@almadar/core 10.28.0 → 10.30.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.
@@ -1,5 +1,5 @@
1
- import { A as AnyPatternConfig, b as EntityRow, c as Entity, E as EntityField } from './pattern-types-BeQXwgpZ.js';
2
- import { S as SExpr, E as EventPayload, a as Expression } from './expression-C6X4A8L7.js';
1
+ import { A as AnyPatternConfig, b as EntityRow, c as EventId, T as TraitId, O as OrbitalId, d as EntityId, P as PageId, e as Entity, E as EntityField } from './pattern-types-CLcOXOmW.js';
2
+ import { S as SExpr, E as EventPayload, a as Expression } from './expression-CB9R3KWk.js';
3
3
  import { z } from 'zod';
4
4
 
5
5
  /**
@@ -800,12 +800,23 @@ type RenderUIEffect = ['render-ui', UISlot, AnyPatternConfig] | ['render-ui', UI
800
800
  * @example ["fn", "item", { "type": "stack", "children": [{ "type": "typography", "content": "@item.title" }] }]
801
801
  */
802
802
  type RenderItemLambda = ['fn', string, AnyPatternConfig];
803
+ /**
804
+ * Dynamic-collection children entry: renders one child per item of a collection
805
+ * expression, authored inline in a `children:` position and kept verbatim as IR
806
+ * (no new node kind). The collection expression is an {@link SExpr} evaluated at
807
+ * render time; the {@link RenderItemLambda} body is instantiated per item with
808
+ * the lambda param bound as an `@item`-scope binding. Both execution paths lower
809
+ * onto the one lambda + `@item` + splice machinery.
810
+ *
811
+ * @example ["array/map", "@entity.tasks", ["fn", "item", { "type": "typography", "content": "@item.title" }]]
812
+ */
813
+ type RenderChildrenMap = ['array/map', SExpr, RenderItemLambda];
803
814
  /**
804
815
  * Navigate effect - navigates to an internal page path or an external URL.
805
816
  * @example ['navigate', '/tasks'] or ['navigate', '/tasks/:id', { id: '123' }]
806
817
  * @example ['navigate', 'https://example.com']
807
818
  */
808
- type NavigateEffect = ['navigate', string] | ['navigate', string, Record<string, string>];
819
+ type NavigateEffect = ['navigate', string | SExpr] | ['navigate', string | SExpr, Record<string, string>];
809
820
  /**
810
821
  * Emit effect - emits an event, optionally with payload.
811
822
  * @example ['emit', 'SAVE'] or ['emit', 'PLAYER_DIED', { playerId: '@entity.id' }]
@@ -1147,6 +1158,43 @@ type AgentEffect = [`agent/${string}`, ...SExpr[]];
1147
1158
  * @example ['os/read-file', '/etc/hosts']
1148
1159
  */
1149
1160
  type OsEffect = [`os/${string}`, ...SExpr[]];
1161
+ /**
1162
+ * Browser effect - invokes a browser/* device operator (client host path).
1163
+ * User-initiated, async, resolves via the standard trailing emit envelope.
1164
+ * Concrete operators (browser/open-file-picker, browser/clipboard-read,
1165
+ * browser/clipboard-write, browser/geolocation-current) and their arity /
1166
+ * payload shapes live in @almadar/std BROWSER_OPERATORS.
1167
+ * @example ['browser/open-file-picker', { multiple: false }, { emit: { success: 'FILES_PICKED', failure: 'PICK_CANCELLED' } }]
1168
+ */
1169
+ type BrowserEffect = [`browser/${string}`, ...SExpr[]];
1170
+ /**
1171
+ * LLM effect - invokes an llm/* operator (agent path).
1172
+ * @example ['llm/generate', '@entity.request', { emit: { success: 'PLANNED', failure: 'PLAN_FAILED' } }]
1173
+ */
1174
+ type LlmEffect = [`llm/${string}`, ...SExpr[]];
1175
+ /**
1176
+ * Behavior effect - invokes a behavior/* operator (agent path).
1177
+ * @example ['behavior/instantiate', '@entity.plan', { emit: { failure: 'BUILD_FAILED' } }]
1178
+ */
1179
+ type BehaviorEffect = [`behavior/${string}`, ...SExpr[]];
1180
+ /**
1181
+ * Validate effect - invokes a validate/* operator (agent path).
1182
+ * @example ['validate/validate', '@entity.schema', { emit: { failure: 'INVALID' } }]
1183
+ */
1184
+ type ValidateEffect = [`validate/${string}`, ...SExpr[]];
1185
+ /**
1186
+ * Remaining agent-path operator effects: session/* (workspace session ops),
1187
+ * compose/* (schema composition), trace/* (trace emission), memory/*
1188
+ * (agent memory), application/* (app lifecycle). Expression-only namespaces
1189
+ * (array/, math/, object/, str/, …) are deliberately NOT effect heads.
1190
+ * @example ['session/write-spec', '@entity.spec']
1191
+ * @example ['compose/compose-all', { emit: { failure: 'COMPOSE_FAILED' } }]
1192
+ */
1193
+ type SessionEffect = [`session/${string}`, ...SExpr[]];
1194
+ type ComposeEffect = [`compose/${string}`, ...SExpr[]];
1195
+ type TraceEffect = [`trace/${string}`, ...SExpr[]];
1196
+ type MemoryEffect = [`memory/${string}`, ...SExpr[]];
1197
+ type ApplicationEffect = [`application/${string}`, ...SExpr[]];
1150
1198
  /**
1151
1199
  * Async delay effect - wait then execute effects.
1152
1200
  * @example ['async/delay', 2000, ['emit', 'TIMEOUT']]
@@ -1189,7 +1237,7 @@ type AsyncSequenceEffect = ['async/sequence', ...Effect[]];
1189
1237
  * Union of all typed effects.
1190
1238
  * Provides compile-time validation for common effect types.
1191
1239
  */
1192
- type TypedEffect = RenderUIEffect | NavigateEffect | EmitEffect | SetEffect | PersistEffect | CallServiceEffect | SpawnEffect | DespawnEffect | DoEffect | NotifyEffect | FetchEffect | IfEffect | WhenEffect | LetEffect | LogEffect | WaitEffect | RefEffect | DerefEffect | SwapEffect | WatchEffect | AtomicEffect | AsyncDelayEffect | AsyncDebounceEffect | AsyncThrottleEffect | AsyncIntervalEffect | AsyncRaceEffect | AsyncAllEffect | AsyncSequenceEffect | ForwardEffect | TrainEffect | EvaluateEffect | CheckpointSaveEffect | CheckpointLoadEffect | AgentEffect | OsEffect;
1240
+ type TypedEffect = RenderUIEffect | NavigateEffect | EmitEffect | SetEffect | PersistEffect | CallServiceEffect | SpawnEffect | DespawnEffect | DoEffect | NotifyEffect | FetchEffect | IfEffect | WhenEffect | LetEffect | LogEffect | WaitEffect | RefEffect | DerefEffect | SwapEffect | WatchEffect | AtomicEffect | AsyncDelayEffect | AsyncDebounceEffect | AsyncThrottleEffect | AsyncIntervalEffect | AsyncRaceEffect | AsyncAllEffect | AsyncSequenceEffect | ForwardEffect | TrainEffect | EvaluateEffect | CheckpointSaveEffect | CheckpointLoadEffect | AgentEffect | OsEffect | BrowserEffect | LlmEffect | BehaviorEffect | ValidateEffect | SessionEffect | ComposeEffect | TraceEffect | MemoryEffect | ApplicationEffect;
1193
1241
  /**
1194
1242
  * Effect type - typed S-expression format.
1195
1243
  *
@@ -1396,7 +1444,10 @@ interface ResolvedPatternProps {
1396
1444
  interface RenderUINode {
1397
1445
  type: string;
1398
1446
  props?: ResolvedPatternProps;
1399
- children?: RenderUINode[];
1447
+ /** Static child nodes and/or dynamic-collection map entries. A
1448
+ * {@link RenderChildrenMap} entry expands at render time into resolved
1449
+ * `RenderUINode`s, so components always receive a flat, fully-resolved list. */
1450
+ children?: Array<RenderUINode | RenderChildrenMap>;
1400
1451
  content?: string;
1401
1452
  entity?: string;
1402
1453
  renderItem?: RenderUINode;
@@ -1460,26 +1511,18 @@ interface PayloadField {
1460
1511
  */
1461
1512
  type: string;
1462
1513
  required?: boolean;
1514
+ /** Structured property schema for object-typed payload fields (recursive). */
1515
+ properties?: ReadonlyArray<PayloadField>;
1463
1516
  }
1464
- declare const PayloadFieldSchema: z.ZodObject<{
1465
- name: z.ZodString;
1466
- type: z.ZodString;
1467
- required: z.ZodOptional<z.ZodBoolean>;
1468
- }, "strip", z.ZodTypeAny, {
1469
- type: string;
1470
- name: string;
1471
- required?: boolean | undefined;
1472
- }, {
1473
- type: string;
1474
- name: string;
1475
- required?: boolean | undefined;
1476
- }>;
1517
+ declare const PayloadFieldSchema: z.ZodType<PayloadField>;
1477
1518
  /**
1478
1519
  * Represents an event that can trigger transitions
1479
1520
  */
1480
1521
  interface Event {
1481
1522
  /** Event key (UPPER_SNAKE_CASE) */
1482
1523
  key: string;
1524
+ /** V4 dual-carry id sibling of `key` — optional until the Phase-7 flip. */
1525
+ id?: EventId;
1483
1526
  /** Human-readable name */
1484
1527
  name: string;
1485
1528
  /** Description (authored `@description` on the emit/listen). */
@@ -1498,49 +1541,32 @@ interface Event {
1498
1541
  }
1499
1542
  declare const EventSchema: z.ZodObject<{
1500
1543
  key: z.ZodString;
1544
+ id: z.ZodOptional<z.ZodEffects<z.ZodString, EventId, string>>;
1501
1545
  name: z.ZodString;
1502
1546
  description: z.ZodOptional<z.ZodString>;
1503
1547
  synonyms: z.ZodOptional<z.ZodString>;
1504
1548
  tier: z.ZodOptional<z.ZodString>;
1505
- payloadSchema: z.ZodOptional<z.ZodArray<z.ZodObject<{
1506
- name: z.ZodString;
1507
- type: z.ZodString;
1508
- required: z.ZodOptional<z.ZodBoolean>;
1509
- }, "strip", z.ZodTypeAny, {
1510
- type: string;
1511
- name: string;
1512
- required?: boolean | undefined;
1513
- }, {
1514
- type: string;
1515
- name: string;
1516
- required?: boolean | undefined;
1517
- }>, "many">>;
1549
+ payloadSchema: z.ZodOptional<z.ZodArray<z.ZodType<PayloadField, z.ZodTypeDef, PayloadField>, "many">>;
1518
1550
  classification: z.ZodOptional<z.ZodEnum<["domain", "system"]>>;
1519
1551
  semanticRole: z.ZodOptional<z.ZodString>;
1520
1552
  }, "strip", z.ZodTypeAny, {
1521
1553
  name: string;
1522
1554
  key: string;
1555
+ id?: EventId | undefined;
1523
1556
  description?: string | undefined;
1524
1557
  synonyms?: string | undefined;
1525
1558
  tier?: string | undefined;
1526
- payloadSchema?: {
1527
- type: string;
1528
- name: string;
1529
- required?: boolean | undefined;
1530
- }[] | undefined;
1559
+ payloadSchema?: PayloadField[] | undefined;
1531
1560
  classification?: "domain" | "system" | undefined;
1532
1561
  semanticRole?: string | undefined;
1533
1562
  }, {
1534
1563
  name: string;
1535
1564
  key: string;
1565
+ id?: string | undefined;
1536
1566
  description?: string | undefined;
1537
1567
  synonyms?: string | undefined;
1538
1568
  tier?: string | undefined;
1539
- payloadSchema?: {
1540
- type: string;
1541
- name: string;
1542
- required?: boolean | undefined;
1543
- }[] | undefined;
1569
+ payloadSchema?: PayloadField[] | undefined;
1544
1570
  classification?: "domain" | "system" | undefined;
1545
1571
  semanticRole?: string | undefined;
1546
1572
  }>;
@@ -1597,6 +1623,8 @@ interface Transition {
1597
1623
  to: string;
1598
1624
  /** Event key that triggers this transition */
1599
1625
  event: string;
1626
+ /** V4 dual-carry id sibling of `event` — optional until the Phase-7 flip. */
1627
+ eventId?: EventId;
1600
1628
  /** Guard expression - S-expression array */
1601
1629
  guard?: Expression | null;
1602
1630
  /** Effects to execute - S-expression arrays */
@@ -1608,6 +1636,7 @@ declare const TransitionSchema: z.ZodObject<{
1608
1636
  from: z.ZodString;
1609
1637
  to: z.ZodString;
1610
1638
  event: z.ZodString;
1639
+ eventId: z.ZodOptional<z.ZodEffects<z.ZodString, EventId, string>>;
1611
1640
  guard: z.ZodOptional<z.ZodNullable<z.ZodType<SExpr, z.ZodTypeDef, SExpr>>>;
1612
1641
  effects: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodArray<z.ZodUnknown, "many">, unknown[], unknown[]>, "many">>;
1613
1642
  description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -1616,6 +1645,7 @@ declare const TransitionSchema: z.ZodObject<{
1616
1645
  from: string;
1617
1646
  to: string;
1618
1647
  description?: string | null | undefined;
1648
+ eventId?: EventId | undefined;
1619
1649
  guard?: SExpr | undefined;
1620
1650
  effects?: unknown[][] | undefined;
1621
1651
  }, {
@@ -1623,6 +1653,7 @@ declare const TransitionSchema: z.ZodObject<{
1623
1653
  from: string;
1624
1654
  to: string;
1625
1655
  description?: string | null | undefined;
1656
+ eventId?: string | undefined;
1626
1657
  guard?: SExpr | undefined;
1627
1658
  effects?: unknown[][] | undefined;
1628
1659
  }>;
@@ -1667,49 +1698,32 @@ declare const StateMachineSchema: z.ZodObject<{
1667
1698
  }>, "many">;
1668
1699
  events: z.ZodArray<z.ZodObject<{
1669
1700
  key: z.ZodString;
1701
+ id: z.ZodOptional<z.ZodEffects<z.ZodString, EventId, string>>;
1670
1702
  name: z.ZodString;
1671
1703
  description: z.ZodOptional<z.ZodString>;
1672
1704
  synonyms: z.ZodOptional<z.ZodString>;
1673
1705
  tier: z.ZodOptional<z.ZodString>;
1674
- payloadSchema: z.ZodOptional<z.ZodArray<z.ZodObject<{
1675
- name: z.ZodString;
1676
- type: z.ZodString;
1677
- required: z.ZodOptional<z.ZodBoolean>;
1678
- }, "strip", z.ZodTypeAny, {
1679
- type: string;
1680
- name: string;
1681
- required?: boolean | undefined;
1682
- }, {
1683
- type: string;
1684
- name: string;
1685
- required?: boolean | undefined;
1686
- }>, "many">>;
1706
+ payloadSchema: z.ZodOptional<z.ZodArray<z.ZodType<PayloadField, z.ZodTypeDef, PayloadField>, "many">>;
1687
1707
  classification: z.ZodOptional<z.ZodEnum<["domain", "system"]>>;
1688
1708
  semanticRole: z.ZodOptional<z.ZodString>;
1689
1709
  }, "strip", z.ZodTypeAny, {
1690
1710
  name: string;
1691
1711
  key: string;
1712
+ id?: EventId | undefined;
1692
1713
  description?: string | undefined;
1693
1714
  synonyms?: string | undefined;
1694
1715
  tier?: string | undefined;
1695
- payloadSchema?: {
1696
- type: string;
1697
- name: string;
1698
- required?: boolean | undefined;
1699
- }[] | undefined;
1716
+ payloadSchema?: PayloadField[] | undefined;
1700
1717
  classification?: "domain" | "system" | undefined;
1701
1718
  semanticRole?: string | undefined;
1702
1719
  }, {
1703
1720
  name: string;
1704
1721
  key: string;
1722
+ id?: string | undefined;
1705
1723
  description?: string | undefined;
1706
1724
  synonyms?: string | undefined;
1707
1725
  tier?: string | undefined;
1708
- payloadSchema?: {
1709
- type: string;
1710
- name: string;
1711
- required?: boolean | undefined;
1712
- }[] | undefined;
1726
+ payloadSchema?: PayloadField[] | undefined;
1713
1727
  classification?: "domain" | "system" | undefined;
1714
1728
  semanticRole?: string | undefined;
1715
1729
  }>, "many">;
@@ -1717,6 +1731,7 @@ declare const StateMachineSchema: z.ZodObject<{
1717
1731
  from: z.ZodString;
1718
1732
  to: z.ZodString;
1719
1733
  event: z.ZodString;
1734
+ eventId: z.ZodOptional<z.ZodEffects<z.ZodString, EventId, string>>;
1720
1735
  guard: z.ZodOptional<z.ZodNullable<z.ZodType<SExpr, z.ZodTypeDef, SExpr>>>;
1721
1736
  effects: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodArray<z.ZodUnknown, "many">, unknown[], unknown[]>, "many">>;
1722
1737
  description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -1725,6 +1740,7 @@ declare const StateMachineSchema: z.ZodObject<{
1725
1740
  from: string;
1726
1741
  to: string;
1727
1742
  description?: string | null | undefined;
1743
+ eventId?: EventId | undefined;
1728
1744
  guard?: SExpr | undefined;
1729
1745
  effects?: unknown[][] | undefined;
1730
1746
  }, {
@@ -1732,6 +1748,7 @@ declare const StateMachineSchema: z.ZodObject<{
1732
1748
  from: string;
1733
1749
  to: string;
1734
1750
  description?: string | null | undefined;
1751
+ eventId?: string | undefined;
1735
1752
  guard?: SExpr | undefined;
1736
1753
  effects?: unknown[][] | undefined;
1737
1754
  }>, "many">;
@@ -1752,14 +1769,11 @@ declare const StateMachineSchema: z.ZodObject<{
1752
1769
  events: {
1753
1770
  name: string;
1754
1771
  key: string;
1772
+ id?: EventId | undefined;
1755
1773
  description?: string | undefined;
1756
1774
  synonyms?: string | undefined;
1757
1775
  tier?: string | undefined;
1758
- payloadSchema?: {
1759
- type: string;
1760
- name: string;
1761
- required?: boolean | undefined;
1762
- }[] | undefined;
1776
+ payloadSchema?: PayloadField[] | undefined;
1763
1777
  classification?: "domain" | "system" | undefined;
1764
1778
  semanticRole?: string | undefined;
1765
1779
  }[];
@@ -1777,6 +1791,7 @@ declare const StateMachineSchema: z.ZodObject<{
1777
1791
  from: string;
1778
1792
  to: string;
1779
1793
  description?: string | null | undefined;
1794
+ eventId?: EventId | undefined;
1780
1795
  guard?: SExpr | undefined;
1781
1796
  effects?: unknown[][] | undefined;
1782
1797
  }[];
@@ -1789,14 +1804,11 @@ declare const StateMachineSchema: z.ZodObject<{
1789
1804
  events: {
1790
1805
  name: string;
1791
1806
  key: string;
1807
+ id?: string | undefined;
1792
1808
  description?: string | undefined;
1793
1809
  synonyms?: string | undefined;
1794
1810
  tier?: string | undefined;
1795
- payloadSchema?: {
1796
- type: string;
1797
- name: string;
1798
- required?: boolean | undefined;
1799
- }[] | undefined;
1811
+ payloadSchema?: PayloadField[] | undefined;
1800
1812
  classification?: "domain" | "system" | undefined;
1801
1813
  semanticRole?: string | undefined;
1802
1814
  }[];
@@ -1814,6 +1826,7 @@ declare const StateMachineSchema: z.ZodObject<{
1814
1826
  from: string;
1815
1827
  to: string;
1816
1828
  description?: string | null | undefined;
1829
+ eventId?: string | undefined;
1817
1830
  guard?: SExpr | undefined;
1818
1831
  effects?: unknown[][] | undefined;
1819
1832
  }[];
@@ -1890,6 +1903,23 @@ type CallSiteConfig = Readonly<Record<string, CallSiteConfigEntry>>;
1890
1903
  * not a `FieldDefinition`).
1891
1904
  */
1892
1905
  declare function isCallSiteConfigDeclaration(entry: CallSiteConfigEntry): entry is ConfigFieldDeclaration;
1906
+ /**
1907
+ * Convert a call-site config map into plain runtime values.
1908
+ *
1909
+ * A `CallSiteConfig` may contain either plain wiring values
1910
+ * (`TraitConfigValue`) or annotated `ConfigFieldDeclaration` objects
1911
+ * (`{ type, default, label, ... }`). Both the JS interpreter
1912
+ * (`@almadar/runtime`) and the render substrate (`@almadar/ui`) need this
1913
+ * extraction, so it lives here — the most-upstream package they share —
1914
+ * rather than being duplicated in each.
1915
+ *
1916
+ * A declared field with no `default` yields no value (dropped) — mirroring
1917
+ * `collectDeclaredConfigDefaults`. Leaking such a schema object through as a
1918
+ * value made `@config.leftIcon` resolve to `{ type: "icon", … }`, which the
1919
+ * render substrate then mounted as an element and passed to `Input`'s icon
1920
+ * slot → "Element type is invalid: got <SlotContentRenderer />".
1921
+ */
1922
+ declare function normalizeCallSiteConfigToValues(config: CallSiteConfig | undefined): TraitConfig | undefined;
1893
1923
  /**
1894
1924
  * Per-field entry in a trait's DECLARED `config { }` schema as it lives
1895
1925
  * on the `.orb` JSON: `{ type: "string" | "[string]" | "object" | ...,
@@ -1904,9 +1934,31 @@ declare function isCallSiteConfigDeclaration(entry: CallSiteConfigEntry): entry
1904
1934
  * the enum member list through lowering — consumed by config-driven UI
1905
1935
  * (e.g. the playground property inspector) to render typed controls.
1906
1936
  */
1937
+ /**
1938
+ * The reference config-field types (V4-W5). A config knob typed `entity`,
1939
+ * `trait`, or `event` holds a REFERENCE (an entity/trait/event name), not a
1940
+ * plain value — so the stamp records the referenced node's id on the field
1941
+ * (`ConfigFieldDeclaration.refId`) and both execution paths resolve the value to
1942
+ * the node's CURRENT name by id, exactly like `entityRefIds`/`traitEmbedIds`.
1943
+ * This is the deterministic, source-tagged contract that lets a declaration-only
1944
+ * rename flow through a config value without any name-scanning heuristic.
1945
+ */
1946
+ declare const REFERENCE_CONFIG_TYPES: readonly ["entity", "trait", "event"];
1947
+ type ReferenceConfigType = (typeof REFERENCE_CONFIG_TYPES)[number];
1948
+ /** True when a config field's `type` marks its value as an entity/trait/event reference. */
1949
+ declare function isReferenceConfigType(type: string): type is ReferenceConfigType;
1907
1950
  interface ConfigFieldDeclaration {
1908
1951
  readonly type: string;
1909
1952
  readonly default?: TraitConfigValue;
1953
+ /**
1954
+ * V4-W5 dual-carry id — set by the stamp when `type` is a reference config
1955
+ * type (`entity`/`trait`/`event`): the stable id of the entity/trait/event
1956
+ * the field's value names. Readers resolve the value to that node's current
1957
+ * name by id (rename-proof); absent for non-reference fields.
1958
+ */
1959
+ readonly refId?: string;
1960
+ /** 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. */
1961
+ readonly required?: boolean;
1910
1962
  /** `@label` — human-readable control label. */
1911
1963
  readonly label?: string;
1912
1964
  /** `@description` — help/tooltip text for the field. */
@@ -1917,6 +1969,17 @@ interface ConfigFieldDeclaration {
1917
1969
  readonly values?: ReadonlyArray<string>;
1918
1970
  /** `@synonyms` — comma-separated vocabulary synonyms (metadata). */
1919
1971
  readonly synonyms?: string;
1972
+ /** Structured per-item schema for array-of-object fields — `edges : [{from: string!, …}]` in `.lolo` lowers to `{ type: "object", properties: {…} }`. */
1973
+ readonly items?: ConfigFieldItemsDeclaration;
1974
+ /** Structured property schema for object-typed config fields (no items wrapper). */
1975
+ readonly properties?: Readonly<Record<string, TraitEntityField>>;
1976
+ }
1977
+ interface ConfigFieldItemsDeclaration {
1978
+ readonly type?: string;
1979
+ /** Absent for arrays of scalars (`items: { type: "string" }`). */
1980
+ readonly properties?: Readonly<Record<string, TraitEntityField>>;
1981
+ /** Nested per-item schema for arrays of arrays (recursive). */
1982
+ readonly items?: ConfigFieldItemsDeclaration;
1920
1983
  }
1921
1984
  declare const ConfigFieldDeclarationSchema: z.ZodType<ConfigFieldDeclaration>;
1922
1985
  /**
@@ -1944,26 +2007,12 @@ interface TraitEntityField {
1944
2007
  required?: boolean;
1945
2008
  default?: unknown;
1946
2009
  values?: string[];
2010
+ /** Structured per-item schema for array-of-object fields (recursive). */
2011
+ items?: ConfigFieldItemsDeclaration;
2012
+ /** Structured property schema for object-typed entity fields. */
2013
+ properties?: Readonly<Record<string, TraitEntityField>>;
1947
2014
  }
1948
- declare const TraitEntityFieldSchema: z.ZodObject<{
1949
- name: z.ZodString;
1950
- type: z.ZodEnum<["string", "number", "boolean", "date", "array", "object", "timestamp", "datetime", "enum"]>;
1951
- required: z.ZodOptional<z.ZodBoolean>;
1952
- default: z.ZodOptional<z.ZodUnknown>;
1953
- values: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1954
- }, "strip", z.ZodTypeAny, {
1955
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
1956
- name: string;
1957
- values?: string[] | undefined;
1958
- required?: boolean | undefined;
1959
- default?: unknown;
1960
- }, {
1961
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
1962
- name: string;
1963
- values?: string[] | undefined;
1964
- required?: boolean | undefined;
1965
- default?: unknown;
1966
- }>;
2015
+ declare const TraitEntityFieldSchema: z.ZodType<TraitEntityField>;
1967
2016
  /**
1968
2017
  * Simplified data entity for traits
1969
2018
  */
@@ -1980,25 +2029,7 @@ interface TraitDataEntity {
1980
2029
  declare const TraitDataEntitySchema: z.ZodObject<{
1981
2030
  name: z.ZodString;
1982
2031
  collection: z.ZodOptional<z.ZodString>;
1983
- fields: z.ZodArray<z.ZodObject<{
1984
- name: z.ZodString;
1985
- type: z.ZodEnum<["string", "number", "boolean", "date", "array", "object", "timestamp", "datetime", "enum"]>;
1986
- required: z.ZodOptional<z.ZodBoolean>;
1987
- default: z.ZodOptional<z.ZodUnknown>;
1988
- values: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1989
- }, "strip", z.ZodTypeAny, {
1990
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
1991
- name: string;
1992
- values?: string[] | undefined;
1993
- required?: boolean | undefined;
1994
- default?: unknown;
1995
- }, {
1996
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
1997
- name: string;
1998
- values?: string[] | undefined;
1999
- required?: boolean | undefined;
2000
- default?: unknown;
2001
- }>, "many">;
2032
+ fields: z.ZodArray<z.ZodType<TraitEntityField, z.ZodTypeDef, TraitEntityField>, "many">;
2002
2033
  timestamps: z.ZodOptional<z.ZodBoolean>;
2003
2034
  description: z.ZodOptional<z.ZodString>;
2004
2035
  runtime: z.ZodOptional<z.ZodBoolean>;
@@ -2006,13 +2037,7 @@ declare const TraitDataEntitySchema: z.ZodObject<{
2006
2037
  pages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2007
2038
  }, "strip", z.ZodTypeAny, {
2008
2039
  name: string;
2009
- fields: {
2010
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
2011
- name: string;
2012
- values?: string[] | undefined;
2013
- required?: boolean | undefined;
2014
- default?: unknown;
2015
- }[];
2040
+ fields: TraitEntityField[];
2016
2041
  description?: string | undefined;
2017
2042
  runtime?: boolean | undefined;
2018
2043
  collection?: string | undefined;
@@ -2021,13 +2046,7 @@ declare const TraitDataEntitySchema: z.ZodObject<{
2021
2046
  singleton?: boolean | undefined;
2022
2047
  }, {
2023
2048
  name: string;
2024
- fields: {
2025
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
2026
- name: string;
2027
- values?: string[] | undefined;
2028
- required?: boolean | undefined;
2029
- default?: unknown;
2030
- }[];
2049
+ fields: TraitEntityField[];
2031
2050
  description?: string | undefined;
2032
2051
  runtime?: boolean | undefined;
2033
2052
  collection?: string | undefined;
@@ -2047,6 +2066,8 @@ interface TraitTick {
2047
2066
  interval: string | number;
2048
2067
  appliesTo?: string[];
2049
2068
  pages?: string[];
2069
+ /** V4 dual-carry id sibling of `pages` — optional until the Phase-7 flip. */
2070
+ pageIds?: PageId[];
2050
2071
  /** Guard expression - string (legacy) or S-expression array */
2051
2072
  guard?: Expression;
2052
2073
  /** Effects to execute (S-expressions) */
@@ -2057,6 +2078,8 @@ interface TraitTick {
2057
2078
  * Used for validation and documentation.
2058
2079
  */
2059
2080
  emits?: string[];
2081
+ /** V4 dual-carry id sibling of `emits` — optional until the Phase-7 flip. */
2082
+ emitIds?: EventId[];
2060
2083
  }
2061
2084
  declare const TraitTickSchema: z.ZodObject<{
2062
2085
  name: z.ZodString;
@@ -2065,9 +2088,11 @@ declare const TraitTickSchema: z.ZodObject<{
2065
2088
  interval: z.ZodUnion<[z.ZodLiteral<"frame">, z.ZodNumber]>;
2066
2089
  appliesTo: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2067
2090
  pages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2091
+ pageIds: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, PageId, string>, "many">>;
2068
2092
  guard: z.ZodOptional<z.ZodType<SExpr, z.ZodTypeDef, SExpr>>;
2069
2093
  effects: z.ZodArray<z.ZodEffects<z.ZodArray<z.ZodUnknown, "many">, unknown[], unknown[]>, "many">;
2070
2094
  emits: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2095
+ emitIds: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, EventId, string>, "many">>;
2071
2096
  }, "strip", z.ZodTypeAny, {
2072
2097
  name: string;
2073
2098
  effects: unknown[][];
@@ -2077,7 +2102,9 @@ declare const TraitTickSchema: z.ZodObject<{
2077
2102
  guard?: SExpr | undefined;
2078
2103
  priority?: number | undefined;
2079
2104
  appliesTo?: string[] | undefined;
2105
+ pageIds?: PageId[] | undefined;
2080
2106
  emits?: string[] | undefined;
2107
+ emitIds?: EventId[] | undefined;
2081
2108
  }, {
2082
2109
  name: string;
2083
2110
  effects: unknown[][];
@@ -2087,7 +2114,9 @@ declare const TraitTickSchema: z.ZodObject<{
2087
2114
  guard?: SExpr | undefined;
2088
2115
  priority?: number | undefined;
2089
2116
  appliesTo?: string[] | undefined;
2117
+ pageIds?: string[] | undefined;
2090
2118
  emits?: string[] | undefined;
2119
+ emitIds?: string[] | undefined;
2091
2120
  }>;
2092
2121
  /**
2093
2122
  * Event scope determines visibility:
@@ -2121,36 +2150,10 @@ interface EventPayloadField {
2121
2150
  description?: string;
2122
2151
  /** For 'entity' type: the entity type name */
2123
2152
  entityType?: string;
2153
+ /** Structured property schema for object-typed payload fields (recursive). */
2154
+ properties?: ReadonlyArray<EventPayloadField>;
2124
2155
  }
2125
- declare const EventPayloadFieldSchema: z.ZodObject<{
2126
- name: z.ZodString;
2127
- /**
2128
- * Field type. Mirrors the Rust validator's acceptance: any non-empty
2129
- * string. Primitives ('string' | 'number' | 'boolean' | 'object' |
2130
- * 'array') are the canonical values; entity-name references like
2131
- * 'ModalRecord' and array-of-entity references like '[ModalRecord]'
2132
- * are also valid because the Rust IR's PayloadField.field_type is
2133
- * just a String. Only enforced narrowly at the call site (e.g.
2134
- * emit-literal type-mismatch warnings in
2135
- * orbital-compiler/phases/validation/emit_payload.rs) — not here.
2136
- */
2137
- type: z.ZodString;
2138
- required: z.ZodOptional<z.ZodBoolean>;
2139
- description: z.ZodOptional<z.ZodString>;
2140
- entityType: z.ZodOptional<z.ZodString>;
2141
- }, "strip", z.ZodTypeAny, {
2142
- type: string;
2143
- name: string;
2144
- required?: boolean | undefined;
2145
- description?: string | undefined;
2146
- entityType?: string | undefined;
2147
- }, {
2148
- type: string;
2149
- name: string;
2150
- required?: boolean | undefined;
2151
- description?: string | undefined;
2152
- entityType?: string | undefined;
2153
- }>;
2156
+ declare const EventPayloadFieldSchema: z.ZodType<EventPayloadField>;
2154
2157
  /**
2155
2158
  * Event contract for events a trait emits.
2156
2159
  * Declares the event name, scope, and payload schema.
@@ -2158,6 +2161,8 @@ declare const EventPayloadFieldSchema: z.ZodObject<{
2158
2161
  interface TraitEventContract {
2159
2162
  /** Event name (UPPER_SNAKE_CASE) */
2160
2163
  event: string;
2164
+ /** V4 dual-carry id sibling of `event` — optional until the Phase-7 flip. */
2165
+ eventId?: EventId;
2161
2166
  /** Human-readable description */
2162
2167
  description?: string;
2163
2168
  /** User-vocabulary synonyms (comma-separated) — the per-event analogue of a
@@ -2176,47 +2181,49 @@ interface TraitEventContract {
2176
2181
  */
2177
2182
  scope?: EventScope;
2178
2183
  }
2184
+ /**
2185
+ * `@config.<knob>` is the only legal reference form for an emit/listen
2186
+ * event name (Option B — the declared event name resolves to a
2187
+ * string-typed config knob's value at inline/resolve time). Matches the
2188
+ * Rust lexer's dotted-sigil body (`config.<ident>`, no further dots).
2189
+ */
2190
+ declare const CONFIG_REF_EVENT_PATTERN: RegExp;
2191
+ /** Returns the knob identifier when `event` is a `@config.<knob>` reference, else `undefined`. */
2192
+ declare function configRefEventKnob(event: string): string | undefined;
2193
+ /** Why a `@config.<knob>` emit/listen event-name reference failed to resolve. */
2194
+ type ConfigRefEventError = 'unknown-knob' | 'not-string' | 'no-default';
2195
+ /**
2196
+ * Resolve a `@config.<knob>` emit/listen event-name reference to its
2197
+ * concrete literal, given the trait's declared config schema and the
2198
+ * effective config value map (call-site override folded over declared
2199
+ * default — same precedence the Rust inline phase's `effective_config`
2200
+ * uses). The single JS-side owner of this resolution rule; mirrors
2201
+ * `resolve_config_ref_event_name` in `orbital-core::schema` (Rust).
2202
+ * Returns the resolved literal, or the specific contract clause that failed.
2203
+ */
2204
+ declare function resolveConfigRefEventName(event: string, declaredConfig: DeclaredTraitConfig | undefined, effectiveConfig: Readonly<Record<string, TraitConfigValue>>): {
2205
+ readonly ok: true;
2206
+ readonly value: string;
2207
+ } | {
2208
+ readonly ok: false;
2209
+ readonly error: ConfigRefEventError;
2210
+ };
2179
2211
  declare const TraitEventContractSchema: z.ZodObject<{
2180
2212
  /**
2181
2213
  * Event name. Mirrors the Rust validator's `is_valid_event_identifier`:
2182
2214
  * starts with a letter, then any letters / digits / underscores. Both
2183
2215
  * UPPER_SNAKE_CASE and PascalCase shapes are valid identifiers in the
2184
2216
  * post-Phase 2.5 nominal-event type system (events declared via
2185
- * `type X = Event<T>`).
2217
+ * `type X = Event<T>`). A pre-resolution `@config.<knob>` reference
2218
+ * (Option B) is also legal — inline/resolve substitutes it with the
2219
+ * knob's effective literal before codegen/runtime consume it.
2186
2220
  */
2187
2221
  event: z.ZodString;
2222
+ eventId: z.ZodOptional<z.ZodEffects<z.ZodString, EventId, string>>;
2188
2223
  description: z.ZodOptional<z.ZodString>;
2189
2224
  synonyms: z.ZodOptional<z.ZodString>;
2190
2225
  tier: z.ZodOptional<z.ZodString>;
2191
- payloadSchema: z.ZodOptional<z.ZodArray<z.ZodObject<{
2192
- name: z.ZodString;
2193
- /**
2194
- * Field type. Mirrors the Rust validator's acceptance: any non-empty
2195
- * string. Primitives ('string' | 'number' | 'boolean' | 'object' |
2196
- * 'array') are the canonical values; entity-name references like
2197
- * 'ModalRecord' and array-of-entity references like '[ModalRecord]'
2198
- * are also valid because the Rust IR's PayloadField.field_type is
2199
- * just a String. Only enforced narrowly at the call site (e.g.
2200
- * emit-literal type-mismatch warnings in
2201
- * orbital-compiler/phases/validation/emit_payload.rs) — not here.
2202
- */
2203
- type: z.ZodString;
2204
- required: z.ZodOptional<z.ZodBoolean>;
2205
- description: z.ZodOptional<z.ZodString>;
2206
- entityType: z.ZodOptional<z.ZodString>;
2207
- }, "strip", z.ZodTypeAny, {
2208
- type: string;
2209
- name: string;
2210
- required?: boolean | undefined;
2211
- description?: string | undefined;
2212
- entityType?: string | undefined;
2213
- }, {
2214
- type: string;
2215
- name: string;
2216
- required?: boolean | undefined;
2217
- description?: string | undefined;
2218
- entityType?: string | undefined;
2219
- }>, "many">>;
2226
+ payloadSchema: z.ZodOptional<z.ZodArray<z.ZodType<EventPayloadField, z.ZodTypeDef, EventPayloadField>, "many">>;
2220
2227
  scope: z.ZodOptional<z.ZodEnum<["internal", "external"]>>;
2221
2228
  }, "strip", z.ZodTypeAny, {
2222
2229
  event: string;
@@ -2224,26 +2231,16 @@ declare const TraitEventContractSchema: z.ZodObject<{
2224
2231
  synonyms?: string | undefined;
2225
2232
  scope?: "internal" | "external" | undefined;
2226
2233
  tier?: string | undefined;
2227
- payloadSchema?: {
2228
- type: string;
2229
- name: string;
2230
- required?: boolean | undefined;
2231
- description?: string | undefined;
2232
- entityType?: string | undefined;
2233
- }[] | undefined;
2234
+ payloadSchema?: EventPayloadField[] | undefined;
2235
+ eventId?: EventId | undefined;
2234
2236
  }, {
2235
2237
  event: string;
2236
2238
  description?: string | undefined;
2237
2239
  synonyms?: string | undefined;
2238
2240
  scope?: "internal" | "external" | undefined;
2239
2241
  tier?: string | undefined;
2240
- payloadSchema?: {
2241
- type: string;
2242
- name: string;
2243
- required?: boolean | undefined;
2244
- description?: string | undefined;
2245
- entityType?: string | undefined;
2246
- }[] | undefined;
2242
+ payloadSchema?: EventPayloadField[] | undefined;
2243
+ eventId?: string | undefined;
2247
2244
  }>;
2248
2245
  /**
2249
2246
  * Event listener for trait communication.
@@ -2268,10 +2265,16 @@ type ListenSource = {
2268
2265
  } | {
2269
2266
  kind: 'trait';
2270
2267
  trait: string;
2268
+ /** V4 dual-carry id sibling of `trait` — optional until the Phase-7 flip. */
2269
+ traitId?: TraitId;
2271
2270
  } | {
2272
2271
  kind: 'orbital';
2273
2272
  orbital: string;
2274
2273
  trait: string;
2274
+ /** V4 dual-carry id sibling of `orbital` — optional until the Phase-7 flip. */
2275
+ orbitalId?: OrbitalId;
2276
+ /** V4 dual-carry id sibling of `trait` — optional until the Phase-7 flip. */
2277
+ traitId?: TraitId;
2275
2278
  };
2276
2279
  declare const ListenSourceSchema: z.ZodUnion<[z.ZodObject<{
2277
2280
  kind: z.ZodLiteral<"any">;
@@ -2282,30 +2285,43 @@ declare const ListenSourceSchema: z.ZodUnion<[z.ZodObject<{
2282
2285
  }>, z.ZodObject<{
2283
2286
  kind: z.ZodLiteral<"trait">;
2284
2287
  trait: z.ZodString;
2288
+ traitId: z.ZodOptional<z.ZodEffects<z.ZodString, TraitId, string>>;
2285
2289
  }, "strip", z.ZodTypeAny, {
2286
2290
  trait: string;
2287
2291
  kind: "trait";
2292
+ traitId?: TraitId | undefined;
2288
2293
  }, {
2289
2294
  trait: string;
2290
2295
  kind: "trait";
2296
+ traitId?: string | undefined;
2291
2297
  }>, z.ZodObject<{
2292
2298
  kind: z.ZodLiteral<"orbital">;
2293
2299
  orbital: z.ZodString;
2294
2300
  trait: z.ZodString;
2301
+ orbitalId: z.ZodOptional<z.ZodEffects<z.ZodString, OrbitalId, string>>;
2302
+ traitId: z.ZodOptional<z.ZodEffects<z.ZodString, TraitId, string>>;
2295
2303
  }, "strip", z.ZodTypeAny, {
2304
+ orbital: string;
2296
2305
  trait: string;
2297
2306
  kind: "orbital";
2298
- orbital: string;
2307
+ traitId?: TraitId | undefined;
2308
+ orbitalId?: OrbitalId | undefined;
2299
2309
  }, {
2310
+ orbital: string;
2300
2311
  trait: string;
2301
2312
  kind: "orbital";
2302
- orbital: string;
2313
+ traitId?: string | undefined;
2314
+ orbitalId?: string | undefined;
2303
2315
  }>]>;
2304
2316
  interface TraitEventListener {
2305
2317
  /** Event key to listen for (bare event name, no source prefix in the new shape) */
2306
2318
  event: string;
2319
+ /** V4 dual-carry id sibling of `event` — optional until the Phase-7 flip. */
2320
+ eventId?: EventId;
2307
2321
  /** State machine event to trigger */
2308
2322
  triggers: string;
2323
+ /** V4 dual-carry id sibling of `triggers` — optional until the Phase-7 flip. */
2324
+ triggersId?: EventId;
2309
2325
  /** Human-readable description (authored `@description` on the listen). */
2310
2326
  description?: string;
2311
2327
  /** User-vocabulary synonyms (comma-separated). */
@@ -2330,7 +2346,9 @@ interface TraitEventListener {
2330
2346
  }
2331
2347
  declare const TraitEventListenerSchema: z.ZodObject<{
2332
2348
  event: z.ZodString;
2349
+ eventId: z.ZodOptional<z.ZodEffects<z.ZodString, EventId, string>>;
2333
2350
  triggers: z.ZodString;
2351
+ triggersId: z.ZodOptional<z.ZodEffects<z.ZodString, EventId, string>>;
2334
2352
  description: z.ZodOptional<z.ZodString>;
2335
2353
  synonyms: z.ZodOptional<z.ZodString>;
2336
2354
  tier: z.ZodOptional<z.ZodString>;
@@ -2346,24 +2364,33 @@ declare const TraitEventListenerSchema: z.ZodObject<{
2346
2364
  }>, z.ZodObject<{
2347
2365
  kind: z.ZodLiteral<"trait">;
2348
2366
  trait: z.ZodString;
2367
+ traitId: z.ZodOptional<z.ZodEffects<z.ZodString, TraitId, string>>;
2349
2368
  }, "strip", z.ZodTypeAny, {
2350
2369
  trait: string;
2351
2370
  kind: "trait";
2371
+ traitId?: TraitId | undefined;
2352
2372
  }, {
2353
2373
  trait: string;
2354
2374
  kind: "trait";
2375
+ traitId?: string | undefined;
2355
2376
  }>, z.ZodObject<{
2356
2377
  kind: z.ZodLiteral<"orbital">;
2357
2378
  orbital: z.ZodString;
2358
2379
  trait: z.ZodString;
2380
+ orbitalId: z.ZodOptional<z.ZodEffects<z.ZodString, OrbitalId, string>>;
2381
+ traitId: z.ZodOptional<z.ZodEffects<z.ZodString, TraitId, string>>;
2359
2382
  }, "strip", z.ZodTypeAny, {
2383
+ orbital: string;
2360
2384
  trait: string;
2361
2385
  kind: "orbital";
2362
- orbital: string;
2386
+ traitId?: TraitId | undefined;
2387
+ orbitalId?: OrbitalId | undefined;
2363
2388
  }, {
2389
+ orbital: string;
2364
2390
  trait: string;
2365
2391
  kind: "orbital";
2366
- orbital: string;
2392
+ traitId?: string | undefined;
2393
+ orbitalId?: string | undefined;
2367
2394
  }>]>>;
2368
2395
  }, "strip", z.ZodTypeAny, {
2369
2396
  event: string;
@@ -2375,14 +2402,19 @@ declare const TraitEventListenerSchema: z.ZodObject<{
2375
2402
  } | {
2376
2403
  trait: string;
2377
2404
  kind: "trait";
2405
+ traitId?: TraitId | undefined;
2378
2406
  } | {
2407
+ orbital: string;
2379
2408
  trait: string;
2380
2409
  kind: "orbital";
2381
- orbital: string;
2410
+ traitId?: TraitId | undefined;
2411
+ orbitalId?: OrbitalId | undefined;
2382
2412
  } | undefined;
2383
2413
  scope?: "internal" | "external" | undefined;
2384
2414
  tier?: string | undefined;
2415
+ eventId?: EventId | undefined;
2385
2416
  guard?: SExpr | undefined;
2417
+ triggersId?: EventId | undefined;
2386
2418
  payloadMapping?: Record<string, string> | undefined;
2387
2419
  }, {
2388
2420
  event: string;
@@ -2394,14 +2426,19 @@ declare const TraitEventListenerSchema: z.ZodObject<{
2394
2426
  } | {
2395
2427
  trait: string;
2396
2428
  kind: "trait";
2429
+ traitId?: string | undefined;
2397
2430
  } | {
2431
+ orbital: string;
2398
2432
  trait: string;
2399
2433
  kind: "orbital";
2400
- orbital: string;
2434
+ traitId?: string | undefined;
2435
+ orbitalId?: string | undefined;
2401
2436
  } | undefined;
2402
2437
  scope?: "internal" | "external" | undefined;
2403
2438
  tier?: string | undefined;
2439
+ eventId?: string | undefined;
2404
2440
  guard?: SExpr | undefined;
2441
+ triggersId?: string | undefined;
2405
2442
  payloadMapping?: Record<string, string> | undefined;
2406
2443
  }>;
2407
2444
  /**
@@ -2417,11 +2454,11 @@ declare const RequiredFieldSchema: z.ZodObject<{
2417
2454
  type: z.ZodEnum<["string", "number", "boolean", "date", "array", "object", "timestamp", "datetime", "enum"]>;
2418
2455
  description: z.ZodOptional<z.ZodString>;
2419
2456
  }, "strip", z.ZodTypeAny, {
2420
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
2457
+ type: "string" | "number" | "boolean" | "object" | "date" | "array" | "timestamp" | "datetime" | "enum";
2421
2458
  name: string;
2422
2459
  description?: string | undefined;
2423
2460
  }, {
2424
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
2461
+ type: "string" | "number" | "boolean" | "object" | "date" | "array" | "timestamp" | "datetime" | "enum";
2425
2462
  name: string;
2426
2463
  description?: string | undefined;
2427
2464
  }>;
@@ -2435,6 +2472,16 @@ declare const RequiredFieldSchema: z.ZodObject<{
2435
2472
  */
2436
2473
  interface TraitReference {
2437
2474
  ref: string;
2475
+ /** V4 dual-carry id sibling of `ref` — optional until the Phase-7 flip. */
2476
+ refId?: TraitId;
2477
+ /**
2478
+ * V4 LOCAL DECLARATION id — the identity of this trait AS DECLARED in its
2479
+ * orbital (`trait X = Alias.traits.Y` declares node X; `refId` carries
2480
+ * Y's id). Minted by the stamp so page trait refs and `@trait.X` embeds
2481
+ * resolve by id across `name:` renames (the composed-organism surface was
2482
+ * the one declaration class without an id).
2483
+ */
2484
+ id?: TraitId;
2438
2485
  /**
2439
2486
  * Phase 1.2: optional registry path disambiguator. Pairs with `ref` to
2440
2487
  * explicitly name which `uses` entry the alias was imported from
@@ -2444,10 +2491,14 @@ interface TraitReference {
2444
2491
  */
2445
2492
  from?: string;
2446
2493
  linkedEntity?: string;
2494
+ /** V4 dual-carry id sibling of `linkedEntity` — optional until the Phase-7 flip. */
2495
+ linkedEntityId?: EntityId;
2447
2496
  /** Phase F: rename the inlined trait at the call site */
2448
2497
  name?: string;
2449
2498
  /** Phase F: rename atom event keys at the call site, e.g. {OPEN: "ADD_ITEM"} */
2450
2499
  events?: Record<string, string>;
2500
+ /** V4 dual-carry id sibling of `events` (keys = baked event names resolved to ids) — optional until the Phase-7 flip. */
2501
+ eventIds?: Record<string, EventId>;
2451
2502
  /**
2452
2503
  * Entity-field remap: rewrite the inlined trait's canonical `@entity.X` /
2453
2504
  * `@payload.row.X` field references to the consumer entity's field names,
@@ -2511,10 +2562,14 @@ interface TraitReference {
2511
2562
  }
2512
2563
  declare const TraitReferenceSchema: z.ZodEffects<z.ZodObject<{
2513
2564
  ref: z.ZodString;
2565
+ refId: z.ZodOptional<z.ZodEffects<z.ZodString, TraitId, string>>;
2566
+ id: z.ZodOptional<z.ZodEffects<z.ZodString, TraitId, string>>;
2514
2567
  from: z.ZodOptional<z.ZodString>;
2515
2568
  linkedEntity: z.ZodOptional<z.ZodString>;
2569
+ linkedEntityId: z.ZodOptional<z.ZodEffects<z.ZodString, EntityId, string>>;
2516
2570
  name: z.ZodOptional<z.ZodString>;
2517
2571
  events: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2572
+ eventIds: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, EventId, string>>>;
2518
2573
  fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2519
2574
  config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodType<ConfigFieldDeclaration, z.ZodTypeDef, ConfigFieldDeclaration>, z.ZodType<TraitConfigValue, z.ZodTypeDef, TraitConfigValue>]>>>;
2520
2575
  appliesTo: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -2523,50 +2578,66 @@ declare const TraitReferenceSchema: z.ZodEffects<z.ZodObject<{
2523
2578
  effects: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodUnknown, "many">>>;
2524
2579
  }, "strip", z.ZodTypeAny, {
2525
2580
  ref: string;
2581
+ id?: TraitId | undefined;
2582
+ from?: string | undefined;
2526
2583
  name?: string | undefined;
2527
2584
  fields?: Record<string, string> | undefined;
2528
2585
  config?: Record<string, TraitConfigValue | ConfigFieldDeclaration> | undefined;
2529
2586
  events?: Record<string, string> | undefined;
2530
- from?: string | undefined;
2531
2587
  effects?: Record<string, unknown[]> | undefined;
2588
+ refId?: TraitId | undefined;
2532
2589
  appliesTo?: string[] | undefined;
2533
2590
  linkedEntity?: string | undefined;
2591
+ linkedEntityId?: EntityId | undefined;
2592
+ eventIds?: Record<string, EventId> | undefined;
2534
2593
  listens?: unknown[] | undefined;
2535
2594
  emitsScope?: "internal" | "external" | undefined;
2536
2595
  }, {
2537
2596
  ref: string;
2597
+ id?: string | undefined;
2598
+ from?: string | undefined;
2538
2599
  name?: string | undefined;
2539
2600
  fields?: Record<string, string> | undefined;
2540
2601
  config?: Record<string, TraitConfigValue | ConfigFieldDeclaration> | undefined;
2541
2602
  events?: Record<string, string> | undefined;
2542
- from?: string | undefined;
2543
2603
  effects?: Record<string, unknown[]> | undefined;
2604
+ refId?: string | undefined;
2544
2605
  appliesTo?: string[] | undefined;
2545
2606
  linkedEntity?: string | undefined;
2607
+ linkedEntityId?: string | undefined;
2608
+ eventIds?: Record<string, string> | undefined;
2546
2609
  listens?: unknown[] | undefined;
2547
2610
  emitsScope?: "internal" | "external" | undefined;
2548
2611
  }>, {
2549
2612
  ref: string;
2613
+ id?: TraitId | undefined;
2614
+ from?: string | undefined;
2550
2615
  name?: string | undefined;
2551
2616
  fields?: Record<string, string> | undefined;
2552
2617
  config?: Record<string, TraitConfigValue | ConfigFieldDeclaration> | undefined;
2553
2618
  events?: Record<string, string> | undefined;
2554
- from?: string | undefined;
2555
2619
  effects?: Record<string, unknown[]> | undefined;
2620
+ refId?: TraitId | undefined;
2556
2621
  appliesTo?: string[] | undefined;
2557
2622
  linkedEntity?: string | undefined;
2623
+ linkedEntityId?: EntityId | undefined;
2624
+ eventIds?: Record<string, EventId> | undefined;
2558
2625
  listens?: unknown[] | undefined;
2559
2626
  emitsScope?: "internal" | "external" | undefined;
2560
2627
  }, {
2561
2628
  ref: string;
2629
+ id?: string | undefined;
2630
+ from?: string | undefined;
2562
2631
  name?: string | undefined;
2563
2632
  fields?: Record<string, string> | undefined;
2564
2633
  config?: Record<string, TraitConfigValue | ConfigFieldDeclaration> | undefined;
2565
2634
  events?: Record<string, string> | undefined;
2566
- from?: string | undefined;
2567
2635
  effects?: Record<string, unknown[]> | undefined;
2636
+ refId?: string | undefined;
2568
2637
  appliesTo?: string[] | undefined;
2569
2638
  linkedEntity?: string | undefined;
2639
+ linkedEntityId?: string | undefined;
2640
+ eventIds?: Record<string, string> | undefined;
2570
2641
  listens?: unknown[] | undefined;
2571
2642
  emitsScope?: "internal" | "external" | undefined;
2572
2643
  }>;
@@ -2647,6 +2718,8 @@ declare const EntityFieldContractSchema: z.ZodObject<{
2647
2718
  provides: string[];
2648
2719
  }>;
2649
2720
  interface Trait {
2721
+ /** V4 dual-carry id sibling of `name` — optional until the Phase-7 flip. */
2722
+ id?: TraitId;
2650
2723
  name: string;
2651
2724
  description?: string;
2652
2725
  description_visual_prompt?: string;
@@ -2695,6 +2768,23 @@ interface Trait {
2695
2768
  * Required for inline trait definitions within an orbital.
2696
2769
  */
2697
2770
  linkedEntity?: string;
2771
+ /** V4 dual-carry id sibling of `linkedEntity` — optional until the Phase-7 flip. */
2772
+ linkedEntityId?: EntityId;
2773
+ /**
2774
+ * V4 leverage-ids — id side-map for `@entity.<Name>` binding tokens + positional
2775
+ * entity args (`fetch`/`ref`/`persist`/`spawn`) in this trait's guards/effects/
2776
+ * ticks/listens. Maps the referenced entity NAME → its stable id, so readers
2777
+ * resolve these bare-string positions by id (else name) and an entity rename never
2778
+ * strands them — the coverage that lets the entity name-rewriter be deleted.
2779
+ */
2780
+ entityRefIds?: Record<string, EntityId>;
2781
+ /**
2782
+ * V4 leverage-ids — id side-map for `@trait.<Name>` embed tokens (render-ui embeds /
2783
+ * effect-tree sibling refs). Maps the embed token NAME → the embedded trait's stable
2784
+ * id, so readers splice embeds by id (else name) — the coverage that lets the
2785
+ * `@trait.` name-rewriter be deleted.
2786
+ */
2787
+ traitEmbedIds?: Record<string, TraitId>;
2698
2788
  requiredFields?: RequiredField[];
2699
2789
  dataEntities?: TraitDataEntity[];
2700
2790
  stateMachine?: StateMachine;
@@ -2752,6 +2842,7 @@ interface SourceBehaviorMetadata {
2752
2842
  originalName: string;
2753
2843
  }
2754
2844
  declare const TraitSchema: z.ZodObject<{
2845
+ id: z.ZodOptional<z.ZodEffects<z.ZodString, TraitId, string>>;
2755
2846
  name: z.ZodString;
2756
2847
  description: z.ZodOptional<z.ZodString>;
2757
2848
  description_visual_prompt: z.ZodOptional<z.ZodString>;
@@ -2772,41 +2863,26 @@ declare const TraitSchema: z.ZodObject<{
2772
2863
  capabilities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2773
2864
  scope: z.ZodEnum<["instance", "collection"]>;
2774
2865
  linkedEntity: z.ZodOptional<z.ZodString>;
2866
+ linkedEntityId: z.ZodOptional<z.ZodEffects<z.ZodString, EntityId, string>>;
2867
+ entityRefIds: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, EntityId, string>>>;
2868
+ traitEmbedIds: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, TraitId, string>>>;
2775
2869
  requiredFields: z.ZodOptional<z.ZodArray<z.ZodObject<{
2776
2870
  name: z.ZodString;
2777
2871
  type: z.ZodEnum<["string", "number", "boolean", "date", "array", "object", "timestamp", "datetime", "enum"]>;
2778
2872
  description: z.ZodOptional<z.ZodString>;
2779
2873
  }, "strip", z.ZodTypeAny, {
2780
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
2874
+ type: "string" | "number" | "boolean" | "object" | "date" | "array" | "timestamp" | "datetime" | "enum";
2781
2875
  name: string;
2782
2876
  description?: string | undefined;
2783
2877
  }, {
2784
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
2878
+ type: "string" | "number" | "boolean" | "object" | "date" | "array" | "timestamp" | "datetime" | "enum";
2785
2879
  name: string;
2786
2880
  description?: string | undefined;
2787
2881
  }>, "many">>;
2788
2882
  dataEntities: z.ZodOptional<z.ZodArray<z.ZodObject<{
2789
2883
  name: z.ZodString;
2790
2884
  collection: z.ZodOptional<z.ZodString>;
2791
- fields: z.ZodArray<z.ZodObject<{
2792
- name: z.ZodString;
2793
- type: z.ZodEnum<["string", "number", "boolean", "date", "array", "object", "timestamp", "datetime", "enum"]>;
2794
- required: z.ZodOptional<z.ZodBoolean>;
2795
- default: z.ZodOptional<z.ZodUnknown>;
2796
- values: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2797
- }, "strip", z.ZodTypeAny, {
2798
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
2799
- name: string;
2800
- values?: string[] | undefined;
2801
- required?: boolean | undefined;
2802
- default?: unknown;
2803
- }, {
2804
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
2805
- name: string;
2806
- values?: string[] | undefined;
2807
- required?: boolean | undefined;
2808
- default?: unknown;
2809
- }>, "many">;
2885
+ fields: z.ZodArray<z.ZodType<TraitEntityField, z.ZodTypeDef, TraitEntityField>, "many">;
2810
2886
  timestamps: z.ZodOptional<z.ZodBoolean>;
2811
2887
  description: z.ZodOptional<z.ZodString>;
2812
2888
  runtime: z.ZodOptional<z.ZodBoolean>;
@@ -2814,13 +2890,7 @@ declare const TraitSchema: z.ZodObject<{
2814
2890
  pages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2815
2891
  }, "strip", z.ZodTypeAny, {
2816
2892
  name: string;
2817
- fields: {
2818
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
2819
- name: string;
2820
- values?: string[] | undefined;
2821
- required?: boolean | undefined;
2822
- default?: unknown;
2823
- }[];
2893
+ fields: TraitEntityField[];
2824
2894
  description?: string | undefined;
2825
2895
  runtime?: boolean | undefined;
2826
2896
  collection?: string | undefined;
@@ -2829,13 +2899,7 @@ declare const TraitSchema: z.ZodObject<{
2829
2899
  singleton?: boolean | undefined;
2830
2900
  }, {
2831
2901
  name: string;
2832
- fields: {
2833
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
2834
- name: string;
2835
- values?: string[] | undefined;
2836
- required?: boolean | undefined;
2837
- default?: unknown;
2838
- }[];
2902
+ fields: TraitEntityField[];
2839
2903
  description?: string | undefined;
2840
2904
  runtime?: boolean | undefined;
2841
2905
  collection?: string | undefined;
@@ -2871,49 +2935,32 @@ declare const TraitSchema: z.ZodObject<{
2871
2935
  }>, "many">;
2872
2936
  events: z.ZodArray<z.ZodObject<{
2873
2937
  key: z.ZodString;
2938
+ id: z.ZodOptional<z.ZodEffects<z.ZodString, EventId, string>>;
2874
2939
  name: z.ZodString;
2875
2940
  description: z.ZodOptional<z.ZodString>;
2876
2941
  synonyms: z.ZodOptional<z.ZodString>;
2877
2942
  tier: z.ZodOptional<z.ZodString>;
2878
- payloadSchema: z.ZodOptional<z.ZodArray<z.ZodObject<{
2879
- name: z.ZodString;
2880
- type: z.ZodString;
2881
- required: z.ZodOptional<z.ZodBoolean>;
2882
- }, "strip", z.ZodTypeAny, {
2883
- type: string;
2884
- name: string;
2885
- required?: boolean | undefined;
2886
- }, {
2887
- type: string;
2888
- name: string;
2889
- required?: boolean | undefined;
2890
- }>, "many">>;
2943
+ payloadSchema: z.ZodOptional<z.ZodArray<z.ZodType<PayloadField, z.ZodTypeDef, PayloadField>, "many">>;
2891
2944
  classification: z.ZodOptional<z.ZodEnum<["domain", "system"]>>;
2892
2945
  semanticRole: z.ZodOptional<z.ZodString>;
2893
2946
  }, "strip", z.ZodTypeAny, {
2894
2947
  name: string;
2895
2948
  key: string;
2949
+ id?: EventId | undefined;
2896
2950
  description?: string | undefined;
2897
2951
  synonyms?: string | undefined;
2898
2952
  tier?: string | undefined;
2899
- payloadSchema?: {
2900
- type: string;
2901
- name: string;
2902
- required?: boolean | undefined;
2903
- }[] | undefined;
2953
+ payloadSchema?: PayloadField[] | undefined;
2904
2954
  classification?: "domain" | "system" | undefined;
2905
2955
  semanticRole?: string | undefined;
2906
2956
  }, {
2907
2957
  name: string;
2908
2958
  key: string;
2959
+ id?: string | undefined;
2909
2960
  description?: string | undefined;
2910
2961
  synonyms?: string | undefined;
2911
2962
  tier?: string | undefined;
2912
- payloadSchema?: {
2913
- type: string;
2914
- name: string;
2915
- required?: boolean | undefined;
2916
- }[] | undefined;
2963
+ payloadSchema?: PayloadField[] | undefined;
2917
2964
  classification?: "domain" | "system" | undefined;
2918
2965
  semanticRole?: string | undefined;
2919
2966
  }>, "many">;
@@ -2921,6 +2968,7 @@ declare const TraitSchema: z.ZodObject<{
2921
2968
  from: z.ZodString;
2922
2969
  to: z.ZodString;
2923
2970
  event: z.ZodString;
2971
+ eventId: z.ZodOptional<z.ZodEffects<z.ZodString, EventId, string>>;
2924
2972
  guard: z.ZodOptional<z.ZodNullable<z.ZodType<SExpr, z.ZodTypeDef, SExpr>>>;
2925
2973
  effects: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodArray<z.ZodUnknown, "many">, unknown[], unknown[]>, "many">>;
2926
2974
  description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -2929,6 +2977,7 @@ declare const TraitSchema: z.ZodObject<{
2929
2977
  from: string;
2930
2978
  to: string;
2931
2979
  description?: string | null | undefined;
2980
+ eventId?: EventId | undefined;
2932
2981
  guard?: SExpr | undefined;
2933
2982
  effects?: unknown[][] | undefined;
2934
2983
  }, {
@@ -2936,6 +2985,7 @@ declare const TraitSchema: z.ZodObject<{
2936
2985
  from: string;
2937
2986
  to: string;
2938
2987
  description?: string | null | undefined;
2988
+ eventId?: string | undefined;
2939
2989
  guard?: SExpr | undefined;
2940
2990
  effects?: unknown[][] | undefined;
2941
2991
  }>, "many">;
@@ -2956,14 +3006,11 @@ declare const TraitSchema: z.ZodObject<{
2956
3006
  events: {
2957
3007
  name: string;
2958
3008
  key: string;
3009
+ id?: EventId | undefined;
2959
3010
  description?: string | undefined;
2960
3011
  synonyms?: string | undefined;
2961
3012
  tier?: string | undefined;
2962
- payloadSchema?: {
2963
- type: string;
2964
- name: string;
2965
- required?: boolean | undefined;
2966
- }[] | undefined;
3013
+ payloadSchema?: PayloadField[] | undefined;
2967
3014
  classification?: "domain" | "system" | undefined;
2968
3015
  semanticRole?: string | undefined;
2969
3016
  }[];
@@ -2981,6 +3028,7 @@ declare const TraitSchema: z.ZodObject<{
2981
3028
  from: string;
2982
3029
  to: string;
2983
3030
  description?: string | null | undefined;
3031
+ eventId?: EventId | undefined;
2984
3032
  guard?: SExpr | undefined;
2985
3033
  effects?: unknown[][] | undefined;
2986
3034
  }[];
@@ -2993,14 +3041,11 @@ declare const TraitSchema: z.ZodObject<{
2993
3041
  events: {
2994
3042
  name: string;
2995
3043
  key: string;
3044
+ id?: string | undefined;
2996
3045
  description?: string | undefined;
2997
3046
  synonyms?: string | undefined;
2998
3047
  tier?: string | undefined;
2999
- payloadSchema?: {
3000
- type: string;
3001
- name: string;
3002
- required?: boolean | undefined;
3003
- }[] | undefined;
3048
+ payloadSchema?: PayloadField[] | undefined;
3004
3049
  classification?: "domain" | "system" | undefined;
3005
3050
  semanticRole?: string | undefined;
3006
3051
  }[];
@@ -3018,6 +3063,7 @@ declare const TraitSchema: z.ZodObject<{
3018
3063
  from: string;
3019
3064
  to: string;
3020
3065
  description?: string | null | undefined;
3066
+ eventId?: string | undefined;
3021
3067
  guard?: SExpr | undefined;
3022
3068
  effects?: unknown[][] | undefined;
3023
3069
  }[];
@@ -3035,9 +3081,11 @@ declare const TraitSchema: z.ZodObject<{
3035
3081
  interval: z.ZodUnion<[z.ZodLiteral<"frame">, z.ZodNumber]>;
3036
3082
  appliesTo: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
3037
3083
  pages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
3084
+ pageIds: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, PageId, string>, "many">>;
3038
3085
  guard: z.ZodOptional<z.ZodType<SExpr, z.ZodTypeDef, SExpr>>;
3039
3086
  effects: z.ZodArray<z.ZodEffects<z.ZodArray<z.ZodUnknown, "many">, unknown[], unknown[]>, "many">;
3040
3087
  emits: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
3088
+ emitIds: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, EventId, string>, "many">>;
3041
3089
  }, "strip", z.ZodTypeAny, {
3042
3090
  name: string;
3043
3091
  effects: unknown[][];
@@ -3047,7 +3095,9 @@ declare const TraitSchema: z.ZodObject<{
3047
3095
  guard?: SExpr | undefined;
3048
3096
  priority?: number | undefined;
3049
3097
  appliesTo?: string[] | undefined;
3098
+ pageIds?: PageId[] | undefined;
3050
3099
  emits?: string[] | undefined;
3100
+ emitIds?: EventId[] | undefined;
3051
3101
  }, {
3052
3102
  name: string;
3053
3103
  effects: unknown[][];
@@ -3057,7 +3107,9 @@ declare const TraitSchema: z.ZodObject<{
3057
3107
  guard?: SExpr | undefined;
3058
3108
  priority?: number | undefined;
3059
3109
  appliesTo?: string[] | undefined;
3110
+ pageIds?: string[] | undefined;
3060
3111
  emits?: string[] | undefined;
3112
+ emitIds?: string[] | undefined;
3061
3113
  }>, "many">>;
3062
3114
  emits: z.ZodOptional<z.ZodArray<z.ZodObject<{
3063
3115
  /**
@@ -3065,41 +3117,16 @@ declare const TraitSchema: z.ZodObject<{
3065
3117
  * starts with a letter, then any letters / digits / underscores. Both
3066
3118
  * UPPER_SNAKE_CASE and PascalCase shapes are valid identifiers in the
3067
3119
  * post-Phase 2.5 nominal-event type system (events declared via
3068
- * `type X = Event<T>`).
3120
+ * `type X = Event<T>`). A pre-resolution `@config.<knob>` reference
3121
+ * (Option B) is also legal — inline/resolve substitutes it with the
3122
+ * knob's effective literal before codegen/runtime consume it.
3069
3123
  */
3070
3124
  event: z.ZodString;
3125
+ eventId: z.ZodOptional<z.ZodEffects<z.ZodString, EventId, string>>;
3071
3126
  description: z.ZodOptional<z.ZodString>;
3072
3127
  synonyms: z.ZodOptional<z.ZodString>;
3073
3128
  tier: z.ZodOptional<z.ZodString>;
3074
- payloadSchema: z.ZodOptional<z.ZodArray<z.ZodObject<{
3075
- name: z.ZodString;
3076
- /**
3077
- * Field type. Mirrors the Rust validator's acceptance: any non-empty
3078
- * string. Primitives ('string' | 'number' | 'boolean' | 'object' |
3079
- * 'array') are the canonical values; entity-name references like
3080
- * 'ModalRecord' and array-of-entity references like '[ModalRecord]'
3081
- * are also valid because the Rust IR's PayloadField.field_type is
3082
- * just a String. Only enforced narrowly at the call site (e.g.
3083
- * emit-literal type-mismatch warnings in
3084
- * orbital-compiler/phases/validation/emit_payload.rs) — not here.
3085
- */
3086
- type: z.ZodString;
3087
- required: z.ZodOptional<z.ZodBoolean>;
3088
- description: z.ZodOptional<z.ZodString>;
3089
- entityType: z.ZodOptional<z.ZodString>;
3090
- }, "strip", z.ZodTypeAny, {
3091
- type: string;
3092
- name: string;
3093
- required?: boolean | undefined;
3094
- description?: string | undefined;
3095
- entityType?: string | undefined;
3096
- }, {
3097
- type: string;
3098
- name: string;
3099
- required?: boolean | undefined;
3100
- description?: string | undefined;
3101
- entityType?: string | undefined;
3102
- }>, "many">>;
3129
+ payloadSchema: z.ZodOptional<z.ZodArray<z.ZodType<EventPayloadField, z.ZodTypeDef, EventPayloadField>, "many">>;
3103
3130
  scope: z.ZodOptional<z.ZodEnum<["internal", "external"]>>;
3104
3131
  }, "strip", z.ZodTypeAny, {
3105
3132
  event: string;
@@ -3107,30 +3134,22 @@ declare const TraitSchema: z.ZodObject<{
3107
3134
  synonyms?: string | undefined;
3108
3135
  scope?: "internal" | "external" | undefined;
3109
3136
  tier?: string | undefined;
3110
- payloadSchema?: {
3111
- type: string;
3112
- name: string;
3113
- required?: boolean | undefined;
3114
- description?: string | undefined;
3115
- entityType?: string | undefined;
3116
- }[] | undefined;
3137
+ payloadSchema?: EventPayloadField[] | undefined;
3138
+ eventId?: EventId | undefined;
3117
3139
  }, {
3118
3140
  event: string;
3119
3141
  description?: string | undefined;
3120
3142
  synonyms?: string | undefined;
3121
3143
  scope?: "internal" | "external" | undefined;
3122
3144
  tier?: string | undefined;
3123
- payloadSchema?: {
3124
- type: string;
3125
- name: string;
3126
- required?: boolean | undefined;
3127
- description?: string | undefined;
3128
- entityType?: string | undefined;
3129
- }[] | undefined;
3145
+ payloadSchema?: EventPayloadField[] | undefined;
3146
+ eventId?: string | undefined;
3130
3147
  }>, "many">>;
3131
3148
  listens: z.ZodOptional<z.ZodArray<z.ZodObject<{
3132
3149
  event: z.ZodString;
3150
+ eventId: z.ZodOptional<z.ZodEffects<z.ZodString, EventId, string>>;
3133
3151
  triggers: z.ZodString;
3152
+ triggersId: z.ZodOptional<z.ZodEffects<z.ZodString, EventId, string>>;
3134
3153
  description: z.ZodOptional<z.ZodString>;
3135
3154
  synonyms: z.ZodOptional<z.ZodString>;
3136
3155
  tier: z.ZodOptional<z.ZodString>;
@@ -3146,24 +3165,33 @@ declare const TraitSchema: z.ZodObject<{
3146
3165
  }>, z.ZodObject<{
3147
3166
  kind: z.ZodLiteral<"trait">;
3148
3167
  trait: z.ZodString;
3168
+ traitId: z.ZodOptional<z.ZodEffects<z.ZodString, TraitId, string>>;
3149
3169
  }, "strip", z.ZodTypeAny, {
3150
3170
  trait: string;
3151
3171
  kind: "trait";
3172
+ traitId?: TraitId | undefined;
3152
3173
  }, {
3153
3174
  trait: string;
3154
3175
  kind: "trait";
3176
+ traitId?: string | undefined;
3155
3177
  }>, z.ZodObject<{
3156
3178
  kind: z.ZodLiteral<"orbital">;
3157
3179
  orbital: z.ZodString;
3158
3180
  trait: z.ZodString;
3181
+ orbitalId: z.ZodOptional<z.ZodEffects<z.ZodString, OrbitalId, string>>;
3182
+ traitId: z.ZodOptional<z.ZodEffects<z.ZodString, TraitId, string>>;
3159
3183
  }, "strip", z.ZodTypeAny, {
3184
+ orbital: string;
3160
3185
  trait: string;
3161
3186
  kind: "orbital";
3162
- orbital: string;
3187
+ traitId?: TraitId | undefined;
3188
+ orbitalId?: OrbitalId | undefined;
3163
3189
  }, {
3190
+ orbital: string;
3164
3191
  trait: string;
3165
3192
  kind: "orbital";
3166
- orbital: string;
3193
+ traitId?: string | undefined;
3194
+ orbitalId?: string | undefined;
3167
3195
  }>]>>;
3168
3196
  }, "strip", z.ZodTypeAny, {
3169
3197
  event: string;
@@ -3175,14 +3203,19 @@ declare const TraitSchema: z.ZodObject<{
3175
3203
  } | {
3176
3204
  trait: string;
3177
3205
  kind: "trait";
3206
+ traitId?: TraitId | undefined;
3178
3207
  } | {
3208
+ orbital: string;
3179
3209
  trait: string;
3180
3210
  kind: "orbital";
3181
- orbital: string;
3211
+ traitId?: TraitId | undefined;
3212
+ orbitalId?: OrbitalId | undefined;
3182
3213
  } | undefined;
3183
3214
  scope?: "internal" | "external" | undefined;
3184
3215
  tier?: string | undefined;
3216
+ eventId?: EventId | undefined;
3185
3217
  guard?: SExpr | undefined;
3218
+ triggersId?: EventId | undefined;
3186
3219
  payloadMapping?: Record<string, string> | undefined;
3187
3220
  }, {
3188
3221
  event: string;
@@ -3194,14 +3227,19 @@ declare const TraitSchema: z.ZodObject<{
3194
3227
  } | {
3195
3228
  trait: string;
3196
3229
  kind: "trait";
3230
+ traitId?: string | undefined;
3197
3231
  } | {
3232
+ orbital: string;
3198
3233
  trait: string;
3199
3234
  kind: "orbital";
3200
- orbital: string;
3235
+ traitId?: string | undefined;
3236
+ orbitalId?: string | undefined;
3201
3237
  } | undefined;
3202
3238
  scope?: "internal" | "external" | undefined;
3203
3239
  tier?: string | undefined;
3240
+ eventId?: string | undefined;
3204
3241
  guard?: SExpr | undefined;
3242
+ triggersId?: string | undefined;
3205
3243
  payloadMapping?: Record<string, string> | undefined;
3206
3244
  }>, "many">>;
3207
3245
  ui: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -3299,6 +3337,7 @@ declare const TraitSchema: z.ZodObject<{
3299
3337
  }, "strip", z.ZodTypeAny, {
3300
3338
  name: string;
3301
3339
  scope: "collection" | "instance";
3340
+ id?: TraitId | undefined;
3302
3341
  description?: string | undefined;
3303
3342
  ui?: Record<string, unknown> | undefined;
3304
3343
  category?: "validation" | "notification" | "lifecycle" | "temporal" | "integration" | "interaction" | "agent" | "game-core" | "game-character" | "game-ai" | "game-combat" | "game-items" | "game-cards" | "game-board" | "game-puzzle" | undefined;
@@ -3306,13 +3345,7 @@ declare const TraitSchema: z.ZodObject<{
3306
3345
  capabilities?: string[] | undefined;
3307
3346
  dataEntities?: {
3308
3347
  name: string;
3309
- fields: {
3310
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
3311
- name: string;
3312
- values?: string[] | undefined;
3313
- required?: boolean | undefined;
3314
- default?: unknown;
3315
- }[];
3348
+ fields: TraitEntityField[];
3316
3349
  description?: string | undefined;
3317
3350
  runtime?: boolean | undefined;
3318
3351
  collection?: string | undefined;
@@ -3324,14 +3357,11 @@ declare const TraitSchema: z.ZodObject<{
3324
3357
  events: {
3325
3358
  name: string;
3326
3359
  key: string;
3360
+ id?: EventId | undefined;
3327
3361
  description?: string | undefined;
3328
3362
  synonyms?: string | undefined;
3329
3363
  tier?: string | undefined;
3330
- payloadSchema?: {
3331
- type: string;
3332
- name: string;
3333
- required?: boolean | undefined;
3334
- }[] | undefined;
3364
+ payloadSchema?: PayloadField[] | undefined;
3335
3365
  classification?: "domain" | "system" | undefined;
3336
3366
  semanticRole?: string | undefined;
3337
3367
  }[];
@@ -3349,6 +3379,7 @@ declare const TraitSchema: z.ZodObject<{
3349
3379
  from: string;
3350
3380
  to: string;
3351
3381
  description?: string | null | undefined;
3382
+ eventId?: EventId | undefined;
3352
3383
  guard?: SExpr | undefined;
3353
3384
  effects?: unknown[][] | undefined;
3354
3385
  }[];
@@ -3364,15 +3395,11 @@ declare const TraitSchema: z.ZodObject<{
3364
3395
  synonyms?: string | undefined;
3365
3396
  scope?: "internal" | "external" | undefined;
3366
3397
  tier?: string | undefined;
3367
- payloadSchema?: {
3368
- type: string;
3369
- name: string;
3370
- required?: boolean | undefined;
3371
- description?: string | undefined;
3372
- entityType?: string | undefined;
3373
- }[] | undefined;
3398
+ payloadSchema?: EventPayloadField[] | undefined;
3399
+ eventId?: EventId | undefined;
3374
3400
  }[] | undefined;
3375
3401
  linkedEntity?: string | undefined;
3402
+ linkedEntityId?: EntityId | undefined;
3376
3403
  listens?: {
3377
3404
  event: string;
3378
3405
  triggers: string;
@@ -3383,14 +3410,19 @@ declare const TraitSchema: z.ZodObject<{
3383
3410
  } | {
3384
3411
  trait: string;
3385
3412
  kind: "trait";
3413
+ traitId?: TraitId | undefined;
3386
3414
  } | {
3415
+ orbital: string;
3387
3416
  trait: string;
3388
3417
  kind: "orbital";
3389
- orbital: string;
3418
+ traitId?: TraitId | undefined;
3419
+ orbitalId?: OrbitalId | undefined;
3390
3420
  } | undefined;
3391
3421
  scope?: "internal" | "external" | undefined;
3392
3422
  tier?: string | undefined;
3423
+ eventId?: EventId | undefined;
3393
3424
  guard?: SExpr | undefined;
3425
+ triggersId?: EventId | undefined;
3394
3426
  payloadMapping?: Record<string, string> | undefined;
3395
3427
  }[] | undefined;
3396
3428
  description_visual_prompt?: string | undefined;
@@ -3401,8 +3433,10 @@ declare const TraitSchema: z.ZodObject<{
3401
3433
  } | undefined;
3402
3434
  entityBindingDescription?: string | undefined;
3403
3435
  entityBindingSynonyms?: string | undefined;
3436
+ entityRefIds?: Record<string, EntityId> | undefined;
3437
+ traitEmbedIds?: Record<string, TraitId> | undefined;
3404
3438
  requiredFields?: {
3405
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
3439
+ type: "string" | "number" | "boolean" | "object" | "date" | "array" | "timestamp" | "datetime" | "enum";
3406
3440
  name: string;
3407
3441
  description?: string | undefined;
3408
3442
  }[] | undefined;
@@ -3416,7 +3450,9 @@ declare const TraitSchema: z.ZodObject<{
3416
3450
  guard?: SExpr | undefined;
3417
3451
  priority?: number | undefined;
3418
3452
  appliesTo?: string[] | undefined;
3453
+ pageIds?: PageId[] | undefined;
3419
3454
  emits?: string[] | undefined;
3455
+ emitIds?: EventId[] | undefined;
3420
3456
  }[] | undefined;
3421
3457
  sourceBehavior?: {
3422
3458
  behavior: string;
@@ -3447,6 +3483,7 @@ declare const TraitSchema: z.ZodObject<{
3447
3483
  }, {
3448
3484
  name: string;
3449
3485
  scope: "collection" | "instance";
3486
+ id?: string | undefined;
3450
3487
  description?: string | undefined;
3451
3488
  ui?: Record<string, unknown> | undefined;
3452
3489
  category?: "validation" | "notification" | "lifecycle" | "temporal" | "integration" | "interaction" | "agent" | "game-core" | "game-character" | "game-ai" | "game-combat" | "game-items" | "game-cards" | "game-board" | "game-puzzle" | undefined;
@@ -3454,13 +3491,7 @@ declare const TraitSchema: z.ZodObject<{
3454
3491
  capabilities?: string[] | undefined;
3455
3492
  dataEntities?: {
3456
3493
  name: string;
3457
- fields: {
3458
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
3459
- name: string;
3460
- values?: string[] | undefined;
3461
- required?: boolean | undefined;
3462
- default?: unknown;
3463
- }[];
3494
+ fields: TraitEntityField[];
3464
3495
  description?: string | undefined;
3465
3496
  runtime?: boolean | undefined;
3466
3497
  collection?: string | undefined;
@@ -3472,14 +3503,11 @@ declare const TraitSchema: z.ZodObject<{
3472
3503
  events: {
3473
3504
  name: string;
3474
3505
  key: string;
3506
+ id?: string | undefined;
3475
3507
  description?: string | undefined;
3476
3508
  synonyms?: string | undefined;
3477
3509
  tier?: string | undefined;
3478
- payloadSchema?: {
3479
- type: string;
3480
- name: string;
3481
- required?: boolean | undefined;
3482
- }[] | undefined;
3510
+ payloadSchema?: PayloadField[] | undefined;
3483
3511
  classification?: "domain" | "system" | undefined;
3484
3512
  semanticRole?: string | undefined;
3485
3513
  }[];
@@ -3497,6 +3525,7 @@ declare const TraitSchema: z.ZodObject<{
3497
3525
  from: string;
3498
3526
  to: string;
3499
3527
  description?: string | null | undefined;
3528
+ eventId?: string | undefined;
3500
3529
  guard?: SExpr | undefined;
3501
3530
  effects?: unknown[][] | undefined;
3502
3531
  }[];
@@ -3512,15 +3541,11 @@ declare const TraitSchema: z.ZodObject<{
3512
3541
  synonyms?: string | undefined;
3513
3542
  scope?: "internal" | "external" | undefined;
3514
3543
  tier?: string | undefined;
3515
- payloadSchema?: {
3516
- type: string;
3517
- name: string;
3518
- required?: boolean | undefined;
3519
- description?: string | undefined;
3520
- entityType?: string | undefined;
3521
- }[] | undefined;
3544
+ payloadSchema?: EventPayloadField[] | undefined;
3545
+ eventId?: string | undefined;
3522
3546
  }[] | undefined;
3523
3547
  linkedEntity?: string | undefined;
3548
+ linkedEntityId?: string | undefined;
3524
3549
  listens?: {
3525
3550
  event: string;
3526
3551
  triggers: string;
@@ -3531,14 +3556,19 @@ declare const TraitSchema: z.ZodObject<{
3531
3556
  } | {
3532
3557
  trait: string;
3533
3558
  kind: "trait";
3559
+ traitId?: string | undefined;
3534
3560
  } | {
3561
+ orbital: string;
3535
3562
  trait: string;
3536
3563
  kind: "orbital";
3537
- orbital: string;
3564
+ traitId?: string | undefined;
3565
+ orbitalId?: string | undefined;
3538
3566
  } | undefined;
3539
3567
  scope?: "internal" | "external" | undefined;
3540
3568
  tier?: string | undefined;
3569
+ eventId?: string | undefined;
3541
3570
  guard?: SExpr | undefined;
3571
+ triggersId?: string | undefined;
3542
3572
  payloadMapping?: Record<string, string> | undefined;
3543
3573
  }[] | undefined;
3544
3574
  description_visual_prompt?: string | undefined;
@@ -3549,8 +3579,10 @@ declare const TraitSchema: z.ZodObject<{
3549
3579
  } | undefined;
3550
3580
  entityBindingDescription?: string | undefined;
3551
3581
  entityBindingSynonyms?: string | undefined;
3582
+ entityRefIds?: Record<string, string> | undefined;
3583
+ traitEmbedIds?: Record<string, string> | undefined;
3552
3584
  requiredFields?: {
3553
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
3585
+ type: "string" | "number" | "boolean" | "object" | "date" | "array" | "timestamp" | "datetime" | "enum";
3554
3586
  name: string;
3555
3587
  description?: string | undefined;
3556
3588
  }[] | undefined;
@@ -3564,7 +3596,9 @@ declare const TraitSchema: z.ZodObject<{
3564
3596
  guard?: SExpr | undefined;
3565
3597
  priority?: number | undefined;
3566
3598
  appliesTo?: string[] | undefined;
3599
+ pageIds?: string[] | undefined;
3567
3600
  emits?: string[] | undefined;
3601
+ emitIds?: string[] | undefined;
3568
3602
  }[] | undefined;
3569
3603
  sourceBehavior?: {
3570
3604
  behavior: string;
@@ -3612,6 +3646,7 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
3612
3646
  events?: Record<string, string> | undefined;
3613
3647
  linkedEntity?: string | undefined;
3614
3648
  }>, z.ZodObject<{
3649
+ id: z.ZodOptional<z.ZodEffects<z.ZodString, TraitId, string>>;
3615
3650
  name: z.ZodString;
3616
3651
  description: z.ZodOptional<z.ZodString>;
3617
3652
  description_visual_prompt: z.ZodOptional<z.ZodString>;
@@ -3632,41 +3667,26 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
3632
3667
  capabilities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
3633
3668
  scope: z.ZodEnum<["instance", "collection"]>;
3634
3669
  linkedEntity: z.ZodOptional<z.ZodString>;
3670
+ linkedEntityId: z.ZodOptional<z.ZodEffects<z.ZodString, EntityId, string>>;
3671
+ entityRefIds: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, EntityId, string>>>;
3672
+ traitEmbedIds: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, TraitId, string>>>;
3635
3673
  requiredFields: z.ZodOptional<z.ZodArray<z.ZodObject<{
3636
3674
  name: z.ZodString;
3637
3675
  type: z.ZodEnum<["string", "number", "boolean", "date", "array", "object", "timestamp", "datetime", "enum"]>;
3638
3676
  description: z.ZodOptional<z.ZodString>;
3639
3677
  }, "strip", z.ZodTypeAny, {
3640
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
3678
+ type: "string" | "number" | "boolean" | "object" | "date" | "array" | "timestamp" | "datetime" | "enum";
3641
3679
  name: string;
3642
3680
  description?: string | undefined;
3643
3681
  }, {
3644
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
3682
+ type: "string" | "number" | "boolean" | "object" | "date" | "array" | "timestamp" | "datetime" | "enum";
3645
3683
  name: string;
3646
3684
  description?: string | undefined;
3647
3685
  }>, "many">>;
3648
3686
  dataEntities: z.ZodOptional<z.ZodArray<z.ZodObject<{
3649
3687
  name: z.ZodString;
3650
3688
  collection: z.ZodOptional<z.ZodString>;
3651
- fields: z.ZodArray<z.ZodObject<{
3652
- name: z.ZodString;
3653
- type: z.ZodEnum<["string", "number", "boolean", "date", "array", "object", "timestamp", "datetime", "enum"]>;
3654
- required: z.ZodOptional<z.ZodBoolean>;
3655
- default: z.ZodOptional<z.ZodUnknown>;
3656
- values: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
3657
- }, "strip", z.ZodTypeAny, {
3658
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
3659
- name: string;
3660
- values?: string[] | undefined;
3661
- required?: boolean | undefined;
3662
- default?: unknown;
3663
- }, {
3664
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
3665
- name: string;
3666
- values?: string[] | undefined;
3667
- required?: boolean | undefined;
3668
- default?: unknown;
3669
- }>, "many">;
3689
+ fields: z.ZodArray<z.ZodType<TraitEntityField, z.ZodTypeDef, TraitEntityField>, "many">;
3670
3690
  timestamps: z.ZodOptional<z.ZodBoolean>;
3671
3691
  description: z.ZodOptional<z.ZodString>;
3672
3692
  runtime: z.ZodOptional<z.ZodBoolean>;
@@ -3674,13 +3694,7 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
3674
3694
  pages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
3675
3695
  }, "strip", z.ZodTypeAny, {
3676
3696
  name: string;
3677
- fields: {
3678
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
3679
- name: string;
3680
- values?: string[] | undefined;
3681
- required?: boolean | undefined;
3682
- default?: unknown;
3683
- }[];
3697
+ fields: TraitEntityField[];
3684
3698
  description?: string | undefined;
3685
3699
  runtime?: boolean | undefined;
3686
3700
  collection?: string | undefined;
@@ -3689,13 +3703,7 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
3689
3703
  singleton?: boolean | undefined;
3690
3704
  }, {
3691
3705
  name: string;
3692
- fields: {
3693
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
3694
- name: string;
3695
- values?: string[] | undefined;
3696
- required?: boolean | undefined;
3697
- default?: unknown;
3698
- }[];
3706
+ fields: TraitEntityField[];
3699
3707
  description?: string | undefined;
3700
3708
  runtime?: boolean | undefined;
3701
3709
  collection?: string | undefined;
@@ -3731,49 +3739,32 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
3731
3739
  }>, "many">;
3732
3740
  events: z.ZodArray<z.ZodObject<{
3733
3741
  key: z.ZodString;
3742
+ id: z.ZodOptional<z.ZodEffects<z.ZodString, EventId, string>>;
3734
3743
  name: z.ZodString;
3735
3744
  description: z.ZodOptional<z.ZodString>;
3736
3745
  synonyms: z.ZodOptional<z.ZodString>;
3737
3746
  tier: z.ZodOptional<z.ZodString>;
3738
- payloadSchema: z.ZodOptional<z.ZodArray<z.ZodObject<{
3739
- name: z.ZodString;
3740
- type: z.ZodString;
3741
- required: z.ZodOptional<z.ZodBoolean>;
3742
- }, "strip", z.ZodTypeAny, {
3743
- type: string;
3744
- name: string;
3745
- required?: boolean | undefined;
3746
- }, {
3747
- type: string;
3748
- name: string;
3749
- required?: boolean | undefined;
3750
- }>, "many">>;
3747
+ payloadSchema: z.ZodOptional<z.ZodArray<z.ZodType<PayloadField, z.ZodTypeDef, PayloadField>, "many">>;
3751
3748
  classification: z.ZodOptional<z.ZodEnum<["domain", "system"]>>;
3752
3749
  semanticRole: z.ZodOptional<z.ZodString>;
3753
3750
  }, "strip", z.ZodTypeAny, {
3754
3751
  name: string;
3755
3752
  key: string;
3753
+ id?: EventId | undefined;
3756
3754
  description?: string | undefined;
3757
3755
  synonyms?: string | undefined;
3758
3756
  tier?: string | undefined;
3759
- payloadSchema?: {
3760
- type: string;
3761
- name: string;
3762
- required?: boolean | undefined;
3763
- }[] | undefined;
3757
+ payloadSchema?: PayloadField[] | undefined;
3764
3758
  classification?: "domain" | "system" | undefined;
3765
3759
  semanticRole?: string | undefined;
3766
3760
  }, {
3767
3761
  name: string;
3768
3762
  key: string;
3763
+ id?: string | undefined;
3769
3764
  description?: string | undefined;
3770
3765
  synonyms?: string | undefined;
3771
3766
  tier?: string | undefined;
3772
- payloadSchema?: {
3773
- type: string;
3774
- name: string;
3775
- required?: boolean | undefined;
3776
- }[] | undefined;
3767
+ payloadSchema?: PayloadField[] | undefined;
3777
3768
  classification?: "domain" | "system" | undefined;
3778
3769
  semanticRole?: string | undefined;
3779
3770
  }>, "many">;
@@ -3781,6 +3772,7 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
3781
3772
  from: z.ZodString;
3782
3773
  to: z.ZodString;
3783
3774
  event: z.ZodString;
3775
+ eventId: z.ZodOptional<z.ZodEffects<z.ZodString, EventId, string>>;
3784
3776
  guard: z.ZodOptional<z.ZodNullable<z.ZodType<SExpr, z.ZodTypeDef, SExpr>>>;
3785
3777
  effects: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodArray<z.ZodUnknown, "many">, unknown[], unknown[]>, "many">>;
3786
3778
  description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -3789,6 +3781,7 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
3789
3781
  from: string;
3790
3782
  to: string;
3791
3783
  description?: string | null | undefined;
3784
+ eventId?: EventId | undefined;
3792
3785
  guard?: SExpr | undefined;
3793
3786
  effects?: unknown[][] | undefined;
3794
3787
  }, {
@@ -3796,6 +3789,7 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
3796
3789
  from: string;
3797
3790
  to: string;
3798
3791
  description?: string | null | undefined;
3792
+ eventId?: string | undefined;
3799
3793
  guard?: SExpr | undefined;
3800
3794
  effects?: unknown[][] | undefined;
3801
3795
  }>, "many">;
@@ -3816,14 +3810,11 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
3816
3810
  events: {
3817
3811
  name: string;
3818
3812
  key: string;
3813
+ id?: EventId | undefined;
3819
3814
  description?: string | undefined;
3820
3815
  synonyms?: string | undefined;
3821
3816
  tier?: string | undefined;
3822
- payloadSchema?: {
3823
- type: string;
3824
- name: string;
3825
- required?: boolean | undefined;
3826
- }[] | undefined;
3817
+ payloadSchema?: PayloadField[] | undefined;
3827
3818
  classification?: "domain" | "system" | undefined;
3828
3819
  semanticRole?: string | undefined;
3829
3820
  }[];
@@ -3841,6 +3832,7 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
3841
3832
  from: string;
3842
3833
  to: string;
3843
3834
  description?: string | null | undefined;
3835
+ eventId?: EventId | undefined;
3844
3836
  guard?: SExpr | undefined;
3845
3837
  effects?: unknown[][] | undefined;
3846
3838
  }[];
@@ -3853,14 +3845,11 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
3853
3845
  events: {
3854
3846
  name: string;
3855
3847
  key: string;
3848
+ id?: string | undefined;
3856
3849
  description?: string | undefined;
3857
3850
  synonyms?: string | undefined;
3858
3851
  tier?: string | undefined;
3859
- payloadSchema?: {
3860
- type: string;
3861
- name: string;
3862
- required?: boolean | undefined;
3863
- }[] | undefined;
3852
+ payloadSchema?: PayloadField[] | undefined;
3864
3853
  classification?: "domain" | "system" | undefined;
3865
3854
  semanticRole?: string | undefined;
3866
3855
  }[];
@@ -3878,6 +3867,7 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
3878
3867
  from: string;
3879
3868
  to: string;
3880
3869
  description?: string | null | undefined;
3870
+ eventId?: string | undefined;
3881
3871
  guard?: SExpr | undefined;
3882
3872
  effects?: unknown[][] | undefined;
3883
3873
  }[];
@@ -3895,9 +3885,11 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
3895
3885
  interval: z.ZodUnion<[z.ZodLiteral<"frame">, z.ZodNumber]>;
3896
3886
  appliesTo: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
3897
3887
  pages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
3888
+ pageIds: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, PageId, string>, "many">>;
3898
3889
  guard: z.ZodOptional<z.ZodType<SExpr, z.ZodTypeDef, SExpr>>;
3899
3890
  effects: z.ZodArray<z.ZodEffects<z.ZodArray<z.ZodUnknown, "many">, unknown[], unknown[]>, "many">;
3900
3891
  emits: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
3892
+ emitIds: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, EventId, string>, "many">>;
3901
3893
  }, "strip", z.ZodTypeAny, {
3902
3894
  name: string;
3903
3895
  effects: unknown[][];
@@ -3907,7 +3899,9 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
3907
3899
  guard?: SExpr | undefined;
3908
3900
  priority?: number | undefined;
3909
3901
  appliesTo?: string[] | undefined;
3902
+ pageIds?: PageId[] | undefined;
3910
3903
  emits?: string[] | undefined;
3904
+ emitIds?: EventId[] | undefined;
3911
3905
  }, {
3912
3906
  name: string;
3913
3907
  effects: unknown[][];
@@ -3917,7 +3911,9 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
3917
3911
  guard?: SExpr | undefined;
3918
3912
  priority?: number | undefined;
3919
3913
  appliesTo?: string[] | undefined;
3914
+ pageIds?: string[] | undefined;
3920
3915
  emits?: string[] | undefined;
3916
+ emitIds?: string[] | undefined;
3921
3917
  }>, "many">>;
3922
3918
  emits: z.ZodOptional<z.ZodArray<z.ZodObject<{
3923
3919
  /**
@@ -3925,41 +3921,16 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
3925
3921
  * starts with a letter, then any letters / digits / underscores. Both
3926
3922
  * UPPER_SNAKE_CASE and PascalCase shapes are valid identifiers in the
3927
3923
  * post-Phase 2.5 nominal-event type system (events declared via
3928
- * `type X = Event<T>`).
3924
+ * `type X = Event<T>`). A pre-resolution `@config.<knob>` reference
3925
+ * (Option B) is also legal — inline/resolve substitutes it with the
3926
+ * knob's effective literal before codegen/runtime consume it.
3929
3927
  */
3930
3928
  event: z.ZodString;
3929
+ eventId: z.ZodOptional<z.ZodEffects<z.ZodString, EventId, string>>;
3931
3930
  description: z.ZodOptional<z.ZodString>;
3932
3931
  synonyms: z.ZodOptional<z.ZodString>;
3933
3932
  tier: z.ZodOptional<z.ZodString>;
3934
- payloadSchema: z.ZodOptional<z.ZodArray<z.ZodObject<{
3935
- name: z.ZodString;
3936
- /**
3937
- * Field type. Mirrors the Rust validator's acceptance: any non-empty
3938
- * string. Primitives ('string' | 'number' | 'boolean' | 'object' |
3939
- * 'array') are the canonical values; entity-name references like
3940
- * 'ModalRecord' and array-of-entity references like '[ModalRecord]'
3941
- * are also valid because the Rust IR's PayloadField.field_type is
3942
- * just a String. Only enforced narrowly at the call site (e.g.
3943
- * emit-literal type-mismatch warnings in
3944
- * orbital-compiler/phases/validation/emit_payload.rs) — not here.
3945
- */
3946
- type: z.ZodString;
3947
- required: z.ZodOptional<z.ZodBoolean>;
3948
- description: z.ZodOptional<z.ZodString>;
3949
- entityType: z.ZodOptional<z.ZodString>;
3950
- }, "strip", z.ZodTypeAny, {
3951
- type: string;
3952
- name: string;
3953
- required?: boolean | undefined;
3954
- description?: string | undefined;
3955
- entityType?: string | undefined;
3956
- }, {
3957
- type: string;
3958
- name: string;
3959
- required?: boolean | undefined;
3960
- description?: string | undefined;
3961
- entityType?: string | undefined;
3962
- }>, "many">>;
3933
+ payloadSchema: z.ZodOptional<z.ZodArray<z.ZodType<EventPayloadField, z.ZodTypeDef, EventPayloadField>, "many">>;
3963
3934
  scope: z.ZodOptional<z.ZodEnum<["internal", "external"]>>;
3964
3935
  }, "strip", z.ZodTypeAny, {
3965
3936
  event: string;
@@ -3967,30 +3938,22 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
3967
3938
  synonyms?: string | undefined;
3968
3939
  scope?: "internal" | "external" | undefined;
3969
3940
  tier?: string | undefined;
3970
- payloadSchema?: {
3971
- type: string;
3972
- name: string;
3973
- required?: boolean | undefined;
3974
- description?: string | undefined;
3975
- entityType?: string | undefined;
3976
- }[] | undefined;
3941
+ payloadSchema?: EventPayloadField[] | undefined;
3942
+ eventId?: EventId | undefined;
3977
3943
  }, {
3978
3944
  event: string;
3979
3945
  description?: string | undefined;
3980
3946
  synonyms?: string | undefined;
3981
3947
  scope?: "internal" | "external" | undefined;
3982
3948
  tier?: string | undefined;
3983
- payloadSchema?: {
3984
- type: string;
3985
- name: string;
3986
- required?: boolean | undefined;
3987
- description?: string | undefined;
3988
- entityType?: string | undefined;
3989
- }[] | undefined;
3949
+ payloadSchema?: EventPayloadField[] | undefined;
3950
+ eventId?: string | undefined;
3990
3951
  }>, "many">>;
3991
3952
  listens: z.ZodOptional<z.ZodArray<z.ZodObject<{
3992
3953
  event: z.ZodString;
3954
+ eventId: z.ZodOptional<z.ZodEffects<z.ZodString, EventId, string>>;
3993
3955
  triggers: z.ZodString;
3956
+ triggersId: z.ZodOptional<z.ZodEffects<z.ZodString, EventId, string>>;
3994
3957
  description: z.ZodOptional<z.ZodString>;
3995
3958
  synonyms: z.ZodOptional<z.ZodString>;
3996
3959
  tier: z.ZodOptional<z.ZodString>;
@@ -4006,24 +3969,33 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4006
3969
  }>, z.ZodObject<{
4007
3970
  kind: z.ZodLiteral<"trait">;
4008
3971
  trait: z.ZodString;
3972
+ traitId: z.ZodOptional<z.ZodEffects<z.ZodString, TraitId, string>>;
4009
3973
  }, "strip", z.ZodTypeAny, {
4010
3974
  trait: string;
4011
3975
  kind: "trait";
3976
+ traitId?: TraitId | undefined;
4012
3977
  }, {
4013
3978
  trait: string;
4014
3979
  kind: "trait";
3980
+ traitId?: string | undefined;
4015
3981
  }>, z.ZodObject<{
4016
3982
  kind: z.ZodLiteral<"orbital">;
4017
3983
  orbital: z.ZodString;
4018
3984
  trait: z.ZodString;
3985
+ orbitalId: z.ZodOptional<z.ZodEffects<z.ZodString, OrbitalId, string>>;
3986
+ traitId: z.ZodOptional<z.ZodEffects<z.ZodString, TraitId, string>>;
4019
3987
  }, "strip", z.ZodTypeAny, {
3988
+ orbital: string;
4020
3989
  trait: string;
4021
3990
  kind: "orbital";
4022
- orbital: string;
3991
+ traitId?: TraitId | undefined;
3992
+ orbitalId?: OrbitalId | undefined;
4023
3993
  }, {
3994
+ orbital: string;
4024
3995
  trait: string;
4025
3996
  kind: "orbital";
4026
- orbital: string;
3997
+ traitId?: string | undefined;
3998
+ orbitalId?: string | undefined;
4027
3999
  }>]>>;
4028
4000
  }, "strip", z.ZodTypeAny, {
4029
4001
  event: string;
@@ -4035,14 +4007,19 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4035
4007
  } | {
4036
4008
  trait: string;
4037
4009
  kind: "trait";
4010
+ traitId?: TraitId | undefined;
4038
4011
  } | {
4012
+ orbital: string;
4039
4013
  trait: string;
4040
4014
  kind: "orbital";
4041
- orbital: string;
4015
+ traitId?: TraitId | undefined;
4016
+ orbitalId?: OrbitalId | undefined;
4042
4017
  } | undefined;
4043
4018
  scope?: "internal" | "external" | undefined;
4044
4019
  tier?: string | undefined;
4020
+ eventId?: EventId | undefined;
4045
4021
  guard?: SExpr | undefined;
4022
+ triggersId?: EventId | undefined;
4046
4023
  payloadMapping?: Record<string, string> | undefined;
4047
4024
  }, {
4048
4025
  event: string;
@@ -4054,14 +4031,19 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4054
4031
  } | {
4055
4032
  trait: string;
4056
4033
  kind: "trait";
4034
+ traitId?: string | undefined;
4057
4035
  } | {
4036
+ orbital: string;
4058
4037
  trait: string;
4059
4038
  kind: "orbital";
4060
- orbital: string;
4039
+ traitId?: string | undefined;
4040
+ orbitalId?: string | undefined;
4061
4041
  } | undefined;
4062
4042
  scope?: "internal" | "external" | undefined;
4063
4043
  tier?: string | undefined;
4044
+ eventId?: string | undefined;
4064
4045
  guard?: SExpr | undefined;
4046
+ triggersId?: string | undefined;
4065
4047
  payloadMapping?: Record<string, string> | undefined;
4066
4048
  }>, "many">>;
4067
4049
  ui: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -4159,6 +4141,7 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4159
4141
  }, "strip", z.ZodTypeAny, {
4160
4142
  name: string;
4161
4143
  scope: "collection" | "instance";
4144
+ id?: TraitId | undefined;
4162
4145
  description?: string | undefined;
4163
4146
  ui?: Record<string, unknown> | undefined;
4164
4147
  category?: "validation" | "notification" | "lifecycle" | "temporal" | "integration" | "interaction" | "agent" | "game-core" | "game-character" | "game-ai" | "game-combat" | "game-items" | "game-cards" | "game-board" | "game-puzzle" | undefined;
@@ -4166,13 +4149,7 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4166
4149
  capabilities?: string[] | undefined;
4167
4150
  dataEntities?: {
4168
4151
  name: string;
4169
- fields: {
4170
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
4171
- name: string;
4172
- values?: string[] | undefined;
4173
- required?: boolean | undefined;
4174
- default?: unknown;
4175
- }[];
4152
+ fields: TraitEntityField[];
4176
4153
  description?: string | undefined;
4177
4154
  runtime?: boolean | undefined;
4178
4155
  collection?: string | undefined;
@@ -4184,14 +4161,11 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4184
4161
  events: {
4185
4162
  name: string;
4186
4163
  key: string;
4164
+ id?: EventId | undefined;
4187
4165
  description?: string | undefined;
4188
4166
  synonyms?: string | undefined;
4189
4167
  tier?: string | undefined;
4190
- payloadSchema?: {
4191
- type: string;
4192
- name: string;
4193
- required?: boolean | undefined;
4194
- }[] | undefined;
4168
+ payloadSchema?: PayloadField[] | undefined;
4195
4169
  classification?: "domain" | "system" | undefined;
4196
4170
  semanticRole?: string | undefined;
4197
4171
  }[];
@@ -4209,6 +4183,7 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4209
4183
  from: string;
4210
4184
  to: string;
4211
4185
  description?: string | null | undefined;
4186
+ eventId?: EventId | undefined;
4212
4187
  guard?: SExpr | undefined;
4213
4188
  effects?: unknown[][] | undefined;
4214
4189
  }[];
@@ -4224,15 +4199,11 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4224
4199
  synonyms?: string | undefined;
4225
4200
  scope?: "internal" | "external" | undefined;
4226
4201
  tier?: string | undefined;
4227
- payloadSchema?: {
4228
- type: string;
4229
- name: string;
4230
- required?: boolean | undefined;
4231
- description?: string | undefined;
4232
- entityType?: string | undefined;
4233
- }[] | undefined;
4202
+ payloadSchema?: EventPayloadField[] | undefined;
4203
+ eventId?: EventId | undefined;
4234
4204
  }[] | undefined;
4235
4205
  linkedEntity?: string | undefined;
4206
+ linkedEntityId?: EntityId | undefined;
4236
4207
  listens?: {
4237
4208
  event: string;
4238
4209
  triggers: string;
@@ -4243,14 +4214,19 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4243
4214
  } | {
4244
4215
  trait: string;
4245
4216
  kind: "trait";
4217
+ traitId?: TraitId | undefined;
4246
4218
  } | {
4219
+ orbital: string;
4247
4220
  trait: string;
4248
4221
  kind: "orbital";
4249
- orbital: string;
4222
+ traitId?: TraitId | undefined;
4223
+ orbitalId?: OrbitalId | undefined;
4250
4224
  } | undefined;
4251
4225
  scope?: "internal" | "external" | undefined;
4252
4226
  tier?: string | undefined;
4227
+ eventId?: EventId | undefined;
4253
4228
  guard?: SExpr | undefined;
4229
+ triggersId?: EventId | undefined;
4254
4230
  payloadMapping?: Record<string, string> | undefined;
4255
4231
  }[] | undefined;
4256
4232
  description_visual_prompt?: string | undefined;
@@ -4261,8 +4237,10 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4261
4237
  } | undefined;
4262
4238
  entityBindingDescription?: string | undefined;
4263
4239
  entityBindingSynonyms?: string | undefined;
4240
+ entityRefIds?: Record<string, EntityId> | undefined;
4241
+ traitEmbedIds?: Record<string, TraitId> | undefined;
4264
4242
  requiredFields?: {
4265
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
4243
+ type: "string" | "number" | "boolean" | "object" | "date" | "array" | "timestamp" | "datetime" | "enum";
4266
4244
  name: string;
4267
4245
  description?: string | undefined;
4268
4246
  }[] | undefined;
@@ -4276,7 +4254,9 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4276
4254
  guard?: SExpr | undefined;
4277
4255
  priority?: number | undefined;
4278
4256
  appliesTo?: string[] | undefined;
4257
+ pageIds?: PageId[] | undefined;
4279
4258
  emits?: string[] | undefined;
4259
+ emitIds?: EventId[] | undefined;
4280
4260
  }[] | undefined;
4281
4261
  sourceBehavior?: {
4282
4262
  behavior: string;
@@ -4307,6 +4287,7 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4307
4287
  }, {
4308
4288
  name: string;
4309
4289
  scope: "collection" | "instance";
4290
+ id?: string | undefined;
4310
4291
  description?: string | undefined;
4311
4292
  ui?: Record<string, unknown> | undefined;
4312
4293
  category?: "validation" | "notification" | "lifecycle" | "temporal" | "integration" | "interaction" | "agent" | "game-core" | "game-character" | "game-ai" | "game-combat" | "game-items" | "game-cards" | "game-board" | "game-puzzle" | undefined;
@@ -4314,13 +4295,7 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4314
4295
  capabilities?: string[] | undefined;
4315
4296
  dataEntities?: {
4316
4297
  name: string;
4317
- fields: {
4318
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
4319
- name: string;
4320
- values?: string[] | undefined;
4321
- required?: boolean | undefined;
4322
- default?: unknown;
4323
- }[];
4298
+ fields: TraitEntityField[];
4324
4299
  description?: string | undefined;
4325
4300
  runtime?: boolean | undefined;
4326
4301
  collection?: string | undefined;
@@ -4332,14 +4307,11 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4332
4307
  events: {
4333
4308
  name: string;
4334
4309
  key: string;
4310
+ id?: string | undefined;
4335
4311
  description?: string | undefined;
4336
4312
  synonyms?: string | undefined;
4337
4313
  tier?: string | undefined;
4338
- payloadSchema?: {
4339
- type: string;
4340
- name: string;
4341
- required?: boolean | undefined;
4342
- }[] | undefined;
4314
+ payloadSchema?: PayloadField[] | undefined;
4343
4315
  classification?: "domain" | "system" | undefined;
4344
4316
  semanticRole?: string | undefined;
4345
4317
  }[];
@@ -4357,6 +4329,7 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4357
4329
  from: string;
4358
4330
  to: string;
4359
4331
  description?: string | null | undefined;
4332
+ eventId?: string | undefined;
4360
4333
  guard?: SExpr | undefined;
4361
4334
  effects?: unknown[][] | undefined;
4362
4335
  }[];
@@ -4372,15 +4345,11 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4372
4345
  synonyms?: string | undefined;
4373
4346
  scope?: "internal" | "external" | undefined;
4374
4347
  tier?: string | undefined;
4375
- payloadSchema?: {
4376
- type: string;
4377
- name: string;
4378
- required?: boolean | undefined;
4379
- description?: string | undefined;
4380
- entityType?: string | undefined;
4381
- }[] | undefined;
4348
+ payloadSchema?: EventPayloadField[] | undefined;
4349
+ eventId?: string | undefined;
4382
4350
  }[] | undefined;
4383
4351
  linkedEntity?: string | undefined;
4352
+ linkedEntityId?: string | undefined;
4384
4353
  listens?: {
4385
4354
  event: string;
4386
4355
  triggers: string;
@@ -4391,14 +4360,19 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4391
4360
  } | {
4392
4361
  trait: string;
4393
4362
  kind: "trait";
4363
+ traitId?: string | undefined;
4394
4364
  } | {
4365
+ orbital: string;
4395
4366
  trait: string;
4396
4367
  kind: "orbital";
4397
- orbital: string;
4368
+ traitId?: string | undefined;
4369
+ orbitalId?: string | undefined;
4398
4370
  } | undefined;
4399
4371
  scope?: "internal" | "external" | undefined;
4400
4372
  tier?: string | undefined;
4373
+ eventId?: string | undefined;
4401
4374
  guard?: SExpr | undefined;
4375
+ triggersId?: string | undefined;
4402
4376
  payloadMapping?: Record<string, string> | undefined;
4403
4377
  }[] | undefined;
4404
4378
  description_visual_prompt?: string | undefined;
@@ -4409,8 +4383,10 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4409
4383
  } | undefined;
4410
4384
  entityBindingDescription?: string | undefined;
4411
4385
  entityBindingSynonyms?: string | undefined;
4386
+ entityRefIds?: Record<string, string> | undefined;
4387
+ traitEmbedIds?: Record<string, string> | undefined;
4412
4388
  requiredFields?: {
4413
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
4389
+ type: "string" | "number" | "boolean" | "object" | "date" | "array" | "timestamp" | "datetime" | "enum";
4414
4390
  name: string;
4415
4391
  description?: string | undefined;
4416
4392
  }[] | undefined;
@@ -4424,7 +4400,9 @@ declare const TraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4424
4400
  guard?: SExpr | undefined;
4425
4401
  priority?: number | undefined;
4426
4402
  appliesTo?: string[] | undefined;
4403
+ pageIds?: string[] | undefined;
4427
4404
  emits?: string[] | undefined;
4405
+ emitIds?: string[] | undefined;
4428
4406
  }[] | undefined;
4429
4407
  sourceBehavior?: {
4430
4408
  behavior: string;
@@ -4542,6 +4520,7 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4542
4520
  events?: Record<string, string> | undefined;
4543
4521
  linkedEntity?: string | undefined;
4544
4522
  }>, z.ZodObject<{
4523
+ id: z.ZodOptional<z.ZodEffects<z.ZodString, TraitId, string>>;
4545
4524
  name: z.ZodString;
4546
4525
  description: z.ZodOptional<z.ZodString>;
4547
4526
  description_visual_prompt: z.ZodOptional<z.ZodString>;
@@ -4562,41 +4541,26 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4562
4541
  capabilities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
4563
4542
  scope: z.ZodEnum<["instance", "collection"]>;
4564
4543
  linkedEntity: z.ZodOptional<z.ZodString>;
4544
+ linkedEntityId: z.ZodOptional<z.ZodEffects<z.ZodString, EntityId, string>>;
4545
+ entityRefIds: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, EntityId, string>>>;
4546
+ traitEmbedIds: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, TraitId, string>>>;
4565
4547
  requiredFields: z.ZodOptional<z.ZodArray<z.ZodObject<{
4566
4548
  name: z.ZodString;
4567
4549
  type: z.ZodEnum<["string", "number", "boolean", "date", "array", "object", "timestamp", "datetime", "enum"]>;
4568
4550
  description: z.ZodOptional<z.ZodString>;
4569
4551
  }, "strip", z.ZodTypeAny, {
4570
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
4552
+ type: "string" | "number" | "boolean" | "object" | "date" | "array" | "timestamp" | "datetime" | "enum";
4571
4553
  name: string;
4572
4554
  description?: string | undefined;
4573
4555
  }, {
4574
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
4556
+ type: "string" | "number" | "boolean" | "object" | "date" | "array" | "timestamp" | "datetime" | "enum";
4575
4557
  name: string;
4576
4558
  description?: string | undefined;
4577
4559
  }>, "many">>;
4578
4560
  dataEntities: z.ZodOptional<z.ZodArray<z.ZodObject<{
4579
4561
  name: z.ZodString;
4580
4562
  collection: z.ZodOptional<z.ZodString>;
4581
- fields: z.ZodArray<z.ZodObject<{
4582
- name: z.ZodString;
4583
- type: z.ZodEnum<["string", "number", "boolean", "date", "array", "object", "timestamp", "datetime", "enum"]>;
4584
- required: z.ZodOptional<z.ZodBoolean>;
4585
- default: z.ZodOptional<z.ZodUnknown>;
4586
- values: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
4587
- }, "strip", z.ZodTypeAny, {
4588
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
4589
- name: string;
4590
- values?: string[] | undefined;
4591
- required?: boolean | undefined;
4592
- default?: unknown;
4593
- }, {
4594
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
4595
- name: string;
4596
- values?: string[] | undefined;
4597
- required?: boolean | undefined;
4598
- default?: unknown;
4599
- }>, "many">;
4563
+ fields: z.ZodArray<z.ZodType<TraitEntityField, z.ZodTypeDef, TraitEntityField>, "many">;
4600
4564
  timestamps: z.ZodOptional<z.ZodBoolean>;
4601
4565
  description: z.ZodOptional<z.ZodString>;
4602
4566
  runtime: z.ZodOptional<z.ZodBoolean>;
@@ -4604,13 +4568,7 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4604
4568
  pages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
4605
4569
  }, "strip", z.ZodTypeAny, {
4606
4570
  name: string;
4607
- fields: {
4608
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
4609
- name: string;
4610
- values?: string[] | undefined;
4611
- required?: boolean | undefined;
4612
- default?: unknown;
4613
- }[];
4571
+ fields: TraitEntityField[];
4614
4572
  description?: string | undefined;
4615
4573
  runtime?: boolean | undefined;
4616
4574
  collection?: string | undefined;
@@ -4619,13 +4577,7 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4619
4577
  singleton?: boolean | undefined;
4620
4578
  }, {
4621
4579
  name: string;
4622
- fields: {
4623
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
4624
- name: string;
4625
- values?: string[] | undefined;
4626
- required?: boolean | undefined;
4627
- default?: unknown;
4628
- }[];
4580
+ fields: TraitEntityField[];
4629
4581
  description?: string | undefined;
4630
4582
  runtime?: boolean | undefined;
4631
4583
  collection?: string | undefined;
@@ -4661,49 +4613,32 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4661
4613
  }>, "many">;
4662
4614
  events: z.ZodArray<z.ZodObject<{
4663
4615
  key: z.ZodString;
4616
+ id: z.ZodOptional<z.ZodEffects<z.ZodString, EventId, string>>;
4664
4617
  name: z.ZodString;
4665
4618
  description: z.ZodOptional<z.ZodString>;
4666
4619
  synonyms: z.ZodOptional<z.ZodString>;
4667
4620
  tier: z.ZodOptional<z.ZodString>;
4668
- payloadSchema: z.ZodOptional<z.ZodArray<z.ZodObject<{
4669
- name: z.ZodString;
4670
- type: z.ZodString;
4671
- required: z.ZodOptional<z.ZodBoolean>;
4672
- }, "strip", z.ZodTypeAny, {
4673
- type: string;
4674
- name: string;
4675
- required?: boolean | undefined;
4676
- }, {
4677
- type: string;
4678
- name: string;
4679
- required?: boolean | undefined;
4680
- }>, "many">>;
4621
+ payloadSchema: z.ZodOptional<z.ZodArray<z.ZodType<PayloadField, z.ZodTypeDef, PayloadField>, "many">>;
4681
4622
  classification: z.ZodOptional<z.ZodEnum<["domain", "system"]>>;
4682
4623
  semanticRole: z.ZodOptional<z.ZodString>;
4683
4624
  }, "strip", z.ZodTypeAny, {
4684
4625
  name: string;
4685
4626
  key: string;
4627
+ id?: EventId | undefined;
4686
4628
  description?: string | undefined;
4687
4629
  synonyms?: string | undefined;
4688
4630
  tier?: string | undefined;
4689
- payloadSchema?: {
4690
- type: string;
4691
- name: string;
4692
- required?: boolean | undefined;
4693
- }[] | undefined;
4631
+ payloadSchema?: PayloadField[] | undefined;
4694
4632
  classification?: "domain" | "system" | undefined;
4695
4633
  semanticRole?: string | undefined;
4696
4634
  }, {
4697
4635
  name: string;
4698
4636
  key: string;
4637
+ id?: string | undefined;
4699
4638
  description?: string | undefined;
4700
4639
  synonyms?: string | undefined;
4701
4640
  tier?: string | undefined;
4702
- payloadSchema?: {
4703
- type: string;
4704
- name: string;
4705
- required?: boolean | undefined;
4706
- }[] | undefined;
4641
+ payloadSchema?: PayloadField[] | undefined;
4707
4642
  classification?: "domain" | "system" | undefined;
4708
4643
  semanticRole?: string | undefined;
4709
4644
  }>, "many">;
@@ -4711,6 +4646,7 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4711
4646
  from: z.ZodString;
4712
4647
  to: z.ZodString;
4713
4648
  event: z.ZodString;
4649
+ eventId: z.ZodOptional<z.ZodEffects<z.ZodString, EventId, string>>;
4714
4650
  guard: z.ZodOptional<z.ZodNullable<z.ZodType<SExpr, z.ZodTypeDef, SExpr>>>;
4715
4651
  effects: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodArray<z.ZodUnknown, "many">, unknown[], unknown[]>, "many">>;
4716
4652
  description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -4719,6 +4655,7 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4719
4655
  from: string;
4720
4656
  to: string;
4721
4657
  description?: string | null | undefined;
4658
+ eventId?: EventId | undefined;
4722
4659
  guard?: SExpr | undefined;
4723
4660
  effects?: unknown[][] | undefined;
4724
4661
  }, {
@@ -4726,6 +4663,7 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4726
4663
  from: string;
4727
4664
  to: string;
4728
4665
  description?: string | null | undefined;
4666
+ eventId?: string | undefined;
4729
4667
  guard?: SExpr | undefined;
4730
4668
  effects?: unknown[][] | undefined;
4731
4669
  }>, "many">;
@@ -4746,14 +4684,11 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4746
4684
  events: {
4747
4685
  name: string;
4748
4686
  key: string;
4687
+ id?: EventId | undefined;
4749
4688
  description?: string | undefined;
4750
4689
  synonyms?: string | undefined;
4751
4690
  tier?: string | undefined;
4752
- payloadSchema?: {
4753
- type: string;
4754
- name: string;
4755
- required?: boolean | undefined;
4756
- }[] | undefined;
4691
+ payloadSchema?: PayloadField[] | undefined;
4757
4692
  classification?: "domain" | "system" | undefined;
4758
4693
  semanticRole?: string | undefined;
4759
4694
  }[];
@@ -4771,6 +4706,7 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4771
4706
  from: string;
4772
4707
  to: string;
4773
4708
  description?: string | null | undefined;
4709
+ eventId?: EventId | undefined;
4774
4710
  guard?: SExpr | undefined;
4775
4711
  effects?: unknown[][] | undefined;
4776
4712
  }[];
@@ -4783,14 +4719,11 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4783
4719
  events: {
4784
4720
  name: string;
4785
4721
  key: string;
4722
+ id?: string | undefined;
4786
4723
  description?: string | undefined;
4787
4724
  synonyms?: string | undefined;
4788
4725
  tier?: string | undefined;
4789
- payloadSchema?: {
4790
- type: string;
4791
- name: string;
4792
- required?: boolean | undefined;
4793
- }[] | undefined;
4726
+ payloadSchema?: PayloadField[] | undefined;
4794
4727
  classification?: "domain" | "system" | undefined;
4795
4728
  semanticRole?: string | undefined;
4796
4729
  }[];
@@ -4808,6 +4741,7 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4808
4741
  from: string;
4809
4742
  to: string;
4810
4743
  description?: string | null | undefined;
4744
+ eventId?: string | undefined;
4811
4745
  guard?: SExpr | undefined;
4812
4746
  effects?: unknown[][] | undefined;
4813
4747
  }[];
@@ -4825,9 +4759,11 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4825
4759
  interval: z.ZodUnion<[z.ZodLiteral<"frame">, z.ZodNumber]>;
4826
4760
  appliesTo: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
4827
4761
  pages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
4762
+ pageIds: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, PageId, string>, "many">>;
4828
4763
  guard: z.ZodOptional<z.ZodType<SExpr, z.ZodTypeDef, SExpr>>;
4829
4764
  effects: z.ZodArray<z.ZodEffects<z.ZodArray<z.ZodUnknown, "many">, unknown[], unknown[]>, "many">;
4830
4765
  emits: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
4766
+ emitIds: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, EventId, string>, "many">>;
4831
4767
  }, "strip", z.ZodTypeAny, {
4832
4768
  name: string;
4833
4769
  effects: unknown[][];
@@ -4837,7 +4773,9 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4837
4773
  guard?: SExpr | undefined;
4838
4774
  priority?: number | undefined;
4839
4775
  appliesTo?: string[] | undefined;
4776
+ pageIds?: PageId[] | undefined;
4840
4777
  emits?: string[] | undefined;
4778
+ emitIds?: EventId[] | undefined;
4841
4779
  }, {
4842
4780
  name: string;
4843
4781
  effects: unknown[][];
@@ -4847,7 +4785,9 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4847
4785
  guard?: SExpr | undefined;
4848
4786
  priority?: number | undefined;
4849
4787
  appliesTo?: string[] | undefined;
4788
+ pageIds?: string[] | undefined;
4850
4789
  emits?: string[] | undefined;
4790
+ emitIds?: string[] | undefined;
4851
4791
  }>, "many">>;
4852
4792
  emits: z.ZodOptional<z.ZodArray<z.ZodObject<{
4853
4793
  /**
@@ -4855,41 +4795,16 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4855
4795
  * starts with a letter, then any letters / digits / underscores. Both
4856
4796
  * UPPER_SNAKE_CASE and PascalCase shapes are valid identifiers in the
4857
4797
  * post-Phase 2.5 nominal-event type system (events declared via
4858
- * `type X = Event<T>`).
4798
+ * `type X = Event<T>`). A pre-resolution `@config.<knob>` reference
4799
+ * (Option B) is also legal — inline/resolve substitutes it with the
4800
+ * knob's effective literal before codegen/runtime consume it.
4859
4801
  */
4860
4802
  event: z.ZodString;
4803
+ eventId: z.ZodOptional<z.ZodEffects<z.ZodString, EventId, string>>;
4861
4804
  description: z.ZodOptional<z.ZodString>;
4862
4805
  synonyms: z.ZodOptional<z.ZodString>;
4863
4806
  tier: z.ZodOptional<z.ZodString>;
4864
- payloadSchema: z.ZodOptional<z.ZodArray<z.ZodObject<{
4865
- name: z.ZodString;
4866
- /**
4867
- * Field type. Mirrors the Rust validator's acceptance: any non-empty
4868
- * string. Primitives ('string' | 'number' | 'boolean' | 'object' |
4869
- * 'array') are the canonical values; entity-name references like
4870
- * 'ModalRecord' and array-of-entity references like '[ModalRecord]'
4871
- * are also valid because the Rust IR's PayloadField.field_type is
4872
- * just a String. Only enforced narrowly at the call site (e.g.
4873
- * emit-literal type-mismatch warnings in
4874
- * orbital-compiler/phases/validation/emit_payload.rs) — not here.
4875
- */
4876
- type: z.ZodString;
4877
- required: z.ZodOptional<z.ZodBoolean>;
4878
- description: z.ZodOptional<z.ZodString>;
4879
- entityType: z.ZodOptional<z.ZodString>;
4880
- }, "strip", z.ZodTypeAny, {
4881
- type: string;
4882
- name: string;
4883
- required?: boolean | undefined;
4884
- description?: string | undefined;
4885
- entityType?: string | undefined;
4886
- }, {
4887
- type: string;
4888
- name: string;
4889
- required?: boolean | undefined;
4890
- description?: string | undefined;
4891
- entityType?: string | undefined;
4892
- }>, "many">>;
4807
+ payloadSchema: z.ZodOptional<z.ZodArray<z.ZodType<EventPayloadField, z.ZodTypeDef, EventPayloadField>, "many">>;
4893
4808
  scope: z.ZodOptional<z.ZodEnum<["internal", "external"]>>;
4894
4809
  }, "strip", z.ZodTypeAny, {
4895
4810
  event: string;
@@ -4897,30 +4812,22 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4897
4812
  synonyms?: string | undefined;
4898
4813
  scope?: "internal" | "external" | undefined;
4899
4814
  tier?: string | undefined;
4900
- payloadSchema?: {
4901
- type: string;
4902
- name: string;
4903
- required?: boolean | undefined;
4904
- description?: string | undefined;
4905
- entityType?: string | undefined;
4906
- }[] | undefined;
4815
+ payloadSchema?: EventPayloadField[] | undefined;
4816
+ eventId?: EventId | undefined;
4907
4817
  }, {
4908
4818
  event: string;
4909
4819
  description?: string | undefined;
4910
4820
  synonyms?: string | undefined;
4911
4821
  scope?: "internal" | "external" | undefined;
4912
4822
  tier?: string | undefined;
4913
- payloadSchema?: {
4914
- type: string;
4915
- name: string;
4916
- required?: boolean | undefined;
4917
- description?: string | undefined;
4918
- entityType?: string | undefined;
4919
- }[] | undefined;
4823
+ payloadSchema?: EventPayloadField[] | undefined;
4824
+ eventId?: string | undefined;
4920
4825
  }>, "many">>;
4921
4826
  listens: z.ZodOptional<z.ZodArray<z.ZodObject<{
4922
4827
  event: z.ZodString;
4828
+ eventId: z.ZodOptional<z.ZodEffects<z.ZodString, EventId, string>>;
4923
4829
  triggers: z.ZodString;
4830
+ triggersId: z.ZodOptional<z.ZodEffects<z.ZodString, EventId, string>>;
4924
4831
  description: z.ZodOptional<z.ZodString>;
4925
4832
  synonyms: z.ZodOptional<z.ZodString>;
4926
4833
  tier: z.ZodOptional<z.ZodString>;
@@ -4936,24 +4843,33 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4936
4843
  }>, z.ZodObject<{
4937
4844
  kind: z.ZodLiteral<"trait">;
4938
4845
  trait: z.ZodString;
4846
+ traitId: z.ZodOptional<z.ZodEffects<z.ZodString, TraitId, string>>;
4939
4847
  }, "strip", z.ZodTypeAny, {
4940
4848
  trait: string;
4941
4849
  kind: "trait";
4850
+ traitId?: TraitId | undefined;
4942
4851
  }, {
4943
4852
  trait: string;
4944
4853
  kind: "trait";
4854
+ traitId?: string | undefined;
4945
4855
  }>, z.ZodObject<{
4946
4856
  kind: z.ZodLiteral<"orbital">;
4947
4857
  orbital: z.ZodString;
4948
4858
  trait: z.ZodString;
4859
+ orbitalId: z.ZodOptional<z.ZodEffects<z.ZodString, OrbitalId, string>>;
4860
+ traitId: z.ZodOptional<z.ZodEffects<z.ZodString, TraitId, string>>;
4949
4861
  }, "strip", z.ZodTypeAny, {
4862
+ orbital: string;
4950
4863
  trait: string;
4951
4864
  kind: "orbital";
4952
- orbital: string;
4865
+ traitId?: TraitId | undefined;
4866
+ orbitalId?: OrbitalId | undefined;
4953
4867
  }, {
4868
+ orbital: string;
4954
4869
  trait: string;
4955
4870
  kind: "orbital";
4956
- orbital: string;
4871
+ traitId?: string | undefined;
4872
+ orbitalId?: string | undefined;
4957
4873
  }>]>>;
4958
4874
  }, "strip", z.ZodTypeAny, {
4959
4875
  event: string;
@@ -4965,14 +4881,19 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4965
4881
  } | {
4966
4882
  trait: string;
4967
4883
  kind: "trait";
4884
+ traitId?: TraitId | undefined;
4968
4885
  } | {
4886
+ orbital: string;
4969
4887
  trait: string;
4970
4888
  kind: "orbital";
4971
- orbital: string;
4889
+ traitId?: TraitId | undefined;
4890
+ orbitalId?: OrbitalId | undefined;
4972
4891
  } | undefined;
4973
4892
  scope?: "internal" | "external" | undefined;
4974
4893
  tier?: string | undefined;
4894
+ eventId?: EventId | undefined;
4975
4895
  guard?: SExpr | undefined;
4896
+ triggersId?: EventId | undefined;
4976
4897
  payloadMapping?: Record<string, string> | undefined;
4977
4898
  }, {
4978
4899
  event: string;
@@ -4984,14 +4905,19 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
4984
4905
  } | {
4985
4906
  trait: string;
4986
4907
  kind: "trait";
4908
+ traitId?: string | undefined;
4987
4909
  } | {
4910
+ orbital: string;
4988
4911
  trait: string;
4989
4912
  kind: "orbital";
4990
- orbital: string;
4913
+ traitId?: string | undefined;
4914
+ orbitalId?: string | undefined;
4991
4915
  } | undefined;
4992
4916
  scope?: "internal" | "external" | undefined;
4993
4917
  tier?: string | undefined;
4918
+ eventId?: string | undefined;
4994
4919
  guard?: SExpr | undefined;
4920
+ triggersId?: string | undefined;
4995
4921
  payloadMapping?: Record<string, string> | undefined;
4996
4922
  }>, "many">>;
4997
4923
  ui: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -5089,6 +5015,7 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
5089
5015
  }, "strip", z.ZodTypeAny, {
5090
5016
  name: string;
5091
5017
  scope: "collection" | "instance";
5018
+ id?: TraitId | undefined;
5092
5019
  description?: string | undefined;
5093
5020
  ui?: Record<string, unknown> | undefined;
5094
5021
  category?: "validation" | "notification" | "lifecycle" | "temporal" | "integration" | "interaction" | "agent" | "game-core" | "game-character" | "game-ai" | "game-combat" | "game-items" | "game-cards" | "game-board" | "game-puzzle" | undefined;
@@ -5096,13 +5023,7 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
5096
5023
  capabilities?: string[] | undefined;
5097
5024
  dataEntities?: {
5098
5025
  name: string;
5099
- fields: {
5100
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
5101
- name: string;
5102
- values?: string[] | undefined;
5103
- required?: boolean | undefined;
5104
- default?: unknown;
5105
- }[];
5026
+ fields: TraitEntityField[];
5106
5027
  description?: string | undefined;
5107
5028
  runtime?: boolean | undefined;
5108
5029
  collection?: string | undefined;
@@ -5114,14 +5035,11 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
5114
5035
  events: {
5115
5036
  name: string;
5116
5037
  key: string;
5038
+ id?: EventId | undefined;
5117
5039
  description?: string | undefined;
5118
5040
  synonyms?: string | undefined;
5119
5041
  tier?: string | undefined;
5120
- payloadSchema?: {
5121
- type: string;
5122
- name: string;
5123
- required?: boolean | undefined;
5124
- }[] | undefined;
5042
+ payloadSchema?: PayloadField[] | undefined;
5125
5043
  classification?: "domain" | "system" | undefined;
5126
5044
  semanticRole?: string | undefined;
5127
5045
  }[];
@@ -5139,6 +5057,7 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
5139
5057
  from: string;
5140
5058
  to: string;
5141
5059
  description?: string | null | undefined;
5060
+ eventId?: EventId | undefined;
5142
5061
  guard?: SExpr | undefined;
5143
5062
  effects?: unknown[][] | undefined;
5144
5063
  }[];
@@ -5154,15 +5073,11 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
5154
5073
  synonyms?: string | undefined;
5155
5074
  scope?: "internal" | "external" | undefined;
5156
5075
  tier?: string | undefined;
5157
- payloadSchema?: {
5158
- type: string;
5159
- name: string;
5160
- required?: boolean | undefined;
5161
- description?: string | undefined;
5162
- entityType?: string | undefined;
5163
- }[] | undefined;
5076
+ payloadSchema?: EventPayloadField[] | undefined;
5077
+ eventId?: EventId | undefined;
5164
5078
  }[] | undefined;
5165
5079
  linkedEntity?: string | undefined;
5080
+ linkedEntityId?: EntityId | undefined;
5166
5081
  listens?: {
5167
5082
  event: string;
5168
5083
  triggers: string;
@@ -5173,14 +5088,19 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
5173
5088
  } | {
5174
5089
  trait: string;
5175
5090
  kind: "trait";
5091
+ traitId?: TraitId | undefined;
5176
5092
  } | {
5093
+ orbital: string;
5177
5094
  trait: string;
5178
5095
  kind: "orbital";
5179
- orbital: string;
5096
+ traitId?: TraitId | undefined;
5097
+ orbitalId?: OrbitalId | undefined;
5180
5098
  } | undefined;
5181
5099
  scope?: "internal" | "external" | undefined;
5182
5100
  tier?: string | undefined;
5101
+ eventId?: EventId | undefined;
5183
5102
  guard?: SExpr | undefined;
5103
+ triggersId?: EventId | undefined;
5184
5104
  payloadMapping?: Record<string, string> | undefined;
5185
5105
  }[] | undefined;
5186
5106
  description_visual_prompt?: string | undefined;
@@ -5191,8 +5111,10 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
5191
5111
  } | undefined;
5192
5112
  entityBindingDescription?: string | undefined;
5193
5113
  entityBindingSynonyms?: string | undefined;
5114
+ entityRefIds?: Record<string, EntityId> | undefined;
5115
+ traitEmbedIds?: Record<string, TraitId> | undefined;
5194
5116
  requiredFields?: {
5195
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
5117
+ type: "string" | "number" | "boolean" | "object" | "date" | "array" | "timestamp" | "datetime" | "enum";
5196
5118
  name: string;
5197
5119
  description?: string | undefined;
5198
5120
  }[] | undefined;
@@ -5206,7 +5128,9 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
5206
5128
  guard?: SExpr | undefined;
5207
5129
  priority?: number | undefined;
5208
5130
  appliesTo?: string[] | undefined;
5131
+ pageIds?: PageId[] | undefined;
5209
5132
  emits?: string[] | undefined;
5133
+ emitIds?: EventId[] | undefined;
5210
5134
  }[] | undefined;
5211
5135
  sourceBehavior?: {
5212
5136
  behavior: string;
@@ -5237,6 +5161,7 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
5237
5161
  }, {
5238
5162
  name: string;
5239
5163
  scope: "collection" | "instance";
5164
+ id?: string | undefined;
5240
5165
  description?: string | undefined;
5241
5166
  ui?: Record<string, unknown> | undefined;
5242
5167
  category?: "validation" | "notification" | "lifecycle" | "temporal" | "integration" | "interaction" | "agent" | "game-core" | "game-character" | "game-ai" | "game-combat" | "game-items" | "game-cards" | "game-board" | "game-puzzle" | undefined;
@@ -5244,13 +5169,7 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
5244
5169
  capabilities?: string[] | undefined;
5245
5170
  dataEntities?: {
5246
5171
  name: string;
5247
- fields: {
5248
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
5249
- name: string;
5250
- values?: string[] | undefined;
5251
- required?: boolean | undefined;
5252
- default?: unknown;
5253
- }[];
5172
+ fields: TraitEntityField[];
5254
5173
  description?: string | undefined;
5255
5174
  runtime?: boolean | undefined;
5256
5175
  collection?: string | undefined;
@@ -5262,14 +5181,11 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
5262
5181
  events: {
5263
5182
  name: string;
5264
5183
  key: string;
5184
+ id?: string | undefined;
5265
5185
  description?: string | undefined;
5266
5186
  synonyms?: string | undefined;
5267
5187
  tier?: string | undefined;
5268
- payloadSchema?: {
5269
- type: string;
5270
- name: string;
5271
- required?: boolean | undefined;
5272
- }[] | undefined;
5188
+ payloadSchema?: PayloadField[] | undefined;
5273
5189
  classification?: "domain" | "system" | undefined;
5274
5190
  semanticRole?: string | undefined;
5275
5191
  }[];
@@ -5287,6 +5203,7 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
5287
5203
  from: string;
5288
5204
  to: string;
5289
5205
  description?: string | null | undefined;
5206
+ eventId?: string | undefined;
5290
5207
  guard?: SExpr | undefined;
5291
5208
  effects?: unknown[][] | undefined;
5292
5209
  }[];
@@ -5302,15 +5219,11 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
5302
5219
  synonyms?: string | undefined;
5303
5220
  scope?: "internal" | "external" | undefined;
5304
5221
  tier?: string | undefined;
5305
- payloadSchema?: {
5306
- type: string;
5307
- name: string;
5308
- required?: boolean | undefined;
5309
- description?: string | undefined;
5310
- entityType?: string | undefined;
5311
- }[] | undefined;
5222
+ payloadSchema?: EventPayloadField[] | undefined;
5223
+ eventId?: string | undefined;
5312
5224
  }[] | undefined;
5313
5225
  linkedEntity?: string | undefined;
5226
+ linkedEntityId?: string | undefined;
5314
5227
  listens?: {
5315
5228
  event: string;
5316
5229
  triggers: string;
@@ -5321,14 +5234,19 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
5321
5234
  } | {
5322
5235
  trait: string;
5323
5236
  kind: "trait";
5237
+ traitId?: string | undefined;
5324
5238
  } | {
5239
+ orbital: string;
5325
5240
  trait: string;
5326
5241
  kind: "orbital";
5327
- orbital: string;
5242
+ traitId?: string | undefined;
5243
+ orbitalId?: string | undefined;
5328
5244
  } | undefined;
5329
5245
  scope?: "internal" | "external" | undefined;
5330
5246
  tier?: string | undefined;
5247
+ eventId?: string | undefined;
5331
5248
  guard?: SExpr | undefined;
5249
+ triggersId?: string | undefined;
5332
5250
  payloadMapping?: Record<string, string> | undefined;
5333
5251
  }[] | undefined;
5334
5252
  description_visual_prompt?: string | undefined;
@@ -5339,8 +5257,10 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
5339
5257
  } | undefined;
5340
5258
  entityBindingDescription?: string | undefined;
5341
5259
  entityBindingSynonyms?: string | undefined;
5260
+ entityRefIds?: Record<string, string> | undefined;
5261
+ traitEmbedIds?: Record<string, string> | undefined;
5342
5262
  requiredFields?: {
5343
- type: "string" | "number" | "boolean" | "object" | "date" | "timestamp" | "datetime" | "array" | "enum";
5263
+ type: "string" | "number" | "boolean" | "object" | "date" | "array" | "timestamp" | "datetime" | "enum";
5344
5264
  name: string;
5345
5265
  description?: string | undefined;
5346
5266
  }[] | undefined;
@@ -5354,7 +5274,9 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
5354
5274
  guard?: SExpr | undefined;
5355
5275
  priority?: number | undefined;
5356
5276
  appliesTo?: string[] | undefined;
5277
+ pageIds?: string[] | undefined;
5357
5278
  emits?: string[] | undefined;
5279
+ emitIds?: string[] | undefined;
5358
5280
  }[] | undefined;
5359
5281
  sourceBehavior?: {
5360
5282
  behavior: string;
@@ -5384,4 +5306,4 @@ declare const OrbitalTraitRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
5384
5306
  } | undefined;
5385
5307
  }>]>;
5386
5308
 
5387
- export { OrbitalTraitRefSchema as $, type AgentEffect as A, EventSchema as B, type CallSiteConfig as C, type DeclaredTraitConfig as D, type Effect as E, type EventScope as F, EventScopeSchema as G, type FetchEffect as H, type FetchOptions as I, type FetchResult as J, type ForwardConfig as K, type ForwardEffect as L, type Guard as M, type GuardInput as N, GuardSchema as O, type ListenSource as P, ListenSourceSchema as Q, type LogEffect as R, type State as S, type TraitEventListener as T, type McpServiceDef as U, McpServiceDefSchema as V, type NavigateEffect as W, type NnConfig as X, type NnLayer as Y, type NotifyEffect as Z, type OrbitalTraitRef as _, type TraitReference as a, TraitReferenceSchema as a$, type OsEffect as a0, type PayloadField as a1, PayloadFieldSchema as a2, type PersistData as a3, type PersistEffect as a4, type PersistEmitConfig as a5, type PresentationType as a6, type RefEffect as a7, type RenderBinding as a8, type RenderItemLambda as a9, type SpawnEffect as aA, type StateInput as aB, type StateMachine as aC, type StateMachineInput as aD, StateMachineSchema as aE, StateSchema as aF, type SwapEffect as aG, type TrainConfig as aH, type TrainEffect as aI, type TraitCategory as aJ, TraitCategorySchema as aK, type TraitConfig as aL, type TraitConfigObject as aM, TraitConfigSchema as aN, type TraitConfigValue as aO, TraitConfigValueSchema as aP, type TraitDataEntity as aQ, TraitDataEntitySchema as aR, type TraitEntityField as aS, TraitEntityFieldSchema as aT, type TraitEventContract as aU, TraitEventContractSchema as aV, TraitEventListenerSchema as aW, type TraitInput as aX, type TraitRef as aY, TraitRefSchema as aZ, type TraitReferenceInput as a_, type RenderUIEffect as aa, type RenderUINode as ab, type RequiredField as ac, RequiredFieldSchema as ad, type ResolvedPatternProps as ae, type RestAuthConfig as af, RestAuthConfigSchema as ag, type RestServiceDef as ah, RestServiceDefSchema as ai, SERVICE_TYPES as aj, type ServiceDefinition as ak, ServiceDefinitionSchema as al, type ServiceParams as am, type ServiceParamsValue as an, type ServiceRef as ao, type ServiceRefObject as ap, ServiceRefObjectSchema as aq, ServiceRefSchema as ar, ServiceRefStringSchema as as, type ServiceType as at, ServiceTypeSchema as au, type SetEffect as av, type SocketEvents as aw, SocketEventsSchema as ax, type SocketServiceDef as ay, SocketServiceDefSchema as az, type CallSiteConfigEntry as b, TraitSchema as b0, type TraitTick as b1, TraitTickSchema as b2, type TraitUIBinding as b3, type Transition as b4, type TransitionInput as b5, TransitionSchema as b6, type TypedEffect as b7, type UISlot as b8, UISlotSchema as b9, notify as bA, parseServiceRef as bB, persist as bC, ref as bD, renderUI as bE, set as bF, spawn as bG, swap as bH, watch as bI, type TraitScope as bJ, UI_SLOTS as ba, type WatchEffect as bb, type WatchOptions as bc, atomic as bd, callService as be, deref as bf, despawn as bg, doEffects as bh, emit as bi, findService as bj, getServiceNames as bk, getTraitConfig as bl, getTraitName as bm, hasService as bn, isCallSiteConfigDeclaration as bo, isCircuitEvent as bp, isEffect as bq, isInlineTrait as br, isMcpService as bs, isRestService as bt, isSExprEffect as bu, isServiceReference as bv, isServiceReferenceObject as bw, isSocketService as bx, navigate as by, normalizeTraitRef as bz, type Trait as c, type AtomicEffect as d, type CallServiceConfig as e, type CallServiceEffect as f, type CheckpointLoadEffect as g, type CheckpointSaveEffect as h, type ConfigFieldDeclaration as i, ConfigFieldDeclarationSchema as j, DeclaredTraitConfigSchema as k, type DerefEffect as l, type DespawnEffect as m, type DoEffect as n, type EffectInput as o, EffectSchema as p, type EmitConfig as q, type EmitEffect as r, type EntityFieldContract as s, EntityFieldContractSchema as t, type EvaluateConfig as u, type EvaluateEffect as v, type Event as w, type EventInput as x, type EventPayloadField as y, EventPayloadFieldSchema as z };
5309
+ export { type LogEffect as $, type AgentEffect as A, type BehaviorEffect as B, type CallSiteConfig as C, type DeclaredTraitConfig as D, type Effect as E, type EvaluateConfig as F, type EvaluateEffect as G, type Event as H, type EventInput as I, type EventPayloadField as J, EventPayloadFieldSchema as K, EventSchema as L, type EventScope as M, EventScopeSchema as N, type FetchEffect as O, type FetchOptions as P, type FetchResult as Q, type ForwardConfig as R, type State as S, type TraitEventListener as T, type ForwardEffect as U, type Guard as V, type GuardInput as W, GuardSchema as X, type ListenSource as Y, ListenSourceSchema as Z, type LlmEffect as _, type TraitReference as a, type TraitConfigValue as a$, type McpServiceDef as a0, McpServiceDefSchema as a1, type MemoryEffect as a2, type NavigateEffect as a3, type NnConfig as a4, type NnLayer as a5, type NotifyEffect as a6, type OrbitalTraitRef as a7, OrbitalTraitRefSchema as a8, type OsEffect as a9, type ServiceRef as aA, type ServiceRefObject as aB, ServiceRefObjectSchema as aC, ServiceRefSchema as aD, ServiceRefStringSchema as aE, type ServiceType as aF, ServiceTypeSchema as aG, type SessionEffect as aH, type SetEffect as aI, type SocketEvents as aJ, SocketEventsSchema as aK, type SocketServiceDef as aL, SocketServiceDefSchema as aM, type SpawnEffect as aN, type StateInput as aO, type StateMachine as aP, type StateMachineInput as aQ, StateMachineSchema as aR, StateSchema as aS, type SwapEffect as aT, type TraceEffect as aU, type TrainConfig as aV, type TrainEffect as aW, type TraitCategory as aX, TraitCategorySchema as aY, type TraitConfigObject as aZ, TraitConfigSchema as a_, type PayloadField as aa, PayloadFieldSchema as ab, type PersistData as ac, type PersistEffect as ad, type PersistEmitConfig as ae, type PresentationType as af, REFERENCE_CONFIG_TYPES as ag, type RefEffect as ah, type ReferenceConfigType as ai, type RenderBinding as aj, type RenderChildrenMap as ak, type RenderItemLambda as al, type RenderUIEffect as am, type RenderUINode as an, type RequiredField as ao, RequiredFieldSchema as ap, type ResolvedPatternProps as aq, type RestAuthConfig as ar, RestAuthConfigSchema as as, type RestServiceDef as at, RestServiceDefSchema as au, SERVICE_TYPES as av, type ServiceDefinition as aw, ServiceDefinitionSchema as ax, type ServiceParams as ay, type ServiceParamsValue as az, type CallSiteConfigEntry as b, type TraitScope as b$, TraitConfigValueSchema as b0, type TraitDataEntity as b1, TraitDataEntitySchema as b2, type TraitEntityField as b3, TraitEntityFieldSchema as b4, type TraitEventContract as b5, TraitEventContractSchema as b6, TraitEventListenerSchema as b7, type TraitInput as b8, type TraitRef as b9, getTraitConfig as bA, getTraitName as bB, hasService as bC, isCallSiteConfigDeclaration as bD, isCircuitEvent as bE, isEffect as bF, isInlineTrait as bG, isMcpService as bH, isReferenceConfigType as bI, isRestService as bJ, isSExprEffect as bK, isServiceReference as bL, isServiceReferenceObject as bM, isSocketService as bN, navigate as bO, normalizeCallSiteConfigToValues as bP, normalizeTraitRef as bQ, notify as bR, parseServiceRef as bS, persist as bT, ref as bU, renderUI as bV, resolveConfigRefEventName as bW, set as bX, spawn as bY, swap as bZ, watch as b_, TraitRefSchema as ba, type TraitReferenceInput as bb, TraitReferenceSchema as bc, TraitSchema as bd, type TraitTick as be, TraitTickSchema as bf, type TraitUIBinding as bg, type Transition as bh, type TransitionInput as bi, TransitionSchema as bj, type TypedEffect as bk, type UISlot as bl, UISlotSchema as bm, UI_SLOTS as bn, type ValidateEffect as bo, type WatchEffect as bp, type WatchOptions as bq, atomic as br, callService as bs, configRefEventKnob as bt, deref as bu, despawn as bv, doEffects as bw, emit as bx, findService as by, getServiceNames as bz, type Trait as c, type TraitConfig as d, type ApplicationEffect as e, type AtomicEffect as f, CONFIG_REF_EVENT_PATTERN as g, type CallServiceConfig as h, type CallServiceEffect as i, type CheckpointLoadEffect as j, type CheckpointSaveEffect as k, type ComposeEffect as l, type ConfigFieldDeclaration as m, ConfigFieldDeclarationSchema as n, type ConfigFieldItemsDeclaration as o, type ConfigRefEventError as p, DeclaredTraitConfigSchema as q, type DerefEffect as r, type DespawnEffect as s, type DoEffect as t, type EffectInput as u, EffectSchema as v, type EmitConfig as w, type EmitEffect as x, type EntityFieldContract as y, EntityFieldContractSchema as z };