@almadar/core 10.129.0 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/behavior-package.d.ts +49 -11
- package/dist/behavior-package.js +1 -1
- package/dist/{orbital-CkFdDS9f.d.ts → builders-BhnofAik.d.ts} +5966 -7116
- package/dist/builders.d.ts +6 -6
- package/dist/builders.js +7 -6
- package/dist/{bus-CcbB__oo.d.ts → bus-BrRFWDQK.d.ts} +270 -354
- package/dist/chunk-347APWFM.js +286 -0
- package/dist/chunk-347APWFM.js.map +1 -0
- package/dist/chunk-3URQAGD7.js +98 -0
- package/dist/chunk-3URQAGD7.js.map +1 -0
- package/dist/chunk-7GHJU5WI.js +39 -0
- package/dist/chunk-7GHJU5WI.js.map +1 -0
- package/dist/chunk-B4MNHGBP.js +8 -0
- package/dist/chunk-B4MNHGBP.js.map +1 -0
- package/dist/{chunk-KDMV222Q.js → chunk-F6KHUW7T.js} +304 -373
- package/dist/chunk-F6KHUW7T.js.map +1 -0
- package/dist/chunk-FGT5OS2Y.js +918 -0
- package/dist/chunk-FGT5OS2Y.js.map +1 -0
- package/dist/chunk-FQLEAMAB.js +24 -0
- package/dist/chunk-FQLEAMAB.js.map +1 -0
- package/dist/chunk-HEXOGHQ4.js +3264 -0
- package/dist/chunk-HEXOGHQ4.js.map +1 -0
- package/dist/chunk-JCD6GLBX.js +412 -0
- package/dist/chunk-JCD6GLBX.js.map +1 -0
- package/dist/{chunk-QUOTJULD.js → chunk-MGLG2XLD.js} +20 -219
- package/dist/chunk-MGLG2XLD.js.map +1 -0
- package/dist/chunk-MTBEBSNO.js +1293 -0
- package/dist/chunk-MTBEBSNO.js.map +1 -0
- package/dist/{chunk-X4SC7FGF.js → chunk-RGACZEYC.js} +99 -96
- package/dist/chunk-RGACZEYC.js.map +1 -0
- package/dist/{chunk-RYPVOI6H.js → chunk-UZPYYI37.js} +524 -26
- package/dist/{chunk-RYPVOI6H.js.map → chunk-UZPYYI37.js.map} +1 -1
- package/dist/chunk-VG7BRFUD.js +152 -0
- package/dist/chunk-VG7BRFUD.js.map +1 -0
- package/dist/chunk-Y2DYZPP5.js +2329 -0
- package/dist/chunk-Y2DYZPP5.js.map +1 -0
- package/dist/chunk-ZEI7C32D.js +1566 -0
- package/dist/chunk-ZEI7C32D.js.map +1 -0
- package/dist/{domain-Dz3jP-UM.d.ts → domain-CfKPpXCP.d.ts} +51 -51
- package/dist/{effect-result-Bebwu9yT.d.ts → effect-result-DPERsn_v.d.ts} +641 -851
- package/dist/{effect-CiEVLsZz.d.ts → effect-wP-IdRt2.d.ts} +236 -443
- package/dist/{expression-D0Fs0riG.d.ts → expression-DirYKz-f.d.ts} +5 -13
- package/dist/factory/index.d.ts +7 -144
- package/dist/factory/index.js +8 -8
- package/dist/factory-runtime/index.d.ts +7 -6
- package/dist/factory-runtime/index.js +527 -8
- package/dist/factory-runtime/index.js.map +1 -1
- package/dist/fixtures.d.ts +9 -11
- package/dist/fixtures.js +12 -8
- package/dist/fixtures.js.map +1 -1
- package/dist/i18n/index.d.ts +15 -19
- package/dist/i18n/index.js +2 -1
- package/dist/{index-BC-Jycqj.d.ts → index-DomgmRBG.d.ts} +29 -729
- package/dist/index.d.ts +69 -247
- package/dist/index.js +322 -986
- package/dist/index.js.map +1 -1
- package/dist/kernel-wire.d.ts +3 -3
- package/dist/kernel-wire.js +3 -79
- package/dist/kernel-wire.js.map +1 -1
- package/dist/language/constructs.json +22 -2
- package/dist/language/program-types.json +203 -22
- package/dist/language/protocols.json +46 -0
- package/dist/language/ui-vocabulary.json +1697 -0
- package/dist/language/validation-codes.json +1205 -1215
- package/dist/language/vocabulary.json +44 -8
- package/dist/language-data.d.ts +7 -4
- package/dist/language-data.js +20 -14
- package/dist/language-data.js.map +1 -1
- package/dist/patterns/component-mapping.json +11 -1
- package/dist/patterns/definitions.d.ts +2 -2
- package/dist/patterns/definitions.js +1 -1
- package/dist/patterns/event-contracts.json +1 -15
- package/dist/patterns/index.d.ts +24 -120
- package/dist/patterns/index.js +3 -3
- package/dist/patterns/patterns-registry.json +522 -24
- package/dist/patterns/registry.json +522 -24
- package/dist/trait-CzG9M89M.d.ts +3519 -0
- package/dist/types/index.d.ts +9 -10
- package/dist/types/index.js +11 -5
- package/dist/{types-DGwrltUF.d.ts → types-BHlTjwWd.d.ts} +3 -3
- package/fixtures/events-wire/client-effects-by-trait/response.json +0 -18
- package/fixtures/events-wire/client-effects-provenance/response.json +0 -18
- package/fixtures/events-wire/effect-results-every-kind/response.json +2 -27
- package/fixtures/events-wire/navigate-1/response.json +8 -5
- package/fixtures/events-wire/navigate-2/response.json +11 -8
- package/fixtures/events-wire/navigate-3/response.json +14 -11
- package/fixtures/events-wire/navigate-back/response.json +7 -4
- package/fixtures/events-wire/render-ui-3/response.json +12 -9
- package/fixtures/events-wire/render-ui-clear/response.json +0 -7
- package/fixtures/events-wire/sse-stream/response.json +0 -20
- package/fixtures/events-wire/sse-stream/stream.json +0 -20
- package/fixtures/events-wire/stateless-traits/response.json +14 -5
- package/fixtures/kernel-wire/golden/basic-entity.json +1687 -0
- package/fixtures/kernel-wire/golden/entity-rerender.json +743 -0
- package/fixtures/kernel-wire/golden/rollback.json +793 -0
- package/fixtures/kernel-wire/golden/tick-counter.json +1538 -0
- package/fixtures/kernel-wire/golden/two-orbital-chore.json +847 -0
- package/fixtures/kernel-wire/golden/two-orbital-task.json +457 -0
- package/fixtures/kernel-wire/played-step.json +136 -0
- package/fixtures/kernel-wire/scripts/basic-entity.json +28 -0
- package/fixtures/kernel-wire/scripts/entity-rerender.json +13 -0
- package/fixtures/kernel-wire/scripts/rollback.json +53 -0
- package/fixtures/kernel-wire/scripts/tick-counter.json +26 -0
- package/fixtures/kernel-wire/scripts/two-orbital-chore.json +9 -0
- package/fixtures/kernel-wire/scripts/two-orbital-task.json +9 -0
- package/package.json +28 -19
- package/dist/builders-DmZE5By0.d.ts +0 -2663
- package/dist/chunk-45I2O4SJ.js +0 -4646
- package/dist/chunk-45I2O4SJ.js.map +0 -1
- package/dist/chunk-6LR43Z5E.js +0 -3061
- package/dist/chunk-6LR43Z5E.js.map +0 -1
- package/dist/chunk-GIUA3NUJ.js +0 -809
- package/dist/chunk-GIUA3NUJ.js.map +0 -1
- package/dist/chunk-GTY53NS5.js +0 -1908
- package/dist/chunk-GTY53NS5.js.map +0 -1
- package/dist/chunk-JOHDVS6J.js +0 -1614
- package/dist/chunk-JOHDVS6J.js.map +0 -1
- package/dist/chunk-KDMV222Q.js.map +0 -1
- package/dist/chunk-QRHJUS3D.js +0 -23
- package/dist/chunk-QRHJUS3D.js.map +0 -1
- package/dist/chunk-QUOTJULD.js.map +0 -1
- package/dist/chunk-V5VNGRVU.js +0 -66
- package/dist/chunk-V5VNGRVU.js.map +0 -1
- package/dist/chunk-X4SC7FGF.js.map +0 -1
- package/dist/entityAccess-BPSz1i2n.d.ts +0 -80
- package/dist/mock/index.d.ts +0 -153
- package/dist/mock/index.js +0 -190
- package/dist/mock/index.js.map +0 -1
- package/dist/schema-T5RT5s6H.d.ts +0 -282
- package/dist/state-machine/index.d.ts +0 -359
- package/dist/state-machine/index.js +0 -3
- package/dist/state-machine/index.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/os-grants.ts","../src/types/skeleton.ts","../src/types/state-machine.ts","../src/types/trait.ts","../src/types/page.ts","../src/types/service.ts","../src/types/orbital.ts","../src/types/schema.ts","../src/types/observability.ts","../src/types/bindings.ts","../src/types/binding.ts","../src/types/agent.ts","../src/types/plan.ts","../src/types/interaction-model.ts","../src/types/pattern.ts","../src/types/changeset.ts","../src/service-types.ts","../src/row-predicate.ts","../src/types/ir.ts","../src/types/visit-key.ts","../src/types/dispatch-memory.ts","../src/types/guard-holds.ts","../src/types/verification-ids.json","../src/types/verification.ts","../src/generated/language/validation-codes.json","../src/types/validation.ts","../src/types/living.ts","../src/types/a11y.ts","../src/types/surface.ts","../src/types/canvas-theme.ts","../src/types/behavior-value.ts","../src/types/eval-spec.ts","../src/types/tab-port.ts","../src/types/client-manifest.ts","../src/types/program-machine.ts","../src/types/program-inspection.ts"],"names":["out","z","ref","TraitRefSchema"],"mappings":";;;;;AAOO,IAAM,WAAW,CAAC,MAAA,EAAQ,OAAA,EAAS,QAAA,EAAU,UAAU,MAAM;AAC7D,IAAM,SAAA,GAAY,CAAC,KAAA,EAAO,KAAA,EAAO,QAAQ;AACzC,IAAM,WAAA,GAAc,CAAC,IAAA,EAAM,KAAA,EAAO,KAAK;AACvC,IAAM,YAAY,CAAC,KAAA,EAAO,UAAU,MAAA,EAAQ,SAAA,EAAW,eAAe,UAAU;AAChF,IAAM,gBAAgB,CAAC,QAAA,EAAU,OAAA,EAAS,YAAA,EAAc,UAAU,OAAO;AACzE,IAAM,SAAA,GAAY,CAAC,MAAA,EAAQ,OAAA,EAAS,QAAQ,KAAK,CAAA;AAwCjD,SAAS,aAAA,CAAc,GAAyB,CAAA,EAAmC;AACxF,EAAA,MAAM,OAAO,CAAI,CAAA,EAA6B,MAAqC,CAAC,uBAAO,GAAA,CAAI,CAAC,GAAI,CAAA,IAAK,EAAC,EAAI,GAAI,KAAK,EAAG,CAAC,CAAC,CAAA;AAC5H,EAAA,MAAM,QAAQ,CAAO,CAAA,EAA6B,CAAA,EAA6B,GAAA,EAAuB,OAA+B,IAAA,KAAwC;AAC3K,IAAA,MAAMA,IAAAA,uBAAU,GAAA,EAAe;AAC/B,IAAA,KAAA,MAAW,KAAA,IAAS,CAAC,GAAI,CAAA,IAAK,IAAK,GAAI,CAAA,IAAK,EAAG,CAAA,EAAG;AAChD,MAAA,MAAM,IAAA,GAAOA,IAAAA,CAAI,GAAA,CAAI,GAAA,CAAI,KAAK,CAAC,CAAA;AAC/B,MAAAA,KAAI,GAAA,CAAI,GAAA,CAAI,KAAK,CAAA,EAAG,IAAA,KAAS,SAAY,KAAA,GAAQ,IAAA,CAAK,IAAA,EAAM,IAAA,CAAK,MAAM,IAAI,CAAA,EAAG,M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EAAMA,EAAE,MAAA,EAAO,EAAG,WAAWA,CAAAA,CAAE,MAAA,IAAU,OAAA,EAASA,CAAAA,CAAE,QAAO,EAAG,eAAA,EAAiB,mBAAA,EAAqB,CAAC,CAAA;AAAA,EACjI,IAAA,EAAMA,CAAAA,CAAE,KAAA,CAAM,eAAe,CAAA;AAAA,EAC7B,IAAA,EAAMA,EAAE,MAAA,EAAO;AAAA,EACf,OAAA,EAASA,EAAE,MAAA,EAAO,CAAE,KAAI,CAAE,WAAA,GAAc,QAAA,EAAS;AAAA,EACjD,cAAA,EAAgBA,CAAAA,CAAE,OAAA,CAAQ,gBAAgB,CAAA;AAAA,EAC1C,cAAA,EAAgBA,CAAAA,CAAE,OAAA,CAAQ,aAAa,CAAA;AAAA,EACvC,QAAA,EAAUA,CAAAA,CAAE,OAAA,CAAQ,CAAC,CAAA;AAAA,EACrB,UAAA,EAAYA,CAAAA,CAAE,OAAA,CAAQ,CAAC;AAC3B,CAAC","file":"chunk-45I2O4SJ.js","sourcesContent":["/**\n * OS grants — the program's closed-by-default `os/` permissions.\n * Mirrors `OsGrants` in `orbital-core/crates/base/src/os_grants.rs`.\n */\n\nimport { z } from \"zod\";\n\nexport const FS_MODES = [\"read\", \"write\", \"create\", \"remove\", \"meta\"] as const;\nexport const NET_KINDS = [\"tcp\", \"udp\", \"listen\"] as const;\nexport const STDIO_KINDS = [\"in\", \"out\", \"err\"] as const;\nexport const SYS_KINDS = [\"cpu\", \"memory\", \"disk\", \"network\", \"power-state\", \"identity\"] as const;\nexport const DESKTOP_KINDS = [\"notify\", \"speak\", \"brightness\", \"volume\", \"power\"] as const;\nexport const DEV_KINDS = [\"read\", \"write\", \"wait\", \"ack\"] as const;\n\nexport type FsMode = (typeof FS_MODES)[number];\nexport type NetKind = (typeof NET_KINDS)[number];\nexport type StdioKind = (typeof STDIO_KINDS)[number];\nexport type SysKind = (typeof SYS_KINDS)[number];\nexport type DesktopKind = (typeof DESKTOP_KINDS)[number];\nexport type DevKind = (typeof DEV_KINDS)[number];\n\n/** A path glob and the modes it grants. */\nexport interface FsGrant {\n glob: string;\n modes: FsMode[];\n}\n\n/** An exact `host:port` and the kinds of traffic it grants. */\nexport interface NetGrant {\n target: string;\n kinds: NetKind[];\n}\n\n/** A device resource (`mmio:<base>+<length>` or `irq:<line>`) and the kinds of access it grants. */\nexport interface DevGrant {\n target: string;\n kinds: DevKind[];\n}\n\n/** Every grant a program or orbital declares; an omitted family grants nothing. */\nexport interface OsGrants {\n fs?: FsGrant[];\n exec?: string[];\n net?: NetGrant[];\n env?: string[];\n stdio?: StdioKind[];\n sys?: SysKind[];\n desktop?: DesktopKind[];\n dev?: DevGrant[];\n}\n\n/** Every grant either declares: lists deduplicated in first-seen order, an fs glob or net target named by both with its modes or kinds unioned. */\nexport function unionOsGrants(a: OsGrants | undefined, b: OsGrants | undefined): OsGrants {\n const list = <T>(x: readonly T[] | undefined, y: readonly T[] | undefined): T[] => [...new Set([...(x ?? []), ...(y ?? [])])];\n const keyed = <G, K>(x: readonly G[] | undefined, y: readonly G[] | undefined, key: (g: G) => string, items: (g: G) => readonly K[], make: (g: G, merged: K[]) => G): G[] => {\n const out = new Map<string, G>();\n for (const grant of [...(x ?? []), ...(y ?? [])]) {\n const seen = out.get(key(grant));\n out.set(key(grant), seen === undefined ? grant : make(seen, list(items(seen), items(grant))));\n }\n return [...out.values()];\n };\n const out: OsGrants = {};\n const fs = keyed(a?.fs, b?.fs, (g) => g.glob, (g) => g.modes, (g, modes) => ({ ...g, modes }));\n const net = keyed(a?.net, b?.net, (g) => g.target, (g) => g.kinds, (g, kinds) => ({ ...g, kinds }));\n if (fs.length > 0) out.fs = fs;\n if (net.length > 0) out.net = net;\n const dev = keyed(a?.dev, b?.dev, (g) => g.target, (g) => g.kinds, (g, kinds) => ({ ...g, kinds }));\n if (dev.length > 0) out.dev = dev;\n const exec = list(a?.exec, b?.exec);\n const env = list(a?.env, b?.env);\n const stdio = list(a?.stdio, b?.stdio);\n const sys = list(a?.sys, b?.sys);\n const desktop = list(a?.desktop, b?.desktop);\n if (exec.length > 0) out.exec = exec;\n if (env.length > 0) out.env = env;\n if (stdio.length > 0) out.stdio = stdio;\n if (sys.length > 0) out.sys = sys;\n if (desktop.length > 0) out.desktop = desktop;\n return out;\n}\n\nexport const FsModeSchema = z.enum(FS_MODES);\nexport const NetKindSchema = z.enum(NET_KINDS);\nexport const StdioKindSchema = z.enum(STDIO_KINDS);\nexport const SysKindSchema = z.enum(SYS_KINDS);\nexport const DesktopKindSchema = z.enum(DESKTOP_KINDS);\nexport const DevKindSchema = z.enum(DEV_KINDS);\n\nexport const FsGrantSchema = z.object({\n glob: z.string(),\n modes: z.array(FsModeSchema),\n});\n\nexport const NetGrantSchema = z.object({\n target: z.string(),\n kinds: z.array(NetKindSchema),\n});\n\nexport const DevGrantSchema = z.object({\n target: z.string(),\n kinds: z.array(DevKindSchema),\n});\n\nexport const OsGrantsSchema = z.object({\n fs: z.array(FsGrantSchema).optional(),\n exec: z.array(z.string()).optional(),\n net: z.array(NetGrantSchema).optional(),\n env: z.array(z.string()).optional(),\n stdio: z.array(StdioKindSchema).optional(),\n sys: z.array(SysKindSchema).optional(),\n desktop: z.array(DesktopKindSchema).optional(),\n dev: z.array(DevGrantSchema).optional(),\n});\n\n/** `deployment` — target name to the orbital names deployed there. */\nexport const DeploymentSchema = z.record(z.string(), z.array(z.string()));\nexport type Deployment = z.infer<typeof DeploymentSchema>;\n","/**\n * Awaiting-server skeletons — the platform-neutral contract.\n *\n * A server-backed trait renders through a server round trip (on entering the\n * screen and on events that open a new view). While it waits, an empty slot\n * (or embedded frame) shows a skeleton shaped like what the server WILL render:\n * - every data pattern declares its natural shape as the default of its\n * universal `skeleton` prop, and a `.lolo` element may override it\n * (`skeleton: list`, `skeleton: { variant: table, rows: 6 }`, `skeleton: none`);\n * - orbital-compiler (enrich, resolve/codegen only — never persisted) folds the\n * render a transition's server effects lead to into a `SkeletonNode` and\n * attaches it to the transition as `awaitRender`;\n * - each execution engine marks a trait as awaiting from server-leg send until\n * fold or error (`AwaitingTrait`), and the shell draws the node.\n */\nimport { z } from \"zod\";\n\n/** The skeleton shapes every shell can draw. */\nexport const SKELETON_VARIANTS = [\"header\", \"table\", \"list\", \"grid\", \"detail\", \"stats\", \"form\", \"card\", \"text\"] as const;\nexport type SkeletonVariant = (typeof SKELETON_VARIANTS)[number];\nexport const SkeletonVariantSchema = z.enum(SKELETON_VARIANTS);\n\n/** A sized shape. `rows` for table/list/text, cards for grid, field pairs for detail; `columns` for table/stats; `fields` for form. */\nexport type SkeletonShape = {\n variant: SkeletonVariant;\n rows?: number;\n columns?: number;\n fields?: number;\n};\n\nexport const SkeletonShapeSchema = z.object({\n variant: SkeletonVariantSchema,\n rows: z.number().int().positive().optional(),\n columns: z.number().int().positive().optional(),\n fields: z.number().int().positive().optional(),\n});\n\n/**\n * The universal `skeleton` prop value on a render-ui node: a shape name, a\n * sized shape, or `none` (this element contributes no skeleton).\n */\nexport type SkeletonSpec = SkeletonVariant | \"none\" | SkeletonShape;\n\nexport const SkeletonSpecSchema = z.union([SkeletonVariantSchema, z.literal(\"none\"), SkeletonShapeSchema]);\n\n/** A predicted skeleton: one shape, or a vertical stack of nodes (a container's children). */\nexport type SkeletonNode = { shape: SkeletonShape } | { stack: SkeletonNode[] };\n\nexport const SkeletonNodeSchema: z.ZodType<SkeletonNode> = z.lazy(() =>\n z.union([z.object({ shape: SkeletonShapeSchema }), z.object({ stack: z.array(SkeletonNodeSchema) })]),\n);\n\n/**\n * One predicted render a transition's server effects lead to: `trait` (the seed\n * itself, or a listener reached across the declared listens graph) will render\n * into `slot` something shaped like `skeleton`.\n */\nexport type AwaitRender = {\n trait: string;\n slot: string;\n skeleton: SkeletonNode;\n};\n\nexport const AwaitRenderSchema = z.object({\n trait: z.string(),\n slot: z.string(),\n skeleton: SkeletonNodeSchema,\n});\n\n/**\n * Kernel contract: a non-local trait is awaiting from its server leg's send\n * until the fold (or error), keyed by the transition its local run took.\n * Local/hybrid traits and tick legs are never awaiting.\n */\nexport type AwaitingTrait = {\n trait: string;\n event: string;\n /** `from` state of the transition the local run took (with `event`, identifies its `awaitRender`). */\n from: string;\n};\n","/**\n * State Machine Types (Self-Contained)\n *\n * Defines state machine types for traits.\n * Copied from schema/state-machine.ts to make orbitals/ self-contained.\n *\n * @packageDocumentation\n */\n\nimport { AwaitRenderSchema, type AwaitRender } from \"./skeleton.js\";\nimport { z } from \"zod\";\nimport { FieldProjectionSchema, type FieldProjection } from \"./projection.js\";\nimport type { Effect } from \"./effect.js\";\nimport { EffectSchema } from \"./effect.js\";\nimport type { Expression, SExpr } from \"./expression.js\";\nimport { ExpressionSchema, SExprListSchema, SExprSchema } from \"./expression.js\";\nimport type { EventId } from \"./identity.js\";\nimport { EventIdSchema } from \"./identity.js\";\n\n// ============================================================================\n// State\n// ============================================================================\n\n/**\n * Represents a state in the state machine\n */\nexport type State = {\n /** State name (unique identifier) */\n name: string;\n /** Whether this is the initial state */\n isInitial?: boolean;\n /** Whether this is a terminal state (no outgoing transitions expected) */\n isTerminal?: boolean;\n /** Whether this is a final state (legacy alias for isTerminal) */\n isFinal?: boolean;\n /** Human-readable description */\n description?: string;\n /** Effect names to run on entry */\n onEntry?: string[];\n /** Effect names to run on exit */\n onExit?: string[];\n /** `@holds <expr>`: the trait's `@entity` satisfies it whenever the trait is in this state, proved by `orb validate`. No runtime effect. */\n holds?: SExpr;\n};\n\nexport const StateSchema = z.object({\n name: z.string().min(1, \"State name is required\"),\n isInitial: z.boolean().optional(),\n isTerminal: z.boolean().optional(),\n isFinal: z.boolean().optional(),\n description: z.string().optional(),\n onEntry: z.array(z.string()).optional(),\n onExit: z.array(z.string()).optional(),\n holds: SExprSchema.optional(),\n});\n\n// ============================================================================\n// Event\n// ============================================================================\n\n/**\n * Payload field definition for events\n */\n/**\n * One condition of a payload field's `typeWhen` conditional list: \"when\n * config knob `knob` resolves to the literal whose string spelling is\n * `equals`, this field's type is `type`\". Declared DATA — authored in\n * `.lolo` as a type-level `match` block (§25 — REPLACED the `@typeWhen`\n * annotation spelling outright) — never a compiler-side predicate over a\n * specific knob name. This wire shape is `match`'s lowered form, unchanged.\n * Mirrors Rust `PayloadTypeWhen`.\n */\nexport type PayloadTypeWhen = {\n knob: string;\n equals: string;\n type: string;\n};\n\nexport const PayloadTypeWhenSchema: z.ZodType<PayloadTypeWhen> = z.object({\n knob: z.string().min(1),\n equals: z.string().min(1),\n type: z.string().min(1),\n});\n\nexport type PayloadField = {\n name: string;\n /**\n * Field type. Mirrors the Rust validator's acceptance: any non-empty\n * string. Primitives ('string' | 'number' | 'boolean' | 'object' |\n * 'array') are the canonical values; entity-name references like\n * 'CartItem' and array-of-entity references like '[CartItem]' are also\n * valid because the Rust IR's PayloadField.field_type is just a String.\n */\n type: string;\n required?: boolean;\n nullable?: boolean;\n additionalProperties?: PayloadField;\n /** Closed value set (`\"a\" | \"b\"`) — element-wise for an array type. Mirrors Rust `PayloadField.values`. */\n values?: ReadonlyArray<string>;\n /** Structured property schema for object-typed payload fields (recursive). */\n properties?: ReadonlyArray<PayloadField>;\n /**\n * Declared knob-conditional type list (`match` in `.lolo`, §25). Resolved\n * and cleared once composed — the emitted `.orb` carries only the\n * resolved truth, never the conditional.\n */\n typeWhen?: ReadonlyArray<PayloadTypeWhen>;\n /**\n * The declared entity this field's value IS an instance of — stamped by\n * lowering when an entity-typed payload field (`row: Note`, scalar or\n * `[Note]` array — the array form names the element entity) is flattened\n * into `type: \"object\"`/`\"[object]\"` + `properties`. Mirrors Rust\n * `PayloadField.entity`. Absent for an anonymous struct/object field with\n * no declared entity — never inferred from shape or name.\n */\n entity?: string;\n /**\n * `.lolo` `T.f` / `[T.f]`: the declared field this field's value — each\n * element's, for an array type — was projected from. Mirrors Rust\n * `PayloadField.projected_from`.\n */\n projectedFrom?: FieldProjection;\n /**\n * The element type of an `array` field whose element is itself a typed field (a union of named types:\n * `[(Adv | string)]`), the nested form an entity field's `items` takes. Mirrors Rust `PayloadField.items`.\n */\n items?: PayloadField;\n};\n\n/**\n * The container a payload field's `type` string declares. `[X]` (and the\n * bare `array` primitive) is an array of `X`; `Map<K,V>` carries key/value\n * types; `object` is a plain object;\n * every other spelling — scalars, entity names, `@entity`, type variables,\n * unions — is opaque to a container check.\n */\nexport type PayloadTypeContainer =\n | { kind: 'array'; element: string }\n | { kind: 'map'; key: string; value: string }\n | { kind: 'object' }\n | { kind: 'opaque' };\n\nexport function payloadTypeContainer(type: string): PayloadTypeContainer {\n if (type === 'array') return { kind: 'array', element: '' };\n if (type === 'object') return { kind: 'object' };\n if (type.startsWith('Map<') && type.endsWith('>')) {\n const inner = type.slice(4, -1);\n const comma = inner.indexOf(',');\n if (comma > 0 && comma < inner.length - 1) {\n return { kind: 'map', key: inner.slice(0, comma).trim(), value: inner.slice(comma + 1).trim() };\n }\n }\n if (type.length > 2 && type.startsWith('[') && type.endsWith(']')) {\n return { kind: 'array', element: type.slice(1, -1) };\n }\n return { kind: 'opaque' };\n}\n\nconst payloadFieldShape = {\n type: z.string().min(1),\n required: z.boolean().optional(),\n nullable: z.boolean().optional(),\n additionalProperties: z.lazy(() => PayloadFieldDescriptorSchema).optional(),\n values: z.array(z.string()).optional(),\n properties: z.lazy(() => z.array(PayloadFieldSchema)).optional(),\n typeWhen: z.array(PayloadTypeWhenSchema).optional(),\n entity: z.string().min(1).optional(),\n projectedFrom: FieldProjectionSchema.optional(),\n items: z.lazy(() => PayloadFieldDescriptorSchema).optional(),\n};\n\nconst PayloadFieldDescriptorSchema: z.ZodType<PayloadField> = z.object({\n name: z.string(),\n ...payloadFieldShape,\n});\n\nexport const PayloadFieldSchema: z.ZodType<PayloadField> = z.object({\n name: z.string().min(1),\n ...payloadFieldShape,\n});\n\n/** What an inbound event declares: the hook name it receives and the event whose payload answers the request. */\nexport type InboundDeclaration = {\n name: string;\n answers: string;\n /** The sender check the runtime makes before the handler runs; its result is the payload's `verified`. */\n verifies?: InboundVerification;\n};\n\n/** `verifies \"<header>\" \"<CREDENTIAL>\"`: the request header that must equal the named credential (compared in constant time, never exposed to program data). */\nexport type InboundVerification = {\n header: string;\n credential: string;\n};\n\nexport const InboundVerificationSchema = z.object({\n header: z.string().min(1),\n credential: z.string().min(1),\n});\n\nexport const InboundDeclarationSchema = z.object({\n name: z.string().min(1),\n answers: z.string().min(1),\n verifies: InboundVerificationSchema.optional(),\n});\n\n/**\n * Represents an event that can trigger transitions\n */\nexport type Event = {\n /** Event key (UPPER_SNAKE_CASE) */\n key: string;\n /** V4 dual-carry id sibling of `key` — optional until the Phase-7 flip. */\n id?: EventId;\n /** Human-readable name */\n name: string;\n /** Description (authored `@description` on the emit/listen). */\n description?: string;\n /** User-vocabulary synonyms (comma-separated) — per-event analogue of a\n * field/config `@synonyms`. Feeds the curation event matcher. */\n synonyms?: string;\n /** Authoring tier (`essential`/`customization`/`advanced`/`internal`). */\n tier?: string;\n /** Expected payload structure */\n payloadSchema?: PayloadField[];\n /**\n * The entity this WHOLE payload was declared as (`type X = Event\n * <EntityName>`, the bare/concrete form) — mirrors Rust\n * `EventDefinition.payload_entity` (G4, `Almadar_Compiler_Gaps.md` §82).\n * Distinct from `PayloadField.entity` (a single NESTED field's value is\n * an entity instance): this marks the payload schema ITSELF as a 1:1\n * mirror of that entity's CURRENT fields. Consumed by\n * `resolveTraitTypeParamSentinels` (`resolver/sentinel-resolution.ts`)\n * to re-derive `payloadSchema` from the entity's post-`fields{}`/\n * `extend{}` shape once an orbital-import or trait-reference override\n * has materialized; kept in sync across entity renames the same one\n * owner `PayloadField.entity` already uses\n * (`renamePayloadEntityMarkers`, `reference-resolver.ts`).\n */\n payloadEntity?: string;\n /**\n * A declared input (`listens { EVENT -> input { … } }`): a client\n * outside the program (an API, an agent, an MCP client) may send this event to\n * the trait. Absent = not an input. Mirrors Rust `EventDefinition.input`.\n */\n input?: boolean;\n /**\n * Declared in the trait's own `listens { EVENT … }` block (the local form, input or\n * not): an input the author offers to the program. Absent = not declared there.\n * Mirrors Rust `EventDefinition.listened`.\n */\n listened?: boolean;\n /**\n * A declared inbound delivery (`listens { EVENT -> inbound \"name\" answers ANSWER { … } }`): the\n * host carries the request at `/api/hooks/<name>` and the kernel delivers it to this event; the\n * handler's emit of `answers` (`{ status, body }`) is the HTTP answer. Mirrors Rust\n * `EventDefinition.inbound`.\n */\n inbound?: InboundDeclaration;\n /** Domain vs System classification (optional, for analysis) */\n classification?: \"domain\" | \"system\";\n /** Semantic role of this event (optional, for analysis) */\n semanticRole?: string;\n};\n\nexport const EventSchema = z.object({\n key: z.string().min(1, \"Event key is required\"),\n id: EventIdSchema.optional(),\n name: z.string().min(1, \"Event name is required\"),\n description: z.string().optional(),\n synonyms: z.string().optional(),\n tier: z.string().optional(),\n payloadSchema: z.array(PayloadFieldSchema).optional(),\n payloadEntity: z.string().optional(),\n input: z.boolean().optional(),\n listened: z.boolean().optional(),\n inbound: InboundDeclarationSchema.optional(),\n classification: z.enum([\"domain\", \"system\"]).optional(),\n semanticRole: z.string().optional(),\n});\n\n// ============================================================================\n// Guard\n// ============================================================================\n\n/**\n * Represents a named guard condition.\n * Expression must be an S-expression.\n *\n * @example\n * {\n * name: \"hasHealth\",\n * expression: [\">\", \"@entity.health\", 0],\n * description: \"Check if entity has health remaining\"\n * }\n */\nexport type Guard = {\n name: string;\n /** Guard expression - S-expression array only */\n expression: Expression;\n description?: string;\n};\n\nexport const GuardSchema = z.object({\n name: z.string().min(1, \"Guard name is required\"),\n expression: ExpressionSchema,\n description: z.string().optional(),\n});\n\n// ============================================================================\n// Transition (Effect imported separately to avoid circular deps)\n// ============================================================================\n\n/**\n * Represents a transition between states.\n * Guards and effects must be S-expressions.\n *\n * @example\n * {\n * from: \"idle\",\n * to: \"running\",\n * event: \"START\",\n * guard: [\">\", \"@entity.fuel\", 0],\n * effects: [\n * [\"set\", \"@entity.status\", \"running\"],\n * [\"emit\", \"ENGINE_STARTED\"]\n * ]\n * }\n */\nexport type Transition = {\n /** Source state name */\n from: string;\n /** Target state name */\n to: string;\n /** Event key that triggers this transition */\n event: string;\n /** V4 dual-carry id sibling of `event` — optional until the Phase-7 flip. */\n eventId?: EventId;\n /** Guard expression - S-expression array */\n guard?: Expression | null;\n /** Effects to execute - S-expression arrays */\n effects?: Effect[];\n /** `@ensures <expr>`: the outcome contract owed at this transition (`@fromEntity` is the row before it); proved by `orb validate`, judged by `orb verify`. No runtime effect. */\n ensures?: SExpr[];\n /** Description */\n description?: string | null;\n /**\n * Predicted renders this transition's server effects lead to, used to draw\n * awaiting-server skeletons. Computed by orbital-compiler (enrich) in the\n * resolved schema only — never authored, never persisted in a registry `.orb`.\n */\n awaitRender?: AwaitRender[];\n};\n\nexport const TransitionSchema = z.object({\n from: z.string().min(1, \"Transition source state is required\"),\n to: z.string().min(1, \"Transition target state is required\"),\n event: z.string().min(1, \"Transition event is required\"),\n eventId: EventIdSchema.optional(),\n guard: ExpressionSchema.nullish(),\n effects: z.array(EffectSchema).optional(),\n ensures: SExprListSchema.optional(),\n description: z.string().nullish(),\n awaitRender: z.array(AwaitRenderSchema).optional(),\n});\n\n// ============================================================================\n// State Machine\n// ============================================================================\n\n/**\n * Complete state machine definition\n */\nexport type StateMachine = {\n /** All states in the machine */\n states: State[];\n /** All events that can be triggered */\n events: Event[];\n /** All transitions between states */\n transitions: Transition[];\n /** Named guard definitions */\n guards?: Guard[];\n};\n\nexport const StateMachineSchema = z.object({\n states: z.array(StateSchema).min(1, \"At least one state is required\"),\n events: z.array(EventSchema),\n transitions: z.array(TransitionSchema),\n guards: z.array(GuardSchema).optional(),\n});\n\n// ============================================================================\n// Type exports\n// ============================================================================\n\nexport type StateInput = z.input<typeof StateSchema>;\nexport type EventInput = z.input<typeof EventSchema>;\nexport type GuardInput = z.input<typeof GuardSchema>;\nexport type TransitionInput = z.input<typeof TransitionSchema>;\nexport type StateMachineInput = z.input<typeof StateMachineSchema>;\n\n// ============================================================================\n// Event Utilities\n// ============================================================================\n\n/**\n * Check if an event is a circuit event (not internal/system event).\n * Circuit events are user-defined events that participate in the closed circuit pattern.\n * Internal/system events start with underscore (e.g., _INIT, _TICK, _TIMER).\n *\n * @param {string} event - Event name to check\n * @returns {boolean} true if event is a circuit event (doesn't start with underscore)\n *\n * @example\n * isCircuitEvent('CREATE') // true\n * isCircuitEvent('SAVE') // true\n * isCircuitEvent('_INIT') // false (internal)\n * isCircuitEvent('_TICK') // false (internal)\n */\nexport function isCircuitEvent(event: string): boolean {\n return !event.startsWith('_');\n}\n","/**\n * Trait Types (Self-Contained)\n *\n * Defines trait types for behavioral patterns.\n * Self-contained - imports only from local orbital types.\n *\n * @packageDocumentation\n */\n\nimport { z } from 'zod';\nimport { FieldProjectionSchema, type FieldProjection } from './projection.js';\nimport type { TraitId, EntityId, EventId, PageId, OrbitalId } from './identity.js';\nimport { TraitIdSchema, EntityIdSchema, EventIdSchema, PageIdSchema, OrbitalIdSchema } from './identity.js';\nimport type { StateMachine, PayloadTypeWhen } from './state-machine.js';\nimport { StateMachineSchema, PayloadTypeWhenSchema } from './state-machine.js';\nimport type { Effect } from './effect.js';\nimport { EffectSchema, PatternObjectSchema } from './effect.js';\nimport type { Entity } from './entity.js';\nimport { EntitySchema } from './entity.js';\nimport type { AnyPatternConfig } from '../patterns/index.js';\nimport type { Expression, SExpr } from './expression.js';\nimport { ExpressionSchema, SExprSchema } from './expression.js';\nimport { JsonValueSchema } from './json.js';\nimport { EntityFieldSchema, TypeVariableSchema, type EntityField, type TypeVariable } from './field.js';\n\n// ============================================================================\n// Trait Configuration\n// ============================================================================\n\n/**\n * A single value in a trait's call-site `config: { ... }` block. Supports\n * scalars (string, number, boolean, null), arrays (e.g. `fields: [\"name\",\n * \"description\"]`), and nested objects. This is the authoring surface for\n * molecules to parameterize imported atoms: the atom's render-ui reads back\n * via `@config.<key>` bindings.\n */\nexport type TraitConfigValue =\n | string\n | number\n | boolean\n | null\n | ReadonlyArray<TraitConfigValue>\n | TraitConfigObject;\n\nexport type TraitConfigObject = {\n readonly [key: string]: TraitConfigValue;\n};\n\nexport type TraitConfig = TraitConfigObject;\n\n/** Zod schema for TraitConfig. Recursive via z.lazy to allow nested structures. */\nexport const TraitConfigValueSchema: z.ZodType<TraitConfigValue> = z.lazy(() =>\n z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n z.array(TraitConfigValueSchema),\n z.record(z.string(), TraitConfigValueSchema),\n ])\n);\n\nexport const TraitConfigSchema: z.ZodType<TraitConfig> = z.record(z.string(), TraitConfigValueSchema);\n\n/**\n * A single entry in a call-site `config { }` override block. Either a plain\n * wiring value (`TraitConfigValue` — string, number, bool, array, object) or\n * a fully-annotated re-declaration (`ConfigFieldDeclaration` — carries `type`,\n * optional `label`/`description`/`synonyms`/`tier`). Disambiguated at runtime\n * by `isCallSiteConfigDeclaration`: the presence of a `\"type\"` string key\n * marks the annotated form.\n *\n * The `.orb` compiler emits plain values for wiring entries and\n * `{ type, default, ... }` objects for annotated entries. Consumers that only\n * need the value (e.g. `apply-params-to-orb.ts`) read `entry` directly for\n * primitives or `entry.default` for the declaration form.\n */\nexport type CallSiteConfigEntry = TraitConfigValue | ConfigFieldDeclaration;\n\n/** Typed map of call-site config entries (one per knob). */\nexport type CallSiteConfig = Readonly<Record<string, CallSiteConfigEntry>>;\n\n/**\n * Type guard: returns `true` when `entry` is an annotated `ConfigFieldDeclaration`\n * (a config-field SCHEMA: a `\"type\"` string key AND a `\"default\"` value slot)\n * rather than a plain wiring value or a render value object.\n *\n * The `\"default\"` requirement disambiguates a declaration from a `render-ui`\n * VALUE object (e.g. `{ type: \"tabs\", items: \"@entity.items\", ... }`) that\n * coincidentally carries a UI-component `type` key — such a value has no\n * `default` slot and is a `TraitConfigValue`, not a schema declaration. Every\n * annotated config field lowered from `.lolo` carries a `default`; misreading a\n * render value as a declaration drops it straight into the `config` map where\n * Rust's `serde` rejects its inner fields (e.g. `items` is a binding string,\n * not a `FieldDefinition`).\n */\nexport function isCallSiteConfigDeclaration(\n entry: CallSiteConfigEntry,\n): entry is ConfigFieldDeclaration {\n return (\n typeof entry === 'object' &&\n entry !== null &&\n !Array.isArray(entry) &&\n 'type' in entry &&\n typeof entry.type === 'string' &&\n 'default' in entry\n );\n}\n\n/**\n * Whether a call-site config entry RE-DECLARES its knob (legal for a knob the trait does not\n * declare) rather than setting a value. Twin of orbital-core `ConfigField::is_declaration_form`:\n * a value wrapped as `{ type: 'unknown', default }` (what `mergeCallSiteConfigOverrides` builds)\n * is a value; a typed declaration, or one carrying `label`/`description`/`synonyms`/`tier`, is not.\n */\nexport function isConfigRedeclaration(entry: CallSiteConfigEntry): boolean {\n if (!isCallSiteConfigDeclaration(entry)) return false;\n return (\n entry.type !== 'unknown' ||\n entry.label !== undefined ||\n entry.description !== undefined ||\n entry.synonyms !== undefined ||\n entry.tier !== undefined\n );\n}\n\n/** Metadata keys that only ever appear on a declared config-field SCHEMA\n * (never on a render-value object that merely carries a UI `type` key). */\nconst CONFIG_DECLARATION_META_KEYS = ['label', 'description', 'tier', 'synonyms', 'values'] as const;\n\n/**\n * Type guard: `entry` is a declared config-field SCHEMA — a string `type` plus\n * EITHER a `default` slot OR declaration metadata (`label`/`description`/\n * `tier`/`synonyms`/`values`). Broader than `isCallSiteConfigDeclaration`,\n * which requires a `default`: a field declared with no default (e.g.\n * `leftIcon : icon` → `{ type: \"icon\", label, description, tier }`) is still a\n * schema, and its runtime VALUE is its (absent → `undefined`) default, NOT the\n * schema object itself. A render-value object that coincidentally has a `type`\n * key (e.g. `{ type: \"tabs\", items: … }`) carries none of these metadata keys\n * and is therefore left untouched as a plain value.\n */\nexport function isConfigFieldSchema(entry: CallSiteConfigEntry): entry is ConfigFieldDeclaration {\n if (typeof entry !== 'object' || entry === null || Array.isArray(entry)) return false;\n if (!('type' in entry) || typeof (entry as { type?: TraitConfigValue }).type !== 'string') return false;\n return 'default' in entry || CONFIG_DECLARATION_META_KEYS.some((k) => k in entry);\n}\n\n/**\n * Convert a call-site config map into plain runtime values.\n *\n * A `CallSiteConfig` may contain either plain wiring values\n * (`TraitConfigValue`) or annotated `ConfigFieldDeclaration` objects\n * (`{ type, default, label, ... }`). Both the JS interpreter\n * (`@almadar/runtime`) and the render substrate (`@almadar/ui`) need this\n * extraction, so it lives here — the most-upstream package they share —\n * rather than being duplicated in each.\n *\n * A declared field with no `default` yields no value (dropped), as the\n * kernel reads it. Leaking such a schema object through as a\n * value made `@config.leftIcon` resolve to `{ type: \"icon\", … }`, which the\n * render substrate then mounted as an element and passed to `Input`'s icon\n * slot → \"Element type is invalid: got <SlotContentRenderer />\".\n */\nexport function normalizeCallSiteConfigToValues(\n config: CallSiteConfig | undefined,\n): TraitConfig | undefined {\n if (config === undefined) {\n return undefined;\n }\n\n const out: Record<string, TraitConfigValue> = {};\n let hasAny = false;\n for (const [key, entry] of Object.entries(config)) {\n const value = isConfigFieldSchema(entry)\n ? entry.default\n : entry;\n if (value !== undefined) {\n out[key] = value;\n hasAny = true;\n }\n }\n\n return hasAny ? out : undefined;\n}\n\n/**\n * Merge call-site config overrides onto a base `CallSiteConfig`. Every entry\n * in the result is a `ConfigField` (Rust's `HashMap<String, ConfigField>`):\n * bare values — base AND override — are wrapped as `{ type: 'unknown', default }`\n * when not already a declaration. Override folds into an existing declaration's\n * `default` field.\n */\nexport function mergeCallSiteConfigOverrides(\n base: CallSiteConfig,\n overrides: CallSiteConfig,\n): Record<string, ConfigFieldDeclaration> {\n const next: Record<string, ConfigFieldDeclaration> = {};\n for (const [k, entry] of Object.entries(base)) {\n next[k] = isConfigFieldSchema(entry)\n ? entry\n : { type: 'unknown', default: entry };\n }\n for (const [k, v] of Object.entries(overrides)) {\n if (isCallSiteConfigDeclaration(v)) {\n next[k] = v;\n continue;\n }\n const existing = base[k];\n next[k] = existing !== undefined && isConfigFieldSchema(existing)\n ? { ...existing, default: v }\n : { type: 'unknown', default: v };\n }\n return next;\n}\n\n/**\n * Per-field entry in a trait's DECLARED `config { }` schema as it lives\n * on the `.orb` JSON: `{ type: \"string\" | \"[string]\" | \"object\" | ...,\n * default?: <value> }`. Distinct from `TraitConfigValue` (which is the\n * resolved runtime value). The runtime reads `default` to seed the\n * `@config.X` binding context when no call-site override is supplied.\n *\n * Authored as `config { foo : string = \"bar\" }` in `.lolo`; lowered to\n * `{ foo: { type: \"string\", default: \"bar\" } }` in `.orb`. The optional\n * metadata fields below (`label`/`description`/`tier`/`values`/`synonyms`)\n * carry the `.lolo` `@label`/`@description`/`@tier`/`@synonyms` annotations and\n * the enum member list through lowering — consumed by config-driven UI\n * (e.g. the playground property inspector) to render typed controls.\n */\n/**\n * The reference config-field types (V4-W5). A config knob typed `entity`,\n * `trait`, or `event` holds a REFERENCE (an entity/trait/event name), not a\n * plain value — so the stamp records the referenced node's id on the field\n * (`ConfigFieldDeclaration.refId`) and both execution paths resolve the value to\n * the node's CURRENT name by id, exactly like `entityRefIds`/`traitEmbedIds`.\n * This is the deterministic, source-tagged contract that lets a declaration-only\n * rename flow through a config value without any name-scanning heuristic.\n */\nexport const REFERENCE_CONFIG_TYPES = ['entity', 'trait', 'event'] as const;\nexport type ReferenceConfigType = (typeof REFERENCE_CONFIG_TYPES)[number];\n\n/** True when a config field's `type` marks its value as an entity/trait/event reference. */\nexport function isReferenceConfigType(type: string): type is ReferenceConfigType {\n return (REFERENCE_CONFIG_TYPES as readonly string[]).includes(type);\n}\n\n/**\n * The secret config-field types. A config knob typed `secret` holds a\n * credential REFERENCE (an env-var key name for `resolveCredentialRef`) —\n * and, as defense-in-depth against a host wrongly inlining material, its\n * VALUE must never flow into spec.json, traces, plan snapshots, or factory\n * bakes in cleartext: consumers mask it (see `maskSecretConfigValues`) and\n * UI password-renders the knob. `.lolo` accepts `: secret` as a config-field\n * type (I-29, 2026-08-23 — previously the parser silently read it as a\n * meaningless named type); this contract is the single deterministic source\n * downstream consumers (studio, verifiers, rabit bakes) key on.\n */\nexport const SECRET_CONFIG_TYPES = ['secret'] as const;\nexport type SecretConfigType = (typeof SECRET_CONFIG_TYPES)[number];\n\n/** True when a config field's `type` marks its value as a credential to be masked. */\nexport function isSecretConfigType(type: string): type is SecretConfigType {\n return (SECRET_CONFIG_TYPES as readonly string[]).includes(type);\n}\n\n/**\n * Return `values` with every `secret`-declared field's string value masked to\n * its last 4 characters (shorter values fully masked). Non-secret fields and\n * non-string values pass through untouched. Use before echoing call-site\n * config into traces, spec snapshots, or logs.\n */\nexport function maskSecretConfigValues(\n config: DeclaredTraitConfig,\n values: TraitConfig,\n): TraitConfig {\n const masked: Record<string, TraitConfigValue> = {};\n for (const [key, value] of Object.entries(values)) {\n const decl = config[key];\n if (decl !== undefined && isSecretConfigType(decl.type) && typeof value === 'string' && value.length > 0) {\n masked[key] = value.length > 4 ? `••••${value.slice(-4)}` : '••••';\n } else {\n masked[key] = value;\n }\n }\n return masked;\n}\n\n/**\n * A `trait`-typed knob's override may spell the unbound sentinel as the bare\n * `none` — `orbital-lolo`'s plain-wiring grammar has no static type at the\n * call site, so it lowers `none` to the literal string `\"none\"` like any\n * other identifier. This is the one place the field's declared `type` is\n * known, so it is where the string is canonicalized to `null` — the\n * language's single \"unbound\" representation for a `trait`-typed knob\n * (owner ruling 2026-09-13), mirroring the compiler's\n * `canonicalize_unbound_trait_override` (`orbital-compiler/src/phases/\n * inline/trait.rs`). A no-op for every other type or value.\n */\nfunction canonicalizeUnboundTraitOverride(fieldType: string, value: TraitConfigValue): TraitConfigValue {\n return fieldType === 'trait' && value === 'none' ? null : value;\n}\n\n/**\n * Fold an override value map onto a `DeclaredTraitConfig`'s per-knob\n * `default`, mirroring the compiler's `ORB_O_CONFIG_UNKNOWN_KEY` check.\n * Single owner for the factory-runtime overlay (`applyParamsToOrb` folding\n * `OrbitalFactoryParams.config`) and the runtime's `OrbitalRefObject.config`\n * fold (`reference-resolver.ts`) — same operation, two call sites.\n *\n * Throws when `overrides` names a key `declared` does not declare. Callers\n * validate the override keys against the manifest / upstream config first\n * (`validateOrbitalFactoryParams`, the resolver's own pre-check), so this is\n * a should-never-happen guard, not a user-facing error path.\n */\nexport function overrideDeclaredKnobs(\n declared: DeclaredTraitConfig,\n overrides: Readonly<Record<string, TraitConfigValue>>,\n): DeclaredTraitConfig {\n const out: Record<string, ConfigFieldDeclaration> = { ...declared };\n for (const key of Object.keys(overrides)) {\n const field = declared[key];\n if (field === undefined) {\n throw new Error(\n `overrideDeclaredKnobs: config override \"${key}\" is not a declared knob ` +\n `(ORB_O_CONFIG_UNKNOWN_KEY). Declared: ${Object.keys(declared).join(', ') || '(none)'}`,\n );\n }\n out[key] = { ...field, default: canonicalizeUnboundTraitOverride(field.type, overrides[key]) };\n }\n return out;\n}\n\nexport type ConfigFieldDeclaration = {\n readonly nullable?: boolean;\n readonly additionalProperties?: EntityField;\n readonly type: string;\n readonly default?: TraitConfigValue;\n /**\n * V4-W5 dual-carry id — set by the stamp when `type` is a reference config\n * type (`entity`/`trait`/`event`): the stable id of the entity/trait/event\n * the field's value names. Readers resolve the value to that node's current\n * name by id (rename-proof); absent for non-reference fields.\n */\n readonly refId?: string;\n /** Marks the knob as mandatory at every call site (own-page binding exempt). `required` + `default` may coexist — the default only serves the trait's own demo page. */\n readonly required?: boolean;\n /** `@label` — human-readable control label. */\n readonly label?: string;\n /** `@description` — help/tooltip text for the field. */\n readonly description?: string;\n /** `@tier` — disclosure tier: `presentation`|`domain`|`policy`|`infra`|`internal`. */\n readonly tier?: string;\n /** Enum members when the field's type is a string union — drives a select control. */\n readonly values?: ReadonlyArray<string>;\n /** `@synonyms` — comma-separated vocabulary synonyms (metadata). */\n readonly synonyms?: string;\n /** Structured per-item schema for array-of-object fields — `edges : [{from: string!, …}]` in `.lolo` lowers to `{ type: \"object\", properties: {…} }`. */\n readonly items?: ConfigFieldItemsDeclaration;\n /** Structured property schema for object-typed config fields (no items wrapper). */\n readonly properties?: Readonly<Record<string, TraitEntityField>>;\n /**\n * Provenance for a collapsed knob forward. The L2 inline phase (and the\n * runtime resolver) fold a trait's `default: \"@config.<knob>\"` (or a\n * call-site override of the same shape) down to the resolved value, so\n * the resolved schema no longer carries the literal `@config.<knob>`\n * token anywhere. `forwardedFrom` records that token — the original\n * app/orbital-level knob name this field's value came from — so a\n * dead-knob check (`ORB_O_CONFIG_DEAD_KNOB` / `orbital-config-knob-unforwarded`)\n * can still recognize the knob as forwarded on an already-resolved\n * schema. Absent when the field's `default`/value was authored directly\n * (not a forward), or on an unresolved schema where the `@config.<knob>`\n * token itself is still present.\n */\n readonly forwardedFrom?: string;\n /**\n * The `@config.<knob>` tokens nested INSIDE this field's value (an array\n * element or object member, e.g. `metrics[].target`) that the resolver\n * folded to their values — the list twin of `forwardedFrom`, so the\n * dead-knob check still sees those knobs as read. Absent when nothing\n * nested resolved. Compiled-path wire key `nestedForwardedFrom`.\n */\n readonly nestedForwardedFrom?: ReadonlyArray<string>;\n /**\n * The definer knob this field is the payload companion of, when its\n * declared type was `@payload(<knob>)`: the L2 sigil pass rewrites the\n * sentinel to the resolved payload type and records the knob here, the\n * same way `forwardedFrom` keeps a provenance the resolved `default` /\n * `type` can no longer show. Absent for any field that was never a\n * `@payload(<knob>)` sentinel. Compiled-path wire key `payloadFor`.\n */\n readonly payloadFor?: string;\n /** `.lolo` `T.f`: the declared field this knob's type was projected from. */\n readonly projectedFrom?: FieldProjection;\n /** `field R T`: the record `R` as a type string (`@entity`, `@payload(knob)`, an entity or alias name, `$r`). */\n readonly record?: string;\n};\n\nexport type ConfigFieldItemsDeclaration = {\n readonly nullable?: boolean;\n readonly additionalProperties?: EntityField;\n readonly type?: string;\n /** Absent for arrays of scalars (`items: { type: \"string\" }`). */\n readonly properties?: Readonly<Record<string, TraitEntityField>>;\n /** Nested per-item schema for arrays of arrays (recursive). */\n readonly items?: ConfigFieldItemsDeclaration;\n /** Union member names when the item type is a union — including a by-name recursive back-reference. */\n readonly values?: ReadonlyArray<string>;\n};\n\nexport const ConfigFieldItemsDeclarationSchema: z.ZodType<ConfigFieldItemsDeclaration, object> = z.lazy(() =>\n z.object({\n nullable: z.boolean().optional(),\n additionalProperties: EntityFieldSchema.optional(),\n type: z.string().optional(),\n properties: z.record(z.string(), TraitEntityFieldSchema).optional(),\n items: ConfigFieldItemsDeclarationSchema.optional(),\n values: z.array(z.string()).optional(),\n }),\n);\n\nexport const ConfigFieldDeclarationSchema: z.ZodType<ConfigFieldDeclaration, object> = z.object({\n nullable: z.boolean().optional(),\n additionalProperties: EntityFieldSchema.optional(),\n type: z.string(),\n default: TraitConfigValueSchema.optional(),\n refId: z.string().optional(),\n required: z.boolean().optional(),\n label: z.string().optional(),\n description: z.string().optional(),\n tier: z.string().optional(),\n values: z.array(z.string()).optional(),\n synonyms: z.string().optional(),\n items: ConfigFieldItemsDeclarationSchema.optional(),\n properties: z.lazy(() => z.record(z.string(), TraitEntityFieldSchema)).optional(),\n forwardedFrom: z.string().optional(),\n nestedForwardedFrom: z.array(z.string()).optional(),\n payloadFor: z.string().optional(),\n projectedFrom: FieldProjectionSchema.optional(),\n record: z.string().optional(),\n});\n\n/**\n * Map of declared config fields keyed by name. Lives on `Trait.config`\n * and `ResolvedTrait.config` for atoms/molecules that expose typed\n * configuration to consumers.\n */\nexport type DeclaredTraitConfig = Readonly<Record<string, ConfigFieldDeclaration>>;\n\nexport const DeclaredTraitConfigSchema: z.ZodType<DeclaredTraitConfig, Record<string, object>> = z.record(z.string(),\n ConfigFieldDeclarationSchema,\n);\n\n// ============================================================================\n// Trait Entity Field (simplified)\n// ============================================================================\n\n/**\n * Field types for trait data entities\n */\n// `trait` / `slot` / `pattern` mirror Rust's `FieldType::{Trait, Slot, Pattern}`\n// (orbital-core schema/types.rs) — config-field-only types: a `@trait.X`\n// embed slot, a UI slot name, a pattern type name.\n// `union` is the closed variant type — a real .lolo/.orb type, so the\n// trait-side mirror must carry it or generated factories fail DTS.\nexport type TraitFieldType = 'string' | 'number' | 'boolean' | 'date' | 'array' | 'object' | 'timestamp' | 'datetime' | 'instant' | 'enum' | 'email' | 'url' | 'phone' | 'uuid' | 'image' | 'bytes' | 'trait' | 'slot' | 'pattern' | 'node' | 'event' | 'EventAddress' | 'CallKey' | 'SExpr' | 'union' | 'tuple' | 'field' | TypeVariable;\n\n/** Every `TraitFieldType`, as a runtime array — the ONE list `TraitEntityFieldSchema`\n * and `RequiredFieldSchema` both read. Two separate inline copies of this enum had\n * already fallen behind the TS type twice (`node` missing, then `union`\n * missing) — mirrors the `FIELD_TYPES` fix for `FieldType` in `field.ts`. */\nexport const TRAIT_FIELD_TYPES = [\n 'string',\n 'number',\n 'boolean',\n 'date',\n 'array',\n 'object',\n 'timestamp',\n 'datetime',\n 'instant',\n 'enum',\n 'email',\n 'url',\n 'phone',\n 'uuid',\n 'image',\n 'bytes',\n 'trait',\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 TraitFieldType[];\n\n/**\n * Simplified field for trait data entities\n */\nexport type TraitEntityField = {\n nullable?: boolean;\n additionalProperties?: EntityField;\n name: string;\n type: TraitFieldType;\n required?: boolean;\n /** Field default parsed from `.orb` — always a JSON-shaped value. */\n default?: TraitConfigValue;\n values?: string[];\n /** Structured per-item schema for array-of-object fields (recursive). */\n items?: ConfigFieldItemsDeclaration;\n /** Structured property schema for object-typed entity fields. */\n properties?: Readonly<Record<string, TraitEntityField>>;\n};\n\nexport const TraitEntityFieldSchema: z.ZodType<TraitEntityField, object> = z.object({\n nullable: z.boolean().optional(),\n additionalProperties: EntityFieldSchema.optional(),\n name: z.string().min(1),\n type: z.union([z.enum(TRAIT_FIELD_TYPES), TypeVariableSchema]),\n required: z.boolean().optional(),\n default: TraitConfigValueSchema.optional(),\n values: z.array(z.string()).optional(),\n items: ConfigFieldItemsDeclarationSchema.optional(),\n properties: z.lazy(() => z.record(z.string(), TraitEntityFieldSchema)).optional(),\n});\n\n// ============================================================================\n// Trait Data Entity\n// ============================================================================\n\n/**\n * Simplified data entity for traits\n */\nexport type TraitDataEntity = {\n name: string;\n collection?: string;\n fields: TraitEntityField[];\n timestamps?: boolean;\n description?: string;\n runtime?: boolean;\n singleton?: boolean;\n pages?: string[];\n};\n\nexport const TraitDataEntitySchema = z.object({\n name: z.string().min(1),\n collection: z.string().optional(),\n fields: z.array(TraitEntityFieldSchema).min(1),\n timestamps: z.boolean().optional(),\n description: z.string().optional(),\n runtime: z.boolean().optional(),\n singleton: z.boolean().optional(),\n pages: z.array(z.string()).optional(),\n});\n\n// ============================================================================\n// Trait Tick\n// ============================================================================\n\n/**\n * Tick rule for traits.\n * Guards can be legacy strings or S-expressions.\n * Effects can be typed Effect objects or S-expressions.\n */\nexport type TraitTick = {\n name: string;\n description?: string;\n priority?: number;\n interval: string | number;\n appliesTo?: string[];\n /** `[background]`: runs with no client mounted; otherwise paused while no client has the trait mounted. */\n runsInBackground?: boolean;\n /** `[visible]`: a browser tick that pauses while its trait's rendered output is off screen. */\n whileVisible?: boolean;\n pages?: string[];\n /** V4 dual-carry id sibling of `pages` — optional until the Phase-7 flip. */\n pageIds?: PageId[];\n /** Guard expression - string (legacy) or S-expression array */\n guard?: Expression;\n /** Effects to execute (S-expressions) */\n effects: Effect[];\n /**\n * Events this tick emits.\n * Must reference events defined in trait's emits array.\n * Used for validation and documentation.\n */\n emits?: string[];\n /** V4 dual-carry id sibling of `emits` — optional until the Phase-7 flip. */\n emitIds?: EventId[];\n};\n\n/** `\"500ms\"` / `\"5s\"` / `\"1m\"` / `\"1h\"` / `\"1d\"` — the duration form both schedulers parse. */\nconst DURATION_INTERVAL = /^\\d+(ms|s|m|h|d)$/;\n/** A 5-field cron expression, e.g. `\"0 9 * * *\"`. */\nconst CRON_INTERVAL = /^\\S+(\\s+\\S+){4}$/;\n\n/**\n * A tick's cadence: `\"frame\"`, a positive number of milliseconds, a duration\n * string, or a cron expression.\n *\n * This schema previously accepted only `\"frame\"` or a number, while `TraitTick`\n * declared `string | number` and BOTH schedulers already parsed durations and cron\n * (`OrbitalServerRuntime.registerTick` → `isValidCronExpression`/\n * `parseDurationString`; Rust `TickScheduler::parse_interval` → `cron::parse_cron`).\n * The gate therefore rejected every cron/duration tick before its runtime could\n * run it — `std-data-erasure`'s hourly `executionScan` made the whole orbital\n * unloadable in the interpreter with only `traits.N: Invalid input` to go on.\n */\nexport const TickIntervalSchema = z.union([\n z.literal('frame'),\n z.number().positive(),\n z.string().refine((v) => DURATION_INTERVAL.test(v) || CRON_INTERVAL.test(v), {\n message:\n 'interval must be \"frame\", a positive number of milliseconds, a duration (\"500ms\"/\"5s\"/\"1m\"/\"1h\"/\"1d\"), or a 5-field cron expression (\"0 9 * * *\")',\n }),\n]);\n\nexport const TraitTickSchema = z.object({\n name: z.string().min(1),\n description: z.string().optional(),\n priority: z.number().optional(),\n interval: TickIntervalSchema,\n appliesTo: z.array(z.string()).optional(),\n runsInBackground: z.boolean().optional(),\n whileVisible: z.boolean().optional(),\n pages: z.array(z.string()).optional(),\n pageIds: z.array(PageIdSchema).optional(),\n guard: ExpressionSchema.optional(),\n effects: z.array(EffectSchema).min(1),\n emits: z.array(z.string()).optional(),\n emitIds: z.array(EventIdSchema).optional(),\n});\n\n// ============================================================================\n// Event Scope\n// ============================================================================\n\n/**\n * Event scope determines visibility:\n * - 'internal': Trait-to-trait within same orbital (default)\n * - 'external': Exposed for cross-orbital communication\n */\nexport type EventScope = 'internal' | 'external';\n\nexport const EventScopeSchema = z.enum(['internal', 'external']);\n\n// ============================================================================\n// Event Payload Field\n// ============================================================================\n\n/**\n * Payload field definition for events.\n * Defines the structure of data carried by events.\n */\nexport type EventPayloadField = {\n /** Field name */\n name: string;\n /**\n * Field type. Any non-empty string, mirroring the Rust validator's\n * acceptance (Zod schema below uses `z.string().min(1)`). Well-known\n * values include the primitives (`string`, `number`, `boolean`,\n * `object`, `array`, `entity`), date variants (`date`, `datetime`,\n * `timestamp`), entity-name references (`User`), and array-of-entity\n * shorthand (`[User]`). Narrowing happens at the call sites that care\n * (e.g. `orbital-compiler/phases/validation/emit_payload.rs`), not at\n * the structural type level — this keeps `.orb`-emitted payloads\n * round-trippable through TypeScript without losing precision.\n */\n type: string;\n /** Whether field is required in payload */\n required?: boolean;\n nullable?: boolean;\n additionalProperties?: EventPayloadField;\n /** Closed value set (`\"a\" | \"b\"`) — element-wise for an array type. */\n values?: ReadonlyArray<string>;\n /** Human-readable description */\n description?: string;\n /** For 'entity' type: the entity type name */\n entity?: string;\n /** Structured property schema for object-typed payload fields (recursive). */\n properties?: ReadonlyArray<EventPayloadField>;\n /**\n * Declared knob-conditional type list (`match` in `.lolo`, §25 —\n * REPLACED the `@typeWhen` annotation spelling outright) — see\n * `PayloadTypeWhen` in `state-machine.ts`. Resolved and cleared once\n * composed; the emitted `.orb` carries only the resolved truth.\n */\n typeWhen?: ReadonlyArray<PayloadTypeWhen>;\n /** `.lolo` `T.f` / `[T.f]`: the declared field this value — each element's, for an array — was projected from. */\n projectedFrom?: FieldProjection;\n /** The element type of an `array` field whose element is itself a typed field (`[(Adv | string)]`). */\n items?: EventPayloadField;\n};\n\nconst eventPayloadFieldShape = {\n /**\n * Field type. Mirrors the Rust validator's acceptance: any non-empty\n * string. Primitives ('string' | 'number' | 'boolean' | 'object' |\n * 'array') are the canonical values; entity-name references like\n * 'ModalRecord' and array-of-entity references like '[ModalRecord]'\n * are also valid because the Rust IR's PayloadField.field_type is\n * just a String. Only enforced narrowly at the call site (e.g.\n * emit-literal type-mismatch warnings in\n * orbital-compiler/phases/validation/emit_payload.rs) — not here.\n */\n type: z.string().min(1),\n required: z.boolean().optional(),\n nullable: z.boolean().optional(),\n additionalProperties: z.lazy(() => EventPayloadTypeMemberSchema).optional(),\n values: z.array(z.string()).optional(),\n description: z.string().optional(),\n entity: z.string().optional(),\n properties: z.lazy(() => z.array(EventPayloadFieldSchema)).optional(),\n typeWhen: z.array(PayloadTypeWhenSchema).optional(),\n projectedFrom: FieldProjectionSchema.optional(),\n items: z.lazy(() => EventPayloadTypeMemberSchema).optional(),\n};\n\nexport const EventPayloadTypeMemberSchema: z.ZodType<EventPayloadField> = z.object({\n name: z.string(),\n ...eventPayloadFieldShape,\n});\n\nexport const EventPayloadFieldSchema: z.ZodType<EventPayloadField> = z.object({\n name: z.string().min(1),\n ...eventPayloadFieldShape,\n});\n\n// ============================================================================\n// Trait Event Contract\n// ============================================================================\n\n/**\n * Event contract for events a trait emits.\n * Declares the event name, scope, and payload schema.\n */\nexport type TraitEventContract = {\n /** Event name (UPPER_SNAKE_CASE) */\n event: string;\n /** V4 dual-carry id sibling of `event` — optional until the Phase-7 flip. */\n eventId?: EventId;\n /** Human-readable description */\n description?: string;\n /** User-vocabulary synonyms (comma-separated) — the per-event analogue of a\n * field/config `@synonyms`. Feeds the curation event matcher. */\n synonyms?: string;\n /** Authoring tier (`essential`/`customization`/`advanced`/`internal`). */\n tier?: string;\n /**\n * The config knob whose value DEFINES this event's name, when the emit was\n * authored as `emits { @config.<knob> }`. Captured at L1, where the\n * `@config.X` spelling still exists — after inlining, `event` holds the\n * resolved literal and the fact that it came from a knob is otherwise\n * unrecoverable.\n *\n * A definer knob CREATES an event name rather than referencing one, which\n * is why consumers must not pin such a knob to the trait's existing event\n * vocabulary: doing so forbids the very name it exists to introduce.\n */\n definerKnob?: string;\n /**\n * `true` when `scope` was set by a CALL-SITE `emitsScope` override (the\n * inline phase applies it), not by the source atom's own `-> external`\n * declaration. An atom declaring its emits external is an unexamined\n * default (nearly every atom does), while a composition restating it is\n * the consumer's own deferral — the dead-control check honours it as an\n * exemption. See ORB-X-EXTERNAL-EMIT-EXEMPTION.\n */\n scopeOverridden?: boolean;\n /** Payload schema — declarative type info for the event's payload.\n * Distinct from the runtime payload value (`@payload.X` bindings,\n * `EventPayload`) which is a separate concept. */\n payloadSchema?: EventPayloadField[];\n /**\n * Same marker as `Event.payloadEntity` (`state-machine.ts`) — this\n * emit's payload was declared `type X = Event <EntityName>` and is a\n * flat mirror of that entity's fields. See that field's doc for the\n * full contract (G4, `Almadar_Compiler_Gaps.md` §82).\n */\n payloadEntity?: string;\n /**\n * Event scope:\n * - 'internal': Trait-to-trait within same orbital (default)\n * - 'external': Exposed for cross-orbital communication\n */\n scope?: EventScope;\n};\n\n/**\n * `@config.<knob>` is the only legal reference form for an emit/listen\n * event name (Option B — the declared event name resolves to a\n * `string`- or `event`-typed config knob's value at inline/resolve time).\n * Matches the Rust lexer's dotted-sigil body (`config.<ident>`, no further\n * dots).\n */\nexport const CONFIG_REF_EVENT_PATTERN = /^@config\\.[A-Za-z_][A-Za-z0-9_]*$/;\n\n/** Returns the knob identifier when `event` is a `@config.<knob>` reference, else `undefined`. */\nexport function configRefEventKnob(event: string): string | undefined {\n return CONFIG_REF_EVENT_PATTERN.test(event) ? event.slice('@config.'.length) : undefined;\n}\n\n/** Why a `@config.<knob>` emit/listen event-name reference failed to resolve. */\nexport type ConfigRefEventError = 'unknown-knob' | 'not-string' | 'no-default';\n\n/**\n * Resolve a `@config.<knob>` emit/listen event-name reference to its\n * concrete literal, given the trait's declared config schema and the\n * effective config value map (call-site override folded over declared\n * default — same precedence the Rust inline phase's `effective_config`\n * uses). The single JS-side owner of this resolution rule; mirrors\n * `resolve_config_ref_event_name` in `orbital-core::schema` (Rust).\n * Returns the resolved literal, or the specific contract clause that failed.\n */\nexport function resolveConfigRefEventName(\n event: string,\n declaredConfig: DeclaredTraitConfig | undefined,\n effectiveConfig: Readonly<Record<string, TraitConfigValue>>,\n): { readonly ok: true; readonly value: string } | { readonly ok: false; readonly error: ConfigRefEventError } {\n const knob = configRefEventKnob(event);\n if (knob === undefined) return { ok: false, error: 'unknown-knob' };\n const field = declaredConfig?.[knob];\n if (field === undefined) return { ok: false, error: 'unknown-knob' };\n // A-UNIFY: definer knobs (whose value CREATES the event name) spell\n // `: event` same as reference knobs — the declared field type is\n // `'string' | 'event'`, the VALUE still must be a plain string literal.\n if (field.type !== 'string' && field.type !== 'event') return { ok: false, error: 'not-string' };\n if (field.default === undefined) return { ok: false, error: 'no-default' };\n const value = effectiveConfig[knob];\n if (typeof value !== 'string') return { ok: false, error: 'not-string' };\n return { ok: true, value };\n}\n\nexport const TraitEventContractSchema = z.object({\n /**\n * Event name. Mirrors the Rust validator's `is_valid_event_identifier`:\n * starts with a letter, then any letters / digits / underscores. Both\n * UPPER_SNAKE_CASE and PascalCase shapes are valid identifiers in the\n * post-Phase 2.5 nominal-event type system (events declared via\n * `type X = Event<T>`). A pre-resolution `@config.<knob>` reference\n * (Option B) is also legal — inline/resolve substitutes it with the\n * knob's effective literal before codegen/runtime consume it.\n */\n event: z.string().min(1).regex(\n /^([A-Za-z][A-Za-z0-9_]*|@config\\.[A-Za-z_][A-Za-z0-9_]*)$/,\n 'Event name must start with a letter and contain only letters, digits, and underscores, or be a `@config.<knob>` reference'\n ),\n eventId: EventIdSchema.optional(),\n description: z.string().optional(),\n synonyms: z.string().optional(),\n tier: z.string().optional(),\n definerKnob: z.string().optional(),\n scopeOverridden: z.boolean().optional(),\n payloadSchema: z.array(EventPayloadFieldSchema).optional(),\n payloadEntity: z.string().optional(),\n scope: EventScopeSchema.optional(),\n});\n\n// ============================================================================\n// Trait Event Listener\n// ============================================================================\n\n/**\n * Event listener for trait communication.\n * Guards can be legacy strings or S-expressions.\n * Enhanced with scope and payloadMapping for cross-orbital communication.\n */\n/**\n * Source-scoping for a `listens {}` entry. Determines which emitters the\n * listener responds to.\n *\n * - `{ kind: \"any\" }`: wildcard (`* EVENT -> TRIGGER`). Any trait, any orbital.\n * - `{ kind: \"trait\", trait: \"X\" }`: intra-orbital (`X EVENT -> TRIGGER`).\n * Only emits from the same orbital's trait `X`.\n * - `{ kind: \"orbital\", orbital: \"O\", trait: \"X\" }`: cross-orbital\n * (`O.X EVENT -> TRIGGER`). Only emits from orbital `O`'s trait `X`.\n *\n * Absent (undefined) means the listener is a local payload-declaration only\n * — pure type metadata, no bus subscription.\n */\nexport type ListenSource =\n | { kind: 'any' }\n | {\n kind: 'trait';\n trait: string;\n /** V4 dual-carry id sibling of `trait` — optional until the Phase-7 flip. */\n traitId?: TraitId;\n }\n | {\n kind: 'orbital';\n orbital: string;\n trait: string;\n /** V4 dual-carry id sibling of `orbital` — optional until the Phase-7 flip. */\n orbitalId?: OrbitalId;\n /** V4 dual-carry id sibling of `trait` — optional until the Phase-7 flip. */\n traitId?: TraitId;\n };\n\nexport const ListenSourceSchema = z.union([\n z.object({ kind: z.literal('any') }),\n z.object({\n kind: z.literal('trait'),\n trait: z.string().min(1),\n traitId: TraitIdSchema.optional(),\n }),\n z.object({\n kind: z.literal('orbital'),\n orbital: z.string().min(1),\n trait: z.string().min(1),\n orbitalId: OrbitalIdSchema.optional(),\n traitId: TraitIdSchema.optional(),\n }),\n]);\n\n/**\n * Split a `listens`-addressed event (`EVENT`, `Trait.EVENT`, `*.EVENT`,\n * `Orbital.Trait.EVENT`) into the bare event and its source. The one parser of\n * the address form, shared by `listens` and event-typed values. Mirrors\n * `orbital-core` `split_event_address`.\n */\nexport function splitEventAddress(raw: string): { event: string; source?: ListenSource } {\n const parts = raw.split('.');\n if (parts.length <= 1) return { event: raw };\n if (parts.length === 2) {\n const [src, event] = parts;\n return src === '*'\n ? { event, source: { kind: 'any' } }\n : { event, source: { kind: 'trait', trait: src } };\n }\n const n = parts.length;\n return {\n event: parts[n - 1],\n source: { kind: 'orbital', orbital: parts.slice(0, n - 2).join('.'), trait: parts[n - 2] },\n };\n}\n\n/** Inverse of {@link splitEventAddress}. */\nexport function joinEventAddress(event: string, source?: ListenSource): string {\n if (source === undefined) return event;\n switch (source.kind) {\n case 'any':\n return `*.${event}`;\n case 'trait':\n return `${source.trait}.${event}`;\n case 'orbital':\n return `${source.orbital}.${source.trait}.${event}`;\n }\n}\n\nexport type TraitEventListener = {\n /** Event key to listen for (bare event name, no source prefix in the new shape) */\n event: string;\n /** V4 dual-carry id sibling of `event` — optional until the Phase-7 flip. */\n eventId?: EventId;\n /** State machine event to trigger */\n triggers: string;\n /** V4 dual-carry id sibling of `triggers` — optional until the Phase-7 flip. */\n triggersId?: EventId;\n /** Human-readable description (authored `@description` on the listen). */\n description?: string;\n /** User-vocabulary synonyms (comma-separated). */\n synonyms?: string;\n /** Authoring tier (`essential`/`customization`/`advanced`/`internal`). */\n tier?: string;\n /** Guard expression - string (legacy) or S-expression array */\n guard?: Expression;\n /**\n * Listener scope:\n * - 'internal': Listen to events within same orbital (default)\n * - 'external': Listen to events from other orbitals\n */\n scope?: EventScope;\n /**\n * `with { ... }` payload rewrite: `{ targetField: SExpr }`. Each value is a\n * full s-expression evaluated against the source payload — a `@payload.<field>`\n * read, a literal, or an operator list. The kernel applies it\n * (`applyListenMapping` crosses into it).\n */\n payloadMapping?: Record<string, SExpr>;\n /**\n * Source scoping (see `ListenSource`). Undefined when the listen entry is\n * a local payload declaration rather than a bus subscription.\n */\n source?: ListenSource;\n};\n\nexport const TraitEventListenerSchema = z.object({\n event: z.string().min(1),\n eventId: EventIdSchema.optional(),\n triggers: z.string().min(1),\n triggersId: EventIdSchema.optional(),\n description: z.string().optional(),\n synonyms: z.string().optional(),\n tier: z.string().optional(),\n guard: ExpressionSchema.optional(),\n scope: EventScopeSchema.optional(),\n payloadMapping: z.record(z.string(), SExprSchema).optional(),\n source: ListenSourceSchema.optional(),\n});\n\n// ============================================================================\n// Required Field\n// ============================================================================\n\n/**\n * Field required by a trait from its linkedEntity\n */\nexport type RequiredField = {\n name: string;\n type: TraitFieldType;\n description?: string;\n};\n\nexport const RequiredFieldSchema = z.object({\n name: z.string().min(1),\n type: z.union([z.enum(TRAIT_FIELD_TYPES), TypeVariableSchema]),\n description: z.string().optional(),\n});\n\n// ============================================================================\n// Trait Reference\n// ============================================================================\n\n/**\n * Reference to a trait from an entity or page.\n *\n * Phase F treats a trait reference as a function call: `ref` names the\n * imported trait and the sibling fields are arguments. The compiler's\n * identifier-substitution pass uses these arguments to rewrite the\n * inlined trait clone before lowering.\n */\nexport type TraitReference = {\n ref: string;\n /** V4 dual-carry id sibling of `ref` — optional until the Phase-7 flip. */\n refId?: TraitId;\n /**\n * V4 LOCAL DECLARATION id — the identity of this trait AS DECLARED in its\n * orbital (`trait X = Alias.traits.Y` declares node X; `refId` carries\n * Y's id). Minted by the stamp so page trait refs and `@trait.X` embeds\n * resolve by id across `name:` renames (the composed-organism surface was\n * the one declaration class without an id).\n */\n id?: TraitId;\n /**\n * Phase 1.2: optional registry path disambiguator. Pairs with `ref` to\n * explicitly name which `uses` entry the alias was imported from\n * (e.g. \"std/behaviors/atoms/std-browse\"). Helpful for programmatic\n * descriptor construction and inline-phase disambiguation when multiple\n * registries expose the same alias prefix.\n */\n from?: string;\n linkedEntity?: string;\n /** V4 dual-carry id sibling of `linkedEntity` — optional until the Phase-7 flip. */\n linkedEntityId?: EntityId;\n /** Phase F: rename the inlined trait at the call site */\n name?: string;\n /** Phase F: rename atom event keys at the call site, e.g. {OPEN: \"ADD_ITEM\"} */\n events?: Record<string, string>;\n /**\n * 3-II trait type-parameter arguments (`:: p SomeType` in `.lolo`):\n * declared-param name → type-vocabulary name (an entity, a primitive incl.\n * `scalar`, or a struct alias from the AUTHORING file's `types` map).\n * Present on pre-inline registry references only — the inline phase\n * consumes it while resolving `$<name>` payload sentinels and it never\n * appears in a final composed `.orb`.\n */\n typeArgs?: Record<string, string>;\n /** Preprocess-output carrier: the fully resolved trait this reference stands\n * for (`@almadar/runtime` `preprocessSchema` output only; never in a `.orb`). */\n _resolved?: Trait;\n /** V4 dual-carry id sibling of `events` (keys = baked event names resolved to ids) — optional until the Phase-7 flip. */\n eventIds?: Record<string, EventId>;\n /**\n * Entity-field remap: rewrite the inlined trait's canonical `@entity.X` /\n * `@payload.row.X` field references to the consumer entity's field names,\n * e.g. `{ name: \"title\", folder: \"parentId\" }`. Mirrors `events` for\n * fields. Applied during inline substitution alongside `linkedEntity`.\n */\n fields?: Record<string, string>;\n /**\n * Call-site config overrides. Each entry is either a plain wiring value\n * (`TraitConfigValue`) or a fully-annotated re-declaration\n * (`ConfigFieldDeclaration` with `type`, optional `label`/`description`/\n * `synonyms`/`tier`). Use `isCallSiteConfigDeclaration` to discriminate.\n *\n * Plain wiring (existing callers): `config: { icon: \"star\", count: 5 }`.\n * Annotated (new): `config: { icon: { type: \"string\", default: \"star\",\n * label: \"Icon\", tier: \"presentation\" } }`.\n */\n config?: CallSiteConfig;\n appliesTo?: string[];\n /**\n * Phase F.7: replace the imported trait's `listens` array with the\n * caller-supplied list. Empty array clears all upstream listens. The\n * inliner applies this AFTER substitution, overwriting whatever the\n * upstream declared. Use sparingly: this drops external event wiring.\n */\n listens?: TraitEventListener[];\n /**\n * Phase F.7: set every emit's `scope` to the caller-supplied value.\n * `'internal'` confines emits to the orbital's internal bus; `'external'`\n * broadcasts them. Applied after substitution and listens replacement.\n */\n emitsScope?: 'internal' | 'external';\n /**\n * Phase F.8: per-transition effects override. The map's keys are event\n * names (the transition triggers, AFTER any rename via `events`). The\n * values are the SExpression effect lists that REPLACE the matching\n * transitions' `effects[]` arrays.\n *\n * This is the unified content + effect override mechanism. Whether the\n * override list contains `[\"render-ui\", ...]` (visual content),\n * `[\"fetch\", ...]` (data load), `[\"persist\", ...]` (mutation), or any\n * combination, the inliner just substitutes the whole list. Identifier\n * substitution (entity refs, event refs) still runs over the merged\n * trait body, so override effects can use either upstream or caller\n * identifiers and the F.3 walker will rewrite them consistently.\n *\n * Example:\n * ```json\n * \"effects\": {\n * \"ADD_ITEM\": [\n * [\"fetch\", \"CartItem\"],\n * [\"render-ui\", \"main\", { ... }]\n * ],\n * \"SAVE\": [\n * [\"persist\", \"create\", \"CartItem\", \"@payload.data\"]\n * ]\n * }\n * ```\n */\n effects?: Record<string, SExpr[]>;\n};\n\n/** The reference object's fields, before the `events` refinement (so other shapes can `.pick` from it). */\nexport const TraitReferenceObjectSchema = z\n .object({\n ref: z.string().min(1),\n refId: TraitIdSchema.optional(),\n // V4 local declaration id (see the interface doc) — declared so the\n // strip-mode zod gate carries it through instead of dropping it.\n id: TraitIdSchema.optional(),\n // Phase 1.2: optional registry path disambiguator, pairs with `ref`.\n from: z.string().optional(),\n linkedEntity: z.string().optional(),\n linkedEntityId: EntityIdSchema.optional(),\n name: z.string().optional(),\n events: z\n .record(\n z.string().min(1, \"events key (atom event name) must be non-empty\"),\n z.string().min(1, \"events value (caller event name) must be non-empty\"),\n )\n .optional(),\n eventIds: z.record(z.string().min(1), EventIdSchema).optional(),\n _resolved: z.lazy(() => TraitSchema).optional(),\n // 3-II type-parameter arguments (see `TraitReference.typeArgs`).\n typeArgs: z\n .record(\n z.string().min(1, \"typeArgs key (declared param name) must be non-empty\"),\n z.string().min(1, \"typeArgs value (type name) must be non-empty\"),\n )\n .optional(),\n fields: z\n .record(\n z.string().min(1, \"fields key (canonical field name) must be non-empty\"),\n z.string().min(1, \"fields value (consumer field name) must be non-empty\"),\n )\n .optional(),\n // Each value is either a plain wiring value (TraitConfigValue) or an\n // annotated ConfigFieldDeclaration. Declaration form is tried first\n // (it's more specific — has a `\"type\"` string key); plain values fall\n // through to the recursive TraitConfigValue union.\n config: z.record(z.string(), z.union([ConfigFieldDeclarationSchema, TraitConfigValueSchema])).optional(),\n appliesTo: z.array(z.string()).optional(),\n // Phase F.7: caller-supplied listen entries are already-resolved\n // structured definitions (see `TraitReference.listens`).\n listens: z.array(TraitEventListenerSchema).optional(),\n emitsScope: z.enum(['internal', 'external']).optional(),\n // Phase F.8: per-transition effects override. The keys are event\n // names (the transition triggers AFTER renames); values are SExpr\n // effect tuples.\n effects: z\n .record(\n z.string().min(1, \"effects override key (event name) must be non-empty\"),\n z.array(SExprSchema),\n )\n .optional(),\n });\n\nexport const TraitReferenceSchema = TraitReferenceObjectSchema\n .refine(\n (ref) => {\n if (!ref.events) return true;\n // Phase F.4: reject empty event-name strings on either side of\n // every entry. The substitution pass treats empty strings as\n // no-ops at runtime, but accepting them at the schema boundary\n // hides authoring errors. The per-entry .min(1) above already\n // rejects most cases; this refine is the belt-and-braces check\n // that survives any future relaxation of the inner validators.\n for (const [from, to] of Object.entries(ref.events)) {\n if (from.length === 0 || to.length === 0) return false;\n }\n return true;\n },\n {\n message:\n 'TraitReference \"events\" entries must have non-empty atom and caller event names',\n path: [\"events\"],\n },\n );\n\n/**\n * Simplified trait reference - supports string, reference object, or inline Trait definition\n * - string: \"TraitName\" - reference to a trait by name\n * - { ref: \"TraitName\" }: reference object with optional config / overrides\n * - { name: \"TraitName\", stateMachine: {...} }: inline trait definition\n *\n * Phase F adds `name` and `events` to the reference object form so callers\n * can rename the trait and remap atom event keys.\n */\n/** A trait in an orbital: a bare name, a reference (the full `TraitReference` the wire carries), or an inline trait. */\nexport type TraitRef = string | TraitReference | Trait;\n\n// TraitRefSchema is defined after TraitSchema (see below) to avoid forward reference\n\n// ============================================================================\n// Trait UI Binding\n// ============================================================================\n\nexport type PresentationType = 'modal' | 'drawer' | 'popover' | 'inline' | 'confirm-dialog';\n\nexport type TraitUIBinding = {\n [stateName: string]: {\n presentation: PresentationType;\n content: AnyPatternConfig | AnyPatternConfig[];\n props?: {\n size?: 'sm' | 'md' | 'lg' | 'xl' | 'full';\n position?: 'left' | 'right' | 'top' | 'bottom' | 'center';\n title?: string;\n closable?: boolean;\n width?: string;\n showProgress?: boolean;\n step?: number;\n totalSteps?: number;\n };\n };\n};\n\n/**\n * Zod schema for {@link TraitUIBinding}. `content` is a pattern config (or\n * list of them), validated as pattern objects by {@link PatternObjectSchema}\n * (the registry checks props at validate time).\n */\nexport const TraitUIBindingSchema = z.record(z.string(),\n z.object({\n presentation: z.enum(['modal', 'drawer', 'popover', 'inline', 'confirm-dialog']),\n content: z.union([PatternObjectSchema, z.array(PatternObjectSchema)]),\n props: z\n .object({\n size: z.enum(['sm', 'md', 'lg', 'xl', 'full']).optional(),\n position: z.enum(['left', 'right', 'top', 'bottom', 'center']).optional(),\n title: z.string().optional(),\n closable: z.boolean().optional(),\n width: z.string().optional(),\n showProgress: z.boolean().optional(),\n step: z.number().optional(),\n totalSteps: z.number().optional(),\n })\n .optional(),\n }),\n);\n\n// ============================================================================\n// Trait Definition\n// ============================================================================\n\n/**\n * A Trait is a reusable behavioral module with state machine.\n *\n * Traits declare their event contracts via `emits` and `listens`:\n * - `emits`: Events this trait can emit (with scope and payload schema)\n * - `listens`: Events this trait listens for (with optional payloadMapping)\n */\n/**\n * Inferred field contract for a `@rebindable` trait binding. `requires` =\n * entity fields the trait READS via `@entity.<field>`; `provides` = fields it\n * WRITES via `(set @entity.<field> ...)`. A consumer that rebinds the trait\n * (`linkedEntity`) must point at an entity whose fields ⊇ `requires`. Inferred\n * by the lolo lowerer from the trait's own SExpr usage; the orbital-rust L2\n * validator enforces it (`ORB_T_REBIND_MISSING_FIELDS`). Mirrors the Rust\n * `EntityFieldContract` serde shape exactly.\n */\nexport type EntityFieldContract = {\n requires: string[];\n provides: string[];\n};\n\nexport const EntityFieldContractSchema = z.object({\n requires: z.array(z.string()),\n provides: z.array(z.string()),\n});\n\n/**\n * Where in a trait an effect is declared. The distinction is load-bearing: a\n * `render-ui` in a transition fires when that transition fires, but one inside a\n * `ticks` block repaints every frame, so two tick writers on one slot paint\n * together where two transition writers routinely alternate.\n */\nexport type EffectSite = 'transition' | 'tick';\n\nexport const EffectSiteSchema = z.enum(['transition', 'tick']);\n\n/**\n * One effect a trait produces, with the resource it acts on — the slot for\n * `render-ui`, the entity for `persist`/`fetch`, the event for `emit`, the\n * binding path for `set`. `resource` is recorded verbatim as authored; when the\n * author deferred it to a call site (`@config.surface`) the reference is kept as\n * written and `resolved` is false. Mirrors the Rust `EffectUse` serde shape.\n */\nexport type EffectUse = {\n kind: string;\n resource?: string;\n /** Absent means true — only an unresolved `@config.*` resource sets it. */\n resolved?: boolean;\n /** Absent means `'transition'`. */\n site?: EffectSite;\n};\n\nexport const EffectUseSchema = z.object({\n kind: z.string(),\n resource: z.string().optional(),\n resolved: z.boolean().optional(),\n site: EffectSiteSchema.optional(),\n});\n\n/**\n * Every effect a trait produces — what composing it actually brings along.\n *\n * Inferred by the lolo lowerer from the trait's own effects (never authored, the\n * way {@link EntityFieldContract} is never authored), then re-derived\n * post-inline once call-site config makes `@config.*` resources concrete. A\n * trait's type used to say nothing about its effects, which is why \"is this safe\n * to compose?\" could only be answered by reading the atom.\n */\nexport type EffectRow = EffectUse[];\n\nexport const EffectRowSchema = z.array(EffectUseSchema);\n\n/**\n * Client dispatch strategy for a trait's transitions — the ONE rule,\n * computed from declared facts only, never inferred from a trait's effects\n * (`docs/Almadar_LOLO.md` §7). Mirrors `orbital-core`'s\n * `runtime::dispatch_mode::DispatchMode` serde shape exactly (the enum both\n * `OirTrait::dispatch_mode` (compiled path) and `TraitDefinition::dispatch_mode`\n * (runtime kernel) return) — same variant spellings, so a value round-trips\n * on the wire unchanged.\n */\nexport type DispatchMode = 'persistedAwaited' | 'hybridClientOnly' | 'runtimeOptimistic';\n\nexport const DispatchModeSchema = z.enum(['persistedAwaited', 'hybridClientOnly', 'runtimeOptimistic']);\n\n/** The `[client]` / `[optimistic]` / `[server]` trait-header word; absent = server dispatch, `server` is the explicit spelling that overrides an atom's mode. Mirrors Rust `DispatchMode` (serde lowercase). */\nexport type TraitDispatchMode = 'client' | 'optimistic' | 'server';\n\nexport const TraitDispatchModeSchema = z.enum(['client', 'optimistic', 'server']);\n\nexport type Trait = {\n /** V4 dual-carry id sibling of `name` — optional until the Phase-7 flip. */\n id?: TraitId;\n name: string;\n description?: string;\n description_visual_prompt?: string;\n /**\n * Opt-in marker authored as `-> @rebindable Entity` in `.lolo`. When\n * `true`, a consuming molecule/organism may rebind this trait's entity via\n * `linkedEntity`; otherwise the binding is fixed and the validator rejects\n * any rebind (`ORB_T_ENTITY_NOT_REBINDABLE`). Absent on traits that don't\n * bind an entity.\n */\n entityRebindable?: boolean;\n /**\n * Inferred field contract a rebind target must satisfy. Emitted only\n * alongside `entityRebindable: true`. See {@link EntityFieldContract}.\n */\n entityContract?: EntityFieldContract;\n /**\n * Inferred effect surface. Absent on traits that produce no effects at all.\n * See {@link EffectRow}.\n */\n effectRow?: EffectRow;\n /**\n * `@description \"...\"` authored on the `@rebindable` binding in `.lolo`.\n * Surfaced to catalog prose + knob-embeddings so the LLM can reach for the\n * binding from intent vocabulary (binding-discovery). Absent when unmarked.\n */\n entityBindingDescription?: string;\n /** `@synonyms \"...\"` authored on the `@rebindable` binding in `.lolo`. */\n entityBindingSynonyms?: string;\n /**\n * Dispatch mode authored as `[client]` / `[optimistic]` / `[server]` on the `.lolo` trait\n * header. Absent means server dispatch. Mirrors the Rust\n * `TraitDefinition.dispatch` field; never inferred from effects.\n */\n dispatch?: TraitDispatchMode;\n /**\n * The entity this trait is linked to.\n * Required for inline trait definitions within an orbital.\n */\n linkedEntity?: string;\n /** V4 dual-carry id sibling of `linkedEntity` — optional until the Phase-7 flip. */\n linkedEntityId?: EntityId;\n /**\n * V4 leverage-ids — id side-map for `@entity.<Name>` binding tokens + positional\n * entity args (`fetch`/`ref`/`persist`/`spawn`) in this trait's guards/effects/\n * ticks/listens. Maps the referenced entity NAME → its stable id, so readers\n * resolve these bare-string positions by id (else name) and an entity rename never\n * strands them — the coverage that lets the entity name-rewriter be deleted.\n */\n entityRefIds?: Record<string, EntityId>;\n /**\n * V4 leverage-ids — id side-map for `@trait.<Name>` embed tokens (render-ui embeds /\n * effect-tree sibling refs). Maps the embed token NAME → the embedded trait's stable\n * id, so readers splice embeds by id (else name) — the coverage that lets the\n * `@trait.` name-rewriter be deleted.\n */\n traitEmbedIds?: Record<string, TraitId>;\n requiredFields?: RequiredField[];\n dataEntities?: TraitDataEntity[];\n stateMachine?: StateMachine;\n initialEffects?: Effect[];\n ticks?: TraitTick[];\n /**\n * Events this trait emits.\n * Each event can be scoped as internal or external.\n * External events are namespaced at orbital level (TraitName.EVENT_NAME).\n */\n emits?: TraitEventContract[];\n /**\n * Events this trait listens for.\n * External listeners reference namespaced events (TraitName.EVENT_NAME).\n */\n listens?: TraitEventListener[];\n /**\n * `events { ACTION: CONFIRM_VOID }` — the call-site rename map that binds a\n * pattern's own event slot (the key, e.g. a Button's `ACTION`) to the app\n * event it fires (the value). Emitted into the IR by the inliner and read\n * by wiring analysis: without it, an affordance whose event lives here\n * rather than in the render payload looks like it fires nothing.\n */\n events?: Readonly<Record<string, string>>;\n ui?: TraitUIBinding;\n /**\n * Declared `config { }` schema authored on the trait. Drives\n * `@config.X` substitution: each field's `default` seeds the\n * binding context behind any caller-supplied call-site\n * `config: { ... }` override.\n */\n config?: DeclaredTraitConfig;\n /**\n * Set by the resolve/inline phase when this trait was cloned from a\n * `uses[]` import. Absent for traits authored directly on the\n * orbital. Viewport-only metadata — runtime and codegen ignore it.\n * Drives Studio's L2 grouping (imported traits collapse under one\n * card per alias) and L3 drill (alias → that behavior's transitions).\n */\n sourceBehavior?: SourceBehaviorMetadata;\n sourceDeclaration?: SourceDeclarationMetadata;\n /**\n * Set by the resolve/inline phase alongside `sourceBehavior`. Carries\n * the resolved `Entity` definition of the imported behavior so the\n * client-side mock-data generator can produce rows for the trait's\n * `linkedEntity` without re-walking the import graph at runtime.\n */\n sourceEntityDefinition?: Entity;\n /**\n * Increment 3-II: this trait's own declared type parameters. Present\n * only on an atom's DECLARING inline trait (never authored on a\n * reference); survives cloning into a consumer's composed schema.\n */\n typeParams?: TraitTypeParamDef[];\n};\n\n/**\n * Provenance attached to a trait that was cloned from a `uses[]` import\n * during the inline phase. The resolved schema carries this so Studio\n * can group L2 cards by source behavior and offer an L3 drill into the\n * import's own transitions.\n */\nexport type SourceBehaviorMetadata = {\n /** Behavior name (e.g. \"std-stat-card\") — the resolved `from:` value. */\n behavior: string;\n /** Alias used at the import site (e.g. \"Stat\"). Multiple imports of\n * the same atom group by alias, not by behavior. */\n alias: string;\n /** Original trait name inside the imported behavior, before any\n * call-site `name:` rename. */\n originalName: string;\n};\n\nexport type SourceDeclarationMetadata = {\n traitId: string;\n fingerprint: string;\n};\n\nexport const SourceDeclarationMetadataSchema = z.object({\n traitId: z.string().min(1),\n fingerprint: z.string().min(1),\n});\n\nexport const SourceBehaviorMetadataSchema = z.object({\n behavior: z.string().min(1),\n alias: z.string().min(1),\n originalName: z.string().min(1),\n});\n\n/**\n * One trait-level type parameter — `(V : Type, R : Type)` in\n * `trait Name (V : Type, R : Type) -> Entity { ... }`. Present only on an\n * atom's DECLARING inline trait; survives cloning into a consumer's composed\n * schema so the inline phase can read each param's `kind` when resolving a\n * surviving `\"$<name>\"` payload sentinel. `kind` is one of the six alias\n * type-parameter kind names (`Type`, `Entity`, `Trait`, `Page`, `Orbital`,\n * `Event`) — in practice `Type` and `Entity` are the two meaningful kinds\n * for a trait param today.\n */\nexport type TraitTypeParamDef = {\n name: string;\n kind: string;\n /**\n * Declaration default (`(r : Type = <name>)`) — a primitive name (incl.\n * `scalar`), an entity name, or a struct-alias name, all resolved in\n * the atom's own file. Consulted only when no call-site `::` arg was\n * supplied (and, for Entity-kind, only when `linkedEntity` also gave no\n * default).\n */\n default?: string;\n};\n\nexport const TraitTypeParamDefSchema: z.ZodType<TraitTypeParamDef> = z.object({\n name: z.string().min(1),\n kind: z.string().min(1),\n default: z.string().optional(),\n});\n\nexport const TraitSchema = z.object({\n id: TraitIdSchema.optional(),\n name: z.string().min(1),\n description: z.string().optional(),\n description_visual_prompt: z.string().optional(),\n entityRebindable: z.boolean().optional(),\n entityContract: EntityFieldContractSchema.optional(),\n effectRow: EffectRowSchema.optional(),\n entityBindingDescription: z.string().optional(),\n entityBindingSynonyms: z.string().optional(),\n dispatch: TraitDispatchModeSchema.optional(),\n linkedEntity: z.string().optional(),\n linkedEntityId: EntityIdSchema.optional(),\n entityRefIds: z.record(z.string().min(1), EntityIdSchema).optional(),\n traitEmbedIds: z.record(z.string().min(1), TraitIdSchema).optional(),\n requiredFields: z.array(RequiredFieldSchema).optional(),\n dataEntities: z.array(TraitDataEntitySchema).optional(),\n stateMachine: StateMachineSchema.optional(),\n initialEffects: z.array(EffectSchema).optional(),\n ticks: z.array(TraitTickSchema).optional(),\n emits: z.array(TraitEventContractSchema).optional(),\n listens: z.array(TraitEventListenerSchema).optional(),\n /** Call-site rename map (`events { ACTION: CONFIRM_VOID }`) — mirrors `Trait.events`. */\n events: z.record(z.string().min(1), z.string().min(1)).optional(),\n ui: TraitUIBindingSchema.optional(),\n config: DeclaredTraitConfigSchema.optional(),\n sourceBehavior: SourceBehaviorMetadataSchema.optional(),\n sourceDeclaration: SourceDeclarationMetadataSchema.optional(),\n sourceEntityDefinition: EntitySchema.optional(),\n typeParams: z.array(TraitTypeParamDefSchema).optional(),\n});\n\n// TraitRefSchema defined here after TraitSchema to avoid forward reference.\n//\n// The reference arm IS `TraitReferenceSchema` — one schema for one shape. It\n// used to be a narrower hand-rolled copy (`ref`/`config`/`linkedEntity`/`name`/\n// `events` only), and because `z.object()` STRIPS undeclared keys rather than\n// rejecting them, every `.orb` that came through the loader's `safeParse` lost\n// `id`, `refId`, `linkedEntityId`, `listens`, `emitsScope`, `effects`, `fields`\n// and `eventIds` on every trait ref — silently, with a schema that reported\n// success. An atom's own sub-view refs (`trait DenseTableView =\n// TableView.traits.TableViewRender -> BrowseItem { listens {…} }`) arrived with\n// no listens at all, so the interpreted path could not wire what the compiled\n// path wires from the same file.\nexport const TraitRefSchema = z.union([\n z.string().min(1),\n TraitReferenceSchema,\n TraitSchema, // Allow inline trait definitions\n]);\n\n// ============================================================================\n// Helper Functions\n// ============================================================================\n\n/**\n * Check if a trait ref is an inline Trait definition\n */\n/**\n * Checks if a trait reference is an inline trait definition.\n * \n * Type guard to determine if a TraitRef is an inline trait object\n * (with 'name' property) rather than a string reference or object reference.\n * \n * @param {TraitRef} traitRef - Trait reference to check\n * @returns {boolean} True if traitRef is an inline trait, false otherwise\n * \n * @example\n * isInlineTrait({ name: 'MyTrait' }); // returns true (inline)\n * isInlineTrait('MyTrait'); // returns false (string reference)\n * isInlineTrait({ ref: 'MyTrait' }); // returns false (object reference)\n */\nexport function isInlineTrait(traitRef: TraitRef): traitRef is Trait {\n return typeof traitRef === 'object' && 'name' in traitRef && !('ref' in traitRef);\n}\n\n/**\n * Extracts the trait name from a trait reference.\n * \n * Handles all trait reference formats (string, inline object, object reference)\n * and returns the canonical trait name.\n * \n * @param {TraitRef} traitRef - Trait reference to extract name from\n * @returns {string} Trait name\n * \n * @example\n * getTraitName('MyTrait'); // returns 'MyTrait'\n * getTraitName({ name: 'MyTrait' }); // returns 'MyTrait'\n * getTraitName({ ref: 'MyTrait' }); // returns 'MyTrait'\n */\nexport function getTraitName(traitRef: TraitRef): string {\n if (typeof traitRef === 'string') {\n return traitRef;\n }\n if (isInlineTrait(traitRef)) {\n return traitRef.name;\n }\n return traitRef.ref;\n}\n\n/**\n * Extracts the configuration from a trait reference.\n * \n * Returns the configuration object for trait references that support it\n * (object references with 'config' property). Returns undefined for\n * string references and inline traits.\n * \n * @param {TraitRef} traitRef - Trait reference to extract config from\n * @returns {TraitConfig | undefined} Trait configuration or undefined\n *\n * @example\n * getTraitConfig('MyTrait'); // returns undefined\n * getTraitConfig({ name: 'MyTrait' }); // returns undefined\n * getTraitConfig({ ref: 'MyTrait', config: { option: 'value' } }); // returns config object\n */\nexport function getTraitConfig(traitRef: TraitRef): CallSiteConfig | undefined {\n if (typeof traitRef === 'string') {\n return undefined;\n }\n if (isInlineTrait(traitRef)) {\n return undefined; // Inline traits don't have config\n }\n return traitRef.config;\n}\n\n/**\n * Normalizes a trait reference to object form.\n * \n * Converts any trait reference format (string, inline, object) to a\n * standardized object format with 'ref' and optional 'config' properties.\n * \n * @param {TraitRef} traitRef - Trait reference to normalize\n * @returns {{ ref: string; config?: TraitConfig }} Normalized trait reference\n *\n * @example\n * normalizeTraitRef('MyTrait'); // returns { ref: 'MyTrait' }\n * normalizeTraitRef({ name: 'MyTrait' }); // returns { ref: 'MyTrait' }\n * normalizeTraitRef({ ref: 'MyTrait', config: {...} }); // returns original\n */\nexport function normalizeTraitRef(traitRef: TraitRef): { ref: string; config?: CallSiteConfig } {\n if (typeof traitRef === 'string') {\n return { ref: traitRef };\n }\n if (isInlineTrait(traitRef)) {\n return { ref: traitRef.name };\n }\n return traitRef;\n}\n\n// ============================================================================\n// Type exports\n// ============================================================================\n\nexport type TraitInput = z.input<typeof TraitSchema>;\nexport type TraitReferenceInput = z.input<typeof TraitReferenceSchema>;\n\n// Backward compatibility aliases\nexport type OrbitalTraitRef = TraitRef;\nexport const OrbitalTraitRefSchema = TraitRefSchema;\n","/**\n * Page Types for Orbital Units\n *\n * Defines OrbitalPage type for pages within an Orbital Unit.\n *\n * IMPORTANT: Trait-driven UI architecture requires pages to have traits.\n * Static sections are NO LONGER SUPPORTED.\n *\n * @packageDocumentation\n */\n\nimport { z } from 'zod';\nimport type { PageId, TraitId, EntityId } from './identity.js';\nimport { PageIdSchema, TraitIdSchema, EntityIdSchema } from './identity.js';\nimport { TraitConfigSchema, type TraitConfig } from './trait.js';\nimport { SExprSchema, type SExpr } from './expression.js';\n\n// ============================================================================\n// View Type\n// ============================================================================\n\n/**\n * Page view types.\n * Note: viewType may be deprecated in favor of trait-driven UI.\n */\nexport type ViewType = 'list' | 'detail' | 'create' | 'edit' | 'dashboard' | 'custom';\n\nexport const ViewTypeSchema = z.enum([\n 'list',\n 'detail',\n 'create',\n 'edit',\n 'dashboard',\n 'custom',\n]);\n\n// ============================================================================\n// Trait Reference\n// ============================================================================\n\n/**\n * Trait reference on a page.\n */\nexport type PageTraitRef = {\n /** Trait name from library */\n ref: string;\n /** V4 dual-carry id sibling of `ref` — optional until the Phase-7 flip. */\n refId?: TraitId;\n /** Entity this trait operates on */\n linkedEntity?: string;\n /** V4 dual-carry id sibling of `linkedEntity` — optional until the Phase-7 flip. */\n linkedEntityId?: EntityId;\n /** Additional trait configuration */\n config?: TraitConfig;\n};\n\nexport const PageTraitRefSchema = z.object({\n ref: z.string().min(1, 'Trait ref is required'),\n refId: TraitIdSchema.optional(),\n linkedEntity: z.string().optional(),\n linkedEntityId: EntityIdSchema.optional(),\n config: TraitConfigSchema.optional(),\n});\n\n// ============================================================================\n// Page modifiers (access, indexing, metadata)\n// ============================================================================\n\n/** `access:` — `public` admits anonymous viewers; `authenticated` mounts the\n * page circuit only for a resolved signed-in viewer. Absent = no gate. */\nexport type PageAccess = 'public' | 'authenticated';\nexport const PageAccessSchema = z.enum(['public', 'authenticated']);\n\n/** `indexing:` — a search-engine directive, never access control. */\nexport type PageIndexing = 'index' | 'noindex';\nexport const PageIndexingSchema = z.enum(['index', 'noindex']);\n\n/** `title:` / `description:` — a literal, or `[\"i18n/t\", key]` resolved\n * against the route's locale. No entity/config/viewer bindings. */\nexport type PageMeta = string | ['i18n/t', string];\nexport const PageMetaSchema = z.union([\n z.string(),\n z.tuple([z.literal('i18n/t'), z.string().min(1)]),\n]);\n\n/** Resolve a {@link PageMeta} through a message lookup. */\nexport function resolvePageMeta(\n meta: PageMeta | undefined,\n lookup: (key: string) => string | undefined,\n): string | undefined {\n if (meta === undefined) return undefined;\n return typeof meta === 'string' ? meta : lookup(meta[1]);\n}\n\n// ============================================================================\n// Orbital Page\n// ============================================================================\n\n/**\n * OrbitalPage - a page definition within an Orbital Unit.\n *\n * TRAIT-DRIVEN: Pages must have traits array. Sections are NOT supported.\n */\nexport type OrbitalPage = {\n /** V4 dual-carry id sibling of `name` — optional until the Phase-7 flip. */\n id?: PageId;\n\n /** Page name (PascalCase, e.g., \"TasksPage\") */\n name: string;\n\n /** URL path (e.g., \"/tasks\", \"/tasks/:id\"); \"\" on a protocol page, whose `address` says where it is reached. */\n path: string;\n\n /** Protocol word of a non-route page (`page http { … }`, `page stdio`, `page boot`). Absent = route. */\n protocol?: string;\n\n /** The protocol's address record (`{ host, port, path }`), an expression typed against the protocol table row. Absent on a route and on a protocol row with no address. */\n address?: SExpr;\n\n /** View type (optional in trait-driven mode) */\n viewType?: ViewType;\n\n /** `title:` page modifier — the document title. */\n title?: PageMeta;\n\n /** `description:` page modifier — the document meta description. */\n description?: PageMeta;\n\n /** `access:` page modifier. */\n access?: PageAccess;\n\n /** `indexing:` page modifier. */\n indexing?: PageIndexing;\n\n /**\n * The upstream page this one was imported from (its id, kept through nested\n * imports). Imports of one page in different locales are language\n * alternates. Set by import resolution, never authored.\n */\n sourcePage?: string;\n\n /** `translationOf:` page modifier — pages sharing it in different locales are language alternates (ahead of `sourcePage`). */\n translationOf?: string;\n\n /** Primary entity for this page */\n primaryEntity?: string;\n\n /**\n * Traits that drive UI for this page.\n * REQUIRED in trait-driven architecture.\n */\n traits?: PageTraitRef[];\n\n /** Is this the initial page for navigation? */\n isInitial?: boolean;\n\n /** Nav icon name — `@icon \"...\"` annotation on the page declaration. */\n icon?: string;\n\n /** Nav label — `@label \"...\"` annotation. Only a page that declares one is a `@pages` nav entry. */\n label?: string;\n\n /** Roles the nav entry shows for — `@roles \"a, b\"` annotation. Absent = everyone. */\n roles?: string[];\n};\n\n/**\n * Strict Zod schema for trait-driven pages.\n * Rejects unknown properties like 'sections'.\n */\n/** The page modifiers a `pages {}` remap entry declares for one imported page. */\nexport interface PageModifiers {\n access?: PageAccess;\n indexing?: PageIndexing;\n title?: PageMeta;\n description?: PageMeta;\n translationOf?: string;\n /** The page's nav entry, declared on a `pages {}` remap entry. */\n label?: string;\n icon?: string;\n roles?: string[];\n}\n\nexport const PageModifiersSchema = z.object({\n access: PageAccessSchema.optional(),\n indexing: PageIndexingSchema.optional(),\n title: PageMetaSchema.optional(),\n description: PageMetaSchema.optional(),\n translationOf: z.string().min(1).optional(),\n label: z.string().optional(),\n icon: z.string().optional(),\n roles: z.array(z.string().min(1)).min(1).optional(),\n}).strict();\n\nexport const OrbitalPageStrictSchema = z.object({\n id: PageIdSchema.optional(),\n name: z.string().min(1, 'Page name is required'),\n path: z.string().min(1, 'Page path is required').startsWith('/', 'Path must start with /'),\n primaryEntity: z.string().min(1, 'Primary entity is required'),\n traits: z.array(PageTraitRefSchema).min(1, 'Page must have at least one trait'),\n title: PageMetaSchema.optional(),\n description: PageMetaSchema.optional(),\n access: PageAccessSchema.optional(),\n indexing: PageIndexingSchema.optional(),\n sourcePage: z.string().min(1).optional(),\n translationOf: z.string().min(1).optional(),\n icon: z.string().optional(),\n label: z.string().optional(),\n roles: z.array(z.string().min(1)).min(1).optional(),\n}).strict(); // Reject unknown keys like 'sections'\n\n/**\n * Zod schema for OrbitalPage.\n * Trait-driven: pages have traits instead of static sections/patterns.\n * Uses .strict() to reject unknown keys like 'sections'.\n */\nexport const OrbitalPageSchema = z.object({\n id: PageIdSchema.optional(),\n name: z.string().min(1, 'Page name is required'),\n path: z.string(),\n protocol: z.string().min(1).optional(),\n address: SExprSchema.optional(),\n viewType: ViewTypeSchema.optional(),\n title: PageMetaSchema.optional(),\n description: PageMetaSchema.optional(),\n access: PageAccessSchema.optional(),\n indexing: PageIndexingSchema.optional(),\n sourcePage: z.string().min(1).optional(),\n translationOf: z.string().min(1).optional(),\n primaryEntity: z.string().optional(),\n traits: z.array(PageTraitRefSchema).optional(),\n isInitial: z.boolean().optional(),\n icon: z.string().optional(),\n label: z.string().optional(),\n roles: z.array(z.string().min(1)).min(1).optional(),\n}).strict().superRefine((page, ctx) => {\n if (page.protocol !== undefined) {\n if (page.path !== '') ctx.addIssue({ code: 'custom', path: ['path'], message: 'A protocol page has an empty path; its address says where it is reached' });\n return;\n }\n if (page.address !== undefined) ctx.addIssue({ code: 'custom', path: ['address'], message: 'A route page takes no address; its path is its address' });\n if (page.path.length === 0) ctx.addIssue({ code: 'custom', path: ['path'], message: 'Page path is required' });\n else if (!page.path.startsWith('/')) ctx.addIssue({ code: 'custom', path: ['path'], message: 'Path must start with /' });\n}); // Rejects unknown keys like 'sections' - use traits with render_ui effects\n\nexport type OrbitalPageInput = z.input<typeof OrbitalPageSchema>;\nexport type OrbitalPageStrictInput = z.input<typeof OrbitalPageStrictSchema>;\n\n// ============================================================================\n// Type Aliases (for cleaner imports)\n// ============================================================================\n\n/** Alias for OrbitalPage - preferred name */\nexport type Page = OrbitalPage;\n\n/** Alias for OrbitalPageSchema - preferred name */\nexport const PageSchema = OrbitalPageSchema;\n\n// ============================================================================\n// Protocols (EXEC-ENDPOINT-1)\n// ============================================================================\n\n/** The side of the program that serves a protocol's endpoints. Mirrors Rust `ProtocolSide`. */\nexport type ProtocolSide = 'client' | 'server' | 'process' | 'start';\nexport const ProtocolSideSchema = z.enum(['client', 'server', 'process', 'start']);\n\n/** One field of a protocol's address record. `ty` is the lolo type text. */\nexport interface ProtocolAddressField {\n name: string;\n ty: string;\n required: boolean;\n}\n\n/** A row of the protocol table (`orb reference protocols`, orbital-core `lang/protocols.rs`). */\nexport interface ProtocolSpec {\n name: string;\n address?: ProtocolAddressField[];\n viewer: boolean;\n grant?: string;\n side: ProtocolSide;\n}\n\nexport const ProtocolSpecSchema = z.object({\n name: z.string().min(1),\n address: z.array(z.object({ name: z.string().min(1), ty: z.string().min(1), required: z.boolean() }).strict()).optional(),\n viewer: z.boolean(),\n grant: z.string().min(1).optional(),\n side: ProtocolSideSchema,\n}).strict();\n\n/** `route` is the protocol of a page that declares none. */\nexport const ROUTE_PROTOCOL = 'route';\n\n/** A page reached by a path a client opens (no protocol word). */\nexport function isRoutePage(page: Pick<OrbitalPage, 'protocol'> & object): boolean {\n return page.protocol === undefined;\n}\n\n/** The protocol a page speaks: its protocol word, or `route`. */\nexport function protocolName(page: Pick<OrbitalPage, 'protocol'> & object): string {\n return page.protocol ?? ROUTE_PROTOCOL;\n}\n","/**\n * Service Types for Orbital Schema\n *\n * Defines external service integrations (REST APIs, WebSockets, MCP servers)\n * that can be used by orbital units via the `call_service` effect.\n *\n * @packageDocumentation\n */\n\nimport { z } from \"zod\";\nimport type { RuntimeValue } from './json.js';\n\n// ============================================================================\n// Service Type Enum\n// ============================================================================\n\n/**\n * Types of external services that can be integrated.\n */\nexport const SERVICE_TYPES = [\"rest\", \"socket\", \"mcp\"] as const;\n\nexport type ServiceType = (typeof SERVICE_TYPES)[number];\n\nexport const ServiceTypeSchema = z.enum(SERVICE_TYPES);\n\n// ============================================================================\n// REST Service Definition\n// ============================================================================\n\n/**\n * Configuration for a REST API service.\n *\n * @example\n * ```typescript\n * const weatherService: RestServiceDef = {\n * name: 'WeatherAPI',\n * type: 'rest',\n * baseUrl: 'https://api.openweathermap.org/data/2.5',\n * headers: {\n * 'Content-Type': 'application/json',\n * },\n * auth: {\n * type: 'api-key',\n * keyName: 'appid',\n * location: 'query',\n * },\n * };\n * ```\n */\nexport type RestServiceDef = {\n /** Unique service name (used in call_service effect) */\n name: string;\n\n /** Service type */\n type: \"rest\";\n\n /** Optional description */\n description?: string;\n\n /** Base URL for the API */\n baseUrl: string;\n\n /** Default headers to include in all requests */\n headers?: Record<string, string>;\n\n /** Authentication configuration */\n auth?: RestAuthConfig;\n\n /** Timeout in milliseconds (default: 30000) */\n timeout?: number;\n};\n\n/**\n * Authentication configuration for REST services.\n */\nexport type RestAuthConfig = {\n /** Authentication type */\n type: \"api-key\" | \"bearer\" | \"basic\" | \"oauth2\";\n\n /** For api-key: the query parameter or header name */\n keyName?: string;\n\n /** For api-key: where to place the key */\n location?: \"query\" | \"header\";\n\n /** Environment variable name containing the secret (for secure storage) */\n secretEnv?: string;\n};\n\nexport const RestAuthConfigSchema = z.object({\n type: z.enum([\"api-key\", \"bearer\", \"basic\", \"oauth2\"]),\n keyName: z.string().optional(),\n location: z.enum([\"query\", \"header\"]).optional(),\n secretEnv: z.string().optional(),\n});\n\nexport const RestServiceDefSchema = z.object({\n name: z.string().min(1, \"Service name is required\"),\n type: z.literal(\"rest\"),\n description: z.string().optional(),\n baseUrl: z.string().url(\"Base URL must be a valid URL\"),\n headers: z.record(z.string(), z.string()).optional(),\n auth: RestAuthConfigSchema.optional(),\n timeout: z.number().positive().optional(),\n});\n\n// ============================================================================\n// Socket Service Definition\n// ============================================================================\n\n/**\n * Configuration for a WebSocket service.\n *\n * @example\n * ```typescript\n * const chatService: SocketServiceDef = {\n * name: 'ChatSocket',\n * type: 'socket',\n * url: 'wss://chat.example.com',\n * events: {\n * inbound: ['message_received', 'user_joined', 'user_left'],\n * outbound: ['send_message', 'join_room', 'leave_room'],\n * },\n * };\n * ```\n */\nexport type SocketServiceDef = {\n /** Unique service name */\n name: string;\n\n /** Service type */\n type: \"socket\";\n\n /** Optional description */\n description?: string;\n\n /** WebSocket URL */\n url: string;\n\n /** Event definitions */\n events: SocketEvents;\n\n /** Reconnection configuration */\n reconnect?: {\n /** Enable automatic reconnection */\n enabled: boolean;\n /** Maximum reconnection attempts */\n maxAttempts?: number;\n /** Delay between attempts in ms */\n delayMs?: number;\n };\n};\n\n/**\n * Socket event definitions.\n */\nexport type SocketEvents = {\n /** Events received from server (maps to orbital events) */\n inbound: string[];\n\n /** Events sent to server (triggered by effects) */\n outbound: string[];\n};\n\nexport const SocketEventsSchema = z.object({\n inbound: z.array(z.string()),\n outbound: z.array(z.string()),\n});\n\nexport const SocketServiceDefSchema = z.object({\n name: z.string().min(1, \"Service name is required\"),\n type: z.literal(\"socket\"),\n description: z.string().optional(),\n url: z.string().url(\"WebSocket URL must be valid\"),\n events: SocketEventsSchema,\n reconnect: z\n .object({\n enabled: z.boolean(),\n maxAttempts: z.number().positive().optional(),\n delayMs: z.number().positive().optional(),\n })\n .optional(),\n});\n\n// ============================================================================\n// MCP Service Definition\n// ============================================================================\n\n/**\n * Configuration for an MCP (Model Context Protocol) server.\n *\n * @example\n * ```typescript\n * const mcpService: McpServiceDef = {\n * name: 'DatabaseMCP',\n * type: 'mcp',\n * serverPath: './mcp-servers/database',\n * capabilities: ['query', 'insert', 'update'],\n * };\n * ```\n */\nexport type McpServiceDef = {\n /** Unique service name */\n name: string;\n\n /** Service type */\n type: \"mcp\";\n\n /** Optional description */\n description?: string;\n\n /** Path to MCP server executable or module */\n serverPath: string;\n\n /** List of capabilities/tools exposed by the MCP server */\n capabilities: string[];\n\n /** Environment variables to pass to the MCP server */\n env?: Record<string, string>;\n};\n\nexport const McpServiceDefSchema = z.object({\n name: z.string().min(1, \"Service name is required\"),\n type: z.literal(\"mcp\"),\n description: z.string().optional(),\n serverPath: z.string().min(1, \"Server path is required\"),\n capabilities: z\n .array(z.string())\n .min(1, \"At least one capability is required\"),\n env: z.record(z.string(), z.string()).optional(),\n});\n\n// ============================================================================\n// Union Type: ServiceDefinition\n// ============================================================================\n\n/**\n * Union type for all service definitions.\n */\nexport type ServiceDefinition =\n | RestServiceDef\n | SocketServiceDef\n | McpServiceDef;\n\nexport const ServiceDefinitionSchema = z.discriminatedUnion(\"type\", [\n RestServiceDefSchema,\n SocketServiceDefSchema,\n McpServiceDefSchema,\n]);\n\n// ============================================================================\n// Service Reference (Inline OR Reference)\n// ============================================================================\n\n/**\n * ServiceRef - Service can be inline definition, reference object with overrides,\n * or bare string reference to an imported service.\n *\n * Reference format: \"Alias.services.ServiceName\"\n */\nexport type ServiceRef = ServiceDefinition | ServiceRefObject | string;\n\n/**\n * Phase F: Service reference object with override fields.\n *\n * Mirrors the Rust `ServiceRefObject` at\n * `orbital-rust/crates/orbital-core/src/schema/types.rs:353-375`. A caller\n * imports a service via `uses[]`, references it by `ref`, and supplies\n * any subset of these fields to override the imported service's defaults\n * during inlining.\n *\n * @example\n * ```typescript\n * const ref: ServiceRefObject = {\n * ref: \"Weather.services.openweather\",\n * baseUrl: \"https://staging.weather.example.com\",\n * headers: { \"X-Tenant\": \"acme\" },\n * };\n * ```\n */\nexport type ServiceRefObject = {\n /** Reference to imported service: \"Alias.services.ServiceName\" */\n ref: string;\n /** Override the service description */\n description?: string;\n /** Override the REST baseUrl */\n baseUrl?: string;\n /** Override or merge default headers (caller wins on key collision) */\n headers?: Record<string, string>;\n /** Override the WebSocket url */\n url?: string;\n /** Override the MCP server path */\n serverPath?: string;\n};\n\n/**\n * Checks if a service reference is a bare string reference.\n *\n * Type guard to determine if a service reference is a string reference\n * (format: \"Alias.services.ServiceName\") rather than an inline service\n * definition or a reference object.\n *\n * @param {ServiceRef} service - Service reference to check\n * @returns {boolean} True if service is a string reference, false otherwise\n *\n * @example\n * isServiceReference(\"Weather.services.openweather\"); // returns true\n * isServiceReference({ name: \"weather\", type: \"rest\" }); // returns false\n * isServiceReference({ ref: \"Weather.services.openweather\" }); // returns false\n */\nexport function isServiceReference(service: ServiceRef): service is string {\n return typeof service === \"string\";\n}\n\n/**\n * Phase F: Type guard for `ServiceRefObject` (the override-carrying form).\n *\n * @param {ServiceRef} service - Service reference to check\n * @returns {boolean} True if service is a ServiceRefObject\n */\nexport function isServiceReferenceObject(\n service: ServiceRef,\n): service is ServiceRefObject {\n return (\n typeof service === \"object\" &&\n service !== null &&\n \"ref\" in service &&\n !(\"type\" in service)\n );\n}\n\n/**\n * Validate service reference format: \"Alias.services.ServiceName\"\n */\nexport const ServiceRefStringSchema = z\n .string()\n .regex(\n /^[A-Z][a-zA-Z0-9]*\\.services\\.[a-zA-Z][a-zA-Z0-9]*$/,\n 'Service reference must be in format \"Alias.services.ServiceName\" (e.g., \"Weather.services.openweather\")',\n );\n\nexport const ServiceRefObjectSchema = z.object({\n ref: ServiceRefStringSchema,\n description: z.string().optional(),\n baseUrl: z.string().url(\"baseUrl override must be a valid URL\").optional(),\n headers: z.record(z.string(), z.string()).optional(),\n url: z.string().url(\"url override must be a valid URL\").optional(),\n serverPath: z.string().optional(),\n});\n\nexport const ServiceRefSchema = z.union([\n ServiceDefinitionSchema,\n ServiceRefObjectSchema,\n ServiceRefStringSchema,\n]);\n\n/**\n * Parses a service reference into its components.\n * \n * Extracts the alias and service name from a service reference string\n * in format \"Alias.services.ServiceName\". Returns null if not a valid reference.\n * \n * @param {string} ref - Service reference string\n * @returns {{ alias: string; serviceName: string } | null} Parsed components or null\n * \n * @example\n * parseServiceRef(\"Weather.services.openweather\"); // returns { alias: \"Weather\", serviceName: \"openweather\" }\n * parseServiceRef(\"invalid\"); // returns null\n */\nexport function parseServiceRef(\n ref: string,\n): { alias: string; serviceName: string } | null {\n const match = ref.match(\n /^([A-Z][a-zA-Z0-9]*)\\.services\\.([a-zA-Z][a-zA-Z0-9]*)$/,\n );\n if (!match) return null;\n return { alias: match[1], serviceName: match[2] };\n}\n\n// ============================================================================\n// Utility Functions\n// ============================================================================\n\n/**\n * Checks if a service definition is a REST service.\n * \n * Type guard to determine if a service definition represents a REST API service.\n * Used for service type discrimination and validation.\n * \n * @param {ServiceDefinition} service - Service definition to check\n * @returns {boolean} True if service is a REST service, false otherwise\n * \n * @example\n * isRestService({ name: \"weather\", type: \"rest\", baseUrl: \"...\" }); // returns true\n * isRestService({ name: \"chat\", type: \"socket\" }); // returns false\n */\nexport function isRestService(\n service: ServiceDefinition,\n): service is RestServiceDef {\n return service.type === \"rest\";\n}\n\n/**\n * Checks if a service definition is a Socket service.\n * \n * Type guard to determine if a service definition represents a WebSocket service.\n * Used for service type discrimination and validation.\n * \n * @param {ServiceDefinition} service - Service definition to check\n * @returns {boolean} True if service is a Socket service, false otherwise\n * \n * @example\n * isSocketService({ name: \"chat\", type: \"socket\", url: \"wss://...\" }); // returns true\n * isSocketService({ name: \"weather\", type: \"rest\" }); // returns false\n */\nexport function isSocketService(\n service: ServiceDefinition,\n): service is SocketServiceDef {\n return service.type === \"socket\";\n}\n\n/**\n * Checks if a service definition is an MCP service.\n * \n * Type guard to determine if a service definition represents an MCP\n * (Multiplayer Control Protocol) service. Used for service type discrimination.\n * \n * @param {ServiceDefinition} service - Service definition to check\n * @returns {boolean} True if service is an MCP service, false otherwise\n * \n * @example\n * isMcpService({ name: \"game\", type: \"mcp\", serverUrl: \"...\" }); // returns true\n * isMcpService({ name: \"chat\", type: \"socket\" }); // returns false\n */\nexport function isMcpService(\n service: ServiceDefinition,\n): service is McpServiceDef {\n return service.type === \"mcp\";\n}\n\n/**\n * Get all service names from a list of services.\n */\nexport function getServiceNames(services: ServiceDefinition[]): string[] {\n return services.map((s) => s.name);\n}\n\n/**\n * Find a service by name.\n */\nexport function findService(\n services: ServiceDefinition[],\n name: string,\n): ServiceDefinition | undefined {\n return services.find((s) => s.name.toLowerCase() === name.toLowerCase());\n}\n\n/**\n * Check if a service name exists (case-insensitive).\n */\nexport function hasService(\n services: ServiceDefinition[],\n name: string,\n): boolean {\n return services.some((s) => s.name.toLowerCase() === name.toLowerCase());\n}\n\n/**\n * Allowed leaf value for `ServiceParams`. Mirrors `EventPayloadValue`'s\n * recursive-array shape so integration call signatures can express the\n * nested structures real services need (port mappings, volume mounts,\n * pagination cursors), and so a value satisfying `EventPayloadValue`\n * also satisfies `ServiceParamsValue` without a cast — the same data\n * flows through `call-service` and `emit` without boundary widening.\n */\nexport type ServiceParamsValue =\n | string\n | number\n | boolean\n | Date\n | null\n | undefined\n | ServiceParams\n | readonly ServiceParamsValue[];\n\n/** Parameters passed to call-service effects. Recursive for nested request shapes. */\nexport type ServiceParams = {\n [key: string]: ServiceParamsValue;\n};\n\nexport interface CredentialIdentity {\n name: string;\n principal?: string;\n}\n\nexport function credentialStorageKey(identity: CredentialIdentity): string {\n if (typeof identity.name !== 'string' || (identity.principal !== undefined && typeof identity.principal !== 'string')) {\n throw new Error('credential identity requires string name and principal');\n }\n return JSON.stringify([identity.principal ?? null, identity.name]);\n}\n\nexport function resolveCredentialStatusIdentity(selection: RuntimeValue, principal: string | undefined): CredentialIdentity {\n if (selection !== null && typeof selection === 'object' && !Array.isArray(selection)) {\n const keys = Reflect.ownKeys(selection);\n if (keys.length !== 2 || !keys.includes('credential') || !keys.includes('scope') || !('credential' in selection) || !('scope' in selection)) {\n throw new Error('credential-status: expected { credential, scope: app | user }');\n }\n const { credential, scope } = selection;\n if (typeof credential !== 'string' || (scope !== 'app' && scope !== 'user')) {\n throw new Error('credential-status: expected { credential, scope: app | user }');\n }\n if (scope === 'app') return { name: credential };\n if (principal === undefined) throw new Error('credential-status: nobody is signed in');\n return { name: credential, principal };\n }\n if (principal === undefined) throw new Error('credential-status: nobody is signed in');\n if (typeof selection !== 'string') throw new Error(\"credential-status: the credential must be a secret knob's name\");\n return { name: selection, principal };\n}\n\nexport function credentialStatusConnected(value: string | undefined, principal: string | undefined): boolean {\n return value !== undefined && (principal !== undefined || value !== '');\n}\n","/**\n * Orbital Type (Self-Contained)\n *\n * Defines the Orbital - the atomic building block of applications.\n * Formula: Orbital = Entity × Traits × Pages\n *\n * An Orbital is a module that exports { entity, traits, pages }.\n * Use `uses` to import other Orbitals and access their components via:\n * - Alias.entity\n * - Alias.traits.TraitName\n * - Alias.pages.PageName\n *\n * @packageDocumentation\n */\n\nimport { z } from \"zod\";\nimport type { OsGrants } from \"./os-grants.js\";\nimport { OsGrantsSchema } from \"./os-grants.js\";\nimport type { OrbitalId, EntityId, TraitId, PageId } from \"./identity.js\";\nimport { OrbitalIdSchema, EntityIdSchema, TraitIdSchema, PageIdSchema } from \"./identity.js\";\nimport type { Entity, EntityPersistence } from \"./entity.js\";\nimport { EntitySchema, EntityPersistenceSchema } from \"./entity.js\";\nimport type { EntityField } from \"./field.js\";\nimport { EntityFieldSchema } from \"./field.js\";\nimport type { Page, PageAccess, PageIndexing, PageMeta, PageModifiers } from \"./page.js\";\nimport { PageSchema, PageAccessSchema, PageIndexingSchema, PageMetaSchema, PageModifiersSchema } from \"./page.js\";\nimport type {\n TraitRef,\n CallSiteConfig,\n EventPayloadField,\n EventScope,\n Trait,\n DeclaredTraitConfig,\n TraitEventListener,\n ConfigFieldDeclaration,\n TraitDispatchMode,\n} from \"./trait.js\";\nimport {\n isInlineTrait,\n mergeCallSiteConfigOverrides,\n TraitRefSchema,\n EventPayloadFieldSchema,\n EventPayloadTypeMemberSchema,\n EventScopeSchema,\n TraitSchema,\n DeclaredTraitConfigSchema,\n TraitEventListenerSchema,\n ConfigFieldDeclarationSchema,\n TraitDispatchModeSchema,\n} from \"./trait.js\";\nimport type {\n DomainContext,\n DesignPreferences,\n SuggestedGuard,\n ThemeRef,\n} from \"./domain.js\";\nimport {\n DomainContextSchema,\n DesignPreferencesSchema,\n SuggestedGuardSchema,\n ThemeRefSchema,\n} from \"./domain.js\";\nimport type { ServiceRef } from \"./service.js\";\nimport { ServiceRefSchema } from \"./service.js\";\nimport type { Expression, SExpr } from \"./expression.js\";\nimport { ExpressionSchema, SExprListSchema, SExprSchema } from \"./expression.js\";\n\n// ============================================================================\n// Use Declaration (Import System)\n// ============================================================================\n\n/**\n * UseDeclaration - Import an external Orbital as a namespace.\n *\n * After importing, access components via:\n * - Alias.entity - The entity definition\n * - Alias.traits.TraitName - A specific trait\n * - Alias.pages.PageName - A specific page\n *\n * @example\n * ```json\n * {\n * \"uses\": [\n * { \"from\": \"./health.orb\", \"as\": \"Health\" },\n * { \"from\": \"std/behaviors/game-core\", \"as\": \"GameCore\" }\n * ]\n * }\n * ```\n */\nexport type UseDeclaration = {\n /**\n * Import source path:\n * - \"std/behaviors/game-core\" - Standard library\n * - \"./shared/health.orb\" - Local .orb file (relative path)\n * - \"../common/physics.orb\" - Parent directory .orb file\n * - \"@game-lib/enemies.orb\" - Scoped package (configured base)\n */\n from: string;\n\n /**\n * Alias for accessing imported components.\n * Used as namespace: Alias.entity, Alias.traits.X, Alias.pages.X\n */\n as: string;\n\n /** `uses A from \"…\" { config { … } }` override of the upstream schema's declared `config {}` — keys must exist in `OrbitalSchema.config`. */\n config?: DeclaredTraitConfig;\n\n /** `uses lazy A from \"…\"` — the imported behavior is compiled to its own `.orb` and loaded when one of its pages is opened; see {@link LazyPage}. */\n lazy?: boolean;\n};\n\nexport const UseDeclarationSchema = z.object({\n from: z.string().min(1, \"Import source is required\"),\n as: z\n .string()\n .min(1, \"Alias is required\")\n .regex(\n /^[A-Z][a-zA-Z0-9]*$/,\n 'Alias must be PascalCase (e.g., \"Health\", \"GameCore\")',\n ),\n config: DeclaredTraitConfigSchema.optional(),\n lazy: z.boolean().optional(),\n});\n\n/**\n * A page served by a lazily-used behavior. The importer's `.orb` lists the\n * page so routing and prerender know it; the behavior itself lives in the\n * `.orb` at `orbRef` (relative to the importer's `.orb`) and is fetched when\n * the page is opened.\n */\nexport type LazyPage = {\n path: string;\n orbital: string;\n orbRef: string;\n};\n\nexport const LazyPageSchema = z.object({\n path: z.string().min(1),\n orbital: z.string().min(1),\n orbRef: z.string().min(1),\n});\n\n// ============================================================================\n// Expect Declaration (Consumer-Side Requirements)\n// ============================================================================\n\n/**\n * ExpectDeclaration - a consumer-side requirement: \"some sibling orbital\n * provides this, and here is the minimal typed slice of it I rely on.\"\n *\n * The dual of a provider: the entity `[identity]` tag declares \"I am the\n * roster\"; `expects identity` declares \"I read the roster\". Standalone\n * validation trusts the declaration and uses its shape as the local type\n * environment; composed-program validation link-checks it against the real\n * provider. The shape reuses the canonical `EntityField` so all type\n * compatibility flows through the one compat owner. Compile-time only.\n * See docs/Almadar_LOLO_Expects_Proposal.md.\n */\nexport type ExpectDeclaration = ExpectDeclarationShape & {\n /** Set when the obligation arrived through a spec import: an unprovided one is an error, not deferred. */\n strict?: boolean;\n};\n\ntype ExpectDeclarationShape =\n | {\n /** `expects identity Customer { role : \"admin\" | \"member\" }` — the `@user` fields this orbital reads, typed. */\n kind: \"identity\";\n name?: string;\n shape?: EntityField[];\n }\n | {\n /** `expects entity OrderRecord { totalAmount : number }` — a sibling entity this orbital touches. Shape omitted = opaque reference. */\n kind: \"entity\";\n name: string;\n shape?: EntityField[];\n /** `[persistent]` / `[runtime]`: the storage mode the provider must declare. */\n persistence?: EntityPersistence;\n /** `[shared]` / `[browser]`: the provider must carry the same tag. */\n shared?: boolean;\n browser?: boolean;\n /** `@read|@create|@update|@delete <expr>`: the provider's policy must be this expression. */\n read_policy?: SExpr;\n create_policy?: SExpr;\n update_policy?: SExpr;\n delete_policy?: SExpr;\n /** `@<op> none \"<reason>\"`: the provider must declare a waiver for each op named. */\n access_waivers?: Entity[\"access_waivers\"];\n /** `@invariant <expr>` (spec only): every stored row satisfies each, proved by `orb validate`. */\n invariants?: SExpr[];\n }\n | {\n /** `expects event Checkout.ORDER_PLACED` — a sibling trait produces this event (Phase 2). */\n kind: \"event\";\n traitName: string;\n event: string;\n /** The payload fields the event must carry, checked against the provider's `emits`. */\n payload?: EventPayloadField[];\n }\n | {\n /**\n * `expects page \"/articles/:slug\"` — a route a sibling orbital declares\n * and this one navigates to. The one cross-boundary edge a `navigate`\n * effect cannot state for itself: the effect carries a static prefix\n * (`/articles/`), the provider a pattern (`/articles/:slug`), and the\n * parameterisation is information the usage does not hold. Derived, not\n * hand-authored — `orb behaviors expects` derives them.\n */\n kind: \"page\";\n path: string;\n /** `expects page \"/p\" -> A, B`: the traits the provider page must mount. */\n traits?: string[];\n }\n | {\n /** `expects trait T { state paid }`: the provider trait declares this state. */\n kind: \"state\";\n traitName: string;\n state: string;\n /** `state paid @holds <expr>` (spec only): holds over `@entity` while the trait is in the state, proved by `orb validate`. */\n holds?: SExpr;\n }\n | {\n /** `expects trait T { state idle { PAY -> paid } }`: the provider trait has this transition. */\n kind: \"transition\";\n traitName: string;\n from: string;\n event: string;\n to: string;\n /** `@ensures <expr>`: the outcome contract owed at this transition (`@fromEntity` is the row before it). */\n ensures?: SExpr[];\n }\n | {\n /** `expects config { stdio : string = \"pipe\" }`: a trait declares this knob, of this type and stated default. */\n kind: \"config\";\n name: string;\n knob: ConfigFieldDeclaration;\n };\n\n/**\n * The entity name an expectation is ABOUT, or undefined when it is not about\n * an entity at all (`event` names a trait's event, `page` a route, and a bare\n * `expects identity` defers to whoever is tagged `[identity]`).\n *\n * TS counterpart of the compiler's `expectations::expected_entity_names` and\n * L1's `types::expected_entity_names`. Exists so callers stop reaching for\n * `kind !== \"event\"` as a stand-in for \"has a name\" — a proxy that silently\n * became wrong the moment a second nameless kind was added.\n */\nexport function expectedEntityName(decl: ExpectDeclaration): string | undefined {\n switch (decl.kind) {\n case \"entity\":\n return decl.name;\n case \"identity\":\n return decl.name;\n case \"event\":\n case \"page\":\n case \"state\":\n case \"transition\":\n case \"config\":\n return undefined;\n }\n}\n\nexport const ExpectDeclarationSchema = z.discriminatedUnion(\"kind\", [\n z.object({\n strict: z.boolean().optional(),\n kind: z.literal(\"identity\"),\n name: z.string().optional(),\n shape: z.array(EntityFieldSchema).optional(),\n }),\n z.object({\n strict: z.boolean().optional(),\n kind: z.literal(\"entity\"),\n name: z.string().min(1, \"Expected entity name is required\"),\n shape: z.array(EntityFieldSchema).optional(),\n persistence: EntityPersistenceSchema.optional(),\n shared: z.boolean().optional(),\n browser: z.boolean().optional(),\n read_policy: SExprSchema.optional(),\n create_policy: SExprSchema.optional(),\n update_policy: SExprSchema.optional(),\n delete_policy: SExprSchema.optional(),\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: z.array(SExprSchema).optional(),\n }),\n z.object({\n strict: z.boolean().optional(),\n kind: z.literal(\"event\"),\n traitName: z.string().min(1, \"Expected event trait name is required\"),\n event: z.string().min(1, \"Expected event name is required\"),\n payload: z.array(EventPayloadFieldSchema).optional(),\n }),\n z.object({\n strict: z.boolean().optional(),\n kind: z.literal(\"page\"),\n path: z.string().min(1, \"Expected page path is required\"),\n traits: z.array(z.string().min(1)).optional(),\n }),\n z.object({\n strict: z.boolean().optional(),\n kind: z.literal(\"state\"),\n traitName: z.string().min(1, \"Expected state trait name is required\"),\n state: z.string().min(1, \"Expected state name is required\"),\n holds: SExprSchema.optional(),\n }),\n z.object({\n strict: z.boolean().optional(),\n kind: z.literal(\"transition\"),\n traitName: z.string().min(1, \"Expected transition trait name is required\"),\n from: z.string().min(1),\n event: z.string().min(1),\n to: z.string().min(1),\n ensures: SExprListSchema.optional(),\n }),\n z.object({\n strict: z.boolean().optional(),\n kind: z.literal(\"config\"),\n name: z.string().min(1, \"Expected config knob name is required\"),\n knob: ConfigFieldDeclarationSchema,\n }),\n]);\n\n/** A cross-boundary usage `orb behaviors expects` could not turn into a declaration. */\nexport const ExpectationDiagnosticSchema = z\n .object({\n kind: z.enum([\"unknown-orbital\", \"identity-field-not-declared\", \"entity-field-not-declared\", \"event-source-unknown\"]),\n orbital: z.string(),\n entity: z.string().optional(),\n field: z.string().optional(),\n })\n .strict();\nexport type ExpectationDiagnostic = z.infer<typeof ExpectationDiagnosticSchema>;\n\n/**\n * What `orb behaviors expects <organism>` prints: every orbital's derived `expects`\n * (docs/Almadar_LOLO_Expects_Proposal.md §7; the derivation lives in `orbital-core`).\n */\nexport const OrganismExpectationsSchema = z.record(z.string(),\n z.object({ expectations: z.array(ExpectDeclarationSchema), diagnostics: z.array(ExpectationDiagnosticSchema) }).strict(),\n);\nexport type OrganismExpectations = z.infer<typeof OrganismExpectationsSchema>;\n\n// ============================================================================\n// Entity Reference (Inline OR Reference)\n// ============================================================================\n\n/**\n * EntityCall - Reference to an imported entity with optional override arguments.\n *\n * Treats the imported entity as a callable function: the atom's declared\n * fields are defaults and the caller can append extra fields, rename, or\n * override persistence/collection. The discriminator key is `extends` to\n * stay consistent with the Phase A.5 Rust schema (`EntityRef::Extends`).\n *\n * @example\n * ```json\n * // Inherit ModalRecord's fields, rename to CartItem, add pendingId\n * {\n * \"extends\": \"Modal.entity\",\n * \"name\": \"CartItem\",\n * \"fields\": [{ \"name\": \"pendingId\", \"type\": \"string\" }]\n * }\n * ```\n */\nexport type EntityCall = {\n /** Reference to the imported entity using the \"extends\" discriminator key */\n extends: string;\n /** V4 dual-carry id sibling of `extends` — optional until the Phase-7 flip. */\n extendsId?: EntityId;\n /** Optional rename for the resulting entity */\n name?: string;\n /** Additional fields appended to the inherited set (caller wins on name collision) */\n fields?: EntityField[];\n /** Optional persistence override */\n persistence?: EntityPersistence;\n /** Optional collection override */\n collection?: string;\n};\n\n/**\n * EntityRef - Entity can be inline definition OR reference to imported entity.\n *\n * Reference formats:\n * - Simple string: \"Alias.entity\"\n * - Call form (with overrides): { extends: \"Alias.entity\", name?, fields?, persistence?, collection? }\n *\n * @example\n * ```json\n * // Inline\n * { \"entity\": { \"name\": \"Player\", \"fields\": [...] } }\n *\n * // Simple reference\n * { \"entity\": \"Goblin.entity\" }\n *\n * // Call form with overrides (Phase F)\n * { \"entity\": { \"extends\": \"Modal.entity\", \"name\": \"CartItem\", \"fields\": [...] } }\n * ```\n */\nexport type EntityRef = Entity | string | EntityCall;\n\n/**\n * Checks if an entity reference is a string reference.\n *\n * Type guard to determine if an EntityRef is a string reference\n * (format: \"Alias.entity\") rather than an inline entity definition or\n * an EntityCall object.\n *\n * Note: This guard intentionally narrows to `string` only. To check for\n * any non-inline form (string OR EntityCall), use `isEntityReferenceAny`.\n *\n * @param {EntityRef} entity - Entity reference to check\n * @returns {boolean} True if entity is a string reference, false otherwise\n *\n * @example\n * const ref1 = \"User.entity\"; // string reference\n * const ref2 = { name: \"User\", fields: [...] }; // inline definition\n * const ref3 = { extends: \"User.entity\" }; // EntityCall\n *\n * isEntityReference(ref1); // returns true\n * isEntityReference(ref2); // returns false\n * isEntityReference(ref3); // returns false\n */\nexport function isEntityReference(entity: EntityRef): entity is string {\n return typeof entity === \"string\";\n}\n\n/**\n * Checks if an entity reference is an EntityCall (extends form).\n *\n * Type guard for the call-form EntityRef introduced in Phase F. EntityCall\n * is identified by the presence of the \"extends\" discriminator key.\n *\n * @param {EntityRef} entity - Entity reference to check\n * @returns {boolean} True if entity is an EntityCall object\n *\n * @example\n * isEntityCall({ extends: \"Modal.entity\", name: \"CartItem\" }); // returns true\n * isEntityCall(\"Modal.entity\"); // returns false\n * isEntityCall({ name: \"Modal\", fields: [] }); // returns false\n */\nexport function isEntityCall(entity: EntityRef): entity is EntityCall {\n return typeof entity === \"object\" && entity !== null && \"extends\" in entity;\n}\n\n/**\n * Checks if an entity reference is any non-inline form (string or EntityCall).\n *\n * Broader companion to `isEntityReference` that recognizes both the bare\n * string reference and the Phase F EntityCall form.\n *\n * @param {EntityRef} entity - Entity reference to check\n * @returns {boolean} True if entity is a string reference or EntityCall\n */\nexport function isEntityReferenceAny(\n entity: EntityRef,\n): entity is string | EntityCall {\n return isEntityReference(entity) || isEntityCall(entity);\n}\n\n/**\n * Validate entity reference format: \"Alias.entity\", or the placeholder a\n * reference-form orbital carries before inline, \"Alias.orbitals.Name.entity\".\n */\nexport const EntityRefStringSchema = z\n .string()\n .regex(\n /^[A-Z][a-zA-Z0-9]*(\\.orbitals\\.[A-Z][a-zA-Z0-9]*)?\\.entity$/,\n 'Entity reference must be in format \"Alias.entity\" (e.g., \"Goblin.entity\") or \"Alias.orbitals.Name.entity\"',\n );\n\n/**\n * Validate EntityCall (extends form) shape.\n *\n * Phase F.4 refines:\n * - The `fields` override array must not contain duplicate field names\n * (case-sensitive). Duplicates would silently shadow each other during\n * the inliner's field-merge step, so reject at the schema boundary.\n */\nexport const EntityCallSchema = z\n .object({\n extends: z\n .string()\n .regex(\n /^[A-Z][a-zA-Z0-9]*\\.entity$/,\n 'EntityCall \"extends\" must be in format \"Alias.entity\"',\n ),\n name: z.string().optional(),\n fields: z.array(EntityFieldSchema).optional(),\n persistence: EntityPersistenceSchema.optional(),\n collection: z.string().optional(),\n })\n .refine(\n (call) => {\n if (!call.fields) return true;\n const seen = new Set<string>();\n for (const field of call.fields) {\n if (field.name === undefined) continue;\n if (seen.has(field.name)) return false;\n seen.add(field.name);\n }\n return true;\n },\n {\n message:\n 'EntityCall \"fields\" override list must not contain duplicate field names',\n path: [\"fields\"],\n },\n );\n\nexport const EntityRefSchema = z.union([\n EntitySchema,\n EntityRefStringSchema,\n EntityCallSchema,\n]);\n\n// ============================================================================\n// Page Reference (Inline OR Reference)\n// ============================================================================\n\n/**\n * PageRefObject - Reference to imported page with optional override arguments.\n *\n * Phase F adds `linkedEntity` and `traits` arguments so a caller can rebind\n * the imported page's entity and trait set, treating the page as a callable\n * function.\n */\nexport type PageRefObject = {\n /**\n * Reference to imported page: \"Alias.pages.PageName\"\n */\n ref: string;\n\n /** V4 dual-carry id sibling of `ref` — optional until the Phase-7 flip. */\n refId?: PageId;\n\n /**\n * Phase 1.2: optional registry path disambiguator. Pairs with `ref` to\n * explicitly name which `uses` entry the alias was imported from\n * (e.g. \"std/behaviors/atoms/std-browse\"). Helpful for programmatic\n * descriptor construction and inline-phase disambiguation when multiple\n * registries expose the same alias prefix.\n */\n from?: string;\n\n /**\n * Optional path override.\n * If provided, overrides the original page's path.\n */\n path?: string;\n\n /**\n * Phase F: rebind the page's entity to the caller's entity.\n * Identifier-substitution pass rewrites references to the original\n * entity inside the imported page.\n */\n linkedEntity?: string;\n\n /** V4 dual-carry id sibling of `linkedEntity` — optional until the Phase-7 flip. */\n linkedEntityId?: EntityId;\n\n /**\n * Phase F: override the page's trait set with the caller-supplied list.\n * Each entry may be a string trait reference or an inline trait reference object.\n */\n traits?: TraitRef[];\n\n /** V4 dual-carry id sibling of `traits` — optional until the Phase-7 flip. */\n traitRefIds?: TraitId[];\n\n /** Explicit page-modifier overrides; absent fields inherit the upstream page's. */\n access?: PageAccess;\n indexing?: PageIndexing;\n title?: PageMeta;\n description?: PageMeta;\n /** `translationOf:` — the translation group this page belongs to. */\n translationOf?: string;\n /** The page's nav entry (`@label`/`@icon`/`@roles`). */\n label?: string;\n icon?: string;\n roles?: string[];\n};\n\n/**\n * PageRef - Page can be inline definition OR reference to imported page.\n *\n * Reference formats:\n * - \"Alias.pages.PageName\" - Simple reference (keeps original path)\n * - { ref: \"Alias.pages.PageName\", path: \"/custom\" } - Reference with path override\n *\n * @example\n * ```json\n * // Inline\n * { \"name\": \"Dashboard\", \"path\": \"/\", ... }\n *\n * // Simple reference\n * \"User.pages.Profile\"\n *\n * // Reference with path override\n * { \"ref\": \"User.pages.Profile\", \"path\": \"/my-profile\" }\n * ```\n */\nexport type PageRef = Page | string | PageRefObject;\n\n/**\n * Checks if a page reference is a string reference.\n * \n * Type guard to determine if a PageRef is a simple string reference\n * (format: \"Alias.pages.PageName\") rather than an inline page definition or object reference.\n * \n * @param {PageRef} page - Page reference to check\n * @returns {boolean} True if page is a string reference, false otherwise\n * \n * @example\n * const ref1 = \"User.pages.Profile\"; // string reference\n * const ref2 = { name: \"Dashboard\", path: \"/\" }; // inline definition\n * \n * isPageReferenceString(ref1); // returns true\n * isPageReferenceString(ref2); // returns false\n */\nexport function isPageReferenceString(page: PageRef): page is string {\n return typeof page === \"string\";\n}\n\n/**\n * Checks if a page reference is a reference object.\n * \n * Type guard to determine if a PageRef is an object reference\n * with a 'ref' property rather than an inline page definition.\n * \n * @param {PageRef} page - Page reference to check\n * @returns {boolean} True if page is a reference object, false otherwise\n * \n * @example\n * const ref1 = { ref: \"User.pages.Profile\", path: \"/custom\" }; // reference object\n * const ref2 = { name: \"Dashboard\", path: \"/\" }; // inline definition\n * \n * isPageReferenceObject(ref1); // returns true\n * isPageReferenceObject(ref2); // returns false\n */\nexport function isPageReferenceObject(page: PageRef): page is PageRefObject {\n return typeof page === \"object\" && \"ref\" in page && !(\"name\" in page);\n}\n\n/**\n * Checks if a page reference is any type of reference.\n * \n * Type guard to determine if a PageRef is a reference (string or object)\n * rather than an inline page definition.\n * \n * @param {PageRef} page - Page reference to check\n * @returns {boolean} True if page is a reference, false if inline definition\n * \n * @example\n * const ref1 = \"User.pages.Profile\"; // string reference\n * const ref2 = { ref: \"User.pages.Profile\", path: \"/custom\" }; // object reference\n * const ref3 = { name: \"Dashboard\", path: \"/\" }; // inline definition\n * \n * isPageReference(ref1); // returns true\n * isPageReference(ref2); // returns true\n * isPageReference(ref3); // returns false\n */\nexport function isPageReference(page: PageRef): page is string | PageRefObject {\n return isPageReferenceString(page) || isPageReferenceObject(page);\n}\n\n/**\n * Validate page reference format: \"Alias.pages.PageName\"\n */\nexport const PageRefStringSchema = z\n .string()\n .regex(\n /^[A-Z][a-zA-Z0-9]*\\.pages\\.[A-Z][a-zA-Z0-9]*$/,\n 'Page reference must be in format \"Alias.pages.PageName\" (e.g., \"User.pages.Profile\")',\n );\n\nexport const PageRefObjectSchema = z.object({\n ref: PageRefStringSchema,\n refId: PageIdSchema.optional(),\n // Phase 1.2: optional registry path disambiguator, pairs with `ref`.\n from: z.string().optional(),\n path: z.string().startsWith(\"/\").optional(),\n linkedEntity: z.string().optional(),\n linkedEntityId: EntityIdSchema.optional(),\n traits: z.array(TraitRefSchema).optional(),\n traitRefIds: z.array(TraitIdSchema).optional(),\n access: PageAccessSchema.optional(),\n indexing: PageIndexingSchema.optional(),\n title: PageMetaSchema.optional(),\n description: PageMetaSchema.optional(),\n translationOf: z.string().min(1).optional(),\n label: z.string().optional(),\n icon: z.string().optional(),\n roles: z.array(z.string().min(1)).min(1).optional(),\n});\n\nexport const PageRefSchema = z.union([\n PageSchema,\n PageRefStringSchema,\n PageRefObjectSchema,\n]);\n\n// ============================================================================\n// Orbital Reference\n// ============================================================================\n\n/**\n * OrbitalRefObject - Reference to an imported orbital (\"Alias.orbitals.OrbitalName\"),\n * mirroring PageRefObject/TraitRef's reference-with-overrides shape.\n *\n * Set on `OrbitalDefinition.reference` by lowering and cleared by the\n * compiler's inline phase / runtime's resolver — transient, never present on\n * a fully resolved orbital.\n */\nexport type OrbitalRefObject = {\n /** Reference to imported orbital: \"Alias.orbitals.OrbitalName\" */\n ref: string;\n\n /** V4 dual-carry id sibling of `ref` — optional until the Phase-7 flip. */\n refId?: OrbitalId;\n\n /** `entity E` — rebind the primary entity (bare name). */\n entity?: string;\n\n /** `fields { up: local }` — primary-entity field renames. */\n fields?: Readonly<Record<string, string>>;\n\n /** `pages { \"/up\": \"/local\" }` — route remap; unmapped paths keep the upstream value. */\n pages?: Readonly<Record<string, string>>;\n\n /** `pages { \"/up\": \"/local\" [access: …] }` — page modifiers per remap entry, keyed by the upstream path. */\n pageModifiers?: Readonly<Record<string, PageModifiers>>;\n\n /** Trim the imported trait set to everything but these. */\n omit?: readonly string[];\n\n /** Trim the imported trait set to only these. */\n only?: readonly string[];\n\n /** Overrides of the upstream orbital's DECLARED knobs only. */\n config?: DeclaredTraitConfig;\n\n /** `events { UP: LOCAL }` — orbital-scope rename over every trait's emits + listen keys. */\n events?: Readonly<Record<string, string>>;\n\n /**\n * `roles { approver: [owner, project_manager] employee: team_member }` —\n * remap the upstream's role literals to the consumer roster. Values are\n * ALWAYS arrays, even for a single target: one target is a literal swap\n * (`(= @user.role \"approver\")` → `(= @user.role \"owner\")`); a list rewrites\n * an equality comparison into `(array/includes [...] @user.role)` (and\n * wraps `!=`/`neq` in `not`), and expands the literals of an existing\n * `array/includes` haystack. Every target must be a member of the\n * consumer's `[identity]` role vocabulary.\n */\n roles?: Readonly<Record<string, readonly string[]>>;\n\n /**\n * `entities { Employee: Person }` — retarget an out-of-orbital relation\n * (an entity named by the imported closure but declared by another\n * orbital of the same upstream alias) to a consumer entity. Applied to\n * relation targets, `@Entity` tokens, fetch/persist targets, policy\n * comparisons, and page `primaryEntity` / `sourceEntityDefinition`.\n * `entity E` (the primary rebind) is a separate field, not part of this map.\n */\n entities?: Readonly<Record<string, string>>;\n\n /**\n * `pages { \"/up\": \"/local\" -> TraitA, TraitB }` — sibling traits mounted\n * onto the remapped page, keyed by the UPSTREAM page path. These traits\n * ride the reference body unprefixed; `omit`/`only` never apply to them.\n */\n mounts?: Readonly<Record<string, readonly string[]>>;\n\n /**\n * `extend { field : type = default }` — ADD fields to the upstream primary\n * entity (full entity-field syntax; `fields {}` stays rename-only). Applied\n * after `fields {}` renames; a name colliding with the upstream primary\n * (post-rename) or a `fields {}` rename target refuses resolution\n * (`ORB_O_EXTEND_FIELD_COLLISION`). A relation-typed added field's target\n * resolves in the CONSUMER's own scope, never upstream's. An added field\n * no trait of the materialized orbital ever reads/sets/renders/forwards is\n * a `orb validate` WARNING (`ORB_O_EXTEND_FIELD_UNREAD`), not a JS-resolve\n * concern.\n */\n extend?: readonly EntityField[];\n\n /**\n * `mock { field: \"a, b\" }` — sample data for fields of the materialized\n * primary entity (named after `fields {}` renames, or an `extend {}` field),\n * replacing the upstream field's `@mock`. A key naming no such field is\n * `ORB_O_MOCK_UNKNOWN_FIELD`.\n */\n mock?: Readonly<Record<string, string>>;\n\n /**\n * `retype { field : type = default }` — replace the type/default of fields the\n * upstream primary entity already declares (named after `fields {}` renames).\n * Unlike `extend {}`, every name MUST exist (`ORB_O_RETYPE_UNKNOWN_FIELD`); a\n * field also in `extend {}` or listed twice is `ORB_O_RETYPE_FIELD_CONFLICT`.\n */\n retype?: readonly EntityField[];\n\n /**\n * `entity Name [persistent: tbl]` — override the materialized primary entity's\n * persistence mode. Refused when the upstream entity is not `persistent`\n * (`ORB_O_ENTITY_PERSISTENCE_LOCKED`), the factory-runtime rule.\n */\n persistence?: EntityPersistence;\n\n /** `entity Name [persistent: tbl]` — override the primary entity's collection. */\n collection?: string;\n\n /** Entity-header flags of the `entity` line; each switches the flag ON. */\n shared?: boolean;\n identity?: boolean;\n browser?: boolean;\n\n /**\n * `traits { UpstreamTrait { … } }` — per-imported-trait overrides keyed by the\n * trait's UPSTREAM name (the §8 trait-reference body). A key naming no upstream\n * trait is `ORB_O_TRAITS_UNKNOWN_TRAIT`; one `omit`/`only` dropped is\n * `ORB_O_TRAITS_OMITTED_TRAIT`; a config key the trait never declares is\n * `ORB_O_CONFIG_UNKNOWN_KEY`.\n */\n traits?: Readonly<Record<string, OrbitalRefTraitOverride>>;\n\n /**\n * `listens { Source.EVENT -> Target.TRIGGER }` — declared routes INTO the\n * imported set. Each entry appends one listen to the imported trait named\n * by `trait` (upstream name). A source naming an imported trait follows\n * the prefix; any other source is a host sibling and keeps its name. The\n * trigger is in the post-`events {}` vocabulary. A target outside the\n * imported set (after omit/only) refuses resolution\n * (`ORB_O_LISTEN_TARGET_UNKNOWN`).\n */\n listens?: readonly OrbitalRefListen[];\n};\n\n/** One orbital-import `traits {}` entry: the trait-reference override surface for one imported trait. */\nexport type OrbitalRefTraitOverride = {\n /** `-> Entity`: rebinds the trait's linked entity. */\n linkedEntity?: string;\n config?: DeclaredTraitConfig;\n events?: Readonly<Record<string, string>>;\n fields?: Readonly<Record<string, string>>;\n /** Replaces the trait's whole `listens` array. */\n listens?: readonly TraitEventListener[];\n emitsScope?: EventScope;\n /** `Up [client|optimistic|server]`: replaces the imported trait's declared dispatch mode. */\n dispatch?: TraitDispatchMode;\n};\n\n/** One orbital-import `listens {}` entry: the target imported trait plus an ordinary listen. */\nexport type OrbitalRefListen = TraitEventListener & { trait: string };\n\n/**\n * Validate orbital reference format: \"Alias.orbitals.OrbitalName\"\n */\nexport const OrbitalRefStringSchema = z\n .string()\n .regex(\n /^[A-Z][a-zA-Z0-9]*\\.orbitals\\.[A-Z][a-zA-Z0-9]*$/,\n 'Orbital reference must be \"Alias.orbitals.OrbitalName\"',\n );\n\nexport const OrbitalRefObjectSchema = z.object({\n ref: OrbitalRefStringSchema,\n refId: OrbitalIdSchema.optional(),\n entity: z.string().optional(),\n fields: z.record(z.string(), z.string()).optional(),\n pages: z.record(z.string(), z.string()).optional(),\n pageModifiers: z.record(z.string(), PageModifiersSchema).optional(),\n omit: z.array(z.string()).optional(),\n only: z.array(z.string()).optional(),\n config: DeclaredTraitConfigSchema.optional(),\n events: z.record(z.string(), z.string()).optional(),\n roles: z.record(z.string(), z.array(z.string())).optional(),\n entities: z.record(z.string(), z.string()).optional(),\n mounts: z.record(z.string(), z.array(z.string())).optional(),\n extend: z.array(EntityFieldSchema).optional(),\n mock: z.record(z.string(), z.string()).optional(),\n retype: z.array(EntityFieldSchema).optional(),\n persistence: EntityPersistenceSchema.optional(),\n collection: z.string().optional(),\n shared: z.boolean().optional(),\n identity: z.boolean().optional(),\n browser: z.boolean().optional(),\n traits: z\n .record(\n z.string(),\n z.object({\n linkedEntity: z.string().optional(),\n config: DeclaredTraitConfigSchema.optional(),\n events: z.record(z.string(), z.string()).optional(),\n fields: z.record(z.string(), z.string()).optional(),\n listens: z.array(TraitEventListenerSchema).optional(),\n emitsScope: EventScopeSchema.optional(),\n dispatch: TraitDispatchModeSchema.optional(),\n }),\n )\n .optional(),\n listens: z.array(TraitEventListenerSchema.extend({ trait: z.string() })).optional(),\n});\n\n/**\n * Parses an orbital reference.\n *\n * Extracts the alias and orbital name from an orbital reference\n * in format \"Alias.orbitals.OrbitalName\". Returns null if not a valid orbital reference.\n *\n * @param {string} ref - Orbital reference to parse\n * @returns {{ alias: string; orbitalName: string } | null} Parsed reference or null\n *\n * @example\n * parseOrbitalRef(\"TimeTracking.orbitals.TimesheetPanelOrbital\"); // returns { alias: \"TimeTracking\", orbitalName: \"TimesheetPanelOrbital\" }\n * parseOrbitalRef(\"TimeTracking.traits.X\"); // returns null\n */\nexport function parseOrbitalRef(\n ref: string,\n): { alias: string; orbitalName: string } | null {\n const match = ref.match(/^([A-Z][a-zA-Z0-9]*)\\.orbitals\\.([A-Z][a-zA-Z0-9]*)$/);\n if (!match) return null;\n return { alias: match[1], orbitalName: match[2] };\n}\n\n// ============================================================================\n// Trait Reference Extensions\n// ============================================================================\n\n/**\n * Extended trait reference format for imported traits.\n *\n * Formats:\n * - \"TraitName\" - Local trait (inline or from uses without alias)\n * - \"Alias.traits.TraitName\" - Imported trait with namespace\n *\n * The existing TraitRef type already supports these via string.\n */\n\n/**\n * Validate trait reference format for imported traits.\n */\nexport const ImportedTraitRefStringSchema = z\n .string()\n .regex(\n /^([A-Z][a-zA-Z0-9]*\\.traits\\.)?[A-Z][a-zA-Z0-9]*$/,\n 'Trait reference must be \"TraitName\" or \"Alias.traits.TraitName\"',\n );\n\n/**\n * Checks if a trait reference is an imported reference.\n * \n * Determines if a trait reference uses the imported format\n * \"Alias.traits.TraitName\" rather than a simple \"TraitName\".\n * \n * @param {string} ref - Trait reference to check\n * @returns {boolean} True if reference is imported format, false otherwise\n * \n * @example\n * isImportedTraitRef(\"User.traits.Profile\"); // returns true\n * isImportedTraitRef(\"Profile\"); // returns false\n */\nexport function isImportedTraitRef(ref: string): boolean {\n return /^[A-Z][a-zA-Z0-9]*\\.traits\\.[A-Z][a-zA-Z0-9]*$/.test(ref);\n}\n\n/**\n * Parses an imported trait reference.\n * \n * Extracts the alias and trait name from an imported trait reference\n * in format \"Alias.traits.TraitName\". Returns null if not a valid imported reference.\n * \n * @param {string} ref - Trait reference to parse\n * @returns {{ alias: string; traitName: string } | null} Parsed reference or null\n * \n * @example\n * parseImportedTraitRef(\"User.traits.Profile\"); // returns { alias: \"User\", traitName: \"Profile\" }\n * parseImportedTraitRef(\"Profile\"); // returns null\n */\nexport function parseImportedTraitRef(\n ref: string,\n): { alias: string; traitName: string } | null {\n const match = ref.match(/^([A-Z][a-zA-Z0-9]*)\\.traits\\.([A-Z][a-zA-Z0-9]*)$/);\n if (!match) return null;\n return { alias: match[1], traitName: match[2] };\n}\n\n/**\n * Parses an entity reference.\n * \n * Extracts the alias from an entity reference in format \"Alias.entity\".\n * Returns null if not a valid entity reference.\n * \n * @param {string} ref - Entity reference to parse\n * @returns {{ alias: string } | null} Parsed reference or null\n * \n * @example\n * parseEntityRef(\"User.entity\"); // returns { alias: \"User\" }\n * parseEntityRef(\"User\"); // returns null\n */\nexport function parseEntityRef(ref: string): { alias: string } | null {\n const match = ref.match(/^([A-Z][a-zA-Z0-9]*)\\.entity$/);\n if (!match) return null;\n return { alias: match[1] };\n}\n\n/**\n * Parses a page reference.\n * \n * Extracts the alias and page name from a page reference\n * in format \"Alias.pages.PageName\". Returns null if not a valid page reference.\n * \n * @param {string} ref - Page reference to parse\n * @returns {{ alias: string; pageName: string } | null} Parsed reference or null\n * \n * @example\n * parsePageRef(\"User.pages.Profile\"); // returns { alias: \"User\", pageName: \"Profile\" }\n * parsePageRef(\"Profile\"); // returns null\n */\nexport function parsePageRef(\n ref: string,\n): { alias: string; pageName: string } | null {\n const match = ref.match(/^([A-Z][a-zA-Z0-9]*)\\.pages\\.([A-Z][a-zA-Z0-9]*)$/);\n if (!match) return null;\n return { alias: match[1], pageName: match[2] };\n}\n\n// ============================================================================\n// Event Listener (Legacy)\n// ============================================================================\n\n/**\n * Event listener for cross-orbital communication (legacy format).\n * @deprecated Use trait-level listens with scope instead.\n */\nexport interface EventListener {\n /** Event key to listen for */\n event: string;\n /** Action to trigger */\n triggers: string;\n /** Optional guard condition */\n guard?: string;\n}\n\nexport const EventListenerSchema = z.object({\n event: z.string().min(1),\n triggers: z.string().min(1),\n guard: z.string().optional(),\n});\n\n// ============================================================================\n// Computed Event Contract (Trait-Centric Model)\n// ============================================================================\n\n/**\n * Source of an event - which trait/transition/tick emits it.\n */\nexport type EventSource = {\n /** Trait that emits this event */\n trait: string;\n /** Transition that emits this event (if applicable) */\n transition?: string;\n /** Tick that emits this event (if applicable) */\n tick?: string;\n};\n\nexport const EventSourceSchema = z.object({\n trait: z.string().min(1),\n transition: z.string().optional(),\n tick: z.string().optional(),\n});\n\n/**\n * Computed event contract with source tracking.\n * Generated by aggregating trait-level emits with namespacing.\n */\nexport type ComputedEventContract = {\n /** Namespaced event: \"TraitName.EVENT_NAME\" */\n event: string;\n /** Original event name without namespace */\n originalEvent: string;\n /** Source trait that emits this event */\n source: EventSource;\n /** Human-readable description */\n description?: string;\n /** Payload schema */\n payload?: EventPayloadField[];\n};\n\nexport const ComputedEventContractSchema = z.object({\n event: z.string().min(1),\n originalEvent: z.string().min(1),\n source: EventSourceSchema,\n description: z.string().optional(),\n payload: z.array(EventPayloadFieldSchema).optional(),\n});\n\n/**\n * Computed event listener with source tracking.\n * Generated by aggregating trait-level listens.\n */\nexport type ComputedEventListener = {\n /** Event to listen for (may be namespaced) */\n event: string;\n /** Source trait that defines this listener */\n source: EventSource;\n /** State machine event to trigger */\n triggers: string;\n /** Guard expression */\n guard?: Expression;\n /** `with { ... }` payload rewrite: `{ targetField: SExpr }`, evaluated against the source payload. */\n payloadMapping?: Record<string, SExpr>;\n};\n\nexport const ComputedEventListenerSchema = z.object({\n event: z.string().min(1),\n source: EventSourceSchema,\n triggers: z.string().min(1),\n guard: ExpressionSchema.optional(),\n payloadMapping: z.record(z.string(), SExprSchema).optional(),\n});\n\n// ============================================================================\n// Orbital\n// ============================================================================\n\n/**\n * Orbital - The atomic building block of applications.\n *\n * Formula: Orbital = Entity × Traits × Pages\n *\n * An orbital is a self-contained feature unit that groups:\n * - One entity (the data nucleus) - inline OR referenced via \"Alias.entity\"\n * - Zero or more traits (behavioral patterns) - inline OR referenced via \"Alias.traits.X\"\n * - Zero or more pages (UI entry points) - inline OR referenced via \"Alias.pages.X\"\n *\n * Use `uses` to import other orbitals and access their components.\n */\nexport type Orbital = OrbitalDefinition;\n\nexport type OrbitalDefinition = {\n /** V4 dual-carry id sibling of `name` — optional until the Phase-7 flip. */\n id?: OrbitalId;\n\n /** Human-readable name */\n name: string;\n\n /** Optional description */\n description?: string;\n\n /** Visual prompt override */\n visual_prompt?: string;\n\n // ========================================================================\n // Import System (Unified Reference)\n // ========================================================================\n\n /**\n * Import external orbitals as namespaces.\n *\n * After importing, access components via:\n * - Alias.entity - The entity definition\n * - Alias.traits.TraitName - A specific trait\n * - Alias.pages.PageName - A specific page\n * - Alias.theme - The theme definition\n * - Alias.services.ServiceName - A specific service\n *\n * @example\n * ```json\n * \"uses\": [\n * { \"from\": \"./health.orb\", \"as\": \"Health\" },\n * { \"from\": \"std/behaviors/game-core\", \"as\": \"GameCore\" }\n * ]\n * ```\n */\n uses?: UseDeclaration[];\n\n /**\n * Consumer-side requirement declarations (`.lolo` `expects ...`).\n *\n * Promises about sibling orbitals this unit relies on: trusted as the\n * local type environment when the orbital is validated standalone,\n * link-checked against real providers at compose. Compile-time only —\n * runtime semantics are unchanged.\n * See docs/Almadar_LOLO_Expects_Proposal.md.\n */\n expects?: ExpectDeclaration[];\n\n /** An orbital of only `expects` lines: a spec. It provides nothing; its obligations bind the orbital that imports it. */\n spec?: boolean;\n\n // ========================================================================\n // Theme & Services\n // ========================================================================\n\n /**\n * Theme definition (inline OR reference via \"Alias.theme\").\n *\n * @example\n * ```json\n * // Inline\n * \"theme\": { \"name\": \"ocean\", \"tokens\": { \"colors\": { \"primary\": \"#0ea5e9\" } } }\n *\n * // Reference\n * \"theme\": \"Ocean.theme\"\n * ```\n */\n theme?: ThemeRef;\n\n /**\n * Service definitions (inline OR reference via \"Alias.services.ServiceName\").\n *\n * @example\n * ```json\n * // Inline\n * \"services\": [{ \"name\": \"weather\", \"type\": \"rest\", \"baseUrl\": \"...\" }]\n *\n * // Reference\n * \"services\": [\"Weather.services.openweather\"]\n * ```\n */\n services?: ServiceRef[];\n\n // ========================================================================\n // Components (Inline OR Reference)\n // ========================================================================\n\n /**\n * Entity definition (nucleus).\n *\n * Can be:\n * - Inline: Full entity definition\n * - Reference: \"Alias.entity\" (from uses)\n *\n * Entity sharing depends on persistence type:\n * - persistent: Shared (same DB collection)\n * - runtime: Isolated (each orbital gets own instances)\n */\n entity: EntityRef;\n\n /**\n * Imported atom entities surfaced into this orbital's resolution\n * scope WITHOUT modifying the primary `entity`. Populated by the\n * compiler's inline phase when a trait reference imports an atom\n * and OMITS the `-> Entity` linkedEntity rebind: the atom keeps its\n * own entity (e.g. `SearchResult` from std-search), and that entity\n * is registered here so validators / codegen / runtime can resolve\n * `linkedEntity = \"SearchResult\"` lookups, register persistence for\n * it, and emit its TypeScript type alongside the primary entity.\n * The orbital's per-trait entity arity stays 1:1 — this is purely a\n * NAME-RESOLUTION side channel for cross-import linkedEntity\n * references.\n */\n auxiliaryEntities?: EntityRef[];\n\n /** Trait references (local or imported via \"Alias.traits.TraitName\") */\n traits: TraitRef[];\n\n /**\n * Page definitions.\n *\n * Can be:\n * - Inline: Full page definition\n * - Reference string: \"Alias.pages.PageName\"\n * - Reference object: { ref: \"Alias.pages.PageName\", path: \"/custom\" }\n */\n pages: PageRef[];\n\n // ========================================================================\n // Event Interface (Trait-Centric Model)\n // ========================================================================\n\n /**\n * Events this orbital emits.\n *\n * COMPUTED from trait-level emits:\n * - Aggregated from all traits with `scope: 'external'`\n * - Namespaced as \"TraitName.EVENT_NAME\"\n * - Filtered by `exposes` if present\n *\n * Do not author directly - computed by resolver.\n */\n emits?: ComputedEventContract[];\n\n /**\n * Events this orbital listens for.\n *\n * COMPUTED from trait-level listens:\n * - Aggregated from all traits with `scope: 'external'`\n *\n * Do not author directly - computed by resolver.\n */\n listens?: ComputedEventListener[];\n\n /**\n * Filter which trait events are exposed externally.\n * If omitted, all external-scoped trait events are exposed.\n * Format: [\"TraitName.EVENT_NAME\", ...]\n */\n exposes?: string[];\n\n /** `os-grants { … }` — the `os/` permissions this orbital holds beyond the program's. */\n osGrants?: OsGrants;\n\n /**\n * This orbital's own DECLARED knobs (§4.5) — distinct from `OrbitalSchema.config`,\n * which declares organism-wide knobs shared by every orbital. Traits publish a\n * knob by forwarding `@config.<knob>`; an importer overrides via\n * `OrbitalRefObject.config` or `UseDeclaration.config`.\n */\n config?: DeclaredTraitConfig;\n\n /**\n * TRANSIENT — set by lowering when this orbital is authored as\n * `orbital X = Alias.orbitals.Y { ... }` (the reference form). Cleared by\n * the compiler's inline phase / runtime's resolver during flattening; must\n * never reach validation, codegen, or a committed `.orb`.\n */\n reference?: OrbitalRefObject;\n\n // ========================================================================\n // Context fields - persisted throughout orbital lifecycle\n // ========================================================================\n\n /** Domain context - category, vocabulary, personas */\n domainContext?: DomainContext;\n\n /** Design preferences - style, colors, UX hints */\n design?: DesignPreferences;\n\n /**\n * Suggested guards (decomposition phase only).\n * Natural language descriptions that generator converts to S-expressions.\n * Removed after generation - guards live in traits.\n */\n suggestedGuards?: SuggestedGuard[];\n\n /**\n * This orbital's own named STRUCT aliases (`type X = { ... }`), each\n * flattened to the same payload-field tree emit/listen payloads use.\n * The `.orb`'s only record of a struct alias post-L1 — a Type-kind trait\n * type-param arg (`:: p SomeStructAlias`) resolves against this map.\n * Enum/primitive/entity aliases are NOT carried here (not legal `::`\n * args). A dictionary or list alias (`Map string string`, `[string]`) is one\n * unnamed member (`name: ''`) carrying the type string; a tagged union alias is one\n * unnamed member typed `union` whose `properties` are its variants.\n */\n types?: Record<string, EventPayloadField[]>;\n};\n\n/**\n * A named type alias of an orbital: a record alias is its fields; a dictionary or list alias\n * (`type Cells = Map string string`) is one unnamed member carrying the type string; a tagged union alias\n * (`type Item = Shape | Text`) is one unnamed member typed `union` whose properties are its variants.\n */\nexport const TypeAliasMembersSchema = z.union([\n z.array(EventPayloadFieldSchema),\n z.tuple([EventPayloadTypeMemberSchema.refine((field) => field.name === '', 'An unnamed alias member requires an empty name')]),\n]);\n\nexport const OrbitalDefinitionSchema = z.object({\n id: OrbitalIdSchema.optional(),\n name: z.string().min(1, \"Orbital name is required\"),\n description: z.string().optional(),\n visual_prompt: z.string().optional(),\n // Import system\n uses: z.array(UseDeclarationSchema).optional(),\n // Consumer-side requirement declarations (`.lolo` `expects ...`)\n expects: z.array(ExpectDeclarationSchema).optional(),\n spec: z.boolean().optional(),\n // Theme & Services\n theme: ThemeRefSchema.optional(),\n services: z.array(ServiceRefSchema).optional(),\n // Components (inline or reference)\n entity: EntityRefSchema,\n // Mirrors the `OrbitalDefinition.auxiliaryEntities` type field — WAS\n // undeclared here, so `OrbitalSchemaSchema.safeParse` (every load through\n // `external-loader.ts`) silently stripped it on every externally-loaded\n // orbital (zod drops unrecognized keys by default), while a schema parsed\n // directly via `JSON.parse` kept it. Found via the entity-field auto-merge\n // rebind-target fallback landing on the wrong entity for any RECURSIVELY\n // loaded `uses` file (`packages/almadar-runtime/src/resolver/\n // reference-resolver.ts`'s `mergeImportedEntityFieldsIntoOrbital`).\n auxiliaryEntities: z.array(EntityRefSchema).optional(),\n traits: z.array(TraitRefSchema),\n // A reference-form orbital's pages come from its upstream until inline.\n pages: z.array(PageRefSchema).default([]),\n // Event interface (trait-centric model) - computed by resolver\n emits: z.array(ComputedEventContractSchema).optional(),\n listens: z.array(ComputedEventListenerSchema).optional(),\n // Filter for exposed events (trait-centric model)\n exposes: z.array(z.string()).optional(),\n osGrants: OsGrantsSchema.optional(),\n // This orbital's own declared knobs (§4.5)\n config: DeclaredTraitConfigSchema.optional(),\n // Transient — set by lowering, cleared by inline/resolve\n reference: OrbitalRefObjectSchema.optional(),\n // Context fields - persisted throughout orbital lifecycle\n domainContext: DomainContextSchema.optional(),\n design: DesignPreferencesSchema.optional(),\n suggestedGuards: z.array(SuggestedGuardSchema).optional(),\n types: z.record(z.string(), TypeAliasMembersSchema).optional(),\n}).superRefine((orbital, ctx) => {\n // The compiler's EntityNoFields, which skips a spec's shell entity (`validate_all_entities`).\n if (orbital.spec === true) return;\n const entities: Array<[EntityRef, (string | number)[]]> = [[orbital.entity, ['entity']], ...(orbital.auxiliaryEntities ?? []).map((e, i): [EntityRef, (string | number)[]] => [e, ['auxiliaryEntities', i]])];\n for (const [entity, path] of entities) {\n if (!isEntityReferenceAny(entity) && entity.fields.length === 0) {\n ctx.addIssue({ code: 'too_small', minimum: 1, origin: 'array', inclusive: true, path: [...path, 'fields'], message: 'At least one field is required' });\n }\n }\n});\n\nexport const OrbitalSchema = OrbitalDefinitionSchema;\n\n/**\n * Unwrap a composed trait (`X = Atom.traits.T`) carried as a `{ ref, config?, _resolved }` wrapper to\n * its resolved trait, returning the call-site `config` beside it. A string ref, an inline trait and a\n * wrapper with no `_resolved` come back as they are, with no config.\n */\nexport function unwrapTraitRef(traitRef: TraitRef): { trait: TraitRef; config?: CallSiteConfig } {\n if (typeof traitRef === 'string' || isInlineTrait(traitRef) || traitRef._resolved === undefined) {\n return { trait: traitRef };\n }\n return traitRef.config === undefined\n ? { trait: traitRef._resolved }\n : { trait: traitRef._resolved, config: traitRef.config };\n}\n\n/**\n * The orbitals with every composed-trait wrapper replaced by its inline trait, the call-site `config`\n * folded onto the trait's declared knobs (`mergeCallSiteConfigOverrides`). Pure.\n */\nexport function inlineTraitRefs(orbitals: readonly OrbitalDefinition[]): OrbitalDefinition[] {\n return orbitals.map((orbital) => ({\n ...orbital,\n traits: orbital.traits.map((traitRef) => {\n const { trait, config } = unwrapTraitRef(traitRef);\n if (config === undefined || typeof trait === 'string' || !isInlineTrait(trait)) return trait;\n return { ...trait, config: mergeCallSiteConfigOverrides(trait.config ?? {}, config) };\n }),\n }));\n}\n\n// ============================================================================\n// Type Guards\n// ============================================================================\n\n/**\n * Type guard to check if an Orbital is a full definition.\n * @deprecated No longer needed since Orbital is always OrbitalDefinition now.\n */\nexport function isOrbitalDefinition(\n orbital: Orbital,\n): orbital is OrbitalDefinition {\n return \"entity\" in orbital;\n}\n\n// ============================================================================\n// Type exports\n// ============================================================================\n\nexport type OrbitalInput = z.input<typeof OrbitalSchema>;\n\n// Backward compatibility\nexport type OrbitalUnit = Orbital;\nexport const OrbitalUnitSchema = OrbitalSchema;\n","/**\n * Orbital Schema Type (Self-Contained)\n *\n * Defines the OrbitalSchema - the top-level application definition.\n * An application is a composition of orbitals: App = Σ(Orbitals)\n *\n * @packageDocumentation\n */\n\nimport { z } from \"zod\";\nimport type { EventPayloadField } from \"./trait.js\";\nimport type { Orbital, LazyPage } from \"./orbital.js\";\nimport { OrbitalSchema as OrbitalZodSchema, LazyPageSchema, TypeAliasMembersSchema } from \"./orbital.js\";\nimport type {\n DomainContext,\n DesignPreferences,\n DesignTokens,\n CustomPatternMap,\n} from \"./domain.js\";\nimport {\n DomainContextSchema,\n DesignPreferencesSchema,\n DesignTokensSchema,\n CustomPatternMapSchema,\n} from \"./domain.js\";\nimport type { ServiceDefinition } from \"./service.js\";\nimport { ServiceDefinitionSchema } from \"./service.js\";\nimport type { Trait, DeclaredTraitConfig } from \"./trait.js\";\nimport { DeclaredTraitConfigSchema } from \"./trait.js\";\nimport type { IdentityLedger } from \"./identity.js\";\nimport { IdentityLedgerSchema } from \"./identity.js\";\nimport type { ThemeDefinition, ThemeRef } from \"./domain.js\";\nimport { ThemeDefinitionSchema, ThemeRefSchema } from \"./domain.js\";\nimport type { RuntimeValue } from \"./json.js\";\nimport type { OsGrants, Deployment } from \"./os-grants.js\";\nimport { OsGrantsSchema, DeploymentSchema } from \"./os-grants.js\";\n\n// ============================================================================\n// Orbital Schema\n// ============================================================================\n\n/**\n * OrbitalSchema - The top-level application definition.\n *\n * An application is a composition of orbitals:\n * App = Σ(Orbitals)\n *\n * Custom traits can be defined at the schema level and referenced\n * by orbitals via TraitRef. This allows LLMs to generate custom\n * traits that aren't in the trait library.\n */\n/**\n * One `@config.<knob>` → render-ui prop substitution recorded by the inline\n * phase. Lets a consumer trace a resolved render-ui literal back to the config\n * knob it came from (the `@config.X` string is erased after substitution).\n * Mirrors the Rust `ConfigProvenanceRecord`.\n */\nexport interface ConfigProvenanceRecord {\n /** Resolved trait name (post call-site rename) owning the render-ui effect. */\n trait: string;\n /** Pattern path within the render-ui tree (e.g. `root.children.0`). */\n patternPath?: string;\n /** The pattern-node prop key whose value was a `@config.X` binding. */\n prop: string;\n /** The config knob name (`X` in `@config.X`). */\n knob: string;\n}\n\n/** Compiler-emitted schema metadata — the resolved `.orb` `_metadata` block. */\nexport interface SchemaMetadata {\n version?: number;\n createdAt?: number;\n source?: string;\n updatedAt?: number;\n /** Config→knob provenance keyed by orbital name. See {@link ConfigProvenanceRecord}. */\n configProvenance?: Record<string, ConfigProvenanceRecord[]>;\n /** For a program with `locales`: each loaded behavior → its source folder, relative to the program's (catalogs at `<folder>/locales/<locale>/<name>.json`). */\n messageSources?: Record<string, string>;\n /** Compiled client programs: where each effect operator the client's traits run executes, for a kernel with no operator table. */\n operatorSites?: Record<string, 'client' | 'server' | 'any'>;\n /** Compiled client programs: the operator-table facts a kernel reads at dispatch. */\n dispatchFacts?: DispatchFacts;\n}\n\n/** The operator-table facts a browser kernel reads at dispatch (`emit` busExcluded, `program/dispatch` targetOptions). */\nexport interface DispatchFacts {\n busExcluded: string[];\n targetOptions: string[];\n}\n\n/** App-level site modifiers: `origin`, `icon`, `siteName` (→ `name`), `signIn`. */\nexport interface SiteMeta {\n /** Canonical production origin, e.g. `https://orb.almadar.io`. */\n origin?: string;\n /** Site icon path served from the public folder. */\n icon?: string;\n /** Site name (og:site_name). */\n name?: string;\n /** Route an `access: authenticated` page sends a non-admitted viewer to. */\n signIn?: string;\n}\n\n/**\n * The sign-in route every host provides itself (the compiled shell's login form, the\n * runtime host's sign-in surface). `signIn:` may name it without a page, and no page\n * may be declared on it. Mirrors `orbital-core` `HOST_SIGN_IN_ROUTE`.\n */\nexport const HOST_SIGN_IN_ROUTE = '/login';\n\n/** Whether `path` is {@link HOST_SIGN_IN_ROUTE}, ignoring a trailing slash. */\nexport function isHostSignInRoute(path: string): boolean {\n return path.replace(/\\/+$/, '') === HOST_SIGN_IN_ROUTE;\n}\n\nexport const SiteMetaSchema = z.object({\n origin: z.string().url().optional(),\n icon: z.string().min(1).optional(),\n name: z.string().min(1).optional(),\n signIn: z.string().startsWith('/').optional(),\n}).strict();\n\n/** A program's merged message catalogs: locale → qualified key (`<behavior>:<key>`) → message. `orb resolve` writes one `<stem>.<locale>.json` per locale. */\nexport type MessageCatalogs = Record<string, Record<string, string>>;\n\nexport interface OrbitalSchema {\n types?: Record<string, EventPayloadField[]>;\n typeContractVersion?: 1;\n /** Application name */\n name: string;\n\n /** Description */\n description?: string;\n\n /**\n * App-level theme: the skin every orbital's `@currentTheme` seeds from\n * unless the orbital declares its own `theme` (precedence: orbital →\n * app → the runtime's baseline default). Authored as `theme \"<key>\"` in\n * the `.lolo` app header; a full `<base>-<light|dark>` registry key.\n * Distinct from {@link OrbitalSchema.config} — this names a registry\n * theme, not a declared knob.\n */\n theme?: ThemeRef;\n\n /**\n * The registry themes the program switches to inside a page (a sub-frame's\n * `data-theme`, a theme switcher's options), beyond its app and orbital\n * themes. Authored as `themes: [<key>, …]` in the `.lolo` app header; each\n * a full `<base>-<light|dark>` registry key.\n */\n themes?: string[];\n\n /**\n * The theme presets this program references (app and orbital `theme`\n * keys) plus the runtime default, written by `orb` when it compiles the\n * program for a runtime, so a kernel with no installed `@almadar/core`\n * (wasm, mobile) resolves `@currentTheme` from the program alone. Never\n * authored; absent on a source `.orb`.\n */\n themeDefinitions?: ThemeDefinition[];\n\n /**\n * Short human-readable summary distinct from `description`. Typically an\n * AI-generated one-liner used by app list views, breadcrumbs, and the\n * `GET /graphs/:appId/domain-text` projection. Kept separate from\n * `description` (which may be longer / authored copy) so consumers can\n * present a stable short label without truncating.\n */\n summary?: string;\n\n /** Version (semver) */\n version?: string;\n\n /** Domain context - user request + classification */\n domainContext?: DomainContext;\n\n /** Design preferences */\n design?: DesignPreferences;\n\n /**\n * Design tokens - reusable Tailwind class collections.\n * Reference via `token: \"surfaces.glass\"` in patterns.\n */\n designTokens?: DesignTokens;\n\n /**\n * Custom pattern definitions for app-specific reusable patterns.\n * Register custom designs that can be referenced by name.\n */\n customPatterns?: CustomPatternMap;\n\n /** Array of orbitals */\n orbitals: Orbital[];\n\n /** `locales [en, ar, sl]` — the locales this program ships; every `(i18n/t …)` key must exist in each one's catalog. */\n locales?: string[];\n\n /** `public: \"./public\"` — a folder beside the program copied verbatim to the built site's root. */\n publicDir?: string;\n\n /** `app … [store: Driver]` — the default store-driver orbital for persistent entities that name none. */\n store?: string;\n\n /** Origins (`scheme://host[:port]`) the program's `http` effects may reach. */\n egress?: string[];\n\n /** `os-grants { … }` — the `os/` permissions the whole program holds; every orbital inherits them. */\n osGrants?: OsGrants;\n\n /** `deployment { target: [Orbital, …] }` — which orbitals ship to which target. */\n deployment?: Deployment;\n\n /** `inbound: [...]` — the hook names (`/api/hooks/<name>`) the program accepts deliveries on. */\n inbound?: string[];\n\n /** Site modifiers from the app bracket (`origin`, `icon`, `siteName`, `signIn`). */\n site?: SiteMeta;\n\n /** Pages served by `uses lazy` behaviors, each loaded from its own `.orb` when opened. */\n lazyPages?: LazyPage[];\n\n /** External services */\n services?: ServiceDefinition[];\n\n /**\n * Organism-level DECLARED knobs (§4.5) — shared by every orbital in this\n * schema, forwarded via `@config.<knob>`. Distinct from `Orbital.config`,\n * which declares one orbital's own knobs.\n */\n config?: DeclaredTraitConfig;\n\n /** Compiler-emitted metadata (resolved `.orb` `_metadata`). */\n _metadata?: SchemaMetadata;\n\n /**\n * V4 IR schema version. Distinct from the semver `version` above; gates the\n * identity-keyed reference semantics. Optional/unset for pre-V4 schemas.\n */\n schemaVersion?: number;\n\n /**\n * V4 identity ledger — the sole name↔id map for this schema's nodes. Optional\n * until the Phase-7 flip; absent on pre-V4 schemas.\n */\n ledger?: IdentityLedger;\n}\n\nexport const ConfigProvenanceRecordSchema = z.object({\n trait: z.string(),\n patternPath: z.string().optional(),\n prop: z.string(),\n knob: z.string(),\n});\n\nexport const SchemaMetadataSchema = z.object({\n version: z.number().optional(),\n createdAt: z.number().optional(),\n source: z.string().optional(),\n updatedAt: z.number().optional(),\n configProvenance: z.record(z.string(), z.array(ConfigProvenanceRecordSchema)).optional(),\n messageSources: z.record(z.string(), z.string()).optional(),\n operatorSites: z.record(z.string(), z.enum(['client', 'server', 'any'])).optional(),\n dispatchFacts: z.object({ busExcluded: z.array(z.string()), targetOptions: z.array(z.string()) }).optional(),\n});\n\nexport const OrbitalSchemaSchema: z.ZodType<OrbitalSchema, object> = z.object({\n types: z.record(z.string(), TypeAliasMembersSchema).optional(),\n typeContractVersion: z.literal(1).optional(),\n name: z.string().min(1, \"Schema name is required\"),\n description: z.string().optional(),\n theme: ThemeRefSchema.optional(),\n themes: z.array(z.string().min(1)).optional(),\n themeDefinitions: z.array(ThemeDefinitionSchema).optional(),\n summary: z.string().optional(),\n version: z.string().optional(),\n domainContext: DomainContextSchema.optional(),\n design: DesignPreferencesSchema.optional(),\n designTokens: DesignTokensSchema,\n customPatterns: CustomPatternMapSchema,\n orbitals: z\n .array(OrbitalZodSchema)\n .min(1, \"At least one orbital is required\"),\n locales: z.array(z.string().min(1)).optional(),\n publicDir: z.string().min(1).optional(),\n store: z.string().min(1).optional(),\n egress: z.array(z.string().min(1)).optional(),\n osGrants: OsGrantsSchema.optional(),\n deployment: DeploymentSchema.optional(),\n inbound: z.array(z.string().min(1)).optional(),\n site: SiteMetaSchema.optional(),\n lazyPages: z.array(LazyPageSchema).optional(),\n services: z.array(ServiceDefinitionSchema).optional(),\n config: DeclaredTraitConfigSchema.optional(),\n _metadata: SchemaMetadataSchema.optional(),\n // V4 identity — optional/dual-carry until the Phase-7 flip. Present on\n // id-carrying `.orb` files so `parseOrbitalSchema` preserves them instead\n // of stripping unknown keys.\n schemaVersion: z.number().optional(),\n ledger: IdentityLedgerSchema.optional(),\n});\n\n// ============================================================================\n// Persisted/Flattened View\n// ============================================================================\n\n/**\n * Flattened `OrbitalSchema` view used by the persistence/runtime layer.\n *\n * Canonical `OrbitalSchema` keeps every trait inside its owning\n * `OrbitalDefinition.traits`. Some runtime paths (e.g. the orbital-agent\n * stream, Firestore persistence) additionally roll the resolved trait set up\n * to the top level as `traits[]` so diffs and list views don't have to walk\n * every orbital.\n *\n * This is intentionally a LOSSY persisted view, NOT the canonical authoring\n * shape: it carries the rolled-up array alongside the per-orbital trait\n * lists, and consumers should prefer `OrbitalSchema` whenever the rolled-up\n * surface isn't required.\n */\nexport interface OrbitalSchemaWithTraits extends OrbitalSchema {\n /** Flattened trait set rolled up from all orbitals. Persisted-view only. */\n traits?: Trait[];\n}\n\n// ============================================================================\n// Parsing Functions\n// ============================================================================\n\n/**\n * Parses raw data into a validated OrbitalSchema.\n * \n * Uses Zod validation to ensure the data conforms to the OrbitalSchema structure.\n * Throws a ZodError if validation fails. For safe parsing that doesn't throw,\n * use `safeParseOrbitalSchema()` instead.\n * \n * @param {unknown} data - Raw data to parse (typically JSON)\n * @returns {OrbitalSchema} Validated orbital schema\n * @throws {z.ZodError} If data doesn't match OrbitalSchema structure\n * \n * @example\n * ```typescript\n * try {\n * const schema = parseOrbitalSchema(jsonData);\n * console.log('Valid schema:', schema.name);\n * } catch (error) {\n * console.error('Invalid schema:', error);\n * }\n * ```\n * \n * @see safeParseOrbitalSchema\n */\nexport function parseOrbitalSchema(data: RuntimeValue): OrbitalSchema {\n return OrbitalSchemaSchema.parse(data);\n}\n\n/**\n * Safely parses raw data into a validated OrbitalSchema without throwing.\n * \n * Uses Zod's safeParse method to validate data and return a result object\n * instead of throwing errors. This is useful for form validation and\n * user input handling where you want to gracefully handle invalid data.\n * \n * @param {unknown} data - Raw data to parse (typically JSON)\n * @returns {z.ZodSafeParseResult<OrbitalSchema>} Parse result with success/status\n * \n * @example\n * ```typescript\n * const result = safeParseOrbitalSchema(jsonData);\n * if (result.success) {\n * console.log('Valid schema:', result.data.name);\n * } else {\n * console.error('Validation errors:', result.error);\n * }\n * ```\n * \n * @see parseOrbitalSchema\n */\nexport function safeParseOrbitalSchema(data: RuntimeValue) {\n return OrbitalSchemaSchema.safeParse(data);\n}\n\n// ============================================================================\n// Type exports\n// ============================================================================\n\nexport type OrbitalSchemaInput = z.input<typeof OrbitalSchemaSchema>;\n","/**\n * Observability contract for a running app: one structured log line per entry (Cloud Logging's\n * JSON shape), optionally carrying a call record for one call the app made. `@almadar/logger`\n * writes these; a deployment's topology is read back from them.\n *\n * @packageDocumentation\n */\n\nimport { isJsonObject, type JsonObject, type JsonValue } from './json.js';\n\n/** What a call reached: a browser client, another server, a data store, a queue, or an external service. */\nexport type CallKind = 'client' | 'server' | 'db' | 'queue' | 'external';\n\nexport const CALL_KINDS: readonly CallKind[] = ['client', 'server', 'db', 'queue', 'external'];\n\n/** One call an app made, with its outcome. `error` is present only on a failed call. */\nexport interface CallRecord {\n kind: CallKind;\n /** The service reached: a data backend (`firestore`), an integration (`stripe`), a route prefix. */\n service: string;\n /** The operation: `list:Order`, `charge`, `POST /api/orbitals/:orbital/events`. */\n op: string;\n durationMs: number;\n ok: boolean;\n error?: string;\n}\n\n/** Which deployment a line came from. */\nexport interface LogContext {\n appId?: string;\n deploymentCommit?: string;\n}\n\n/** Cloud Logging severities used by structured lines. */\nexport type LogSeverity = 'DEBUG' | 'INFO' | 'WARNING' | 'ERROR';\n\nexport const LOG_SEVERITIES: readonly LogSeverity[] = ['DEBUG', 'INFO', 'WARNING', 'ERROR'];\n\n/** One structured log line. */\nexport interface StructuredLogEntry extends LogContext {\n severity: LogSeverity;\n time: string;\n namespace: string;\n message: string;\n data?: JsonObject;\n call?: CallRecord;\n}\n\nfunction isCallKind(value: JsonValue | undefined): value is CallKind {\n return typeof value === 'string' && CALL_KINDS.some((k) => k === value);\n}\n\nfunction isSeverity(value: JsonValue | undefined): value is LogSeverity {\n return typeof value === 'string' && LOG_SEVERITIES.some((s) => s === value);\n}\n\nfunction optionalString(value: JsonValue | undefined): boolean {\n return value === undefined || typeof value === 'string';\n}\n\n/** True when `value` is a complete call record; a successful call never carries an error. */\nexport function isCallRecord(value: JsonValue | undefined): value is JsonObject & CallRecord {\n if (value === undefined || !isJsonObject(value)) return false;\n const { kind, service, op, durationMs, ok, error } = value;\n if (!isCallKind(kind) || typeof service !== 'string' || typeof op !== 'string') return false;\n if (typeof durationMs !== 'number' || !Number.isFinite(durationMs) || durationMs < 0) return false;\n if (typeof ok !== 'boolean' || !optionalString(error)) return false;\n return !(ok && error !== undefined);\n}\n\n/** True when `value` is a structured log line, with a well-formed call record if it carries one. */\nexport function isStructuredLogEntry(value: JsonValue): value is JsonObject & StructuredLogEntry {\n if (!isJsonObject(value)) return false;\n const { severity, time, namespace, message, data, call, appId, deploymentCommit } = value;\n if (!isSeverity(severity) || typeof time !== 'string' || typeof namespace !== 'string' || typeof message !== 'string') return false;\n if (data !== undefined && !isJsonObject(data)) return false;\n if (call !== undefined && !isCallRecord(call)) return false;\n return optionalString(appId) && optionalString(deploymentCommit);\n}\n","/**\n * S-Expression Bindings\n *\n * Defines binding types and utilities for S-expression context.\n * Bindings are references to values that are resolved at runtime.\n *\n * Core Bindings:\n * - @entity - The linked entity for this trait (e.g., @entity.health)\n * - @payload - Event payload data (e.g., @payload.amount)\n * - @state - Current state machine state\n * - @now - Current timestamp (Date.now())\n *\n * Entity Bindings:\n * - @EntityName.field - Reference to singleton/runtime entity (e.g., @GameConfig.gravity)\n *\n * @packageDocumentation\n */\n\nimport { z } from 'zod';\n\n// Re-export core binding utilities from expression.ts\nexport {\n isBinding,\n parseBinding,\n isValidBinding,\n CORE_BINDINGS,\n type CoreBinding,\n type ParsedBinding,\n} from './expression.js';\nimport type { SExpr } from './expression.js';\nimport type { RuntimeValue } from './json.js';\n\n// ============================================================================\n// Binding Schema\n// ============================================================================\n\n/**\n * Schema for a binding string.\n * Validates that the string starts with @ and has valid format.\n */\nexport const BindingSchema = z.string().refine(\n (val) => {\n if (!val.startsWith('@')) return false;\n const parts = val.slice(1).split('.');\n if (parts.length === 0 || parts[0] === '') return false;\n // All parts must be valid identifiers (letters, numbers, underscore)\n // supporting unicode characters for i18n\n return parts.every((part) => /^[\\p{L}_][\\p{L}0-9_]*$/u.test(part));\n },\n { message: 'Invalid binding format. Must be @name or @name.path.to.field' }\n);\n\n// ============================================================================\n// Binding Constants\n// ============================================================================\n\n/**\n * Binding documentation for LLM prompts and validation messages.\n * \n * IMPORTANT: Keep synchronized with CORE_BINDINGS in expression.ts\n */\nexport const BINDING_DOCS = {\n entity: {\n description: 'Reference to the linked entity for this trait',\n examples: ['@entity.health', '@entity.x', '@entity.status'],\n requiresPath: true,\n },\n payload: {\n description: 'Reference to the event payload data',\n examples: ['@payload.amount', '@payload.targetId', '@payload.action'],\n requiresPath: true,\n },\n state: {\n description: 'Current state machine state name',\n examples: ['@state'],\n requiresPath: false,\n },\n now: {\n description: 'Current timestamp in milliseconds',\n examples: ['@now'],\n requiresPath: false,\n },\n config: {\n description: 'Trait configuration values',\n examples: ['@config.apiEndpoint', '@config.theme'],\n requiresPath: true,\n },\n computed: {\n description: 'Computed/calculated values',\n examples: ['@computed.total', '@computed.isValid'],\n requiresPath: true,\n },\n trait: {\n description: 'Trait context data',\n examples: ['@trait.name', '@trait.category'],\n requiresPath: true,\n },\n user: {\n description: 'Authenticated user / agent context for ownership and role-based gating',\n examples: ['@user.id', '@user.role'],\n requiresPath: true,\n },\n callsitePayload: {\n description:\n 'Call-site-captured event payload — emitted by the compiler\\'s inline-trait hoisting when an extracted render block captured @payload; resolved at the composing effect by the runtime BindingResolver',\n examples: ['@callsitePayload.error', '@callsitePayload.row'],\n requiresPath: true,\n },\n pages: {\n description:\n 'Render-resolved schema sigil — the host orbital\\'s pages as a NavItem[] array (href = page.path, label = page.name). Substituted from the OrbitalSchema before codegen; never survives as a live binding.',\n examples: ['@pages'],\n requiresPath: false,\n },\n currentTheme: {\n description:\n 'Render-resolved schema sigil — the host orbital\\'s active data-theme key, derived from Orbital.theme. Substituted from the OrbitalSchema before codegen; never survives as a live binding.',\n examples: ['@currentTheme'],\n requiresPath: false,\n },\n locale: {\n description: 'The active locale code (`en`, `ar`, `sl`, …) — the locale whose catalog `i18n/t` reads, set by the host from the route.',\n examples: ['@locale'],\n requiresPath: false,\n },\n event: {\n description: 'The delivery being processed: { event, payload, source } — for a listens delivery the source emit, with its BusEventSource envelope (Runtime Spec Clause 5.5)',\n examples: ['@event.event', '@event.payload.n', '@event.source.trait', '@event.source.tick'],\n requiresPath: false,\n },\n prevEvents: {\n description: 'The deliveries this trait already received in this dispatch, in order, each shaped like @event',\n examples: ['@prevEvents'],\n requiresPath: false,\n },\n prevStates: {\n description: 'The states this trait left in this dispatch, in order',\n examples: ['@prevStates'],\n requiresPath: false,\n },\n fromState: {\n description: \"The transition's source state\",\n examples: ['@fromState'],\n requiresPath: false,\n },\n toState: {\n description: \"The transition's target state (null in a listens `when`, where no transition is chosen yet)\",\n examples: ['@toState'],\n requiresPath: false,\n },\n} as const;\n\n/**\n * Validation rules for bindings in different contexts.\n */\nexport const BINDING_CONTEXT_RULES = {\n guard: {\n allowed: ['entity', 'payload', 'state', 'now', 'config', 'user', 'event', 'prevEvents', 'prevStates', 'fromState', 'toState'] as const,\n description:\n 'Guards can read the delivery being processed and this dispatch\\'s log (@event, @prevEvents, @prevStates) and the transition\\'s ends (@fromState, @toState; Runtime Spec Clause 5.5). Guards can access entity fields, event payload, current state, time, the call-site trait config (@config.X), and the authenticated user context (@user.id, @user.role) for ownership / role gates. Config access lets atoms write mode-aware guards — e.g. std-modal\\'s OPEN can require @payload.row only when @config.mode equals \"edit\", letting create-mode legitimately fire OPEN with no row. Like effects, @config.X is substituted at molecule/organism inline time with the literal call-site value; at atom-scope validate, @config is allowed-but-unresolved.',\n },\n effect: {\n allowed: ['entity', 'payload', 'state', 'now', 'trait', 'config', 'user', 'callsitePayload', 'pages', 'currentTheme', 'locale', 'event', 'prevEvents', 'prevStates', 'fromState', 'toState'] as const,\n description:\n 'Effects can access and modify entity fields, use payload data, embed another trait\\'s live frame via @trait.X inside render-ui children, read trait config values (@config.X) for atoms parameterized by their call-site, and read the authenticated user context (@user.id, @user.role). At molecule/organism inline time, @config.X is substituted with the literal value from the call-site config block; at atom-scope validate, @config is allowed-but-unresolved. @callsitePayload.X is the call-site-captured event payload emitted by the compiler\\'s inline-trait hoisting (a hoisted render block that captured @payload); it is resolved at the composing effect by the runtime BindingResolver.',\n },\n tick: {\n allowed: ['entity', 'state', 'now', 'config', 'user'] as const,\n description: 'Ticks can access entity fields, current state, time, trait config (@config.X) for parameterized atoms, and the authenticated user context (@user.id, @user.role). Same substitution semantics as guards/effects.',\n },\n} as const;\n\nexport type BindingContext = keyof typeof BINDING_CONTEXT_RULES;\n\n// ============================================================================\n// Render-Time Binding Markers\n// ============================================================================\n\n/**\n * Tag property of a `RenderBindingMarker`. `$`-prefixed so it can never\n * collide with a pattern prop key (prop keys are camelCase identifiers).\n */\nexport const RENDER_BINDING_MARKER = '$renderBinding' as const;\n\n/**\n * A render-ui prop leaf that is evaluated at RENDER time, not at flush time.\n *\n * The interpreted path's executor carries `@entity`-dependent leaves into\n * slot content as these markers instead of resolving them eagerly; the\n * renderer (`@almadar/ui`'s SlotContentRenderer) resolves each marker\n * against the live entity store on every render — the same model the\n * compiled shell uses (state-based JSX reading `fields?.X` per React\n * render). Payload-dependent leaves are never deferred: `@payload` is\n * event-scoped and does not exist at render time.\n *\n * A `type` (not `interface`) so it carries an implicit index signature and\n * stays assignable to the `SExpr` record branch at guard call sites.\n */\nexport type RenderBindingMarker = {\n readonly [RENDER_BINDING_MARKER]: true;\n /** The raw prop expression: a binding string (`'@entity.hp'`, embedded\n * form `'HP: @entity.hp'`) or an S-expression tree. */\n readonly expression: SExpr;\n};\n\n/** Narrow an arbitrary prop value to a `RenderBindingMarker`. */\nexport function isRenderBindingMarker(value: RuntimeValue): value is RenderBindingMarker {\n return (\n typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value) &&\n RENDER_BINDING_MARKER in value &&\n value[RENDER_BINDING_MARKER] === true\n );\n}\n\n/** Matches a whole `@entity` token (path or bracket suffix allowed). */\nconst ENTITY_BINDING_RE = /@entity(?=[.\\[\\]]|$)/;\n\n/** Matches a whole `@payload` / `@callsitePayload` token. */\nconst PAYLOAD_BINDING_RE = /@(?:callsitePayload|payload)(?=[.\\[\\]]|$)/;\n\n/**\n * Does this raw prop expression reference `@entity` anywhere (pure binding,\n * embedded-binding string, nested S-expression, or object tree)? Marker\n * objects count as entity-referencing by construction.\n */\nexport function containsEntityBinding(value: SExpr): boolean {\n if (typeof value === 'string') return ENTITY_BINDING_RE.test(value);\n if (Array.isArray(value)) return value.some(containsEntityBinding);\n if (value !== null && typeof value === 'object') {\n if (isRenderBindingMarker(value)) return true;\n return Object.values(value as Record<string, SExpr>).some(containsEntityBinding);\n }\n return false;\n}\n\n/**\n * Does this raw prop expression reference the event payload (`@payload` /\n * `@callsitePayload`) anywhere? Such leaves stay flush-time evaluated —\n * the payload does not exist at render time.\n */\nexport function containsPayloadBinding(value: SExpr): boolean {\n if (typeof value === 'string') return PAYLOAD_BINDING_RE.test(value);\n if (Array.isArray(value)) return value.some(containsPayloadBinding);\n if (value !== null && typeof value === 'object') {\n return Object.values(value as Record<string, SExpr>).some(containsPayloadBinding);\n }\n return false;\n}\n\n// ============================================================================\n// Binding Validation Helpers\n// ============================================================================\n\n/**\n * Check if a binding is valid in a given context.\n *\n * @param binding - Parsed binding\n * @param context - Context where binding is used\n * @returns Error message if invalid, null if valid\n */\nexport function validateBindingInContext(\n binding: { type: 'core' | 'entity'; root: string },\n context: BindingContext\n): string | null {\n const rules = BINDING_CONTEXT_RULES[context];\n\n if (binding.type === 'core') {\n if (!(rules.allowed as readonly string[]).includes(binding.root)) {\n return `Binding @${binding.root} is not allowed in ${context} context. Allowed: ${rules.allowed.join(', ')}`;\n }\n }\n\n // Entity bindings are always allowed (they reference singletons/runtime entities)\n return null;\n}\n\n/**\n * Get all valid binding examples for a context.\n *\n * @param context - Context to get examples for\n * @returns Array of example binding strings\n */\nexport function getBindingExamples(context: BindingContext): string[] {\n const rules = BINDING_CONTEXT_RULES[context];\n const examples: string[] = [];\n\n for (const binding of rules.allowed) {\n const doc = BINDING_DOCS[binding];\n examples.push(...doc.examples);\n }\n\n // Add entity binding example\n examples.push('@GameConfig.gravity', '@Filter.searchTerm');\n\n return examples;\n}\n","/**\n * Binding root classification\n *\n * The prefix of an `@X.path` binding expression identifies which runtime\n * context resolves the rest of the path. This type is the TS-side mirror\n * of `OirBindingRoot` in `orbital-core`'s IR; publishing it from\n * `@almadar/core` lets the codegen, the runtime binding resolver, and\n * the verifier's schema walker all refer to the same narrow union.\n *\n * Distinct from {@link ParsedBinding.root} (which is a plain string): use\n * `BindingRoot` whenever you need exhaustiveness over the known prefixes.\n *\n * - `entity`: `@entity.field` — the trait's linked entity (first row on\n * the client, `getById` result on the server).\n * - `payload`: `@payload.x` — the last event's payload.\n * - `state`: `@state.x` — the state machine's `state` slot (rare;\n * mostly used for guard/effect contexts).\n * - `config`: `@config.x` — the trait ref's merged config from the\n * molecule call site.\n * - `user`: `@user.x` — authenticated user / agent context.\n * - `trait`: `@trait.x` — render-time reference to another trait's\n * mounted view. Resolved by `<TraitFrame>` at runtime, not by the\n * SExpression compiler.\n * - `now`: `@now` — the dispatch's one timestamp (Runtime Spec Clause 8.5).\n * - `callsitePayload`: `@callsitePayload.x` — a composing transition's\n * payload captured for an inlined child trait (compiler-produced).\n * - `pages` / `currentTheme`: render-resolved schema sigils (no path).\n * - `event`, `prevEvents`, `prevStates`, `fromState`, `toState`: the delivery\n * being processed and this dispatch's log (Runtime Spec Clause 5.5).\n * - `other`: not a root — a lambda/let local (`@item`) or an\n * entity-reference binding (`@User.name`).\n *\n * The author-facing roots are the i18n `sigils` table; the orbital-compiler\n * validator's `CORE_BINDING_ROOTS` is the same set as `BINDING_ROOTS` minus `other`.\n *\n * @packageDocumentation\n */\n\nimport { z } from 'zod';\nimport type { RuntimeValue } from './json.js';\n\nexport type BindingRoot =\n | 'entity'\n | 'payload'\n | 'state'\n | 'now'\n | 'config'\n | 'trait'\n | 'user'\n | 'callsitePayload'\n | 'pages'\n | 'currentTheme'\n | 'locale'\n | 'event'\n | 'prevEvents'\n | 'prevStates'\n | 'fromState'\n | 'toState'\n | 'fromEntity'\n | 'other';\n\n/** Every known binding root, in a stable order — useful for exhaustiveness checks. */\nexport const BINDING_ROOTS: readonly BindingRoot[] = [\n 'entity',\n 'payload',\n 'state',\n 'now',\n 'config',\n 'trait',\n 'user',\n 'callsitePayload',\n 'pages',\n 'currentTheme',\n 'locale',\n 'event',\n 'prevEvents',\n 'prevStates',\n 'fromState',\n 'toState',\n 'fromEntity',\n 'other',\n] as const;\n\nconst KNOWN_ROOTS = new Set<string>(BINDING_ROOTS.filter((r) => r !== 'other'));\n\n/**\n * Narrow a raw binding-root string (e.g. the `root` field of\n * `ParsedBinding` from `./expression.ts`) to a `BindingRoot`. Returns\n * `'other'` for entity-reference roots like `@User.name` or unknown\n * prefixes.\n */\nexport function toBindingRoot(root: string): BindingRoot {\n return KNOWN_ROOTS.has(root) ? (root as BindingRoot) : 'other';\n}\n\n/**\n * A trait reference string of the form `@trait.<TraitName>`. Used as the\n * value type for `trait`-typed config fields. The runtime + compiled codegen\n * both substitute this with embedded trait UI at render time.\n *\n * Branded as a literal-template type so TS narrows on use; consumers should\n * call {@link isTraitFieldRef} to validate runtime values before assignment.\n */\nexport type TraitFieldRef = `@trait.${string}`;\n\nconst TRAIT_REF_PATTERN = /^@trait\\.[A-Z][a-zA-Z0-9]*$/;\n\n/** Type guard: narrow an unknown value to {@link TraitFieldRef}. */\nexport function isTraitFieldRef(value: RuntimeValue): value is TraitFieldRef {\n return typeof value === 'string' && TRAIT_REF_PATTERN.test(value);\n}\n\n/** Zod schema for {@link TraitFieldRef} values. Useful when validating analyzer\n * JSON or recipe overrides at runtime boundaries. */\nexport const TraitFieldRefSchema = z\n .string()\n .regex(TRAIT_REF_PATTERN, 'expected `@trait.<TraitName>` reference');\n","/**\n * Agent Types\n *\n * Defines the AgentContext interface and related types for the agent/* operator namespace.\n * These types are the contract between operators (language) and implementation (runtime).\n *\n * @packageDocumentation\n */\n\nimport type { ServiceParams } from './service.js';\nimport type { EventPayloadValue } from './expression.js';\nimport type { FieldValue } from './entity.js';\nimport type { JsonSchema } from '../factory/types.js';\nimport type { ValidationError } from './validation.js';\nimport type { Orbital } from './orbital.js';\nimport type { OrbitalSchema } from './schema.js';\nimport type { JsonValue, RuntimeValue } from './json.js';\nimport type { AnalysisResult, PlanSnapshot } from './plan.js';\n\n// ============================================================================\n// Agent Memory Types\n// ============================================================================\n\n/**\n * Categories for agent memories.\n */\nexport type AgentMemoryCategory =\n | 'preference'\n | 'correction'\n | 'pattern-affinity'\n | 'entity-template'\n | 'error-resolution';\n\n/**\n * A single memory record stored by the agent.\n */\nexport interface AgentMemoryRecord {\n /** Unique memory identifier */\n id: string;\n /** Memory content (natural language) */\n content: string;\n /** Memory category */\n category: AgentMemoryCategory;\n /** Strength value (0.0-1.0), decays over time unless pinned */\n strength: number;\n /** Whether this memory is pinned (immune to decay) */\n pinned: boolean;\n /** Memory scope */\n scope: 'global' | 'project';\n /** ISO timestamp of last access */\n lastAccessedAt: string;\n /** ISO timestamp of creation */\n createdAt: string;\n}\n\n// ============================================================================\n// Agent Context Types\n// ============================================================================\n\n/**\n * Strategy for context compaction.\n */\nexport type AgentCompactStrategy = 'hybrid' | 'summarize' | 'truncate' | 'extract';\n\n/**\n * Result of a context compaction operation.\n */\nexport interface AgentCompactResult {\n /** Token count before compaction */\n before: number;\n /** Token count after compaction */\n after: number;\n /** Strategy used */\n strategy: AgentCompactStrategy;\n /** Optional summary generated during compaction */\n summary?: string;\n}\n\n// ============================================================================\n// Agent LLM Types\n// ============================================================================\n\n/**\n * Options for agent/generate calls.\n */\nexport interface AgentGenerateOptions {\n /** LLM provider override */\n provider?: string;\n /** Model override */\n model?: string;\n /** Maximum tokens to generate */\n maxTokens?: number;\n}\n\n// ============================================================================\n// LLM Tool-Calling Contract Types\n// ============================================================================\n//\n// These are the LANGUAGE-LEVEL contract types for the llm/* substrate\n// operators. The provider chat-completion types are the WIRE FORMAT; the\n// runtime handler maps between them. Defined here so\n// the dependency direction stays core → nothing.\n\n/**\n * A message in an LLM tool-calling conversation.\n */\nexport interface LlmMessage {\n role: 'system' | 'user' | 'assistant' | 'tool';\n content: string;\n /** Present on assistant messages that called tools. */\n toolCalls?: ReadonlyArray<LlmToolCall>;\n /** Present on tool-role messages — matches the preceding toolCall's id. */\n toolCallId?: string;\n}\n\n/**\n * A tool call requested by the assistant.\n */\nexport interface LlmToolCall {\n id: string;\n name: string;\n /** JSON-encoded arguments string (as returned by the LLM). */\n arguments: string;\n}\n\n/**\n * A tool definition passed to llm/call-tools.\n */\nexport interface LlmToolDef {\n name: string;\n description: string;\n /** JSON Schema describing the tool's parameters. */\n parameters: JsonSchema;\n}\n\n/**\n * Result of llm/call-tools.\n */\nexport interface LlmCallToolsResult {\n /** The assistant's text response (may be empty when only tool_calls fired). */\n content: string;\n /** Tool calls the assistant requested, if any. */\n toolCalls?: ReadonlyArray<LlmToolCall>;\n /** Token usage from the call. */\n usage: LlmTokenUsage;\n}\n\n/**\n * Token usage from an LLM call.\n */\nexport interface LlmTokenUsage {\n prompt: number;\n completion: number;\n total: number;\n}\n\n// ============================================================================\n// Agent Search Types\n// ============================================================================\n\n/**\n * Result from agent/search-code.\n */\nexport interface AgentCodeSearchResult {\n /** Repository name (owner/repo) */\n repo: string;\n /** File path within the repository */\n path: string;\n /** URL to the file */\n url: string;\n}\n\n// ============================================================================\n// Substrate Result Types\n// ============================================================================\n//\n// Language-level contracts for compose/behavior/validate operator returns.\n// Defined in @almadar/core (not @almadar-io/rabit) because the compiled path\n// also needs them — emitted TS code references these types without depending\n// on rabit. rabit's TS implementations produce/consume these shapes.\n\n/** Result of validate/validate for a single orbital or the composed schema. */\nexport interface ValidateResult {\n valid: boolean;\n errorCount: number;\n errors: ValidationError[];\n orbitalName?: string;\n}\n\n/** Result of the repair service. */\nexport interface RepairResult {\n orbitalName: string;\n success: boolean;\n attempt: number;\n paramsChanged: boolean;\n error?: string;\n}\n\n/** Result of the planner service. */\nexport interface PlannerResult {\n organism: string;\n operationCount: number;\n pendingQuestions: boolean;\n cached: boolean;\n success: boolean;\n error?: string;\n}\n\n/** Result of the executor (spawn-subagents). */\nexport interface ExecutePlanResult {\n dispatchedOrbitals: string[];\n noopForBuild: boolean;\n success: boolean;\n error?: string;\n}\n\n/** Result of dispatch-updates. */\nexport interface DispatchUpdatesResult {\n updatedOrbitals: string[];\n updateCount: number;\n success: boolean;\n}\n\n/** Discriminated union of all substrate service-call results. */\nexport type ServiceCallResult =\n | ValidateResult\n | RepairResult\n | PlannerResult\n | ExecutePlanResult\n | DispatchUpdatesResult;\n\n// ============================================================================\n// Session History\n// ============================================================================\n\n/** A single entry in an orbital's session history (build/conversation log). */\nexport interface SessionHistoryEntry {\n /** Role of the entry's author (e.g. 'user', 'assistant', 'system') */\n role: string;\n /** Entry content (natural language or structured description) */\n content: string;\n /** Epoch milliseconds when the entry was recorded */\n timestamp: number;\n}\n\n/**\n * Runtime guard for `SessionHistoryEntry` — narrows interpreter-produced\n * `unknown` values at the `SessionContext.appendHistory` boundary.\n */\nexport function isSessionHistoryEntry(value: RuntimeValue): value is SessionHistoryEntry {\n if (typeof value !== 'object' || value === null) return false;\n return (\n 'role' in value && typeof value.role === 'string' &&\n 'content' in value && typeof value.content === 'string' &&\n 'timestamp' in value && typeof value.timestamp === 'number'\n );\n}\n\n// ============================================================================\n// Agent Context Interface\n// ============================================================================\n\n/**\n * AgentContext is the runtime contract for agent/* operators.\n *\n * The evaluator dispatches agent/* operators to methods on this interface.\n * Pure methods (usable in guards) return synchronously.\n * Effect methods return Promises.\n *\n * When ctx.agent is undefined, operators return safe defaults ([], 0, false, \"\").\n * Implementations live in @almadar-io/agent-runtime (Phase 2B).\n */\nexport interface AgentContext {\n // Memory (pure)\n recall(query: string, limit?: number): AgentMemoryRecord[];\n memories(category?: AgentMemoryCategory): AgentMemoryRecord[];\n memoryStrength(id: string): number;\n isPinned(id: string): boolean;\n\n // Memory (effects)\n memorize(content: string, category: AgentMemoryCategory, scope?: 'global' | 'project'): Promise<string>;\n forget(id: string): Promise<void>;\n pin(id: string): Promise<void>;\n reinforce(id: string): Promise<void>;\n decay(): Promise<number>;\n\n // LLM (pure)\n provider(): string;\n model(): string;\n\n // LLM (effects)\n generate(prompt: string, options?: AgentGenerateOptions): Promise<string>;\n switchProvider(provider: string, model?: string): void;\n\n // Tools (pure)\n tools(): string[];\n\n // Tools (effects)\n invoke(toolName: string, args: ServiceParams): Promise<EventPayloadValue>;\n\n // Context (pure)\n tokenCount(): number;\n contextUsage(): number;\n\n // Context (effects)\n compact(strategy?: AgentCompactStrategy): Promise<AgentCompactResult>;\n\n // Session (pure)\n sessionId(): string;\n\n // Session (effects)\n fork(label?: string): Promise<string>;\n label(text: string): void;\n\n // Search (effects)\n searchCode(query: string, language?: string): Promise<AgentCodeSearchResult[]>;\n}\n\n// ============================================================================\n// Substrate Context Interfaces\n// ============================================================================\n//\n// Focused runtime contracts for the substrate operator namespaces. Each\n// interface backs one module of operators (llm/*, workspace/*, etc.). The\n// evaluator reads from ctx.<namespace>; the runtime (rabit) supplies\n// concrete implementations via contextExtensions. When a context is\n// undefined, operators return safe defaults (matching the agent/* pattern).\n\n/** Backs the llm/* operators (6 ops). */\nexport interface LlmContext {\n generate(prompt: string, options?: { json?: boolean; maxTokens?: number; provider?: string; model?: string }): Promise<string>;\n callTools(messages: LlmMessage[], tools: LlmToolDef[]): Promise<LlmCallToolsResult>;\n embed(texts: string[]): Promise<number[][]>;\n tokenCount(): number;\n switchProvider(provider: string, model?: string): void;\n compact(strategy?: string): Promise<{ before: number; after: number }>;\n}\n\n/** Backs the workspace/* operators (11 ops). */\nexport interface WorkspaceContext {\n readOrbital(name: string): Promise<Orbital>;\n writeOrbital(name: string, content: Orbital): Promise<void>;\n readFile(path: string): Promise<string>;\n writeFile(path: string, content: string): Promise<void>;\n exists(path: string): boolean;\n listOrbitals(): string[];\n readSchema(): Promise<OrbitalSchema>;\n writeSchema(schema: OrbitalSchema): Promise<void>;\n readPlan(): Promise<PlanSnapshot>;\n writePlan(plan: PlanSnapshot): Promise<void>;\n archiveOrbital(name: string): Promise<void>;\n}\n\n/** Backs the session/* operators (9 ops). */\nexport interface SessionContext {\n readSpec(orbitalName: string): Promise<Orbital>;\n writeSpec(orbitalName: string, spec: Orbital): Promise<void>;\n readMemory(orbitalName: string): Promise<AgentMemoryRecord[]>;\n writeMemory(orbitalName: string, memory: AgentMemoryRecord[]): Promise<void>;\n readHistory(orbitalName: string): Promise<SessionHistoryEntry[]>;\n appendHistory(orbitalName: string, entry: SessionHistoryEntry): Promise<void>;\n readErrors(orbitalName: string): Promise<string[]>;\n writeErrors(orbitalName: string, errors: string[]): Promise<void>;\n readAnalysis(orbitalName: string): Promise<AnalysisResult>;\n}\n\n/** Backs the memory/* operators (3 ops). */\nexport interface MemoryContext {\n recall(query: string, limit?: number): AgentMemoryRecord[];\n store(content: string, category?: string, strength?: number): Promise<string>;\n list(category?: string): AgentMemoryRecord[];\n}\n\n/** Backs the trace/* operators (2 ops). */\nexport interface TraceContext {\n emit(event: string, payload?: EventPayloadValue): void;\n log(message: string, level?: 'log' | 'warn' | 'error', data?: EventPayloadValue): void;\n}\n","/**\n * Plan & Analysis Types\n *\n * Lifted from @almadar-io/rabit's coordinator types. These are the\n * language-level contracts for the planner/analysis pipeline — the\n * session/* and workspace/* substrate operators produce and consume\n * these shapes. Defined here (not in rabit) so both the compiled path\n * (orbital-rust codegen → @almadar/server) and the interpreted path\n * (@almadar/runtime) reference the same types without depending on rabit.\n *\n * @packageDocumentation\n */\n\nimport type { EntityField } from './field.js';\nimport type { EntityPersistence } from './entity.js';\nimport type { RuntimeValue } from './json.js';\nimport type { OrbitalSchema } from './schema.js';\nimport type { PageTraitRef } from './page.js';\nimport type { TraitReference, TraitConfigObject } from './trait.js';\nimport type { ThemeDefinition } from './domain.js';\nimport type { RuleOverlay, TraitOverlay } from '../factory/overlays.js';\nimport type {\n EventWiringEntry,\n LayoutStrategy,\n MakeTraitRefOpts,\n} from '../builders/index.js';\n\n// ============================================================================\n// Clarification System\n// ============================================================================\n\nexport type ClarificationLevel = 'organism' | 'molecule' | 'atom_trait';\n\nexport interface ClarificationCandidate {\n id: string;\n label: string;\n description: string;\n whyThisFits: string;\n}\n\nexport interface Clarification {\n level: ClarificationLevel;\n scope: { orbitalName?: string; traitName?: string };\n question: string;\n candidates: ClarificationCandidate[];\n skipDefault: string;\n skippable: true;\n}\n\n// ============================================================================\n// Orbital Analysis Params\n// ============================================================================\n\nexport interface AnalysisPageOverride {\n name: string;\n path?: string;\n linkedEntity?: string;\n traits?: PageTraitRef[];\n}\n\nexport interface ExtraTraitRef\n extends Pick<\n TraitReference,\n 'ref' | 'name' | 'linkedEntity' | 'config' | 'events' | 'listens' | 'emitsScope'\n > {\n from: string;\n as: string;\n}\n\nexport interface AnalysisOrbitalParams {\n fields?: EntityField[];\n pagePath?: string;\n persistence?: EntityPersistence;\n entityName?: string;\n collection?: string;\n traitOverrides?: Record<\n string,\n Pick<MakeTraitRefOpts, 'config' | 'linkedEntity' | 'events' | 'name' | 'emitsScope' | 'listens'>\n >;\n extraTraits?: ExtraTraitRef[];\n pages?: AnalysisPageOverride[];\n}\n\n// ============================================================================\n// Analysis Result\n// ============================================================================\n\nexport interface AnalysisOrbital {\n orbitalName: string;\n suggestedBehavior: string | null;\n entityName?: string;\n pageNames?: ReadonlyArray<string>;\n params?: AnalysisOrbitalParams;\n traitOverlay?: TraitOverlay;\n paletteTopics?: string[];\n primitiveHints?: string[];\n}\n\nexport interface AnalysisRename {\n oldName: string;\n newName: string;\n}\n\nexport interface ComplexityAssessment {\n score: number;\n category: 'simple' | 'moderate' | 'complex';\n reasoning: string;\n detectedEntities?: string[];\n detectedFeatures?: string[];\n}\n\nexport interface AnalysisResult {\n userRequest: string;\n complexity: ComplexityAssessment;\n route: 'direct' | 'direct_with_questions' | 'decompose';\n organism: string;\n appName: string;\n organismReason: string;\n orbitals: AnalysisOrbital[];\n renames?: AnalysisRename[];\n deletedOrbitals?: string[];\n ruleOverlay?: RuleOverlay;\n estimatedMinutes?: number;\n schema: OrbitalSchema;\n wiring?: EventWiringEntry[];\n layout?: LayoutStrategy | 'detect';\n themeOverrides?: Partial<ThemeDefinition>;\n pendingClarifications?: Clarification[];\n}\n\n// ============================================================================\n// Plan Snapshot\n// ============================================================================\n\nexport interface SpawnResult {\n orbitalName: string;\n ok: boolean;\n traitNames: ReadonlyArray<string>;\n error?: string;\n durationMs: number;\n}\n\nexport type PlanSnapshotStatus = 'proposed' | 'confirmed' | 'built' | 'failed';\n\nexport interface PlanSnapshot {\n schemaVersion: 1;\n status: PlanSnapshotStatus;\n builtAt: string;\n organism: string | null;\n appName: string | null;\n organismReason: string | null;\n complexity: ComplexityAssessment | null;\n themeOverrides: Partial<ThemeDefinition>;\n ruleOverlay: RuleOverlay | null;\n orbitals: ReadonlyArray<AnalysisOrbital>;\n renames: ReadonlyArray<AnalysisRename>;\n deletedOrbitals: ReadonlyArray<string>;\n priorBuiltOrbitals: ReadonlyArray<AnalysisOrbital>;\n spawnedOrbitalResults: ReadonlyArray<SpawnResult>;\n skippedOrbitalNames: ReadonlyArray<string>;\n pendingClarifications: ReadonlyArray<Clarification>;\n paletteTopics?: string[];\n}\n\n/**\n * Runtime guard for `PlanSnapshot` — narrows interpreter-produced `unknown`\n * values at the `WorkspaceContext.writePlan` boundary. Discriminates on the\n * snapshot envelope (schemaVersion, status, roster arrays), not deep contents.\n */\nexport function isPlanSnapshot(value: RuntimeValue): value is PlanSnapshot {\n if (typeof value !== 'object' || value === null) return false;\n const statuses: ReadonlyArray<PlanSnapshotStatus> = ['proposed', 'confirmed', 'built', 'failed'];\n return (\n 'schemaVersion' in value && value.schemaVersion === 1 &&\n 'status' in value && statuses.some((s) => s === value.status) &&\n 'builtAt' in value && typeof value.builtAt === 'string' &&\n 'orbitals' in value && Array.isArray(value.orbitals) &&\n 'renames' in value && Array.isArray(value.renames) &&\n 'deletedOrbitals' in value && Array.isArray(value.deletedOrbitals)\n );\n}\n\n// ============================================================================\n// Compose Options\n// ============================================================================\n\nexport interface ComposeOptions {\n appName?: string;\n wiring?: EventWiringEntry[];\n layout?: LayoutStrategy | 'auto';\n themeOverrides?: Partial<ThemeDefinition>;\n}\n\n","/**\n * Interaction Model Types\n *\n * Defines how users interact with entities in the application.\n * Used to drive trait selection and UI slot usage.\n *\n * @packageDocumentation\n */\n\nimport { z } from 'zod';\n\n// ============================================================================\n// Flow Types\n// ============================================================================\n\n/**\n * Create flow - how new items are created\n */\nexport type CreateFlow = 'modal' | 'page' | 'inline' | 'none';\n\n/**\n * Edit flow - how items are edited\n */\nexport type EditFlow = 'modal' | 'page' | 'inline' | 'none';\n\n/**\n * View flow - how item details are viewed\n */\nexport type ViewFlow = 'drawer' | 'page' | 'modal' | 'inline' | 'none';\n\n/**\n * Delete flow - how items are deleted\n */\nexport type DeleteFlow = 'confirm' | 'instant' | 'none';\n\n/**\n * List interaction - what happens when clicking list items\n */\nexport type ListInteraction = 'click-to-view' | 'click-to-edit' | 'inline-edit';\n\n// ============================================================================\n// Interaction Model\n// ============================================================================\n\n/**\n * InteractionModel - defines how users interact with entities.\n *\n * This drives:\n * - Which traits to attach (EntityManagement, ModalEdit, etc.)\n * - How render_ui effects target slots (modal, drawer, page)\n * - What UI patterns to use\n */\nexport interface InteractionModel {\n /** How new items are created */\n createFlow: CreateFlow;\n\n /** How items are edited */\n editFlow: EditFlow;\n\n /** How item details are viewed */\n viewFlow: ViewFlow;\n\n /** How items are deleted */\n deleteFlow: DeleteFlow;\n\n /** What happens when clicking list items */\n listInteraction?: ListInteraction;\n\n /** Enable bulk actions (select multiple, delete all) */\n bulkActions?: boolean;\n\n /** Enable real-time updates */\n realtime?: boolean;\n}\n\nexport const InteractionModelSchema = z.object({\n createFlow: z.enum(['modal', 'page', 'inline', 'none']),\n editFlow: z.enum(['modal', 'page', 'inline', 'none']),\n viewFlow: z.enum(['drawer', 'page', 'modal', 'inline', 'none']),\n deleteFlow: z.enum(['confirm', 'instant', 'none']),\n listInteraction: z.enum(['click-to-view', 'click-to-edit', 'inline-edit']).optional(),\n bulkActions: z.boolean().optional(),\n realtime: z.boolean().optional(),\n});\n\n// ============================================================================\n// Default Models per Domain\n// ============================================================================\n\n/**\n * Default interaction models for each domain type\n */\nexport const DEFAULT_INTERACTION_MODELS: Record<string, InteractionModel> = {\n business: {\n createFlow: 'modal',\n editFlow: 'modal',\n viewFlow: 'drawer',\n deleteFlow: 'confirm',\n listInteraction: 'click-to-view',\n bulkActions: true,\n },\n game: {\n createFlow: 'none',\n editFlow: 'none',\n viewFlow: 'none',\n deleteFlow: 'none',\n realtime: true,\n },\n form: {\n createFlow: 'inline',\n editFlow: 'inline',\n viewFlow: 'none',\n deleteFlow: 'none',\n },\n dashboard: {\n createFlow: 'modal',\n editFlow: 'modal',\n viewFlow: 'drawer',\n deleteFlow: 'confirm',\n listInteraction: 'click-to-view',\n },\n content: {\n createFlow: 'page',\n editFlow: 'page',\n viewFlow: 'page',\n deleteFlow: 'confirm',\n listInteraction: 'click-to-view',\n },\n};\n\n/**\n * Gets the interaction model for a domain.\n * \n * Retrieves the appropriate interaction model configuration based on the\n * specified domain. Falls back to the business model if no specific\n * domain match is found.\n * \n * @param {string} domain - Domain name (e.g., 'healthcare', 'education')\n * @returns {InteractionModel} Interaction model configuration\n * \n * @example\n * getInteractionModelForDomain('healthcare'); // returns healthcare-specific model\n * getInteractionModelForDomain('unknown'); // returns business fallback model\n */\nexport function getInteractionModelForDomain(domain: string): InteractionModel {\n return DEFAULT_INTERACTION_MODELS[domain] ?? DEFAULT_INTERACTION_MODELS.business;\n}\n\n// ============================================================================\n// Type exports\n// ============================================================================\n\nexport type InteractionModelInput = z.input<typeof InteractionModelSchema>;\n","/**\n * Pattern Type for Orbital Units\n *\n * Re-exports pattern type definitions from @almadar/core/patterns,\n * which is the single source of truth for all pattern types.\n *\n * @packageDocumentation\n */\n\nimport { z } from 'zod';\n\n// ============================================================================\n// Pattern Type - Re-exported from @almadar/core/patterns\n// ============================================================================\n\n/**\n * All valid pattern type names, imported from the @almadar/core/patterns registry.\n * The authoritative list is auto-generated from patterns-registry.json.\n */\nexport {\n PATTERN_TYPES,\n isValidPatternType,\n} from '../patterns/index.js';\nexport type { PatternType } from '../patterns/index.js';\n\n/**\n * Zod schema for pattern types.\n * Accepts any string - validation against full registry happens at runtime.\n */\nexport const PatternTypeSchema = z.string();\n","/**\n * Changeset & Snapshot Types\n *\n * Unified types for schema change tracking, snapshots, and removal categorization.\n * Used by @almadar/server for Firestore storage and by consumers for type safety.\n */\n\nimport type { OrbitalSchema } from './schema.js';\nimport type { Orbital } from './orbital.js';\nimport type { Trait } from './trait.js';\nimport type { Entity } from './entity.js';\nimport type { Page } from './page.js';\nimport type { EventPayloadValue } from './expression.js';\n\n// ============================================================================\n// Schema Change Types\n// ============================================================================\n\n/**\n * Value attached to a SchemaChange entry's `before` / `after`.\n *\n * Either a JSON-shaped LLM payload (`EventPayloadValue`), a single schema\n * fragment (`Orbital`, `Trait`, `Entity`, `Page`, `OrbitalSchema`), or an\n * array of such fragments. Mirrors the exact shapes the builder's changeset\n * writers actually persist when adding/replacing a slice of the schema.\n */\nexport type ChangesetValue =\n | EventPayloadValue\n | OrbitalSchema\n | Orbital\n | Trait\n | Entity\n | Page\n | Orbital[]\n | Trait[]\n | Entity[]\n | Page[];\n\n/**\n * A single change within a changeset.\n */\nexport interface SchemaChange {\n id: string;\n operation: 'add' | 'modify' | 'remove' | 'rename';\n target: string;\n path: (string | number)[];\n before?: ChangesetValue;\n after?: ChangesetValue;\n description: string;\n reason?: string;\n dependsOn?: string[];\n}\n\n/**\n * Author of a changeset.\n */\nexport interface ChangeAuthor {\n type: 'agent' | 'user';\n id?: string;\n name?: string;\n}\n\n/**\n * Summary statistics for a changeset.\n */\nexport interface ChangeSummary {\n added: number;\n modified: number;\n removed: number;\n description: string;\n}\n\n/**\n * Complete changeset document.\n * Stored at: users/{uid}/apps/{appId}/changesets/{changeSetId}\n */\nexport interface ChangeSetDocument {\n id: string;\n version: number;\n timestamp: number;\n source: 'requirements-agent' | 'builder-agent' | 'user' | 'auto-fix';\n author: ChangeAuthor;\n trigger?: string;\n changes: SchemaChange[];\n summary: ChangeSummary;\n status: 'applied' | 'reverted' | 'pending';\n description: string;\n}\n\n// ============================================================================\n// Snapshot Types\n// ============================================================================\n\n/**\n * Schema snapshot document.\n * Stored at: users/{uid}/apps/{appId}/snapshots/{snapshotId}\n */\nexport interface SnapshotDocument {\n id: string;\n timestamp: number;\n schema: OrbitalSchema;\n reason: string;\n version?: number;\n}\n\n// ============================================================================\n// Schema Protection Types\n// ============================================================================\n\n/**\n * Removals categorized by severity.\n */\nexport interface CategorizedRemovals {\n /** States, pages, entities — always require confirmation */\n critical: SchemaChange[];\n /** Fields, actions — auto-snapshotted */\n standard: SchemaChange[];\n /** Transitions, guards — tracked */\n minor: SchemaChange[];\n /** Implicit content removal within pages */\n pageContentReductions: PageContentReduction[];\n}\n\n/**\n * Detected reduction in page content (components, actions, displays removed).\n */\nexport interface PageContentReduction {\n pageName: string;\n componentsRemoved: number;\n actionsRemoved: number;\n displaysRemoved: number;\n before: { sections: number; actions: number };\n after: { sections: number; actions: number };\n isSignificant: boolean;\n}\n\n// ============================================================================\n// History Metadata Types\n// ============================================================================\n\n/**\n * History metadata stored in main app document for quick access.\n */\nexport interface HistoryMeta {\n latestSnapshotId?: string;\n latestChangeSetId?: string;\n snapshotCount: number;\n changeSetCount: number;\n}\n\n/**\n * Validation metadata stored in main app document for quick access.\n */\nexport interface ValidationMeta {\n errorCount: number;\n warningCount: number;\n validatedAt: number;\n}\n\n// ============================================================================\n// Semantic Schema Change (concept-level diffing)\n// ============================================================================\n\n/**\n * What kind of .orb concept changed between two schema versions.\n * Used by canvas focus derivation, CLI narration, selective re-verification.\n */\nexport const SEMANTIC_CHANGE_KINDS = [\n 'orbital-added',\n 'orbital-removed',\n 'entity-fields-changed',\n 'trait-added',\n 'trait-removed',\n 'trait-config-changed',\n 'state-machine-changed',\n 'guard-changed',\n 'effect-changed',\n 'render-ui-changed',\n 'event-wiring-changed',\n 'page-changed',\n 'theme-changed',\n 'behavior-composed',\n] as const;\n\nexport type SemanticChangeKind = (typeof SEMANTIC_CHANGE_KINDS)[number];\n\n/**\n * A semantic change between two OrbitalSchema versions.\n * Identifies WHAT concept changed and WHERE in the schema.\n */\nexport interface SemanticSchemaChange {\n kind: SemanticChangeKind;\n orbitalName: string;\n traitName?: string;\n transitionEvent?: string;\n fieldName?: string;\n}\n","/**\n * Service Contract Types\n *\n * Formalizes the two public surfaces of an Almadar service:\n * 1. Call-Service Contract — what the .orb schema can invoke on the TypeScript package\n * 2. Event Contract — what events enter/leave the service\n *\n * Plus internal-but-standardized patterns:\n * 3. StoreContract — database abstraction boundary\n * 4. LazyService — singleton lifecycle pattern\n *\n * @packageDocumentation\n */\n\nimport type { EventPayload, EventPayloadValue, LogMeta } from './types/expression.js';\nimport type { ServiceParams } from './types/service.js';\nimport type { EntityRow, FieldValue } from './types/entity.js';\n\n// ============================================================================\n// Service Action Names (generated from services-registry.json)\n// ============================================================================\n\n/**\n * All known service action names across all contracts.\n * Kept in sync with `tools/almadar-service-sync/services-registry.json`.\n *\n * Persist operations are listed separately because they also appear\n * as `EffectResult.action` for persist effects.\n */\nexport type PersistActionName =\n | \"create\"\n | \"update\"\n | \"delete\"\n | \"list\"\n | \"query\";\n\n/**\n * Union of all service action names across the registered service contracts.\n */\nexport type ServiceActionName =\n | PersistActionName\n // Data service\n | \"get\"\n | \"getById\"\n | \"set\"\n | \"remove\"\n | \"size\"\n // LLM\n | \"generate\"\n | \"classify\"\n | \"extract\"\n | \"summarize\"\n // Messaging\n | \"send\"\n | \"sendMessage\"\n | \"sendSMS\"\n | \"sendWhatsApp\"\n // Auth / Identity\n | \"authorize\"\n | \"revoke\"\n | \"token\"\n | \"refresh\"\n | \"userinfo\"\n | \"register\"\n // Git / VCS\n | \"cloneRepo\"\n | \"commit\"\n | \"createBranch\"\n | \"createPR\"\n | \"getPRComments\"\n | \"pull\"\n | \"push\"\n // CI / Build\n | \"build\"\n | \"compile\"\n | \"compileSchema\"\n | \"run\"\n | \"validate\"\n | \"validateSchema\"\n | \"publish\"\n // Queue / Jobs\n | \"enqueue\"\n | \"dequeue\"\n | \"cancel\"\n // Storage / Assets\n | \"upload\"\n | \"download\"\n | \"getSignedUrl\"\n // Search / Issues\n | \"search\"\n | \"getIssue\"\n | \"listIssues\"\n // Agent / Generation\n | \"generateAll\"\n | \"generateDomainLanguage\"\n | \"generateFix\"\n | \"generateOrbitals\"\n | \"cancelGeneration\"\n | \"getGenerationHistory\"\n | \"recordGeneration\"\n // Telemetry / Metrics\n | \"startSpan\"\n | \"endSpan\"\n | \"getSpan\"\n | \"recordMetric\"\n | \"getMetrics\"\n | \"increment\"\n | \"logs\"\n // Events / Channels\n | \"addEvent\"\n | \"emit\"\n | \"findEmitters\"\n | \"findListeners\"\n | \"getListenerCounts\"\n | \"getChannel\"\n | \"subscribe\"\n // User / Preferences\n | \"getUserPreferences\"\n | \"updateUserPreferences\"\n | \"getThreadHistory\"\n // Migration / Import\n | \"listDocuments\"\n | \"fetchDocument\"\n // Media\n | \"getVideo\"\n // Payments\n | \"createPaymentIntent\"\n | \"confirmPayment\"\n | \"refund\"\n // Lifecycle\n | \"complete\"\n | \"fail\"\n | \"expire\"\n | \"resume\"\n | \"status\"\n | \"stop\"\n | \"lock\"\n | \"unlock\"\n | \"clear\";\n\n// ============================================================================\n// Call-Service Contract\n// ============================================================================\n\n/**\n * Action definition for a service contract.\n *\n * - `params` is bus-payload-shaped (`ServiceParams`): JSON-serializable\n * key/value bag with optional nesting. Service contracts override this\n * with stricter shapes via the generic position on `ServiceContract`.\n *\n * - `result` is JSON-serializable too (`EventPayloadValue`): a primitive,\n * `null`/`undefined`, an array of values, or an `EventPayload` object.\n * This is the same recursive shape the bus accepts when an effect's\n * `success` event fires with the call-service result, so no boundary\n * widening is needed when the runtime forwards the value.\n */\nexport interface ServiceAction {\n params: ServiceParams;\n result: EventPayloadValue;\n}\n\n/**\n * What `[\"call-service\", \"name\", \"action\", {...}]` actually calls at runtime.\n * Each service defines its action map as a Record<string, ServiceAction>.\n *\n * @example\n * ```typescript\n * type LLMActions = {\n * generate: {\n * params: { userPrompt: string; model: string; maxTokens: number };\n * result: { content: string; tokensUsed: number; latencyMs: number };\n * };\n * };\n *\n * class LLMService implements ServiceContract<LLMActions> {\n * async execute(action, params) { ... }\n * }\n * ```\n */\nexport interface ServiceContract<\n Actions extends Record<string, ServiceAction>,\n> {\n execute<A extends keyof Actions & string>(\n action: A,\n params: Actions[A][\"params\"],\n ): Promise<Actions[A][\"result\"]>;\n}\n\n// ============================================================================\n// Event Contract\n// ============================================================================\n\n/**\n * Event contract — what events the service emits/listens with typed payloads.\n * Derived from the `.orb` schema's `emits` and `listens` declarations.\n *\n * @example\n * ```typescript\n * type LLMEventMap = {\n * AGENT_LLM_REQUEST: { requestId: string; prompt: string };\n * LLM_RESPONSE: { requestId: string; content: string; tokensUsed: number };\n * LLM_ERROR: { requestId: string; error: string };\n * };\n *\n * const events: ServiceEvents<LLMEventMap> = getEventBus();\n * events.emit('LLM_RESPONSE', { requestId: '1', content: '...', tokensUsed: 42 });\n * ```\n */\nexport interface ServiceEvents<\n EventMap extends Record<string, EventPayload>,\n> {\n emit<E extends keyof EventMap & string>(\n event: E,\n payload: EventMap[E],\n ): void;\n on<E extends keyof EventMap & string>(\n event: E,\n handler: (payload: EventMap[E]) => void,\n ): () => void;\n}\n\n/**\n * Create a typed view of an untyped EventBus. Wraps the raw EventBus\n * with compile-time type checking while keeping runtime behavior identical.\n *\n * @example\n * ```typescript\n * type LLMEventMap = {\n * LLM_RESPONSE: { requestId: string; content: string };\n * LLM_ERROR: { requestId: string; error: string };\n * };\n *\n * const typedBus = createTypedEventBus<LLMEventMap>(getServerEventBus());\n * typedBus.emit('LLM_RESPONSE', { requestId: '1', content: '...' }); // type-safe\n * typedBus.on('LLM_ERROR', (payload) => { payload.error; }); // payload is typed\n * ```\n */\n/**\n * Creates a typed event bus from an untyped bus implementation.\n * \n * This wrapper adds TypeScript type safety to event emission and listening.\n * The generic `EventMap` defines the shape of all events and their payloads.\n * \n * @template EventMap - Type mapping event names to their payload types\n * @param {Object} bus - Untyped event bus implementation\n * @param {Function} bus.emit - Function to emit events\n * @param {Function} bus.on - Function to listen to events\n * @returns {ServiceEvents<EventMap>} Typed event bus interface\n * \n * @example\n * interface MyEvents {\n * 'user.created': { id: string; name: string };\n * 'user.deleted': { id: string };\n * }\n * \n * const typedBus = createTypedEventBus<MyEvents>(rawBus);\n * typedBus.emit('user.created', { id: '123', name: 'Alice' });\n */\nexport function createTypedEventBus<\n EventMap extends Record<string, EventPayload>,\n>(bus: {\n emit(event: string, payload?: unknown, meta?: LogMeta): void;\n on(event: string, handler: (payload: unknown, meta?: LogMeta) => void): () => void;\n}): ServiceEvents<EventMap> {\n return {\n emit<E extends keyof EventMap & string>(event: E, payload: EventMap[E]): void {\n bus.emit(event, payload);\n },\n on<E extends keyof EventMap & string>(\n event: E,\n handler: (payload: EventMap[E]) => void,\n ): () => void {\n return bus.on(event, handler as (payload: unknown) => void);\n },\n };\n}\n\n// ============================================================================\n// Store Contract\n// ============================================================================\n\n/** Filter operator for store queries. */\nexport type StoreFilterOp =\n | \"==\"\n | \"!=\"\n | \"<\"\n | \"<=\"\n | \">\"\n | \">=\"\n | \"in\"\n | \"not-in\"\n | \"contains\"\n | \"array-contains\"\n | \"array-contains-any\";\n\n/** A single filter clause for store queries. */\nexport interface StoreFilter<T> {\n field: keyof T & string;\n op: StoreFilterOp;\n value: FieldValue | undefined;\n}\n\n/** One page of rows from a store: filters, then search, then sort, then the page. */\nexport interface RowPageRequest<T> {\n /** 1-indexed. */\n page: number;\n pageSize: number;\n filters?: readonly StoreFilter<T>[];\n /** Case-insensitive substring match over `searchFields` (every field when absent). */\n search?: string;\n searchFields?: readonly string[];\n sortBy?: string;\n sortOrder?: \"asc\" | \"desc\";\n}\n\nexport interface RowPage<T> {\n rows: T[];\n /** Rows matching the filters and search, across all pages. */\n total: number;\n}\n\n/** The comparison members of `StoreFilterOp`. */\nexport type RowCompareOp = Extract<StoreFilterOp, \"==\" | \"!=\" | \"<\" | \"<=\" | \">\" | \">=\">;\n\n/**\n * A row predicate with two-valued logic: a missing or null field satisfies only `!=` against a\n * non-null value and `isNull: true`, and fails every other leaf, so `not` of a failing leaf holds.\n * Leaves reuse the `StoreFilterOp` meanings: `member` is `in`, `hasElement` is `array-contains`,\n * `contains` is a substring test.\n */\nexport type RowPredicate =\n | { kind: \"compare\"; field: string; op: RowCompareOp; value: FieldValue }\n | { kind: \"member\"; field: string; values: FieldValue[] }\n | { kind: \"hasElement\"; field: string; value: FieldValue }\n | { kind: \"contains\"; field: string; text: string; caseSensitive: boolean }\n | { kind: \"isNull\"; field: string; isNull: boolean }\n | { kind: \"all\"; of: RowPredicate[] }\n | { kind: \"any\"; of: RowPredicate[] }\n | { kind: \"not\"; of: RowPredicate }\n | { kind: \"const\"; value: boolean };\n\n/** One sort key. Missing and null values sort last in both directions; ties break by `id` ascending. A query with no `order` is ordered by `createdAt` ascending, then `id` (EXEC-FETCH-1). */\nexport interface RowOrder {\n field: string;\n direction: \"asc\" | \"desc\";\n}\n\n/**\n * A vector-similarity query: up to `k` rows ordered by descending cosine similarity of `field` to `vector`\n * (EXEC-FETCH-2). A row whose field is absent, null or of zero norm is skipped; a stored vector that is not a\n * `[number]` of the query's length, a zero-norm query or a non-positive `k` fails.\n */\nexport interface RowNearest {\n field: string;\n vector: number[];\n k: number;\n}\n\n/**\n * A pushed-down query: rows matching `policy` AND `filter`, ordered, then windowed. `policy` is the\n * entity's `@read` predicate already specialised to the viewer; `filter` is the call-site filter.\n */\nexport interface RowQuery {\n policy?: RowPredicate;\n filter?: RowPredicate;\n /** Absent = `createdAt` ascending, then `id` ascending (EXEC-FETCH-1). */\n order?: RowOrder;\n offset?: number;\n /** Absent = no limit. */\n limit?: number;\n /** Absent = `exact`. With `none` the store need not count; `total` is then only the window's size. */\n total?: RowTotalMode;\n /** The nearest `k` rows among those `policy` and `filter` admit. Excludes `order`, `offset` and `limit`; `total` is the count returned. */\n nearest?: RowNearest;\n}\n\n/** The answer to a `RowQuery`: the window, and `total` = every match before the window. */\nexport type RowQueryPage = RowPage<EntityRow>;\n\n/** Value kinds a store can compare, in `compare`/`member`/`hasElement` operands. */\nexport type RowValueKind = \"string\" | \"number\" | \"boolean\" | \"date\" | \"null\";\n\n/** Every operator a `RowPredicate` leaf can carry. */\nexport type RowOperator = RowCompareOp | \"member\" | \"hasElement\" | \"contains\";\n\n/** The value kinds one operator accepts on a store; an operator not listed accepts every kind. */\nexport interface OperatorValueKinds {\n operator: RowOperator;\n valueKinds: RowValueKind[];\n}\n\n/** Whether `total` counts every match (`exact`, the default) or the store may skip the count (`none`). */\nexport type RowTotalMode = \"exact\" | \"none\";\n\n/** What an adapter's `queryPage` honours for one entity type. */\nexport interface QueryCapabilities {\n leaves: (\"compare\" | \"member\" | \"hasElement\" | \"contains\" | \"isNull\")[];\n combinators: (\"all\" | \"any\" | \"not\")[];\n compareOps: RowCompareOp[];\n /** Per operator x value kind restrictions; absent = every kind for every declared operator. */\n operatorValueKinds?: OperatorValueKinds[];\n orderableFields: { kind: \"every-field\" } | { kind: \"listed\"; fields: string[] };\n /** offset and limit. */\n window: boolean;\n /** `total` counts every match, not the window. Needed only for `total: exact` queries. */\n exactTotal: boolean;\n /** `queryIds` is implemented. */\n idsOnly?: boolean;\n /** `nearest` is pushed down: the store ranks by cosine similarity itself (EXEC-FETCH-2). */\n nearest?: boolean;\n}\n\n/** The answer to a `queryIds`: the window's ids in order, and `total` as in `RowQueryPage`. */\nexport interface RowIdPage {\n ids: string[];\n total: number;\n}\n\n/**\n * One write. `create` fails (`duplicate-id`) when its id is taken. `upsert` creates the row or replaces it\n * whole by id (`created` / `updated`), keeping the existing `createdAt`. `update` changes an existing row only\n * (never an upsert) and merges `data` over it with `id` stamped last; `guard` is tested against the pre-image.\n * `delete` likewise. Native `rekey` moves an existing id with insertion-order collision semantics; support is explicit.\n */\nexport type RowWriteOp =\n | { kind: \"create\"; entityType: string; data: EntityRow }\n | { kind: \"upsert\"; entityType: string; data: EntityRow }\n | { kind: \"update\"; entityType: string; id: string; data: EntityRow; guard?: RowPredicate }\n | { kind: \"delete\"; entityType: string; id: string; guard?: RowPredicate }\n | { kind: \"rekey\"; entityType: string; id: string; newId: string; guard?: RowPredicate };\n\n/**\n * What one write did. `before` (the pre-image) is present exactly when the op carried a guard.\n * `rolled-back` is only produced inside an `atomic` batch that failed: the op had succeeded and was undone.\n */\nexport type RowWriteOutcome =\n | { kind: \"created\"; row: EntityRow }\n | { kind: \"updated\"; row: EntityRow; before?: EntityRow }\n | { kind: \"deleted\"; before?: EntityRow }\n | { kind: \"not-found\" }\n | { kind: \"duplicate-id\" }\n | { kind: \"refused\" }\n | { kind: \"failed\"; message: string }\n | { kind: \"rolled-back\" };\n\n/**\n * `atomic`: all ops apply or none do (a `persist batch`); on failure the outcomes are `rolled-back` for\n * every earlier op, then the failing outcome, and nothing is written.\n * `stop`: ops apply in order and stop at the first failure; earlier ops stay applied, later ones are\n * not attempted and have no outcome (a run of plain `persist` effects).\n */\nexport type RowWriteFailureMode = \"atomic\" | \"stop\";\n\nexport interface RowWriteBatch {\n ops: RowWriteOp[];\n onFailure: RowWriteFailureMode;\n}\n\n/** What an adapter's `writeWhere`/`writeBatch` honours for one entity type. */\nexport interface WriteCapabilities {\n /** The guard predicates the store can test; a `Pick` of the query capabilities. */\n guards: Pick<QueryCapabilities, \"leaves\" | \"combinators\" | \"compareOps\">;\n /** `writeWhere` tests the guard and the existence of the row in one step. */\n conditional: boolean;\n /** Outcomes carry the written row. */\n returnsRow: boolean;\n /** `writeBatch` with `onFailure: \"stop\"`. */\n stopRuns: boolean;\n /** `writeBatch` with `onFailure: \"atomic\"`; needs transactions. */\n atomicBatch: boolean;\n /** Native id moves; absent means unsupported. */\n rekey?: boolean;\n /** The store commits rows the kernel decided (`commitRows`) and holds no write semantics (EXEC-STORE-5). */\n commitRows?: boolean;\n}\n\n/** What a compare-and-commit does to one row the kernel read. */\nexport type RowCommitWrite = { kind: \"keep\" } | { kind: \"put\"; row: EntityRow } | { kind: \"delete\" };\n\n/** One row of a compare-and-commit: the version the kernel read (`null` when absent) and what it writes (EXEC-STORE-5). */\nexport interface RowCommit {\n entityType: string;\n id: string;\n expected: EntityRow | null;\n write: RowCommitWrite;\n}\n\n/**\n * Storage contract for CRUD operations on entity rows. The runtime's effect\n * handlers and every database backend (`@almadar/db`) speak this interface.\n */\nexport interface PersistenceAdapter {\n create(entityType: string, data: EntityRow): Promise<{ id: string }>;\n update(entityType: string, id: string, data: EntityRow): Promise<void>;\n delete(entityType: string, id: string): Promise<void>;\n getById(entityType: string, id: string): Promise<EntityRow | null>;\n list(entityType: string): Promise<EntityRow[]>;\n /** Number of rows of `entityType`, without reading them; needed by a row quota. */\n countRows?(entityType: string): Promise<number>;\n /** Rows matching every filter, pushed down to the store where it can; absent = filter over `list`. */\n query?(entityType: string, filters: readonly StoreFilter<EntityRow>[]): Promise<EntityRow[]>;\n /** One page, pushed down to the store where it can; absent = page over `list`. */\n listPage?(entityType: string, request: RowPageRequest<EntityRow>): Promise<RowPage<EntityRow>>;\n /** The page of rows matching `query.policy AND query.filter`, ordered and windowed; only queries within `queryCapabilities`. */\n queryPage?(entityType: string, query: RowQuery): Promise<RowQueryPage>;\n /** What `queryPage` honours; absent = the host cannot push a query down. */\n queryCapabilities?(entityType: string): QueryCapabilities;\n /** The ids of the page `queryPage` would return, without the rows; only when `queryCapabilities.idsOnly`. */\n queryIds?(entityType: string, query: RowQuery): Promise<RowIdPage>;\n /** One conditional write; only ops within `writeCapabilities`. */\n writeWhere?(op: RowWriteOp): Promise<RowWriteOutcome>;\n /** Ordered writes with the batch's failure mode; one outcome per attempted op. */\n writeBatch?(batch: RowWriteBatch): Promise<RowWriteOutcome[]>;\n /** What `writeWhere`/`writeBatch` honour; absent = the host cannot push a write down. */\n writeCapabilities?(entityType: string): WriteCapabilities;\n /** Apply every row's write in one storage transaction only if each row still equals its `expected` version; `false` (nothing applied) on a conflict. */\n commitRows?(rows: readonly RowCommit[]): Promise<boolean>;\n /** Bind `entityType` to its declared `[persistent: tbl]` collection: a store that keys rows by collection stores the entity's rows under that name. Absent = the store keys by entity name alone. */\n bindCollection?(entityType: string, collection: string): void;\n}\n\n/**\n * Database abstraction boundary. Services receive `StoreContract<T>`,\n * not raw database clients. Swappable per database engine.\n *\n * @example\n * ```typescript\n * interface LLMRequest { id: string; prompt: string; status: string }\n *\n * class FirestoreLLMRequestStore implements StoreContract<LLMRequest> {\n * async getById(id) { ... }\n * async create(data) { ... }\n * async update(id, data) { ... }\n * async delete(id) { ... }\n * async query(filters) { ... }\n * }\n * ```\n */\nexport interface StoreContract<T extends { id: string }> {\n getById(id: string): Promise<T | null>;\n create(data: Omit<T, \"id\">): Promise<T>;\n update(id: string, data: Partial<T>): Promise<T>;\n delete(id: string): Promise<void>;\n query(filters: StoreFilter<T>[]): Promise<T[]>;\n}\n\n// ============================================================================\n// Lazy Service (Singleton Pattern)\n// ============================================================================\n\n/**\n * Standardized singleton lifecycle. Replaces ad-hoc\n * `let x = null; export function getX()` patterns.\n *\n * @example\n * ```typescript\n * const llmClient = createLazyService(() => new LLMClient({ apiKey: process.env.LLM_KEY }));\n *\n * // In request handler:\n * const client = llmClient.get(); // created on first call, cached after\n *\n * // In test teardown:\n * llmClient.reset(); // next get() creates a fresh instance\n * ```\n */\nexport interface LazyService<T> {\n /** Get the singleton instance (creates on first call). */\n get(): T;\n /** Reset the singleton (next get() creates fresh). For test isolation. */\n reset(): void;\n}\n\n/**\n * Create a lazy singleton from a factory function.\n * \n * Creates a service that lazily initializes on first access and caches the instance.\n * Useful for expensive resources like database connections or API clients.\n * \n * @template T - The type of service to create\n * @param {() => T} factory - Factory function that creates the service instance\n * @returns {LazyService<T>} Lazy service with get() and reset() methods\n * \n * @example\n * const dbService = createLazyService(() => new DatabaseClient(config));\n * const db = dbService.get(); // Initializes on first call\n */\nexport function createLazyService<T>(factory: () => T): LazyService<T> {\n let instance: T | null = null;\n return {\n get(): T {\n if (instance === null) {\n instance = factory();\n }\n return instance;\n },\n reset(): void {\n instance = null;\n },\n };\n}\n","/**\n * Row-predicate helpers the TS shell keeps. Compiling a `filter` or `@read` to a `RowPredicate` is the kernel's\n * (`compile_predicate`; `kernelEvaluator().readPolicy`); this module holds only the binding-fold result shape the\n * kernel answers and the fetch-order parse.\n */\nimport type { RowOrder } from './service-types.js';\n\nexport type RowBindingScalar = string | number | boolean | null;\n\nexport type RowBindingResult =\n | { kind: 'value'; value: RowBindingScalar }\n | { kind: 'list'; values: RowBindingScalar[] }\n | { kind: 'unspecialised'; detail: string }\n | { kind: 'inexpressible'; detail: string };\n\n/** A fetch's `orderBy` (`\"field\"` or `\"field:asc|desc\"`): ascending unless `desc`. */\nexport function parseFetchOrder(orderBy: string | undefined): RowOrder | undefined {\n if (typeof orderBy !== 'string' || orderBy === '') return undefined;\n const [field, direction] = orderBy.split(':');\n const dir: RowOrder['direction'] = direction === 'desc' ? 'desc' : 'asc';\n return { field, direction: dir };\n}\n","/**\n * Shared Intermediate Representation Types\n *\n * Unified IR types used by both the compiler and runtime.\n * This is the single source of truth for IR structures.\n *\n * @packageDocumentation\n */\n\nimport type { SExpr } from './expression.js';\nimport type { Entity, EntityRow, FieldValue } from './entity.js';\nimport type { JsonValue, RuntimeValue } from './json.js';\nimport type { ListenSource } from './trait.js';\nimport type { TraitId, EventId } from './identity.js';\nimport type { PageAccess, PageIndexing, PageMeta } from './page.js';\nimport type { AnyPatternConfig } from '../patterns/index.js';\nimport type { EntityField, RelationConfig } from './field.js';\nimport { payloadTypeContainer } from './state-machine.js';\n\n// ============================================================================\n// Transition Types\n// ============================================================================\n\n/**\n * Transition source state specification.\n * - string: Single state name (e.g., 'Idle')\n * - '*': Wildcard - matches any current state\n * - string[]: Array of states - matches any of the listed states\n */\nexport type TransitionFrom = string | '*' | string[];\n\n// ============================================================================\n// Field Types\n// ============================================================================\n\nexport interface ResolvedField {\n name: string;\n type: string;\n tsType: string;\n description?: string;\n /** Field default — JSON-shaped, mirroring `EntityField.default`. */\n default?: JsonValue;\n required: boolean;\n /** Validation constraints carried from the schema (enum whitelist). */\n validation?: { enum?: string[] };\n /** Enum values for enum or constrained string fields */\n values?: string[];\n /** Enum values (alias for values, for compatibility) */\n enumValues?: string[];\n relation?: RelationConfig;\n intrinsic?: boolean;\n items?: EntityField;\n properties?: Record<string, EntityField>;\n}\n\n// ============================================================================\n// Entity Types\n// ============================================================================\n\nexport interface ResolvedEntity {\n name: string;\n description?: string;\n icon?: string;\n collection: string;\n fields: ResolvedField[];\n\n /** Whether this entity only exists in runtime (not persisted to Firestore) */\n runtime?: boolean;\n\n /** Whether this entity's state is shared across every bound trait (vs a per-trait copy). Orthogonal to `runtime`. */\n shared?: boolean;\n\n /** Whether this entity has pre-authored instances in the schema */\n hasInstances?: boolean;\n\n /** Pre-authored instances from the schema (seed data or static reference data) */\n instances?: EntityRow[];\n\n /** Default field values from schema (for spawning singletons) */\n defaults?: Record<string, FieldValue>;\n\n // Cross-references\n usedByTraits: string[];\n usedByPages: string[];\n}\n\nexport interface ResolvedEntityBinding {\n /** Binding name in code */\n name: string;\n\n /** Entity being bound */\n entity: ResolvedEntity;\n\n /** CRUD operations to generate */\n operations: ('list' | 'get' | 'create' | 'update' | 'delete')[];\n}\n\n// ============================================================================\n// Trait Types\n// ============================================================================\n\nexport interface ResolvedTraitState {\n name: string;\n isInitial: boolean;\n isFinal: boolean;\n}\n\nexport interface ResolvedTraitEvent {\n key: string;\n name: string;\n payload?: Record<string, string>;\n}\n\nexport interface ResolvedTraitTransition {\n /** Source state(s): string, '*' for wildcard, or array of states */\n from: TransitionFrom;\n to: string;\n event: string;\n guard?: SExpr;\n effects: SExpr[];\n}\n\nexport interface ResolvedTraitGuard {\n name: string;\n condition: SExpr;\n}\n\nexport interface ResolvedTraitTick {\n name: string;\n /**\n * `number` (ms), `'frame'`, a duration string (`'5s'`/`'1m'`/`'1h'`), or a\n * 5-field cron expression (`'0 9 * * *'`) — `schema-to-ir.ts`'s\n * `interval: tick.interval || 0` passes the source schema's raw\n * `string | number` straight through with no normalization, so this must\n * match that reality rather than the narrower `number | 'frame'` it used\n * to declare (which made every non-'frame' string an unchecked cast at\n * every consumer).\n */\n interval: number | string;\n guard?: SExpr;\n effects: SExpr[];\n priority: number;\n appliesTo: string[];\n /** `[visible]`: pauses while the trait's rendered output is off screen. */\n whileVisible: boolean;\n}\n\nexport interface ResolvedTraitListener {\n event: string;\n triggers: string;\n guard?: SExpr;\n /** `with { ... }` payload rewrite: `{ targetField: SExpr }`, evaluated against the source payload. */\n payloadMapping?: Record<string, SExpr>;\n /** Source scoping (see `ListenSource` in types/trait). */\n source?: ListenSource;\n}\n\nexport interface ResolvedTraitDataEntity {\n name: string;\n fields: ResolvedField[];\n runtime: boolean;\n singleton: boolean;\n}\n\n/**\n * UI binding for interaction traits - maps states to presentations\n */\nexport interface ResolvedTraitUIBinding {\n [stateName: string]: {\n /** Presentation type: modal, drawer, popover, inline, confirm-dialog */\n presentation: string;\n /** Content pattern(s) to render */\n content: AnyPatternConfig | AnyPatternConfig[];\n /** Presentation props */\n props?: {\n size?: string;\n position?: string;\n title?: string;\n closable?: boolean;\n width?: string;\n showProgress?: boolean;\n step?: number;\n totalSteps?: number;\n };\n };\n}\n\n/**\n * One emit contract on a resolved trait — the minimal shape the\n * emit-source stamp needs (`eventId` lookup by event name, parity with\n * `OrbitalServerRuntime`'s `emitContract?.eventId`).\n */\nexport interface ResolvedTraitEmit {\n event: string;\n eventId?: EventId;\n}\n\n/**\n * Fully resolved trait - expanded from schema OR library.\n * The compiler generates code from this structure universally,\n * without knowing which specific trait it is.\n */\nexport interface ResolvedTrait {\n /** Unique trait identifier */\n name: string;\n\n /**\n * V4 dual-carry id sibling of `name` — preserved from the source trait\n * when the schema carries ids. The emit-source stamp needs it: an\n * id-scoped `listens` matcher (`buildSourceMatcher`, `@almadar/runtime`)\n * compares ids ONLY, so a name-only stamp never matches a `traitId`-carrying\n * listen (the chat SAVE → DO_CREATE relay died on the stateful path,\n * 2026-09-22).\n */\n id?: TraitId;\n\n /**\n * The trait's emit contracts, preserved from the source trait when the\n * schema carries them. The emit-source stamp reads `eventId` from the\n * matching contract — parity with `OrbitalServerRuntime`'s emit stamp.\n */\n emits?: ResolvedTraitEmit[];\n\n /** Human-readable description */\n description?: string;\n\n /** Where this trait came from */\n source: 'schema' | 'library' | 'inline';\n\n // State Machine (all optional - not all traits have state machines)\n states: ResolvedTraitState[];\n events: ResolvedTraitEvent[];\n transitions: ResolvedTraitTransition[];\n guards: ResolvedTraitGuard[];\n\n // Behavior\n ticks: ResolvedTraitTick[];\n\n // Communication\n listens: ResolvedTraitListener[];\n\n // Data\n dataEntities: ResolvedTraitDataEntity[];\n\n /**\n * Atom-declared linked entity. The atom (e.g. std-pagination)\n * declares which entity its `@entity.X` bindings resolve against\n * (e.g. `PagedItem`). Distinct from the call-site rebind on\n * `ResolvedTraitBinding.linkedEntity`, which a molecule may use\n * to override the atom's default. Either side may be undefined\n * for traits that don't bind any entity (pure interaction).\n */\n linkedEntity?: string;\n\n /**\n * The trait's DECLARED `config { }` schema (per-field\n * `{ type, default? }`). Drives `@config.X` substitution: each\n * field's `default` seeds the binding context behind any caller-\n * supplied call-site `config: { ... }` override on the trait\n * reference. Authored on the atom; flows through verbatim from\n * `Trait.config`.\n *\n * (Caller-supplied call-site overrides live on the page-trait\n * binding's `config: TraitConfig` — see `ResolvedTraitBinding`.)\n */\n config?: import('./trait.js').DeclaredTraitConfig;\n\n // UI Bindings for interaction traits\n ui?: ResolvedTraitUIBinding;\n}\n\n/**\n * Trait binding on a page - links a resolved trait to the page\n */\nexport interface ResolvedTraitBinding {\n /** Reference name */\n ref?: string;\n\n /** Fully resolved trait */\n trait: ResolvedTrait;\n\n /** Entity this trait operates on (if any) */\n linkedEntity?: string;\n\n /** Instance configuration */\n config?: import('./trait.js').TraitConfig;\n}\n\n// ============================================================================\n// Pattern & Section Types\n// ============================================================================\n\nexport interface ResolvedPattern {\n /** Pattern type (e.g., 'page-header', 'data-list', 'game-canvas') */\n type: string;\n\n /** Pattern configuration */\n config: AnyPatternConfig;\n\n /** Shell component to use */\n shellComponent?: string;\n}\n\nexport interface ResolvedSectionEvent {\n event: string;\n action: string;\n target?: string;\n}\n\nexport interface ResolvedSection {\n /** Section identifier */\n id: string;\n\n /** Resolved pattern */\n pattern: ResolvedPattern;\n\n /** Events emitted by this section */\n events: ResolvedSectionEvent[];\n\n /** Position in page layout */\n position?: number;\n\n /** Entity binding for this section */\n binding?: ResolvedEntityBinding;\n}\n\n// ============================================================================\n// Page Types\n// ============================================================================\n\nexport interface ResolvedNavigation {\n event?: string;\n from?: string;\n to: string;\n trigger?: string;\n params?: Record<string, string>;\n label?: string;\n path?: string;\n icon?: string;\n}\n\nexport interface ResolvedPage {\n /** Page identifier */\n name: string;\n\n /** URL path */\n path: string;\n\n /** Feature folder name */\n featureName: string;\n\n /** Layout component */\n layout?: string;\n\n /** View type (dashboard, list, detail, create, edit) */\n viewType?: 'dashboard' | 'list' | 'detail' | 'create' | 'edit';\n\n /** Resolved sections */\n sections: ResolvedSection[];\n\n /** Resolved trait bindings */\n traits: ResolvedTraitBinding[];\n\n /** Entity data bindings */\n entityBindings: ResolvedEntityBinding[];\n\n /** Navigation wiring */\n navigation: ResolvedNavigation[];\n\n /** Singleton entities to spawn on this page (runtime singletons) */\n singletonEntities: ResolvedEntity[];\n\n /** `access:` page modifier; absent = no gate. */\n access?: PageAccess;\n\n /** `indexing:` page modifier. */\n indexing?: PageIndexing;\n /** The upstream page this one was imported from; see `OrbitalPage.sourcePage`. */\n sourcePage?: string;\n /** `translationOf:` page modifier; see `OrbitalPage.translationOf`. */\n translationOf?: string;\n\n /** `title:` page modifier. */\n title?: PageMeta;\n\n /** `description:` page modifier. */\n description?: PageMeta;\n}\n\n// ============================================================================\n// IR Types\n// ============================================================================\n\n/**\n * Complete resolved IR - all references expanded\n */\nexport interface ResolvedIR {\n /** App name */\n appName: string;\n\n /** App description */\n description?: string;\n\n /** App version */\n version?: string;\n\n /** All resolved entities (Map for lookup) */\n entities: Map<string, ResolvedEntity>;\n\n /** All resolved traits (Map for lookup) */\n traits: Map<string, ResolvedTrait>;\n\n /** All resolved pages (Map for lookup) */\n pages: Map<string, ResolvedPage>;\n\n /** Entity bindings (used for data hook generation) */\n entityBindings: ResolvedEntityBinding[];\n\n /** Raw data entities (used for instance data generation) */\n rawEntities?: Entity[];\n\n /** Generation timestamp */\n generatedAt: string;\n}\n\n// ============================================================================\n// Factory Functions\n// ============================================================================\n\n/**\n * Create an empty resolved trait with defaults\n */\nexport function createEmptyResolvedTrait(name: string, source: 'schema' | 'library' | 'inline'): ResolvedTrait {\n return {\n name,\n source,\n states: [],\n events: [],\n transitions: [],\n guards: [],\n ticks: [],\n listens: [],\n dataEntities: [],\n };\n}\n\n/**\n * Create an empty resolved page with defaults\n */\nexport function createEmptyResolvedPage(name: string): ResolvedPage {\n return {\n name,\n path: `/${name.toLowerCase()}`,\n featureName: name.toLowerCase(),\n sections: [],\n traits: [],\n entityBindings: [],\n navigation: [],\n singletonEntities: [],\n };\n}\n\n/**\n * Infer TypeScript type from schema type\n */\nexport function inferTsType(schemaType: string): string {\n const typeMap: Record<string, string> = {\n string: 'string',\n number: 'number',\n boolean: 'boolean',\n date: 'Date',\n datetime: 'Date',\n timestamp: 'number',\n array: 'unknown[]',\n object: 'Record<string, unknown>',\n any: 'unknown',\n // Renderable UI content — the canonical pattern-tree type from\n // render-ui-edit.ts. Without this entry the raw tag `node` would leak\n // out as a (nonexistent) TS type name.\n node: 'PatternNode | PatternNode[]',\n };\n\n // Handle array types like \"string[]\"\n if (schemaType.endsWith('[]')) {\n const baseType = schemaType.slice(0, -2);\n return `${typeMap[baseType] || baseType}[]`;\n }\n\n const container = payloadTypeContainer(schemaType);\n if (container.kind === 'map') {\n return `Record<${inferTsType(container.key)}, ${inferTsType(container.value)}>`;\n }\n\n return typeMap[schemaType] || schemaType;\n}\n\n/**\n * Create a resolved field with TypeScript type inference\n */\nexport function createResolvedField(field: {\n name: string;\n type: string;\n description?: string;\n default?: JsonValue;\n required?: boolean;\n validation?: { enum?: string[] };\n values?: string[];\n relation?: RelationConfig;\n intrinsic?: boolean;\n items?: EntityField;\n properties?: Record<string, EntityField>;\n}): ResolvedField {\n return {\n name: field.name,\n type: field.type,\n tsType: inferTsType(field.type),\n description: field.description,\n default: field.default,\n required: field.required ?? false,\n validation: field.validation,\n values: field.values,\n relation: field.relation,\n intrinsic: field.intrinsic,\n items: field.items,\n properties: field.properties,\n };\n}\n\n// ============================================================================\n// Type Guards\n// ============================================================================\n\n/**\n * Type guard to check if an object is a ResolvedIR.\n * \n * Validates that an unknown value conforms to the ResolvedIR structure.\n * Checks for required properties and correct types. Used for runtime\n * type checking and validation.\n * \n * @param {unknown} ir - Value to check\n * @returns {boolean} True if value is ResolvedIR, false otherwise\n * \n * @example\n * if (isResolvedIR(schema)) {\n * // Type-safe access to ResolvedIR properties\n * console.log('Valid IR:', schema.appName);\n * }\n */\nexport function isResolvedIR(ir: RuntimeValue): ir is ResolvedIR {\n if (!ir || typeof ir !== 'object') return false;\n const r = ir as ResolvedIR;\n return typeof r.appName === 'string' && r.traits instanceof Map && r.pages instanceof Map;\n}\n","// The one identity of a cascade delivery (Runtime Spec Clause 5.3); twin of orbital-core `dispatch_visit_key`.\nimport type { EventPayload, EventPayloadValue } from './expression.js';\n\nfunction isPayloadList(value: EventPayloadValue): value is readonly EventPayloadValue[] {\n return Array.isArray(value);\n}\n\nexport function canonicalJson(value: EventPayloadValue): string {\n if (value === undefined || value === null) return 'null';\n if (value instanceof Date) return JSON.stringify(value.toISOString());\n if (isPayloadList(value)) {\n return `[${value.map((item: EventPayloadValue) => (item === undefined ? 'null' : canonicalJson(item))).join(',')}]`;\n }\n if (typeof value === 'object') {\n const record: EventPayload = value;\n const fields = Object.keys(record)\n .filter((k) => record[k] !== undefined)\n .sort()\n .map((k) => `${JSON.stringify(k)}:${canonicalJson(record[k])}`);\n return `{${fields.join(',')}}`;\n }\n return JSON.stringify(value);\n}\n\n/**\n * `(trait, event, from, payload, frame)`: only an exact repeat of all five is a cycle. The frame is the\n * trait's entity row as it stands when the step is taken — a loop whose row moved on is progress even\n * when an effect hands back the same result twice; `null` when the trait has no row.\n */\nexport function dispatchVisitKey(\n trait: string,\n event: string,\n from: string,\n payload: EventPayload | null | undefined,\n frame: EventPayload | null,\n): string {\n return `${trait}\\u0000${event}\\u0000${from}\\u0000${canonicalJson(payload)}\\u0000${canonicalJson(frame)}`;\n}\n\nconst COMPOSITE: unique symbol = Symbol('composite');\n\n/** The JSON leaf `canonicalJson` writes for a scalar (an absent value and a non-finite number both write `null`). */\nfunction canonicalLeaf(value: EventPayloadValue): string | number | boolean | null | typeof COMPOSITE {\n if (value === undefined || value === null) return null;\n if (value instanceof Date) return value.toISOString();\n if (typeof value === 'number') return Number.isFinite(value) ? value : null;\n if (typeof value === 'object') return COMPOSITE;\n return value;\n}\n\n/** `canonicalJson(a) === canonicalJson(b)`, without building either string. */\nfunction sameCanonical(a: EventPayloadValue, b: EventPayloadValue): boolean {\n if (a === b) return true;\n const leafA = canonicalLeaf(a);\n const leafB = canonicalLeaf(b);\n if (leafA !== COMPOSITE || leafB !== COMPOSITE) return leafA === leafB;\n if (isPayloadList(a) || isPayloadList(b)) {\n if (!isPayloadList(a) || !isPayloadList(b) || a.length !== b.length) return false;\n return a.every((item, i) => sameCanonical(item, b[i]));\n }\n if (a instanceof Date || b instanceof Date || typeof a !== 'object' || typeof b !== 'object' || a === null || b === null) return false;\n const keysA = Object.keys(a).filter((k) => a[k] !== undefined);\n const keysB = Object.keys(b).filter((k) => b[k] !== undefined);\n return keysA.length === keysB.length && keysA.every((k) => b[k] !== undefined && sameCanonical(a[k], b[k]));\n}\n\ninterface Visit {\n payload: EventPayload | null;\n frame: EventPayload | null;\n}\n\n/**\n * A set of deliveries under the `dispatchVisitKey` identity. Steps are filed by `(trait, event, from)`;\n * payload and frame are compared only against earlier visits of that same step, so a large entity\n * frame is not serialized on every cascade step. Payload and frame are kept as their top-level fields\n * stood when recorded: a step reassigns entity fields in place, nested values are never mutated.\n */\nexport class DispatchVisits {\n private readonly steps = new Map<string, Visit[]>();\n\n has(trait: string, event: string, from: string, payload: EventPayload | null | undefined, frame: EventPayload | null): boolean {\n const seen = this.steps.get(`${trait}\\u0000${event}\\u0000${from}`);\n return seen !== undefined && seen.some((v) => sameCanonical(v.payload, payload) && sameCanonical(v.frame, frame));\n }\n\n add(trait: string, event: string, from: string, payload: EventPayload | null | undefined, frame: EventPayload | null): void {\n if (this.has(trait, event, from, payload, frame)) return;\n const step = `${trait}\\u0000${event}\\u0000${from}`;\n const visit: Visit = {\n payload: payload === undefined || payload === null ? null : { ...payload },\n frame: frame === null ? null : { ...frame },\n };\n const seen = this.steps.get(step);\n if (seen === undefined) this.steps.set(step, [visit]);\n else seen.push(visit);\n }\n}\n","// The path memory of one dispatch (Runtime Spec Clause 5.5), shared by the JS runtime and compiled clients.\n// Twin of orbital-core `runtime::dispatch_memory`.\nimport type { EventPayload } from './expression.js';\nimport { deliveryRecordValue, type DeliveryRecord, type DispatchLog } from './bus.js';\n\n/** What a guard or effect reads: `@event`, `@prevEvents`, `@prevStates`. */\nexport interface DispatchScope {\n event: EventPayload;\n prevEvents: EventPayload[];\n prevStates: string[];\n}\n\n/** The scope of a delivery with the given log so far; no delivery = a direct dispatch of `event`. */\nexport function dispatchScopeOf(\n delivery: DeliveryRecord | undefined,\n log: DispatchLog | undefined,\n event: string,\n payload: EventPayload | undefined,\n): DispatchScope {\n const record = delivery ?? { event, ...(payload !== undefined ? { payload } : {}), source: {} };\n return {\n event: deliveryRecordValue(record),\n prevEvents: (log?.prevEvents ?? []).map(deliveryRecordValue),\n prevStates: [...(log?.prevStates ?? [])],\n };\n}\n\nexport class DispatchMemory {\n private readonly deliveries = new Map<string, DeliveryRecord[]>();\n private readonly left = new Map<string, string[]>();\n\n /** This trait's log so far, as it travels on a request. */\n log(trait: string): DispatchLog {\n return { prevEvents: [...(this.deliveries.get(trait) ?? [])], prevStates: [...(this.left.get(trait) ?? [])] };\n }\n\n view(trait: string, delivery: DeliveryRecord): DispatchScope {\n return dispatchScopeOf(delivery, this.log(trait), delivery.event, delivery.payload);\n }\n\n /** Continue a dispatch that began elsewhere: the target trait's log so far. */\n seed(trait: string, log: DispatchLog): void {\n this.deliveries.set(trait, [...log.prevEvents]);\n this.left.set(trait, [...log.prevStates]);\n }\n\n recordDelivery(trait: string, delivery: DeliveryRecord): void {\n const log = this.deliveries.get(trait) ?? [];\n log.push(delivery);\n this.deliveries.set(trait, log);\n }\n\n recordTransition(trait: string, from: string, to: string): void {\n if (from === to) return;\n const log = this.left.get(trait) ?? [];\n log.push(from);\n this.left.set(trait, log);\n }\n}\n","/**\n * Whether a guard holds. A guard that throws does not hold: it blocks its transition exactly\n * like a false guard, and the error is handed to `onError` (one rule on every path — the JS\n * runtime, the code the TypeScript shell generates, and the Rust kernel).\n */\nexport function guardHolds(check: () => boolean, onError: (error: Error) => void): boolean {\n try {\n return check();\n } catch (error) {\n onError(error instanceof Error ? error : new Error(String(error)));\n return false;\n }\n}\n","{\n \"actionPrefix\": \"action-\",\n \"overflowKey\": \"overflow\",\n \"gestureEventProps\": {\n \"longPressEvent\": \"long-press\",\n \"swipeLeftEvent\": \"swipe-left\",\n \"swipeRightEvent\": \"swipe-right\"\n },\n \"nativeIdPrefix\": {\n \"pattern\": \"pattern-\",\n \"row\": \"row-\",\n \"field\": \"field-\",\n \"slot\": \"slot-\"\n },\n \"nativeIdSeparator\": \" \"\n}\n","/**\n * Verification Types (framework concept)\n *\n * The `window.__orbitalVerification` bridge is the single observation\n * point Playwright-based verifiers (`orbital-verify`, `runtime-verify`,\n * `@almadar-io/verify`) use to read runtime state out of a live app.\n * Its shape was previously duplicated between `@almadar/ui`'s\n * `verificationRegistry.ts` (producer) and `@almadar-io/verify`'s\n * `state-bridge.ts` (consumer). Every added field had to be mirrored\n * by hand; one side drifting silently broke the other.\n *\n * Hoisting the wire types into `@almadar/core` closes that gap the same\n * way {@link BusEvent} closed the UI/runtime event-shape drift. The\n * registry still owns the state machine, the schedule, and the window\n * exposure — this module owns only the shapes both sides agree on.\n *\n * @packageDocumentation\n */\n\nimport type { TraitConfig } from \"./trait.js\";\nimport type { EntityRow } from \"./entity.js\";\nimport type { EvalTrace, EventPayload, SExpr } from \"./expression.js\";\nimport type { BusEventSource } from \"./bus.js\";\nimport type { HopObservation } from \"../generated/kernel-wire.js\";\nimport verificationIds from \"./verification-ids.json\";\n\n// ── Checks ────────────────────────────────────────────────────────────\n\n/**\n * Outcome of a single verification check. `warn` is non-fatal in the\n * overall pass/fail tally; `pending` means the check has been registered\n * but not yet resolved.\n */\nexport type CheckStatus = \"pass\" | \"fail\" | \"pending\" | \"warn\";\n\nexport interface VerificationCheck {\n id: string;\n label: string;\n status: CheckStatus;\n details?: string;\n /** Timestamp (ms since epoch) when the status last changed. */\n updatedAt: number;\n}\n\n// ── Transition timeline ──────────────────────────────────────────────\n\n/**\n * Trace of a single effect as it ran on a transition. `args` are the\n * effect tuple's trailing S-expressions; consumers narrow via `type`\n * before inspecting.\n */\nexport interface EffectTrace {\n type: string;\n /** For fetch/persist effects: the entity the effect addresses. */\n entityName?: string;\n /** For persist effects: the mutation performed. */\n action?: \"create\" | \"upsert\" | \"update\" | \"delete\" | \"batch\";\n /** For a persist that wrote a row: its id. */\n resultId?: string;\n /**\n * The effect's real outcome, distinct from `status`. `denied` means the\n * write was rejected by an access policy or resolved no row key —\n * `status` reports `\"failed\"` for it too (kept for back-compat with\n * consumers that only branch on `status`); `outcome` is the one field\n * that tells a denial apart from any other kind of failure.\n */\n outcome?: \"success\" | \"denied\" | \"failed\";\n args: SExpr[];\n status: \"executed\" | \"failed\" | \"skipped\";\n error?: string;\n /** What the effect addressed: an `http` effect's `<METHOD> <origin><path>`, an `emit` entry's event name. */\n target?: string;\n /** The declared `emit.failure` event the program routed this effect's failure to; absent when it declares none. */\n routed?: string;\n durationMs?: number;\n /** The effect expression's evaluation, node by node, when the producer traced it. */\n evalTrace?: EvalTrace;\n}\n\n/** What the server returned for a forwarded event. */\nexport interface ServerResponseTrace {\n orbitalName: string;\n success: boolean;\n /**\n * The runtime's own verdict on whether ANY arm accepted this dispatch\n * (`OrbitalEventResponse.transitioned`). `false` = the event was\n * delivered but no transition fired — guard false, or no arm in the\n * current state — which a self-loop's unchanged state cannot reveal on\n * its own. Undefined only where the producing path does not report it\n * yet (the compiled client bridge's lifecycle payload).\n */\n transitioned?: boolean;\n /**\n * Server-side emits with their EVALUATED payloads (`OrbitalEventResponse.\n * emittedEvents[].payload`). `emittedEvents` keeps the names for existing\n * consumers; observers that judge what an emit CARRIES read this — a\n * server-side `(emit SAVE {…})` never reaches the client bus log, and the\n * effect trace holds the declared args, not the values.\n */\n emitted?: ReadonlyArray<{ event: string; payload?: EventPayload }>;\n clientEffects: number;\n dataEntities: Record<string, number>;\n emittedEvents: string[];\n error?: string;\n timestamp: number;\n}\n\nexport interface TransitionTrace {\n id: string;\n traitName: string;\n from: string;\n to: string;\n event: string;\n /** The arm that fired, by its position among the state's arms for the event (the kernel's hop). */\n firedArm?: number;\n guardExpression?: string;\n guardResult?: boolean;\n effects: EffectTrace[];\n /** Populated when the event round-tripped to the server. */\n serverResponse?: ServerResponseTrace;\n /** The hop's payload and the trait's `@entity` before and after it, when a verifier asked the kernel\n * to record them (`setRecordEntityAfter`): what the hop's `@ensures` is judged on. */\n observed?: HopObservation;\n timestamp: number;\n}\n\n// ── Bridge health / summary ───────────────────────────────────────────\n\nexport interface BridgeHealth {\n connected: boolean;\n eventsForwarded: number;\n eventsReceived: number;\n lastError?: string;\n lastHeartbeat: number;\n}\n\nexport interface VerificationSummary {\n totalChecks: number;\n passed: number;\n failed: number;\n warnings: number;\n pending: number;\n}\n\n// ── Trait reducer snapshot ────────────────────────────────────────────\n\n/**\n * Per-trait state snapshot exposed to the verifier so it can assert\n * that reducer data (populated by fetch/persist transitions) and the\n * last dispatched payload land in the DOM correctly (VG4/VG6/VG11a/b/c).\n *\n * Mirrors what `useTraitStateMachine` / generated trait logic hooks\n * keep internally, without the verifier having to parse rendered text.\n */\nexport interface TraitStateSnapshot {\n /** Trait name as declared in the schema. */\n traitName: string;\n /** Current state machine state. */\n currentState: string;\n /** Declared state names for this trait (non-empty for healthy refs). */\n states: string[];\n /** Declared event keys for this trait (non-empty for healthy refs). */\n events: string[];\n /**\n * Entity data keyed by entity name. Uses {@link EntityRow} — the\n * canonical persisted-entity shape the server returns and the trait\n * reducer stores. Consumers that need full field-level types can cast\n * down to the generated entity (e.g. `data['CartItem'] as CartItem[]`).\n * Snapshot-on-read; mutating the returned arrays does not affect the\n * live reducer.\n */\n data: Record<string, EntityRow[]>;\n /** Payload of the last event the state machine processed, if any. */\n lastPayload?: EventPayload;\n /**\n * Last event the walker (or a UI click) dispatched into this trait.\n * Used by VG11a to resolve `@payload.X` expected values.\n */\n lastEventDispatched?: {\n event: string;\n payload?: EventPayload;\n source?: BusEventSource;\n timestamp: number;\n };\n /**\n * Bus events received from the server's `emittedEvents` cascade\n * since the last user dispatch. VG4 compares the length against the\n * number of `emit: { success/failure: ... }` entries on the\n * triggering transition.\n */\n cascadeReceived: Array<{\n event: string;\n payload?: EventPayload;\n timestamp: number;\n }>;\n}\n\n// ── Top-level snapshot ────────────────────────────────────────────────\n\nexport interface VerificationSnapshot {\n checks: VerificationCheck[];\n transitions: TransitionTrace[];\n bridge: BridgeHealth | null;\n summary: VerificationSummary;\n /**\n * Per-trait reducer snapshots. Empty on older runtimes that predate\n * the Foundation 1 expansion; non-empty once any trait hook has\n * registered a snapshot getter.\n */\n traits: TraitStateSnapshot[];\n}\n\n// ── Side-channel observation surfaces ────────────────────────────────\n\n/** Asset load status exposed for canvas-based game verification. */\nexport type AssetLoadStatus = \"loaded\" | \"failed\" | \"pending\";\n\n/**\n * Entry recorded on the verification event log. The registry ring-buffers\n * the log to the last `MAX_EVENT_LOG` entries (evicting the oldest, never\n * the recent tail) so long runs don't grow unbounded — see\n * `verificationRegistry` and `eventLogDropped`.\n */\nexport interface EventLogEntry {\n type: string;\n payload?: EventPayload;\n source?: BusEventSource;\n timestamp: number;\n}\n\n/** One guarded arm evaluated while choosing which `from --event-->` arm fires. */\nexport interface GuardEvaluation {\n /** Position of the arm among the trait's `from --event-->` arms, in declaration order. */\n arm: number;\n guard: SExpr;\n passed: boolean;\n trace: EvalTrace;\n error?: string;\n}\n\n/** One played circuit step: Event → Guard → Transition → Effects. */\nexport interface CircuitStepResult {\n trait: string;\n event: string;\n /** A guard-fail always means no transition, even for a self-loop. */\n transitionFired: boolean;\n guard: \"pass\" | \"fail\" | \"none\";\n /** Position of the chosen arm among the trait's `from --event-->` arms; absent when every guard failed. */\n firedArm?: number;\n state: { before: string | null; after: string | null };\n effects: ReadonlyArray<EffectTrace>;\n emitted: ReadonlyArray<EventLogEntry>;\n /** Guarded arms evaluated during arm selection, in order, when the guard hook traced them. */\n guards?: ReadonlyArray<GuardEvaluation>;\n}\n\n// ── Window bridge contract ───────────────────────────────────────────\n\n/**\n * A drawable descriptor as exposed over the verification bridge. The\n * concrete `DrawableNode` union lives downstream in `@almadar/ui`\n * (`lib/drawable/paintDispatch.ts`) and cannot be imported here without\n * inverting the dependency axis; the bridge contract carries the `type`\n * discriminant (`draw-sprite`, `draw-shape`, …) that verifiers narrow on.\n */\nexport interface DrawableDescriptor {\n type: string;\n}\n\n/**\n * The object attached to `window.__orbitalVerification`. Every optional\n * member is wired up by a corresponding `bind*` / `register*` call on\n * the registry (e.g. `bindEventBus` populates `sendEvent`). Consumers\n * should null-check before calling — an older bundle might expose only\n * the core readers.\n */\nexport interface OrbitalVerificationAPI {\n applyConfig?: (traitName: string, config: TraitConfig) => void | Promise<void>;\n getSnapshot: () => VerificationSnapshot;\n getChecks: () => VerificationCheck[];\n getTransitions: () => TransitionTrace[];\n getBridge: () => BridgeHealth | null;\n getSummary: () => VerificationSummary;\n /** Wait for a specific event to be processed. Resolves to null on timeout. */\n waitForTransition: (\n event: string,\n timeoutMs?: number,\n ) => Promise<TransitionTrace | null>;\n /**\n * Send an event into the runtime. Requires {@link bindEventBus} (in\n * `@almadar/ui`) to have run at least once. Payload typed as\n * {@link EventPayload} so callers can't slip non-bus-shaped data in.\n *\n * `traitScope` is the qualified `Orbital.Trait` (or `App.Trait`)\n * scope that bus listeners subscribe under. The bridge constructs\n * `UI:${traitScope}.${event}` and emits that on the bus, matching\n * the codegen-emitted subscription keys (gap #13). When omitted,\n * the legacy bare-prefix form `UI:${event}` is used — kept only\n * for system-scope events like `UI:NAVIGATE`; trait-driven dispatch\n * MUST pass a `traitScope`.\n */\n sendEvent?: (\n event: string,\n payload?: EventPayload,\n traitScope?: string,\n ) => void;\n /** Current state name for a given trait, if known. */\n getTraitState?: (traitName: string) => string | undefined;\n /** Per-trait reducer snapshots (VG4/VG6/VG11a/b/c). */\n getTraitSnapshots?: () => TraitStateSnapshot[];\n /** Canvas frame capture. Populated by game organisms on mount. */\n captureFrame?: () => string | null;\n /** Last neutral drawables list received by the active canvas host. */\n getLastDrawables?: () => DrawableDescriptor[] | null;\n /** Asset-url → load-status map. Populated by game organisms. */\n assetStatus?: Record<string, AssetLoadStatus>;\n /** Rolling event bus log. Populated by `bindEventBus`. */\n eventLog?: EventLogEntry[];\n /**\n * Per-page-load nonce, set once when `bindEventBus` creates the log\n * (and bumped by `clearEventLog`). A verifier reading the log across\n * hermetic page reloads uses this — not the array length — to detect a\n * reset: the length can coincidentally refill to the same count after a\n * reload, which silently drops the post-reload delta. The epoch changing\n * is the only reliable reset signal.\n */\n eventLogEpoch?: string;\n /**\n * Count of entries evicted from the FRONT of the ring-buffered log this\n * page (see `MAX_EVENT_LOG`). The absolute index of `eventLog[i]` is\n * `eventLogDropped + i`, so a verifier can cursor by absolute position\n * even after eviction — the recent (driven) tail is never silently lost.\n */\n eventLogDropped?: number;\n /** Clear the event log in place (also bumps `eventLogEpoch`). */\n clearEventLog?: () => void;\n}\n\n/** `data-testid` of the box UISlotRenderer draws when a pattern prop's value\n * has a shape no declared type accepts; verifiers count each as a failure. */\nexport const PATTERN_PROP_TYPE_ERROR_TESTID = \"pattern-prop-type-error\";\n\n/** `data-testid` of the error a trait's card shows when its lifecycle step\n * (INIT/LOAD/$MOUNT) throws; verifiers count each as a failure. */\nexport const TRAIT_MOUNT_ERROR_TESTID = \"trait-mount-error\";\n\n/** DOM attribute on an empty-state view's root, so a verifier finds empty collections by structure, never by text. */\nexport const EMPTY_STATE_MARKER = \"data-empty-state\";\n\n/** DOM attribute on a loading view's root (spinner, loading state). */\nexport const LOADING_STATE_MARKER = \"data-loading-state\";\n\n/** Web DOM attributes the verifier selects on; one owner for @almadar/ui (producer) and @almadar-io/verify (consumer). */\nexport const VERIFICATION_DOM_ATTRS = {\n pattern: \"data-pattern\",\n rowId: \"data-row-id\",\n entityRow: \"data-entity-row\",\n entityId: \"data-entity-id\",\n fieldName: \"data-field-name\",\n event: \"data-event\",\n} as const;\n\nexport const ACTION_TESTID_PREFIX = verificationIds.actionPrefix;\n\nexport const ACTION_OVERFLOW_TESTID = `${ACTION_TESTID_PREFIX}${verificationIds.overflowKey}`;\n\n/** Pattern name of the form container a verifier fills. */\nexport const FORM_PATTERN = \"form-section\";\n\n/** `data-testid` (web) / native identifier of an element that dispatches `eventKey`. */\nexport function actionTestId(eventKey: string): string {\n return `${ACTION_TESTID_PREFIX}${eventKey}`;\n}\n\n/** True when `testId` dispatches `event`: the exact form, or a qualified `Orbital.Trait.EVENT` form. */\nexport function actionTestIdMatches(testId: string, event: string): boolean {\n if (!testId.startsWith(ACTION_TESTID_PREFIX)) return false;\n const key = testId.slice(ACTION_TESTID_PREFIX.length);\n return key === event || key.endsWith(`.${event}`);\n}\n\n/** How an affordance dispatches its event: a tap, or a gesture its pattern declares. */\nexport type ActionGesture = \"tap\" | \"long-press\" | \"swipe-left\" | \"swipe-right\";\n\nconst GESTURES: readonly ActionGesture[] = [\"tap\", \"long-press\", \"swipe-left\", \"swipe-right\"];\n\n/** Pattern props whose event fires on a gesture, not a tap (`calendar-grid`, `data-list`). */\nfunction gestureOf(name: string): Exclude<ActionGesture, \"tap\"> {\n const gesture = GESTURES.find((g): g is Exclude<ActionGesture, \"tap\"> => g !== \"tap\" && g === name);\n if (gesture === undefined) throw new Error(`verification-ids.json names an unknown gesture \"${name}\"`);\n return gesture;\n}\n\nexport const GESTURE_EVENT_PROPS: Readonly<Record<string, Exclude<ActionGesture, \"tap\">>> = Object.fromEntries(\n Object.entries(verificationIds.gestureEventProps).map(([prop, gesture]) => [prop, gestureOf(gesture)]),\n);\n\n/** The identifier of an element whose `gesture` dispatches `eventKey`; a tap is the plain {@link actionTestId}. */\nexport function gestureActionTestId(eventKey: string, gesture: ActionGesture): string {\n return gesture === \"tap\" ? actionTestId(eventKey) : `${ACTION_TESTID_PREFIX}${gesture}:${eventKey}`;\n}\n\n/** The gesture `testId` dispatches `event` with, or null when it does not dispatch `event`. */\nexport function gestureOfActionTestId(testId: string, event: string): ActionGesture | null {\n if (!testId.startsWith(ACTION_TESTID_PREFIX)) return null;\n const rest = testId.slice(ACTION_TESTID_PREFIX.length);\n const colon = rest.indexOf(\":\");\n const gesture = colon < 0 ? \"tap\" : GESTURES.find((g) => g !== \"tap\" && g === rest.slice(0, colon));\n if (gesture === undefined) return null;\n const key = colon < 0 ? rest : rest.slice(colon + 1);\n return key === event || key.endsWith(`.${event}`) ? gesture : null;\n}\n\n/** Single-identifier prefixes for native shells (accessibilityIdentifier / testTag); row scope is hierarchical. */\nexport const NATIVE_ID_PREFIX = verificationIds.nativeIdPrefix;\n\n/** Separates the ids of one native element that dispatches several actions (a tap and a gesture). */\nexport const NATIVE_ID_SEPARATOR = verificationIds.nativeIdSeparator;\n\n/** The identifier of a native element carrying every non-empty id in `ids`. */\nexport function nativeIds(...ids: readonly string[]): string {\n return ids.filter((id) => id !== \"\").join(NATIVE_ID_SEPARATOR);\n}\n\n/** The ids a native identifier carries. */\nexport function splitNativeIds(identifier: string): string[] {\n return identifier.split(NATIVE_ID_SEPARATOR).filter((id) => id !== \"\");\n}\n\nexport function nativePatternId(name: string): string {\n return `${NATIVE_ID_PREFIX.pattern}${name}`;\n}\n\nexport function nativeRowId(id: string): string {\n return `${NATIVE_ID_PREFIX.row}${id}`;\n}\n\nexport function nativeFieldId(name: string): string {\n return `${NATIVE_ID_PREFIX.field}${name}`;\n}\n\nexport function nativeSlotId(name: string): string {\n return `${NATIVE_ID_PREFIX.slot}${name}`;\n}\n","[\n {\n \"code\": \"ORB_E_MISSING_NAME\",\n \"category\": \"entity\",\n \"description\": \"Entity is missing a name\"\n },\n {\n \"code\": \"ORB_E_NO_FIELDS\",\n \"category\": \"entity\",\n \"description\": \"Entity has no fields defined\"\n },\n {\n \"code\": \"ORB_E_INVALID_FIELD_TYPE\",\n \"category\": \"entity\",\n \"description\": \"Field has an invalid type\"\n },\n {\n \"code\": \"ORB_E_DUPLICATE_FIELD\",\n \"category\": \"entity\",\n \"description\": \"Duplicate field name in entity\"\n },\n {\n \"code\": \"ORB_E_INVALID_FIELD_NAME\",\n \"category\": \"entity\",\n \"description\": \"Field name doesn't match camelCase pattern\"\n },\n {\n \"code\": \"ORB_E_MISSING_COLLECTION\",\n \"category\": \"entity\",\n \"description\": \"Persistent entity missing collection property\"\n },\n {\n \"code\": \"ORB_E_LOCAL_REQUIRES_PERSISTENT\",\n \"category\": \"entity\",\n \"description\": \"`browser` on a non-persistent entity (ORB_E_LOCAL_REQUIRES_PERSISTENT)\"\n },\n {\n \"code\": \"ORB_E_IDENTITY_LOCAL\",\n \"category\": \"entity\",\n \"description\": \"`[identity]` entity declared `browser` (ORB_E_IDENTITY_LOCAL)\"\n },\n {\n \"code\": \"ORB_E_INSTANCE_INVALID\",\n \"category\": \"entity\",\n \"description\": \"A written-out row with an unknown field, a missing required field, or (local) no id (ORB_E_INSTANCE_INVALID)\"\n },\n {\n \"code\": \"ORB_E_LOCALE_INSTANCES_NOT_LOCAL\",\n \"category\": \"entity\",\n \"description\": \"`instances <lang>` on an entity whose rows are not browser-stored (ORB_E_LOCALE_INSTANCES_NOT_LOCAL)\"\n },\n {\n \"code\": \"ORB_E_LOCALE_INSTANCES_UNKNOWN_LOCALE\",\n \"category\": \"entity\",\n \"description\": \"`instances <lang>` for a locale the app does not declare, or for its default locale (ORB_E_LOCALE_INSTANCES_UNKNOWN_LOCALE)\"\n },\n {\n \"code\": \"ORB_E_LOCALE_INSTANCES_INCOMPLETE\",\n \"category\": \"entity\",\n \"description\": \"Locale rows written without the default `instances`, or missing a declared locale (ORB_E_LOCALE_INSTANCES_INCOMPLETE)\"\n },\n {\n \"code\": \"ORB_E_INVALID_RELATION\",\n \"category\": \"entity\",\n \"description\": \"Relation target entity doesn't exist\"\n },\n {\n \"code\": \"ORB_E_EMPTY_ENUM_VALUES\",\n \"category\": \"entity\",\n \"description\": \"Enum field has no values\"\n },\n {\n \"code\": \"ORB_E_SEMANTIC_VALUE_INVALID\",\n \"category\": \"entity\",\n \"description\": \"A literal default on a semantic-domain field does not satisfy that domain (`email : email = \\\"not-an-email\\\"`).\"\n },\n {\n \"code\": \"ORB_E_MOCK_NOT_IN_ENUM\",\n \"category\": \"entity\",\n \"description\": \"An enum field's `@mock` names a candidate that is not one of its values.\"\n },\n {\n \"code\": \"ORB_E_LITERAL_UNION_DEFAULT_MISMATCH\",\n \"category\": \"entity\",\n \"description\": \"Phase F.3: an entity field declares `values: [...]` (literal-union) AND `default: <X>`, but X is not one of the declared values. Error.\"\n },\n {\n \"code\": \"ORB_E_DEFAULT_TYPE_MISMATCH\",\n \"category\": \"entity\",\n \"description\": \"An entity field's `default` is structurally incompatible with its declared type — a relation field defaulting to a whole row (`seedRow : Note = {}`) instead of an id/absent, a number/boolean default on a string/enum field, etc. Rung-2 prevention: `check_field_def_shape` (`config_type.rs`) owns the one shape-vs-type check, reused here for entity defaults. Skips the string-vs-enum-membership case, which `LiteralUnionDefaultMismatch` already reports.\"\n },\n {\n \"code\": \"ORB_T_UNDEFINED_TRAIT\",\n \"category\": \"trait\",\n \"description\": \"Trait reference not found\"\n },\n {\n \"code\": \"ORB_T_INVALID_FORMAT\",\n \"category\": \"trait\",\n \"description\": \"Trait has invalid format\"\n },\n {\n \"code\": \"ORB_T_NO_INITIAL_STATE\",\n \"category\": \"trait\",\n \"description\": \"State machine has no initial state\"\n },\n {\n \"code\": \"ORB_T_MULTIPLE_INITIAL_STATES\",\n \"category\": \"trait\",\n \"description\": \"State machine has multiple initial states\"\n },\n {\n \"code\": \"ORB_T_DUPLICATE_STATE\",\n \"category\": \"trait\",\n \"description\": \"Duplicate state name in state machine\"\n },\n {\n \"code\": \"ORB_T_EMPTY_EVENT_NAME\",\n \"category\": \"trait\",\n \"description\": \"An event declared, emitted or transitioned on has an empty name\"\n },\n {\n \"code\": \"ORB_T_INVALID_TRANSITION\",\n \"category\": \"trait\",\n \"description\": \"Transition references non-existent state\"\n },\n {\n \"code\": \"ORB_T_DUPLICATE_TRANSITION\",\n \"category\": \"trait\",\n \"description\": \"Duplicate transition (same from/event without guard)\"\n },\n {\n \"code\": \"ORB_T_MISSING_INIT_TRANSITION\",\n \"category\": \"trait\",\n \"description\": \"Missing INIT transition on initial state\"\n },\n {\n \"code\": \"ORB_T_STATE_UNREACHABLE\",\n \"category\": \"trait\",\n \"description\": \"A declared state is unreachable from the trait's initial state via any transition path. BFS from the initial state over `transitions` (skipping `from == \\\"*\\\"` wildcards and the boot `INIT` self-loop on the initial state) never reaches it — dead topology. Surfaces only as a generic \\\"uncovered\\\" in the verifier today; caught here at author time. Worked example: std-booking-system ScheduleDisplay's `displaying`/`refreshing` cluster.\"\n },\n {\n \"code\": \"ORB_T_INIT_MISSING_FETCH\",\n \"category\": \"trait\",\n \"description\": \"INIT transition missing fetch effect for linked entity\"\n },\n {\n \"code\": \"ORB_T_MISSING_RENDER_UI\",\n \"category\": \"trait\",\n \"description\": \"Interaction trait missing render_ui effects\"\n },\n {\n \"code\": \"ORB_T_ENDPOINT_TRAIT_RENDERS\",\n \"category\": \"trait\",\n \"description\": \"A trait mounted only on protocol endpoints renders\"\n },\n {\n \"code\": \"ORB_T_TRAIT_ON_ROUTE_AND_ENDPOINT\",\n \"category\": \"trait\",\n \"description\": \"One trait is listed on both a route page and a protocol endpoint\"\n },\n {\n \"code\": \"ORB_T_TRAIT_UNMOUNTED\",\n \"category\": \"trait\",\n \"description\": \"A program trait is listed on no page\"\n },\n {\n \"code\": \"ORB_T_DEPRECATED_UI\",\n \"category\": \"trait\",\n \"description\": \"Deprecated ui property used\"\n },\n {\n \"code\": \"ORB_T_DUPLICATE_NAME\",\n \"category\": \"trait\",\n \"description\": \"Duplicate trait name across orbitals\"\n },\n {\n \"code\": \"ORB_T_UNDEFINED_EVENT\",\n \"category\": \"trait\",\n \"description\": \"Event not defined but used in transition\"\n },\n {\n \"code\": \"ORB_T_BEHAVIOR_REF_UNRESOLVED\",\n \"category\": \"trait\",\n \"description\": \"A trait-value literal (`<spec>.traits.<Trait>`) whose behavior or trait does not resolve against the installed behavior packages.\"\n },\n {\n \"code\": \"ORB_T_BEHAVIOR_REF_NOT_LITERAL\",\n \"category\": \"trait\",\n \"description\": \"A `behavior/ref` whose argument is computed at run time: a behavior from data must arrive as a `behavior` value, never re-parsed from text.\"\n },\n {\n \"code\": \"ORB_T_UNQUOTE_OUTSIDE_QUASIQUOTE\",\n \"category\": \"trait\",\n \"description\": \"An `[\\\"unquote\\\", …]` call outside a quasiquote body in an `.orb` input.\"\n },\n {\n \"code\": \"ORB_T_INVALID_SLOT_DEFAULT\",\n \"category\": \"trait\",\n \"description\": \"Config field typed `slot` has a default value not in `VALID_SLOTS`\"\n },\n {\n \"code\": \"ORB_T_INVALID_PATTERN_DEFAULT\",\n \"category\": \"trait\",\n \"description\": \"Config field typed `pattern` has a default value not in `PATTERN_TYPES`\"\n },\n {\n \"code\": \"ORB_T_SECRET_DEFAULT_NOT_STRING\",\n \"category\": \"trait\",\n \"description\": \"Config field typed `secret` has a non-string default — the value is a credential REFERENCE (env-var key name), never secret material (I-29)\"\n },\n {\n \"code\": \"ORB_T_INVALID_EVENT_DEFAULT\",\n \"category\": \"trait\",\n \"description\": \"Config field typed `event` holds a value that is not a member of the trait's post-rename event set (SCAN-EVENT-KNOB-1). Definer-position knobs (A-UNIFY) skip this membership check — their value CREATES the event name — but still land here if the default isn't a plain string.\"\n },\n {\n \"code\": \"ORB_T_EVENT_REF_UNRESOLVED\",\n \"category\": \"trait\",\n \"description\": \"An event-typed config value addresses a trait the program does not have.\"\n },\n {\n \"code\": \"ORB_T_EVENT_REF_NOT_EXTERNAL_INPUT\",\n \"category\": \"trait\",\n \"description\": \"An event-typed config value addresses an event its trait does not declare as an external input.\"\n },\n {\n \"code\": \"ORB_T_EXTERNAL_INPUT_NOT_RESTING\",\n \"category\": \"trait\",\n \"description\": \"A declared external input (`listens { EVENT -> external { … } }`) has no transition from the trait's initial state: inputs are complete commands.\"\n },\n {\n \"code\": \"ORB_T_CONFIG_SHAPE_MISMATCH\",\n \"category\": \"trait\",\n \"description\": \"Config field's default value doesn't match its declared structural shape (array vs scalar, object vs string, missing required, etc.). Fires after the typed-config carriers (`items` / `properties` / `values`) make the declared shape concrete enough to check against.\"\n },\n {\n \"code\": \"ORB_T_CONFIG_OBJECT_ARRAY_FORBIDDEN\",\n \"category\": \"trait\",\n \"description\": \"Config field uses `[object]` as its declared type. Banned because it lowers to an untyped `Array { inner: Json }` — the same shape the strict-lint floor catches as `Record<string, FieldValue | undefined>[]`. Authors should declare a named struct alias (e.g. `type FieldConfig = { name: string, label: string, ... }`) and use `[FieldConfig]` so the catalog + codegen carry real types.\"\n },\n {\n \"code\": \"ORB_T_GENERIC_TYPE_DEPRECATED\",\n \"category\": \"trait\",\n \"description\": \"A declaration uses a generic type — bare `json`, `object` (without declared `properties`), or `any` — in an entity field, config knob, type-alias member, or event payload field. Generic types are being eliminated from the language: renderable content belongs in `node`, structured data in inline `{ k: T }` shapes / named aliases / `Map K V`, and genuinely polymorphic atoms in declared type parameters. Hard error since 2026-09-01 (both behavior packages report zero occurrences).\"\n },\n {\n \"code\": \"ORB_T_TYPE_UNKNOWN\",\n \"category\": \"trait\",\n \"description\": \"A type reference names no declared type, entity or primitive\"\n },\n {\n \"code\": \"ORB_T_TYPE_CYCLE\",\n \"category\": \"trait\",\n \"description\": \"A type composition chain refers back to itself\"\n },\n {\n \"code\": \"ORB_T_TYPE_KIND_MISMATCH\",\n \"category\": \"trait\",\n \"description\": \"Composed types do not share a kind (all Entity, all Trait, …)\"\n },\n {\n \"code\": \"ORB_T_TYPE_COMPOSITION_CONFLICT\",\n \"category\": \"trait\",\n \"description\": \"A field is declared in more than one composed entity\"\n },\n {\n \"code\": \"ORB_T_TYPE_ANNOTATION_MISMATCH\",\n \"category\": \"trait\",\n \"description\": \"A type body does not match its `::` type annotation\"\n },\n {\n \"code\": \"ORB_T_TYPE_UNKNOWN_PARAM\",\n \"category\": \"trait\",\n \"description\": \"A type alias body uses a type parameter the alias does not declare\"\n },\n {\n \"code\": \"ORB_T_TYPE_WRONG_ARG_COUNT\",\n \"category\": \"trait\",\n \"description\": \"A type alias is applied with the wrong number of type arguments\"\n },\n {\n \"code\": \"ORB_T_EVENT_TYPE_WRONG_KIND\",\n \"category\": \"trait\",\n \"description\": \"An `emits` entry names a declared type that is not an Event type\"\n },\n {\n \"code\": \"ORB_RUI_NODE_FIELD_UNCHECKED_CONTENT\",\n \"category\": \"trait\",\n \"description\": \"A `node`-typed entity field receives a value the validator cannot statically check (a computed expression rather than a pattern-tree literal). Non-blocking: computed renderable content is legitimate, but its callback wiring is unchecked — prefer literal fragments (optionally via `let` bindings, which ARE resolved and checked).\"\n },\n {\n \"code\": \"ORB_RUI_RENDERABLE_IN_GENERIC_FIELD\",\n \"category\": \"trait\",\n \"description\": \"A render-ui pattern literal is assigned to a field NOT typed `node` — renderable content hiding in a generic/structured field escapes every render-ui check. Type the field `node` (or `[node]`). Error severity.\"\n },\n {\n \"code\": \"ORB_T_CONFIG_TIER_INVALID\",\n \"category\": \"trait\",\n \"description\": \"Config field's `@tier \\\"...\\\"` annotation uses a value outside the allowed set. Allowed values: `essential`, `customization`, `advanced`, `internal`. Defense-in-depth — the parser allowlists the four values today; this L2 rule catches future regressions and any malformed `.orb` IR that bypasses the parser.\"\n },\n {\n \"code\": \"ORB_T_ENTITY_NOT_REBINDABLE\",\n \"category\": \"trait\",\n \"description\": \"A trait imported from an atom carries a `linkedEntity` rebind, but the atom's binding is not marked `@rebindable`. The binding is fixed and the consumer may not redirect it. See `@rebindable` in `.lolo`.\"\n },\n {\n \"code\": \"ORB_T_REBIND_MISSING_FIELDS\",\n \"category\": \"trait\",\n \"description\": \"A `@rebindable` rebind points at an entity that lacks fields the trait reads (its inferred `entityContract.requires`). The target would break the behavior.\"\n },\n {\n \"code\": \"ORB_T_REBIND_TARGET_UNRESOLVED\",\n \"category\": \"trait\",\n \"description\": \"A `linkedEntity` rebind names something that is not any orbital's primary or auxiliary entity anywhere in the schema — the §52 rebind-merge (`phases::inline::entity::merge_into_named_entity`) has nowhere to land the imported trait's fields. Retired 2026-09-19: this used to fall back to the caller's primary entity silently; it is now a hard error instead of a wrong-entity merge.\"\n },\n {\n \"code\": \"ORB_T_UNRESOLVED_TYPE_PARAM\",\n \"category\": \"trait\",\n \"description\": \"A `.lolo` event alias's `(E : Entity)` type parameter — lowered to the `\\\"$E\\\"` payload sentinel by `orbital-lolo` (increment 3-I, `docs/Almadar_LOLO.md` ~line 315/1387) — survived the inline phase's substitution pass because the trait carrying the sentinel has no `linkedEntity` to monomorphize it against. Fix: bind the trait to an entity (or, once explicit application ships, apply the alias with a concrete argument).\"\n },\n {\n \"code\": \"ORB_T_EVENT_RENAME_UNKNOWN_KEY\",\n \"category\": \"trait\",\n \"description\": \"A call-site `events: { OLD: NEW }` rename names an OLD source key that does not exist in the imported trait's event set (its `emits[].event` ∪ `state_machine.transitions[].event`). The rename silently no-ops: nothing is renamed and the author's intent is lost. Surfaced from the inline phase where the imported trait's pre-rename event set is still visible.\"\n },\n {\n \"code\": \"ORB_T_CONFIG_UNKNOWN_CALL_SITE_KEY\",\n \"category\": \"trait\",\n \"description\": \"A trait Reference's call-site `config` block supplies a key that matches no declared config knob on the referenced trait — the override silently no-ops (e.g. a stale `entity=` left over from a generator regression, or a knob the atom never declared).\"\n },\n {\n \"code\": \"ORB_T_CONFIG_MISSING_REQUIRED_KEY\",\n \"category\": \"trait\",\n \"description\": \"A trait Reference's call site omits a key for a knob the referenced trait declares `!` (required). Any value form (literal, `@config.X` forward, `@entity.*`, payload ref) satisfies the requirement — only a fully missing key fires. The atom's own page binding is exempt.\"\n },\n {\n \"code\": \"ORB_T_LOCAL_TRAIT_TOUCHES_SERVER\",\n \"category\": \"trait\",\n \"description\": \"A `[client]` trait's transitions contain a server-bound effect (`fetch`/`persist`/`call-service`/`ref`/`deref`/`swap`/`watch`/ `atomic`/`fetch-stream`), or a guard reading `@user.*`. `[client]` declares client-only dispatch (`OirTrait::dispatch_mode`) — a trait that actually touches the server or reads viewer identity is mis-tagged; its transitions would never await the round trip they depend on. Wave 2. Error severity.\"\n },\n {\n \"code\": \"ORB_T_CLIENT_TICK_SERVER_EFFECT\",\n \"category\": \"trait\",\n \"description\": \"A tick that runs in the browser (its trait is not server-awaited; the tick is not `[background]`) carries a server effect — a server-owned data effect, or a `runsOn: server` operator. Nothing replays a tick on the server, so the effect would be dropped. Server work goes through an emitted event a server-side trait handles.\"\n },\n {\n \"code\": \"ORB_T_LOCAL_ON_NON_SHARED_PERSISTENT\",\n \"category\": \"trait\",\n \"description\": \"`[client]` on a trait whose linked entity is neither `[shared]` nor `[runtime]`. `[client]` is only legal on an entity multiple traits co-mutate client-side (`[shared]`) or one that is never persisted at all (`[runtime]`) — on an ordinary persistent entity it would silently hide server-gated writes behind client-only dispatch. Wave 2. Error severity.\"\n },\n {\n \"code\": \"ORB_AUTH_GUARD_CLIENT_ONLY\",\n \"category\": \"dispatch\",\n \"description\": \"A transition guard reads `@user.*` while the trait's `OirTrait::dispatch_mode()` is `RuntimeOptimistic` or `HybridClientOnly` — evaluated client-side only. An identity check that never reaches the server is not an authorization boundary: the client can construct any `@user` value it likes. Wave 2. Warning severity (the guard may still be a legitimate UX precondition; it is never a security boundary).\"\n },\n {\n \"code\": \"ORB_P_MISSING_NAME\",\n \"category\": \"page\",\n \"description\": \"Page is missing a name\"\n },\n {\n \"code\": \"ORB_P_MISSING_PATH\",\n \"category\": \"page\",\n \"description\": \"Page is missing a path\"\n },\n {\n \"code\": \"ORB_P_INVALID_PATH\",\n \"category\": \"page\",\n \"description\": \"Page path is invalid (must start with /)\"\n },\n {\n \"code\": \"ORB_P_DUPLICATE_PATH\",\n \"category\": \"page\",\n \"description\": \"Duplicate page path\"\n },\n {\n \"code\": \"ORB_P_INDEX_REQUIRES_PUBLIC\",\n \"category\": \"page\",\n \"description\": \"`indexing: index` without `access: public`, a title, a description or an app `origin`\"\n },\n {\n \"code\": \"ORB_P_INDEX_PARAM_ROUTE\",\n \"category\": \"page\",\n \"description\": \"`indexing: index` on a `:param` route (concrete URL inputs are not declarable yet)\"\n },\n {\n \"code\": \"ORB_P_AUTH_NO_SIGN_IN\",\n \"category\": \"page\",\n \"description\": \"`access: authenticated` page in an app that declares no `signIn` route\"\n },\n {\n \"code\": \"ORB_P_SIGN_IN_UNKNOWN_ROUTE\",\n \"category\": \"page\",\n \"description\": \"The app's `signIn` route is no page, or is itself `access: authenticated`\"\n },\n {\n \"code\": \"ORB_P_HOST_RESERVED_ROUTE\",\n \"category\": \"page\",\n \"description\": \"A page is declared on the host's own sign-in route (`/login`)\"\n },\n {\n \"code\": \"ORB_P_UNKNOWN_PROTOCOL\",\n \"category\": \"page\",\n \"description\": \"A page names a protocol that is no row of the protocol table\"\n },\n {\n \"code\": \"ORB_P_ENDPOINT_GRANT_MISSING\",\n \"category\": \"page\",\n \"description\": \"An `http` endpoint has no covering `net` listen grant\"\n },\n {\n \"code\": \"ORB_P_ADDRESS_INVALID\",\n \"category\": \"page\",\n \"description\": \"A protocol page's address does not type-check against the protocol's address record\"\n },\n {\n \"code\": \"ORB_P_TRANSLATION_DUPLICATE_LOCALE\",\n \"category\": \"page\",\n \"description\": \"One locale holds two pages of the same `translationOf` group\"\n },\n {\n \"code\": \"ORB_P_MISSING_TRAITS\",\n \"category\": \"page\",\n \"description\": \"Page is missing traits array\"\n },\n {\n \"code\": \"ORB_P_EMPTY_TRAITS\",\n \"category\": \"page\",\n \"description\": \"Page traits array is empty\"\n },\n {\n \"code\": \"ORB_O_DUPLICATE_NAME\",\n \"category\": \"page\",\n \"description\": \"Two orbitals of one program share a name\"\n },\n {\n \"code\": \"ORB_O_CONFIG_UNKNOWN_KEY\",\n \"category\": \"page\",\n \"description\": \"An `orbital X = Alias.orbitals.Y { config { … } } }` call-site override names a key the upstream orbital's declared `config {}` does not have (`Almadar_Orbital_Import.md` §4.5).\"\n },\n {\n \"code\": \"ORB_O_OMIT_EMBEDDED_TRAIT\",\n \"category\": \"page\",\n \"description\": \"An `orbital X = Alias.orbitals.Y { omit { … } } }` call site drops a trait that a surviving trait still embeds via `@trait.<X>` — the embed token has nothing left to render.\"\n },\n {\n \"code\": \"ORB_O_CONFIG_DEAD_KNOB\",\n \"category\": \"page\",\n \"description\": \"A declared `Orbital.config` or `OrbitalSchema.config` knob (`Almadar_Orbital_Import.md` §4.5) that no trait in the schema forwards (`config[*].default == \\\"@config.<knob>\\\"`) — dead: nothing publishes it, so no call site can ever reach it.\"\n },\n {\n \"code\": \"ORB_O_ROLE_TARGET_NOT_MEMBER\",\n \"category\": \"page\",\n \"description\": \"An `orbital X = Alias.orbitals.Y { roles { … } } }` target is not a member of the CONSUMER roster's vocabulary (`identity_entities` on the importing schema, post-inline).\"\n },\n {\n \"code\": \"ORB_O_ROLE_UNKNOWN_UPSTREAM\",\n \"category\": \"page\",\n \"description\": \"An `orbital X = Alias.orbitals.Y { roles { … } } }` key names no value in any UPSTREAM identity field's vocabulary (or the upstream alias declares no roster at all).\"\n },\n {\n \"code\": \"ORB_O_ENTITY_UNMAPPED\",\n \"category\": \"page\",\n \"description\": \"A kept trait/relation/page references an out-of-orbital entity that `obj.entities {}` never maps — the import splice has nothing to rebind it to.\"\n },\n {\n \"code\": \"ORB_O_ENTITY_UNKNOWN_KEY\",\n \"category\": \"page\",\n \"description\": \"An `obj.entities {}` key names no entity in the upstream closure's out-of-orbital universe.\"\n },\n {\n \"code\": \"ORB_O_ENTITY_EXPECT_AMBIGUOUS\",\n \"category\": \"page\",\n \"description\": \"An entity an imported orbital expects of a sibling is provided by several sibling imports and no `entities {}` entry names which one it binds to.\"\n },\n {\n \"code\": \"ORB_O_ENTITY_TARGET_UNKNOWN\",\n \"category\": \"page\",\n \"description\": \"An `obj.entities {}` value names no entity the consumer schema declares.\"\n },\n {\n \"code\": \"ORB_O_PAGE_UNKNOWN_PATH\",\n \"category\": \"page\",\n \"description\": \"An `obj.pages {}` / `obj.mounts {}` key names no page path the imported orbital declares.\"\n },\n {\n \"code\": \"ORB_O_EXTEND_FIELD_COLLISION\",\n \"category\": \"page\",\n \"description\": \"An `orbital X = Alias.orbitals.Y { extend { … } } }` field name is already declared on the upstream primary entity (after `fields {}` renames), or equals a `fields {}` rename TARGET (Stage C).\"\n },\n {\n \"code\": \"ORB_O_EXTEND_FIELD_UNREAD\",\n \"category\": \"page\",\n \"description\": \"An `extend { … }` field no kept trait reads/sets/renders and no orbital-level config knob value forwards (Stage C, warning — rung 2).\"\n },\n {\n \"code\": \"ORB_O_FIELD_RENAME_UNAPPLIED\",\n \"category\": \"page\",\n \"description\": \"A `fields { OLD: NEW }` rename on an `orbital X = Alias.orbitals.Y { … }` reference left a structurally-recognized field-reference position (a config default's bare/list field-name value) still naming the pre-rename upstream field — the rename silently failed to reach it (G3, `docs/Almadar_Compiler_Gaps.md` §82, rung 2: what used to validate 0/0 with a dead reference now errors instead).\"\n },\n {\n \"code\": \"ORB_O_MOCK_UNKNOWN_FIELD\",\n \"category\": \"page\",\n \"description\": \"A `mock { … }` key names no field of the imported primary entity.\"\n },\n {\n \"code\": \"ORB_O_RETYPE_UNKNOWN_FIELD\",\n \"category\": \"page\",\n \"description\": \"A `retype { … }` field the upstream primary entity does not declare (after `fields {}` renames).\"\n },\n {\n \"code\": \"ORB_O_RETYPE_FIELD_CONFLICT\",\n \"category\": \"page\",\n \"description\": \"A `retype { … }` field also added by `extend {}`, or retyped twice.\"\n },\n {\n \"code\": \"ORB_O_ENTITY_PERSISTENCE_LOCKED\",\n \"category\": \"page\",\n \"description\": \"An `entity [persistent: …]` override on an upstream entity whose persistence mode does not allow overrides (the factory-runtime rule).\"\n },\n {\n \"code\": \"ORB_O_TRAITS_UNKNOWN_TRAIT\",\n \"category\": \"page\",\n \"description\": \"A `traits { T { … } }` key naming no trait of the upstream orbital.\"\n },\n {\n \"code\": \"ORB_O_TRAITS_OMITTED_TRAIT\",\n \"category\": \"page\",\n \"description\": \"A `traits { T { … } }` key naming a trait `omit {}` / `only {}` dropped.\"\n },\n {\n \"code\": \"ORB_P_SECTIONS_FORBIDDEN\",\n \"category\": \"page\",\n \"description\": \"Static sections are forbidden (use render_ui)\"\n },\n {\n \"code\": \"ORB_P_INVALID_TRAIT_REF\",\n \"category\": \"page\",\n \"description\": \"Invalid trait reference on page\"\n },\n {\n \"code\": \"ORB_P_INVALID_VIEW_TYPE\",\n \"category\": \"page\",\n \"description\": \"Invalid view type\"\n },\n {\n \"code\": \"ORB_PAGE_UNREACHABLE\",\n \"category\": \"page\",\n \"description\": \"A declared inline page is not the target of any `navigate` effect, any literal `href` value, and is not the root page or a parameterized page — nothing in the schema can ever route a viewer to it. Ported from the JS wiring lint's `page-absent-from-nav`, generalised: no navItems-array opt-in gate, and scalar `href` values count (not only object-array entries).\"\n },\n {\n \"code\": \"ORB_PAGE_SECOND_CONTENT_BODY\",\n \"category\": \"page\",\n \"description\": \"A page's content owner (`page_content_owner`'s `channel`/`ambiguous`) leaves a SECOND page-declared, inline, content-main-writing trait unclaimed: not an owner itself, not embedded by any client-bound trait, and not kin to the owner through either the config-channel or embed-containment relation (`reduce_to_owners({owner, this}).len() == 1` would mean related, not a rival). Two content bodies stacking into one page's `main`. Ported from the JS wiring lint's `unclaimed-main-writer` (warning there; error here per the owner's Q3 ruling).\"\n },\n {\n \"code\": \"ORB_PAGE_CONTROL_OUTSIDE_SHELL\",\n \"category\": \"page\",\n \"description\": \"A page whose `main` a shell owns through a config channel (`contentTrait` …) also mounts a trait that paints a control into `main` which neither the owner nor anything it embeds references: the control stacks outside the shell's layout instead of inside it.\"\n },\n {\n \"code\": \"ORB_COMPOSED_STATE_UNREACHABLE\",\n \"category\": \"circuit\",\n \"description\": \"A composed trait (`sourceBehavior` set) has a state no event the program can produce leads to: every transition into it waits on an event nothing routes in, no control or effect fires, and the host is not declared to send (`external`). An atom's own inputs are its offer; a composition that never wires one leaves that part of it dead.\"\n },\n {\n \"code\": \"ORB_COMPOSED_TRANSITION_UNREACHABLE\",\n \"category\": \"circuit\",\n \"description\": \"A composed trait (`sourceBehavior` set) has a live transition, from a reachable state, on an event the program cannot produce under its resolved config: no listens route, control or effect fires it, it is not a lifecycle event and not declared `external` (G-CROSS-144).\"\n },\n {\n \"code\": \"ORB_CONTROL_VALUE_DISCARDED\",\n \"category\": \"circuit\",\n \"description\": \"A composed trait's rendered control fires an event carrying a value that no other trait hears and whose own handling reads none of it: the value the user entered is discarded (a form submission nothing keeps).\"\n },\n {\n \"code\": \"ORB_PAGE_AMBIGUOUS_CONTENT_OWNER\",\n \"category\": \"page\",\n \"description\": \"A page whose content owner is ambiguous: two or more page-declared `main` writers, none composing the others, no shell channel naming one. Renders stacked alone, but any shell that designates one `contentTrait` turns the rest into second bodies (G-ORB-128).\"\n },\n {\n \"code\": \"ORB_SLOT_MAIN_NOT_COVERED\",\n \"category\": \"slot\",\n \"description\": \"Main slot not covered by any trait\"\n },\n {\n \"code\": \"ORB_SLOT_CONTENTION\",\n \"category\": \"slot\",\n \"description\": \"Multiple traits rendering to same slot (INIT state)\"\n },\n {\n \"code\": \"ORB_SLOT_CONTENTION_RUNTIME\",\n \"category\": \"slot\",\n \"description\": \"Multiple traits rendering to same slot in a reachable post-INIT state (emitted as a warning; INIT-state case still errors via `SlotContention`)\"\n },\n {\n \"code\": \"ORB_SLOT_CONTENTION_TICK\",\n \"category\": \"slot\",\n \"description\": \"Two or more traits mounted on one page repaint the same slot from inside a `ticks` block, with no guard proving either one dead. Tick bodies run every frame, so they paint together rather than alternating.\"\n },\n {\n \"code\": \"ORB_SLOT_INVALID_NESTING\",\n \"category\": \"slot\",\n \"description\": \"Invalid slot nesting (e.g., modal in modal)\"\n },\n {\n \"code\": \"ORB_RUI_INVALID_SLOT\",\n \"category\": \"render_ui\",\n \"description\": \"Invalid slot in render_ui effect\"\n },\n {\n \"code\": \"ORB_RUI_INVALID_PATTERN\",\n \"category\": \"render_ui\",\n \"description\": \"Invalid pattern type\"\n },\n {\n \"code\": \"ORB_RUI_MISSING_PATTERN_TYPE\",\n \"category\": \"render_ui\",\n \"description\": \"Pattern missing type property\"\n },\n {\n \"code\": \"ORB_RUI_INVALID_PROP\",\n \"category\": \"render_ui\",\n \"description\": \"Invalid prop for pattern\"\n },\n {\n \"code\": \"ORB_RUI_CHILD_NOT_DRAWABLE\",\n \"category\": \"render_ui\",\n \"description\": \"A non-drawable child composed under a canvas draw-host. A draw-host paints only neutral drawable descriptors (draw-sprite / draw-shape / draw-text / draw-*-layer); DOM chrome belongs in a `hud`/`overlay` slot.\"\n },\n {\n \"code\": \"ORB_RUI_MISSING_REQUIRED_PROP\",\n \"category\": \"render_ui\",\n \"description\": \"Missing required prop for pattern\"\n },\n {\n \"code\": \"ORB_RUI_INVALID_ITEM_ACTION\",\n \"category\": \"render_ui\",\n \"description\": \"Invalid itemAction configuration\"\n },\n {\n \"code\": \"ORB_RUI_UNKNOWN_ITEM_ACTION_PROP\",\n \"category\": \"render_ui\",\n \"description\": \"Unknown itemAction prop (e.g., hallucinated 'condition')\"\n },\n {\n \"code\": \"ORB_RUI_MISSING_ACTION\",\n \"category\": \"render_ui\",\n \"description\": \"Button/link missing action prop\"\n },\n {\n \"code\": \"ORB_A11Y_UNNAMED\",\n \"category\": \"render_ui\",\n \"description\": \"A pattern that declares `@accessibleName` props has none of them, no `aria-label`/`aria-labelledby`, and is not `aria-hidden`\"\n },\n {\n \"code\": \"ORB_RUI_INVALID_FIELD_PATH\",\n \"category\": \"render_ui\",\n \"description\": \"Nested field path references invalid relation or field\"\n },\n {\n \"code\": \"ORB_RUI_FORM_FIELD_INTRINSIC\",\n \"category\": \"render_ui\",\n \"description\": \"A `form`-contract pattern offers an input for an `@intrinsic` entity field — intrinsic fields are never persisted, so the input is discarded.\"\n },\n {\n \"code\": \"ORB_RUI_PROP_TYPE_MISMATCH\",\n \"category\": \"render_ui\",\n \"description\": \"Prop value type doesn't match expected type from registry\"\n },\n {\n \"code\": \"ORB_RUI_BINDING_TYPE_MISMATCH\",\n \"category\": \"render_ui\",\n \"description\": \"L2.1 keystone: render-ui prop bound to a `@payload.X` / `@entity.X` / `@config.X` / SExpression operator whose resolved type doesn't match any of the prop's declared `types` in the patterns registry. Distinct from `RenderUIPropTypeMismatch` (literal-only); this rule uses the F3 binding resolver to walk through bindings and SExpression operator return types (sharpened by F2's `returnSemantics` for input-dependent operators). Gap #6 in `docs/Almadar_Std_Verification.md`.\"\n },\n {\n \"code\": \"ORB_RUI_ELEMENT_SHAPE_MISMATCH\",\n \"category\": \"render_ui\",\n \"description\": \"L2.4: render-ui binds an array literal to a prop whose pattern declares per-element required fields (`items.properties.<field>.required`), and one or more elements omit a required field. Catches the landing-page/about-page/showcase class of bugs where the lolo `[StepCard]` type omits `id` but the consuming `step-flow-organism` pattern requires it — surfaced at codegen as TS2322 before this rule. Walks `OirValue::Array` element-by-element against `items.properties` from `patterns-registry.json`. Discovery context: `docs/Almadar_Std_Gaps.md` §13.\"\n },\n {\n \"code\": \"ORB_T_ENTITY_NAME_SHADOWS_TRAIT_UNION\",\n \"category\": \"entity\",\n \"description\": \"Entity name collides with a sibling trait's generated `<TraitName>State` or `<TraitName>Event` union type. The TS codegen emits both `import type { <EntityName> } from '@app/shared'` and `type <TraitName>State = '...'` / `type <TraitName>Event = '...'` in every server-handler / client-hook / view file — when the entity name equals one of those generated unions, the import collides with the local declaration and tsc raises TS2440 \\\"Import declaration conflicts with local declaration\\\". Defense-in-depth pair with the lolo lowering check `LowerError::EntityNameShadowsTraitUnion`: the lolo rule catches hand-authored `.lolo`, this validator rule catches `.orb` mutated directly by an agent or factory that bypassed the lolo parse path. Convention fix: rename the entity (e.g. `<TraitName>Data`).\"\n },\n {\n \"code\": \"ORB_RUI_EVENT_BINDING_PAYLOAD_MISMATCH\",\n \"category\": \"render_ui\",\n \"description\": \"L2.2: render-ui prop with `kind: \\\"event-ref\\\"` or `kind: \\\"callback\\\"` bound to an event-name string whose declared payload schema in the trait's `emits {}` block doesn't match the component's documented bus emit shape (registry's `emitPayloadSchema` for event-ref props; `callbackArgs` for callback props). Gap #32 in `docs/Almadar_Std_Verification.md`.\"\n },\n {\n \"code\": \"ORB_X_RENDER_UI_EVENT_LITERAL_STALE\",\n \"category\": \"render_ui\",\n \"description\": \"L2.3: render-ui pattern carries a string literal that matches an event name no longer in the trait's event set after the inline phase applies an `events: { OLD: NEW }` override. Detects the stale literal that the compiler's events-rewrite pass should have rewritten — defense-in-depth for C1 (the compiler fix). Gap #30 in `docs/Almadar_Std_Verification.md`.\"\n },\n {\n \"code\": \"ORB_EFF_CALL_SERVICE_MISSING_SERVICE\",\n \"category\": \"effect\",\n \"description\": \"call_service missing service name\"\n },\n {\n \"code\": \"ORB_EFF_CALL_SERVICE_UNKNOWN_SERVICE\",\n \"category\": \"effect\",\n \"description\": \"call_service names a service in neither schema.services nor the services registry. Error severity.\"\n },\n {\n \"code\": \"ORB_EFF_CALL_SERVICE_MISSING_ACTION\",\n \"category\": \"effect\",\n \"description\": \"call_service missing action\"\n },\n {\n \"code\": \"ORB_EFF_CALL_SERVICE_MISSING_HANDLERS\",\n \"category\": \"effect\",\n \"description\": \"call_service missing onSuccess/onError handlers\"\n },\n {\n \"code\": \"ORB_EFF_CALL_SERVICE_UNKNOWN_PARAM\",\n \"category\": \"effect\",\n \"description\": \"call_service params carry a key the action's registry contract does not declare (I-13 — the `recipient` vs `to` class)\"\n },\n {\n \"code\": \"ORB_EFF_CALL_SERVICE_MISSING_PARAM\",\n \"category\": \"effect\",\n \"description\": \"call_service params omit a key the action's registry contract requires\"\n },\n {\n \"code\": \"ORB_EFF_CALL_SERVICE_PARAM_TYPE\",\n \"category\": \"effect\",\n \"description\": \"call_service literal param value contradicts the contract's param type\"\n },\n {\n \"code\": \"ORB_CALL_SERVICE_CANCELLED_WITHOUT_KEY\",\n \"category\": \"effect\",\n \"description\": \"call-service declares `emit.cancelled` but no `key` — nothing can cancel an unkeyed call\"\n },\n {\n \"code\": \"ORB_CALL_SERVICE_KEY_TYPE\",\n \"category\": \"effect\",\n \"description\": \"call-service `key` is a non-string literal (number/bool/object/array)\"\n },\n {\n \"code\": \"ORB_CANCEL_CALL_NO_KEYED_CALL\",\n \"category\": \"effect\",\n \"description\": \"the app runs `cancel-call` but no `call-service` anywhere carries a `key`\"\n },\n {\n \"code\": \"ORB_CALL_KEY_UNUSED\",\n \"category\": \"effect\",\n \"description\": \"a literal `(as \\\"k\\\" CallKey)` in a program whose keyed calls are all keyed by literals, none of them `\\\"k\\\"`\"\n },\n {\n \"code\": \"ORB_EFFECT_OPTION_DROPPED\",\n \"category\": \"effect\",\n \"description\": \"an emit-options `key` on an effect that carries no key, so its completion could never echo it\"\n },\n {\n \"code\": \"ORB_CANCEL_CALL_KEY_NEVER_CALLED\",\n \"category\": \"effect\",\n \"description\": \"`--final`: a `cancel-call` on a `CallKey` (or a list of them) in a finished program where no keyed call has a `CallKey`-typed `key:`, so nothing the program runs is named by a key made with `as`\"\n },\n {\n \"code\": \"ORB_CALL_SERVICE_KEY_DUPLICATE\",\n \"category\": \"effect\",\n \"description\": \"two `call-service` effects of one transition carry the same literal `key`\"\n },\n {\n \"code\": \"ORB_CALL_SERVICE_RESULT_HAS_KEY\",\n \"category\": \"effect\",\n \"description\": \"a keyed call-service whose registry responseShape already has a `key` field\"\n },\n {\n \"code\": \"ORB_HTTP_EGRESS_UNDECLARED\",\n \"category\": \"effect\",\n \"description\": \"an `http` origin, `tokenUrl` origin, or `url` knob default is not in `egress`\"\n },\n {\n \"code\": \"ORB_HTTP_EGRESS_ENTRY_INVALID\",\n \"category\": \"effect\",\n \"description\": \"an `egress` entry is not `scheme://host[:port]`\"\n },\n {\n \"code\": \"ORB_INBOUND_UNDECLARED\",\n \"category\": \"effect\",\n \"description\": \"an inbound handler (`listens { EVENT -> inbound \\\"name\\\" … }`) is reachable in a program whose app does not declare `name` in `inbound`\"\n },\n {\n \"code\": \"ORB_INBOUND_ENTRY_INVALID\",\n \"category\": \"effect\",\n \"description\": \"an `inbound` entry is not one lower-case hook name (letters, digits, `-`), or is listed twice\"\n },\n {\n \"code\": \"ORB_INBOUND_DUPLICATE\",\n \"category\": \"effect\",\n \"description\": \"two traits handle the same inbound hook name\"\n },\n {\n \"code\": \"ORB_INBOUND_ANSWER_UNDECLARED\",\n \"category\": \"effect\",\n \"description\": \"an inbound handler answers with an event its trait does not declare in `emits`\"\n },\n {\n \"code\": \"ORB_INBOUND_ANSWER_FOREIGN\",\n \"category\": \"effect\",\n \"description\": \"a trait other than an inbound handler emits the handler's answer event and the handler does not relay it: only the handler's own emit answers\"\n },\n {\n \"code\": \"ORB_INBOUND_VERIFY_INVALID\",\n \"category\": \"effect\",\n \"description\": \"an inbound `verifies` header is not a lower-case header name, or its credential is not a credential name\"\n },\n {\n \"code\": \"ORB_OS_GRANT_MISSING\",\n \"category\": \"effect\",\n \"description\": \"an `os/` call needs something the calling orbital's grants do not cover\"\n },\n {\n \"code\": \"ORB_OS_TARGET_NOT_STATIC\",\n \"category\": \"effect\",\n \"description\": \"an `os/` call's target (path, command, host, port, variable, flags) is not a literal\"\n },\n {\n \"code\": \"ORB_OS_GRANT_UNUSED\",\n \"category\": \"effect\",\n \"description\": \"a declared `os/` grant entry that no `os/` call of the orbitals holding it uses (warning)\"\n },\n {\n \"code\": \"ORB_OS_GRANT_ENTRY_INVALID\",\n \"category\": \"effect\",\n \"description\": \"a declared `os/` grant entry whose shape cannot match anything\"\n },\n {\n \"code\": \"ORB_PLACEMENT_ORBITAL_UNKNOWN\",\n \"category\": \"effect\",\n \"description\": \"a `deployment` unit lists an orbital the program does not declare\"\n },\n {\n \"code\": \"ORB_PLACEMENT_ORBITAL_DUPLICATE\",\n \"category\": \"effect\",\n \"description\": \"an orbital is listed in more than one `deployment` unit, or twice in one\"\n },\n {\n \"code\": \"ORB_PLACEMENT_ORBITAL_UNPLACED\",\n \"category\": \"effect\",\n \"description\": \"a `deployment` is declared and an orbital is in none of its units\"\n },\n {\n \"code\": \"ORB_PLACEMENT_UNIT_EMPTY\",\n \"category\": \"effect\",\n \"description\": \"a `deployment` unit lists no orbital\"\n },\n {\n \"code\": \"ORB_HTTP_ORIGIN_NOT_STATIC\",\n \"category\": \"effect\",\n \"description\": \"an `http` origin is neither a string literal nor a `url`-typed `@config` knob\"\n },\n {\n \"code\": \"ORB_HTTP_METHOD_UNKNOWN\",\n \"category\": \"effect\",\n \"description\": \"an `http` method is not one of GET POST PUT PATCH DELETE\"\n },\n {\n \"code\": \"ORB_HTTP_PATH_INVALID\",\n \"category\": \"effect\",\n \"description\": \"an `http` path violates the kernel's absolute-path contract\"\n },\n {\n \"code\": \"ORB_HTTP_OPTION_UNKNOWN\",\n \"category\": \"effect\",\n \"description\": \"an `http` request/auth/paginate object carries a key outside its closed set\"\n },\n {\n \"code\": \"ORB_HTTP_AUTH_SCHEME_UNKNOWN\",\n \"category\": \"effect\",\n \"description\": \"`http` `auth.scheme` is not in the closed scheme set\"\n },\n {\n \"code\": \"ORB_HTTP_AUTH_INVALID\",\n \"category\": \"effect\",\n \"description\": \"An HTTP auth, grant-cache, presign, or webpush configuration violates its contract.\"\n },\n {\n \"code\": \"ORB_HTTP_TOKEN_ROTATE_INVALID\",\n \"category\": \"effect\",\n \"description\": \"A token-exchange `rotate` is not a `{ field, credential }` rotation of the body's `refresh_token` slot.\"\n },\n {\n \"code\": \"ORB_HTTP_HEADER_INVALID\",\n \"category\": \"effect\",\n \"description\": \"An HTTP request/auth header name is not a token, or its value is not a single-line string.\"\n },\n {\n \"code\": \"ORB_HTTP_REQUEST_OPTION_INVALID\",\n \"category\": \"effect\",\n \"description\": \"An HTTP request's `timeoutMs`, `delayMs` or `retry` is not a value of its declared kind.\"\n },\n {\n \"code\": \"ORB_HTTP_AUTH_ON_CLIENT\",\n \"category\": \"effect\",\n \"description\": \"an `http` with `auth` sits where its trait runs on the client (a `[client]` trait, a browser-run tick)\"\n },\n {\n \"code\": \"ORB_HTTP_BODY_CONFLICT\",\n \"category\": \"effect\",\n \"description\": \"an `http` request has more than one body kind, or a body on GET\"\n },\n {\n \"code\": \"ORB_HOST_EFFECT_ARITY\",\n \"category\": \"effect\",\n \"description\": \"`random-bytes`, `credential-status` or `credential-forget` with the wrong number of arguments\"\n },\n {\n \"code\": \"ORB_HOST_EFFECT_OPTION_UNKNOWN\",\n \"category\": \"effect\",\n \"description\": \"a key other than `emit`, or a non-object, as the options of a host effect\"\n },\n {\n \"code\": \"ORB_RANDOM_BYTES_COUNT\",\n \"category\": \"effect\",\n \"description\": \"a literal `random-bytes` count that is not an integer from 1 to 1024\"\n },\n {\n \"code\": \"ORB_CREDENTIAL_REQUEST_INVALID\",\n \"category\": \"effect\",\n \"description\": \"a literal request of a `credential-*` administration effect that is not an object of its declared parameters, or leaves one out\"\n },\n {\n \"code\": \"ORB_REDIS_CALL_INVALID\",\n \"category\": \"effect\",\n \"description\": \"a `redis` call whose origin is not `redis://` or `rediss://`, whose command is not a non-empty list of text, or whose connection options are malformed\"\n },\n {\n \"code\": \"ORB_POSTGRES_CALL_INVALID\",\n \"category\": \"effect\",\n \"description\": \"a `postgres` call whose origin is not `postgres://` or `postgresql://`, whose literal statement is not a single read-only SELECT, whose params are not a list, or whose connection options are malformed or lack a user\"\n },\n {\n \"code\": \"ORB_OAUTH_CLIENT_INVALID\",\n \"category\": \"effect\",\n \"description\": \"an OAuth client object with an unknown or missing key, both or neither of `issuer`/`endpoints`, or a bad word\"\n },\n {\n \"code\": \"ORB_OAUTH_OP_UNKNOWN\",\n \"category\": \"effect\",\n \"description\": \"an `oauth-client` `op` outside the closed set, or an input the op does not take or requires\"\n },\n {\n \"code\": \"ORB_OAUTH_ENDPOINT_MISMATCH\",\n \"category\": \"effect\",\n \"description\": \"`oauth-endpoint` without an `oauth-client` auth, or a target word or method that does not serve the op\"\n },\n {\n \"code\": \"ORB_OAUTH_REQUEST_CONFLICT\",\n \"category\": \"effect\",\n \"description\": \"an `oauth-client` request that carries anything but `auth`\"\n },\n {\n \"code\": \"ORB_OAUTH_PROVIDER_UNKNOWN\",\n \"category\": \"effect\",\n \"description\": \"a provider word outside `google | github | auth0`\"\n },\n {\n \"code\": \"ORB_OAUTH_OPTION_UNKNOWN\",\n \"category\": \"effect\",\n \"description\": \"an unknown key, or a missing `redirectUri`, in `oauth-authorize` options\"\n },\n {\n \"code\": \"ORB_HTTP_PAGINATE_MAX_MISSING\",\n \"category\": \"effect\",\n \"description\": \"`http` `paginate` without `max`\"\n },\n {\n \"code\": \"ORB_HTTP_STREAM_WITHOUT_ON_MESSAGE\",\n \"category\": \"effect\",\n \"description\": \"`http` `stream` without `emit.onMessage`\"\n },\n {\n \"code\": \"ORB_PAGE_FACTS_FIELD_INVALID\",\n \"category\": \"effect\",\n \"description\": \"`browser/page-facts` fields: an unknown word, an empty list or a duplicate\"\n },\n {\n \"code\": \"ORB_PAGE_FACTS_UNREQUESTED_READ\",\n \"category\": \"effect\",\n \"description\": \"an event reads a page fact the `browser/page-facts` call did not request\"\n },\n {\n \"code\": \"ORB_BEACON_OPTION_UNKNOWN\",\n \"category\": \"effect\",\n \"description\": \"a `browser/beacon` request or option key outside its closed set\"\n },\n {\n \"code\": \"ORB_BEACON_TEXT_REQUIRED\",\n \"category\": \"effect\",\n \"description\": \"a `browser/beacon` request without `text`\"\n },\n {\n \"code\": \"ORB_BEACON_URL_NOT_ABSOLUTE\",\n \"category\": \"effect\",\n \"description\": \"a literal `browser/beacon` URL that is not an absolute http(s) URL\"\n },\n {\n \"code\": \"ORB_ON_DEVICE_EFFECT_ON_SERVER\",\n \"category\": \"effect\",\n \"description\": \"a `browser/prompt` or `browser/embed` where the server runs the transition: a `[background]` tick\"\n },\n {\n \"code\": \"ORB_ON_DEVICE_SCHEMA_INVALID\",\n \"category\": \"effect\",\n \"description\": \"a literal `browser/prompt` response schema that is not a JSON object\"\n },\n {\n \"code\": \"ORB_TAB_REQUEST_INVALID\",\n \"category\": \"effect\",\n \"description\": \"a `browser/tab-*` request that is not an object of the op's closed keys, or whose literal values the kernel refuses\"\n },\n {\n \"code\": \"ORB_TAB_EFFECT_ON_SERVER\",\n \"category\": \"effect\",\n \"description\": \"a `browser/tab-*` effect where the server runs the transition: a `[background]` tick\"\n },\n {\n \"code\": \"ORB_EFF_SET_INVALID_BINDING\",\n \"category\": \"effect\",\n \"description\": \"set effect using invalid binding\"\n },\n {\n \"code\": \"ORB_EFF_SET_PAYLOAD_NOT_ALLOWED\",\n \"category\": \"effect\",\n \"description\": \"set effect using @payload (should use @entity)\"\n },\n {\n \"code\": \"ORB_EFF_FETCH_INVALID_ENTITY\",\n \"category\": \"effect\",\n \"description\": \"fetch effect referencing invalid entity\"\n },\n {\n \"code\": \"ORB_EFF_FETCH_INVALID_INCLUDE\",\n \"category\": \"effect\",\n \"description\": \"fetch effect include references non-existent or non-relation field\"\n },\n {\n \"code\": \"ORB_PERSIST_BATCH_OPS_NOT_ARRAY\",\n \"category\": \"effect\",\n \"description\": \"`persist batch` ops expression is not array-typed\"\n },\n {\n \"code\": \"ORB_PERSIST_BATCH_BAD_OP\",\n \"category\": \"effect\",\n \"description\": \"`persist batch` op tuple with an unknown action or the wrong arity\"\n },\n {\n \"code\": \"ORB_PERSIST_BATCH_MIXED_PLACEMENT\",\n \"category\": \"effect\",\n \"description\": \"`persist batch` ops name both browser-stored and server-stored entities\"\n },\n {\n \"code\": \"ORB_EFF_SLOT_CONFLICT\",\n \"category\": \"effect\",\n \"description\": \"Multiple render_ui effects targeting same slot\"\n },\n {\n \"code\": \"ORB_EFF_UNKNOWN_TYPE\",\n \"category\": \"effect\",\n \"description\": \"Unknown effect type\"\n },\n {\n \"code\": \"ORB_EFF_NOTIFY_RETIRED\",\n \"category\": \"effect\",\n \"description\": \"`notify` is sugar for `render-ui toast { type: alert, … }`, desugared at `.lolo` lowering (owner ruling 2026-09-11) — the `.orb` IR never carries a `notify` effect kind. A `notify` tuple reaching L2 means a hand-authored `.orb` or a registry not yet re-emitted.\"\n },\n {\n \"code\": \"ORB_EFF_NAVIGATE_MISSING_PAYLOAD\",\n \"category\": \"effect\",\n \"description\": \"Navigate effect missing required payload for target page\"\n },\n {\n \"code\": \"ORB_EFF_NAVIGATE_TARGET_UNREACHABLE\",\n \"category\": \"effect\",\n \"description\": \"Navigate effect references a path that doesn't resolve to any declared `pages[].path` across the resolved schema. Post-inline backstop for L1.2 — catches navigate calls injected by molecule- level `effects: { ... }` overrides AND navigate calls that targeted imported pages from `uses` refs that L1 couldn't see.\"\n },\n {\n \"code\": \"ORB_EMIT_DECLARED_BUT_UNFIRED\",\n \"category\": \"effect\",\n \"description\": \"Trait declares an event in its `emits[]` block but no transition fires it via `(emit X)` or operator emit-config success/failure. Usually a copy-paste leftover or a stale declaration after a rename; gap #2 defense in `docs/Almadar_Std_Verification.md`.\"\n },\n {\n \"code\": \"ORB_EMIT_CONTROL_UNHANDLED\",\n \"category\": \"effect\",\n \"description\": \"`orb validate --final`: a rendered control fires an event no trait handles — not the rendering trait, an embedder of it, nor a `listens` route (G-ORB-187).\"\n },\n {\n \"code\": \"ORB_EMIT_CONFIG_REF_INVALID\",\n \"category\": \"effect\",\n \"description\": \"`emits { @config.<knob> -> ... }` references a knob that isn't a DECLARED string-typed config field with a default (Option B contract). Left unresolved by the inline phase; surfaces here with the specific clause that failed.\"\n },\n {\n \"code\": \"ORB_EFF_MISSING_FETCH_FOR_ENTITY\",\n \"category\": \"effect\",\n \"description\": \"render-ui has entity prop but no fetch effect for that entity in the same transition\"\n },\n {\n \"code\": \"ORB_EFF_EMIT_KEY_INVALID\",\n \"category\": \"effect\",\n \"description\": \"`emit:` config carries a key the operator doesn't support (e.g. `on_message` on `fetch`, `failure` on `set`).\"\n },\n {\n \"code\": \"ORB_EFF_EMIT_INVALID_NAME\",\n \"category\": \"effect\",\n \"description\": \"Event name inside `emit:` isn't UPPER_SNAKE_CASE.\"\n },\n {\n \"code\": \"ORB_EFF_EMIT_UNDECLARED_EVENT\",\n \"category\": \"effect\",\n \"description\": \"Event in `emit:` isn't declared in the trait's `emits` array.\"\n },\n {\n \"code\": \"ORB_EFF_PROGRAM_EVAL_FAILURE_MISSING\",\n \"category\": \"effect\",\n \"description\": \"`program/eval` carries no `emit.failure` event: the validator's errors come back through the failure arm, so without one they are dropped.\"\n },\n {\n \"code\": \"ORB_EFF_MISSING_REQUIRED_EMIT\",\n \"category\": \"effect\",\n \"description\": \"Operator declares `requiresEmitSuccess: true` in canonical-operators.json but the effect call site is missing the trailing options object or its `emit.success` event key. Applies to fetch / persist / call-service / ref by default; any future operator can opt in via the same JSON flag.\"\n },\n {\n \"code\": \"ORB_EFF_FETCH_BY_ID_PAYLOAD_LIST\",\n \"category\": \"effect\",\n \"description\": \"A success event only `(fetch X { id: … })` produces declares `data` as a list; a by-id fetch delivers one row (G-ORB-185).\"\n },\n {\n \"code\": \"ORB_EFF_FETCH_INVALID_OPTION\",\n \"category\": \"effect\",\n \"description\": \"A `fetch` option outside its closed enum (`deliver: rows | ids`, `total: exact | none`).\"\n },\n {\n \"code\": \"ORB_FETCH_DELIVER_IDS_ROWS_READ\",\n \"category\": \"effect\",\n \"description\": \"`deliver: ids` makes the success event's `data` a row-set reference; any use other than passing it whole as a `render-ui` prop value reads rows that were never delivered.\"\n },\n {\n \"code\": \"ORB_FETCH_DELIVER_IDS_ENTITY_REFS\",\n \"category\": \"effect\",\n \"description\": \"`deliver: ids` with `include`: included relations are row content.\"\n },\n {\n \"code\": \"ORB_FETCH_DELIVER_IDS_NO_SUCCESS\",\n \"category\": \"effect\",\n \"description\": \"`deliver: ids` with no `emit.success`: the reference is only ever passed whole to a `render-ui` prop, and nothing can reference a result that no event carries.\"\n },\n {\n \"code\": \"ORB_FETCH_TOTAL_NONE_READ\",\n \"category\": \"effect\",\n \"description\": \"`total: none` skips the count, so the success event's `totalCount` is never set.\"\n },\n {\n \"code\": \"SEXPR_INVALID_OPERATOR\",\n \"category\": \"sexpr\",\n \"description\": \"Unknown operator in S-expression\"\n },\n {\n \"code\": \"SEXPR_ARITY_MISMATCH\",\n \"category\": \"sexpr\",\n \"description\": \"Wrong number of arguments for operator\"\n },\n {\n \"code\": \"SEXPR_LAMBDA_ARG_POSITION\",\n \"category\": \"sexpr\",\n \"description\": \"A `(fn …)` form in an argument position the operator does not take its lambda in — decidable wrong argument order, e.g. `(array/reduce arr (fn …) init)`\"\n },\n {\n \"code\": \"SEXPR_EFFECT_IN_GUARD\",\n \"category\": \"sexpr\",\n \"description\": \"Effect operator used in guard context\"\n },\n {\n \"code\": \"SEXPR_INVALID_BINDING\",\n \"category\": \"sexpr\",\n \"description\": \"Invalid binding reference\"\n },\n {\n \"code\": \"SEXPR_INVALID_BINDING_PATH\",\n \"category\": \"sexpr\",\n \"description\": \"Invalid binding path syntax\"\n },\n {\n \"code\": \"SEXPR_UNKNOWN_ENTITY\",\n \"category\": \"sexpr\",\n \"description\": \"Unknown entity in binding\"\n },\n {\n \"code\": \"SEXPR_PARSE_ERROR\",\n \"category\": \"sexpr\",\n \"description\": \"Parse error in S-expression\"\n },\n {\n \"code\": \"ORB_X_DUPLICATE_ENTITY\",\n \"category\": \"cross\",\n \"description\": \"Duplicate entity name across orbitals\"\n },\n {\n \"code\": \"ORB_X_MIXED_RESIDENCE\",\n \"category\": \"cross\",\n \"description\": \"One transition's data effects touch both browser-stored and server-stored entities (ORB_X_MIXED_RESIDENCE)\"\n },\n {\n \"code\": \"ORB_X_ORPHAN_LISTENER\",\n \"category\": \"cross\",\n \"description\": \"Event listener without matching emitter\"\n },\n {\n \"code\": \"ORB_X_UNUSED_EMISSION\",\n \"category\": \"cross\",\n \"description\": \"Event emitted but never listened to\"\n },\n {\n \"code\": \"ORB_EMIT_UNROUTED_TO_HANDLER\",\n \"category\": \"cross\",\n \"description\": \"A trait emits an event (an `(emit …)` effect or an operator emit-config result) that a SIBLING trait in the same orbital has an arm for, but no declared `listens` route delivers it from that emitter. Events reach another trait only through declared routes, so the intent terminates in nothing (std-pong's PADDLE_MOVE, 2026-09-24).\"\n },\n {\n \"code\": \"ORB_T_CLIENT_TICK_NOT_LOCAL\",\n \"category\": \"cross\",\n \"description\": \"A trait writing a client-held `[runtime]` frame from client ticks (or bound to a `[shared]` one another trait ticks) is not `[client]`: its dispatches post to a stateful host whose stale copy folds back.\"\n },\n {\n \"code\": \"ORB_X_CIRCULAR_DEPENDENCY\",\n \"category\": \"cross\",\n \"description\": \"Circular dependency in event wiring\"\n },\n {\n \"code\": \"ORB_X_MISSING_ORBITAL_NAME\",\n \"category\": \"cross\",\n \"description\": \"Orbital missing name\"\n },\n {\n \"code\": \"ORB_X_PAYLOAD_MISMATCH\",\n \"category\": \"cross\",\n \"description\": \"Payload mismatch between emitter and listener\"\n },\n {\n \"code\": \"ORB_X_LISTEN_SOURCE_UNRESOLVED\",\n \"category\": \"cross\",\n \"description\": \"`listens` references a source trait or event that doesn't exist in the resolved IR. Defense-in-depth backstop for the L1 (`orbital-lolo`) `LowerError::ListenSourceUnresolved` check; surfaces the same defect after `use`-imports inline so atoms/molecules pulled into an orbital can't accidentally introduce dangling listens.\"\n },\n {\n \"code\": \"ORB_X_LISTEN_SOURCE_NEVER_PRODUCES\",\n \"category\": \"cross\",\n \"description\": \"A `listens { S.E -> TRIGGER }` route whose source trait S DOES declare event E in its `emits[]` contract, but nothing in the schema currently produces E live — no effect emit, no rendered `action:`/ event prop, no structured `itemActions` entry, and no trait embedded (directly or transitively) inside S produces it either. The contract permits it; a config override (an itemActions/browseItemActions narrowed at this call site, say) removed the only producer, so the route is a live wire with nothing behind it — fires whatever the emit's declared `scope` is (`external` included: a cross-orbital broadcast still needs a live broadcaster). Ported from the JS wiring lint's `listener-affordance-removed-by-config`.\"\n },\n {\n \"code\": \"ORB_X_LISTEN_TRIGGER_UNMATCHED\",\n \"category\": \"cross\",\n \"description\": \"A `listens { Src.EVENT -> TRIGGER }` entry names an internal TRIGGER that no transition in the SAME trait reacts to. The bus would deliver the event but the state machine has no handler — the wire silently drops. Runs post-inline so the `events: { OLD: NEW }`-rename variant (where the rewrite renamed the transition event but the listen trigger drifted) is caught too. Defense-in-depth for the L1 (`orbital-lolo`) author-time check on hand-authored `.lolo`.\"\n },\n {\n \"code\": \"ORB_X_INTERNAL_EVENT_EXPOSED\",\n \"category\": \"cross\",\n \"description\": \"Composing trait's override map touches an event declared `scope: 'internal'`. Error severity. See COMP-7 in docs/Almadar_Agent_Behaviors_Plan.md.\"\n },\n {\n \"code\": \"ORB_X_FILTER_FIELD_NEVER_WRITTEN\",\n \"category\": \"cross\",\n \"description\": \"A `fetch`'s `filter` compares a LITERAL `(object/get @entity <field>)` against a value, but no `persist create`/`update` anywhere in the schema (own trait, sibling trait, or a `persistent:`-collection-mate entity) ever supplies that field — the filter can never match a real row. Cross-orbital because the persistor routinely lives in a sibling orbital (the modal + persistor idiom). `[identity]`-roster entities and `@intrinsic` fields are exempt; a declared default only exempts the field when it folds, under the trait's resolved config, to the SAME literal the filter's comparand folds to — an undecidable (payload/entity/user-bound) comparand stays silent rather than guessing. Ported from `filter-field-never-written`. Error severity.\"\n },\n {\n \"code\": \"ORB_X_UNRESOLVED_RELATION_TARGET\",\n \"category\": \"cross\",\n \"description\": \"A `type: 'relation'` field's `relation.entity` does not resolve to any entity declared in the same schema. Error severity; the entity-scope validator also emits `ORB_E_INVALID_RELATION` for the same condition. See COMP-9 in docs/Almadar_Agent_Behaviors_Plan.md.\"\n },\n {\n \"code\": \"ORB_X_UNRESOLVED_PATTERN_FIELD_REF\",\n \"category\": \"cross\",\n \"description\": \"A pattern prop tagged `kind: 'field-ref'` (scalar) or `itemKind: 'field-ref'` (array element) carries a value that does not resolve to any field on the linked entity. Error severity. See Phase 3.2/3.3 in docs/Almadar_Agent_Behaviors_Plan.md.\"\n },\n {\n \"code\": \"ORB_LISTEN_ROUTE_STARVES_REQUIRED_FIELD\",\n \"category\": \"cross\",\n \"description\": \"A `listens { Src.EVENT -> TRIGGER }` route's TRIGGER declares a required leaf payload field the route never produces: no `with { }` mapping supplies it, and (pass-through, no mapping) the source trait's declared `emits { EVENT { ... } }` contract never declares it at the same dotted path either. The consumer's transition reads `?payload.<field>` as `undefined` at runtime.\"\n },\n {\n \"code\": \"ORB_LISTEN_REDUNDANT_EMBED_ROUTE\",\n \"category\": \"cross\",\n \"description\": \"A host trait's `listens { Child.EV -> EV }` route where `Child` is a trait the host embeds (directly or transitively), `EV` is fired by a control inside `Child`'s subtree, and the host already has a transition on `EV`. The control's emit bubbles to every scope on the embed chain, so the host already hears it directly; the route is a second delivery of the same physical event.\"\n },\n {\n \"code\": \"ORB_LISTEN_WILDCARD_UNKEYED\",\n \"category\": \"cross\",\n \"description\": \"A `*.EVENT` route on an event whose payload carries a `CallKey`-typed `key`, with a guard that never reads it.\"\n },\n {\n \"code\": \"ORB_BINDING_INVALID_FORMAT\",\n \"category\": \"binding\",\n \"description\": \"Binding has invalid format\"\n },\n {\n \"code\": \"ORB_BINDING_UNKNOWN_ROOT\",\n \"category\": \"binding\",\n \"description\": \"Unknown binding root\"\n },\n {\n \"code\": \"ORB_CONFIG_DANGLING_REF\",\n \"category\": \"binding\",\n \"description\": \"`@config.<key>` literal whose key no reachable config schema declares\"\n },\n {\n \"code\": \"ORB_CONFIG_FIELD_REF_UNKNOWN\",\n \"category\": \"binding\",\n \"description\": \"A `field @entity` config knob names something that is not a field of the trait's bound entity\"\n },\n {\n \"code\": \"ORB_CONFIG_FIELD_REF_TYPE_MISMATCH\",\n \"category\": \"binding\",\n \"description\": \"A `field @entity T` config knob names a field whose type is not `T`\"\n },\n {\n \"code\": \"ORB_BINDING_INVALID_PATH\",\n \"category\": \"binding\",\n \"description\": \"Invalid binding path\"\n },\n {\n \"code\": \"ORB_BINDING_STATE_NO_PATH\",\n \"category\": \"binding\",\n \"description\": \"@state binding should not have path\"\n },\n {\n \"code\": \"ORB_BINDING_NOW_NO_PATH\",\n \"category\": \"binding\",\n \"description\": \"@now binding should not have path\"\n },\n {\n \"code\": \"ORB_BINDING_PAYLOAD_IN_TICK\",\n \"category\": \"binding\",\n \"description\": \"@payload not available in tick context\"\n },\n {\n \"code\": \"ORB_BINDING_DISPATCH_ROOT_IN_TICK\",\n \"category\": \"binding\",\n \"description\": \"`@event`/`@prevEvents`/`@prevStates`/`@fromState`/`@toState` in a tick, which has no delivery\"\n },\n {\n \"code\": \"ORB_BINDING_FROM_ENTITY_OUTSIDE_ENSURES\",\n \"category\": \"binding\",\n \"description\": \"`@fromEntity` (the row before a transition) outside an `@ensures`\"\n },\n {\n \"code\": \"ORB_BINDING_ROOT_NO_PATH\",\n \"category\": \"binding\",\n \"description\": \"`@fromState`/`@toState`/`@prevStates`/`@prevEvents` written with a path\"\n },\n {\n \"code\": \"ORB_BINDING_EVENT_INVALID_PATH\",\n \"category\": \"binding\",\n \"description\": \"`@event.<path>` that does not follow the `{ event, payload, source }` record\"\n },\n {\n \"code\": \"ORB_BINDING_UNKNOWN_ENTITY\",\n \"category\": \"binding\",\n \"description\": \"Unknown entity in @EntityName binding\"\n },\n {\n \"code\": \"ORB_BINDING_INVALID_FIELD_NAME\",\n \"category\": \"binding\",\n \"description\": \"Invalid field name in binding path\"\n },\n {\n \"code\": \"ORB_BINDING_SET_TARGET_MISSING_PATH\",\n \"category\": \"binding\",\n \"description\": \"Set target missing field path\"\n },\n {\n \"code\": \"ORB_BINDING_PAYLOAD_FIELD_UNDECLARED\",\n \"category\": \"binding\",\n \"description\": \"@payload.field references a field not declared in event payload schema\"\n },\n {\n \"code\": \"ORB_BINDING_PAYLOAD_TYPE_INCOMPATIBLE\",\n \"category\": \"binding\",\n \"description\": \"@payload.field is declared but its type does not match the operator argument or comparison it appears in (e.g. string used where a number was expected). Warn-only in V2 Phase 0 rollout; escalates to error in the Phase 5 cleanup. Wired up in a follow-up pass over operator signatures; the class is declared here so the code path can reference it and emit warnings incrementally.\"\n },\n {\n \"code\": \"ORB_X_SET_VALUE_TYPE_MISMATCH\",\n \"category\": \"effect\",\n \"description\": \"`(set @entity.X ?payloadField)` writes a payload field whose declared type does not match the target entity field's declared type. The lolo crate catches this at author time for `.lolo`; this is the raw-`.orb` defense-in-depth backstop. Payload field types are sourced from the trait's `emits[].payload_schema` and `listens` payload metadata.\"\n },\n {\n \"code\": \"ORB_X_ENUM_VALUE_NOT_MEMBER\",\n \"category\": \"effect\",\n \"description\": \"`(set @entity.X literal)` assigns a string literal that is not a member of the target field's declared enum (`values: [...]`). The declared union was previously validated + emitted but never enforced — an out-of-set value passed silently. The lolo crate catches this at author time for `.lolo`; this is the raw-`.orb` defense-in-depth backstop.\"\n },\n {\n \"code\": \"ORB_X_SET_RETURN_TYPE_MISMATCH\",\n \"category\": \"effect\",\n \"description\": \"`(set @entity.X (op …))` assigns an operator/expression value whose inferred result type is incompatible with the target field's declared type (e.g. `(set @entity.count (str/concat …))` into a `number` field). The value's type is inferred *through* the S-expression via the canonical operator `return_semantics` lattice; an unknowable result (`Json`) never rejects (Gap G-LOLO-SET-OP-RETURN).\"\n },\n {\n \"code\": \"ORB_X_COMPARISON_OPERAND_TYPE_MISMATCH\",\n \"category\": \"effect\",\n \"description\": \"An ordering comparison (`<`, `<=`, `>`, `>=`) whose operands infer to a number on one side and a string on the other. The JS runtime coerces, the compiled TypeScript does not typecheck, and Rust compares kinds — the paths disagree. Convert one side so both are the same kind.\"\n },\n {\n \"code\": \"ORB_X_OPERATOR_ARG_TYPE_MISMATCH\",\n \"category\": \"effect\",\n \"description\": \"An operator argument whose static type contradicts the type the operator table declares for its position — `(str/upper @entity.count)` with `count: number`, `(+ \\\"a\\\" 1)`. Both evaluators raise the same typed mismatch at run time (D-12), so the program can never do what it says.\"\n },\n {\n \"code\": \"ORB_X_OPERATOR_ARG_UNDETERMINED\",\n \"category\": \"effect\",\n \"description\": \"A value handed to an operator's type variable has no determined type — an unresolved expression, an expression value, json, a list whose items share no type — so what the variable stands for, and the type of the call's result, is unknown. There are no generic types: give the value a real type (a declared payload or entity shape, a named union alias for a list of differently-shaped items).\"\n },\n {\n \"code\": \"ORB_X_ORDERING_OPTIONAL_OPERAND\",\n \"category\": \"effect\",\n \"description\": \"An ordering comparison (`<`, `<=`, `>`, `>=`) over an operand that can be missing or null — an optional entity field with no default, an optional payload field — that the program neither guards with a presence check (`(and (validate/required x) (< x 3))`, an `if`/`when` on presence) nor declares a default for. Both evaluators read a missing value as below any number; every push-down store fails the comparison, so the meaning is the program's to state.\"\n },\n {\n \"code\": \"ORB_X_OPERATOR_NULL_OPERAND\",\n \"category\": \"effect\",\n \"description\": \"An operand that can be missing or null — an optional entity field with no default, an optional payload field — handed to a position the kernel raises on when it is null (`rejectsNull` in the operator table), with no presence check or default in front of it. The program says what a missing value means: a guard, a default, or a required field.\"\n },\n {\n \"code\": \"ORB_X_SET_REQUIRED_FIELD_FROM_OPTIONAL_KNOB\",\n \"category\": \"effect\",\n \"description\": \"`(set @entity.X @config.<knob>)` where the value is STILL the literal `@config.<knob>` token post-inline (no default resolved it, no call-site override supplied one) and `X` is a REQUIRED entity field. The emitter has nothing honest to assign — a required TS slot gets `undefined`. Give the knob a default or make the field optional.\"\n },\n {\n \"code\": \"ORB_EMIT_PAYLOAD_MISSING_REQUIRED\",\n \"category\": \"binding\",\n \"description\": \"`(emit EVT {...})` literal payload is missing a field the event's declared payload marks as required. Error severity.\"\n },\n {\n \"code\": \"ORB_EMIT_PAYLOAD_EXTRA_FIELD\",\n \"category\": \"binding\",\n \"description\": \"`(emit EVT {...})` literal carries a field that is not declared on the event's payload schema. Error severity.\"\n },\n {\n \"code\": \"ORB_EMIT_PAYLOAD_FIELD_TYPE_MISMATCH\",\n \"category\": \"binding\",\n \"description\": \"`(emit EVT {...})` literal provides a value whose primitive type does not match the declared `PayloadField.field_type`. Error severity.\"\n },\n {\n \"code\": \"ORB_USER_INTO_REQUIRED_SLOT\",\n \"category\": \"binding\",\n \"description\": \"The whole `@user` record fills a required slot (an emit payload `X!`, a required entity field) with no guard on its presence: a dispatch with no viewer (an os/ completion, a tick) has a null `@user`. Error severity.\"\n },\n {\n \"code\": \"ORB_EMIT_REPEATS_IDENTICALLY\",\n \"category\": \"binding\",\n \"description\": \"An `emit` repeats an earlier one of the same transition identically: the dispatch loop collapses the second.\"\n },\n {\n \"code\": \"ORB_X_PAYLOAD_FIELD_NAME\",\n \"category\": \"binding\",\n \"description\": \"An event/emit `payloadSchema` field name is not a valid TypeScript identifier (contains a dot, space, or leading digit). Codegen turns each field into a struct member, so `row.category` would emit broken TS. Validate-layer defense-in-depth for the lowering pass that flattens nested payload field names. Error severity.\"\n },\n {\n \"code\": \"ORB_X_UNTYPED_ARRAY\",\n \"category\": \"entity\",\n \"description\": \"An array field (entity or payload-schema) declares no element type.\"\n },\n {\n \"code\": \"ORB_X_ENTITY_PROP_CONTRACT\",\n \"category\": \"render_ui\",\n \"description\": \"A render-ui pattern prop typed `EntityWith<K>` declares required entity fields (`requiredFields` in the registry), but the bound entity does not provide them and no remap/field-map supplies them. The component would render blank rows. Remap-aware (runs post-inline). Error severity.\"\n },\n {\n \"code\": \"ORB_EMIT_SUCCESS_PAYLOAD_RETURN_MISMATCH\",\n \"category\": \"binding\",\n \"description\": \"**RETIRED (2026-08-30) — superseded by `EmitPayloadNotProduced`, which checks the full shape rather than only the empty-payload case.** No longer raised anywhere; the variant is kept so external tooling matching on the wire string `ORB_EMIT_SUCCESS_PAYLOAD_RETURN_MISMATCH` does not break on an unknown code. `emit: { success: \\\"X\\\" }` config on a data operator declares success event X but X's declared payload does not match the operator's `effect.produces` at this call site. Warn-only.\"\n },\n {\n \"code\": \"ORB_EMIT_PAYLOAD_NOT_PRODUCED\",\n \"category\": \"binding\",\n \"description\": \"**The payload invariant.** An event's declared payload type IS its access path: declaring `Survey` means the payload is the row (read `?name`); declaring `{ row : Survey }` means read `?row.name`. This fires when an event declares a field that the effect firing it does not actually emit — so every read of that field is `undefined` at runtime, even though `orb validate` and `orb verify` otherwise pass. Checked as width subtyping (`declared ⊆ produced`): declaring FEWER fields than are emitted is legal, declaring one that is never emitted is not. Replaces the narrower `EmitSuccessPayloadWrapped` (persist-only) and `EmitSuccessPayloadReturnMismatch` (empty-payload-only) checks. Error severity.\"\n },\n {\n \"code\": \"ORB_EMIT_SUCCESS_PAYLOAD_WRAPPED\",\n \"category\": \"binding\",\n \"description\": \"**RETIRED (2026-08-30) — superseded by `EmitPayloadNotProduced`.** This check only recognised a wrapper on `persist create`/`update` whose type named that exact entity; the general rule catches the same defect at any operator and in shapes this one was blind to (a wrapper naming a different entity, a field the operator never emits at all). Kept so external tooling matching `ORB_EMIT_SUCCESS_PAYLOAD_WRAPPED` still resolves. A `persist create`/`persist update` call's `emit: { success: \\\"X\\\" }` names an event X whose declared payload wraps the persisted entity under a single field (`type X = Event { row: EntityName }`), but `persist create`/`update` emits the persisted row directly (flat, unwrapped) on success in both @almadar/runtime and orbital-core — verified live 2026-08-30 (std-thread's `ThreadPostCreated`): a wrapped declaration validates and compiles clean but every `?row.<field>` read silently returns undefined at runtime. Warn-only.\"\n },\n {\n \"code\": \"ORB_X_CROSS_EMITTER_DECLARED_PAYLOAD_MISMATCH\",\n \"category\": \"cross\",\n \"description\": \"Phase F.2: two or more traits declare the same external event name in their `emits` arrays but disagree on the declared payload field list. Consumers that listen on the event will see one shape from one emitter and a different shape from another. Error severity.\"\n },\n {\n \"code\": \"ORB_X_DUPLICATE_TRAIT_ID\",\n \"category\": \"cross\",\n \"description\": \"Two traits of one program carry the same trait id; listens match sources by id, so each hears the other's emits.\"\n },\n {\n \"code\": \"ORB_BINDING_ENTITY_FIELD_NOT_FOUND\",\n \"category\": \"binding\",\n \"description\": \"@entity.field references a field not present on the linked entity\"\n },\n {\n \"code\": \"ORB_BINDING_ENTITY_FIELD_NEVER_SET\",\n \"category\": \"binding\",\n \"description\": \"@entity.field is referenced by render-ui / guard / effect but no transition in the same trait runs `(set @entity.field <value>)`. Per the explicit-binding rule, every `@entity.X` read must be backed by at least one explicit setter; otherwise the value is undefined and the component renders empty. Surfaces post-inline so atoms imported via `uses` get checked too. Defense-in-depth backstop for the L1 `LowerError::EntityFieldNeverSet` check.\"\n },\n {\n \"code\": \"ORB_BINDING_PERSIST_ROW_ID_NEVER_SET\",\n \"category\": \"binding\",\n \"description\": \"`(persist update|delete <Entity> @entity)` passes the WHOLE row, so the row key never appears as an `@entity.id` read and `BindingEntityFieldNeverSet` cannot see it. An unbound `id` resolves empty and the runtime refuses the write outright.\"\n },\n {\n \"code\": \"ORB_BINDING_EMBED_READS_ARM_WRITE\",\n \"category\": \"binding\",\n \"description\": \"A transition writes `@entity.F` (or its whole row) and renders an embedded trait (`@trait.X`, incl. a hoisted inline `<A.traits.T/>`) whose call-site value reads that field of the same PERSISTENT entity. The embed resolves `@entity` against its own frame at its own render (its mount), so it shows the value from before this transition. Read the value the transition used instead (a call-site capture, `?row.F`), or route the host event to the embed's INIT.\"\n },\n {\n \"code\": \"ORB_PERSIST_CREATE_MISSING_POLICY_FIELD\",\n \"category\": \"binding\",\n \"description\": \"`persist create E { ... }` with an explicit data literal whose key set lacks a field that `E.@create` compares (e.g. `@create sender == @user.id` and the literal has no `sender`). The access policy will never be satisfied by a row this transition itself creates — every future `@update`/`@delete`/`@read` gated on that field locks the creator out of their own row. A bare `persist create @entity` (whole frame) is not a hit. Wave 2. Error severity.\"\n },\n {\n \"code\": \"ORB_PERSIST_CREATE_LITERAL_ID\",\n \"category\": \"binding\",\n \"description\": \"`persist create E { id: \\\"literal\\\", … }`: the row names a string-literal id, so the second run creates a row that already exists and fails with `duplicate-id`. A seed or singleton re-save is an authored `persist upsert` (create-or-replace by id). Error severity.\"\n },\n {\n \"code\": \"ORB_PERSIST_ID_NOT_A_PATH\",\n \"category\": \"binding\",\n \"description\": \"`persist delete E <expression>` / `persist update E <expression> data`: the single forms take the row id as a binding path or a literal, so an expression resolves no row key at run time. Error severity.\"\n },\n {\n \"code\": \"ORB_PERSIST_WHERE_NOT_A_PREDICATE\",\n \"category\": \"binding\",\n \"description\": \"`persist … { where: … }`: the guard is a one-param `fn` over the stored row that never reads the frame (`@entity`), on a single `delete` or `update` only (EXEC-STEP-8). Error severity.\"\n },\n {\n \"code\": \"ORB_EFFECT_IN_LAMBDA\",\n \"category\": \"binding\",\n \"description\": \"An effect (`emit`, `persist`, `set`, `notify`, …) inside the `fn` body of a collection operator: a lambda is evaluated for its value, an effect there never runs. Error severity.\"\n },\n {\n \"code\": \"ORB_BINDING_TRAIT_MISSING_NAME\",\n \"category\": \"binding\",\n \"description\": \"`@trait` binding with no trait name — bare `@trait` is not resolvable.\"\n },\n {\n \"code\": \"ORB_BINDING_TRAIT_INVALID_FORMAT\",\n \"category\": \"binding\",\n \"description\": \"`@trait.X` trait name doesn't match the `PascalCase` identifier pattern.\"\n },\n {\n \"code\": \"ORB_BINDING_TRAIT_UNKNOWN\",\n \"category\": \"binding\",\n \"description\": \"`@trait.X` references a trait not declared in the current orbital.\"\n },\n {\n \"code\": \"ORB_BINDING_TRAIT_SELF_REFERENCE\",\n \"category\": \"binding\",\n \"description\": \"A trait's render-ui references itself via `@trait.<self>`.\"\n },\n {\n \"code\": \"ORB_BINDING_TRAIT_CYCLE\",\n \"category\": \"binding\",\n \"description\": \"Cycle detected in the `@trait.X` reference graph (e.g. A → B → A).\"\n },\n {\n \"code\": \"ORB_BINDING_TRAIT_INVALID_POSITION\",\n \"category\": \"binding\",\n \"description\": \"`@trait.X` appears outside a `children:` array or a `node`-typed pattern prop — valid positions are where a subtree can be substituted.\"\n },\n {\n \"code\": \"ORB_BINDING_TRAIT_OUTSIDE_RENDER_UI\",\n \"category\": \"binding\",\n \"description\": \"`@trait.X` (a render-only, client-side binding) appears outside a `render-ui` effect entirely — in a guard, a non-render effect (`fetch`/`set`/`persist`/`ref`/`call-service`), or a tick. Trait references are render-time composition primitives and have no meaning in data/effects/control flow.\"\n },\n {\n \"code\": \"ORB_RENDER_UNBOUND_TRAIT_KNOB_EMBEDDED\",\n \"category\": \"render_ui\",\n \"description\": \"A render-ui payload embeds `@config.<knob>` (as a child or inside a `children` entry) where `<knob>` is a `trait`-typed config field whose resolved value is `none` (unbound), and the render-ui is not guarded by an `(if @config.<knob> ...)` wrapping it in the same effect list. An unbound trait knob's embed renders nothing — the closed-circuit rule that no wire may terminate in nothing (owner ruling 2026-09-13: a `trait`-typed config knob may be `none`).\"\n },\n {\n \"code\": \"ORB_RENDER_ORBITAL_VALUE_EMBEDDED\",\n \"category\": \"render_ui\",\n \"description\": \"A render-ui payload embeds an `orbital`-typed field: an orbital value is data (an import body) and never renders — only trait values embed.\"\n },\n {\n \"code\": \"ORB_EMBED_BRIDGE_LISTENS_UNSENT\",\n \"category\": \"render_ui\",\n \"description\": \"A bridged embed delivers an event nothing in the program sends.\"\n },\n {\n \"code\": \"ORB_EMBED_BRIDGE_EMITS_UNHEARD\",\n \"category\": \"render_ui\",\n \"description\": \"A bridged embed re-emits an event nothing in the program handles.\"\n },\n {\n \"code\": \"ORB_ENTITY_SPLIT_MUTATION\",\n \"category\": \"entity_mutation\",\n \"description\": \"A non-`[shared]`, `Runtime`-persistence entity is mutated (via `set` or a tick write) by ≥2 distinct traits. Each mutator gets an isolated per-trait copy, so if one of the mutators' render-ui also reads the entity, it only ever sees its own trait's writes — never the others'. Error severity: add `[shared]` to the entity, or isolate the mutators.\"\n },\n {\n \"code\": \"ORB_SHARED_ENTITY_FIELD_CONFLICT\",\n \"category\": \"entity_mutation\",\n \"description\": \"A `[shared]` entity has ≥2 distinct traits writing the SAME field. Coupled mechanics writing one field must be one ordered pipeline, not parallel writers — undefined last-write-wins ordering otherwise.\"\n },\n {\n \"code\": \"ORB_SHARED_ENTITY_RENDER_AUTHORITY\",\n \"category\": \"entity_mutation\",\n \"description\": \"A `[shared]` entity is render-ui-read by more than one distinct trait. Exactly one render authority is allowed per shared entity, mirroring `SlotContention`'s single-owner rule.\"\n },\n {\n \"code\": \"ORB_E_MERGED_FIELD_UNREFERENCED\",\n \"category\": \"entity_mutation\",\n \"description\": \"Post-inline: an entity field carrying `mergedFrom` (added by the rebind-merge auto-merge, `merge_imported_entity_fields`) that no trait of the consuming orbital reads, writes, fetch-includes, or persists — R-ENTITY-FIELD-UNION-ACROSS-SAME-NAMED-ENTITY. The merge already narrows to referenced fields at compose time; this catches drift when a later edit removes the trait/effect that used to justify the merge. Error severity.\"\n },\n {\n \"code\": \"ORB_TICK_REQUIRES_RUNTIME\",\n \"category\": \"entity_mutation\",\n \"description\": \"A trait runs a non-`Cron` tick (frame/duration interval) against a `Persistent` linked entity. Corpus-facing backstop mirroring the lolo L1 tick guards. Error severity.\"\n },\n {\n \"code\": \"ORB_TICK_ASYNC_EFFECT\",\n \"category\": \"entity_mutation\",\n \"description\": \"A non-`Cron` tick effect calls a server-async operator (the canonical registry's `std-agent` category — `agent/generate`, `agent/invoke`, etc.). Repeated per-tick LLM/agent calls can pile up faster than they resolve. Error severity.\"\n },\n {\n \"code\": \"ORB_ENTITY_INTRINSIC_FIELD_PERSISTED\",\n \"category\": \"entity_mutation\",\n \"description\": \"An explicit `persist create`/`persist update` data LITERAL (an `OirExpr::Object`, never a bare whole-frame `@entity`) names an `@intrinsic` field of the target entity. Intrinsic fields are trait-owned view-state/machinery (`OirEntity::frame_fields`'s ONLY allow-list) — never a persisted column — so writing one into the database is a category error the author almost certainly meant as a domain field. Wave 2. Error severity.\"\n },\n {\n \"code\": \"ORB_GUARD_ON_FRAME_FIELD_AUTHORIZES\",\n \"category\": \"entity_mutation\",\n \"description\": \"An `@intrinsic` field is used as an AUTHORIZATION input: it appears in an access policy (`@create`/`@read`/`@update`/`@delete`), or in a transition guard that also reads `@user.*`/role/identity AND the transition performs `persist`/`call-service`. Intrinsic fields are trait-computed view-state the runtime never seeds or persists — using one to gate a mutation means the gate is trivially bypassable (the caller controls the \\\"intrinsic\\\" value directly). A plain precondition guard with no identity comparison is not a hit. Wave 2. Error severity.\"\n },\n {\n \"code\": \"ORB_SET_COLUMN_WITHOUT_ROW\",\n \"category\": \"entity_mutation\",\n \"description\": \"`(set @entity.<f> ...)` writes a non-`@intrinsic` column of a `[persistent]` entity in a transition with no row binding (no `id`/`?row`-bearing event payload, no `entityId` in scope) AND the owning trait never runs `persist create`/`persist update` on that entity anywhere — so the write can never land: it is not framed to an identified row, and nothing ever persists it. A draft form that sets columns across several transitions before a final `persist create` is legitimate (the write eventually lands); this only fires when the trait has no landing transition at all. Wave 2. Error severity.\"\n },\n {\n \"code\": \"CIRCUIT_ORPHAN_EVENT\",\n \"category\": \"circuit\",\n \"description\": \"Action emits event with no transition handler\"\n },\n {\n \"code\": \"CIRCUIT_DUPLICATE_EVENT\",\n \"category\": \"circuit\",\n \"description\": \"Same event emitted multiple times in same context\"\n },\n {\n \"code\": \"CIRCUIT_DEAD_END_COMPONENT\",\n \"category\": \"circuit\",\n \"description\": \"Interactive component missing itemActions\"\n },\n {\n \"code\": \"CIRCUIT_UNREACHABLE_STATE\",\n \"category\": \"circuit\",\n \"description\": \"State has no incoming transitions\"\n },\n {\n \"code\": \"CIRCUIT_DEAD_END_STATE\",\n \"category\": \"circuit\",\n \"description\": \"State has no outgoing transitions\"\n },\n {\n \"code\": \"CIRCUIT_ACTION_COMPONENT_MISMATCH\",\n \"category\": \"circuit\",\n \"description\": \"Action-component mismatch\"\n },\n {\n \"code\": \"CIRCUIT_NO_OVERLAY_EXIT\",\n \"category\": \"circuit\",\n \"description\": \"Overlay slot (modal/drawer) missing exit transition\"\n },\n {\n \"code\": \"CIRCUIT_MODAL_EXIT_INCOMPLETE\",\n \"category\": \"circuit\",\n \"description\": \"Modal-to-inline transition missing render-ui(\\\"main\\\", ...) alongside render-ui(\\\"modal\\\", null)\"\n },\n {\n \"code\": \"CIRCUIT_DEAD_HANDLER\",\n \"category\": \"circuit\",\n \"description\": \"Render-ui handler fires event with no matching transition from the rendering state\"\n },\n {\n \"code\": \"ORB_RENDER_ACTION_LIFECYCLE_EVENT\",\n \"category\": \"circuit\",\n \"description\": \"A rendered affordance's event-bearing prop (`action`, `itemActions[].event`, `submitEvent`, `onChange`, …) targets a lifecycle event (`orbital_core::events::BUS_EXCLUDED_EVENTS`). The bus never re-delivers `INIT`/`LOAD`/`$MOUNT`, so the control is dead on click.\"\n },\n {\n \"code\": \"ORB_CIRCUIT_FAILURE_ARM_MISSING\",\n \"category\": \"circuit\",\n \"description\": \"A transition's effects (`fetch`/`persist`/`call-service`) declare an `emit.failure` event, but no arm at the destination state (`from === to || from === '*'`) handles it — the async result contract's failure half is a live wire terminating in nothing. Ported from the JS wiring lint's `failure-arm-missing` (client-bound traits only). Error severity.\"\n },\n {\n \"code\": \"ORB_CIRCUIT_FAILURE_ARM_RENDERS_NOTHING\",\n \"category\": \"circuit\",\n \"description\": \"The failure-handling arm found for [`CircuitFailureArmMissing`]'s contract exists but paints nothing (no `render-ui <slot> <non-null>` anywhere in its effects, including through `if`/`do`) — the failure is caught but never shown to the user. A trait declared `[integration]` is headless, so its arm also handles the failure by emitting an event some trait in the program listens to, or one it declares `-> external`; an emit nobody hears still reports. Ported from `failure-arm-renders- nothing`. Error severity.\"\n },\n {\n \"code\": \"ORB_CIRCUIT_MODAL_SHELL_CLOSE_DEAF\",\n \"category\": \"circuit\",\n \"description\": \"A transition renders a non-self-overlaying pattern into an overlay slot (`modal`/`drawer`/`overlay`), but the destination state has no `CLOSE`/`CANCEL` arm — the generic portal shell's own dismiss control (X / Escape / overlay-click) fires an event nothing handles. Ported from `modal-shell-close-deaf`. Error severity.\"\n },\n {\n \"code\": \"ORB_CIRCUIT_SELF_OVERLAY_IN_SHELL\",\n \"category\": \"circuit\",\n \"description\": \"A transition renders a SELF-overlaying pattern (`slideOver: true` anywhere in the payload tree) into an overlay slot — the generic portal shell wraps it too, producing two stacked overlay chromes. Ported from `self-overlay-inside-modal-shell`. Error severity.\"\n },\n {\n \"code\": \"ORB_CIRCUIT_LIFECYCLE_EMIT_UNDELIVERED\",\n \"category\": \"circuit\",\n \"description\": \"A transition's own effects list contains a top-level `(emit <event>)` naming a lifecycle event (`orbital_core::events::BUS_EXCLUDED_EVENTS`) — the bus never re-delivers it, so this half of the closed circuit is written but can never run. Sibling production site to [`RenderActionLifecycleEvent`](ErrorCode::RenderActionLifecycleEvent) (an explicit effect instead of a rendered affordance prop). Ported from the JS wiring lint's `dead-lifecycle-emit`. Error severity.\"\n },\n {\n \"code\": \"ORB_CIRCUIT_SELF_EMIT_LOOP\",\n \"category\": \"circuit\",\n \"description\": \"A transition arm re-emits its OWN trigger event (`X --X--> Y` whose effects contain `(emit X ...)`), the `to` state has another arm on X, and the re-emitted payload does not derive from `@payload` — the runtime path re-enters an arm on the same event with unchanged payload and loops forever (G-RUNTIME-020). Payloads derived from `@payload` (sentinel fan-out counters) make progress per hop and are not flagged; neither is a self-emit whose target state has no same-event arm (a dead-end broadcast). Error severity.\"\n },\n {\n \"code\": \"ORB_CIRCUIT_INIT_UNCOVERED_STATE\",\n \"category\": \"circuit\",\n \"description\": \"A page trait that initializes on `INIT` has a reachable state with no `INIT` arm: trait state survives unmount, so revisiting the page from that state does nothing (G-ORB-186).\"\n },\n {\n \"code\": \"ORB_CIRCUIT_DEAD_BODILESS_ACTION\",\n \"category\": \"circuit\",\n \"description\": \"A transition moves `from -> to` (not a self-transition) with NO effects at all, out of a `from` state some OTHER arm already painted into a main slot (`orbital_core::slots::MAIN_SLOTS`) — the machine leaves that state but the screen keeps its old paint standing, so every affordance routed here is dead. Client-bound gated (an unbound trait's arms never run in the shipped client at all). Ported from the JS wiring lint's `dead-bodiless-action`. Error severity.\"\n },\n {\n \"code\": \"ORB_CIRCUIT_ASYNC_RESULT_DEAF_TARGET\",\n \"category\": \"circuit\",\n \"description\": \"A state-CHANGING transition (`from != to`) whose `fetch`/`persist` effects declare async-result events (`collect_async_result_events`: EVERY value of the `emit` map, recursing through `if`/`do`) that the destination state's own arms (`from === to-state || from === \\\"*\\\"`) don't handle — the requester departs before it can hear its own operation's result, so the cascade lands on a machine deaf to it and wedges. NOT client-bound gated (the JS predicate has none here, unlike its `failure-arm-missing` sibling). Ported from the JS wiring lint's `async-result-deaf-target` (warning there; error here per the 0/0 ruling). Error severity.\"\n },\n {\n \"code\": \"ORB_CIRCUIT_VIEWER_STRANDED\",\n \"category\": \"circuit\",\n \"description\": \"The trait that OWNS a page's content region (`page_content_owner`'s `channel`/`sole-writer`) has a user-triggered arm that repaints its own main-slot body with something offering no way on: no content-body pattern, no registry event-kind prop bound to a live (non-lifecycle) event or an unresolved binding, and no `@trait.X` embed. \\\"User- triggered\\\" means the event is reachable from a rendered affordance or a `listens` route, transitively, minus async-result and lifecycle events. Exempt: an arm running its own `fetch`/`persist` (its result arm repaints); a non-self-transition escaping to a state with another producible, non-lifecycle arm. Ported from the JS wiring lint's `viewer-stranded`, predicate revised 2026-09-12 per the F31 live probe (`play_scene` on `ui-minigolf-board`/`std-chem-titration`): the JS's labelled-control test and `@`/`?` sigil branch were both heuristics and are dropped — a registry event-kind prop is the only test. Error severity.\"\n },\n {\n \"code\": \"ORB_UI_ICON_INVALID_FORMAT\",\n \"category\": \"icon\",\n \"description\": \"Icon name has invalid format\"\n },\n {\n \"code\": \"ORB_UI_ICON_EMPTY\",\n \"category\": \"icon\",\n \"description\": \"Icon name is empty\"\n },\n {\n \"code\": \"ORB_UI_ICON_NOT_FOUND\",\n \"category\": \"icon\",\n \"description\": \"Icon may not exist in Lucide\"\n },\n {\n \"code\": \"ORB_OP_INVALID_TIME_UNIT\",\n \"category\": \"operator\",\n \"description\": \"A `time/*` operator was given a unit literal outside the vocabulary. Unchecked, it throws at evaluation time — and inside a read predicate that means rows are dropped fail-closed while the run still reports PASS (`S-CALENDAR-RANGE-FILTER-USES-UNSUPPORTED-TIME-UNITS`).\"\n },\n {\n \"code\": \"ORB_QUERY_MISSING_SEARCH\",\n \"category\": \"query\",\n \"description\": \"Query singleton missing search field\"\n },\n {\n \"code\": \"ORB_QUERY_MISSING_RECOMMENDED\",\n \"category\": \"query\",\n \"description\": \"Query singleton missing recommended fields\"\n },\n {\n \"code\": \"ORB_QUERY_UNSUPPORTED_PATTERN\",\n \"category\": \"query\",\n \"description\": \"Pattern doesn't support query prop\"\n },\n {\n \"code\": \"ORB_QUERY_UNKNOWN_SINGLETON\",\n \"category\": \"query\",\n \"description\": \"Query references unknown singleton\"\n },\n {\n \"code\": \"ORB_QUERY_UNUSED_SINGLETON\",\n \"category\": \"query\",\n \"description\": \"Query singleton is unused\"\n },\n {\n \"code\": \"ORB_T_EVT_UNDECLARED\",\n \"category\": \"trait_event\",\n \"description\": \"Event emitted but not declared in trait.emits\"\n },\n {\n \"code\": \"ORB_T_EVT_INVALID_NAME\",\n \"category\": \"trait_event\",\n \"description\": \"Event name not UPPER_SNAKE_CASE\"\n },\n {\n \"code\": \"ORB_T_EVT_TICK_UNDECLARED\",\n \"category\": \"trait_event\",\n \"description\": \"Tick emits undeclared event\"\n },\n {\n \"code\": \"ORB_T_EVT_SCOPE_MISMATCH\",\n \"category\": \"trait_event\",\n \"description\": \"Listener scope mismatch\"\n },\n {\n \"code\": \"ORB_T_EVT_EXTERNAL_MISSING_PAYLOAD\",\n \"category\": \"trait_event\",\n \"description\": \"External emit missing payload definition\"\n },\n {\n \"code\": \"ORB_S_MISSING_NAME\",\n \"category\": \"schema\",\n \"description\": \"Schema missing name\"\n },\n {\n \"code\": \"ORB_S_NO_ORBITALS\",\n \"category\": \"schema\",\n \"description\": \"Schema has no orbitals\"\n },\n {\n \"code\": \"ORB_S_EMPTY_VERSION\",\n \"category\": \"schema\",\n \"description\": \"Schema version is empty\"\n },\n {\n \"code\": \"ORB_S_IDENTITY_NOT_UNIQUE\",\n \"category\": \"schema\",\n \"description\": \"More than one differently-named `[identity]` entity in one composed program. `@user` is a single root resolving to a single viewer, so two declarations make every `@user.x` ambiguous. (Same-name duplicates are already rejected upstream by `validate_entity_uniqueness`.)\"\n },\n {\n \"code\": \"ORB_S_ROLE_LITERAL_NOT_MEMBER\",\n \"category\": \"schema\",\n \"description\": \"A literal compared against an `@user.<field>` whose declared type is a closed vocabulary is not one of that vocabulary's members — a branch that can never be taken. The bug class that let std-healthcare's `\\\"patient\\\"` and std-lms's `\\\"student\\\"` ship green.\"\n },\n {\n \"code\": \"ORB_S_UNKNOWN_IDENTITY_FIELD\",\n \"category\": \"schema\",\n \"description\": \"`@user.<field>` names a field the declared `[identity]` entity does not have. Resolves to null at runtime, so the guard silently takes its negative branch.\"\n },\n {\n \"code\": \"ORB_S_ACCESS_POLICY_UNKNOWN_ENTITY_FIELD\",\n \"category\": \"schema\",\n \"description\": \"`@entity.<field>` (or `(object/get @entity field)`) inside an `@read`/`@create`/`@update`/`@delete` directive names a field the OWNING entity does not have.\"\n },\n {\n \"code\": \"ORB_S_OWNER_FIELD_NOT_IDENTITY_TYPED\",\n \"category\": \"schema\",\n \"description\": \"An access directive compares an `@entity.<field>` against `@user.id`, but `<field>` is not a relation to the `[identity]` entity. The comparison is then between a free-text scalar and a roster id — it type-checks, reads like ownership, and matches nothing, because the seeder only stamps viewer ids onto DECLARED relations. This is the `customerEmail` trap: a policy that silently denies everyone while looking correct.\"\n },\n {\n \"code\": \"ORB_ENTITY_OWNER_COLUMN_UNSCOPED\",\n \"category\": \"entity\",\n \"description\": \"An entity declares ≥1 owner column (a declared relation to the `[identity]` entity, via `owner_fields_from_schema` — never by field name) but no `read_policy` and no stated `access_waivers.read` reason. An undeclared policy is ALLOW-ALL, not deny-all, so every viewer reads every row. L3 port of JS `unscoped-owned-entity`.\"\n },\n {\n \"code\": \"ORB_STORE_UNKNOWN_ORBITAL\",\n \"category\": \"entity\",\n \"description\": \"`store: X` (entity or app header) names no orbital of the program (EXEC-STORE-4). Error severity.\"\n },\n {\n \"code\": \"ORB_STORE_DRIVER_CONTRACT\",\n \"category\": \"entity\",\n \"description\": \"A store driver orbital has no trait handling one of ROW_READ / ROW_LIST / ROWS_QUERY / ROWS_WRITE (`spec/store/row-store.lolo`). Error severity.\"\n },\n {\n \"code\": \"ORB_STORE_ON_NON_PERSISTENT\",\n \"category\": \"entity\",\n \"description\": \"`store:` on an entity whose rows live in no store (`[runtime]` or browser-stored). Error severity.\"\n },\n {\n \"code\": \"ORB_STORE_VERB_OUTSIDE_SEAM\",\n \"category\": \"entity\",\n \"description\": \"A trait outside a store driver orbital emits a row verb: the store seam alone asks a driver, one frame per ask (EXEC-STORE-4). Error severity.\"\n },\n {\n \"code\": \"ORB_STORE_DRIVER_NOT_CONDITIONAL\",\n \"category\": \"entity\",\n \"description\": \"A single `persist delete|update` on an entity whose driver declares `writeCapabilities.conditional` false: the take is one conditional op (EXEC-STEP-8). Error severity.\"\n },\n {\n \"code\": \"ORB_RENDER_GROUPBY_ENUM_COLUMN_GAP\",\n \"category\": \"render_ui\",\n \"description\": \"A trait's `config.groupByField` + `config.columns[].key` bucket rows of the linked entity by strict key equality, but the field's declared enum allows a value no column key names — those rows match no column and silently disappear. L3 port of JS `groupby-enum-column-gap`.\"\n },\n {\n \"code\": \"ORB_EMBED_CONFIG_FORWARD_MULTI_REFERRER\",\n \"category\": \"cross\",\n \"description\": \"A trait embedded via `@trait.X` by ≥2 referrers that itself declares an `@config.<key>` forward. One declaration serves one embedder (its forwards chain to the first referrer only), so the second embedder's call-site config never takes effect. L3 port of JS `embedded-sibling-single-referrer`.\"\n },\n {\n \"code\": \"ORB_THEME_PIN_CONTRADICTS_APP\",\n \"category\": \"schema\",\n \"description\": \"A trait pins `config.theme` to a non-empty literal that isn't a binding (`@…`) and doesn't match the schema's app-level `theme` declaration. `\\\"\\\"` and bindings are unpinned — an orbital riding the ambient default is silent. L3 port of the app-level branch of JS `app-theme-divergent`; the dominant-vote branch is a name/plurality heuristic and is retired, not ported.\"\n },\n {\n \"code\": \"ORB_THEME_UNDECLARED\",\n \"category\": \"schema\",\n \"description\": \"A `data-theme` resolves to a literal theme the program does not declare (app or orbital `theme`, or the app's `themes`), so the compiled client ships no stylesheet for it (G-UI-106).\"\n },\n {\n \"code\": \"ORB_S_ACCESS_POLICY_INVALID_BINDING\",\n \"category\": \"schema\",\n \"description\": \"An access directive reads a binding root other than `@entity`/`@user` — the directive has no call site, so `@payload`/`@config`/`@state` are not meaningful there.\"\n },\n {\n \"code\": \"ORB_S_ACCESS_POLICY_REQUIRES_IDENTITY\",\n \"category\": \"schema\",\n \"description\": \"An access directive reads `@user` in a program declaring no `[identity]` entity. Unlike a bare pre-existing `@user` read (which falls back to the implicit default shape), a NEW authorization construct must have a real roster — that is what makes personas switchable.\"\n },\n {\n \"code\": \"ORB_S_COLLECTION_POLICY_CONFLICT\",\n \"category\": \"schema\",\n \"description\": \"Two entity declarations bind the same `persistent:` collection and declare DIFFERENT access directives. One table cannot honestly have two visibility rules, and the runtime's collection-level inheritance has no principled way to choose (`R-SHADOW-ENTITY-SHARES-COLLECTION-DIRECTIVES-DONT-APPLY`).\"\n },\n {\n \"code\": \"ORB_S_EXPECTATION_UNSATISFIED\",\n \"category\": \"schema\",\n \"description\": \"Compose link-check: an orbital's `expects entity X` / `expects entity X [identity]` names a requirement no orbital in the program provides. The message names WHO ASKED — the consumer orbital — so the repair is attributable.\"\n },\n {\n \"code\": \"ORB_S_EXPECTATION_PROVIDER_MISMATCH\",\n \"category\": \"schema\",\n \"description\": \"Compose link-check: the named provider entity exists but lacks the expected kind (e.g. `expects entity Customer [identity]` where `Customer` carries no `[identity]` tag).\"\n },\n {\n \"code\": \"ORB_S_EXPECTED_FIELD_NOT_PROVIDED\",\n \"category\": \"schema\",\n \"description\": \"Compose link-check: the provider entity declares no field with an expected shape name. Names consumer, provider, and field.\"\n },\n {\n \"code\": \"ORB_S_EXPECTED_FIELD_TYPE_MISMATCH\",\n \"category\": \"schema\",\n \"description\": \"Compose link-check: the provider has the expected field but with an incompatible type (per orbital-core's `type_compat`; literal unions use subset semantics — every expected member must be a provider member).\"\n },\n {\n \"code\": \"ORB_S_EXPECTATION_FIELD_UNDECLARED\",\n \"category\": \"schema\",\n \"description\": \"Standalone AND compose self-consistency: the consumer uses a field it did not declare — an `@user.<field>` read outside its `expects identity` shape, or a `persist` payload field outside its `expects entity` shape. The consumer's declaration is its own source of truth.\"\n },\n {\n \"code\": \"ORB_S_INVARIANT_VIOLATED\",\n \"category\": \"schema\",\n \"description\": \"A spec proposition (`@invariant` on `expects entity`, `@holds` on an `expects trait` state) is broken: a write or transition of the program falsifies it on a counterexample the evaluator confirms.\"\n },\n {\n \"code\": \"ORB_S_INVARIANT_UNPROVED\",\n \"category\": \"schema\",\n \"description\": \"A spec proposition the prover could not decide (an expression outside the decidable fragment, or a write whose effect on the proposition is over-approximated). Never a pass.\"\n },\n {\n \"code\": \"ORB_U_CONFIG_UNKNOWN_KEY\",\n \"category\": \"schema\",\n \"description\": \"A `uses A from \\\"…\\\" { config { … } }` call-site override names a key the imported behavior's app-level `config {}` (`OrbitalSchema.config`, `Almadar_Orbital_Import.md` §4.5) does not declare.\"\n },\n {\n \"code\": \"ORB_S_SHARED_WITHOUT_PERSISTENCE_MODE\",\n \"category\": \"schema\",\n \"description\": \"L2 twin of `orbital-lolo`'s `LowerError::SharedEntityWithoutPersistenceMode` (`ORB_S_SHARED_WITHOUT_PERSISTENCE_MODE`): `EntityDefinition.shared && persistence.is_none()` on the input schema. Nothing about a `[shared]` entity may be inferred — it must say `persistent: <collection>` or `runtime` explicitly. Catches a `.orb` mutated directly (factory edits, agent rewrites) that bypasses the `.lolo` parse path. Runs before any persistence defaulting. Wave 2. Error severity.\"\n },\n {\n \"code\": \"ORB_ID_UNKNOWN_REF\",\n \"category\": \"identity\",\n \"description\": \"A populated dual-carry id field points at an id that is neither a node declared in the schema's arena (orbital/entity/trait/page/emit-event) nor a `schema.ledger` entry. The edge is dangling.\"\n },\n {\n \"code\": \"ORB_ID_NAME_MISMATCH\",\n \"category\": \"identity\",\n \"description\": \"Both a reference's name field and its id sibling are populated, but the ledger's `curName` for that id disagrees with the name (dual-carry drift).\"\n },\n {\n \"code\": \"ORB_ID_KIND_MISMATCH\",\n \"category\": \"identity\",\n \"description\": \"An id's kind prefix (`identity::id_kind_of`) disagrees with the reference position it occupies (e.g. an `ent_` id sitting in a trait `refId`).\"\n },\n {\n \"code\": \"ORB_ID_LEDGER_ORPHAN\",\n \"category\": \"identity\",\n \"description\": \"A ledger row whose id no node in the schema carries — a stale row left behind after its node was removed. Error severity.\"\n },\n {\n \"code\": \"ORB_ID_DUPLICATE_EVENT_ID\",\n \"category\": \"identity\",\n \"description\": \"One event id is declared by two or more DIFFERENT traits in the same orbital (`stateMachine.events[].id` / `emits[].eventId`). Ids are the durable node keys of the identity graph; a shared id makes every id→name resolution (identity normalize, id-primary dispatch) ambiguous. Inline's event-id hygiene derives per-instance ids at expansion, so this fires only on an artifact produced outside that path.\"\n },\n {\n \"code\": \"ORB_ID_AUTHORED_WITHOUT_LEDGER\",\n \"category\": \"identity\",\n \"description\": \"A ledger-less `.orb` carries an authored declaration id that loading re-mints (`stamp::ensure_stamped`). Warning severity.\"\n },\n {\n \"code\": \"ORB_BEHAVIOR_PACKAGE_NOT_INSTALLED\",\n \"category\": \"behavior_package\",\n \"description\": \"`<prefix>/<name>` names a prefix no installed behavior package declares.\"\n },\n {\n \"code\": \"ORB_BEHAVIOR_NOT_FOUND\",\n \"category\": \"behavior_package\",\n \"description\": \"The prefix resolved to an installed package, but it has no behavior by that name (or `std/behaviors/<name>` matched neither the std source nor any other installed package).\"\n },\n {\n \"code\": \"ORB_BEHAVIOR_AMBIGUOUS\",\n \"category\": \"behavior_package\",\n \"description\": \"`std/behaviors/<name>` matched the same behavior name in two or more non-std installed packages.\"\n },\n {\n \"code\": \"ORB_BEHAVIOR_PREFIX_CONFLICT\",\n \"category\": \"behavior_package\",\n \"description\": \"Two different installed packages declare the same `orb.prefix`.\"\n },\n {\n \"code\": \"ORB_BEHAVIOR_NAME_DUPLICATE\",\n \"category\": \"behavior_package\",\n \"description\": \"A behavior name is duplicated within or across installed package sources.\"\n },\n {\n \"code\": \"ORB_BEHAVIOR_PACKAGE_INVALID\",\n \"category\": \"behavior_package\",\n \"description\": \"An installed behavior package's registry cannot be read or indexed.\"\n },\n {\n \"code\": \"ORB_GEN_INVALID_VALUE\",\n \"category\": \"generic\",\n \"description\": \"Generic invalid value\"\n },\n {\n \"code\": \"ORB_GEN_INVALID_REFERENCE\",\n \"category\": \"generic\",\n \"description\": \"Generic invalid reference format\"\n },\n {\n \"code\": \"ORB_X_UNKNOWN_THEME\",\n \"category\": \"generic\",\n \"description\": \"Theme reference names a theme not in the valid set (built-in `@almadar-ui/themes/` registry ∪ orbital-declared inline themes)\"\n },\n {\n \"code\": \"ORB_GEN_MISSING_FIELD\",\n \"category\": \"generic\",\n \"description\": \"Generic missing required field\"\n },\n {\n \"code\": \"ORB_GEN_DUPLICATE\",\n \"category\": \"generic\",\n \"description\": \"Generic duplicate entity/item\"\n }\n]\n","/**\n * Validation error types — the shape emitted by every\n * `.orb` / `.lolo` validator pass.\n *\n * `ValidationError` is the wire shape: `{ code, path, message, suggestion? }`.\n * `code` is `ValidationErrorCode`, which is an OPEN `string` to let the\n * Rust validator emit new codes without an `@almadar/core` rev. The\n * `KNOWN_VALIDATION_ERROR_CODES` const documents the codes currently\n * emitted by the validator + lolo lower pipeline (extracted from\n * `orbital-rust/crates/orbital-compiler/src/phases/validation/` +\n * `orbital-rust/crates/orbital-lolo/src/`).\n *\n * Consumers that want to narrow a code to the closed known set use\n * `KnownValidationErrorCode`:\n *\n * ```ts\n * if (err.code in KNOWN_VALIDATION_ERROR_CODES) {\n * // err.code is now narrowable to KnownValidationErrorCode for\n * // exhaustive switch handling.\n * }\n * ```\n *\n * @packageDocumentation\n */\n\nimport validationCodesJson from '../generated/language/validation-codes.json' with { type: 'json' };\n\ninterface ValidationCodeEntry {\n code: string;\n category: string;\n description: string;\n}\n\nconst validationCodes: readonly ValidationCodeEntry[] = validationCodesJson;\n\n/**\n * One validation diagnostic emitted by the validator / lolo lower pipeline.\n *\n * - `code`: machine-readable identifier (see `KNOWN_VALIDATION_ERROR_CODES`).\n * - `path`: JSON pointer-like path into the failing schema location,\n * e.g. `'orbitals[0].traits[2].stateMachine.transitions[1].effects[0]'`.\n * - `message`: human-readable description of the failure.\n * - `suggestion`: optional hint the validator may add to help the\n * author / LLM fix the issue.\n */\nexport interface ValidationError {\n code: ValidationErrorCode;\n path: string;\n message: string;\n suggestion?: string;\n}\n\n/**\n * Validation error code — open `string` for forward-compat with the\n * Rust validator's evolving code set. Narrow to the closed known set\n * via `KnownValidationErrorCode` when exhaustive handling is needed.\n */\nexport type ValidationErrorCode = string;\n\nconst ORBITAL_PATH_PREFIX = /^orbitals\\[(\\d+)(?: \\([^\\]]*\\))?\\]/;\n\n/**\n * The index of the orbital a validation error belongs to, read from the\n * validator's declared path shape `orbitals[<index> (<name>)]…`, split into\n * segments or not (`['orbitals[<index> (<name>)]', …]`, `['orbitals', <index>, …]`);\n * null for a schema-level (or missing) path.\n */\nexport function orbitalIndexOfValidationPath(path: string | ReadonlyArray<string | number> | undefined): number | null {\n if (Array.isArray(path)) {\n if (path[0] === 'orbitals') return typeof path[1] === 'number' ? path[1] : null;\n return typeof path[0] === 'string' ? orbitalIndexOfValidationPath(path[0]) : null;\n }\n const m = typeof path === 'string' ? ORBITAL_PATH_PREFIX.exec(path) : null;\n return m ? Number(m[1]) : null;\n}\n\n/**\n * The result of a single validator pass: a boolean verdict plus the errors\n * and warnings (the validator wire shape, `ValidationError`).\n *\n * Distinct from `ValidationResults` (app.ts): that is the Firestore-persisted\n * app-document shape keyed on `ValidationIssue` (with `severity` + array path\n * + `validatedAt`). This `ValidationResult` is the in-process pass result keyed\n * on `ValidationError` (code + JSON-pointer string path + `suggestion`).\n * `ok === true` iff there are zero errors AND zero warnings.\n */\nexport interface ValidationResult {\n ok: boolean;\n errors: ValidationError[];\n warnings: ValidationError[];\n}\n\n/**\n * Closed set of validation codes the Rust validator + lolo lower\n * pipeline emit, derived from the generated\n * `generated/language/validation-codes.json` (orbital-compiler\n * `ErrorCode::ALL`). Never hand-listed here.\n *\n * Categories (prefix → meaning):\n * - `ORB_BINDING_*` — binding (`@entity.X`, `@payload.Y`, ...) issues\n * - `ORB_E_*` / `ORB_EFF_*` / `ORB_EMIT_*` — entity / effect / emit\n * - `ORB_GEN_*` — generic / cross-cutting structure\n * - `ORB_O_*` / `ORB_P_*` / `ORB_S_*` / `ORB_SM_*` / `ORB_T_*` —\n * orbital / page / schema / state-machine / trait\n * - `ORB_QUERY_*` — query / search behaviors\n * - `ORB_RUI_*` — render-UI binding + prop validation\n * - `ORB_SLOT_*` — UI-slot conflict / contention\n * - `ORB_SVC_*` / `ORB_UI_*` — service / UI primitives\n * - `ORB_X_*` — cross-orbital constraints (listens, emits, IDs)\n * - `ORB_ID_*` — V4 dual-carry id integrity (unknown ref, name/kind\n * mismatch, ledger orphan)\n */\nexport const KNOWN_VALIDATION_ERROR_CODES: Readonly<Record<string, string>> = Object.fromEntries(\n validationCodes.map((entry) => [entry.code, entry.code]),\n);\n\n/**\n * Narrow union of the codes documented in `KNOWN_VALIDATION_ERROR_CODES`.\n * Use this in exhaustive `switch` handlers; use the broader\n * `ValidationErrorCode` (open `string`) anywhere a fresh validator-side\n * code could plausibly arrive.\n */\nexport type KnownValidationErrorCode = string;\n\n/**\n * Type guard: is the given code a known one? After the guard returns\n * true, the code can be narrowed to `KnownValidationErrorCode` via a\n * separate cast, because the type system can't track `in` against\n * `as const` records without an explicit narrowing helper.\n */\nexport function isKnownValidationErrorCode(\n code: ValidationErrorCode,\n): boolean {\n return code in KNOWN_VALIDATION_ERROR_CODES;\n}\n","/**\n * Living Orbital Schema — Golden Data Structure type system.\n *\n * The Living layer treats an `OrbitalSchema` as a heterogeneous attributed\n * graph: every vertex (orbital, entity, trait, state, transition, page, field,\n * event, effect, config-knob) carries a `SemanticAnnotation` + an embedding\n * vector, and the whole object can embed / validate / compile / similarity-\n * search / evolve itself. These are the canonical TYPE definitions shared by\n * the masar (Python) implementation and any TS implementation (rabit, Phase 5);\n * the numeric implementation lives outside @almadar/core.\n *\n * See `docs/Almadar_Masar_Golden_Data_Structure.md` §II/§III/§VIII. Existing\n * core vocabulary is reused, never re-defined: `SchemaChange`/`SemanticChangeKind`\n * (changeset.ts) back the evolution delta, `ValidationError`/`ValidationResult`\n * (validation.ts) back `validate()`, and the per-vertex payloads ARE the existing\n * structural types.\n *\n * @packageDocumentation\n */\n\nimport type { OrbitalSchema } from \"./schema.js\";\nimport type { OrbitalDefinition } from \"./orbital.js\";\nimport type { Entity } from \"./entity.js\";\nimport type { EntityField } from \"./field.js\";\nimport type { Trait, TraitConfigValue, ConfigFieldDeclaration } from \"./trait.js\";\nimport type { State, Transition, Event } from \"./state-machine.js\";\nimport type { Page } from \"./page.js\";\nimport type { Effect } from \"./effect.js\";\nimport type { SExpr, EvalContext, EventPayload } from \"./expression.js\";\nimport type { SchemaChange } from \"./changeset.js\";\nimport type { ValidationError, ValidationResult } from \"./validation.js\";\n// Type-only import (erased at build): no runtime cycle even though factory/\n// imports from types/. `AnnotationTier` is the documented superset of this.\nimport type { FactoryConfigTier } from \"../factory/types.js\";\n\n// ============================================================================\n// Semantic annotation (the NL → typed bridge)\n// ============================================================================\n\n/**\n * Decision-kind tier for the annotation layer. SUPERSET of the validator-\n * enforced `FactoryConfigTier` (`domain`/`policy`/`infra`/`presentation`/\n * `internal`), adding `essential` and `customization` for non-knob (event)\n * vertices that still carry the old vocabulary. Every `FactoryConfigTier`\n * value must be a member so `widenTier` stays a valid identity widen.\n */\nexport type AnnotationTier =\n | \"essential\"\n | \"domain\"\n | \"policy\"\n | \"infra\"\n | \"presentation\"\n | \"customization\"\n | \"internal\";\n\n/** Widen a knob's `FactoryConfigTier` into the annotation-layer `AnnotationTier`. */\nexport function widenTier(tier: FactoryConfigTier): AnnotationTier {\n return tier;\n}\n\n/**\n * The natural-language metadata attached to every living vertex — the text that\n * gets embedded for `similar()`/`match_intent()`. Today these four members live\n * scattered inline across core types (`EntityField.description`/`synonyms`,\n * `Event`/`TraitEventContract`.`description`/`synonyms`/`tier`,\n * `FactoryConfigParam.label`/`description`/`synonyms`/`tier`); `SemanticAnnotation`\n * is the uniform bundle of them, generalized to every vertex.\n */\nexport interface SemanticAnnotation {\n description: string;\n synonyms: string[];\n label: string;\n tier: AnnotationTier;\n}\n\n// ============================================================================\n// ML scalar/vector aliases\n// ============================================================================\n\n/**\n * A dense semantic embedding. In-memory form is `Float32Array`; the at-rest\n * JSON form (e.g. rabit's `knob-embeddings.json`) is `number[]`.\n */\nexport type SemanticVector = Float32Array;\n\n/** A probability in `[0, 1]`. */\nexport type Probability = number;\n\n/** Whether a semantic gate's transition is open, closed, or ~0.5 ambiguous. */\nexport type GateState = \"open\" | \"closed\" | \"ambiguous\";\n\n// ============================================================================\n// Graph vertex / edge typing\n// ============================================================================\n\n/** The typed vertex kinds of the living attributed graph (§II.1 `V_*`). */\nexport type VertexType =\n | \"orbital\"\n | \"entity\"\n | \"trait\"\n | \"state\"\n | \"transition\"\n | \"page\"\n | \"field\"\n | \"event\"\n | \"effect\"\n | \"value\";\n\n/**\n * A stable, structural, embedding-independent vertex id (path style, e.g.\n * `orb:Cart/trt:AddItem/st:Open`). Re-embedding never changes it.\n */\nexport type VertexId = string;\n\n/** The typed directed edge kinds of the living attributed graph (§II.1 `E_*`). */\nexport type EdgeType =\n | \"belongs_to\"\n | \"has_trait\"\n | \"has_state\"\n | \"has_transition\"\n | \"from_state\"\n | \"to_state\"\n | \"on_event\"\n | \"emits\"\n | \"listens\"\n | \"cross_orbital\"\n | \"has_effect\"\n | \"effect_seq\"\n | \"data_flow\"\n | \"ref_in_effect\"\n | \"has_page\"\n | \"has_field\"\n | \"ref\";\n\n/**\n * An effect vertex's payload. Effects are positional S-expression tuples\n * (`Effect`), so the synthesized coordinates (operator, owning transition,\n * positional index) carry the addressing the raw tuple lacks.\n */\nexport interface EffectPayload {\n sexpr: Effect;\n operator: string;\n transitionId: VertexId;\n index: number;\n}\n\n/**\n * A config-knob vertex's payload — joins a `Trait.config` dict key with its\n * declaration (no single core type carries both).\n */\nexport interface KnobPayload {\n name: string;\n declaration: ConfigFieldDeclaration;\n traitId: VertexId;\n}\n\n/** The union of every kind of vertex payload (the existing structural types). */\nexport type VertexPayload =\n | OrbitalDefinition\n | Entity\n | Trait\n | State\n | Transition\n | Page\n | EntityField\n | Event\n | EffectPayload\n | KnobPayload;\n\n/**\n * One vertex of the living graph: a structural payload plus its annotation and\n * embedding. Identity is `id` (structural); annotation/embedding are derived.\n */\nexport interface LivingVertex<P extends VertexPayload = VertexPayload> {\n id: VertexId;\n vtype: VertexType;\n payload: P;\n annotation: SemanticAnnotation;\n /** Lazily populated — undefined until the schema's `embed()` runs. */\n embedding?: SemanticVector;\n}\n\nexport type LivingOrbital = LivingVertex<OrbitalDefinition>;\nexport type LivingEntity = LivingVertex<Entity>;\nexport type LivingTrait = LivingVertex<Trait>;\nexport type LivingState = LivingVertex<State>;\nexport type LivingTransition = LivingVertex<Transition>;\nexport type LivingPage = LivingVertex<Page>;\nexport type LivingField = LivingVertex<EntityField>;\nexport type LivingEvent = LivingVertex<Event>;\nexport type LivingEffect = LivingVertex<EffectPayload>;\nexport type LivingValue = LivingVertex<KnobPayload>;\n\n/**\n * One directed edge. `via` carries the transition vertex for the ternary\n * `has_transition(from, via, to)` decomposition; `seq` carries the ordering for\n * `effect_seq`.\n */\nexport interface LivingEdge {\n etype: EdgeType;\n src: VertexId;\n dst: VertexId;\n via?: VertexId;\n seq?: number;\n}\n\n// ============================================================================\n// Evolution + lineage (composes changeset.ts vocabulary)\n// ============================================================================\n\n/**\n * A single evolution step over the living graph. `modified` reuses the canonical\n * `SchemaChange` (changeset.ts) rather than inventing a parallel operation enum;\n * `intent` is the natural-language delta that caused the change.\n */\nexport interface EvolutionDelta {\n added: VertexId[];\n removed: VertexId[];\n modified: SchemaChange[];\n intent: string;\n}\n\n/** One immutable entry in a living schema's evolution lineage (§6.2). */\nexport interface LineageEntry {\n root: string;\n parent: string;\n delta: EvolutionDelta;\n intent: string;\n time: number;\n valid: boolean;\n}\n\n// ============================================================================\n// Effect-simulation results\n// ============================================================================\n\n/** The result of simulating one effect's S-expression (§4.6) — pure, no I/O. */\nexport interface EffectResult {\n result: SExpr;\n sideEffects: string[];\n emittedEvents: string[];\n}\n\n// ============================================================================\n// The living schema contract (§VIII) — implemented by masar (Python) + rabit (TS)\n// ============================================================================\n\n/**\n * The operation surface of a living orbital schema. This interface is the shared\n * CONTRACT; the numeric implementation (embedding, cosine, validator shelling)\n * is language-specific. `compile()` is the bridge back to the canonical\n * `OrbitalSchema` (the ML surface — annotations beyond `description`, embeddings,\n * gates — is stripped).\n */\nexport interface LivingOrbitalSchema {\n // Orbital container\n orbitals: LivingOrbital[];\n addOrbital(name: string): LivingOrbital;\n removeOrbital(name: string): void;\n getOrbital(name: string): LivingOrbital;\n\n // Semantic layer\n annotations: Map<VertexId, SemanticAnnotation>;\n embeddings: Map<VertexId, SemanticVector>;\n\n // Structural operations\n embed(): void;\n compile(): OrbitalSchema;\n validate(): ValidationResult;\n\n // Semantic retrieval\n similar(query: string | SemanticVector, k: number, type?: VertexType): LivingVertex[];\n matchIntent(intent: string, threshold?: number): { vertex: LivingVertex; score: number }[];\n\n // Predictive operations\n predictConfig(intent: string, trait: Trait): Record<string, TraitConfigValue>;\n predictPresence(intent: string): Set<string>;\n suggestOrbital(intent: string): LivingOrbital[];\n suggestEntity(intent: string): LivingEntity[];\n suggestTrait(intent: string): LivingTrait[];\n\n // Evolution\n evolve(intentDelta: string): LivingOrbitalSchema;\n compose(other: LivingOrbitalSchema): LivingOrbitalSchema;\n repair(errors: ValidationError[]): LivingOrbitalSchema;\n\n // Cross-orbital wiring\n wireEvents(source: LivingEvent, target: LivingEvent): void;\n findWiringGaps(): LivingEvent[];\n\n // Effect simulation\n simulateEffect(effect: LivingEffect, context: EvalContext): EffectResult;\n simulateInteraction(effect: LivingEffect, path: string[]): { event: LivingEvent; payload: EventPayload };\n traceDataFlow(transition: LivingTransition, inputEntity: LivingEntity): LivingEffect[];\n\n // Gates\n evaluateGates(intentEmbedding: SemanticVector): Map<VertexId, GateState[]>;\n sampleTrajectory(intentEmbedding: SemanticVector, steps: number): LivingVertex[];\n\n // Lineage\n lineage: LineageEntry[];\n checkout(hash: string): LivingOrbitalSchema;\n diff(hash1: string, hash2: string): EvolutionDelta;\n}\n","/**\n * Accessibility attribute vocabulary — the one source every layer reads.\n *\n * `@almadar/ui` components that forward these to their element declare\n * `extends A11yProps`; `@almadar/pattern-sync` expands `A11Y_ATTRIBUTES` into\n * those patterns' `propsSchema`, so `.lolo` render-ui can set them and both\n * execution paths (runtime + compiled) admit them.\n *\n * @packageDocumentation\n */\n\nimport { z } from \"zod\";\n\nexport const ARIA_LIVE = [\"off\", \"polite\", \"assertive\"] as const;\nexport type AriaLive = (typeof ARIA_LIVE)[number];\n\nexport const ARIA_CURRENT = [\"page\", \"step\", \"location\", \"date\", \"time\", \"true\", \"false\"] as const;\nexport type AriaCurrent = (typeof ARIA_CURRENT)[number];\n\nexport const ARIA_PRESSED = [\"true\", \"false\", \"mixed\"] as const;\nexport type AriaPressed = (typeof ARIA_PRESSED)[number];\n\nexport const TEXT_DIRECTIONS = [\"ltr\", \"rtl\", \"auto\"] as const;\nexport type TextDirection = (typeof TEXT_DIRECTIONS)[number];\n\n/** Focus order a pattern may opt into: in order (0) or programmatic-only (-1). */\nexport const TAB_INDEX_VALUES = [-1, 0] as const;\nexport type TabIndexValue = (typeof TAB_INDEX_VALUES)[number];\n\n/** WAI-ARIA 1.2 non-abstract roles. */\nexport const ARIA_ROLES = [\n \"alert\", \"alertdialog\", \"application\", \"article\", \"banner\", \"blockquote\", \"button\",\n \"caption\", \"cell\", \"checkbox\", \"code\", \"columnheader\", \"combobox\", \"complementary\",\n \"contentinfo\", \"definition\", \"deletion\", \"dialog\", \"document\", \"emphasis\", \"feed\",\n \"figure\", \"form\", \"generic\", \"grid\", \"gridcell\", \"group\", \"heading\", \"img\", \"insertion\",\n \"link\", \"list\", \"listbox\", \"listitem\", \"log\", \"main\", \"marquee\", \"math\", \"menu\",\n \"menubar\", \"menuitem\", \"menuitemcheckbox\", \"menuitemradio\", \"meter\", \"navigation\",\n \"none\", \"note\", \"option\", \"paragraph\", \"presentation\", \"progressbar\", \"radio\",\n \"radiogroup\", \"region\", \"row\", \"rowgroup\", \"rowheader\", \"scrollbar\", \"search\",\n \"searchbox\", \"separator\", \"slider\", \"spinbutton\", \"status\", \"strong\", \"subscript\",\n \"superscript\", \"switch\", \"tab\", \"table\", \"tablist\", \"tabpanel\", \"term\", \"textbox\",\n \"time\", \"timer\", \"toolbar\", \"tooltip\", \"tree\", \"treegrid\", \"treeitem\",\n] as const;\nexport type AriaRole = (typeof ARIA_ROLES)[number];\nexport const AriaRoleSchema = z.enum(ARIA_ROLES);\n\nconst ARIA_ROLE_SET: ReadonlySet<string> = new Set(ARIA_ROLES);\n\nexport function isAriaRole(value: string): value is AriaRole {\n return ARIA_ROLE_SET.has(value);\n}\n\n/** ARIA's boolean attribute values, as React accepts them. */\nexport type AriaBooleanish = boolean | \"true\" | \"false\";\n\n/**\n * The props an accessible pattern forwards to its element. Typed as React\n * accepts them (TSX call sites); `.lolo` gets the narrower A11Y_ATTRIBUTES.\n */\nexport interface A11yProps {\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n \"aria-describedby\"?: string;\n \"aria-live\"?: AriaLive;\n \"aria-current\"?: AriaCurrent | boolean;\n \"aria-pressed\"?: AriaBooleanish | \"mixed\";\n \"aria-expanded\"?: AriaBooleanish;\n \"aria-selected\"?: AriaBooleanish;\n \"aria-hidden\"?: AriaBooleanish;\n \"aria-busy\"?: AriaBooleanish;\n role?: AriaRole;\n lang?: string;\n dir?: TextDirection;\n tabIndex?: number;\n}\n\n/** A11yProps as propsSchema entries (the registry's prop shape). */\nexport interface A11yAttributeSchema {\n types: [\"string\"] | [\"boolean\"] | [\"number\"];\n description: string;\n enumValues?: readonly string[];\n numericEnumValues?: readonly number[];\n}\n\nexport const A11Y_ATTRIBUTES: Record<keyof A11yProps, A11yAttributeSchema> = {\n \"aria-label\": { types: [\"string\"], description: \"Accessible name read by screen readers when the visible text is missing or not descriptive (e.g. an icon-only control).\" },\n \"aria-labelledby\": { types: [\"string\"], description: \"Id of the element whose text names this one.\" },\n \"aria-describedby\": { types: [\"string\"], description: \"Id of the element whose text describes this one (help text, error).\" },\n \"aria-live\": { types: [\"string\"], enumValues: ARIA_LIVE, description: \"Announce changes to this region: polite waits for a pause, assertive interrupts.\" },\n \"aria-current\": { types: [\"string\"], enumValues: ARIA_CURRENT, description: \"Marks the current item in a set: the current page, step, location, date or time.\" },\n \"aria-pressed\": { types: [\"string\"], enumValues: ARIA_PRESSED, description: \"Toggle-button state.\" },\n \"aria-expanded\": { types: [\"boolean\"], description: \"Whether the element it controls is expanded.\" },\n \"aria-selected\": { types: [\"boolean\"], description: \"Whether this item is selected (tabs, options, grid cells).\" },\n \"aria-hidden\": { types: [\"boolean\"], description: \"Hide from assistive technology (decorative content only).\" },\n \"aria-busy\": { types: [\"boolean\"], description: \"This region is updating; assistive technology waits before announcing it.\" },\n role: { types: [\"string\"], enumValues: ARIA_ROLES, description: \"WAI-ARIA role when the element's native semantics don't describe it.\" },\n lang: { types: [\"string\"], description: \"Language of this element's content (BCP 47, e.g. ar, sl, en).\" },\n dir: { types: [\"string\"], enumValues: TEXT_DIRECTIONS, description: \"Text direction of this element's content.\" },\n tabIndex: { types: [\"number\"], numericEnumValues: TAB_INDEX_VALUES, description: \"0 puts the element in the Tab order; -1 makes it focusable only programmatically.\" },\n};\n\n/** Props that give an element its accessible name. */\nexport const ACCESSIBLE_NAME_ATTRIBUTES = [\"aria-label\", \"aria-labelledby\"] as const;\n","/** A content block's surface modes. */\nexport const SURFACE_MODES = ['auto', 'none'] as const;\n\n/**\n * A content block's surface: `auto` paints the theme-owned content surface\n * behind the block unless it already sits on one (a card, dialog or another\n * block); `none` places it directly on the page.\n */\nexport type SurfaceMode = (typeof SURFACE_MODES)[number];\n","/**\n * Canvas theme — the theme's drawing axes (`diagram`, `scene`, diagram colors, the canvas ground)\n * resolved to concrete values for surfaces that cannot evaluate CSS: canvas 2D, three.js and the\n * native painters. A mark names a role (`tone`, `stroke`, `text`, `font`); the surface asks the\n * resolved theme what that role looks like.\n */\n\nimport { z } from 'zod';\nimport type { DiagramFillStyle, DiagramLabelFont, DiagramLineCap, DiagramLineJoin, DiagramMarker } from './domain.js';\n\n/** The color roles a mark can name instead of a literal color. */\nexport type DiagramTone =\n | 'ink'\n | 'label'\n | 'guide'\n | 'axis'\n | 'grid'\n | 'highlight'\n | 'fill'\n | 'series-1'\n | 'series-2'\n | 'series-3'\n | 'series-4'\n | 'series-5'\n | 'series-6'\n | 'series-7'\n | 'series-8'\n | 'primary'\n | 'accent'\n | 'success'\n | 'warning'\n | 'error'\n | 'info'\n | 'muted';\n\nexport const DIAGRAM_TONES = [\n 'ink', 'label', 'guide', 'axis', 'grid', 'highlight', 'fill',\n 'series-1', 'series-2', 'series-3', 'series-4', 'series-5', 'series-6', 'series-7', 'series-8',\n 'primary', 'accent', 'success', 'warning', 'error', 'info', 'muted',\n] as const satisfies readonly DiagramTone[];\nexport const DiagramToneSchema = z.enum(DIAGRAM_TONES);\n\n/** The theme color key (`--color-<key>`) each tone draws with. */\nexport const DIAGRAM_TONE_COLOR_KEYS: Readonly<Record<DiagramTone, string>> = {\n ink: 'diagram-ink',\n label: 'diagram-label',\n guide: 'diagram-guide',\n axis: 'diagram-axis',\n grid: 'diagram-grid',\n highlight: 'diagram-highlight',\n fill: 'diagram-fill',\n 'series-1': 'series-1',\n 'series-2': 'series-2',\n 'series-3': 'series-3',\n 'series-4': 'series-4',\n 'series-5': 'series-5',\n 'series-6': 'series-6',\n 'series-7': 'series-7',\n 'series-8': 'series-8',\n primary: 'primary',\n accent: 'accent',\n success: 'success',\n warning: 'warning',\n error: 'error',\n info: 'info',\n muted: 'muted-foreground',\n};\n\nexport type DiagramStrokeWeight = 'thin' | 'normal' | 'bold';\nexport const DIAGRAM_STROKE_WEIGHTS = ['thin', 'normal', 'bold'] as const satisfies readonly DiagramStrokeWeight[];\nexport const DiagramStrokeWeightSchema = z.enum(DIAGRAM_STROKE_WEIGHTS);\n\nexport type DiagramTextSize = 'xs' | 'sm' | 'base' | 'lg' | 'xl' | '2xl';\nexport const DIAGRAM_TEXT_SIZES = ['xs', 'sm', 'base', 'lg', 'xl', '2xl'] as const satisfies readonly DiagramTextSize[];\nexport const DiagramTextSizeSchema = z.enum(DIAGRAM_TEXT_SIZES);\n\n/** Whether a label follows the theme's label case or keeps its letters (symbols, units, formulas). */\nexport type DiagramTextCase = 'theme' | 'verbatim';\nexport const DIAGRAM_TEXT_CASES = ['theme', 'verbatim'] as const satisfies readonly DiagramTextCase[];\nexport const DiagramTextCaseSchema = z.enum(DIAGRAM_TEXT_CASES);\n\n/** Each list names every member of its union (a missing member fails to compile). */\ntype Covers<U, L extends readonly U[]> = Exclude<U, L[number]> extends never ? true : false;\nconst _tonesComplete: Covers<DiagramTone, typeof DIAGRAM_TONES> = true;\nconst _strokesComplete: Covers<DiagramStrokeWeight, typeof DIAGRAM_STROKE_WEIGHTS> = true;\nconst _textComplete: Covers<DiagramTextSize, typeof DIAGRAM_TEXT_SIZES> = true;\nconst _caseComplete: Covers<DiagramTextCase, typeof DIAGRAM_TEXT_CASES> = true;\nvoid _tonesComplete;\nvoid _strokesComplete;\nvoid _textComplete;\nvoid _caseComplete;\n\n/**\n * The roles a drawn mark can carry. A role overrides the theme default for that mark; a literal\n * style field on the same mark (`color`, `lineWidth`, `fontSize`) overrides the role.\n */\nexport interface DiagramMarkRoles {\n /** Stroke / text color role. */\n tone?: DiagramTone;\n /** Fill color role (default: the stroke's tone under the theme's fill style). */\n fillTone?: DiagramTone;\n /** Stroke weight role. */\n stroke?: DiagramStrokeWeight;\n /** Label size role — a step of the theme's type scale. */\n textSize?: DiagramTextSize;\n /** Label face role. */\n font?: DiagramLabelFont;\n /** `verbatim` keeps a symbol's letters (mg, pH, Na, θ) under an uppercase label theme; default `theme`. */\n textCase?: DiagramTextCase;\n /** Fill treatment; absent = the theme's `--diagram-fill-style`. */\n fillStyle?: DiagramFillStyle;\n}\n\n/** A theme shadow recipe reduced to what a canvas context can draw. */\nexport interface CanvasShadow {\n offsetX: number;\n offsetY: number;\n blur: number;\n color: string;\n}\n\n/** The theme's drawing axes resolved for one scope. Colors are canvas-ready CSS strings. */\nexport interface CanvasTheme {\n ground: string;\n /**\n * Diagram chrome surfaces: the neutral wash (`--color-muted`), cards (`--color-card`) and text\n * drawn on a primary fill (`--color-primary-foreground`).\n */\n surfaces: Readonly<Record<'muted' | 'card' | 'onPrimary', string>>;\n tones: Readonly<Record<DiagramTone, string>>;\n series: readonly string[];\n strokes: Readonly<Record<DiagramStrokeWeight, number>>;\n lineCap: DiagramLineCap;\n lineJoin: DiagramLineJoin;\n dash: readonly number[];\n dot: readonly number[];\n fillStyle: DiagramFillStyle;\n fillOpacity: number;\n roughness: number;\n glow: number;\n shadow: CanvasShadow | null;\n marker: DiagramMarker;\n faces: Readonly<Record<DiagramLabelFont, string>>;\n label: {\n font: DiagramLabelFont;\n size: DiagramTextSize;\n weight: string;\n uppercase: boolean;\n };\n /** Type scale in px. */\n text: Readonly<Record<DiagramTextSize, number>>;\n corner: number;\n motion: {\n enabled: boolean;\n fastMs: number;\n normalMs: number;\n slowMs: number;\n easing: string;\n };\n scene: {\n roughness: number;\n metalness: number;\n flat: boolean;\n outline: number;\n ambient: number;\n key: number;\n keyColor: string;\n fog: number;\n };\n}\n","/**\n * Behaviors as first-class values (language trio, `docs/Almadar_Studio_Behavior.md`).\n *\n * A trait value names a trait of an installed behavior package and carries the\n * call-site overrides of the trait-reference form (LOLO §8); an orbital value\n * names an orbital and carries the orbital-import body (LOLO §8b). Their literal\n * spellings mirror those forms with the `uses` specifier in the alias position:\n * `std/std-kanban.traits.KanbanBoard`, `std/std-kanban.orbitals.KanbanOrbital`.\n * orbital-core's `schema::behavior_value` is the Rust twin.\n *\n * @packageDocumentation\n */\n\nimport { z } from 'zod';\nimport { DeclaredTraitConfigSchema, TraitConfigValueSchema, TraitReferenceObjectSchema, type TraitConfigValue, type TraitReference } from './trait.js';\nimport { ExpectDeclarationSchema, OrbitalRefObjectSchema, type OrbitalRefObject } from './orbital.js';\nimport { EntityFieldSchema, type EntityField } from './field.js';\nimport { EntityPersistenceSchema } from './entity.js';\nimport { StateMachineSchema, type StateMachine } from './state-machine.js';\nimport type { JsonValue, RuntimeValue } from './json.js';\nimport type { OrbitalSchema } from './schema.js';\nimport type { FactoryExposure } from '../factory/types.js';\n\n/** The §8 call-site override surface a trait value records (`behavior/apply`). */\nexport type TraitOverrides = Pick<TraitReference, 'config' | 'events' | 'fields' | 'listens' | 'emitsScope' | 'linkedEntity'>;\n\n/** A trait of an installed behavior, plus the overrides applied to it. */\nexport type TraitValue = TraitOverrides & {\n /** The behavior's specifier: canonical `<prefix>/<name>` (the compiler and `behavior/catalog` emit it), `std/behaviors/<name>` as authored, or workspace-relative `./orbitals/<name>` (what `program/eval` wrote). */\n readonly behavior: string;\n /** The trait's upstream name. */\n readonly trait: string;\n};\n\nconst TRAITS_SEGMENT = '.traits.';\nconst ORBITALS_SEGMENT = '.orbitals.';\nconst PASCAL = /^[A-Z][A-Za-z0-9]*$/;\n// `<prefix>/<name>` (canonical), the `uses` std spelling `std/behaviors/<name>`, or a\n// workspace-relative `./<dir>/<name>` (a program `program/eval` wrote, default `./orbitals/`).\nconst SPECIFIER = /^(?:[a-z0-9][a-z0-9-]*(?:\\/behaviors)?|\\.(?:\\/[A-Za-z0-9_-]+)+)\\/[A-Za-z0-9][A-Za-z0-9_-]*$/;\n\nfunction splitLiteral(raw: string, segment: string): { behavior: string; name: string } | undefined {\n const at = raw.lastIndexOf(segment);\n if (at <= 0) return undefined;\n const behavior = raw.slice(0, at);\n const name = raw.slice(at + segment.length);\n if (!SPECIFIER.test(behavior) || !PASCAL.test(name)) return undefined;\n return { behavior, name };\n}\n\n/** Parse `<prefix>/<name>.traits.<Trait>`; undefined for anything else (a local `@trait.X` included). */\nexport function parseTraitValueLiteral(raw: string): TraitValue | undefined {\n const parts = splitLiteral(raw, TRAITS_SEGMENT);\n return parts === undefined ? undefined : { behavior: parts.behavior, trait: parts.name };\n}\n\n/** Parse `<prefix>/<name>.orbitals.<Orbital>`; undefined for anything else. */\nexport function parseOrbitalValueLiteral(raw: string): OrbitalValue | undefined {\n const parts = splitLiteral(raw, ORBITALS_SEGMENT);\n return parts === undefined ? undefined : { behavior: parts.behavior, orbital: parts.name };\n}\n\n/** Parse either literal form. */\nexport function parseBehaviorValueLiteral(raw: string): BehaviorValue | undefined {\n return parseTraitValueLiteral(raw) ?? parseOrbitalValueLiteral(raw);\n}\n\n/** Inverse of {@link parseTraitValueLiteral}; drops overrides (they have no literal form). */\nexport function formatTraitValueLiteral(value: Pick<TraitValue, 'behavior' | 'trait'>): string {\n return `${value.behavior}${TRAITS_SEGMENT}${value.trait}`;\n}\n\n/** Inverse of {@link parseOrbitalValueLiteral}; drops the recorded import body. */\nexport function formatOrbitalValueLiteral(value: Pick<OrbitalValue, 'behavior' | 'orbital'>): string {\n return `${value.behavior}${ORBITALS_SEGMENT}${value.orbital}`;\n}\n\n/** Either literal form, by kind. */\nexport function formatBehaviorValueLiteral(value: BehaviorValue): string {\n return isOrbitalValueShape(value) ? formatOrbitalValueLiteral(value) : formatTraitValueLiteral(value);\n}\n\n/** Validates the §8 override object `behavior/apply` takes; unknown keys are rejected. */\nexport const TraitOverridesSchema = TraitReferenceObjectSchema.pick({\n config: true,\n events: true,\n fields: true,\n listens: true,\n emitsScope: true,\n linkedEntity: true,\n}).strict();\n\n/** Validates a trait value carried as data: identity plus the recorded overrides. */\nexport const TraitValueSchema = TraitOverridesSchema.extend({\n behavior: z.string().regex(SPECIFIER),\n trait: z.string().regex(PASCAL),\n}).strict();\n\n/**\n * The §8b import body an orbital value records. Config holds plain values, as at\n * a trait call site; the import builder wraps them into the IR's declaration form.\n * `name` is the orbital's name in the importing program (default: the upstream name).\n */\nexport type OrbitalOverrides = Omit<OrbitalRefObject, 'ref' | 'refId' | 'config' | 'traits'> & {\n readonly name?: string;\n /** The source behavior's app-level knobs (its top-level `config {}`), as `uses Source { config }` sets them. */\n readonly app?: Readonly<Record<string, TraitConfigValue>>;\n readonly config?: Readonly<Record<string, TraitConfigValue>>;\n readonly traits?: Readonly<Record<string, TraitOverrides>>;\n /** Imports the value's sibling traits compose from, beside its own source. */\n readonly uses?: readonly OrbitalValueUse[];\n /** Traits the import orbital declares beside the imported ones, mountable through `mounts`. */\n readonly siblings?: readonly OrbitalValueSibling[];\n};\n\n/** An orbital of an installed behavior, plus the import body applied to it. */\nexport type OrbitalValue = OrbitalOverrides & {\n readonly behavior: string;\n /** The orbital's upstream name. */\n readonly orbital: string;\n};\n\n/** A trait value or an orbital value. */\nexport type BehaviorValue = TraitValue | OrbitalValue;\n\n/** One import the value's own sibling traits compose from (`uses <as> from <from>` on the import orbital). */\nexport const OrbitalValueUseSchema = z.object({ from: z.string(), as: z.string().regex(PASCAL) }).strict();\nexport type OrbitalValueUse = z.infer<typeof OrbitalValueUseSchema>;\n\n/** A trait the import orbital declares beside the imported ones (`trait <name> = <ref> { config }`), mountable through `mounts`. */\nexport const OrbitalValueSiblingSchema = z\n .object({\n name: z.string().regex(PASCAL),\n ref: z.string(),\n linkedEntity: z.string().optional(),\n config: z.record(z.string(), TraitConfigValueSchema).optional(),\n })\n .strict();\nexport type OrbitalValueSibling = z.infer<typeof OrbitalValueSiblingSchema>;\n\n/** Validates the §8b body `behavior/apply` takes for an orbital value; unknown keys are rejected. */\nexport const OrbitalOverridesSchema = OrbitalRefObjectSchema.omit({ ref: true, refId: true, config: true, traits: true })\n .extend({\n name: z.string().regex(PASCAL).optional(),\n app: z.record(z.string(), TraitConfigValueSchema).optional(),\n config: z.record(z.string(), TraitConfigValueSchema).optional(),\n traits: z.record(z.string(), TraitOverridesSchema).optional(),\n uses: z.array(OrbitalValueUseSchema).optional(),\n siblings: z.array(OrbitalValueSiblingSchema).optional(),\n })\n .strict();\n\n/** Validates an orbital value carried as data. */\nexport const OrbitalValueSchema = OrbitalOverridesSchema.extend({\n behavior: z.string().regex(SPECIFIER),\n orbital: z.string().regex(PASCAL),\n}).strict();\n\n/** Validates either kind. */\nexport const BehaviorValueSchema = z.union([TraitValueSchema, OrbitalValueSchema]);\n\ntype Mutable<T> = { -readonly [K in keyof T]: T[K] };\n\nfunction mergeTraitOverrides(base: TraitOverrides, overrides: TraitOverrides): TraitOverrides {\n const merged: Mutable<TraitOverrides> = { ...base };\n if (overrides.config !== undefined) merged.config = { ...base.config, ...overrides.config };\n if (overrides.events !== undefined) merged.events = { ...base.events, ...overrides.events };\n if (overrides.fields !== undefined) merged.fields = { ...base.fields, ...overrides.fields };\n if (overrides.listens !== undefined) merged.listens = overrides.listens;\n if (overrides.emitsScope !== undefined) merged.emitsScope = overrides.emitsScope;\n if (overrides.linkedEntity !== undefined) merged.linkedEntity = overrides.linkedEntity;\n return merged;\n}\n\n/**\n * `behavior/apply` on a trait value: `config`, `events` and `fields` merge\n * key-wise with the later value winning; `listens`, `emitsScope` and\n * `linkedEntity` replace. Pure — the input is not mutated.\n */\nexport function applyTraitOverrides(value: TraitValue, overrides: TraitOverrides): TraitValue {\n return { ...mergeTraitOverrides(value, overrides), behavior: value.behavior, trait: value.trait };\n}\n\nfunction mergeFieldsByName(base: readonly EntityField[] | undefined, next: readonly EntityField[]): EntityField[] {\n const out = [...(base ?? [])];\n for (const field of next) {\n const at = field.name === undefined ? -1 : out.findIndex((f) => f.name === field.name);\n if (at >= 0) out[at] = field;\n else out.push(field);\n }\n return out;\n}\n\n/**\n * `behavior/apply` on an orbital value — the §8b merge table. Maps\n * (`config`, `events`, `fields`, `pages`, `pageModifiers`, `roles`, `entities`,\n * `mounts`, `mock`) merge key-wise, later wins; `traits` merges per trait with the\n * trait-value rules; `extend` and `retype` merge by field name; everything else\n * (`name`, `entity`, `persistence`, `collection`, `only`, `omit`, `listens`, the\n * flags) replaces. Pure.\n */\nexport function applyOrbitalOverrides(value: OrbitalValue, overrides: OrbitalOverrides): OrbitalValue {\n const merged: Mutable<OrbitalValue> = { ...value, ...overrides, behavior: value.behavior, orbital: value.orbital };\n if (overrides.app !== undefined) merged.app = { ...value.app, ...overrides.app };\n if (overrides.config !== undefined) merged.config = { ...value.config, ...overrides.config };\n if (overrides.events !== undefined) merged.events = { ...value.events, ...overrides.events };\n if (overrides.fields !== undefined) merged.fields = { ...value.fields, ...overrides.fields };\n if (overrides.pages !== undefined) merged.pages = { ...value.pages, ...overrides.pages };\n if (overrides.pageModifiers !== undefined) merged.pageModifiers = { ...value.pageModifiers, ...overrides.pageModifiers };\n if (overrides.roles !== undefined) merged.roles = { ...value.roles, ...overrides.roles };\n if (overrides.entities !== undefined) merged.entities = { ...value.entities, ...overrides.entities };\n if (overrides.mounts !== undefined) merged.mounts = { ...value.mounts, ...overrides.mounts };\n if (overrides.mock !== undefined) merged.mock = { ...value.mock, ...overrides.mock };\n if (overrides.extend !== undefined) merged.extend = mergeFieldsByName(value.extend, overrides.extend);\n if (overrides.retype !== undefined) merged.retype = mergeFieldsByName(value.retype, overrides.retype);\n if (overrides.uses !== undefined) {\n const byAlias = new Map((value.uses ?? []).map((u) => [u.as, u]));\n for (const use of overrides.uses) byAlias.set(use.as, use);\n merged.uses = [...byAlias.values()];\n }\n if (overrides.siblings !== undefined) {\n const byName = new Map((value.siblings ?? []).map((t) => [t.name, t]));\n for (const sibling of overrides.siblings) {\n const prior = byName.get(sibling.name);\n byName.set(sibling.name, { ...prior, ...sibling, ...(prior?.config !== undefined || sibling.config !== undefined ? { config: { ...prior?.config, ...sibling.config } } : {}) });\n }\n merged.siblings = [...byName.values()];\n }\n if (overrides.traits !== undefined) {\n const traits: Record<string, TraitOverrides> = { ...value.traits };\n for (const [name, entry] of Object.entries(overrides.traits)) {\n traits[name] = mergeTraitOverrides(traits[name] ?? {}, entry);\n }\n merged.traits = traits;\n }\n return merged;\n}\n\n/** `behavior/apply` for either kind; the overrides are validated against the value's kind. */\nexport function applyBehaviorOverrides(value: BehaviorValue, overrides: JsonValue): BehaviorValue {\n if (isOrbitalValueShape(value)) return applyOrbitalOverrides(value, OrbitalOverridesSchema.parse(overrides));\n return applyTraitOverrides(value, TraitOverridesSchema.parse(overrides));\n}\n\n/** Structural guard for a trait value carried as data. */\nexport function isTraitValue(value: RuntimeValue): value is TraitValue {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return false;\n if (!('behavior' in value) || !('trait' in value)) return false;\n const { behavior, trait } = value;\n return typeof behavior === 'string' && SPECIFIER.test(behavior) && typeof trait === 'string' && PASCAL.test(trait);\n}\n\n/** Structural guard for an orbital value carried as data. */\nexport function isOrbitalValue(value: RuntimeValue): value is OrbitalValue {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return false;\n if (!('behavior' in value) || !('orbital' in value)) return false;\n const { behavior, orbital } = value;\n return typeof behavior === 'string' && SPECIFIER.test(behavior) && typeof orbital === 'string' && PASCAL.test(orbital);\n}\n\n/** A whole behavior as a value (`.lolo` type `behavior`): what `behavior/ref` builds and a render embed runs. */\nexport function behaviorRef(specifier: string): BehaviorRef {\n if (!SPECIFIER.test(specifier)) {\n throw new Error(`behavior/ref: \"${specifier}\" is not a behavior specifier (<prefix>/<name>, std/behaviors/<name> or ./<dir>/<name>)`);\n }\n return { behavior: specifier };\n}\n\n/** Structural guard for a behavior value: a specifier and, optionally, its declared bridge (a trait or orbital value names a member too). */\nexport function isBehaviorRefValue(value: RuntimeValue): value is BehaviorRef {\n return BehaviorRefSchema.safeParse(value).success;\n}\n\nfunction isOrbitalValueShape(value: BehaviorValue): value is OrbitalValue {\n return 'orbital' in value;\n}\n\nconst EXPOSURES = ['app', 'experience', 'palette', 'both', 'internal'] as const satisfies readonly FactoryExposure[];\nconst VectorSchema = z.array(z.number());\n\n/**\n * A `behavior/catalog` scope: registry folders `<prefix>/<topic>[/<tier>]` (the\n * tree packages ship as `<registry>/<topic>/<tier>/<name>.orb`), optionally\n * narrowed by exposure.\n */\nexport const CatalogScopeSchema = z.object({\n paths: z.array(z.string().min(1)).min(1),\n exposure: z.array(z.enum(EXPOSURES)).optional(),\n}).strict();\nexport type CatalogScope = z.infer<typeof CatalogScopeSchema>;\n\n/**\n * The events an embedded behavior exchanges with the page that embeds it: `listens` are the\n * host's events delivered into it (to every trait that handles one), `emits` are its own\n * `external` events re-emitted on the host. Nothing else crosses; without a bridge it runs isolated.\n */\nexport const BehaviorBridgeSchema = z.object({\n listens: z.array(z.string().min(1)),\n emits: z.array(z.string().min(1)),\n}).strict();\nexport type BehaviorBridge = z.infer<typeof BehaviorBridgeSchema>;\n\n/**\n * A behavior named by itself, with no trait or orbital picked (what `behavior/describe` takes for a whole behavior), the\n * bridge its embed declares, if any, and optionally `resolved`: the behavior's resolved program as JSON, validated by\n * whoever set it, which an embed runs as it is instead of asking the host to mount the behavior.\n */\nexport const BehaviorRefSchema = z.object({ behavior: z.string().regex(SPECIFIER), bridge: BehaviorBridgeSchema.optional(), resolved: z.string().min(1).optional() }).strict();\nexport type BehaviorRef = z.infer<typeof BehaviorRefSchema>;\n\n/** The overrides `behavior/apply` takes for a whole behavior value: its bridge. */\nexport const BehaviorRefOverridesSchema = z.object({ bridge: BehaviorBridgeSchema }).strict();\n\n/** `behavior/apply` on a behavior value: records (replaces) its bridge. Pure. */\nexport function applyBehaviorRefOverrides(value: BehaviorRef, overrides: JsonValue): BehaviorRef {\n const parsed = BehaviorRefOverridesSchema.parse(overrides);\n return { behavior: value.behavior, bridge: parsed.bridge };\n}\n\n/** One behavior `behavior/catalog` returns (`orb behaviors catalog --json`). */\nexport const CatalogEntrySchema = z.object({\n /** `<prefix>/<name>`. */\n behavior: z.string(),\n package: z.string(),\n topic: z.string(),\n level: z.enum(['atom', 'molecule', 'organism']),\n exposure: z.enum(EXPOSURES).optional(),\n /** The `@almadar/ui` pattern the behavior is the factory of (`;; @pattern`); absent when it is not one. */\n pattern: z.string().optional(),\n description: z.string(),\n capabilities: z.array(z.string()),\n /** The behavior's traits as ready-to-bind values. */\n traits: z.array(TraitValueSchema),\n /** The behavior as a value (`.lolo` type `behavior`), ready to embed or store. */\n value: BehaviorRefSchema,\n /** Shipped embedding vectors, keyed by facet (`description`, `capabilities`). */\n vectors: z.record(z.string(), VectorSchema),\n /** The embedding model the vectors were stamped with. */\n model: z.string(),\n}).strict();\nexport type CatalogEntry = z.infer<typeof CatalogEntrySchema>;\n\n/** One knob of a described trait, with its shipped embedding vector. */\nexport type TraitKnob = {\n key: string;\n type: string;\n default?: TraitConfigValue;\n label?: string;\n description?: string;\n tier?: string;\n vector?: number[];\n};\nexport const TraitKnobSchema: z.ZodType<TraitKnob> = z.object({\n key: z.string(),\n type: z.string(),\n default: TraitConfigValueSchema.optional(),\n label: z.string().optional(),\n description: z.string().optional(),\n tier: z.string().optional(),\n vector: VectorSchema.optional(),\n}).strict();\n\n/** A described trait's events: what it emits, listens to and transitions on, and which of those its source declares `@tier \"domain\"`. */\nexport type TraitEvents = {\n emits: string[];\n listens: string[];\n /** Events the trait's own transitions fire on — the only valid `listens` triggers. */\n transitions: string[];\n domain?: string[];\n};\nexport const TraitEventsSchema: z.ZodType<TraitEvents> = z.object({\n emits: z.array(z.string()),\n listens: z.array(z.string()),\n transitions: z.array(z.string()),\n domain: z.array(z.string()).optional(),\n}).strict();\n\n/** A described trait's state machine as the program runs it (resolved: composition and renames applied). */\nexport type TraitMachine = {\n linkedEntity?: string;\n stateMachine: StateMachine;\n};\nconst TraitMachineObject = z.object({\n linkedEntity: z.string().optional(),\n stateMachine: StateMachineSchema,\n}).strict();\nexport const TraitMachineSchema: z.ZodType<TraitMachine, z.input<typeof TraitMachineObject>> = TraitMachineObject;\n\n/** A described trait printed as `.lolo` by orb's formatter, with the 1-based lines each transition (by its index in the machine) spans. */\nexport type TraitSource = {\n text: string;\n transitions: { index: number; start: number; end: number }[];\n};\nexport const TraitSourceSchema: z.ZodType<TraitSource> = z.object({\n text: z.string(),\n transitions: z.array(z.object({ index: z.number().int(), start: z.number().int(), end: z.number().int() }).strict()),\n}).strict();\n\n/** What `behavior/describe` returns for a trait value (`orb behaviors describe --json`). */\nexport type TraitDescription = {\n value: TraitValue;\n knobs: TraitKnob[];\n events: TraitEvents;\n /** The trait's state machine; absent from an older orb. */\n machine?: TraitMachine;\n /** The trait as orb prints it; absent from an older orb. */\n source?: TraitSource;\n model: string;\n};\nconst TraitDescriptionObject = z.object({\n value: TraitValueSchema,\n knobs: z.array(TraitKnobSchema),\n events: TraitEventsSchema,\n machine: TraitMachineSchema.optional(),\n source: TraitSourceSchema.optional(),\n model: z.string(),\n}).strict();\nexport const TraitDescriptionSchema: z.ZodType<TraitDescription, z.input<typeof TraitDescriptionObject>> = TraitDescriptionObject;\n\n\n/** What `behavior/describe` accepts: a trait value, an orbital value, or a whole behavior. */\nexport const DescribeTargetSchema = z.union([TraitValueSchema, OrbitalValueSchema, BehaviorRefSchema]);\nexport type DescribeTarget = TraitValue | OrbitalValue | BehaviorRef;\n\n/** One knob as a payload field (`orb behaviors describe`): its struct and list shapes resolved, plus its declared docs. */\nexport interface KnobField {\n readonly name: string;\n readonly type: string;\n readonly required?: boolean;\n readonly values?: readonly string[];\n readonly properties?: readonly KnobField[];\n /** The knob's current value: what a caller keeps when it does not change it. */\n readonly default?: TraitConfigValue;\n readonly label?: string;\n readonly description?: string;\n readonly synonyms?: string;\n readonly tier?: string;\n /** The `@config.<knob>` this knob's value forwards: its text is owned (and set) there. */\n readonly forwardedFrom?: string;\n}\nexport const KnobFieldSchema: z.ZodType<KnobField> = z.lazy(() =>\n z.object({\n name: z.string(),\n type: z.string(),\n required: z.boolean().optional(),\n values: z.array(z.string()).optional(),\n properties: z.array(KnobFieldSchema).optional(),\n default: TraitConfigValueSchema.optional(),\n label: z.string().optional(),\n description: z.string().optional(),\n synonyms: z.string().optional(),\n tier: z.string().optional(),\n forwardedFrom: z.string().optional(),\n }).strict(),\n);\n\n/** One orbital of a described behavior, from its resolved program. */\nexport const OrbitalDescriptionSchema = z.object({\n value: OrbitalValueSchema,\n config: DeclaredTraitConfigSchema,\n knobs: z.array(KnobFieldSchema),\n entity: z.object({ name: z.string(), fields: z.array(EntityFieldSchema), identity: z.boolean().optional(), persistence: EntityPersistenceSchema.optional() }).strict().optional(),\n /** Entities a sibling orbital owns that this one references: what an import of it maps through `entities {}`. */\n borrows: z.array(z.string()),\n /** What the orbital needs from its siblings at runtime, derived by `orb` (identity, entities, pages, events). */\n expects: z.array(ExpectDeclarationSchema),\n traits: z.array(z.object({\n trait: z.string(),\n config: DeclaredTraitConfigSchema,\n knobs: z.array(KnobFieldSchema),\n events: TraitEventsSchema,\n /** Declared `-> @rebindable`: the trait may be bound to another record. */\n rebindable: z.boolean().optional(),\n /** The upstream trait this one composes (`trait X = Alias.traits.Y`), as written; absent for a trait the behavior defines itself. */\n ref: z.string().optional(),\n /** The trait's declared `@capabilities` tags. */\n capabilities: z.array(z.string()).optional(),\n }).strict()),\n /** Each page with the traits it mounts: what the behavior declares as standing on its own. */\n pages: z.array(z.object({ name: z.string(), path: z.string(), traits: z.array(z.string()).optional(), label: z.string().optional(), icon: z.string().optional() }).strict()),\n /** Controls the orbital leaves for an embedding organism (`emitsScope external`) that nothing in it handles: an importer must route each. */\n forwards: z.array(z.object({ trait: z.string(), event: z.string(), via: z.array(z.string()) }).strict()).optional(),\n}).strict();\nexport type OrbitalDescription = z.infer<typeof OrbitalDescriptionSchema>;\n\n/** What `behavior/describe` returns for an orbital value or a whole behavior (`orb behaviors describe --json`). */\nexport const BehaviorDescriptionSchema = z.object({\n behavior: z.string(),\n config: DeclaredTraitConfigSchema,\n knobs: z.array(KnobFieldSchema),\n orbitals: z.array(OrbitalDescriptionSchema),\n /** The behaviors this one imports (`uses … from`): what it already contains. */\n uses: z.array(z.string()).optional(),\n}).strict();\nexport type BehaviorDescription = z.infer<typeof BehaviorDescriptionSchema>;\n\n/** What `program/eval` returns: where the validated program was written, and its traits as values. */\nexport interface EvaluatedProgram {\n /** Workspace-relative specifier of the written program (`./orbitals/<name>` by default). */\n readonly behavior: string;\n readonly traits: readonly TraitValue[];\n /** The written program as a behavior value, ready to embed. */\n readonly value: BehaviorRef;\n}\n\n/** A validator finding `program/eval` returns as data (the shape `orb validate --json` reports). A type alias, not an interface, so it is an `EventPayload` member. */\nexport type ProgramValidationIssue = {\n readonly code: string;\n readonly message: string;\n readonly path?: string;\n readonly line?: number;\n readonly column?: number;\n};\n\n/**\n * A trait value made runnable by its host: the resolved one-orbital wrapper\n * program that imports the value's owning orbital (`only { T }`, overrides as\n * `traits { T { … } }`), the mounted trait's name in it, and the page showing it.\n */\nexport interface MountedTraitValue {\n readonly schema: OrbitalSchema;\n /** The orbital the wrapper mounts the value as. */\n readonly orbital: string;\n /** The value's trait under the import prefix (`<orbital><Trait>`). */\n readonly trait: string;\n readonly pagePath?: string;\n}\n\n/** A behavior value made runnable by its host: the resolved program as written and the page it opens on. */\nexport interface MountedBehaviorValue {\n readonly schema: OrbitalSchema;\n /** The program's first page path (where the frame's scoped router starts). */\n readonly firstPage: string;\n}\n\n/** Mounting outcome for a behavior value; validator issues come back as data. */\nexport type BehaviorValueMountResult =\n | { readonly ok: true; readonly mounted: MountedBehaviorValue }\n | { readonly ok: false; readonly error: string; readonly errors?: readonly ProgramValidationIssue[] };\n\n/** Mounting outcome — the validator's issues come back as data when the value does not validate where it is bound. */\nexport type TraitValueMountResult =\n | { readonly ok: true; readonly mounted: MountedTraitValue }\n | { readonly ok: false; readonly error: string; readonly errors?: readonly ProgramValidationIssue[] };\n","/**\n * A generator eval as data: the turns a user types, the structural checks each turn's built program\n * must pass, and what the build must adopt. `orb eval` runs it; mirrored by orbital-core `eval_spec`.\n */\nimport { z } from 'zod';\nimport type { JsonValue } from './json.js';\nimport { JsonValueSchema } from './json.js';\n\n/** A regular expression carried as data (`new RegExp(pattern, flags)`). */\nexport interface EvalPattern {\n pattern: string;\n flags?: string;\n}\n\nexport type EvalPredicate =\n /** a persistent entity named by the nouns */\n | { kind: 'entity' }\n /** a field named by the nouns on a persistent entity; `required`: declared required or read by a create guard/policy */\n | { kind: 'field'; required?: boolean }\n /** an enum value named by `value` on a persistent entity named by the nouns */\n | { kind: 'enumValue'; value: EvalPattern }\n /** a policy or transition guard on the nouns entity compares `@user.role` */\n | { kind: 'roleGated' }\n /** the nouns entity's read policy compares a row value to `@user.id`; with `by`, through a field the request names */\n | { kind: 'ownerScoped'; by?: EvalPattern }\n /** one transition's effects read a nouns field and a field named by `with` */\n | { kind: 'feeds'; with: EvalPattern }\n /** a transition that notifies reads a nouns field in its guard or effects */\n | { kind: 'notifies' }\n /** an external input whose event key or payload field is named by the nouns */\n | { kind: 'input' }\n /** an in-app agent (std-agent-tool-loop) runs in the program */\n | { kind: 'agent' }\n /** a page is declared at `path` */\n | { kind: 'route'; path: string }\n /** text named by the nouns is visible on `route`, else on every route of the entity named by `on` (default: the nouns) */\n | { kind: 'rendered'; route?: string; on?: EvalPattern }\n /** visible text on every concrete route must not show these words */\n | { kind: 'absentText'; words: string[] }\n /** no persistent entity is named by the nouns */\n | { kind: 'absentEntity' }\n /** an orbital named by the nouns is declared; with `absent`, none is */\n | { kind: 'orbital'; absent?: boolean }\n /** a trait named by the nouns sets config `key` to `value` */\n | { kind: 'knob'; key: string; value: JsonValue };\n\nexport interface EvalCheck {\n id: string;\n /** the turn (0-based) from which this check must hold, and keep holding */\n introducedTurn: number;\n /** the request's own words for the thing it asks for */\n nouns: EvalPattern;\n require: EvalPredicate[];\n /** routes framed for the rubric; default: every route a predicate bound */\n frameRoutes?: string[];\n coversDeclines?: string[];\n}\n\nexport const EVAL_TIERS = ['none', 'organism', 'subset', 'compose', 'substrate', 'free'] as const;\nexport type EvalTier = (typeof EVAL_TIERS)[number];\n\nexport interface EvalExpectations {\n /** the build must take one of these tiers */\n tiers?: EvalTier[];\n /** behaviors (exact ids) the build must adopt */\n adopts?: string[];\n /** orbitals (exact names) the built program must declare */\n orbitals?: string[];\n /** the built program passes `orb validate --final` */\n validates?: boolean;\n}\n\nexport type EvalClass = 'plain' | 'specific' | 'complex';\n\nexport interface EvalSpec {\n id: string;\n class: EvalClass;\n description?: string;\n turns: [string, ...string[]];\n checks: EvalCheck[];\n expect?: EvalExpectations;\n /** behaviors (exact ids) the build must not adopt */\n forbidSources?: string[];\n}\n\nfunction validPattern(p: { pattern: string; flags?: string }): boolean {\n try {\n new RegExp(p.pattern, p.flags);\n return true;\n } catch {\n return false;\n }\n}\n\nconst EvalPatternSchema: z.ZodType<EvalPattern> = z\n .object({ pattern: z.string(), flags: z.string().optional() })\n .strict()\n .refine(validPattern, { message: 'pattern is not a valid regular expression' });\n\nconst EvalPredicateSchema: z.ZodType<EvalPredicate> = z.discriminatedUnion('kind', [\n z.object({ kind: z.literal('entity') }).strict(),\n z.object({ kind: z.literal('field'), required: z.boolean().optional() }).strict(),\n z.object({ kind: z.literal('enumValue'), value: EvalPatternSchema }).strict(),\n z.object({ kind: z.literal('roleGated') }).strict(),\n z.object({ kind: z.literal('ownerScoped'), by: EvalPatternSchema.optional() }).strict(),\n z.object({ kind: z.literal('feeds'), with: EvalPatternSchema }).strict(),\n z.object({ kind: z.literal('notifies') }).strict(),\n z.object({ kind: z.literal('input') }).strict(),\n z.object({ kind: z.literal('agent') }).strict(),\n z.object({ kind: z.literal('route'), path: z.string() }).strict(),\n z.object({ kind: z.literal('rendered'), route: z.string().optional(), on: EvalPatternSchema.optional() }).strict(),\n z.object({ kind: z.literal('absentText'), words: z.array(z.string()) }).strict(),\n z.object({ kind: z.literal('absentEntity') }).strict(),\n z.object({ kind: z.literal('orbital'), absent: z.boolean().optional() }).strict(),\n z.object({ kind: z.literal('knob'), key: z.string().min(1), value: JsonValueSchema }).strict(),\n]);\n\nconst EvalCheckSchema: z.ZodType<EvalCheck> = z\n .object({\n id: z.string().min(1),\n introducedTurn: z.number().int().min(0),\n nouns: EvalPatternSchema,\n require: z.array(EvalPredicateSchema),\n frameRoutes: z.array(z.string()).optional(),\n coversDeclines: z.array(z.string()).optional(),\n })\n .strict();\n\nexport const EvalSpecSchema: z.ZodType<EvalSpec> = z\n .object({\n id: z.string().min(1),\n class: z.enum(['plain', 'specific', 'complex']),\n description: z.string().optional(),\n turns: z.tuple([z.string()]).rest(z.string()),\n checks: z.array(EvalCheckSchema),\n expect: z\n .object({\n tiers: z.array(z.enum(EVAL_TIERS)).optional(),\n adopts: z.array(z.string()).optional(),\n orbitals: z.array(z.string()).optional(),\n validates: z.boolean().optional(),\n })\n .strict()\n .optional(),\n forbidSources: z.array(z.string()).optional(),\n })\n .strict()\n .superRefine((spec, ctx) => {\n for (const [i, check] of spec.checks.entries()) {\n if (check.introducedTurn >= spec.turns.length) {\n ctx.addIssue({ code: 'custom', path: ['checks', i, 'introducedTurn'], message: `introducedTurn ${check.introducedTurn} is past the spec's ${spec.turns.length} turns` });\n }\n }\n });\n\n/** Parse an eval spec, throwing with every issue (path + message) when it does not conform. */\nexport function parseEvalSpec(input: JsonValue): EvalSpec {\n const parsed = EvalSpecSchema.safeParse(input);\n if (parsed.success) return parsed.data;\n throw new Error(`invalid eval spec: ${parsed.error.issues.map((i) => `${i.path.join('.') || '(root)'}: ${i.message}`).join('; ')}`);\n}\n\nexport function evalPatternMatches(p: EvalPattern, text: string): boolean {\n return new RegExp(p.pattern, p.flags).test(text);\n}\n","/**\n * The browser-tab host port: what a browser host does for the kernel's `browser/tab-*` effects. The kernel\n * validates every request and shapes every result; the port performs one raw tab or page operation per ask\n * and holds no decision.\n */\nimport type { TabAsk, TabFailureKind } from '../generated/kernel-wire.js';\nimport type { EventPayload } from './expression.js';\nimport type { JsonValue } from './json.js';\n\n/** A raw ask a host could not perform, with the kernel's closed reason. */\nexport class TabHostFailure extends Error {\n constructor(\n readonly kind: TabFailureKind,\n message: string,\n ) {\n super(message);\n this.name = 'TabHostFailure';\n }\n}\n\n/** What one ask comes with: the abort signal of a keyed ask, and the way a watch's elements reach the program. */\nexport interface TabAskContext {\n signal?: AbortSignal;\n /** Dispatches `payload` to the declared external input the watch ask names; a no-op for any other ask. */\n deliver: (payload: EventPayload) => void;\n}\n\nexport interface BrowserTabPort {\n /** Perform one raw ask and resolve its JSON reply (the shape each `TabAsk` documents), or throw a `TabHostFailure`. */\n perform(ask: TabAsk, context: TabAskContext): Promise<JsonValue>;\n}\n\n/** Whether a Chrome match pattern matches a URL: the kernel's one rule (`tabUrlMatches` of `@almadar/kernel`). */\nexport type TabUrlMatcher = (pattern: string, url: string) => boolean;\n","/**\n * What a server hands the program-independent web client at startup (`/client.json`), beside `program.client.orb`:\n * the program's locale and text direction, its themes with the default theme and mode, and whether the kernel's\n * language data ships (`/language.json`). The TypeScript shell writes it for `orb compile` and `orb serve` alike.\n */\nimport { z } from 'zod';\nimport type { JsonValue } from './json.js';\n\nexport const ClientThemeSchema = z\n .object({\n name: z.string().min(1),\n displayName: z.string(),\n hasLightMode: z.boolean(),\n hasDarkMode: z.boolean(),\n })\n .strict();\n\nexport const ClientManifestSchema = z\n .object({\n locale: z.string().min(1),\n direction: z.enum(['ltr', 'rtl']),\n themes: z.array(ClientThemeSchema),\n defaultTheme: z.string().min(1).nullable(),\n defaultMode: z.enum(['light', 'dark']),\n language: z.boolean(),\n })\n .strict();\n\nexport type ClientTheme = z.infer<typeof ClientThemeSchema>;\nexport type ClientManifest = z.infer<typeof ClientManifestSchema>;\n\n/** The manifest, or a throw naming what is wrong with it. */\nexport function parseClientManifest(value: JsonValue): ClientManifest {\n return ClientManifestSchema.parse(value);\n}\n","/**\n * Zod twins of the program reflection records the kernel answers with: a program's state machine as rows\n * (`program/machine` → `MachineRow[]`) and a played request (`program/step` → `PlayedStep[]`). The types are\n * generated from `orbital-core` `program_machine`; these schemas are what `program-types.ts` projects so a `.lolo`\n * program can read them member by member.\n */\nimport { z } from 'zod';\n\nimport type {\n EntityBinding,\n EntityBindingKind,\n EnsuresVerdict,\n EvalStepWire,\n GuardVerdict,\n MachineRow,\n PayloadSlot,\n PlayedEffect,\n PlayedEffectStatus,\n PlayedEmit,\n PlayedEnsures,\n PlayedGuard,\n PlayedResult,\n PlayedState,\n PlayedStep,\n PropositionBindings,\n RenderedNode,\n RenderedSlot,\n TraitRef,\n} from '../generated/kernel-wire.js';\nimport { EventPayloadSchema } from './expression.js';\nimport { JsonValueSchema } from './json.js';\n\nexport type {\n EntityBinding,\n EntityBindingKind,\n EnsuresVerdict,\n GuardVerdict,\n MachineRow,\n PayloadSlot,\n PlayedEffect,\n PlayedEffectStatus,\n PlayedEmit,\n PlayedEnsures,\n PlayedGuard,\n PlayedResult,\n PlayedState,\n PlayedStep,\n PropositionBindings,\n RenderedNode,\n RenderedSlot,\n TraitRef,\n};\n\nexport const PayloadSlotSchema: z.ZodType<PayloadSlot> = z.object({\n name: z.string(),\n type: z.string(),\n required: z.boolean(),\n values: z.array(z.string()).optional(),\n entity: z.string().optional(),\n});\n\nexport const MachineRowSchema: z.ZodType<MachineRow> = z.object({\n orbital: z.string(),\n trait: z.string(),\n from: z.string(),\n event: z.string(),\n to: z.string(),\n guarded: z.boolean(),\n payload: z.array(PayloadSlotSchema),\n});\n\n/** Where a traced evaluation step sits in its expression: indexes and keys, outermost first. */\nexport const EvalPathSchema = z.array(z.union([z.number(), z.string()]));\n\nconst EvalStepWireSchema: z.ZodType<EvalStepWire> = z.object({\n kind: z.enum(['enter', 'exit', 'iter', 'skip']),\n path: EvalPathSchema,\n value: JsonValueSchema.optional(),\n error: z.string().optional(),\n});\n\nconst PlayedEffectSchema: z.ZodType<PlayedEffect> = z.object({\n type: z.string(),\n args: z.array(JsonValueSchema),\n status: z.enum(['executed', 'failed', 'skipped']),\n error: z.string().optional(),\n routed: z.boolean(),\n});\n\nconst PropositionBindingsSchema: z.ZodType<PropositionBindings> = z.object({\n entity: JsonValueSchema,\n fromEntity: JsonValueSchema,\n payload: JsonValueSchema,\n});\n\nconst PlayedEnsuresSchema: z.ZodType<PlayedEnsures> = z.object({\n proposition: JsonValueSchema,\n verdict: z.enum(['held', 'broken', 'inconclusive']),\n reason: z.string().optional(),\n counterexample: PropositionBindingsSchema.optional(),\n});\n\nconst PlayedEmitSchema: z.ZodType<PlayedEmit> = z.object({\n type: z.string(),\n payload: EventPayloadSchema.optional(),\n timestamp: z.number(),\n});\n\nconst PlayedGuardSchema: z.ZodType<PlayedGuard> = z.object({\n arm: z.number(),\n guard: JsonValueSchema,\n passed: z.boolean(),\n trace: z.array(EvalStepWireSchema),\n error: z.string().optional(),\n});\n\nconst EntityBindingSchema: z.ZodType<EntityBinding> = z.object({\n kind: z.enum(['none', 'absent', 'malformed', 'inline', 'named', 'payload-unresolved', 'context-unresolved']),\n entity: z.string(),\n rows: z.number(),\n readGated: z.boolean(),\n});\n\nconst TraitRefSchema: z.ZodType<TraitRef> = z.object({\n name: z.string(),\n resolved: z.boolean(),\n overlayOnly: z.boolean(),\n});\n\nconst RenderedNodeSchema: z.ZodType<RenderedNode> = z.object({\n pattern: z.string(),\n dynamic: z.boolean(),\n supported: z.boolean(),\n stub: z.boolean(),\n binding: EntityBindingSchema,\n traitRefs: z.array(TraitRefSchema),\n});\n\nconst RenderedSlotSchema: z.ZodType<RenderedSlot> = z.object({\n slot: z.string(),\n sourceTrait: z.string(),\n ownerEntity: z.string(),\n nodes: z.array(RenderedNodeSchema),\n});\n\nconst PlayedStateSchema: z.ZodType<PlayedState> = z.object({ before: z.string().nullable(), after: z.string().nullable() });\n\nconst PlayedResultSchema: z.ZodType<PlayedResult> = z.object({\n trait: z.string(),\n event: z.string(),\n transitionFired: z.boolean(),\n guard: z.enum(['pass', 'fail', 'none']),\n firedArm: z.number().optional(),\n state: PlayedStateSchema,\n effects: z.array(PlayedEffectSchema),\n emitted: z.array(PlayedEmitSchema),\n guards: z.array(PlayedGuardSchema),\n ensures: z.array(PlayedEnsuresSchema),\n rendered: z.array(RenderedSlotSchema).optional(),\n});\n\nexport const PlayedStepSchema: z.ZodType<PlayedStep> = z.object({\n orbital: z.string(),\n trait: z.string(),\n from: z.string(),\n event: z.string(),\n payload: EventPayloadSchema,\n result: PlayedResultSchema,\n});\n","import { z } from 'zod';\nimport { JsonValueSchema } from './json.js';\nimport { OrbitalSchemaSchema } from './schema.js';\nimport { SourceDeclarationMetadataSchema } from './trait.js';\n\n// Positions are 1-based Unicode scalars with an exclusive end; length counts original UTF-8 bytes.\nexport const ProgramSourceLocationSchema = z.object({\n path: z.string(),\n line: z.number().int().positive(),\n column: z.number().int().positive(),\n length: z.number().int().nonnegative(),\n endLine: z.number().int().positive(),\n endColumn: z.number().int().positive(),\n exact: z.boolean(),\n scopeEndLine: z.number().int().positive().optional(),\n scopeEndColumn: z.number().int().positive().optional(),\n scopeLength: z.number().int().nonnegative().optional(),\n});\n\nexport const ProgramSourceAnchorSchema = ProgramSourceLocationSchema.extend({\n pointer: z.string(),\n orbitalId: z.string().nullable(),\n traitId: z.string().nullable(),\n originTraitId: z.string(),\n});\n\nexport const ProgramInspectionSchema = z.object({\n program: OrbitalSchemaSchema,\n authoredProgram: OrbitalSchemaSchema,\n definitions: z.array(z.object({\n traitId: z.string(),\n definitionFingerprint: z.string(),\n sourceDeclaration: SourceDeclarationMetadataSchema.extend({ path: z.string().nullable() }).nullable(),\n sourceCandidates: z.array(z.string()),\n })),\n composition: z.array(z.object({ traitId: z.string(), kind: z.enum(['trait-declaration', 'orbital-reference']), authoredPointer: z.string(), traitOverrideKey: z.string().nullable(), binding: JsonValueSchema, source: ProgramSourceLocationSchema.nullable() })),\n sourceMap: z.array(ProgramSourceAnchorSchema),\n imports: z.array(z.object({ path: z.string(), specifier: z.string(), program: z.string(), authoredProgram: OrbitalSchemaSchema })),\n lazy: z.array(JsonValueSchema),\n path: z.string(),\n version: z.number().int().nonnegative().nullable(),\n columnEncoding: z.literal('unicode-scalar'),\n lengthEncoding: z.literal('utf-8-bytes'),\n lineBase: z.literal(1),\n columnBase: z.literal(1),\n});\n\nexport type ProgramSourceLocation = z.infer<typeof ProgramSourceLocationSchema>;\nexport type ProgramSourceAnchor = z.infer<typeof ProgramSourceAnchorSchema>;\nexport type ProgramInspection = z.infer<typeof ProgramInspectionSchema>;\n"]}
|