@almadar/core 10.129.0 → 11.0.1

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.
Files changed (135) hide show
  1. package/dist/behavior-package.d.ts +49 -11
  2. package/dist/behavior-package.js +1 -1
  3. package/dist/{orbital-CkFdDS9f.d.ts → builders-BdgbY7Th.d.ts} +5828 -6917
  4. package/dist/builders.d.ts +6 -6
  5. package/dist/builders.js +7 -6
  6. package/dist/{bus-CcbB__oo.d.ts → bus-C0hFDNFR.d.ts} +262 -354
  7. package/dist/chunk-347APWFM.js +286 -0
  8. package/dist/chunk-347APWFM.js.map +1 -0
  9. package/dist/chunk-5WQ3U7NJ.js +2363 -0
  10. package/dist/chunk-5WQ3U7NJ.js.map +1 -0
  11. package/dist/chunk-5YTPYMPZ.js +99 -0
  12. package/dist/chunk-5YTPYMPZ.js.map +1 -0
  13. package/dist/chunk-66Q5VX2F.js +3810 -0
  14. package/dist/chunk-66Q5VX2F.js.map +1 -0
  15. package/dist/chunk-7GHJU5WI.js +39 -0
  16. package/dist/chunk-7GHJU5WI.js.map +1 -0
  17. package/dist/chunk-B4MNHGBP.js +8 -0
  18. package/dist/chunk-B4MNHGBP.js.map +1 -0
  19. package/dist/chunk-E4T2MQAV.js +24 -0
  20. package/dist/chunk-E4T2MQAV.js.map +1 -0
  21. package/dist/chunk-ENOCKYGA.js +412 -0
  22. package/dist/chunk-ENOCKYGA.js.map +1 -0
  23. package/dist/chunk-FGT5OS2Y.js +918 -0
  24. package/dist/chunk-FGT5OS2Y.js.map +1 -0
  25. package/dist/chunk-GF7KCLNR.js +3284 -0
  26. package/dist/chunk-GF7KCLNR.js.map +1 -0
  27. package/dist/chunk-PNGFWLHD.js +1567 -0
  28. package/dist/chunk-PNGFWLHD.js.map +1 -0
  29. package/dist/{chunk-X4SC7FGF.js → chunk-RGACZEYC.js} +99 -96
  30. package/dist/chunk-RGACZEYC.js.map +1 -0
  31. package/dist/{chunk-RYPVOI6H.js → chunk-SNZYN7UA.js} +2541 -433
  32. package/dist/{chunk-RYPVOI6H.js.map → chunk-SNZYN7UA.js.map} +1 -1
  33. package/dist/{chunk-KDMV222Q.js → chunk-TDNQT3M3.js} +304 -373
  34. package/dist/chunk-TDNQT3M3.js.map +1 -0
  35. package/dist/chunk-VG7BRFUD.js +152 -0
  36. package/dist/chunk-VG7BRFUD.js.map +1 -0
  37. package/dist/chunk-Z7BI7DE7.js +1293 -0
  38. package/dist/chunk-Z7BI7DE7.js.map +1 -0
  39. package/dist/{domain-Dz3jP-UM.d.ts → domain-Cpmja5ak.d.ts} +55 -55
  40. package/dist/{effect-CiEVLsZz.d.ts → effect-DZaXwSAz.d.ts} +283 -453
  41. package/dist/{effect-result-Bebwu9yT.d.ts → effect-result-1HpXgeBc.d.ts} +656 -851
  42. package/dist/{expression-D0Fs0riG.d.ts → expression-DirYKz-f.d.ts} +5 -13
  43. package/dist/factory/index.d.ts +7 -144
  44. package/dist/factory/index.js +8 -8
  45. package/dist/factory-runtime/index.d.ts +7 -6
  46. package/dist/factory-runtime/index.js +527 -8
  47. package/dist/factory-runtime/index.js.map +1 -1
  48. package/dist/fixtures.d.ts +9 -11
  49. package/dist/fixtures.js +12 -8
  50. package/dist/fixtures.js.map +1 -1
  51. package/dist/i18n/index.d.ts +15 -19
  52. package/dist/i18n/index.js +2 -1
  53. package/dist/{index-BC-Jycqj.d.ts → index-D7SxwNdv.d.ts} +34 -734
  54. package/dist/index.d.ts +92 -247
  55. package/dist/index.js +322 -986
  56. package/dist/index.js.map +1 -1
  57. package/dist/kernel-wire.d.ts +3 -3
  58. package/dist/kernel-wire.js +3 -79
  59. package/dist/kernel-wire.js.map +1 -1
  60. package/dist/language/constructs.json +22 -2
  61. package/dist/language/program-types.json +203 -22
  62. package/dist/language/protocols.json +46 -0
  63. package/dist/language/ui-vocabulary.json +1697 -0
  64. package/dist/language/validation-codes.json +1222 -1212
  65. package/dist/language/vocabulary.json +44 -8
  66. package/dist/language-data.d.ts +7 -4
  67. package/dist/language-data.js +20 -14
  68. package/dist/language-data.js.map +1 -1
  69. package/dist/patterns/component-mapping.json +11 -1
  70. package/dist/patterns/definitions.d.ts +2 -2
  71. package/dist/patterns/definitions.js +1 -1
  72. package/dist/patterns/event-contracts.json +1 -15
  73. package/dist/patterns/game-font-families.json +13 -0
  74. package/dist/patterns/index.d.ts +24 -120
  75. package/dist/patterns/index.js +3 -3
  76. package/dist/patterns/pattern-tile-geometry.json +1065 -0
  77. package/dist/patterns/patterns-registry.json +2539 -431
  78. package/dist/patterns/registry.json +2539 -431
  79. package/dist/trait-sRjIivFq.d.ts +3519 -0
  80. package/dist/types/index.d.ts +9 -10
  81. package/dist/types/index.js +11 -5
  82. package/dist/{types-DGwrltUF.d.ts → types-C6_yPMpn.d.ts} +3 -3
  83. package/fixtures/events-wire/client-effects-by-trait/response.json +0 -18
  84. package/fixtures/events-wire/client-effects-provenance/response.json +0 -18
  85. package/fixtures/events-wire/effect-results-every-kind/response.json +2 -27
  86. package/fixtures/events-wire/navigate-1/response.json +8 -5
  87. package/fixtures/events-wire/navigate-2/response.json +11 -8
  88. package/fixtures/events-wire/navigate-3/response.json +14 -11
  89. package/fixtures/events-wire/navigate-back/response.json +7 -4
  90. package/fixtures/events-wire/render-ui-3/response.json +12 -9
  91. package/fixtures/events-wire/render-ui-clear/response.json +0 -7
  92. package/fixtures/events-wire/sse-stream/response.json +0 -20
  93. package/fixtures/events-wire/sse-stream/stream.json +0 -20
  94. package/fixtures/events-wire/stateless-traits/response.json +14 -5
  95. package/fixtures/kernel-wire/golden/basic-entity.json +1687 -0
  96. package/fixtures/kernel-wire/golden/entity-rerender.json +743 -0
  97. package/fixtures/kernel-wire/golden/rollback.json +793 -0
  98. package/fixtures/kernel-wire/golden/tick-counter.json +1538 -0
  99. package/fixtures/kernel-wire/golden/two-orbital-chore.json +847 -0
  100. package/fixtures/kernel-wire/golden/two-orbital-task.json +457 -0
  101. package/fixtures/kernel-wire/played-step.json +136 -0
  102. package/fixtures/kernel-wire/scripts/basic-entity.json +28 -0
  103. package/fixtures/kernel-wire/scripts/entity-rerender.json +13 -0
  104. package/fixtures/kernel-wire/scripts/rollback.json +53 -0
  105. package/fixtures/kernel-wire/scripts/tick-counter.json +26 -0
  106. package/fixtures/kernel-wire/scripts/two-orbital-chore.json +9 -0
  107. package/fixtures/kernel-wire/scripts/two-orbital-task.json +9 -0
  108. package/package.json +28 -19
  109. package/dist/builders-DmZE5By0.d.ts +0 -2663
  110. package/dist/chunk-45I2O4SJ.js +0 -4646
  111. package/dist/chunk-45I2O4SJ.js.map +0 -1
  112. package/dist/chunk-6LR43Z5E.js +0 -3061
  113. package/dist/chunk-6LR43Z5E.js.map +0 -1
  114. package/dist/chunk-GIUA3NUJ.js +0 -809
  115. package/dist/chunk-GIUA3NUJ.js.map +0 -1
  116. package/dist/chunk-GTY53NS5.js +0 -1908
  117. package/dist/chunk-GTY53NS5.js.map +0 -1
  118. package/dist/chunk-JOHDVS6J.js +0 -1614
  119. package/dist/chunk-JOHDVS6J.js.map +0 -1
  120. package/dist/chunk-KDMV222Q.js.map +0 -1
  121. package/dist/chunk-QRHJUS3D.js +0 -23
  122. package/dist/chunk-QRHJUS3D.js.map +0 -1
  123. package/dist/chunk-QUOTJULD.js +0 -4009
  124. package/dist/chunk-QUOTJULD.js.map +0 -1
  125. package/dist/chunk-V5VNGRVU.js +0 -66
  126. package/dist/chunk-V5VNGRVU.js.map +0 -1
  127. package/dist/chunk-X4SC7FGF.js.map +0 -1
  128. package/dist/entityAccess-BPSz1i2n.d.ts +0 -80
  129. package/dist/mock/index.d.ts +0 -153
  130. package/dist/mock/index.js +0 -190
  131. package/dist/mock/index.js.map +0 -1
  132. package/dist/schema-T5RT5s6H.d.ts +0 -282
  133. package/dist/state-machine/index.d.ts +0 -359
  134. package/dist/state-machine/index.js +0 -3
  135. package/dist/state-machine/index.js.map +0 -1
@@ -1,4646 +0,0 @@
1
- import { SuggestedGuardSchema, DesignPreferencesSchema, DomainContextSchema, ThemeRefSchema, CustomPatternMapSchema, DesignTokensSchema, ThemeDefinitionSchema } from './chunk-M4S2B5VJ.js';
2
- import { SExprSchema, FieldProjectionSchema, EventIdSchema, ExpressionSchema, SExprListSchema, EffectSchema, EntityFieldSchema, TypeVariableSchema, PageIdSchema, TraitIdSchema, OrbitalIdSchema, EntityIdSchema, PatternObjectSchema, EntitySchema, EntityPersistenceSchema, IdentityLedgerSchema, EventPayloadSchema, deliveryRecordValue } from './chunk-GTY53NS5.js';
3
- import { JsonValueSchema, isJsonObject } from './chunk-QRHJUS3D.js';
4
- import { z } from 'zod';
5
-
6
- var FS_MODES = ["read", "write", "create", "remove", "meta"];
7
- var NET_KINDS = ["tcp", "udp", "listen"];
8
- var STDIO_KINDS = ["in", "out", "err"];
9
- var SYS_KINDS = ["cpu", "memory", "disk", "network", "power-state", "identity"];
10
- var DESKTOP_KINDS = ["notify", "speak", "brightness", "volume", "power"];
11
- var DEV_KINDS = ["read", "write", "wait", "ack"];
12
- function unionOsGrants(a, b) {
13
- const list = (x, y) => [.../* @__PURE__ */ new Set([...x ?? [], ...y ?? []])];
14
- const keyed = (x, y, key, items, make) => {
15
- const out2 = /* @__PURE__ */ new Map();
16
- for (const grant of [...x ?? [], ...y ?? []]) {
17
- const seen = out2.get(key(grant));
18
- out2.set(key(grant), seen === void 0 ? grant : make(seen, list(items(seen), items(grant))));
19
- }
20
- return [...out2.values()];
21
- };
22
- const out = {};
23
- const fs = keyed(a?.fs, b?.fs, (g) => g.glob, (g) => g.modes, (g, modes) => ({ ...g, modes }));
24
- const net = keyed(a?.net, b?.net, (g) => g.target, (g) => g.kinds, (g, kinds) => ({ ...g, kinds }));
25
- if (fs.length > 0) out.fs = fs;
26
- if (net.length > 0) out.net = net;
27
- const dev = keyed(a?.dev, b?.dev, (g) => g.target, (g) => g.kinds, (g, kinds) => ({ ...g, kinds }));
28
- if (dev.length > 0) out.dev = dev;
29
- const exec = list(a?.exec, b?.exec);
30
- const env = list(a?.env, b?.env);
31
- const stdio = list(a?.stdio, b?.stdio);
32
- const sys = list(a?.sys, b?.sys);
33
- const desktop = list(a?.desktop, b?.desktop);
34
- if (exec.length > 0) out.exec = exec;
35
- if (env.length > 0) out.env = env;
36
- if (stdio.length > 0) out.stdio = stdio;
37
- if (sys.length > 0) out.sys = sys;
38
- if (desktop.length > 0) out.desktop = desktop;
39
- return out;
40
- }
41
- var FsModeSchema = z.enum(FS_MODES);
42
- var NetKindSchema = z.enum(NET_KINDS);
43
- var StdioKindSchema = z.enum(STDIO_KINDS);
44
- var SysKindSchema = z.enum(SYS_KINDS);
45
- var DesktopKindSchema = z.enum(DESKTOP_KINDS);
46
- var DevKindSchema = z.enum(DEV_KINDS);
47
- var FsGrantSchema = z.object({
48
- glob: z.string(),
49
- modes: z.array(FsModeSchema)
50
- });
51
- var NetGrantSchema = z.object({
52
- target: z.string(),
53
- kinds: z.array(NetKindSchema)
54
- });
55
- var DevGrantSchema = z.object({
56
- target: z.string(),
57
- kinds: z.array(DevKindSchema)
58
- });
59
- var OsGrantsSchema = z.object({
60
- fs: z.array(FsGrantSchema).optional(),
61
- exec: z.array(z.string()).optional(),
62
- net: z.array(NetGrantSchema).optional(),
63
- env: z.array(z.string()).optional(),
64
- stdio: z.array(StdioKindSchema).optional(),
65
- sys: z.array(SysKindSchema).optional(),
66
- desktop: z.array(DesktopKindSchema).optional(),
67
- dev: z.array(DevGrantSchema).optional()
68
- });
69
- var DeploymentSchema = z.record(z.string(), z.array(z.string()));
70
- var SKELETON_VARIANTS = ["header", "table", "list", "grid", "detail", "stats", "form", "card", "text"];
71
- var SkeletonVariantSchema = z.enum(SKELETON_VARIANTS);
72
- var SkeletonShapeSchema = z.object({
73
- variant: SkeletonVariantSchema,
74
- rows: z.number().int().positive().optional(),
75
- columns: z.number().int().positive().optional(),
76
- fields: z.number().int().positive().optional()
77
- });
78
- var SkeletonSpecSchema = z.union([SkeletonVariantSchema, z.literal("none"), SkeletonShapeSchema]);
79
- var SkeletonNodeSchema = z.lazy(
80
- () => z.union([z.object({ shape: SkeletonShapeSchema }), z.object({ stack: z.array(SkeletonNodeSchema) })])
81
- );
82
- var AwaitRenderSchema = z.object({
83
- trait: z.string(),
84
- slot: z.string(),
85
- skeleton: SkeletonNodeSchema
86
- });
87
- var StateSchema = z.object({
88
- name: z.string().min(1, "State name is required"),
89
- isInitial: z.boolean().optional(),
90
- isTerminal: z.boolean().optional(),
91
- isFinal: z.boolean().optional(),
92
- description: z.string().optional(),
93
- onEntry: z.array(z.string()).optional(),
94
- onExit: z.array(z.string()).optional(),
95
- holds: SExprSchema.optional()
96
- });
97
- var PayloadTypeWhenSchema = z.object({
98
- knob: z.string().min(1),
99
- equals: z.string().min(1),
100
- type: z.string().min(1)
101
- });
102
- function payloadTypeContainer(type) {
103
- if (type === "array") return { kind: "array", element: "" };
104
- if (type === "object") return { kind: "object" };
105
- if (type.startsWith("Map<") && type.endsWith(">")) {
106
- const inner = type.slice(4, -1);
107
- const comma = inner.indexOf(",");
108
- if (comma > 0 && comma < inner.length - 1) {
109
- return { kind: "map", key: inner.slice(0, comma).trim(), value: inner.slice(comma + 1).trim() };
110
- }
111
- }
112
- if (type.length > 2 && type.startsWith("[") && type.endsWith("]")) {
113
- return { kind: "array", element: type.slice(1, -1) };
114
- }
115
- return { kind: "opaque" };
116
- }
117
- var payloadFieldShape = {
118
- type: z.string().min(1),
119
- required: z.boolean().optional(),
120
- nullable: z.boolean().optional(),
121
- additionalProperties: z.lazy(() => PayloadFieldDescriptorSchema).optional(),
122
- values: z.array(z.string()).optional(),
123
- properties: z.lazy(() => z.array(PayloadFieldSchema)).optional(),
124
- typeWhen: z.array(PayloadTypeWhenSchema).optional(),
125
- entity: z.string().min(1).optional(),
126
- projectedFrom: FieldProjectionSchema.optional(),
127
- items: z.lazy(() => PayloadFieldDescriptorSchema).optional()
128
- };
129
- var PayloadFieldDescriptorSchema = z.object({
130
- name: z.string(),
131
- ...payloadFieldShape
132
- });
133
- var PayloadFieldSchema = z.object({
134
- name: z.string().min(1),
135
- ...payloadFieldShape
136
- });
137
- var InboundVerificationSchema = z.object({
138
- header: z.string().min(1),
139
- credential: z.string().min(1)
140
- });
141
- var InboundDeclarationSchema = z.object({
142
- name: z.string().min(1),
143
- answers: z.string().min(1),
144
- verifies: InboundVerificationSchema.optional()
145
- });
146
- var EventSchema = z.object({
147
- key: z.string().min(1, "Event key is required"),
148
- id: EventIdSchema.optional(),
149
- name: z.string().min(1, "Event name is required"),
150
- description: z.string().optional(),
151
- synonyms: z.string().optional(),
152
- tier: z.string().optional(),
153
- payloadSchema: z.array(PayloadFieldSchema).optional(),
154
- payloadEntity: z.string().optional(),
155
- input: z.boolean().optional(),
156
- listened: z.boolean().optional(),
157
- inbound: InboundDeclarationSchema.optional(),
158
- classification: z.enum(["domain", "system"]).optional(),
159
- semanticRole: z.string().optional()
160
- });
161
- var GuardSchema = z.object({
162
- name: z.string().min(1, "Guard name is required"),
163
- expression: ExpressionSchema,
164
- description: z.string().optional()
165
- });
166
- var TransitionSchema = z.object({
167
- from: z.string().min(1, "Transition source state is required"),
168
- to: z.string().min(1, "Transition target state is required"),
169
- event: z.string().min(1, "Transition event is required"),
170
- eventId: EventIdSchema.optional(),
171
- guard: ExpressionSchema.nullish(),
172
- effects: z.array(EffectSchema).optional(),
173
- ensures: SExprListSchema.optional(),
174
- description: z.string().nullish(),
175
- awaitRender: z.array(AwaitRenderSchema).optional()
176
- });
177
- var StateMachineSchema = z.object({
178
- states: z.array(StateSchema).min(1, "At least one state is required"),
179
- events: z.array(EventSchema),
180
- transitions: z.array(TransitionSchema),
181
- guards: z.array(GuardSchema).optional()
182
- });
183
- function isCircuitEvent(event) {
184
- return !event.startsWith("_");
185
- }
186
-
187
- // src/types/trait.ts
188
- var TraitConfigValueSchema = z.lazy(
189
- () => z.union([
190
- z.string(),
191
- z.number(),
192
- z.boolean(),
193
- z.null(),
194
- z.array(TraitConfigValueSchema),
195
- z.record(z.string(), TraitConfigValueSchema)
196
- ])
197
- );
198
- var TraitConfigSchema = z.record(z.string(), TraitConfigValueSchema);
199
- function isCallSiteConfigDeclaration(entry) {
200
- return typeof entry === "object" && entry !== null && !Array.isArray(entry) && "type" in entry && typeof entry.type === "string" && "default" in entry;
201
- }
202
- function isConfigRedeclaration(entry) {
203
- if (!isCallSiteConfigDeclaration(entry)) return false;
204
- return entry.type !== "unknown" || entry.label !== void 0 || entry.description !== void 0 || entry.synonyms !== void 0 || entry.tier !== void 0;
205
- }
206
- var CONFIG_DECLARATION_META_KEYS = ["label", "description", "tier", "synonyms", "values"];
207
- function isConfigFieldSchema(entry) {
208
- if (typeof entry !== "object" || entry === null || Array.isArray(entry)) return false;
209
- if (!("type" in entry) || typeof entry.type !== "string") return false;
210
- return "default" in entry || CONFIG_DECLARATION_META_KEYS.some((k) => k in entry);
211
- }
212
- function normalizeCallSiteConfigToValues(config) {
213
- if (config === void 0) {
214
- return void 0;
215
- }
216
- const out = {};
217
- let hasAny = false;
218
- for (const [key, entry] of Object.entries(config)) {
219
- const value = isConfigFieldSchema(entry) ? entry.default : entry;
220
- if (value !== void 0) {
221
- out[key] = value;
222
- hasAny = true;
223
- }
224
- }
225
- return hasAny ? out : void 0;
226
- }
227
- function mergeCallSiteConfigOverrides(base, overrides) {
228
- const next = {};
229
- for (const [k, entry] of Object.entries(base)) {
230
- next[k] = isConfigFieldSchema(entry) ? entry : { type: "unknown", default: entry };
231
- }
232
- for (const [k, v] of Object.entries(overrides)) {
233
- if (isCallSiteConfigDeclaration(v)) {
234
- next[k] = v;
235
- continue;
236
- }
237
- const existing = base[k];
238
- next[k] = existing !== void 0 && isConfigFieldSchema(existing) ? { ...existing, default: v } : { type: "unknown", default: v };
239
- }
240
- return next;
241
- }
242
- var REFERENCE_CONFIG_TYPES = ["entity", "trait", "event"];
243
- function isReferenceConfigType(type) {
244
- return REFERENCE_CONFIG_TYPES.includes(type);
245
- }
246
- var SECRET_CONFIG_TYPES = ["secret"];
247
- function isSecretConfigType(type) {
248
- return SECRET_CONFIG_TYPES.includes(type);
249
- }
250
- function maskSecretConfigValues(config, values) {
251
- const masked = {};
252
- for (const [key, value] of Object.entries(values)) {
253
- const decl = config[key];
254
- if (decl !== void 0 && isSecretConfigType(decl.type) && typeof value === "string" && value.length > 0) {
255
- masked[key] = value.length > 4 ? `\u2022\u2022\u2022\u2022${value.slice(-4)}` : "\u2022\u2022\u2022\u2022";
256
- } else {
257
- masked[key] = value;
258
- }
259
- }
260
- return masked;
261
- }
262
- function canonicalizeUnboundTraitOverride(fieldType, value) {
263
- return fieldType === "trait" && value === "none" ? null : value;
264
- }
265
- function overrideDeclaredKnobs(declared, overrides) {
266
- const out = { ...declared };
267
- for (const key of Object.keys(overrides)) {
268
- const field = declared[key];
269
- if (field === void 0) {
270
- throw new Error(
271
- `overrideDeclaredKnobs: config override "${key}" is not a declared knob (ORB_O_CONFIG_UNKNOWN_KEY). Declared: ${Object.keys(declared).join(", ") || "(none)"}`
272
- );
273
- }
274
- out[key] = { ...field, default: canonicalizeUnboundTraitOverride(field.type, overrides[key]) };
275
- }
276
- return out;
277
- }
278
- var ConfigFieldItemsDeclarationSchema = z.lazy(
279
- () => z.object({
280
- nullable: z.boolean().optional(),
281
- additionalProperties: EntityFieldSchema.optional(),
282
- type: z.string().optional(),
283
- properties: z.record(z.string(), TraitEntityFieldSchema).optional(),
284
- items: ConfigFieldItemsDeclarationSchema.optional(),
285
- values: z.array(z.string()).optional()
286
- })
287
- );
288
- var ConfigFieldDeclarationSchema = z.object({
289
- nullable: z.boolean().optional(),
290
- additionalProperties: EntityFieldSchema.optional(),
291
- type: z.string(),
292
- default: TraitConfigValueSchema.optional(),
293
- refId: z.string().optional(),
294
- required: z.boolean().optional(),
295
- label: z.string().optional(),
296
- description: z.string().optional(),
297
- tier: z.string().optional(),
298
- values: z.array(z.string()).optional(),
299
- synonyms: z.string().optional(),
300
- items: ConfigFieldItemsDeclarationSchema.optional(),
301
- properties: z.lazy(() => z.record(z.string(), TraitEntityFieldSchema)).optional(),
302
- forwardedFrom: z.string().optional(),
303
- nestedForwardedFrom: z.array(z.string()).optional(),
304
- payloadFor: z.string().optional(),
305
- projectedFrom: FieldProjectionSchema.optional(),
306
- record: z.string().optional()
307
- });
308
- var DeclaredTraitConfigSchema = z.record(
309
- z.string(),
310
- ConfigFieldDeclarationSchema
311
- );
312
- var TRAIT_FIELD_TYPES = [
313
- "string",
314
- "number",
315
- "boolean",
316
- "date",
317
- "array",
318
- "object",
319
- "timestamp",
320
- "datetime",
321
- "instant",
322
- "enum",
323
- "email",
324
- "url",
325
- "phone",
326
- "uuid",
327
- "image",
328
- "bytes",
329
- "trait",
330
- "slot",
331
- "pattern",
332
- "node",
333
- "event",
334
- "EventAddress",
335
- "CallKey",
336
- "SExpr",
337
- "union",
338
- "tuple",
339
- "field"
340
- ];
341
- var TraitEntityFieldSchema = z.object({
342
- nullable: z.boolean().optional(),
343
- additionalProperties: EntityFieldSchema.optional(),
344
- name: z.string().min(1),
345
- type: z.union([z.enum(TRAIT_FIELD_TYPES), TypeVariableSchema]),
346
- required: z.boolean().optional(),
347
- default: TraitConfigValueSchema.optional(),
348
- values: z.array(z.string()).optional(),
349
- items: ConfigFieldItemsDeclarationSchema.optional(),
350
- properties: z.lazy(() => z.record(z.string(), TraitEntityFieldSchema)).optional()
351
- });
352
- var TraitDataEntitySchema = z.object({
353
- name: z.string().min(1),
354
- collection: z.string().optional(),
355
- fields: z.array(TraitEntityFieldSchema).min(1),
356
- timestamps: z.boolean().optional(),
357
- description: z.string().optional(),
358
- runtime: z.boolean().optional(),
359
- singleton: z.boolean().optional(),
360
- pages: z.array(z.string()).optional()
361
- });
362
- var DURATION_INTERVAL = /^\d+(ms|s|m|h|d)$/;
363
- var CRON_INTERVAL = /^\S+(\s+\S+){4}$/;
364
- var TickIntervalSchema = z.union([
365
- z.literal("frame"),
366
- z.number().positive(),
367
- z.string().refine((v) => DURATION_INTERVAL.test(v) || CRON_INTERVAL.test(v), {
368
- message: 'interval must be "frame", a positive number of milliseconds, a duration ("500ms"/"5s"/"1m"/"1h"/"1d"), or a 5-field cron expression ("0 9 * * *")'
369
- })
370
- ]);
371
- var TraitTickSchema = z.object({
372
- name: z.string().min(1),
373
- description: z.string().optional(),
374
- priority: z.number().optional(),
375
- interval: TickIntervalSchema,
376
- appliesTo: z.array(z.string()).optional(),
377
- runsInBackground: z.boolean().optional(),
378
- whileVisible: z.boolean().optional(),
379
- pages: z.array(z.string()).optional(),
380
- pageIds: z.array(PageIdSchema).optional(),
381
- guard: ExpressionSchema.optional(),
382
- effects: z.array(EffectSchema).min(1),
383
- emits: z.array(z.string()).optional(),
384
- emitIds: z.array(EventIdSchema).optional()
385
- });
386
- var EventScopeSchema = z.enum(["internal", "external"]);
387
- var eventPayloadFieldShape = {
388
- /**
389
- * Field type. Mirrors the Rust validator's acceptance: any non-empty
390
- * string. Primitives ('string' | 'number' | 'boolean' | 'object' |
391
- * 'array') are the canonical values; entity-name references like
392
- * 'ModalRecord' and array-of-entity references like '[ModalRecord]'
393
- * are also valid because the Rust IR's PayloadField.field_type is
394
- * just a String. Only enforced narrowly at the call site (e.g.
395
- * emit-literal type-mismatch warnings in
396
- * orbital-compiler/phases/validation/emit_payload.rs) — not here.
397
- */
398
- type: z.string().min(1),
399
- required: z.boolean().optional(),
400
- nullable: z.boolean().optional(),
401
- additionalProperties: z.lazy(() => EventPayloadTypeMemberSchema).optional(),
402
- values: z.array(z.string()).optional(),
403
- description: z.string().optional(),
404
- entity: z.string().optional(),
405
- properties: z.lazy(() => z.array(EventPayloadFieldSchema)).optional(),
406
- typeWhen: z.array(PayloadTypeWhenSchema).optional(),
407
- projectedFrom: FieldProjectionSchema.optional(),
408
- items: z.lazy(() => EventPayloadTypeMemberSchema).optional()
409
- };
410
- var EventPayloadTypeMemberSchema = z.object({
411
- name: z.string(),
412
- ...eventPayloadFieldShape
413
- });
414
- var EventPayloadFieldSchema = z.object({
415
- name: z.string().min(1),
416
- ...eventPayloadFieldShape
417
- });
418
- var CONFIG_REF_EVENT_PATTERN = /^@config\.[A-Za-z_][A-Za-z0-9_]*$/;
419
- function configRefEventKnob(event) {
420
- return CONFIG_REF_EVENT_PATTERN.test(event) ? event.slice("@config.".length) : void 0;
421
- }
422
- function resolveConfigRefEventName(event, declaredConfig, effectiveConfig) {
423
- const knob = configRefEventKnob(event);
424
- if (knob === void 0) return { ok: false, error: "unknown-knob" };
425
- const field = declaredConfig?.[knob];
426
- if (field === void 0) return { ok: false, error: "unknown-knob" };
427
- if (field.type !== "string" && field.type !== "event") return { ok: false, error: "not-string" };
428
- if (field.default === void 0) return { ok: false, error: "no-default" };
429
- const value = effectiveConfig[knob];
430
- if (typeof value !== "string") return { ok: false, error: "not-string" };
431
- return { ok: true, value };
432
- }
433
- var TraitEventContractSchema = z.object({
434
- /**
435
- * Event name. Mirrors the Rust validator's `is_valid_event_identifier`:
436
- * starts with a letter, then any letters / digits / underscores. Both
437
- * UPPER_SNAKE_CASE and PascalCase shapes are valid identifiers in the
438
- * post-Phase 2.5 nominal-event type system (events declared via
439
- * `type X = Event<T>`). A pre-resolution `@config.<knob>` reference
440
- * (Option B) is also legal — inline/resolve substitutes it with the
441
- * knob's effective literal before codegen/runtime consume it.
442
- */
443
- event: z.string().min(1).regex(
444
- /^([A-Za-z][A-Za-z0-9_]*|@config\.[A-Za-z_][A-Za-z0-9_]*)$/,
445
- "Event name must start with a letter and contain only letters, digits, and underscores, or be a `@config.<knob>` reference"
446
- ),
447
- eventId: EventIdSchema.optional(),
448
- description: z.string().optional(),
449
- synonyms: z.string().optional(),
450
- tier: z.string().optional(),
451
- definerKnob: z.string().optional(),
452
- scopeOverridden: z.boolean().optional(),
453
- payloadSchema: z.array(EventPayloadFieldSchema).optional(),
454
- payloadEntity: z.string().optional(),
455
- scope: EventScopeSchema.optional()
456
- });
457
- var ListenSourceSchema = z.union([
458
- z.object({ kind: z.literal("any") }),
459
- z.object({
460
- kind: z.literal("trait"),
461
- trait: z.string().min(1),
462
- traitId: TraitIdSchema.optional()
463
- }),
464
- z.object({
465
- kind: z.literal("orbital"),
466
- orbital: z.string().min(1),
467
- trait: z.string().min(1),
468
- orbitalId: OrbitalIdSchema.optional(),
469
- traitId: TraitIdSchema.optional()
470
- })
471
- ]);
472
- function splitEventAddress(raw) {
473
- const parts = raw.split(".");
474
- if (parts.length <= 1) return { event: raw };
475
- if (parts.length === 2) {
476
- const [src, event] = parts;
477
- return src === "*" ? { event, source: { kind: "any" } } : { event, source: { kind: "trait", trait: src } };
478
- }
479
- const n = parts.length;
480
- return {
481
- event: parts[n - 1],
482
- source: { kind: "orbital", orbital: parts.slice(0, n - 2).join("."), trait: parts[n - 2] }
483
- };
484
- }
485
- function joinEventAddress(event, source) {
486
- if (source === void 0) return event;
487
- switch (source.kind) {
488
- case "any":
489
- return `*.${event}`;
490
- case "trait":
491
- return `${source.trait}.${event}`;
492
- case "orbital":
493
- return `${source.orbital}.${source.trait}.${event}`;
494
- }
495
- }
496
- var TraitEventListenerSchema = z.object({
497
- event: z.string().min(1),
498
- eventId: EventIdSchema.optional(),
499
- triggers: z.string().min(1),
500
- triggersId: EventIdSchema.optional(),
501
- description: z.string().optional(),
502
- synonyms: z.string().optional(),
503
- tier: z.string().optional(),
504
- guard: ExpressionSchema.optional(),
505
- scope: EventScopeSchema.optional(),
506
- payloadMapping: z.record(z.string(), SExprSchema).optional(),
507
- source: ListenSourceSchema.optional()
508
- });
509
- var RequiredFieldSchema = z.object({
510
- name: z.string().min(1),
511
- type: z.union([z.enum(TRAIT_FIELD_TYPES), TypeVariableSchema]),
512
- description: z.string().optional()
513
- });
514
- var TraitReferenceObjectSchema = z.object({
515
- ref: z.string().min(1),
516
- refId: TraitIdSchema.optional(),
517
- // V4 local declaration id (see the interface doc) — declared so the
518
- // strip-mode zod gate carries it through instead of dropping it.
519
- id: TraitIdSchema.optional(),
520
- // Phase 1.2: optional registry path disambiguator, pairs with `ref`.
521
- from: z.string().optional(),
522
- linkedEntity: z.string().optional(),
523
- linkedEntityId: EntityIdSchema.optional(),
524
- name: z.string().optional(),
525
- events: z.record(
526
- z.string().min(1, "events key (atom event name) must be non-empty"),
527
- z.string().min(1, "events value (caller event name) must be non-empty")
528
- ).optional(),
529
- eventIds: z.record(z.string().min(1), EventIdSchema).optional(),
530
- _resolved: z.lazy(() => TraitSchema).optional(),
531
- // 3-II type-parameter arguments (see `TraitReference.typeArgs`).
532
- typeArgs: z.record(
533
- z.string().min(1, "typeArgs key (declared param name) must be non-empty"),
534
- z.string().min(1, "typeArgs value (type name) must be non-empty")
535
- ).optional(),
536
- fields: z.record(
537
- z.string().min(1, "fields key (canonical field name) must be non-empty"),
538
- z.string().min(1, "fields value (consumer field name) must be non-empty")
539
- ).optional(),
540
- // Each value is either a plain wiring value (TraitConfigValue) or an
541
- // annotated ConfigFieldDeclaration. Declaration form is tried first
542
- // (it's more specific — has a `"type"` string key); plain values fall
543
- // through to the recursive TraitConfigValue union.
544
- config: z.record(z.string(), z.union([ConfigFieldDeclarationSchema, TraitConfigValueSchema])).optional(),
545
- appliesTo: z.array(z.string()).optional(),
546
- // Phase F.7: caller-supplied listen entries are already-resolved
547
- // structured definitions (see `TraitReference.listens`).
548
- listens: z.array(TraitEventListenerSchema).optional(),
549
- emitsScope: z.enum(["internal", "external"]).optional(),
550
- // Phase F.8: per-transition effects override. The keys are event
551
- // names (the transition triggers AFTER renames); values are SExpr
552
- // effect tuples.
553
- effects: z.record(
554
- z.string().min(1, "effects override key (event name) must be non-empty"),
555
- z.array(SExprSchema)
556
- ).optional()
557
- });
558
- var TraitReferenceSchema = TraitReferenceObjectSchema.refine(
559
- (ref2) => {
560
- if (!ref2.events) return true;
561
- for (const [from, to] of Object.entries(ref2.events)) {
562
- if (from.length === 0 || to.length === 0) return false;
563
- }
564
- return true;
565
- },
566
- {
567
- message: 'TraitReference "events" entries must have non-empty atom and caller event names',
568
- path: ["events"]
569
- }
570
- );
571
- var TraitUIBindingSchema = z.record(
572
- z.string(),
573
- z.object({
574
- presentation: z.enum(["modal", "drawer", "popover", "inline", "confirm-dialog"]),
575
- content: z.union([PatternObjectSchema, z.array(PatternObjectSchema)]),
576
- props: z.object({
577
- size: z.enum(["sm", "md", "lg", "xl", "full"]).optional(),
578
- position: z.enum(["left", "right", "top", "bottom", "center"]).optional(),
579
- title: z.string().optional(),
580
- closable: z.boolean().optional(),
581
- width: z.string().optional(),
582
- showProgress: z.boolean().optional(),
583
- step: z.number().optional(),
584
- totalSteps: z.number().optional()
585
- }).optional()
586
- })
587
- );
588
- var EntityFieldContractSchema = z.object({
589
- requires: z.array(z.string()),
590
- provides: z.array(z.string())
591
- });
592
- var EffectSiteSchema = z.enum(["transition", "tick"]);
593
- var EffectUseSchema = z.object({
594
- kind: z.string(),
595
- resource: z.string().optional(),
596
- resolved: z.boolean().optional(),
597
- site: EffectSiteSchema.optional()
598
- });
599
- var EffectRowSchema = z.array(EffectUseSchema);
600
- var DispatchModeSchema = z.enum(["persistedAwaited", "hybridClientOnly", "runtimeOptimistic"]);
601
- var TraitDispatchModeSchema = z.enum(["client", "optimistic", "server"]);
602
- var SourceDeclarationMetadataSchema = z.object({
603
- traitId: z.string().min(1),
604
- fingerprint: z.string().min(1)
605
- });
606
- var SourceBehaviorMetadataSchema = z.object({
607
- behavior: z.string().min(1),
608
- alias: z.string().min(1),
609
- originalName: z.string().min(1)
610
- });
611
- var TraitTypeParamDefSchema = z.object({
612
- name: z.string().min(1),
613
- kind: z.string().min(1),
614
- default: z.string().optional()
615
- });
616
- var TraitSchema = z.object({
617
- id: TraitIdSchema.optional(),
618
- name: z.string().min(1),
619
- description: z.string().optional(),
620
- description_visual_prompt: z.string().optional(),
621
- entityRebindable: z.boolean().optional(),
622
- entityContract: EntityFieldContractSchema.optional(),
623
- effectRow: EffectRowSchema.optional(),
624
- entityBindingDescription: z.string().optional(),
625
- entityBindingSynonyms: z.string().optional(),
626
- dispatch: TraitDispatchModeSchema.optional(),
627
- linkedEntity: z.string().optional(),
628
- linkedEntityId: EntityIdSchema.optional(),
629
- entityRefIds: z.record(z.string().min(1), EntityIdSchema).optional(),
630
- traitEmbedIds: z.record(z.string().min(1), TraitIdSchema).optional(),
631
- requiredFields: z.array(RequiredFieldSchema).optional(),
632
- dataEntities: z.array(TraitDataEntitySchema).optional(),
633
- stateMachine: StateMachineSchema.optional(),
634
- initialEffects: z.array(EffectSchema).optional(),
635
- ticks: z.array(TraitTickSchema).optional(),
636
- emits: z.array(TraitEventContractSchema).optional(),
637
- listens: z.array(TraitEventListenerSchema).optional(),
638
- /** Call-site rename map (`events { ACTION: CONFIRM_VOID }`) — mirrors `Trait.events`. */
639
- events: z.record(z.string().min(1), z.string().min(1)).optional(),
640
- ui: TraitUIBindingSchema.optional(),
641
- config: DeclaredTraitConfigSchema.optional(),
642
- sourceBehavior: SourceBehaviorMetadataSchema.optional(),
643
- sourceDeclaration: SourceDeclarationMetadataSchema.optional(),
644
- sourceEntityDefinition: EntitySchema.optional(),
645
- typeParams: z.array(TraitTypeParamDefSchema).optional()
646
- });
647
- var TraitRefSchema = z.union([
648
- z.string().min(1),
649
- TraitReferenceSchema,
650
- TraitSchema
651
- // Allow inline trait definitions
652
- ]);
653
- function isInlineTrait(traitRef) {
654
- return typeof traitRef === "object" && "name" in traitRef && !("ref" in traitRef);
655
- }
656
- function getTraitName(traitRef) {
657
- if (typeof traitRef === "string") {
658
- return traitRef;
659
- }
660
- if (isInlineTrait(traitRef)) {
661
- return traitRef.name;
662
- }
663
- return traitRef.ref;
664
- }
665
- function getTraitConfig(traitRef) {
666
- if (typeof traitRef === "string") {
667
- return void 0;
668
- }
669
- if (isInlineTrait(traitRef)) {
670
- return void 0;
671
- }
672
- return traitRef.config;
673
- }
674
- function normalizeTraitRef(traitRef) {
675
- if (typeof traitRef === "string") {
676
- return { ref: traitRef };
677
- }
678
- if (isInlineTrait(traitRef)) {
679
- return { ref: traitRef.name };
680
- }
681
- return traitRef;
682
- }
683
- var OrbitalTraitRefSchema = TraitRefSchema;
684
-
685
- // src/types/page.ts
686
- var ViewTypeSchema = z.enum([
687
- "list",
688
- "detail",
689
- "create",
690
- "edit",
691
- "dashboard",
692
- "custom"
693
- ]);
694
- var PageTraitRefSchema = z.object({
695
- ref: z.string().min(1, "Trait ref is required"),
696
- refId: TraitIdSchema.optional(),
697
- linkedEntity: z.string().optional(),
698
- linkedEntityId: EntityIdSchema.optional(),
699
- config: TraitConfigSchema.optional()
700
- });
701
- var PageAccessSchema = z.enum(["public", "authenticated"]);
702
- var PageIndexingSchema = z.enum(["index", "noindex"]);
703
- var PageMetaSchema = z.union([
704
- z.string(),
705
- z.tuple([z.literal("i18n/t"), z.string().min(1)])
706
- ]);
707
- function resolvePageMeta(meta, lookup) {
708
- if (meta === void 0) return void 0;
709
- return typeof meta === "string" ? meta : lookup(meta[1]);
710
- }
711
- var PageModifiersSchema = z.object({
712
- access: PageAccessSchema.optional(),
713
- indexing: PageIndexingSchema.optional(),
714
- title: PageMetaSchema.optional(),
715
- description: PageMetaSchema.optional(),
716
- translationOf: z.string().min(1).optional(),
717
- label: z.string().optional(),
718
- icon: z.string().optional(),
719
- roles: z.array(z.string().min(1)).min(1).optional()
720
- }).strict();
721
- var OrbitalPageStrictSchema = z.object({
722
- id: PageIdSchema.optional(),
723
- name: z.string().min(1, "Page name is required"),
724
- path: z.string().min(1, "Page path is required").startsWith("/", "Path must start with /"),
725
- primaryEntity: z.string().min(1, "Primary entity is required"),
726
- traits: z.array(PageTraitRefSchema).min(1, "Page must have at least one trait"),
727
- title: PageMetaSchema.optional(),
728
- description: PageMetaSchema.optional(),
729
- access: PageAccessSchema.optional(),
730
- indexing: PageIndexingSchema.optional(),
731
- sourcePage: z.string().min(1).optional(),
732
- translationOf: z.string().min(1).optional(),
733
- icon: z.string().optional(),
734
- label: z.string().optional(),
735
- roles: z.array(z.string().min(1)).min(1).optional()
736
- }).strict();
737
- var OrbitalPageSchema = z.object({
738
- id: PageIdSchema.optional(),
739
- name: z.string().min(1, "Page name is required"),
740
- path: z.string(),
741
- protocol: z.string().min(1).optional(),
742
- address: SExprSchema.optional(),
743
- viewType: ViewTypeSchema.optional(),
744
- title: PageMetaSchema.optional(),
745
- description: PageMetaSchema.optional(),
746
- access: PageAccessSchema.optional(),
747
- indexing: PageIndexingSchema.optional(),
748
- sourcePage: z.string().min(1).optional(),
749
- translationOf: z.string().min(1).optional(),
750
- primaryEntity: z.string().optional(),
751
- traits: z.array(PageTraitRefSchema).optional(),
752
- isInitial: z.boolean().optional(),
753
- icon: z.string().optional(),
754
- label: z.string().optional(),
755
- roles: z.array(z.string().min(1)).min(1).optional()
756
- }).strict().superRefine((page, ctx) => {
757
- if (page.protocol !== void 0) {
758
- if (page.path !== "") ctx.addIssue({ code: "custom", path: ["path"], message: "A protocol page has an empty path; its address says where it is reached" });
759
- return;
760
- }
761
- if (page.address !== void 0) ctx.addIssue({ code: "custom", path: ["address"], message: "A route page takes no address; its path is its address" });
762
- if (page.path.length === 0) ctx.addIssue({ code: "custom", path: ["path"], message: "Page path is required" });
763
- else if (!page.path.startsWith("/")) ctx.addIssue({ code: "custom", path: ["path"], message: "Path must start with /" });
764
- });
765
- var PageSchema = OrbitalPageSchema;
766
- var ProtocolSideSchema = z.enum(["client", "server", "process", "start"]);
767
- var ProtocolSpecSchema = z.object({
768
- name: z.string().min(1),
769
- address: z.array(z.object({ name: z.string().min(1), ty: z.string().min(1), required: z.boolean() }).strict()).optional(),
770
- viewer: z.boolean(),
771
- grant: z.string().min(1).optional(),
772
- side: ProtocolSideSchema
773
- }).strict();
774
- var ROUTE_PROTOCOL = "route";
775
- function isRoutePage(page) {
776
- return page.protocol === void 0;
777
- }
778
- function protocolName(page) {
779
- return page.protocol ?? ROUTE_PROTOCOL;
780
- }
781
- var SERVICE_TYPES = ["rest", "socket", "mcp"];
782
- var ServiceTypeSchema = z.enum(SERVICE_TYPES);
783
- var RestAuthConfigSchema = z.object({
784
- type: z.enum(["api-key", "bearer", "basic", "oauth2"]),
785
- keyName: z.string().optional(),
786
- location: z.enum(["query", "header"]).optional(),
787
- secretEnv: z.string().optional()
788
- });
789
- var RestServiceDefSchema = z.object({
790
- name: z.string().min(1, "Service name is required"),
791
- type: z.literal("rest"),
792
- description: z.string().optional(),
793
- baseUrl: z.string().url("Base URL must be a valid URL"),
794
- headers: z.record(z.string(), z.string()).optional(),
795
- auth: RestAuthConfigSchema.optional(),
796
- timeout: z.number().positive().optional()
797
- });
798
- var SocketEventsSchema = z.object({
799
- inbound: z.array(z.string()),
800
- outbound: z.array(z.string())
801
- });
802
- var SocketServiceDefSchema = z.object({
803
- name: z.string().min(1, "Service name is required"),
804
- type: z.literal("socket"),
805
- description: z.string().optional(),
806
- url: z.string().url("WebSocket URL must be valid"),
807
- events: SocketEventsSchema,
808
- reconnect: z.object({
809
- enabled: z.boolean(),
810
- maxAttempts: z.number().positive().optional(),
811
- delayMs: z.number().positive().optional()
812
- }).optional()
813
- });
814
- var McpServiceDefSchema = z.object({
815
- name: z.string().min(1, "Service name is required"),
816
- type: z.literal("mcp"),
817
- description: z.string().optional(),
818
- serverPath: z.string().min(1, "Server path is required"),
819
- capabilities: z.array(z.string()).min(1, "At least one capability is required"),
820
- env: z.record(z.string(), z.string()).optional()
821
- });
822
- var ServiceDefinitionSchema = z.discriminatedUnion("type", [
823
- RestServiceDefSchema,
824
- SocketServiceDefSchema,
825
- McpServiceDefSchema
826
- ]);
827
- function isServiceReference(service) {
828
- return typeof service === "string";
829
- }
830
- function isServiceReferenceObject(service) {
831
- return typeof service === "object" && service !== null && "ref" in service && !("type" in service);
832
- }
833
- var ServiceRefStringSchema = z.string().regex(
834
- /^[A-Z][a-zA-Z0-9]*\.services\.[a-zA-Z][a-zA-Z0-9]*$/,
835
- 'Service reference must be in format "Alias.services.ServiceName" (e.g., "Weather.services.openweather")'
836
- );
837
- var ServiceRefObjectSchema = z.object({
838
- ref: ServiceRefStringSchema,
839
- description: z.string().optional(),
840
- baseUrl: z.string().url("baseUrl override must be a valid URL").optional(),
841
- headers: z.record(z.string(), z.string()).optional(),
842
- url: z.string().url("url override must be a valid URL").optional(),
843
- serverPath: z.string().optional()
844
- });
845
- var ServiceRefSchema = z.union([
846
- ServiceDefinitionSchema,
847
- ServiceRefObjectSchema,
848
- ServiceRefStringSchema
849
- ]);
850
- function parseServiceRef(ref2) {
851
- const match = ref2.match(
852
- /^([A-Z][a-zA-Z0-9]*)\.services\.([a-zA-Z][a-zA-Z0-9]*)$/
853
- );
854
- if (!match) return null;
855
- return { alias: match[1], serviceName: match[2] };
856
- }
857
- function isRestService(service) {
858
- return service.type === "rest";
859
- }
860
- function isSocketService(service) {
861
- return service.type === "socket";
862
- }
863
- function isMcpService(service) {
864
- return service.type === "mcp";
865
- }
866
- function getServiceNames(services) {
867
- return services.map((s) => s.name);
868
- }
869
- function findService(services, name) {
870
- return services.find((s) => s.name.toLowerCase() === name.toLowerCase());
871
- }
872
- function hasService(services, name) {
873
- return services.some((s) => s.name.toLowerCase() === name.toLowerCase());
874
- }
875
- function credentialStorageKey(identity) {
876
- if (typeof identity.name !== "string" || identity.principal !== void 0 && typeof identity.principal !== "string") {
877
- throw new Error("credential identity requires string name and principal");
878
- }
879
- return JSON.stringify([identity.principal ?? null, identity.name]);
880
- }
881
- function resolveCredentialStatusIdentity(selection, principal) {
882
- if (selection !== null && typeof selection === "object" && !Array.isArray(selection)) {
883
- const keys = Reflect.ownKeys(selection);
884
- if (keys.length !== 2 || !keys.includes("credential") || !keys.includes("scope") || !("credential" in selection) || !("scope" in selection)) {
885
- throw new Error("credential-status: expected { credential, scope: app | user }");
886
- }
887
- const { credential, scope } = selection;
888
- if (typeof credential !== "string" || scope !== "app" && scope !== "user") {
889
- throw new Error("credential-status: expected { credential, scope: app | user }");
890
- }
891
- if (scope === "app") return { name: credential };
892
- if (principal === void 0) throw new Error("credential-status: nobody is signed in");
893
- return { name: credential, principal };
894
- }
895
- if (principal === void 0) throw new Error("credential-status: nobody is signed in");
896
- if (typeof selection !== "string") throw new Error("credential-status: the credential must be a secret knob's name");
897
- return { name: selection, principal };
898
- }
899
- function credentialStatusConnected(value, principal) {
900
- return value !== void 0 && (principal !== void 0 || value !== "");
901
- }
902
-
903
- // src/types/orbital.ts
904
- var UseDeclarationSchema = z.object({
905
- from: z.string().min(1, "Import source is required"),
906
- as: z.string().min(1, "Alias is required").regex(
907
- /^[A-Z][a-zA-Z0-9]*$/,
908
- 'Alias must be PascalCase (e.g., "Health", "GameCore")'
909
- ),
910
- config: DeclaredTraitConfigSchema.optional(),
911
- lazy: z.boolean().optional()
912
- });
913
- var LazyPageSchema = z.object({
914
- path: z.string().min(1),
915
- orbital: z.string().min(1),
916
- orbRef: z.string().min(1)
917
- });
918
- function expectedEntityName(decl) {
919
- switch (decl.kind) {
920
- case "entity":
921
- return decl.name;
922
- case "identity":
923
- return decl.name;
924
- case "event":
925
- case "page":
926
- case "state":
927
- case "transition":
928
- case "config":
929
- return void 0;
930
- }
931
- }
932
- var ExpectDeclarationSchema = z.discriminatedUnion("kind", [
933
- z.object({
934
- strict: z.boolean().optional(),
935
- kind: z.literal("identity"),
936
- name: z.string().optional(),
937
- shape: z.array(EntityFieldSchema).optional()
938
- }),
939
- z.object({
940
- strict: z.boolean().optional(),
941
- kind: z.literal("entity"),
942
- name: z.string().min(1, "Expected entity name is required"),
943
- shape: z.array(EntityFieldSchema).optional(),
944
- persistence: EntityPersistenceSchema.optional(),
945
- shared: z.boolean().optional(),
946
- browser: z.boolean().optional(),
947
- read_policy: SExprSchema.optional(),
948
- create_policy: SExprSchema.optional(),
949
- update_policy: SExprSchema.optional(),
950
- delete_policy: SExprSchema.optional(),
951
- access_waivers: z.object({
952
- read: z.string().optional(),
953
- create: z.string().optional(),
954
- update: z.string().optional(),
955
- delete: z.string().optional()
956
- }).optional(),
957
- invariants: z.array(SExprSchema).optional()
958
- }),
959
- z.object({
960
- strict: z.boolean().optional(),
961
- kind: z.literal("event"),
962
- traitName: z.string().min(1, "Expected event trait name is required"),
963
- event: z.string().min(1, "Expected event name is required"),
964
- payload: z.array(EventPayloadFieldSchema).optional()
965
- }),
966
- z.object({
967
- strict: z.boolean().optional(),
968
- kind: z.literal("page"),
969
- path: z.string().min(1, "Expected page path is required"),
970
- traits: z.array(z.string().min(1)).optional()
971
- }),
972
- z.object({
973
- strict: z.boolean().optional(),
974
- kind: z.literal("state"),
975
- traitName: z.string().min(1, "Expected state trait name is required"),
976
- state: z.string().min(1, "Expected state name is required"),
977
- holds: SExprSchema.optional()
978
- }),
979
- z.object({
980
- strict: z.boolean().optional(),
981
- kind: z.literal("transition"),
982
- traitName: z.string().min(1, "Expected transition trait name is required"),
983
- from: z.string().min(1),
984
- event: z.string().min(1),
985
- to: z.string().min(1),
986
- ensures: SExprListSchema.optional()
987
- }),
988
- z.object({
989
- strict: z.boolean().optional(),
990
- kind: z.literal("config"),
991
- name: z.string().min(1, "Expected config knob name is required"),
992
- knob: ConfigFieldDeclarationSchema
993
- })
994
- ]);
995
- var ExpectationDiagnosticSchema = z.object({
996
- kind: z.enum(["unknown-orbital", "identity-field-not-declared", "entity-field-not-declared", "event-source-unknown"]),
997
- orbital: z.string(),
998
- entity: z.string().optional(),
999
- field: z.string().optional()
1000
- }).strict();
1001
- var OrganismExpectationsSchema = z.record(
1002
- z.string(),
1003
- z.object({ expectations: z.array(ExpectDeclarationSchema), diagnostics: z.array(ExpectationDiagnosticSchema) }).strict()
1004
- );
1005
- function isEntityReference(entity) {
1006
- return typeof entity === "string";
1007
- }
1008
- function isEntityCall(entity) {
1009
- return typeof entity === "object" && entity !== null && "extends" in entity;
1010
- }
1011
- function isEntityReferenceAny(entity) {
1012
- return isEntityReference(entity) || isEntityCall(entity);
1013
- }
1014
- var EntityRefStringSchema = z.string().regex(
1015
- /^[A-Z][a-zA-Z0-9]*(\.orbitals\.[A-Z][a-zA-Z0-9]*)?\.entity$/,
1016
- 'Entity reference must be in format "Alias.entity" (e.g., "Goblin.entity") or "Alias.orbitals.Name.entity"'
1017
- );
1018
- var EntityCallSchema = z.object({
1019
- extends: z.string().regex(
1020
- /^[A-Z][a-zA-Z0-9]*\.entity$/,
1021
- 'EntityCall "extends" must be in format "Alias.entity"'
1022
- ),
1023
- name: z.string().optional(),
1024
- fields: z.array(EntityFieldSchema).optional(),
1025
- persistence: EntityPersistenceSchema.optional(),
1026
- collection: z.string().optional()
1027
- }).refine(
1028
- (call) => {
1029
- if (!call.fields) return true;
1030
- const seen = /* @__PURE__ */ new Set();
1031
- for (const field of call.fields) {
1032
- if (field.name === void 0) continue;
1033
- if (seen.has(field.name)) return false;
1034
- seen.add(field.name);
1035
- }
1036
- return true;
1037
- },
1038
- {
1039
- message: 'EntityCall "fields" override list must not contain duplicate field names',
1040
- path: ["fields"]
1041
- }
1042
- );
1043
- var EntityRefSchema = z.union([
1044
- EntitySchema,
1045
- EntityRefStringSchema,
1046
- EntityCallSchema
1047
- ]);
1048
- function isPageReferenceString(page) {
1049
- return typeof page === "string";
1050
- }
1051
- function isPageReferenceObject(page) {
1052
- return typeof page === "object" && "ref" in page && !("name" in page);
1053
- }
1054
- function isPageReference(page) {
1055
- return isPageReferenceString(page) || isPageReferenceObject(page);
1056
- }
1057
- var PageRefStringSchema = z.string().regex(
1058
- /^[A-Z][a-zA-Z0-9]*\.pages\.[A-Z][a-zA-Z0-9]*$/,
1059
- 'Page reference must be in format "Alias.pages.PageName" (e.g., "User.pages.Profile")'
1060
- );
1061
- var PageRefObjectSchema = z.object({
1062
- ref: PageRefStringSchema,
1063
- refId: PageIdSchema.optional(),
1064
- // Phase 1.2: optional registry path disambiguator, pairs with `ref`.
1065
- from: z.string().optional(),
1066
- path: z.string().startsWith("/").optional(),
1067
- linkedEntity: z.string().optional(),
1068
- linkedEntityId: EntityIdSchema.optional(),
1069
- traits: z.array(TraitRefSchema).optional(),
1070
- traitRefIds: z.array(TraitIdSchema).optional(),
1071
- access: PageAccessSchema.optional(),
1072
- indexing: PageIndexingSchema.optional(),
1073
- title: PageMetaSchema.optional(),
1074
- description: PageMetaSchema.optional(),
1075
- translationOf: z.string().min(1).optional(),
1076
- label: z.string().optional(),
1077
- icon: z.string().optional(),
1078
- roles: z.array(z.string().min(1)).min(1).optional()
1079
- });
1080
- var PageRefSchema = z.union([
1081
- PageSchema,
1082
- PageRefStringSchema,
1083
- PageRefObjectSchema
1084
- ]);
1085
- var OrbitalRefStringSchema = z.string().regex(
1086
- /^[A-Z][a-zA-Z0-9]*\.orbitals\.[A-Z][a-zA-Z0-9]*$/,
1087
- 'Orbital reference must be "Alias.orbitals.OrbitalName"'
1088
- );
1089
- var OrbitalRefObjectSchema = z.object({
1090
- ref: OrbitalRefStringSchema,
1091
- refId: OrbitalIdSchema.optional(),
1092
- entity: z.string().optional(),
1093
- fields: z.record(z.string(), z.string()).optional(),
1094
- pages: z.record(z.string(), z.string()).optional(),
1095
- pageModifiers: z.record(z.string(), PageModifiersSchema).optional(),
1096
- omit: z.array(z.string()).optional(),
1097
- only: z.array(z.string()).optional(),
1098
- config: DeclaredTraitConfigSchema.optional(),
1099
- events: z.record(z.string(), z.string()).optional(),
1100
- roles: z.record(z.string(), z.array(z.string())).optional(),
1101
- entities: z.record(z.string(), z.string()).optional(),
1102
- mounts: z.record(z.string(), z.array(z.string())).optional(),
1103
- extend: z.array(EntityFieldSchema).optional(),
1104
- mock: z.record(z.string(), z.string()).optional(),
1105
- retype: z.array(EntityFieldSchema).optional(),
1106
- persistence: EntityPersistenceSchema.optional(),
1107
- collection: z.string().optional(),
1108
- shared: z.boolean().optional(),
1109
- identity: z.boolean().optional(),
1110
- browser: z.boolean().optional(),
1111
- traits: z.record(
1112
- z.string(),
1113
- z.object({
1114
- linkedEntity: z.string().optional(),
1115
- config: DeclaredTraitConfigSchema.optional(),
1116
- events: z.record(z.string(), z.string()).optional(),
1117
- fields: z.record(z.string(), z.string()).optional(),
1118
- listens: z.array(TraitEventListenerSchema).optional(),
1119
- emitsScope: EventScopeSchema.optional(),
1120
- dispatch: TraitDispatchModeSchema.optional()
1121
- })
1122
- ).optional(),
1123
- listens: z.array(TraitEventListenerSchema.extend({ trait: z.string() })).optional()
1124
- });
1125
- function parseOrbitalRef(ref2) {
1126
- const match = ref2.match(/^([A-Z][a-zA-Z0-9]*)\.orbitals\.([A-Z][a-zA-Z0-9]*)$/);
1127
- if (!match) return null;
1128
- return { alias: match[1], orbitalName: match[2] };
1129
- }
1130
- z.string().regex(
1131
- /^([A-Z][a-zA-Z0-9]*\.traits\.)?[A-Z][a-zA-Z0-9]*$/,
1132
- 'Trait reference must be "TraitName" or "Alias.traits.TraitName"'
1133
- );
1134
- function isImportedTraitRef(ref2) {
1135
- return /^[A-Z][a-zA-Z0-9]*\.traits\.[A-Z][a-zA-Z0-9]*$/.test(ref2);
1136
- }
1137
- function parseImportedTraitRef(ref2) {
1138
- const match = ref2.match(/^([A-Z][a-zA-Z0-9]*)\.traits\.([A-Z][a-zA-Z0-9]*)$/);
1139
- if (!match) return null;
1140
- return { alias: match[1], traitName: match[2] };
1141
- }
1142
- function parseEntityRef(ref2) {
1143
- const match = ref2.match(/^([A-Z][a-zA-Z0-9]*)\.entity$/);
1144
- if (!match) return null;
1145
- return { alias: match[1] };
1146
- }
1147
- function parsePageRef(ref2) {
1148
- const match = ref2.match(/^([A-Z][a-zA-Z0-9]*)\.pages\.([A-Z][a-zA-Z0-9]*)$/);
1149
- if (!match) return null;
1150
- return { alias: match[1], pageName: match[2] };
1151
- }
1152
- var EventListenerSchema = z.object({
1153
- event: z.string().min(1),
1154
- triggers: z.string().min(1),
1155
- guard: z.string().optional()
1156
- });
1157
- var EventSourceSchema = z.object({
1158
- trait: z.string().min(1),
1159
- transition: z.string().optional(),
1160
- tick: z.string().optional()
1161
- });
1162
- var ComputedEventContractSchema = z.object({
1163
- event: z.string().min(1),
1164
- originalEvent: z.string().min(1),
1165
- source: EventSourceSchema,
1166
- description: z.string().optional(),
1167
- payload: z.array(EventPayloadFieldSchema).optional()
1168
- });
1169
- var ComputedEventListenerSchema = z.object({
1170
- event: z.string().min(1),
1171
- source: EventSourceSchema,
1172
- triggers: z.string().min(1),
1173
- guard: ExpressionSchema.optional(),
1174
- payloadMapping: z.record(z.string(), SExprSchema).optional()
1175
- });
1176
- var TypeAliasMembersSchema = z.union([
1177
- z.array(EventPayloadFieldSchema),
1178
- z.tuple([EventPayloadTypeMemberSchema.refine((field) => field.name === "", "An unnamed alias member requires an empty name")])
1179
- ]);
1180
- var OrbitalDefinitionSchema = z.object({
1181
- id: OrbitalIdSchema.optional(),
1182
- name: z.string().min(1, "Orbital name is required"),
1183
- description: z.string().optional(),
1184
- visual_prompt: z.string().optional(),
1185
- // Import system
1186
- uses: z.array(UseDeclarationSchema).optional(),
1187
- // Consumer-side requirement declarations (`.lolo` `expects ...`)
1188
- expects: z.array(ExpectDeclarationSchema).optional(),
1189
- spec: z.boolean().optional(),
1190
- // Theme & Services
1191
- theme: ThemeRefSchema.optional(),
1192
- services: z.array(ServiceRefSchema).optional(),
1193
- // Components (inline or reference)
1194
- entity: EntityRefSchema,
1195
- // Mirrors the `OrbitalDefinition.auxiliaryEntities` type field — WAS
1196
- // undeclared here, so `OrbitalSchemaSchema.safeParse` (every load through
1197
- // `external-loader.ts`) silently stripped it on every externally-loaded
1198
- // orbital (zod drops unrecognized keys by default), while a schema parsed
1199
- // directly via `JSON.parse` kept it. Found via the entity-field auto-merge
1200
- // rebind-target fallback landing on the wrong entity for any RECURSIVELY
1201
- // loaded `uses` file (`packages/almadar-runtime/src/resolver/
1202
- // reference-resolver.ts`'s `mergeImportedEntityFieldsIntoOrbital`).
1203
- auxiliaryEntities: z.array(EntityRefSchema).optional(),
1204
- traits: z.array(TraitRefSchema),
1205
- // A reference-form orbital's pages come from its upstream until inline.
1206
- pages: z.array(PageRefSchema).default([]),
1207
- // Event interface (trait-centric model) - computed by resolver
1208
- emits: z.array(ComputedEventContractSchema).optional(),
1209
- listens: z.array(ComputedEventListenerSchema).optional(),
1210
- // Filter for exposed events (trait-centric model)
1211
- exposes: z.array(z.string()).optional(),
1212
- osGrants: OsGrantsSchema.optional(),
1213
- // This orbital's own declared knobs (§4.5)
1214
- config: DeclaredTraitConfigSchema.optional(),
1215
- // Transient — set by lowering, cleared by inline/resolve
1216
- reference: OrbitalRefObjectSchema.optional(),
1217
- // Context fields - persisted throughout orbital lifecycle
1218
- domainContext: DomainContextSchema.optional(),
1219
- design: DesignPreferencesSchema.optional(),
1220
- suggestedGuards: z.array(SuggestedGuardSchema).optional(),
1221
- types: z.record(z.string(), TypeAliasMembersSchema).optional()
1222
- }).superRefine((orbital, ctx) => {
1223
- if (orbital.spec === true) return;
1224
- const entities = [[orbital.entity, ["entity"]], ...(orbital.auxiliaryEntities ?? []).map((e, i) => [e, ["auxiliaryEntities", i]])];
1225
- for (const [entity, path] of entities) {
1226
- if (!isEntityReferenceAny(entity) && entity.fields.length === 0) {
1227
- ctx.addIssue({ code: "too_small", minimum: 1, origin: "array", inclusive: true, path: [...path, "fields"], message: "At least one field is required" });
1228
- }
1229
- }
1230
- });
1231
- var OrbitalSchema = OrbitalDefinitionSchema;
1232
- function unwrapTraitRef(traitRef) {
1233
- if (typeof traitRef === "string" || isInlineTrait(traitRef) || traitRef._resolved === void 0) {
1234
- return { trait: traitRef };
1235
- }
1236
- return traitRef.config === void 0 ? { trait: traitRef._resolved } : { trait: traitRef._resolved, config: traitRef.config };
1237
- }
1238
- function inlineTraitRefs(orbitals) {
1239
- return orbitals.map((orbital) => ({
1240
- ...orbital,
1241
- traits: orbital.traits.map((traitRef) => {
1242
- const { trait, config } = unwrapTraitRef(traitRef);
1243
- if (config === void 0 || typeof trait === "string" || !isInlineTrait(trait)) return trait;
1244
- return { ...trait, config: mergeCallSiteConfigOverrides(trait.config ?? {}, config) };
1245
- })
1246
- }));
1247
- }
1248
- function isOrbitalDefinition(orbital) {
1249
- return "entity" in orbital;
1250
- }
1251
- var OrbitalUnitSchema = OrbitalSchema;
1252
- var HOST_SIGN_IN_ROUTE = "/login";
1253
- function isHostSignInRoute(path) {
1254
- return path.replace(/\/+$/, "") === HOST_SIGN_IN_ROUTE;
1255
- }
1256
- var SiteMetaSchema = z.object({
1257
- origin: z.string().url().optional(),
1258
- icon: z.string().min(1).optional(),
1259
- name: z.string().min(1).optional(),
1260
- signIn: z.string().startsWith("/").optional()
1261
- }).strict();
1262
- var ConfigProvenanceRecordSchema = z.object({
1263
- trait: z.string(),
1264
- patternPath: z.string().optional(),
1265
- prop: z.string(),
1266
- knob: z.string()
1267
- });
1268
- var SchemaMetadataSchema = z.object({
1269
- version: z.number().optional(),
1270
- createdAt: z.number().optional(),
1271
- source: z.string().optional(),
1272
- updatedAt: z.number().optional(),
1273
- configProvenance: z.record(z.string(), z.array(ConfigProvenanceRecordSchema)).optional(),
1274
- messageSources: z.record(z.string(), z.string()).optional(),
1275
- operatorSites: z.record(z.string(), z.enum(["client", "server", "any"])).optional(),
1276
- dispatchFacts: z.object({ busExcluded: z.array(z.string()), targetOptions: z.array(z.string()) }).optional()
1277
- });
1278
- var OrbitalSchemaSchema = z.object({
1279
- types: z.record(z.string(), TypeAliasMembersSchema).optional(),
1280
- typeContractVersion: z.literal(1).optional(),
1281
- name: z.string().min(1, "Schema name is required"),
1282
- description: z.string().optional(),
1283
- theme: ThemeRefSchema.optional(),
1284
- themes: z.array(z.string().min(1)).optional(),
1285
- themeDefinitions: z.array(ThemeDefinitionSchema).optional(),
1286
- summary: z.string().optional(),
1287
- version: z.string().optional(),
1288
- domainContext: DomainContextSchema.optional(),
1289
- design: DesignPreferencesSchema.optional(),
1290
- designTokens: DesignTokensSchema,
1291
- customPatterns: CustomPatternMapSchema,
1292
- orbitals: z.array(OrbitalSchema).min(1, "At least one orbital is required"),
1293
- locales: z.array(z.string().min(1)).optional(),
1294
- publicDir: z.string().min(1).optional(),
1295
- store: z.string().min(1).optional(),
1296
- egress: z.array(z.string().min(1)).optional(),
1297
- osGrants: OsGrantsSchema.optional(),
1298
- deployment: DeploymentSchema.optional(),
1299
- inbound: z.array(z.string().min(1)).optional(),
1300
- site: SiteMetaSchema.optional(),
1301
- lazyPages: z.array(LazyPageSchema).optional(),
1302
- services: z.array(ServiceDefinitionSchema).optional(),
1303
- config: DeclaredTraitConfigSchema.optional(),
1304
- _metadata: SchemaMetadataSchema.optional(),
1305
- // V4 identity — optional/dual-carry until the Phase-7 flip. Present on
1306
- // id-carrying `.orb` files so `parseOrbitalSchema` preserves them instead
1307
- // of stripping unknown keys.
1308
- schemaVersion: z.number().optional(),
1309
- ledger: IdentityLedgerSchema.optional()
1310
- });
1311
- function parseOrbitalSchema(data) {
1312
- return OrbitalSchemaSchema.parse(data);
1313
- }
1314
- function safeParseOrbitalSchema(data) {
1315
- return OrbitalSchemaSchema.safeParse(data);
1316
- }
1317
-
1318
- // src/types/observability.ts
1319
- var CALL_KINDS = ["client", "server", "db", "queue", "external"];
1320
- var LOG_SEVERITIES = ["DEBUG", "INFO", "WARNING", "ERROR"];
1321
- function isCallKind(value) {
1322
- return typeof value === "string" && CALL_KINDS.some((k) => k === value);
1323
- }
1324
- function isSeverity(value) {
1325
- return typeof value === "string" && LOG_SEVERITIES.some((s) => s === value);
1326
- }
1327
- function optionalString(value) {
1328
- return value === void 0 || typeof value === "string";
1329
- }
1330
- function isCallRecord(value) {
1331
- if (value === void 0 || !isJsonObject(value)) return false;
1332
- const { kind, service, op, durationMs, ok, error } = value;
1333
- if (!isCallKind(kind) || typeof service !== "string" || typeof op !== "string") return false;
1334
- if (typeof durationMs !== "number" || !Number.isFinite(durationMs) || durationMs < 0) return false;
1335
- if (typeof ok !== "boolean" || !optionalString(error)) return false;
1336
- return !(ok && error !== void 0);
1337
- }
1338
- function isStructuredLogEntry(value) {
1339
- if (!isJsonObject(value)) return false;
1340
- const { severity, time, namespace, message, data, call, appId, deploymentCommit } = value;
1341
- if (!isSeverity(severity) || typeof time !== "string" || typeof namespace !== "string" || typeof message !== "string") return false;
1342
- if (data !== void 0 && !isJsonObject(data)) return false;
1343
- if (call !== void 0 && !isCallRecord(call)) return false;
1344
- return optionalString(appId) && optionalString(deploymentCommit);
1345
- }
1346
- var BindingSchema = z.string().refine(
1347
- (val) => {
1348
- if (!val.startsWith("@")) return false;
1349
- const parts = val.slice(1).split(".");
1350
- if (parts.length === 0 || parts[0] === "") return false;
1351
- return parts.every((part) => /^[\p{L}_][\p{L}0-9_]*$/u.test(part));
1352
- },
1353
- { message: "Invalid binding format. Must be @name or @name.path.to.field" }
1354
- );
1355
- var BINDING_DOCS = {
1356
- entity: {
1357
- description: "Reference to the linked entity for this trait",
1358
- examples: ["@entity.health", "@entity.x", "@entity.status"],
1359
- requiresPath: true
1360
- },
1361
- payload: {
1362
- description: "Reference to the event payload data",
1363
- examples: ["@payload.amount", "@payload.targetId", "@payload.action"],
1364
- requiresPath: true
1365
- },
1366
- state: {
1367
- description: "Current state machine state name",
1368
- examples: ["@state"],
1369
- requiresPath: false
1370
- },
1371
- now: {
1372
- description: "Current timestamp in milliseconds",
1373
- examples: ["@now"],
1374
- requiresPath: false
1375
- },
1376
- config: {
1377
- description: "Trait configuration values",
1378
- examples: ["@config.apiEndpoint", "@config.theme"],
1379
- requiresPath: true
1380
- },
1381
- computed: {
1382
- description: "Computed/calculated values",
1383
- examples: ["@computed.total", "@computed.isValid"],
1384
- requiresPath: true
1385
- },
1386
- trait: {
1387
- description: "Trait context data",
1388
- examples: ["@trait.name", "@trait.category"],
1389
- requiresPath: true
1390
- },
1391
- user: {
1392
- description: "Authenticated user / agent context for ownership and role-based gating",
1393
- examples: ["@user.id", "@user.role"],
1394
- requiresPath: true
1395
- },
1396
- callsitePayload: {
1397
- description: "Call-site-captured event payload \u2014 emitted by the compiler's inline-trait hoisting when an extracted render block captured @payload; resolved at the composing effect by the runtime BindingResolver",
1398
- examples: ["@callsitePayload.error", "@callsitePayload.row"],
1399
- requiresPath: true
1400
- },
1401
- pages: {
1402
- description: "Render-resolved schema sigil \u2014 the host orbital's pages as a NavItem[] array (href = page.path, label = page.name). Substituted from the OrbitalSchema before codegen; never survives as a live binding.",
1403
- examples: ["@pages"],
1404
- requiresPath: false
1405
- },
1406
- currentTheme: {
1407
- description: "Render-resolved schema sigil \u2014 the host orbital's active data-theme key, derived from Orbital.theme. Substituted from the OrbitalSchema before codegen; never survives as a live binding.",
1408
- examples: ["@currentTheme"],
1409
- requiresPath: false
1410
- },
1411
- locale: {
1412
- description: "The active locale code (`en`, `ar`, `sl`, \u2026) \u2014 the locale whose catalog `i18n/t` reads, set by the host from the route.",
1413
- examples: ["@locale"],
1414
- requiresPath: false
1415
- },
1416
- event: {
1417
- description: "The delivery being processed: { event, payload, source } \u2014 for a listens delivery the source emit, with its BusEventSource envelope (Runtime Spec Clause 5.5)",
1418
- examples: ["@event.event", "@event.payload.n", "@event.source.trait", "@event.source.tick"],
1419
- requiresPath: false
1420
- },
1421
- prevEvents: {
1422
- description: "The deliveries this trait already received in this dispatch, in order, each shaped like @event",
1423
- examples: ["@prevEvents"],
1424
- requiresPath: false
1425
- },
1426
- prevStates: {
1427
- description: "The states this trait left in this dispatch, in order",
1428
- examples: ["@prevStates"],
1429
- requiresPath: false
1430
- },
1431
- fromState: {
1432
- description: "The transition's source state",
1433
- examples: ["@fromState"],
1434
- requiresPath: false
1435
- },
1436
- toState: {
1437
- description: "The transition's target state (null in a listens `when`, where no transition is chosen yet)",
1438
- examples: ["@toState"],
1439
- requiresPath: false
1440
- }
1441
- };
1442
- var BINDING_CONTEXT_RULES = {
1443
- guard: {
1444
- allowed: ["entity", "payload", "state", "now", "config", "user", "event", "prevEvents", "prevStates", "fromState", "toState"],
1445
- description: `Guards can read the delivery being processed and this dispatch's log (@event, @prevEvents, @prevStates) and the transition's ends (@fromState, @toState; Runtime Spec Clause 5.5). Guards can access entity fields, event payload, current state, time, the call-site trait config (@config.X), and the authenticated user context (@user.id, @user.role) for ownership / role gates. Config access lets atoms write mode-aware guards \u2014 e.g. std-modal's OPEN can require @payload.row only when @config.mode equals "edit", letting create-mode legitimately fire OPEN with no row. Like effects, @config.X is substituted at molecule/organism inline time with the literal call-site value; at atom-scope validate, @config is allowed-but-unresolved.`
1446
- },
1447
- effect: {
1448
- allowed: ["entity", "payload", "state", "now", "trait", "config", "user", "callsitePayload", "pages", "currentTheme", "locale", "event", "prevEvents", "prevStates", "fromState", "toState"],
1449
- description: "Effects can access and modify entity fields, use payload data, embed another trait's live frame via @trait.X inside render-ui children, read trait config values (@config.X) for atoms parameterized by their call-site, and read the authenticated user context (@user.id, @user.role). At molecule/organism inline time, @config.X is substituted with the literal value from the call-site config block; at atom-scope validate, @config is allowed-but-unresolved. @callsitePayload.X is the call-site-captured event payload emitted by the compiler's inline-trait hoisting (a hoisted render block that captured @payload); it is resolved at the composing effect by the runtime BindingResolver."
1450
- },
1451
- tick: {
1452
- allowed: ["entity", "state", "now", "config", "user"],
1453
- description: "Ticks can access entity fields, current state, time, trait config (@config.X) for parameterized atoms, and the authenticated user context (@user.id, @user.role). Same substitution semantics as guards/effects."
1454
- }
1455
- };
1456
- var RENDER_BINDING_MARKER = "$renderBinding";
1457
- function isRenderBindingMarker(value) {
1458
- return typeof value === "object" && value !== null && !Array.isArray(value) && RENDER_BINDING_MARKER in value && value[RENDER_BINDING_MARKER] === true;
1459
- }
1460
- var ENTITY_BINDING_RE = /@entity(?=[.\[\]]|$)/;
1461
- var PAYLOAD_BINDING_RE = /@(?:callsitePayload|payload)(?=[.\[\]]|$)/;
1462
- function containsEntityBinding(value) {
1463
- if (typeof value === "string") return ENTITY_BINDING_RE.test(value);
1464
- if (Array.isArray(value)) return value.some(containsEntityBinding);
1465
- if (value !== null && typeof value === "object") {
1466
- if (isRenderBindingMarker(value)) return true;
1467
- return Object.values(value).some(containsEntityBinding);
1468
- }
1469
- return false;
1470
- }
1471
- function containsPayloadBinding(value) {
1472
- if (typeof value === "string") return PAYLOAD_BINDING_RE.test(value);
1473
- if (Array.isArray(value)) return value.some(containsPayloadBinding);
1474
- if (value !== null && typeof value === "object") {
1475
- return Object.values(value).some(containsPayloadBinding);
1476
- }
1477
- return false;
1478
- }
1479
- function validateBindingInContext(binding, context) {
1480
- const rules = BINDING_CONTEXT_RULES[context];
1481
- if (binding.type === "core") {
1482
- if (!rules.allowed.includes(binding.root)) {
1483
- return `Binding @${binding.root} is not allowed in ${context} context. Allowed: ${rules.allowed.join(", ")}`;
1484
- }
1485
- }
1486
- return null;
1487
- }
1488
- function getBindingExamples(context) {
1489
- const rules = BINDING_CONTEXT_RULES[context];
1490
- const examples = [];
1491
- for (const binding of rules.allowed) {
1492
- const doc = BINDING_DOCS[binding];
1493
- examples.push(...doc.examples);
1494
- }
1495
- examples.push("@GameConfig.gravity", "@Filter.searchTerm");
1496
- return examples;
1497
- }
1498
- var BINDING_ROOTS = [
1499
- "entity",
1500
- "payload",
1501
- "state",
1502
- "now",
1503
- "config",
1504
- "trait",
1505
- "user",
1506
- "callsitePayload",
1507
- "pages",
1508
- "currentTheme",
1509
- "locale",
1510
- "event",
1511
- "prevEvents",
1512
- "prevStates",
1513
- "fromState",
1514
- "toState",
1515
- "fromEntity",
1516
- "other"
1517
- ];
1518
- var KNOWN_ROOTS = new Set(BINDING_ROOTS.filter((r) => r !== "other"));
1519
- function toBindingRoot(root) {
1520
- return KNOWN_ROOTS.has(root) ? root : "other";
1521
- }
1522
- var TRAIT_REF_PATTERN = /^@trait\.[A-Z][a-zA-Z0-9]*$/;
1523
- function isTraitFieldRef(value) {
1524
- return typeof value === "string" && TRAIT_REF_PATTERN.test(value);
1525
- }
1526
- var TraitFieldRefSchema = z.string().regex(TRAIT_REF_PATTERN, "expected `@trait.<TraitName>` reference");
1527
-
1528
- // src/types/agent.ts
1529
- function isSessionHistoryEntry(value) {
1530
- if (typeof value !== "object" || value === null) return false;
1531
- return "role" in value && typeof value.role === "string" && "content" in value && typeof value.content === "string" && "timestamp" in value && typeof value.timestamp === "number";
1532
- }
1533
-
1534
- // src/types/plan.ts
1535
- function isPlanSnapshot(value) {
1536
- if (typeof value !== "object" || value === null) return false;
1537
- const statuses = ["proposed", "confirmed", "built", "failed"];
1538
- return "schemaVersion" in value && value.schemaVersion === 1 && "status" in value && statuses.some((s) => s === value.status) && "builtAt" in value && typeof value.builtAt === "string" && "orbitals" in value && Array.isArray(value.orbitals) && "renames" in value && Array.isArray(value.renames) && "deletedOrbitals" in value && Array.isArray(value.deletedOrbitals);
1539
- }
1540
- var InteractionModelSchema = z.object({
1541
- createFlow: z.enum(["modal", "page", "inline", "none"]),
1542
- editFlow: z.enum(["modal", "page", "inline", "none"]),
1543
- viewFlow: z.enum(["drawer", "page", "modal", "inline", "none"]),
1544
- deleteFlow: z.enum(["confirm", "instant", "none"]),
1545
- listInteraction: z.enum(["click-to-view", "click-to-edit", "inline-edit"]).optional(),
1546
- bulkActions: z.boolean().optional(),
1547
- realtime: z.boolean().optional()
1548
- });
1549
- var DEFAULT_INTERACTION_MODELS = {
1550
- business: {
1551
- createFlow: "modal",
1552
- editFlow: "modal",
1553
- viewFlow: "drawer",
1554
- deleteFlow: "confirm",
1555
- listInteraction: "click-to-view",
1556
- bulkActions: true
1557
- },
1558
- game: {
1559
- createFlow: "none",
1560
- editFlow: "none",
1561
- viewFlow: "none",
1562
- deleteFlow: "none",
1563
- realtime: true
1564
- },
1565
- form: {
1566
- createFlow: "inline",
1567
- editFlow: "inline",
1568
- viewFlow: "none",
1569
- deleteFlow: "none"
1570
- },
1571
- dashboard: {
1572
- createFlow: "modal",
1573
- editFlow: "modal",
1574
- viewFlow: "drawer",
1575
- deleteFlow: "confirm",
1576
- listInteraction: "click-to-view"
1577
- },
1578
- content: {
1579
- createFlow: "page",
1580
- editFlow: "page",
1581
- viewFlow: "page",
1582
- deleteFlow: "confirm",
1583
- listInteraction: "click-to-view"
1584
- }
1585
- };
1586
- function getInteractionModelForDomain(domain) {
1587
- return DEFAULT_INTERACTION_MODELS[domain] ?? DEFAULT_INTERACTION_MODELS.business;
1588
- }
1589
- var PatternTypeSchema = z.string();
1590
-
1591
- // src/types/changeset.ts
1592
- var SEMANTIC_CHANGE_KINDS = [
1593
- "orbital-added",
1594
- "orbital-removed",
1595
- "entity-fields-changed",
1596
- "trait-added",
1597
- "trait-removed",
1598
- "trait-config-changed",
1599
- "state-machine-changed",
1600
- "guard-changed",
1601
- "effect-changed",
1602
- "render-ui-changed",
1603
- "event-wiring-changed",
1604
- "page-changed",
1605
- "theme-changed",
1606
- "behavior-composed"
1607
- ];
1608
-
1609
- // src/service-types.ts
1610
- function createTypedEventBus(bus) {
1611
- return {
1612
- emit(event, payload) {
1613
- bus.emit(event, payload);
1614
- },
1615
- on(event, handler) {
1616
- return bus.on(event, handler);
1617
- }
1618
- };
1619
- }
1620
- function createLazyService(factory) {
1621
- let instance = null;
1622
- return {
1623
- get() {
1624
- if (instance === null) {
1625
- instance = factory();
1626
- }
1627
- return instance;
1628
- },
1629
- reset() {
1630
- instance = null;
1631
- }
1632
- };
1633
- }
1634
-
1635
- // src/row-predicate.ts
1636
- function parseFetchOrder(orderBy) {
1637
- if (typeof orderBy !== "string" || orderBy === "") return void 0;
1638
- const [field, direction] = orderBy.split(":");
1639
- const dir = direction === "desc" ? "desc" : "asc";
1640
- return { field, direction: dir };
1641
- }
1642
-
1643
- // src/types/ir.ts
1644
- function createEmptyResolvedTrait(name, source) {
1645
- return {
1646
- name,
1647
- source,
1648
- states: [],
1649
- events: [],
1650
- transitions: [],
1651
- guards: [],
1652
- ticks: [],
1653
- listens: [],
1654
- dataEntities: []
1655
- };
1656
- }
1657
- function createEmptyResolvedPage(name) {
1658
- return {
1659
- name,
1660
- path: `/${name.toLowerCase()}`,
1661
- featureName: name.toLowerCase(),
1662
- sections: [],
1663
- traits: [],
1664
- entityBindings: [],
1665
- navigation: [],
1666
- singletonEntities: []
1667
- };
1668
- }
1669
- function inferTsType(schemaType) {
1670
- const typeMap = {
1671
- string: "string",
1672
- number: "number",
1673
- boolean: "boolean",
1674
- date: "Date",
1675
- datetime: "Date",
1676
- timestamp: "number",
1677
- array: "unknown[]",
1678
- object: "Record<string, unknown>",
1679
- any: "unknown",
1680
- // Renderable UI content — the canonical pattern-tree type from
1681
- // render-ui-edit.ts. Without this entry the raw tag `node` would leak
1682
- // out as a (nonexistent) TS type name.
1683
- node: "PatternNode | PatternNode[]"
1684
- };
1685
- if (schemaType.endsWith("[]")) {
1686
- const baseType = schemaType.slice(0, -2);
1687
- return `${typeMap[baseType] || baseType}[]`;
1688
- }
1689
- const container = payloadTypeContainer(schemaType);
1690
- if (container.kind === "map") {
1691
- return `Record<${inferTsType(container.key)}, ${inferTsType(container.value)}>`;
1692
- }
1693
- return typeMap[schemaType] || schemaType;
1694
- }
1695
- function createResolvedField(field) {
1696
- return {
1697
- name: field.name,
1698
- type: field.type,
1699
- tsType: inferTsType(field.type),
1700
- description: field.description,
1701
- default: field.default,
1702
- required: field.required ?? false,
1703
- validation: field.validation,
1704
- values: field.values,
1705
- relation: field.relation,
1706
- intrinsic: field.intrinsic,
1707
- items: field.items,
1708
- properties: field.properties
1709
- };
1710
- }
1711
- function isResolvedIR(ir) {
1712
- if (!ir || typeof ir !== "object") return false;
1713
- const r = ir;
1714
- return typeof r.appName === "string" && r.traits instanceof Map && r.pages instanceof Map;
1715
- }
1716
-
1717
- // src/types/visit-key.ts
1718
- function isPayloadList(value) {
1719
- return Array.isArray(value);
1720
- }
1721
- function canonicalJson(value) {
1722
- if (value === void 0 || value === null) return "null";
1723
- if (value instanceof Date) return JSON.stringify(value.toISOString());
1724
- if (isPayloadList(value)) {
1725
- return `[${value.map((item) => item === void 0 ? "null" : canonicalJson(item)).join(",")}]`;
1726
- }
1727
- if (typeof value === "object") {
1728
- const record = value;
1729
- const fields = Object.keys(record).filter((k) => record[k] !== void 0).sort().map((k) => `${JSON.stringify(k)}:${canonicalJson(record[k])}`);
1730
- return `{${fields.join(",")}}`;
1731
- }
1732
- return JSON.stringify(value);
1733
- }
1734
- function dispatchVisitKey(trait, event, from, payload, frame) {
1735
- return `${trait}\0${event}\0${from}\0${canonicalJson(payload)}\0${canonicalJson(frame)}`;
1736
- }
1737
- var COMPOSITE = /* @__PURE__ */ Symbol("composite");
1738
- function canonicalLeaf(value) {
1739
- if (value === void 0 || value === null) return null;
1740
- if (value instanceof Date) return value.toISOString();
1741
- if (typeof value === "number") return Number.isFinite(value) ? value : null;
1742
- if (typeof value === "object") return COMPOSITE;
1743
- return value;
1744
- }
1745
- function sameCanonical(a, b) {
1746
- if (a === b) return true;
1747
- const leafA = canonicalLeaf(a);
1748
- const leafB = canonicalLeaf(b);
1749
- if (leafA !== COMPOSITE || leafB !== COMPOSITE) return leafA === leafB;
1750
- if (isPayloadList(a) || isPayloadList(b)) {
1751
- if (!isPayloadList(a) || !isPayloadList(b) || a.length !== b.length) return false;
1752
- return a.every((item, i) => sameCanonical(item, b[i]));
1753
- }
1754
- if (a instanceof Date || b instanceof Date || typeof a !== "object" || typeof b !== "object" || a === null || b === null) return false;
1755
- const keysA = Object.keys(a).filter((k) => a[k] !== void 0);
1756
- const keysB = Object.keys(b).filter((k) => b[k] !== void 0);
1757
- return keysA.length === keysB.length && keysA.every((k) => b[k] !== void 0 && sameCanonical(a[k], b[k]));
1758
- }
1759
- var DispatchVisits = class {
1760
- constructor() {
1761
- this.steps = /* @__PURE__ */ new Map();
1762
- }
1763
- has(trait, event, from, payload, frame) {
1764
- const seen = this.steps.get(`${trait}\0${event}\0${from}`);
1765
- return seen !== void 0 && seen.some((v) => sameCanonical(v.payload, payload) && sameCanonical(v.frame, frame));
1766
- }
1767
- add(trait, event, from, payload, frame) {
1768
- if (this.has(trait, event, from, payload, frame)) return;
1769
- const step = `${trait}\0${event}\0${from}`;
1770
- const visit = {
1771
- payload: payload === void 0 || payload === null ? null : { ...payload },
1772
- frame: frame === null ? null : { ...frame }
1773
- };
1774
- const seen = this.steps.get(step);
1775
- if (seen === void 0) this.steps.set(step, [visit]);
1776
- else seen.push(visit);
1777
- }
1778
- };
1779
-
1780
- // src/types/dispatch-memory.ts
1781
- function dispatchScopeOf(delivery, log, event, payload) {
1782
- const record = delivery ?? { event, ...payload !== void 0 ? { payload } : {}, source: {} };
1783
- return {
1784
- event: deliveryRecordValue(record),
1785
- prevEvents: (log?.prevEvents ?? []).map(deliveryRecordValue),
1786
- prevStates: [...log?.prevStates ?? []]
1787
- };
1788
- }
1789
- var DispatchMemory = class {
1790
- constructor() {
1791
- this.deliveries = /* @__PURE__ */ new Map();
1792
- this.left = /* @__PURE__ */ new Map();
1793
- }
1794
- /** This trait's log so far, as it travels on a request. */
1795
- log(trait) {
1796
- return { prevEvents: [...this.deliveries.get(trait) ?? []], prevStates: [...this.left.get(trait) ?? []] };
1797
- }
1798
- view(trait, delivery) {
1799
- return dispatchScopeOf(delivery, this.log(trait), delivery.event, delivery.payload);
1800
- }
1801
- /** Continue a dispatch that began elsewhere: the target trait's log so far. */
1802
- seed(trait, log) {
1803
- this.deliveries.set(trait, [...log.prevEvents]);
1804
- this.left.set(trait, [...log.prevStates]);
1805
- }
1806
- recordDelivery(trait, delivery) {
1807
- const log = this.deliveries.get(trait) ?? [];
1808
- log.push(delivery);
1809
- this.deliveries.set(trait, log);
1810
- }
1811
- recordTransition(trait, from, to) {
1812
- if (from === to) return;
1813
- const log = this.left.get(trait) ?? [];
1814
- log.push(from);
1815
- this.left.set(trait, log);
1816
- }
1817
- };
1818
-
1819
- // src/types/guard-holds.ts
1820
- function guardHolds(check, onError) {
1821
- try {
1822
- return check();
1823
- } catch (error) {
1824
- onError(error instanceof Error ? error : new Error(String(error)));
1825
- return false;
1826
- }
1827
- }
1828
-
1829
- // src/types/verification-ids.json
1830
- var verification_ids_default = {
1831
- actionPrefix: "action-",
1832
- overflowKey: "overflow",
1833
- gestureEventProps: {
1834
- longPressEvent: "long-press",
1835
- swipeLeftEvent: "swipe-left",
1836
- swipeRightEvent: "swipe-right"
1837
- },
1838
- nativeIdPrefix: {
1839
- pattern: "pattern-",
1840
- row: "row-",
1841
- field: "field-",
1842
- slot: "slot-"
1843
- },
1844
- nativeIdSeparator: " "
1845
- };
1846
-
1847
- // src/types/verification.ts
1848
- var PATTERN_PROP_TYPE_ERROR_TESTID = "pattern-prop-type-error";
1849
- var TRAIT_MOUNT_ERROR_TESTID = "trait-mount-error";
1850
- var EMPTY_STATE_MARKER = "data-empty-state";
1851
- var LOADING_STATE_MARKER = "data-loading-state";
1852
- var VERIFICATION_DOM_ATTRS = {
1853
- pattern: "data-pattern",
1854
- rowId: "data-row-id",
1855
- entityRow: "data-entity-row",
1856
- entityId: "data-entity-id",
1857
- fieldName: "data-field-name",
1858
- event: "data-event"
1859
- };
1860
- var ACTION_TESTID_PREFIX = verification_ids_default.actionPrefix;
1861
- var ACTION_OVERFLOW_TESTID = `${ACTION_TESTID_PREFIX}${verification_ids_default.overflowKey}`;
1862
- var FORM_PATTERN = "form-section";
1863
- function actionTestId(eventKey) {
1864
- return `${ACTION_TESTID_PREFIX}${eventKey}`;
1865
- }
1866
- function actionTestIdMatches(testId, event) {
1867
- if (!testId.startsWith(ACTION_TESTID_PREFIX)) return false;
1868
- const key = testId.slice(ACTION_TESTID_PREFIX.length);
1869
- return key === event || key.endsWith(`.${event}`);
1870
- }
1871
- var GESTURES = ["tap", "long-press", "swipe-left", "swipe-right"];
1872
- function gestureOf(name) {
1873
- const gesture = GESTURES.find((g) => g !== "tap" && g === name);
1874
- if (gesture === void 0) throw new Error(`verification-ids.json names an unknown gesture "${name}"`);
1875
- return gesture;
1876
- }
1877
- var GESTURE_EVENT_PROPS = Object.fromEntries(
1878
- Object.entries(verification_ids_default.gestureEventProps).map(([prop, gesture]) => [prop, gestureOf(gesture)])
1879
- );
1880
- function gestureActionTestId(eventKey, gesture) {
1881
- return gesture === "tap" ? actionTestId(eventKey) : `${ACTION_TESTID_PREFIX}${gesture}:${eventKey}`;
1882
- }
1883
- function gestureOfActionTestId(testId, event) {
1884
- if (!testId.startsWith(ACTION_TESTID_PREFIX)) return null;
1885
- const rest = testId.slice(ACTION_TESTID_PREFIX.length);
1886
- const colon = rest.indexOf(":");
1887
- const gesture = colon < 0 ? "tap" : GESTURES.find((g) => g !== "tap" && g === rest.slice(0, colon));
1888
- if (gesture === void 0) return null;
1889
- const key = colon < 0 ? rest : rest.slice(colon + 1);
1890
- return key === event || key.endsWith(`.${event}`) ? gesture : null;
1891
- }
1892
- var NATIVE_ID_PREFIX = verification_ids_default.nativeIdPrefix;
1893
- var NATIVE_ID_SEPARATOR = verification_ids_default.nativeIdSeparator;
1894
- function nativeIds(...ids) {
1895
- return ids.filter((id) => id !== "").join(NATIVE_ID_SEPARATOR);
1896
- }
1897
- function splitNativeIds(identifier) {
1898
- return identifier.split(NATIVE_ID_SEPARATOR).filter((id) => id !== "");
1899
- }
1900
- function nativePatternId(name) {
1901
- return `${NATIVE_ID_PREFIX.pattern}${name}`;
1902
- }
1903
- function nativeRowId(id) {
1904
- return `${NATIVE_ID_PREFIX.row}${id}`;
1905
- }
1906
- function nativeFieldId(name) {
1907
- return `${NATIVE_ID_PREFIX.field}${name}`;
1908
- }
1909
- function nativeSlotId(name) {
1910
- return `${NATIVE_ID_PREFIX.slot}${name}`;
1911
- }
1912
-
1913
- // src/generated/language/validation-codes.json
1914
- var validation_codes_default = [
1915
- {
1916
- code: "ORB_E_MISSING_NAME",
1917
- category: "entity",
1918
- description: "Entity is missing a name"
1919
- },
1920
- {
1921
- code: "ORB_E_NO_FIELDS",
1922
- category: "entity",
1923
- description: "Entity has no fields defined"
1924
- },
1925
- {
1926
- code: "ORB_E_INVALID_FIELD_TYPE",
1927
- category: "entity",
1928
- description: "Field has an invalid type"
1929
- },
1930
- {
1931
- code: "ORB_E_DUPLICATE_FIELD",
1932
- category: "entity",
1933
- description: "Duplicate field name in entity"
1934
- },
1935
- {
1936
- code: "ORB_E_INVALID_FIELD_NAME",
1937
- category: "entity",
1938
- description: "Field name doesn't match camelCase pattern"
1939
- },
1940
- {
1941
- code: "ORB_E_MISSING_COLLECTION",
1942
- category: "entity",
1943
- description: "Persistent entity missing collection property"
1944
- },
1945
- {
1946
- code: "ORB_E_LOCAL_REQUIRES_PERSISTENT",
1947
- category: "entity",
1948
- description: "`browser` on a non-persistent entity (ORB_E_LOCAL_REQUIRES_PERSISTENT)"
1949
- },
1950
- {
1951
- code: "ORB_E_IDENTITY_LOCAL",
1952
- category: "entity",
1953
- description: "`[identity]` entity declared `browser` (ORB_E_IDENTITY_LOCAL)"
1954
- },
1955
- {
1956
- code: "ORB_E_INSTANCE_INVALID",
1957
- category: "entity",
1958
- description: "A written-out row with an unknown field, a missing required field, or (local) no id (ORB_E_INSTANCE_INVALID)"
1959
- },
1960
- {
1961
- code: "ORB_E_LOCALE_INSTANCES_NOT_LOCAL",
1962
- category: "entity",
1963
- description: "`instances <lang>` on an entity whose rows are not browser-stored (ORB_E_LOCALE_INSTANCES_NOT_LOCAL)"
1964
- },
1965
- {
1966
- code: "ORB_E_LOCALE_INSTANCES_UNKNOWN_LOCALE",
1967
- category: "entity",
1968
- description: "`instances <lang>` for a locale the app does not declare, or for its default locale (ORB_E_LOCALE_INSTANCES_UNKNOWN_LOCALE)"
1969
- },
1970
- {
1971
- code: "ORB_E_LOCALE_INSTANCES_INCOMPLETE",
1972
- category: "entity",
1973
- description: "Locale rows written without the default `instances`, or missing a declared locale (ORB_E_LOCALE_INSTANCES_INCOMPLETE)"
1974
- },
1975
- {
1976
- code: "ORB_E_INVALID_RELATION",
1977
- category: "entity",
1978
- description: "Relation target entity doesn't exist"
1979
- },
1980
- {
1981
- code: "ORB_E_EMPTY_ENUM_VALUES",
1982
- category: "entity",
1983
- description: "Enum field has no values"
1984
- },
1985
- {
1986
- code: "ORB_E_SEMANTIC_VALUE_INVALID",
1987
- category: "entity",
1988
- description: 'A literal default on a semantic-domain field does not satisfy that domain (`email : email = "not-an-email"`).'
1989
- },
1990
- {
1991
- code: "ORB_E_MOCK_NOT_IN_ENUM",
1992
- category: "entity",
1993
- description: "An enum field's `@mock` names a candidate that is not one of its values."
1994
- },
1995
- {
1996
- code: "ORB_E_LITERAL_UNION_DEFAULT_MISMATCH",
1997
- category: "entity",
1998
- description: "Phase F.3: an entity field declares `values: [...]` (literal-union) AND `default: <X>`, but X is not one of the declared values. Error."
1999
- },
2000
- {
2001
- code: "ORB_E_DEFAULT_TYPE_MISMATCH",
2002
- category: "entity",
2003
- description: "An entity field's `default` is structurally incompatible with its declared type \u2014 a relation field defaulting to a whole row (`seedRow : Note = {}`) instead of an id/absent, a number/boolean default on a string/enum field, etc. Rung-2 prevention: `check_field_def_shape` (`config_type.rs`) owns the one shape-vs-type check, reused here for entity defaults. Skips the string-vs-enum-membership case, which `LiteralUnionDefaultMismatch` already reports."
2004
- },
2005
- {
2006
- code: "ORB_T_UNDEFINED_TRAIT",
2007
- category: "trait",
2008
- description: "Trait reference not found"
2009
- },
2010
- {
2011
- code: "ORB_T_INVALID_FORMAT",
2012
- category: "trait",
2013
- description: "Trait has invalid format"
2014
- },
2015
- {
2016
- code: "ORB_T_NO_INITIAL_STATE",
2017
- category: "trait",
2018
- description: "State machine has no initial state"
2019
- },
2020
- {
2021
- code: "ORB_T_MULTIPLE_INITIAL_STATES",
2022
- category: "trait",
2023
- description: "State machine has multiple initial states"
2024
- },
2025
- {
2026
- code: "ORB_T_DUPLICATE_STATE",
2027
- category: "trait",
2028
- description: "Duplicate state name in state machine"
2029
- },
2030
- {
2031
- code: "ORB_T_EMPTY_EVENT_NAME",
2032
- category: "trait",
2033
- description: "An event declared, emitted or transitioned on has an empty name"
2034
- },
2035
- {
2036
- code: "ORB_T_INVALID_TRANSITION",
2037
- category: "trait",
2038
- description: "Transition references non-existent state"
2039
- },
2040
- {
2041
- code: "ORB_T_DUPLICATE_TRANSITION",
2042
- category: "trait",
2043
- description: "Duplicate transition (same from/event without guard)"
2044
- },
2045
- {
2046
- code: "ORB_T_MISSING_INIT_TRANSITION",
2047
- category: "trait",
2048
- description: "Missing INIT transition on initial state"
2049
- },
2050
- {
2051
- code: "ORB_T_STATE_UNREACHABLE",
2052
- category: "trait",
2053
- description: 'A declared state is unreachable from the trait\'s initial state via any transition path. BFS from the initial state over `transitions` (skipping `from == "*"` wildcards and the boot `INIT` self-loop on the initial state) never reaches it \u2014 dead topology. Surfaces only as a generic "uncovered" in the verifier today; caught here at author time. Worked example: std-booking-system ScheduleDisplay\'s `displaying`/`refreshing` cluster.'
2054
- },
2055
- {
2056
- code: "ORB_T_INIT_MISSING_FETCH",
2057
- category: "trait",
2058
- description: "INIT transition missing fetch effect for linked entity"
2059
- },
2060
- {
2061
- code: "ORB_T_MISSING_RENDER_UI",
2062
- category: "trait",
2063
- description: "Interaction trait missing render_ui effects"
2064
- },
2065
- {
2066
- code: "ORB_T_ENDPOINT_TRAIT_RENDERS",
2067
- category: "trait",
2068
- description: "A trait mounted only on protocol endpoints renders"
2069
- },
2070
- {
2071
- code: "ORB_T_TRAIT_ON_ROUTE_AND_ENDPOINT",
2072
- category: "trait",
2073
- description: "One trait is listed on both a route page and a protocol endpoint"
2074
- },
2075
- {
2076
- code: "ORB_T_TRAIT_UNMOUNTED",
2077
- category: "trait",
2078
- description: "A program trait is listed on no page"
2079
- },
2080
- {
2081
- code: "ORB_T_DEPRECATED_UI",
2082
- category: "trait",
2083
- description: "Deprecated ui property used"
2084
- },
2085
- {
2086
- code: "ORB_T_DUPLICATE_NAME",
2087
- category: "trait",
2088
- description: "Duplicate trait name across orbitals"
2089
- },
2090
- {
2091
- code: "ORB_T_UNDEFINED_EVENT",
2092
- category: "trait",
2093
- description: "Event not defined but used in transition"
2094
- },
2095
- {
2096
- code: "ORB_T_BEHAVIOR_REF_UNRESOLVED",
2097
- category: "trait",
2098
- description: "A trait-value literal (`<spec>.traits.<Trait>`) whose behavior or trait does not resolve against the installed behavior packages."
2099
- },
2100
- {
2101
- code: "ORB_T_BEHAVIOR_REF_NOT_LITERAL",
2102
- category: "trait",
2103
- description: "A `behavior/ref` whose argument is computed at run time: a behavior from data must arrive as a `behavior` value, never re-parsed from text."
2104
- },
2105
- {
2106
- code: "ORB_T_UNQUOTE_OUTSIDE_QUASIQUOTE",
2107
- category: "trait",
2108
- description: 'An `["unquote", \u2026]` call outside a quasiquote body in an `.orb` input.'
2109
- },
2110
- {
2111
- code: "ORB_T_INVALID_SLOT_DEFAULT",
2112
- category: "trait",
2113
- description: "Config field typed `slot` has a default value not in `VALID_SLOTS`"
2114
- },
2115
- {
2116
- code: "ORB_T_INVALID_PATTERN_DEFAULT",
2117
- category: "trait",
2118
- description: "Config field typed `pattern` has a default value not in `PATTERN_TYPES`"
2119
- },
2120
- {
2121
- code: "ORB_T_SECRET_DEFAULT_NOT_STRING",
2122
- category: "trait",
2123
- description: "Config field typed `secret` has a non-string default \u2014 the value is a credential REFERENCE (env-var key name), never secret material (I-29)"
2124
- },
2125
- {
2126
- code: "ORB_T_INVALID_EVENT_DEFAULT",
2127
- category: "trait",
2128
- description: "Config field typed `event` holds a value that is not a member of the trait's post-rename event set (SCAN-EVENT-KNOB-1). Definer-position knobs (A-UNIFY) skip this membership check \u2014 their value CREATES the event name \u2014 but still land here if the default isn't a plain string."
2129
- },
2130
- {
2131
- code: "ORB_T_EVENT_REF_UNRESOLVED",
2132
- category: "trait",
2133
- description: "An event-typed config value addresses a trait the program does not have."
2134
- },
2135
- {
2136
- code: "ORB_T_EVENT_REF_NOT_EXTERNAL_INPUT",
2137
- category: "trait",
2138
- description: "An event-typed config value addresses an event its trait does not declare as an external input."
2139
- },
2140
- {
2141
- code: "ORB_T_EXTERNAL_INPUT_NOT_RESTING",
2142
- category: "trait",
2143
- description: "A declared external input (`listens { EVENT -> external { \u2026 } }`) has no transition from the trait's initial state: inputs are complete commands."
2144
- },
2145
- {
2146
- code: "ORB_T_CONFIG_SHAPE_MISMATCH",
2147
- category: "trait",
2148
- description: "Config field's default value doesn't match its declared structural shape (array vs scalar, object vs string, missing required, etc.). Fires after the typed-config carriers (`items` / `properties` / `values`) make the declared shape concrete enough to check against."
2149
- },
2150
- {
2151
- code: "ORB_T_CONFIG_OBJECT_ARRAY_FORBIDDEN",
2152
- category: "trait",
2153
- description: "Config field uses `[object]` as its declared type. Banned because it lowers to an untyped `Array { inner: Json }` \u2014 the same shape the strict-lint floor catches as `Record<string, FieldValue | undefined>[]`. Authors should declare a named struct alias (e.g. `type FieldConfig = { name: string, label: string, ... }`) and use `[FieldConfig]` so the catalog + codegen carry real types."
2154
- },
2155
- {
2156
- code: "ORB_T_GENERIC_TYPE_DEPRECATED",
2157
- category: "trait",
2158
- description: "A declaration uses a generic type \u2014 bare `json`, `object` (without declared `properties`), or `any` \u2014 in an entity field, config knob, type-alias member, or event payload field. Generic types are being eliminated from the language: renderable content belongs in `node`, structured data in inline `{ k: T }` shapes / named aliases / `Map K V`, and genuinely polymorphic atoms in declared type parameters. Hard error since 2026-09-01 (both behavior packages report zero occurrences)."
2159
- },
2160
- {
2161
- code: "ORB_T_TYPE_UNKNOWN",
2162
- category: "trait",
2163
- description: "A type reference names no declared type, entity or primitive"
2164
- },
2165
- {
2166
- code: "ORB_T_TYPE_CYCLE",
2167
- category: "trait",
2168
- description: "A type composition chain refers back to itself"
2169
- },
2170
- {
2171
- code: "ORB_T_TYPE_KIND_MISMATCH",
2172
- category: "trait",
2173
- description: "Composed types do not share a kind (all Entity, all Trait, \u2026)"
2174
- },
2175
- {
2176
- code: "ORB_T_TYPE_COMPOSITION_CONFLICT",
2177
- category: "trait",
2178
- description: "A field is declared in more than one composed entity"
2179
- },
2180
- {
2181
- code: "ORB_T_TYPE_ANNOTATION_MISMATCH",
2182
- category: "trait",
2183
- description: "A type body does not match its `::` type annotation"
2184
- },
2185
- {
2186
- code: "ORB_T_TYPE_UNKNOWN_PARAM",
2187
- category: "trait",
2188
- description: "A type alias body uses a type parameter the alias does not declare"
2189
- },
2190
- {
2191
- code: "ORB_T_TYPE_WRONG_ARG_COUNT",
2192
- category: "trait",
2193
- description: "A type alias is applied with the wrong number of type arguments"
2194
- },
2195
- {
2196
- code: "ORB_T_EVENT_TYPE_WRONG_KIND",
2197
- category: "trait",
2198
- description: "An `emits` entry names a declared type that is not an Event type"
2199
- },
2200
- {
2201
- code: "ORB_RUI_NODE_FIELD_UNCHECKED_CONTENT",
2202
- category: "trait",
2203
- description: "A `node`-typed entity field receives a value the validator cannot statically check (a computed expression rather than a pattern-tree literal). Non-blocking: computed renderable content is legitimate, but its callback wiring is unchecked \u2014 prefer literal fragments (optionally via `let` bindings, which ARE resolved and checked)."
2204
- },
2205
- {
2206
- code: "ORB_RUI_RENDERABLE_IN_GENERIC_FIELD",
2207
- category: "trait",
2208
- description: "A render-ui pattern literal is assigned to a field NOT typed `node` \u2014 renderable content hiding in a generic/structured field escapes every render-ui check. Type the field `node` (or `[node]`). Error severity."
2209
- },
2210
- {
2211
- code: "ORB_T_CONFIG_TIER_INVALID",
2212
- category: "trait",
2213
- description: 'Config field\'s `@tier "..."` annotation uses a value outside the allowed set. Allowed values: `essential`, `customization`, `advanced`, `internal`. Defense-in-depth \u2014 the parser allowlists the four values today; this L2 rule catches future regressions and any malformed `.orb` IR that bypasses the parser.'
2214
- },
2215
- {
2216
- code: "ORB_T_ENTITY_NOT_REBINDABLE",
2217
- category: "trait",
2218
- description: "A trait imported from an atom carries a `linkedEntity` rebind, but the atom's binding is not marked `@rebindable`. The binding is fixed and the consumer may not redirect it. See `@rebindable` in `.lolo`."
2219
- },
2220
- {
2221
- code: "ORB_T_REBIND_MISSING_FIELDS",
2222
- category: "trait",
2223
- description: "A `@rebindable` rebind points at an entity that lacks fields the trait reads (its inferred `entityContract.requires`). The target would break the behavior."
2224
- },
2225
- {
2226
- code: "ORB_T_REBIND_TARGET_UNRESOLVED",
2227
- category: "trait",
2228
- description: "A `linkedEntity` rebind names something that is not any orbital's primary or auxiliary entity anywhere in the schema \u2014 the \xA752 rebind-merge (`phases::inline::entity::merge_into_named_entity`) has nowhere to land the imported trait's fields. Retired 2026-09-19: this used to fall back to the caller's primary entity silently; it is now a hard error instead of a wrong-entity merge."
2229
- },
2230
- {
2231
- code: "ORB_T_UNRESOLVED_TYPE_PARAM",
2232
- category: "trait",
2233
- description: "A `.lolo` event alias's `(E : Entity)` type parameter \u2014 lowered to the `\"$E\"` payload sentinel by `orbital-lolo` (increment 3-I, `docs/Almadar_LOLO.md` ~line 315/1387) \u2014 survived the inline phase's substitution pass because the trait carrying the sentinel has no `linkedEntity` to monomorphize it against. Fix: bind the trait to an entity (or, once explicit application ships, apply the alias with a concrete argument)."
2234
- },
2235
- {
2236
- code: "ORB_T_EVENT_RENAME_UNKNOWN_KEY",
2237
- category: "trait",
2238
- description: "A call-site `events: { OLD: NEW }` rename names an OLD source key that does not exist in the imported trait's event set (its `emits[].event` \u222A `state_machine.transitions[].event`). The rename silently no-ops: nothing is renamed and the author's intent is lost. Surfaced from the inline phase where the imported trait's pre-rename event set is still visible."
2239
- },
2240
- {
2241
- code: "ORB_T_CONFIG_UNKNOWN_CALL_SITE_KEY",
2242
- category: "trait",
2243
- description: "A trait Reference's call-site `config` block supplies a key that matches no declared config knob on the referenced trait \u2014 the override silently no-ops (e.g. a stale `entity=` left over from a generator regression, or a knob the atom never declared)."
2244
- },
2245
- {
2246
- code: "ORB_T_CONFIG_MISSING_REQUIRED_KEY",
2247
- category: "trait",
2248
- description: "A trait Reference's call site omits a key for a knob the referenced trait declares `!` (required). Any value form (literal, `@config.X` forward, `@entity.*`, payload ref) satisfies the requirement \u2014 only a fully missing key fires. The atom's own page binding is exempt."
2249
- },
2250
- {
2251
- code: "ORB_T_LOCAL_TRAIT_TOUCHES_SERVER",
2252
- category: "trait",
2253
- description: "A `[client]` trait's transitions contain a server-bound effect (`fetch`/`persist`/`call-service`/`ref`/`deref`/`swap`/`watch`/ `atomic`/`fetch-stream`), or a guard reading `@user.*`. `[client]` declares client-only dispatch (`OirTrait::dispatch_mode`) \u2014 a trait that actually touches the server or reads viewer identity is mis-tagged; its transitions would never await the round trip they depend on. Wave 2. Error severity."
2254
- },
2255
- {
2256
- code: "ORB_T_CLIENT_TICK_SERVER_EFFECT",
2257
- category: "trait",
2258
- description: "A tick that runs in the browser (its trait is not server-awaited; the tick is not `[background]`) carries a server effect \u2014 a server-owned data effect, or a `runsOn: server` operator. Nothing replays a tick on the server, so the effect would be dropped. Server work goes through an emitted event a server-side trait handles."
2259
- },
2260
- {
2261
- code: "ORB_T_LOCAL_ON_NON_SHARED_PERSISTENT",
2262
- category: "trait",
2263
- description: "`[client]` on a trait whose linked entity is neither `[shared]` nor `[runtime]`. `[client]` is only legal on an entity multiple traits co-mutate client-side (`[shared]`) or one that is never persisted at all (`[runtime]`) \u2014 on an ordinary persistent entity it would silently hide server-gated writes behind client-only dispatch. Wave 2. Error severity."
2264
- },
2265
- {
2266
- code: "ORB_AUTH_GUARD_CLIENT_ONLY",
2267
- category: "dispatch",
2268
- description: "A transition guard reads `@user.*` while the trait's `OirTrait::dispatch_mode()` is `RuntimeOptimistic` or `HybridClientOnly` \u2014 evaluated client-side only. An identity check that never reaches the server is not an authorization boundary: the client can construct any `@user` value it likes. Wave 2. Warning severity (the guard may still be a legitimate UX precondition; it is never a security boundary)."
2269
- },
2270
- {
2271
- code: "ORB_P_MISSING_NAME",
2272
- category: "page",
2273
- description: "Page is missing a name"
2274
- },
2275
- {
2276
- code: "ORB_P_MISSING_PATH",
2277
- category: "page",
2278
- description: "Page is missing a path"
2279
- },
2280
- {
2281
- code: "ORB_P_INVALID_PATH",
2282
- category: "page",
2283
- description: "Page path is invalid (must start with /)"
2284
- },
2285
- {
2286
- code: "ORB_P_DUPLICATE_PATH",
2287
- category: "page",
2288
- description: "Duplicate page path"
2289
- },
2290
- {
2291
- code: "ORB_P_INDEX_REQUIRES_PUBLIC",
2292
- category: "page",
2293
- description: "`indexing: index` without `access: public`, a title, a description or an app `origin`"
2294
- },
2295
- {
2296
- code: "ORB_P_INDEX_PARAM_ROUTE",
2297
- category: "page",
2298
- description: "`indexing: index` on a `:param` route (concrete URL inputs are not declarable yet)"
2299
- },
2300
- {
2301
- code: "ORB_P_AUTH_NO_SIGN_IN",
2302
- category: "page",
2303
- description: "`access: authenticated` page in an app that declares no `signIn` route"
2304
- },
2305
- {
2306
- code: "ORB_P_SIGN_IN_UNKNOWN_ROUTE",
2307
- category: "page",
2308
- description: "The app's `signIn` route is no page, or is itself `access: authenticated`"
2309
- },
2310
- {
2311
- code: "ORB_P_HOST_RESERVED_ROUTE",
2312
- category: "page",
2313
- description: "A page is declared on the host's own sign-in route (`/login`)"
2314
- },
2315
- {
2316
- code: "ORB_P_UNKNOWN_PROTOCOL",
2317
- category: "page",
2318
- description: "A page names a protocol that is no row of the protocol table"
2319
- },
2320
- {
2321
- code: "ORB_P_ENDPOINT_GRANT_MISSING",
2322
- category: "page",
2323
- description: "An `http` endpoint has no covering `net` listen grant"
2324
- },
2325
- {
2326
- code: "ORB_P_ADDRESS_INVALID",
2327
- category: "page",
2328
- description: "A protocol page's address does not type-check against the protocol's address record"
2329
- },
2330
- {
2331
- code: "ORB_P_TRANSLATION_DUPLICATE_LOCALE",
2332
- category: "page",
2333
- description: "One locale holds two pages of the same `translationOf` group"
2334
- },
2335
- {
2336
- code: "ORB_P_MISSING_TRAITS",
2337
- category: "page",
2338
- description: "Page is missing traits array"
2339
- },
2340
- {
2341
- code: "ORB_P_EMPTY_TRAITS",
2342
- category: "page",
2343
- description: "Page traits array is empty"
2344
- },
2345
- {
2346
- code: "ORB_O_DUPLICATE_NAME",
2347
- category: "page",
2348
- description: "Two orbitals of one program share a name"
2349
- },
2350
- {
2351
- code: "ORB_O_CONFIG_UNKNOWN_KEY",
2352
- category: "page",
2353
- description: "An `orbital X = Alias.orbitals.Y { config { \u2026 } } }` call-site override names a key the upstream orbital's declared `config {}` does not have (`Almadar_Orbital_Import.md` \xA74.5)."
2354
- },
2355
- {
2356
- code: "ORB_O_OMIT_EMBEDDED_TRAIT",
2357
- category: "page",
2358
- description: "An `orbital X = Alias.orbitals.Y { omit { \u2026 } } }` call site drops a trait that a surviving trait still embeds via `@trait.<X>` \u2014 the embed token has nothing left to render."
2359
- },
2360
- {
2361
- code: "ORB_O_CONFIG_DEAD_KNOB",
2362
- category: "page",
2363
- description: 'A declared `Orbital.config` or `OrbitalSchema.config` knob (`Almadar_Orbital_Import.md` \xA74.5) that no trait in the schema forwards (`config[*].default == "@config.<knob>"`) \u2014 dead: nothing publishes it, so no call site can ever reach it.'
2364
- },
2365
- {
2366
- code: "ORB_O_ROLE_TARGET_NOT_MEMBER",
2367
- category: "page",
2368
- description: "An `orbital X = Alias.orbitals.Y { roles { \u2026 } } }` target is not a member of the CONSUMER roster's vocabulary (`identity_entities` on the importing schema, post-inline)."
2369
- },
2370
- {
2371
- code: "ORB_O_ROLE_UNKNOWN_UPSTREAM",
2372
- category: "page",
2373
- description: "An `orbital X = Alias.orbitals.Y { roles { \u2026 } } }` key names no value in any UPSTREAM identity field's vocabulary (or the upstream alias declares no roster at all)."
2374
- },
2375
- {
2376
- code: "ORB_O_ENTITY_UNMAPPED",
2377
- category: "page",
2378
- description: "A kept trait/relation/page references an out-of-orbital entity that `obj.entities {}` never maps \u2014 the import splice has nothing to rebind it to."
2379
- },
2380
- {
2381
- code: "ORB_O_ENTITY_UNKNOWN_KEY",
2382
- category: "page",
2383
- description: "An `obj.entities {}` key names no entity in the upstream closure's out-of-orbital universe."
2384
- },
2385
- {
2386
- code: "ORB_O_ENTITY_EXPECT_AMBIGUOUS",
2387
- category: "page",
2388
- description: "An entity an imported orbital expects of a sibling is provided by several sibling imports and no `entities {}` entry names which one it binds to."
2389
- },
2390
- {
2391
- code: "ORB_O_ENTITY_TARGET_UNKNOWN",
2392
- category: "page",
2393
- description: "An `obj.entities {}` value names no entity the consumer schema declares."
2394
- },
2395
- {
2396
- code: "ORB_O_PAGE_UNKNOWN_PATH",
2397
- category: "page",
2398
- description: "An `obj.pages {}` / `obj.mounts {}` key names no page path the imported orbital declares."
2399
- },
2400
- {
2401
- code: "ORB_O_EXTEND_FIELD_COLLISION",
2402
- category: "page",
2403
- description: "An `orbital X = Alias.orbitals.Y { extend { \u2026 } } }` field name is already declared on the upstream primary entity (after `fields {}` renames), or equals a `fields {}` rename TARGET (Stage C)."
2404
- },
2405
- {
2406
- code: "ORB_O_EXTEND_FIELD_UNREAD",
2407
- category: "page",
2408
- description: "An `extend { \u2026 }` field no kept trait reads/sets/renders and no orbital-level config knob value forwards (Stage C, warning \u2014 rung 2)."
2409
- },
2410
- {
2411
- code: "ORB_O_FIELD_RENAME_UNAPPLIED",
2412
- category: "page",
2413
- description: "A `fields { OLD: NEW }` rename on an `orbital X = Alias.orbitals.Y { \u2026 }` reference left a structurally-recognized field-reference position (a config default's bare/list field-name value) still naming the pre-rename upstream field \u2014 the rename silently failed to reach it (G3, `docs/Almadar_Compiler_Gaps.md` \xA782, rung 2: what used to validate 0/0 with a dead reference now errors instead)."
2414
- },
2415
- {
2416
- code: "ORB_O_MOCK_UNKNOWN_FIELD",
2417
- category: "page",
2418
- description: "A `mock { \u2026 }` key names no field of the imported primary entity."
2419
- },
2420
- {
2421
- code: "ORB_O_RETYPE_UNKNOWN_FIELD",
2422
- category: "page",
2423
- description: "A `retype { \u2026 }` field the upstream primary entity does not declare (after `fields {}` renames)."
2424
- },
2425
- {
2426
- code: "ORB_O_RETYPE_FIELD_CONFLICT",
2427
- category: "page",
2428
- description: "A `retype { \u2026 }` field also added by `extend {}`, or retyped twice."
2429
- },
2430
- {
2431
- code: "ORB_O_ENTITY_PERSISTENCE_LOCKED",
2432
- category: "page",
2433
- description: "An `entity [persistent: \u2026]` override on an upstream entity whose persistence mode does not allow overrides (the factory-runtime rule)."
2434
- },
2435
- {
2436
- code: "ORB_O_TRAITS_UNKNOWN_TRAIT",
2437
- category: "page",
2438
- description: "A `traits { T { \u2026 } }` key naming no trait of the upstream orbital."
2439
- },
2440
- {
2441
- code: "ORB_O_TRAITS_OMITTED_TRAIT",
2442
- category: "page",
2443
- description: "A `traits { T { \u2026 } }` key naming a trait `omit {}` / `only {}` dropped."
2444
- },
2445
- {
2446
- code: "ORB_P_SECTIONS_FORBIDDEN",
2447
- category: "page",
2448
- description: "Static sections are forbidden (use render_ui)"
2449
- },
2450
- {
2451
- code: "ORB_P_INVALID_TRAIT_REF",
2452
- category: "page",
2453
- description: "Invalid trait reference on page"
2454
- },
2455
- {
2456
- code: "ORB_P_INVALID_VIEW_TYPE",
2457
- category: "page",
2458
- description: "Invalid view type"
2459
- },
2460
- {
2461
- code: "ORB_PAGE_UNREACHABLE",
2462
- category: "page",
2463
- description: "A declared inline page is not the target of any `navigate` effect, any literal `href` value, and is not the root page or a parameterized page \u2014 nothing in the schema can ever route a viewer to it. Ported from the JS wiring lint's `page-absent-from-nav`, generalised: no navItems-array opt-in gate, and scalar `href` values count (not only object-array entries)."
2464
- },
2465
- {
2466
- code: "ORB_PAGE_SECOND_CONTENT_BODY",
2467
- category: "page",
2468
- description: "A page's content owner (`page_content_owner`'s `channel`/`ambiguous`) leaves a SECOND page-declared, inline, content-main-writing trait unclaimed: not an owner itself, not embedded by any client-bound trait, and not kin to the owner through either the config-channel or embed-containment relation (`reduce_to_owners({owner, this}).len() == 1` would mean related, not a rival). Two content bodies stacking into one page's `main`. Ported from the JS wiring lint's `unclaimed-main-writer` (warning there; error here per the owner's Q3 ruling)."
2469
- },
2470
- {
2471
- code: "ORB_PAGE_CONTROL_OUTSIDE_SHELL",
2472
- category: "page",
2473
- description: "A page whose `main` a shell owns through a config channel (`contentTrait` \u2026) also mounts a trait that paints a control into `main` which neither the owner nor anything it embeds references: the control stacks outside the shell's layout instead of inside it."
2474
- },
2475
- {
2476
- code: "ORB_COMPOSED_STATE_UNREACHABLE",
2477
- category: "circuit",
2478
- description: "A composed trait (`sourceBehavior` set) has a state no event the program can produce leads to: every transition into it waits on an event nothing routes in, no control or effect fires, and the host is not declared to send (`external`). An atom's own inputs are its offer; a composition that never wires one leaves that part of it dead."
2479
- },
2480
- {
2481
- code: "ORB_COMPOSED_TRANSITION_UNREACHABLE",
2482
- category: "circuit",
2483
- description: "A composed trait (`sourceBehavior` set) has a live transition, from a reachable state, on an event the program cannot produce under its resolved config: no listens route, control or effect fires it, it is not a lifecycle event and not declared `external` (G-CROSS-144)."
2484
- },
2485
- {
2486
- code: "ORB_CONTROL_VALUE_DISCARDED",
2487
- category: "circuit",
2488
- description: "A composed trait's rendered control fires an event carrying a value that no other trait hears and whose own handling reads none of it: the value the user entered is discarded (a form submission nothing keeps)."
2489
- },
2490
- {
2491
- code: "ORB_PAGE_AMBIGUOUS_CONTENT_OWNER",
2492
- category: "page",
2493
- description: "A page whose content owner is ambiguous: two or more page-declared `main` writers, none composing the others, no shell channel naming one. Renders stacked alone, but any shell that designates one `contentTrait` turns the rest into second bodies (G-ORB-128)."
2494
- },
2495
- {
2496
- code: "ORB_SLOT_MAIN_NOT_COVERED",
2497
- category: "slot",
2498
- description: "Main slot not covered by any trait"
2499
- },
2500
- {
2501
- code: "ORB_SLOT_CONTENTION",
2502
- category: "slot",
2503
- description: "Multiple traits rendering to same slot (INIT state)"
2504
- },
2505
- {
2506
- code: "ORB_SLOT_CONTENTION_RUNTIME",
2507
- category: "slot",
2508
- description: "Multiple traits rendering to same slot in a reachable post-INIT state (emitted as a warning; INIT-state case still errors via `SlotContention`)"
2509
- },
2510
- {
2511
- code: "ORB_SLOT_CONTENTION_TICK",
2512
- category: "slot",
2513
- description: "Two or more traits mounted on one page repaint the same slot from inside a `ticks` block, with no guard proving either one dead. Tick bodies run every frame, so they paint together rather than alternating."
2514
- },
2515
- {
2516
- code: "ORB_SLOT_INVALID_NESTING",
2517
- category: "slot",
2518
- description: "Invalid slot nesting (e.g., modal in modal)"
2519
- },
2520
- {
2521
- code: "ORB_RUI_INVALID_SLOT",
2522
- category: "render_ui",
2523
- description: "Invalid slot in render_ui effect"
2524
- },
2525
- {
2526
- code: "ORB_RUI_INVALID_PATTERN",
2527
- category: "render_ui",
2528
- description: "Invalid pattern type"
2529
- },
2530
- {
2531
- code: "ORB_RUI_MISSING_PATTERN_TYPE",
2532
- category: "render_ui",
2533
- description: "Pattern missing type property"
2534
- },
2535
- {
2536
- code: "ORB_RUI_INVALID_PROP",
2537
- category: "render_ui",
2538
- description: "Invalid prop for pattern"
2539
- },
2540
- {
2541
- code: "ORB_RUI_CHILD_NOT_DRAWABLE",
2542
- category: "render_ui",
2543
- description: "A non-drawable child composed under a canvas draw-host. A draw-host paints only neutral drawable descriptors (draw-sprite / draw-shape / draw-text / draw-*-layer); DOM chrome belongs in a `hud`/`overlay` slot."
2544
- },
2545
- {
2546
- code: "ORB_RUI_MISSING_REQUIRED_PROP",
2547
- category: "render_ui",
2548
- description: "Missing required prop for pattern"
2549
- },
2550
- {
2551
- code: "ORB_RUI_INVALID_ITEM_ACTION",
2552
- category: "render_ui",
2553
- description: "Invalid itemAction configuration"
2554
- },
2555
- {
2556
- code: "ORB_RUI_UNKNOWN_ITEM_ACTION_PROP",
2557
- category: "render_ui",
2558
- description: "Unknown itemAction prop (e.g., hallucinated 'condition')"
2559
- },
2560
- {
2561
- code: "ORB_RUI_MISSING_ACTION",
2562
- category: "render_ui",
2563
- description: "Button/link missing action prop"
2564
- },
2565
- {
2566
- code: "ORB_A11Y_UNNAMED",
2567
- category: "render_ui",
2568
- description: "A pattern that declares `@accessibleName` props has none of them, no `aria-label`/`aria-labelledby`, and is not `aria-hidden`"
2569
- },
2570
- {
2571
- code: "ORB_RUI_INVALID_FIELD_PATH",
2572
- category: "render_ui",
2573
- description: "Nested field path references invalid relation or field"
2574
- },
2575
- {
2576
- code: "ORB_RUI_FORM_FIELD_INTRINSIC",
2577
- category: "render_ui",
2578
- description: "A `form`-contract pattern offers an input for an `@intrinsic` entity field \u2014 intrinsic fields are never persisted, so the input is discarded."
2579
- },
2580
- {
2581
- code: "ORB_RUI_PROP_TYPE_MISMATCH",
2582
- category: "render_ui",
2583
- description: "Prop value type doesn't match expected type from registry"
2584
- },
2585
- {
2586
- code: "ORB_RUI_BINDING_TYPE_MISMATCH",
2587
- category: "render_ui",
2588
- description: "L2.1 keystone: render-ui prop bound to a `@payload.X` / `@entity.X` / `@config.X` / SExpression operator whose resolved type doesn't match any of the prop's declared `types` in the patterns registry. Distinct from `RenderUIPropTypeMismatch` (literal-only); this rule uses the F3 binding resolver to walk through bindings and SExpression operator return types (sharpened by F2's `returnSemantics` for input-dependent operators). Gap #6 in `docs/Almadar_Std_Verification.md`."
2589
- },
2590
- {
2591
- code: "ORB_RUI_ELEMENT_SHAPE_MISMATCH",
2592
- category: "render_ui",
2593
- description: "L2.4: render-ui binds an array literal to a prop whose pattern declares per-element required fields (`items.properties.<field>.required`), and one or more elements omit a required field. Catches the landing-page/about-page/showcase class of bugs where the lolo `[StepCard]` type omits `id` but the consuming `step-flow-organism` pattern requires it \u2014 surfaced at codegen as TS2322 before this rule. Walks `OirValue::Array` element-by-element against `items.properties` from `patterns-registry.json`. Discovery context: `docs/Almadar_Std_Gaps.md` \xA713."
2594
- },
2595
- {
2596
- code: "ORB_T_ENTITY_NAME_SHADOWS_TRAIT_UNION",
2597
- category: "entity",
2598
- description: "Entity name collides with a sibling trait's generated `<TraitName>State` or `<TraitName>Event` union type. The TS codegen emits both `import type { <EntityName> } from '@app/shared'` and `type <TraitName>State = '...'` / `type <TraitName>Event = '...'` in every server-handler / client-hook / view file \u2014 when the entity name equals one of those generated unions, the import collides with the local declaration and tsc raises TS2440 \"Import declaration conflicts with local declaration\". Defense-in-depth pair with the lolo lowering check `LowerError::EntityNameShadowsTraitUnion`: the lolo rule catches hand-authored `.lolo`, this validator rule catches `.orb` mutated directly by an agent or factory that bypassed the lolo parse path. Convention fix: rename the entity (e.g. `<TraitName>Data`)."
2599
- },
2600
- {
2601
- code: "ORB_RUI_EVENT_BINDING_PAYLOAD_MISMATCH",
2602
- category: "render_ui",
2603
- description: "L2.2: render-ui prop with `kind: \"event-ref\"` or `kind: \"callback\"` bound to an event-name string whose declared payload schema in the trait's `emits {}` block doesn't match the component's documented bus emit shape (registry's `emitPayloadSchema` for event-ref props; `callbackArgs` for callback props). Gap #32 in `docs/Almadar_Std_Verification.md`."
2604
- },
2605
- {
2606
- code: "ORB_X_RENDER_UI_EVENT_LITERAL_STALE",
2607
- category: "render_ui",
2608
- description: "L2.3: render-ui pattern carries a string literal that matches an event name no longer in the trait's event set after the inline phase applies an `events: { OLD: NEW }` override. Detects the stale literal that the compiler's events-rewrite pass should have rewritten \u2014 defense-in-depth for C1 (the compiler fix). Gap #30 in `docs/Almadar_Std_Verification.md`."
2609
- },
2610
- {
2611
- code: "ORB_EFF_CALL_SERVICE_MISSING_SERVICE",
2612
- category: "effect",
2613
- description: "call_service missing service name"
2614
- },
2615
- {
2616
- code: "ORB_EFF_CALL_SERVICE_UNKNOWN_SERVICE",
2617
- category: "effect",
2618
- description: "call_service names a service in neither schema.services nor the services registry. Error severity."
2619
- },
2620
- {
2621
- code: "ORB_EFF_CALL_SERVICE_MISSING_ACTION",
2622
- category: "effect",
2623
- description: "call_service missing action"
2624
- },
2625
- {
2626
- code: "ORB_EFF_CALL_SERVICE_MISSING_HANDLERS",
2627
- category: "effect",
2628
- description: "call_service missing onSuccess/onError handlers"
2629
- },
2630
- {
2631
- code: "ORB_EFF_CALL_SERVICE_UNKNOWN_PARAM",
2632
- category: "effect",
2633
- description: "call_service params carry a key the action's registry contract does not declare (I-13 \u2014 the `recipient` vs `to` class)"
2634
- },
2635
- {
2636
- code: "ORB_EFF_CALL_SERVICE_MISSING_PARAM",
2637
- category: "effect",
2638
- description: "call_service params omit a key the action's registry contract requires"
2639
- },
2640
- {
2641
- code: "ORB_EFF_CALL_SERVICE_PARAM_TYPE",
2642
- category: "effect",
2643
- description: "call_service literal param value contradicts the contract's param type"
2644
- },
2645
- {
2646
- code: "ORB_CALL_SERVICE_CANCELLED_WITHOUT_KEY",
2647
- category: "effect",
2648
- description: "call-service declares `emit.cancelled` but no `key` \u2014 nothing can cancel an unkeyed call"
2649
- },
2650
- {
2651
- code: "ORB_CALL_SERVICE_KEY_TYPE",
2652
- category: "effect",
2653
- description: "call-service `key` is a non-string literal (number/bool/object/array)"
2654
- },
2655
- {
2656
- code: "ORB_CANCEL_CALL_NO_KEYED_CALL",
2657
- category: "effect",
2658
- description: "the app runs `cancel-call` but no `call-service` anywhere carries a `key`"
2659
- },
2660
- {
2661
- code: "ORB_CALL_KEY_UNUSED",
2662
- category: "effect",
2663
- description: 'a literal `(as "k" CallKey)` in a program whose keyed calls are all keyed by literals, none of them `"k"`'
2664
- },
2665
- {
2666
- code: "ORB_EFFECT_OPTION_DROPPED",
2667
- category: "effect",
2668
- description: "an emit-options `key` on an effect that carries no key, so its completion could never echo it"
2669
- },
2670
- {
2671
- code: "ORB_CANCEL_CALL_KEY_NEVER_CALLED",
2672
- category: "effect",
2673
- description: "`--final`: a `cancel-call` on a `CallKey` (or a list of them) in a finished program where no keyed call has a `CallKey`-typed `key:`, so nothing the program runs is named by a key made with `as`"
2674
- },
2675
- {
2676
- code: "ORB_CALL_SERVICE_KEY_DUPLICATE",
2677
- category: "effect",
2678
- description: "two `call-service` effects of one transition carry the same literal `key`"
2679
- },
2680
- {
2681
- code: "ORB_CALL_SERVICE_RESULT_HAS_KEY",
2682
- category: "effect",
2683
- description: "a keyed call-service whose registry responseShape already has a `key` field"
2684
- },
2685
- {
2686
- code: "ORB_HTTP_EGRESS_UNDECLARED",
2687
- category: "effect",
2688
- description: "an `http` origin, `tokenUrl` origin, or `url` knob default is not in `egress`"
2689
- },
2690
- {
2691
- code: "ORB_HTTP_EGRESS_ENTRY_INVALID",
2692
- category: "effect",
2693
- description: "an `egress` entry is not `scheme://host[:port]`"
2694
- },
2695
- {
2696
- code: "ORB_INBOUND_UNDECLARED",
2697
- category: "effect",
2698
- description: 'an inbound handler (`listens { EVENT -> inbound "name" \u2026 }`) is reachable in a program whose app does not declare `name` in `inbound`'
2699
- },
2700
- {
2701
- code: "ORB_INBOUND_ENTRY_INVALID",
2702
- category: "effect",
2703
- description: "an `inbound` entry is not one lower-case hook name (letters, digits, `-`), or is listed twice"
2704
- },
2705
- {
2706
- code: "ORB_INBOUND_DUPLICATE",
2707
- category: "effect",
2708
- description: "two traits handle the same inbound hook name"
2709
- },
2710
- {
2711
- code: "ORB_INBOUND_ANSWER_UNDECLARED",
2712
- category: "effect",
2713
- description: "an inbound handler answers with an event its trait does not declare in `emits`"
2714
- },
2715
- {
2716
- code: "ORB_INBOUND_ANSWER_FOREIGN",
2717
- category: "effect",
2718
- description: "a trait other than an inbound handler emits the handler's answer event and the handler does not relay it: only the handler's own emit answers"
2719
- },
2720
- {
2721
- code: "ORB_INBOUND_VERIFY_INVALID",
2722
- category: "effect",
2723
- description: "an inbound `verifies` header is not a lower-case header name, or its credential is not a credential name"
2724
- },
2725
- {
2726
- code: "ORB_OS_GRANT_MISSING",
2727
- category: "effect",
2728
- description: "an `os/` call needs something the calling orbital's grants do not cover"
2729
- },
2730
- {
2731
- code: "ORB_OS_TARGET_NOT_STATIC",
2732
- category: "effect",
2733
- description: "an `os/` call's target (path, command, host, port, variable, flags) is not a literal"
2734
- },
2735
- {
2736
- code: "ORB_OS_GRANT_UNUSED",
2737
- category: "effect",
2738
- description: "a declared `os/` grant entry that no `os/` call of the orbitals holding it uses (warning)"
2739
- },
2740
- {
2741
- code: "ORB_OS_GRANT_ENTRY_INVALID",
2742
- category: "effect",
2743
- description: "a declared `os/` grant entry whose shape cannot match anything"
2744
- },
2745
- {
2746
- code: "ORB_PLACEMENT_ORBITAL_UNKNOWN",
2747
- category: "effect",
2748
- description: "a `deployment` unit lists an orbital the program does not declare"
2749
- },
2750
- {
2751
- code: "ORB_PLACEMENT_ORBITAL_DUPLICATE",
2752
- category: "effect",
2753
- description: "an orbital is listed in more than one `deployment` unit, or twice in one"
2754
- },
2755
- {
2756
- code: "ORB_PLACEMENT_ORBITAL_UNPLACED",
2757
- category: "effect",
2758
- description: "a `deployment` is declared and an orbital is in none of its units"
2759
- },
2760
- {
2761
- code: "ORB_PLACEMENT_UNIT_EMPTY",
2762
- category: "effect",
2763
- description: "a `deployment` unit lists no orbital"
2764
- },
2765
- {
2766
- code: "ORB_HTTP_ORIGIN_NOT_STATIC",
2767
- category: "effect",
2768
- description: "an `http` origin is neither a string literal nor a `url`-typed `@config` knob"
2769
- },
2770
- {
2771
- code: "ORB_HTTP_METHOD_UNKNOWN",
2772
- category: "effect",
2773
- description: "an `http` method is not one of GET POST PUT PATCH DELETE"
2774
- },
2775
- {
2776
- code: "ORB_HTTP_PATH_INVALID",
2777
- category: "effect",
2778
- description: "an `http` path violates the kernel's absolute-path contract"
2779
- },
2780
- {
2781
- code: "ORB_HTTP_OPTION_UNKNOWN",
2782
- category: "effect",
2783
- description: "an `http` request/auth/paginate object carries a key outside its closed set"
2784
- },
2785
- {
2786
- code: "ORB_HTTP_AUTH_SCHEME_UNKNOWN",
2787
- category: "effect",
2788
- description: "`http` `auth.scheme` is not in the closed scheme set"
2789
- },
2790
- {
2791
- code: "ORB_HTTP_AUTH_INVALID",
2792
- category: "effect",
2793
- description: "An HTTP auth, grant-cache, presign, or webpush configuration violates its contract."
2794
- },
2795
- {
2796
- code: "ORB_HTTP_TOKEN_ROTATE_INVALID",
2797
- category: "effect",
2798
- description: "A token-exchange `rotate` is not a `{ field, credential }` rotation of the body's `refresh_token` slot."
2799
- },
2800
- {
2801
- code: "ORB_HTTP_HEADER_INVALID",
2802
- category: "effect",
2803
- description: "An HTTP request/auth header name is not a token, or its value is not a single-line string."
2804
- },
2805
- {
2806
- code: "ORB_HTTP_REQUEST_OPTION_INVALID",
2807
- category: "effect",
2808
- description: "An HTTP request's `timeoutMs`, `delayMs` or `retry` is not a value of its declared kind."
2809
- },
2810
- {
2811
- code: "ORB_HTTP_AUTH_ON_CLIENT",
2812
- category: "effect",
2813
- description: "an `http` with `auth` sits where its trait runs on the client (a `[client]` trait, a browser-run tick)"
2814
- },
2815
- {
2816
- code: "ORB_HTTP_BODY_CONFLICT",
2817
- category: "effect",
2818
- description: "an `http` request has more than one body kind, or a body on GET"
2819
- },
2820
- {
2821
- code: "ORB_HOST_EFFECT_ARITY",
2822
- category: "effect",
2823
- description: "`random-bytes`, `credential-status` or `credential-forget` with the wrong number of arguments"
2824
- },
2825
- {
2826
- code: "ORB_HOST_EFFECT_OPTION_UNKNOWN",
2827
- category: "effect",
2828
- description: "a key other than `emit`, or a non-object, as the options of a host effect"
2829
- },
2830
- {
2831
- code: "ORB_RANDOM_BYTES_COUNT",
2832
- category: "effect",
2833
- description: "a literal `random-bytes` count that is not an integer from 1 to 1024"
2834
- },
2835
- {
2836
- code: "ORB_CREDENTIAL_REQUEST_INVALID",
2837
- category: "effect",
2838
- description: "a literal request of a `credential-*` administration effect that is not an object of its declared parameters, or leaves one out"
2839
- },
2840
- {
2841
- code: "ORB_REDIS_CALL_INVALID",
2842
- category: "effect",
2843
- description: "a `redis` call whose origin is not `redis://` or `rediss://`, whose command is not a non-empty list of text, or whose connection options are malformed"
2844
- },
2845
- {
2846
- code: "ORB_POSTGRES_CALL_INVALID",
2847
- category: "effect",
2848
- description: "a `postgres` call whose origin is not `postgres://` or `postgresql://`, whose literal statement is not a single read-only SELECT, whose params are not a list, or whose connection options are malformed or lack a user"
2849
- },
2850
- {
2851
- code: "ORB_OAUTH_CLIENT_INVALID",
2852
- category: "effect",
2853
- description: "an OAuth client object with an unknown or missing key, both or neither of `issuer`/`endpoints`, or a bad word"
2854
- },
2855
- {
2856
- code: "ORB_OAUTH_OP_UNKNOWN",
2857
- category: "effect",
2858
- description: "an `oauth-client` `op` outside the closed set, or an input the op does not take or requires"
2859
- },
2860
- {
2861
- code: "ORB_OAUTH_ENDPOINT_MISMATCH",
2862
- category: "effect",
2863
- description: "`oauth-endpoint` without an `oauth-client` auth, or a target word or method that does not serve the op"
2864
- },
2865
- {
2866
- code: "ORB_OAUTH_REQUEST_CONFLICT",
2867
- category: "effect",
2868
- description: "an `oauth-client` request that carries anything but `auth`"
2869
- },
2870
- {
2871
- code: "ORB_OAUTH_PROVIDER_UNKNOWN",
2872
- category: "effect",
2873
- description: "a provider word outside `google | github | auth0`"
2874
- },
2875
- {
2876
- code: "ORB_OAUTH_OPTION_UNKNOWN",
2877
- category: "effect",
2878
- description: "an unknown key, or a missing `redirectUri`, in `oauth-authorize` options"
2879
- },
2880
- {
2881
- code: "ORB_HTTP_PAGINATE_MAX_MISSING",
2882
- category: "effect",
2883
- description: "`http` `paginate` without `max`"
2884
- },
2885
- {
2886
- code: "ORB_HTTP_STREAM_WITHOUT_ON_MESSAGE",
2887
- category: "effect",
2888
- description: "`http` `stream` without `emit.onMessage`"
2889
- },
2890
- {
2891
- code: "ORB_PAGE_FACTS_FIELD_INVALID",
2892
- category: "effect",
2893
- description: "`browser/page-facts` fields: an unknown word, an empty list or a duplicate"
2894
- },
2895
- {
2896
- code: "ORB_PAGE_FACTS_UNREQUESTED_READ",
2897
- category: "effect",
2898
- description: "an event reads a page fact the `browser/page-facts` call did not request"
2899
- },
2900
- {
2901
- code: "ORB_BEACON_OPTION_UNKNOWN",
2902
- category: "effect",
2903
- description: "a `browser/beacon` request or option key outside its closed set"
2904
- },
2905
- {
2906
- code: "ORB_BEACON_TEXT_REQUIRED",
2907
- category: "effect",
2908
- description: "a `browser/beacon` request without `text`"
2909
- },
2910
- {
2911
- code: "ORB_BEACON_URL_NOT_ABSOLUTE",
2912
- category: "effect",
2913
- description: "a literal `browser/beacon` URL that is not an absolute http(s) URL"
2914
- },
2915
- {
2916
- code: "ORB_ON_DEVICE_EFFECT_ON_SERVER",
2917
- category: "effect",
2918
- description: "a `browser/prompt` or `browser/embed` where the server runs the transition: a `[background]` tick"
2919
- },
2920
- {
2921
- code: "ORB_ON_DEVICE_SCHEMA_INVALID",
2922
- category: "effect",
2923
- description: "a literal `browser/prompt` response schema that is not a JSON object"
2924
- },
2925
- {
2926
- code: "ORB_TAB_REQUEST_INVALID",
2927
- category: "effect",
2928
- description: "a `browser/tab-*` request that is not an object of the op's closed keys, or whose literal values the kernel refuses"
2929
- },
2930
- {
2931
- code: "ORB_TAB_EFFECT_ON_SERVER",
2932
- category: "effect",
2933
- description: "a `browser/tab-*` effect where the server runs the transition: a `[background]` tick"
2934
- },
2935
- {
2936
- code: "ORB_EFF_SET_INVALID_BINDING",
2937
- category: "effect",
2938
- description: "set effect using invalid binding"
2939
- },
2940
- {
2941
- code: "ORB_EFF_SET_PAYLOAD_NOT_ALLOWED",
2942
- category: "effect",
2943
- description: "set effect using @payload (should use @entity)"
2944
- },
2945
- {
2946
- code: "ORB_EFF_FETCH_INVALID_ENTITY",
2947
- category: "effect",
2948
- description: "fetch effect referencing invalid entity"
2949
- },
2950
- {
2951
- code: "ORB_EFF_FETCH_INVALID_INCLUDE",
2952
- category: "effect",
2953
- description: "fetch effect include references non-existent or non-relation field"
2954
- },
2955
- {
2956
- code: "ORB_PERSIST_BATCH_OPS_NOT_ARRAY",
2957
- category: "effect",
2958
- description: "`persist batch` ops expression is not array-typed"
2959
- },
2960
- {
2961
- code: "ORB_PERSIST_BATCH_BAD_OP",
2962
- category: "effect",
2963
- description: "`persist batch` op tuple with an unknown action or the wrong arity"
2964
- },
2965
- {
2966
- code: "ORB_PERSIST_BATCH_MIXED_PLACEMENT",
2967
- category: "effect",
2968
- description: "`persist batch` ops name both browser-stored and server-stored entities"
2969
- },
2970
- {
2971
- code: "ORB_EFF_SLOT_CONFLICT",
2972
- category: "effect",
2973
- description: "Multiple render_ui effects targeting same slot"
2974
- },
2975
- {
2976
- code: "ORB_EFF_UNKNOWN_TYPE",
2977
- category: "effect",
2978
- description: "Unknown effect type"
2979
- },
2980
- {
2981
- code: "ORB_EFF_NOTIFY_RETIRED",
2982
- category: "effect",
2983
- description: "`notify` is sugar for `render-ui toast { type: alert, \u2026 }`, desugared at `.lolo` lowering (owner ruling 2026-09-11) \u2014 the `.orb` IR never carries a `notify` effect kind. A `notify` tuple reaching L2 means a hand-authored `.orb` or a registry not yet re-emitted."
2984
- },
2985
- {
2986
- code: "ORB_EFF_NAVIGATE_MISSING_PAYLOAD",
2987
- category: "effect",
2988
- description: "Navigate effect missing required payload for target page"
2989
- },
2990
- {
2991
- code: "ORB_EFF_NAVIGATE_TARGET_UNREACHABLE",
2992
- category: "effect",
2993
- description: "Navigate effect references a path that doesn't resolve to any declared `pages[].path` across the resolved schema. Post-inline backstop for L1.2 \u2014 catches navigate calls injected by molecule- level `effects: { ... }` overrides AND navigate calls that targeted imported pages from `uses` refs that L1 couldn't see."
2994
- },
2995
- {
2996
- code: "ORB_EMIT_DECLARED_BUT_UNFIRED",
2997
- category: "effect",
2998
- description: "Trait declares an event in its `emits[]` block but no transition fires it via `(emit X)` or operator emit-config success/failure. Usually a copy-paste leftover or a stale declaration after a rename; gap #2 defense in `docs/Almadar_Std_Verification.md`."
2999
- },
3000
- {
3001
- code: "ORB_EMIT_CONTROL_UNHANDLED",
3002
- category: "effect",
3003
- description: "`orb validate --final`: a rendered control fires an event no trait handles \u2014 not the rendering trait, an embedder of it, nor a `listens` route (G-ORB-187)."
3004
- },
3005
- {
3006
- code: "ORB_EMIT_CONFIG_REF_INVALID",
3007
- category: "effect",
3008
- description: "`emits { @config.<knob> -> ... }` references a knob that isn't a DECLARED string-typed config field with a default (Option B contract). Left unresolved by the inline phase; surfaces here with the specific clause that failed."
3009
- },
3010
- {
3011
- code: "ORB_EFF_MISSING_FETCH_FOR_ENTITY",
3012
- category: "effect",
3013
- description: "render-ui has entity prop but no fetch effect for that entity in the same transition"
3014
- },
3015
- {
3016
- code: "ORB_EFF_EMIT_KEY_INVALID",
3017
- category: "effect",
3018
- description: "`emit:` config carries a key the operator doesn't support (e.g. `on_message` on `fetch`, `failure` on `set`)."
3019
- },
3020
- {
3021
- code: "ORB_EFF_EMIT_INVALID_NAME",
3022
- category: "effect",
3023
- description: "Event name inside `emit:` isn't UPPER_SNAKE_CASE."
3024
- },
3025
- {
3026
- code: "ORB_EFF_EMIT_UNDECLARED_EVENT",
3027
- category: "effect",
3028
- description: "Event in `emit:` isn't declared in the trait's `emits` array."
3029
- },
3030
- {
3031
- code: "ORB_EFF_PROGRAM_EVAL_FAILURE_MISSING",
3032
- category: "effect",
3033
- description: "`program/eval` carries no `emit.failure` event: the validator's errors come back through the failure arm, so without one they are dropped."
3034
- },
3035
- {
3036
- code: "ORB_EFF_MISSING_REQUIRED_EMIT",
3037
- category: "effect",
3038
- description: "Operator declares `requiresEmitSuccess: true` in canonical-operators.json but the effect call site is missing the trailing options object or its `emit.success` event key. Applies to fetch / persist / call-service / ref by default; any future operator can opt in via the same JSON flag."
3039
- },
3040
- {
3041
- code: "ORB_EFF_FETCH_BY_ID_PAYLOAD_LIST",
3042
- category: "effect",
3043
- description: "A success event only `(fetch X { id: \u2026 })` produces declares `data` as a list; a by-id fetch delivers one row (G-ORB-185)."
3044
- },
3045
- {
3046
- code: "ORB_EFF_FETCH_INVALID_OPTION",
3047
- category: "effect",
3048
- description: "A `fetch` option outside its closed enum (`deliver: rows | ids`, `total: exact | none`)."
3049
- },
3050
- {
3051
- code: "ORB_FETCH_DELIVER_IDS_ROWS_READ",
3052
- category: "effect",
3053
- description: "`deliver: ids` makes the success event's `data` a row-set reference; any use other than passing it whole as a `render-ui` prop value reads rows that were never delivered."
3054
- },
3055
- {
3056
- code: "ORB_FETCH_DELIVER_IDS_ENTITY_REFS",
3057
- category: "effect",
3058
- description: "`deliver: ids` with `include`: included relations are row content."
3059
- },
3060
- {
3061
- code: "ORB_FETCH_DELIVER_IDS_NO_SUCCESS",
3062
- category: "effect",
3063
- description: "`deliver: ids` with no `emit.success`: the reference is only ever passed whole to a `render-ui` prop, and nothing can reference a result that no event carries."
3064
- },
3065
- {
3066
- code: "ORB_FETCH_TOTAL_NONE_READ",
3067
- category: "effect",
3068
- description: "`total: none` skips the count, so the success event's `totalCount` is never set."
3069
- },
3070
- {
3071
- code: "SEXPR_INVALID_OPERATOR",
3072
- category: "sexpr",
3073
- description: "Unknown operator in S-expression"
3074
- },
3075
- {
3076
- code: "SEXPR_ARITY_MISMATCH",
3077
- category: "sexpr",
3078
- description: "Wrong number of arguments for operator"
3079
- },
3080
- {
3081
- code: "SEXPR_LAMBDA_ARG_POSITION",
3082
- category: "sexpr",
3083
- description: "A `(fn \u2026)` form in an argument position the operator does not take its lambda in \u2014 decidable wrong argument order, e.g. `(array/reduce arr (fn \u2026) init)`"
3084
- },
3085
- {
3086
- code: "SEXPR_EFFECT_IN_GUARD",
3087
- category: "sexpr",
3088
- description: "Effect operator used in guard context"
3089
- },
3090
- {
3091
- code: "SEXPR_INVALID_BINDING",
3092
- category: "sexpr",
3093
- description: "Invalid binding reference"
3094
- },
3095
- {
3096
- code: "SEXPR_INVALID_BINDING_PATH",
3097
- category: "sexpr",
3098
- description: "Invalid binding path syntax"
3099
- },
3100
- {
3101
- code: "SEXPR_UNKNOWN_ENTITY",
3102
- category: "sexpr",
3103
- description: "Unknown entity in binding"
3104
- },
3105
- {
3106
- code: "SEXPR_PARSE_ERROR",
3107
- category: "sexpr",
3108
- description: "Parse error in S-expression"
3109
- },
3110
- {
3111
- code: "ORB_X_DUPLICATE_ENTITY",
3112
- category: "cross",
3113
- description: "Duplicate entity name across orbitals"
3114
- },
3115
- {
3116
- code: "ORB_X_MIXED_RESIDENCE",
3117
- category: "cross",
3118
- description: "One transition's data effects touch both browser-stored and server-stored entities (ORB_X_MIXED_RESIDENCE)"
3119
- },
3120
- {
3121
- code: "ORB_X_ORPHAN_LISTENER",
3122
- category: "cross",
3123
- description: "Event listener without matching emitter"
3124
- },
3125
- {
3126
- code: "ORB_X_UNUSED_EMISSION",
3127
- category: "cross",
3128
- description: "Event emitted but never listened to"
3129
- },
3130
- {
3131
- code: "ORB_EMIT_UNROUTED_TO_HANDLER",
3132
- category: "cross",
3133
- description: "A trait emits an event (an `(emit \u2026)` effect or an operator emit-config result) that a SIBLING trait in the same orbital has an arm for, but no declared `listens` route delivers it from that emitter. Events reach another trait only through declared routes, so the intent terminates in nothing (std-pong's PADDLE_MOVE, 2026-09-24)."
3134
- },
3135
- {
3136
- code: "ORB_T_CLIENT_TICK_NOT_LOCAL",
3137
- category: "cross",
3138
- description: "A trait writing a client-held `[runtime]` frame from client ticks (or bound to a `[shared]` one another trait ticks) is not `[client]`: its dispatches post to a stateful host whose stale copy folds back."
3139
- },
3140
- {
3141
- code: "ORB_X_CIRCULAR_DEPENDENCY",
3142
- category: "cross",
3143
- description: "Circular dependency in event wiring"
3144
- },
3145
- {
3146
- code: "ORB_X_MISSING_ORBITAL_NAME",
3147
- category: "cross",
3148
- description: "Orbital missing name"
3149
- },
3150
- {
3151
- code: "ORB_X_PAYLOAD_MISMATCH",
3152
- category: "cross",
3153
- description: "Payload mismatch between emitter and listener"
3154
- },
3155
- {
3156
- code: "ORB_X_LISTEN_SOURCE_UNRESOLVED",
3157
- category: "cross",
3158
- description: "`listens` references a source trait or event that doesn't exist in the resolved IR. Defense-in-depth backstop for the L1 (`orbital-lolo`) `LowerError::ListenSourceUnresolved` check; surfaces the same defect after `use`-imports inline so atoms/molecules pulled into an orbital can't accidentally introduce dangling listens."
3159
- },
3160
- {
3161
- code: "ORB_X_LISTEN_SOURCE_NEVER_PRODUCES",
3162
- category: "cross",
3163
- description: "A `listens { S.E -> TRIGGER }` route whose source trait S DOES declare event E in its `emits[]` contract, but nothing in the schema currently produces E live \u2014 no effect emit, no rendered `action:`/ event prop, no structured `itemActions` entry, and no trait embedded (directly or transitively) inside S produces it either. The contract permits it; a config override (an itemActions/browseItemActions narrowed at this call site, say) removed the only producer, so the route is a live wire with nothing behind it \u2014 fires whatever the emit's declared `scope` is (`external` included: a cross-orbital broadcast still needs a live broadcaster). Ported from the JS wiring lint's `listener-affordance-removed-by-config`."
3164
- },
3165
- {
3166
- code: "ORB_X_LISTEN_TRIGGER_UNMATCHED",
3167
- category: "cross",
3168
- description: "A `listens { Src.EVENT -> TRIGGER }` entry names an internal TRIGGER that no transition in the SAME trait reacts to. The bus would deliver the event but the state machine has no handler \u2014 the wire silently drops. Runs post-inline so the `events: { OLD: NEW }`-rename variant (where the rewrite renamed the transition event but the listen trigger drifted) is caught too. Defense-in-depth for the L1 (`orbital-lolo`) author-time check on hand-authored `.lolo`."
3169
- },
3170
- {
3171
- code: "ORB_X_INTERNAL_EVENT_EXPOSED",
3172
- category: "cross",
3173
- description: "Composing trait's override map touches an event declared `scope: 'internal'`. Error severity. See COMP-7 in docs/Almadar_Agent_Behaviors_Plan.md."
3174
- },
3175
- {
3176
- code: "ORB_X_FILTER_FIELD_NEVER_WRITTEN",
3177
- category: "cross",
3178
- description: "A `fetch`'s `filter` compares a LITERAL `(object/get @entity <field>)` against a value, but no `persist create`/`update` anywhere in the schema (own trait, sibling trait, or a `persistent:`-collection-mate entity) ever supplies that field \u2014 the filter can never match a real row. Cross-orbital because the persistor routinely lives in a sibling orbital (the modal + persistor idiom). `[identity]`-roster entities and `@intrinsic` fields are exempt; a declared default only exempts the field when it folds, under the trait's resolved config, to the SAME literal the filter's comparand folds to \u2014 an undecidable (payload/entity/user-bound) comparand stays silent rather than guessing. Ported from `filter-field-never-written`. Error severity."
3179
- },
3180
- {
3181
- code: "ORB_X_UNRESOLVED_RELATION_TARGET",
3182
- category: "cross",
3183
- description: "A `type: 'relation'` field's `relation.entity` does not resolve to any entity declared in the same schema. Error severity; the entity-scope validator also emits `ORB_E_INVALID_RELATION` for the same condition. See COMP-9 in docs/Almadar_Agent_Behaviors_Plan.md."
3184
- },
3185
- {
3186
- code: "ORB_X_UNRESOLVED_PATTERN_FIELD_REF",
3187
- category: "cross",
3188
- description: "A pattern prop tagged `kind: 'field-ref'` (scalar) or `itemKind: 'field-ref'` (array element) carries a value that does not resolve to any field on the linked entity. Error severity. See Phase 3.2/3.3 in docs/Almadar_Agent_Behaviors_Plan.md."
3189
- },
3190
- {
3191
- code: "ORB_LISTEN_ROUTE_STARVES_REQUIRED_FIELD",
3192
- category: "cross",
3193
- description: "A `listens { Src.EVENT -> TRIGGER }` route's TRIGGER declares a required leaf payload field the route never produces: no `with { }` mapping supplies it, and (pass-through, no mapping) the source trait's declared `emits { EVENT { ... } }` contract never declares it at the same dotted path either. The consumer's transition reads `?payload.<field>` as `undefined` at runtime."
3194
- },
3195
- {
3196
- code: "ORB_LISTEN_REDUNDANT_EMBED_ROUTE",
3197
- category: "cross",
3198
- description: "A host trait's `listens { Child.EV -> EV }` route where `Child` is a trait the host embeds (directly or transitively), `EV` is fired by a control inside `Child`'s subtree, and the host already has a transition on `EV`. The control's emit bubbles to every scope on the embed chain, so the host already hears it directly; the route is a second delivery of the same physical event."
3199
- },
3200
- {
3201
- code: "ORB_LISTEN_WILDCARD_UNKEYED",
3202
- category: "cross",
3203
- description: "A `*.EVENT` route on an event whose payload carries a `CallKey`-typed `key`, with a guard that never reads it."
3204
- },
3205
- {
3206
- code: "ORB_BINDING_INVALID_FORMAT",
3207
- category: "binding",
3208
- description: "Binding has invalid format"
3209
- },
3210
- {
3211
- code: "ORB_BINDING_UNKNOWN_ROOT",
3212
- category: "binding",
3213
- description: "Unknown binding root"
3214
- },
3215
- {
3216
- code: "ORB_CONFIG_DANGLING_REF",
3217
- category: "binding",
3218
- description: "`@config.<key>` literal whose key no reachable config schema declares"
3219
- },
3220
- {
3221
- code: "ORB_CONFIG_FIELD_REF_UNKNOWN",
3222
- category: "binding",
3223
- description: "A `field @entity` config knob names something that is not a field of the trait's bound entity"
3224
- },
3225
- {
3226
- code: "ORB_CONFIG_FIELD_REF_TYPE_MISMATCH",
3227
- category: "binding",
3228
- description: "A `field @entity T` config knob names a field whose type is not `T`"
3229
- },
3230
- {
3231
- code: "ORB_BINDING_INVALID_PATH",
3232
- category: "binding",
3233
- description: "Invalid binding path"
3234
- },
3235
- {
3236
- code: "ORB_BINDING_STATE_NO_PATH",
3237
- category: "binding",
3238
- description: "@state binding should not have path"
3239
- },
3240
- {
3241
- code: "ORB_BINDING_NOW_NO_PATH",
3242
- category: "binding",
3243
- description: "@now binding should not have path"
3244
- },
3245
- {
3246
- code: "ORB_BINDING_PAYLOAD_IN_TICK",
3247
- category: "binding",
3248
- description: "@payload not available in tick context"
3249
- },
3250
- {
3251
- code: "ORB_BINDING_DISPATCH_ROOT_IN_TICK",
3252
- category: "binding",
3253
- description: "`@event`/`@prevEvents`/`@prevStates`/`@fromState`/`@toState` in a tick, which has no delivery"
3254
- },
3255
- {
3256
- code: "ORB_BINDING_FROM_ENTITY_OUTSIDE_ENSURES",
3257
- category: "binding",
3258
- description: "`@fromEntity` (the row before a transition) outside an `@ensures`"
3259
- },
3260
- {
3261
- code: "ORB_BINDING_ROOT_NO_PATH",
3262
- category: "binding",
3263
- description: "`@fromState`/`@toState`/`@prevStates`/`@prevEvents` written with a path"
3264
- },
3265
- {
3266
- code: "ORB_BINDING_EVENT_INVALID_PATH",
3267
- category: "binding",
3268
- description: "`@event.<path>` that does not follow the `{ event, payload, source }` record"
3269
- },
3270
- {
3271
- code: "ORB_BINDING_UNKNOWN_ENTITY",
3272
- category: "binding",
3273
- description: "Unknown entity in @EntityName binding"
3274
- },
3275
- {
3276
- code: "ORB_BINDING_INVALID_FIELD_NAME",
3277
- category: "binding",
3278
- description: "Invalid field name in binding path"
3279
- },
3280
- {
3281
- code: "ORB_BINDING_SET_TARGET_MISSING_PATH",
3282
- category: "binding",
3283
- description: "Set target missing field path"
3284
- },
3285
- {
3286
- code: "ORB_BINDING_PAYLOAD_FIELD_UNDECLARED",
3287
- category: "binding",
3288
- description: "@payload.field references a field not declared in event payload schema"
3289
- },
3290
- {
3291
- code: "ORB_BINDING_PAYLOAD_TYPE_INCOMPATIBLE",
3292
- category: "binding",
3293
- description: "@payload.field is declared but its type does not match the operator argument or comparison it appears in (e.g. string used where a number was expected). Warn-only in V2 Phase 0 rollout; escalates to error in the Phase 5 cleanup. Wired up in a follow-up pass over operator signatures; the class is declared here so the code path can reference it and emit warnings incrementally."
3294
- },
3295
- {
3296
- code: "ORB_X_SET_VALUE_TYPE_MISMATCH",
3297
- category: "effect",
3298
- description: "`(set @entity.X ?payloadField)` writes a payload field whose declared type does not match the target entity field's declared type. The lolo crate catches this at author time for `.lolo`; this is the raw-`.orb` defense-in-depth backstop. Payload field types are sourced from the trait's `emits[].payload_schema` and `listens` payload metadata."
3299
- },
3300
- {
3301
- code: "ORB_X_ENUM_VALUE_NOT_MEMBER",
3302
- category: "effect",
3303
- description: "`(set @entity.X literal)` assigns a string literal that is not a member of the target field's declared enum (`values: [...]`). The declared union was previously validated + emitted but never enforced \u2014 an out-of-set value passed silently. The lolo crate catches this at author time for `.lolo`; this is the raw-`.orb` defense-in-depth backstop."
3304
- },
3305
- {
3306
- code: "ORB_X_SET_RETURN_TYPE_MISMATCH",
3307
- category: "effect",
3308
- description: "`(set @entity.X (op \u2026))` assigns an operator/expression value whose inferred result type is incompatible with the target field's declared type (e.g. `(set @entity.count (str/concat \u2026))` into a `number` field). The value's type is inferred *through* the S-expression via the canonical operator `return_semantics` lattice; an unknowable result (`Json`) never rejects (Gap G-LOLO-SET-OP-RETURN)."
3309
- },
3310
- {
3311
- code: "ORB_X_COMPARISON_OPERAND_TYPE_MISMATCH",
3312
- category: "effect",
3313
- description: "An ordering comparison (`<`, `<=`, `>`, `>=`) whose operands infer to a number on one side and a string on the other. The JS runtime coerces, the compiled TypeScript does not typecheck, and Rust compares kinds \u2014 the paths disagree. Convert one side so both are the same kind."
3314
- },
3315
- {
3316
- code: "ORB_X_OPERATOR_ARG_TYPE_MISMATCH",
3317
- category: "effect",
3318
- description: 'An operator argument whose static type contradicts the type the operator table declares for its position \u2014 `(str/upper @entity.count)` with `count: number`, `(+ "a" 1)`. Both evaluators raise the same typed mismatch at run time (D-12), so the program can never do what it says.'
3319
- },
3320
- {
3321
- code: "ORB_X_OPERATOR_ARG_UNDETERMINED",
3322
- category: "effect",
3323
- description: "A value handed to an operator's type variable has no determined type \u2014 an unresolved expression, an expression value, json, a list whose items share no type \u2014 so what the variable stands for, and the type of the call's result, is unknown. There are no generic types: give the value a real type (a declared payload or entity shape, a named union alias for a list of differently-shaped items)."
3324
- },
3325
- {
3326
- code: "ORB_X_ORDERING_OPTIONAL_OPERAND",
3327
- category: "effect",
3328
- description: "An ordering comparison (`<`, `<=`, `>`, `>=`) over an operand that can be missing or null \u2014 an optional entity field with no default, an optional payload field \u2014 that the program neither guards with a presence check (`(and (validate/required x) (< x 3))`, an `if`/`when` on presence) nor declares a default for. Both evaluators read a missing value as below any number; every push-down store fails the comparison, so the meaning is the program's to state."
3329
- },
3330
- {
3331
- code: "ORB_X_OPERATOR_NULL_OPERAND",
3332
- category: "effect",
3333
- description: "An operand that can be missing or null \u2014 an optional entity field with no default, an optional payload field \u2014 handed to a position the kernel raises on when it is null (`rejectsNull` in the operator table), with no presence check or default in front of it. The program says what a missing value means: a guard, a default, or a required field."
3334
- },
3335
- {
3336
- code: "ORB_X_SET_REQUIRED_FIELD_FROM_OPTIONAL_KNOB",
3337
- category: "effect",
3338
- description: "`(set @entity.X @config.<knob>)` where the value is STILL the literal `@config.<knob>` token post-inline (no default resolved it, no call-site override supplied one) and `X` is a REQUIRED entity field. The emitter has nothing honest to assign \u2014 a required TS slot gets `undefined`. Give the knob a default or make the field optional."
3339
- },
3340
- {
3341
- code: "ORB_EMIT_PAYLOAD_MISSING_REQUIRED",
3342
- category: "binding",
3343
- description: "`(emit EVT {...})` literal payload is missing a field the event's declared payload marks as required. Error severity."
3344
- },
3345
- {
3346
- code: "ORB_EMIT_PAYLOAD_EXTRA_FIELD",
3347
- category: "binding",
3348
- description: "`(emit EVT {...})` literal carries a field that is not declared on the event's payload schema. Error severity."
3349
- },
3350
- {
3351
- code: "ORB_EMIT_PAYLOAD_FIELD_TYPE_MISMATCH",
3352
- category: "binding",
3353
- description: "`(emit EVT {...})` literal provides a value whose primitive type does not match the declared `PayloadField.field_type`. Error severity."
3354
- },
3355
- {
3356
- code: "ORB_USER_INTO_REQUIRED_SLOT",
3357
- category: "binding",
3358
- description: "The whole `@user` record fills a required slot (an emit payload `X!`, a required entity field) with no guard on its presence: a dispatch with no viewer (an os/ completion, a tick) has a null `@user`. Error severity."
3359
- },
3360
- {
3361
- code: "ORB_EMIT_REPEATS_IDENTICALLY",
3362
- category: "binding",
3363
- description: "An `emit` repeats an earlier one of the same transition identically: the dispatch loop collapses the second."
3364
- },
3365
- {
3366
- code: "ORB_X_PAYLOAD_FIELD_NAME",
3367
- category: "binding",
3368
- description: "An event/emit `payloadSchema` field name is not a valid TypeScript identifier (contains a dot, space, or leading digit). Codegen turns each field into a struct member, so `row.category` would emit broken TS. Validate-layer defense-in-depth for the lowering pass that flattens nested payload field names. Error severity."
3369
- },
3370
- {
3371
- code: "ORB_X_UNTYPED_ARRAY",
3372
- category: "entity",
3373
- description: "An array field (entity or payload-schema) declares no element type."
3374
- },
3375
- {
3376
- code: "ORB_X_ENTITY_PROP_CONTRACT",
3377
- category: "render_ui",
3378
- description: "A render-ui pattern prop typed `EntityWith<K>` declares required entity fields (`requiredFields` in the registry), but the bound entity does not provide them and no remap/field-map supplies them. The component would render blank rows. Remap-aware (runs post-inline). Error severity."
3379
- },
3380
- {
3381
- code: "ORB_EMIT_SUCCESS_PAYLOAD_RETURN_MISMATCH",
3382
- category: "binding",
3383
- description: "**RETIRED (2026-08-30) \u2014 superseded by `EmitPayloadNotProduced`, which checks the full shape rather than only the empty-payload case.** No longer raised anywhere; the variant is kept so external tooling matching on the wire string `ORB_EMIT_SUCCESS_PAYLOAD_RETURN_MISMATCH` does not break on an unknown code. `emit: { success: \"X\" }` config on a data operator declares success event X but X's declared payload does not match the operator's `effect.produces` at this call site. Warn-only."
3384
- },
3385
- {
3386
- code: "ORB_EMIT_PAYLOAD_NOT_PRODUCED",
3387
- category: "binding",
3388
- description: "**The payload invariant.** An event's declared payload type IS its access path: declaring `Survey` means the payload is the row (read `?name`); declaring `{ row : Survey }` means read `?row.name`. This fires when an event declares a field that the effect firing it does not actually emit \u2014 so every read of that field is `undefined` at runtime, even though `orb validate` and `orb verify` otherwise pass. Checked as width subtyping (`declared \u2286 produced`): declaring FEWER fields than are emitted is legal, declaring one that is never emitted is not. Replaces the narrower `EmitSuccessPayloadWrapped` (persist-only) and `EmitSuccessPayloadReturnMismatch` (empty-payload-only) checks. Error severity."
3389
- },
3390
- {
3391
- code: "ORB_EMIT_SUCCESS_PAYLOAD_WRAPPED",
3392
- category: "binding",
3393
- description: "**RETIRED (2026-08-30) \u2014 superseded by `EmitPayloadNotProduced`.** This check only recognised a wrapper on `persist create`/`update` whose type named that exact entity; the general rule catches the same defect at any operator and in shapes this one was blind to (a wrapper naming a different entity, a field the operator never emits at all). Kept so external tooling matching `ORB_EMIT_SUCCESS_PAYLOAD_WRAPPED` still resolves. A `persist create`/`persist update` call's `emit: { success: \"X\" }` names an event X whose declared payload wraps the persisted entity under a single field (`type X = Event { row: EntityName }`), but `persist create`/`update` emits the persisted row directly (flat, unwrapped) on success in both @almadar/runtime and orbital-core \u2014 verified live 2026-08-30 (std-thread's `ThreadPostCreated`): a wrapped declaration validates and compiles clean but every `?row.<field>` read silently returns undefined at runtime. Warn-only."
3394
- },
3395
- {
3396
- code: "ORB_X_CROSS_EMITTER_DECLARED_PAYLOAD_MISMATCH",
3397
- category: "cross",
3398
- description: "Phase F.2: two or more traits declare the same external event name in their `emits` arrays but disagree on the declared payload field list. Consumers that listen on the event will see one shape from one emitter and a different shape from another. Error severity."
3399
- },
3400
- {
3401
- code: "ORB_X_DUPLICATE_TRAIT_ID",
3402
- category: "cross",
3403
- description: "Two traits of one program carry the same trait id; listens match sources by id, so each hears the other's emits."
3404
- },
3405
- {
3406
- code: "ORB_BINDING_ENTITY_FIELD_NOT_FOUND",
3407
- category: "binding",
3408
- description: "@entity.field references a field not present on the linked entity"
3409
- },
3410
- {
3411
- code: "ORB_BINDING_ENTITY_FIELD_NEVER_SET",
3412
- category: "binding",
3413
- description: "@entity.field is referenced by render-ui / guard / effect but no transition in the same trait runs `(set @entity.field <value>)`. Per the explicit-binding rule, every `@entity.X` read must be backed by at least one explicit setter; otherwise the value is undefined and the component renders empty. Surfaces post-inline so atoms imported via `uses` get checked too. Defense-in-depth backstop for the L1 `LowerError::EntityFieldNeverSet` check."
3414
- },
3415
- {
3416
- code: "ORB_BINDING_PERSIST_ROW_ID_NEVER_SET",
3417
- category: "binding",
3418
- description: "`(persist update|delete <Entity> @entity)` passes the WHOLE row, so the row key never appears as an `@entity.id` read and `BindingEntityFieldNeverSet` cannot see it. An unbound `id` resolves empty and the runtime refuses the write outright."
3419
- },
3420
- {
3421
- code: "ORB_BINDING_EMBED_READS_ARM_WRITE",
3422
- category: "binding",
3423
- description: "A transition writes `@entity.F` (or its whole row) and renders an embedded trait (`@trait.X`, incl. a hoisted inline `<A.traits.T/>`) whose call-site value reads that field of the same PERSISTENT entity. The embed resolves `@entity` against its own frame at its own render (its mount), so it shows the value from before this transition. Read the value the transition used instead (a call-site capture, `?row.F`), or route the host event to the embed's INIT."
3424
- },
3425
- {
3426
- code: "ORB_PERSIST_CREATE_MISSING_POLICY_FIELD",
3427
- category: "binding",
3428
- description: "`persist create E { ... }` with an explicit data literal whose key set lacks a field that `E.@create` compares (e.g. `@create sender == @user.id` and the literal has no `sender`). The access policy will never be satisfied by a row this transition itself creates \u2014 every future `@update`/`@delete`/`@read` gated on that field locks the creator out of their own row. A bare `persist create @entity` (whole frame) is not a hit. Wave 2. Error severity."
3429
- },
3430
- {
3431
- code: "ORB_PERSIST_CREATE_LITERAL_ID",
3432
- category: "binding",
3433
- description: '`persist create E { id: "literal", \u2026 }`: the row names a string-literal id, so the second run creates a row that already exists and fails with `duplicate-id`. A seed or singleton re-save is an authored `persist upsert` (create-or-replace by id). Error severity.'
3434
- },
3435
- {
3436
- code: "ORB_PERSIST_ID_NOT_A_PATH",
3437
- category: "binding",
3438
- description: "`persist delete E <expression>` / `persist update E <expression> data`: the single forms take the row id as a binding path or a literal, so an expression resolves no row key at run time. Error severity."
3439
- },
3440
- {
3441
- code: "ORB_PERSIST_WHERE_NOT_A_PREDICATE",
3442
- category: "binding",
3443
- description: "`persist \u2026 { where: \u2026 }`: the guard is a one-param `fn` over the stored row that never reads the frame (`@entity`), on a single `delete` or `update` only (EXEC-STEP-8). Error severity."
3444
- },
3445
- {
3446
- code: "ORB_EFFECT_IN_LAMBDA",
3447
- category: "binding",
3448
- description: "An effect (`emit`, `persist`, `set`, `notify`, \u2026) inside the `fn` body of a collection operator: a lambda is evaluated for its value, an effect there never runs. Error severity."
3449
- },
3450
- {
3451
- code: "ORB_BINDING_TRAIT_MISSING_NAME",
3452
- category: "binding",
3453
- description: "`@trait` binding with no trait name \u2014 bare `@trait` is not resolvable."
3454
- },
3455
- {
3456
- code: "ORB_BINDING_TRAIT_INVALID_FORMAT",
3457
- category: "binding",
3458
- description: "`@trait.X` trait name doesn't match the `PascalCase` identifier pattern."
3459
- },
3460
- {
3461
- code: "ORB_BINDING_TRAIT_UNKNOWN",
3462
- category: "binding",
3463
- description: "`@trait.X` references a trait not declared in the current orbital."
3464
- },
3465
- {
3466
- code: "ORB_BINDING_TRAIT_SELF_REFERENCE",
3467
- category: "binding",
3468
- description: "A trait's render-ui references itself via `@trait.<self>`."
3469
- },
3470
- {
3471
- code: "ORB_BINDING_TRAIT_CYCLE",
3472
- category: "binding",
3473
- description: "Cycle detected in the `@trait.X` reference graph (e.g. A \u2192 B \u2192 A)."
3474
- },
3475
- {
3476
- code: "ORB_BINDING_TRAIT_INVALID_POSITION",
3477
- category: "binding",
3478
- description: "`@trait.X` appears outside a `children:` array or a `node`-typed pattern prop \u2014 valid positions are where a subtree can be substituted."
3479
- },
3480
- {
3481
- code: "ORB_BINDING_TRAIT_OUTSIDE_RENDER_UI",
3482
- category: "binding",
3483
- description: "`@trait.X` (a render-only, client-side binding) appears outside a `render-ui` effect entirely \u2014 in a guard, a non-render effect (`fetch`/`set`/`persist`/`ref`/`call-service`), or a tick. Trait references are render-time composition primitives and have no meaning in data/effects/control flow."
3484
- },
3485
- {
3486
- code: "ORB_RENDER_UNBOUND_TRAIT_KNOB_EMBEDDED",
3487
- category: "render_ui",
3488
- description: "A render-ui payload embeds `@config.<knob>` (as a child or inside a `children` entry) where `<knob>` is a `trait`-typed config field whose resolved value is `none` (unbound), and the render-ui is not guarded by an `(if @config.<knob> ...)` wrapping it in the same effect list. An unbound trait knob's embed renders nothing \u2014 the closed-circuit rule that no wire may terminate in nothing (owner ruling 2026-09-13: a `trait`-typed config knob may be `none`)."
3489
- },
3490
- {
3491
- code: "ORB_RENDER_ORBITAL_VALUE_EMBEDDED",
3492
- category: "render_ui",
3493
- description: "A render-ui payload embeds an `orbital`-typed field: an orbital value is data (an import body) and never renders \u2014 only trait values embed."
3494
- },
3495
- {
3496
- code: "ORB_EMBED_BRIDGE_LISTENS_UNSENT",
3497
- category: "render_ui",
3498
- description: "A bridged embed delivers an event nothing in the program sends."
3499
- },
3500
- {
3501
- code: "ORB_EMBED_BRIDGE_EMITS_UNHEARD",
3502
- category: "render_ui",
3503
- description: "A bridged embed re-emits an event nothing in the program handles."
3504
- },
3505
- {
3506
- code: "ORB_ENTITY_SPLIT_MUTATION",
3507
- category: "entity_mutation",
3508
- description: "A non-`[shared]`, `Runtime`-persistence entity is mutated (via `set` or a tick write) by \u22652 distinct traits. Each mutator gets an isolated per-trait copy, so if one of the mutators' render-ui also reads the entity, it only ever sees its own trait's writes \u2014 never the others'. Error severity: add `[shared]` to the entity, or isolate the mutators."
3509
- },
3510
- {
3511
- code: "ORB_SHARED_ENTITY_FIELD_CONFLICT",
3512
- category: "entity_mutation",
3513
- description: "A `[shared]` entity has \u22652 distinct traits writing the SAME field. Coupled mechanics writing one field must be one ordered pipeline, not parallel writers \u2014 undefined last-write-wins ordering otherwise."
3514
- },
3515
- {
3516
- code: "ORB_SHARED_ENTITY_RENDER_AUTHORITY",
3517
- category: "entity_mutation",
3518
- description: "A `[shared]` entity is render-ui-read by more than one distinct trait. Exactly one render authority is allowed per shared entity, mirroring `SlotContention`'s single-owner rule."
3519
- },
3520
- {
3521
- code: "ORB_E_MERGED_FIELD_UNREFERENCED",
3522
- category: "entity_mutation",
3523
- description: "Post-inline: an entity field carrying `mergedFrom` (added by the rebind-merge auto-merge, `merge_imported_entity_fields`) that no trait of the consuming orbital reads, writes, fetch-includes, or persists \u2014 R-ENTITY-FIELD-UNION-ACROSS-SAME-NAMED-ENTITY. The merge already narrows to referenced fields at compose time; this catches drift when a later edit removes the trait/effect that used to justify the merge. Error severity."
3524
- },
3525
- {
3526
- code: "ORB_TICK_REQUIRES_RUNTIME",
3527
- category: "entity_mutation",
3528
- description: "A trait runs a non-`Cron` tick (frame/duration interval) against a `Persistent` linked entity. Corpus-facing backstop mirroring the lolo L1 tick guards. Error severity."
3529
- },
3530
- {
3531
- code: "ORB_TICK_ASYNC_EFFECT",
3532
- category: "entity_mutation",
3533
- description: "A non-`Cron` tick effect calls a server-async operator (the canonical registry's `std-agent` category \u2014 `agent/generate`, `agent/invoke`, etc.). Repeated per-tick LLM/agent calls can pile up faster than they resolve. Error severity."
3534
- },
3535
- {
3536
- code: "ORB_ENTITY_INTRINSIC_FIELD_PERSISTED",
3537
- category: "entity_mutation",
3538
- description: "An explicit `persist create`/`persist update` data LITERAL (an `OirExpr::Object`, never a bare whole-frame `@entity`) names an `@intrinsic` field of the target entity. Intrinsic fields are trait-owned view-state/machinery (`OirEntity::frame_fields`'s ONLY allow-list) \u2014 never a persisted column \u2014 so writing one into the database is a category error the author almost certainly meant as a domain field. Wave 2. Error severity."
3539
- },
3540
- {
3541
- code: "ORB_GUARD_ON_FRAME_FIELD_AUTHORIZES",
3542
- category: "entity_mutation",
3543
- description: 'An `@intrinsic` field is used as an AUTHORIZATION input: it appears in an access policy (`@create`/`@read`/`@update`/`@delete`), or in a transition guard that also reads `@user.*`/role/identity AND the transition performs `persist`/`call-service`. Intrinsic fields are trait-computed view-state the runtime never seeds or persists \u2014 using one to gate a mutation means the gate is trivially bypassable (the caller controls the "intrinsic" value directly). A plain precondition guard with no identity comparison is not a hit. Wave 2. Error severity.'
3544
- },
3545
- {
3546
- code: "ORB_SET_COLUMN_WITHOUT_ROW",
3547
- category: "entity_mutation",
3548
- description: "`(set @entity.<f> ...)` writes a non-`@intrinsic` column of a `[persistent]` entity in a transition with no row binding (no `id`/`?row`-bearing event payload, no `entityId` in scope) AND the owning trait never runs `persist create`/`persist update` on that entity anywhere \u2014 so the write can never land: it is not framed to an identified row, and nothing ever persists it. A draft form that sets columns across several transitions before a final `persist create` is legitimate (the write eventually lands); this only fires when the trait has no landing transition at all. Wave 2. Error severity."
3549
- },
3550
- {
3551
- code: "CIRCUIT_ORPHAN_EVENT",
3552
- category: "circuit",
3553
- description: "Action emits event with no transition handler"
3554
- },
3555
- {
3556
- code: "CIRCUIT_DUPLICATE_EVENT",
3557
- category: "circuit",
3558
- description: "Same event emitted multiple times in same context"
3559
- },
3560
- {
3561
- code: "CIRCUIT_DEAD_END_COMPONENT",
3562
- category: "circuit",
3563
- description: "Interactive component missing itemActions"
3564
- },
3565
- {
3566
- code: "CIRCUIT_UNREACHABLE_STATE",
3567
- category: "circuit",
3568
- description: "State has no incoming transitions"
3569
- },
3570
- {
3571
- code: "CIRCUIT_DEAD_END_STATE",
3572
- category: "circuit",
3573
- description: "State has no outgoing transitions"
3574
- },
3575
- {
3576
- code: "CIRCUIT_ACTION_COMPONENT_MISMATCH",
3577
- category: "circuit",
3578
- description: "Action-component mismatch"
3579
- },
3580
- {
3581
- code: "CIRCUIT_NO_OVERLAY_EXIT",
3582
- category: "circuit",
3583
- description: "Overlay slot (modal/drawer) missing exit transition"
3584
- },
3585
- {
3586
- code: "CIRCUIT_MODAL_EXIT_INCOMPLETE",
3587
- category: "circuit",
3588
- description: 'Modal-to-inline transition missing render-ui("main", ...) alongside render-ui("modal", null)'
3589
- },
3590
- {
3591
- code: "CIRCUIT_DEAD_HANDLER",
3592
- category: "circuit",
3593
- description: "Render-ui handler fires event with no matching transition from the rendering state"
3594
- },
3595
- {
3596
- code: "ORB_RENDER_ACTION_LIFECYCLE_EVENT",
3597
- category: "circuit",
3598
- description: "A rendered affordance's event-bearing prop (`action`, `itemActions[].event`, `submitEvent`, `onChange`, \u2026) targets a lifecycle event (`orbital_core::events::BUS_EXCLUDED_EVENTS`). The bus never re-delivers `INIT`/`LOAD`/`$MOUNT`, so the control is dead on click."
3599
- },
3600
- {
3601
- code: "ORB_CIRCUIT_FAILURE_ARM_MISSING",
3602
- category: "circuit",
3603
- description: "A transition's effects (`fetch`/`persist`/`call-service`) declare an `emit.failure` event, but no arm at the destination state (`from === to || from === '*'`) handles it \u2014 the async result contract's failure half is a live wire terminating in nothing. Ported from the JS wiring lint's `failure-arm-missing` (client-bound traits only). Error severity."
3604
- },
3605
- {
3606
- code: "ORB_CIRCUIT_FAILURE_ARM_RENDERS_NOTHING",
3607
- category: "circuit",
3608
- description: "The failure-handling arm found for [`CircuitFailureArmMissing`]'s contract exists but paints nothing (no `render-ui <slot> <non-null>` anywhere in its effects, including through `if`/`do`) \u2014 the failure is caught but never shown to the user. A trait declared `[integration]` is headless, so its arm also handles the failure by emitting an event some trait in the program listens to, or one it declares `-> external`; an emit nobody hears still reports. Ported from `failure-arm-renders- nothing`. Error severity."
3609
- },
3610
- {
3611
- code: "ORB_CIRCUIT_MODAL_SHELL_CLOSE_DEAF",
3612
- category: "circuit",
3613
- description: "A transition renders a non-self-overlaying pattern into an overlay slot (`modal`/`drawer`/`overlay`), but the destination state has no `CLOSE`/`CANCEL` arm \u2014 the generic portal shell's own dismiss control (X / Escape / overlay-click) fires an event nothing handles. Ported from `modal-shell-close-deaf`. Error severity."
3614
- },
3615
- {
3616
- code: "ORB_CIRCUIT_SELF_OVERLAY_IN_SHELL",
3617
- category: "circuit",
3618
- description: "A transition renders a SELF-overlaying pattern (`slideOver: true` anywhere in the payload tree) into an overlay slot \u2014 the generic portal shell wraps it too, producing two stacked overlay chromes. Ported from `self-overlay-inside-modal-shell`. Error severity."
3619
- },
3620
- {
3621
- code: "ORB_CIRCUIT_LIFECYCLE_EMIT_UNDELIVERED",
3622
- category: "circuit",
3623
- description: "A transition's own effects list contains a top-level `(emit <event>)` naming a lifecycle event (`orbital_core::events::BUS_EXCLUDED_EVENTS`) \u2014 the bus never re-delivers it, so this half of the closed circuit is written but can never run. Sibling production site to [`RenderActionLifecycleEvent`](ErrorCode::RenderActionLifecycleEvent) (an explicit effect instead of a rendered affordance prop). Ported from the JS wiring lint's `dead-lifecycle-emit`. Error severity."
3624
- },
3625
- {
3626
- code: "ORB_CIRCUIT_SELF_EMIT_LOOP",
3627
- category: "circuit",
3628
- description: "A transition arm re-emits its OWN trigger event (`X --X--> Y` whose effects contain `(emit X ...)`), the `to` state has another arm on X, and the re-emitted payload does not derive from `@payload` \u2014 the runtime path re-enters an arm on the same event with unchanged payload and loops forever (G-RUNTIME-020). Payloads derived from `@payload` (sentinel fan-out counters) make progress per hop and are not flagged; neither is a self-emit whose target state has no same-event arm (a dead-end broadcast). Error severity."
3629
- },
3630
- {
3631
- code: "ORB_CIRCUIT_INIT_UNCOVERED_STATE",
3632
- category: "circuit",
3633
- description: "A page trait that initializes on `INIT` has a reachable state with no `INIT` arm: trait state survives unmount, so revisiting the page from that state does nothing (G-ORB-186)."
3634
- },
3635
- {
3636
- code: "ORB_CIRCUIT_DEAD_BODILESS_ACTION",
3637
- category: "circuit",
3638
- description: "A transition moves `from -> to` (not a self-transition) with NO effects at all, out of a `from` state some OTHER arm already painted into a main slot (`orbital_core::slots::MAIN_SLOTS`) \u2014 the machine leaves that state but the screen keeps its old paint standing, so every affordance routed here is dead. Client-bound gated (an unbound trait's arms never run in the shipped client at all). Ported from the JS wiring lint's `dead-bodiless-action`. Error severity."
3639
- },
3640
- {
3641
- code: "ORB_CIRCUIT_ASYNC_RESULT_DEAF_TARGET",
3642
- category: "circuit",
3643
- description: "A state-CHANGING transition (`from != to`) whose `fetch`/`persist` effects declare async-result events (`collect_async_result_events`: EVERY value of the `emit` map, recursing through `if`/`do`) that the destination state's own arms (`from === to-state || from === \"*\"`) don't handle \u2014 the requester departs before it can hear its own operation's result, so the cascade lands on a machine deaf to it and wedges. NOT client-bound gated (the JS predicate has none here, unlike its `failure-arm-missing` sibling). Ported from the JS wiring lint's `async-result-deaf-target` (warning there; error here per the 0/0 ruling). Error severity."
3644
- },
3645
- {
3646
- code: "ORB_CIRCUIT_VIEWER_STRANDED",
3647
- category: "circuit",
3648
- description: "The trait that OWNS a page's content region (`page_content_owner`'s `channel`/`sole-writer`) has a user-triggered arm that repaints its own main-slot body with something offering no way on: no content-body pattern, no registry event-kind prop bound to a live (non-lifecycle) event or an unresolved binding, and no `@trait.X` embed. \"User- triggered\" means the event is reachable from a rendered affordance or a `listens` route, transitively, minus async-result and lifecycle events. Exempt: an arm running its own `fetch`/`persist` (its result arm repaints); a non-self-transition escaping to a state with another producible, non-lifecycle arm. Ported from the JS wiring lint's `viewer-stranded`, predicate revised 2026-09-12 per the F31 live probe (`play_scene` on `ui-minigolf-board`/`std-chem-titration`): the JS's labelled-control test and `@`/`?` sigil branch were both heuristics and are dropped \u2014 a registry event-kind prop is the only test. Error severity."
3649
- },
3650
- {
3651
- code: "ORB_UI_ICON_INVALID_FORMAT",
3652
- category: "icon",
3653
- description: "Icon name has invalid format"
3654
- },
3655
- {
3656
- code: "ORB_UI_ICON_EMPTY",
3657
- category: "icon",
3658
- description: "Icon name is empty"
3659
- },
3660
- {
3661
- code: "ORB_UI_ICON_NOT_FOUND",
3662
- category: "icon",
3663
- description: "Icon may not exist in Lucide"
3664
- },
3665
- {
3666
- code: "ORB_OP_INVALID_TIME_UNIT",
3667
- category: "operator",
3668
- description: "A `time/*` operator was given a unit literal outside the vocabulary. Unchecked, it throws at evaluation time \u2014 and inside a read predicate that means rows are dropped fail-closed while the run still reports PASS (`S-CALENDAR-RANGE-FILTER-USES-UNSUPPORTED-TIME-UNITS`)."
3669
- },
3670
- {
3671
- code: "ORB_QUERY_MISSING_SEARCH",
3672
- category: "query",
3673
- description: "Query singleton missing search field"
3674
- },
3675
- {
3676
- code: "ORB_QUERY_MISSING_RECOMMENDED",
3677
- category: "query",
3678
- description: "Query singleton missing recommended fields"
3679
- },
3680
- {
3681
- code: "ORB_QUERY_UNSUPPORTED_PATTERN",
3682
- category: "query",
3683
- description: "Pattern doesn't support query prop"
3684
- },
3685
- {
3686
- code: "ORB_QUERY_UNKNOWN_SINGLETON",
3687
- category: "query",
3688
- description: "Query references unknown singleton"
3689
- },
3690
- {
3691
- code: "ORB_QUERY_UNUSED_SINGLETON",
3692
- category: "query",
3693
- description: "Query singleton is unused"
3694
- },
3695
- {
3696
- code: "ORB_T_EVT_UNDECLARED",
3697
- category: "trait_event",
3698
- description: "Event emitted but not declared in trait.emits"
3699
- },
3700
- {
3701
- code: "ORB_T_EVT_INVALID_NAME",
3702
- category: "trait_event",
3703
- description: "Event name not UPPER_SNAKE_CASE"
3704
- },
3705
- {
3706
- code: "ORB_T_EVT_TICK_UNDECLARED",
3707
- category: "trait_event",
3708
- description: "Tick emits undeclared event"
3709
- },
3710
- {
3711
- code: "ORB_T_EVT_SCOPE_MISMATCH",
3712
- category: "trait_event",
3713
- description: "Listener scope mismatch"
3714
- },
3715
- {
3716
- code: "ORB_T_EVT_EXTERNAL_MISSING_PAYLOAD",
3717
- category: "trait_event",
3718
- description: "External emit missing payload definition"
3719
- },
3720
- {
3721
- code: "ORB_S_MISSING_NAME",
3722
- category: "schema",
3723
- description: "Schema missing name"
3724
- },
3725
- {
3726
- code: "ORB_S_NO_ORBITALS",
3727
- category: "schema",
3728
- description: "Schema has no orbitals"
3729
- },
3730
- {
3731
- code: "ORB_S_EMPTY_VERSION",
3732
- category: "schema",
3733
- description: "Schema version is empty"
3734
- },
3735
- {
3736
- code: "ORB_S_IDENTITY_NOT_UNIQUE",
3737
- category: "schema",
3738
- description: "More than one differently-named `[identity]` entity in one composed program. `@user` is a single root resolving to a single viewer, so two declarations make every `@user.x` ambiguous. (Same-name duplicates are already rejected upstream by `validate_entity_uniqueness`.)"
3739
- },
3740
- {
3741
- code: "ORB_S_ROLE_LITERAL_NOT_MEMBER",
3742
- category: "schema",
3743
- description: 'A literal compared against an `@user.<field>` whose declared type is a closed vocabulary is not one of that vocabulary\'s members \u2014 a branch that can never be taken. The bug class that let std-healthcare\'s `"patient"` and std-lms\'s `"student"` ship green.'
3744
- },
3745
- {
3746
- code: "ORB_S_UNKNOWN_IDENTITY_FIELD",
3747
- category: "schema",
3748
- description: "`@user.<field>` names a field the declared `[identity]` entity does not have. Resolves to null at runtime, so the guard silently takes its negative branch."
3749
- },
3750
- {
3751
- code: "ORB_S_ACCESS_POLICY_UNKNOWN_ENTITY_FIELD",
3752
- category: "schema",
3753
- description: "`@entity.<field>` (or `(object/get @entity field)`) inside an `@read`/`@create`/`@update`/`@delete` directive names a field the OWNING entity does not have."
3754
- },
3755
- {
3756
- code: "ORB_S_OWNER_FIELD_NOT_IDENTITY_TYPED",
3757
- category: "schema",
3758
- description: "An access directive compares an `@entity.<field>` against `@user.id`, but `<field>` is not a relation to the `[identity]` entity. The comparison is then between a free-text scalar and a roster id \u2014 it type-checks, reads like ownership, and matches nothing, because the seeder only stamps viewer ids onto DECLARED relations. This is the `customerEmail` trap: a policy that silently denies everyone while looking correct."
3759
- },
3760
- {
3761
- code: "ORB_ENTITY_OWNER_COLUMN_UNSCOPED",
3762
- category: "entity",
3763
- description: "An entity declares \u22651 owner column (a declared relation to the `[identity]` entity, via `owner_fields_from_schema` \u2014 never by field name) but no `read_policy` and no stated `access_waivers.read` reason. An undeclared policy is ALLOW-ALL, not deny-all, so every viewer reads every row. L3 port of JS `unscoped-owned-entity`."
3764
- },
3765
- {
3766
- code: "ORB_STORE_UNKNOWN_ORBITAL",
3767
- category: "entity",
3768
- description: "`store: X` (entity or app header) names no orbital of the program (EXEC-STORE-4). Error severity."
3769
- },
3770
- {
3771
- code: "ORB_STORE_DRIVER_CONTRACT",
3772
- category: "entity",
3773
- description: "A store driver orbital has no trait handling one of ROW_READ / ROW_LIST / ROWS_QUERY / ROWS_WRITE (`spec/store/row-store.lolo`). Error severity."
3774
- },
3775
- {
3776
- code: "ORB_STORE_ON_NON_PERSISTENT",
3777
- category: "entity",
3778
- description: "`store:` on an entity whose rows live in no store (`[runtime]` or browser-stored). Error severity."
3779
- },
3780
- {
3781
- code: "ORB_STORE_VERB_OUTSIDE_SEAM",
3782
- category: "entity",
3783
- description: "A trait outside a store driver orbital emits a row verb: the store seam alone asks a driver, one frame per ask (EXEC-STORE-4). Error severity."
3784
- },
3785
- {
3786
- code: "ORB_STORE_DRIVER_NOT_CONDITIONAL",
3787
- category: "entity",
3788
- description: "A single `persist delete|update` on an entity whose driver declares `writeCapabilities.conditional` false: the take is one conditional op (EXEC-STEP-8). Error severity."
3789
- },
3790
- {
3791
- code: "ORB_RENDER_GROUPBY_ENUM_COLUMN_GAP",
3792
- category: "render_ui",
3793
- description: "A trait's `config.groupByField` + `config.columns[].key` bucket rows of the linked entity by strict key equality, but the field's declared enum allows a value no column key names \u2014 those rows match no column and silently disappear. L3 port of JS `groupby-enum-column-gap`."
3794
- },
3795
- {
3796
- code: "ORB_EMBED_CONFIG_FORWARD_MULTI_REFERRER",
3797
- category: "cross",
3798
- description: "A trait embedded via `@trait.X` by \u22652 referrers that itself declares an `@config.<key>` forward. One declaration serves one embedder (its forwards chain to the first referrer only), so the second embedder's call-site config never takes effect. L3 port of JS `embedded-sibling-single-referrer`."
3799
- },
3800
- {
3801
- code: "ORB_THEME_PIN_CONTRADICTS_APP",
3802
- category: "schema",
3803
- description: "A trait pins `config.theme` to a non-empty literal that isn't a binding (`@\u2026`) and doesn't match the schema's app-level `theme` declaration. `\"\"` and bindings are unpinned \u2014 an orbital riding the ambient default is silent. L3 port of the app-level branch of JS `app-theme-divergent`; the dominant-vote branch is a name/plurality heuristic and is retired, not ported."
3804
- },
3805
- {
3806
- code: "ORB_THEME_UNDECLARED",
3807
- category: "schema",
3808
- description: "A `data-theme` resolves to a literal theme the program does not declare (app or orbital `theme`, or the app's `themes`), so the compiled client ships no stylesheet for it (G-UI-106)."
3809
- },
3810
- {
3811
- code: "ORB_S_ACCESS_POLICY_INVALID_BINDING",
3812
- category: "schema",
3813
- description: "An access directive reads a binding root other than `@entity`/`@user` \u2014 the directive has no call site, so `@payload`/`@config`/`@state` are not meaningful there."
3814
- },
3815
- {
3816
- code: "ORB_S_ACCESS_POLICY_REQUIRES_IDENTITY",
3817
- category: "schema",
3818
- description: "An access directive reads `@user` in a program declaring no `[identity]` entity. Unlike a bare pre-existing `@user` read (which falls back to the implicit default shape), a NEW authorization construct must have a real roster \u2014 that is what makes personas switchable."
3819
- },
3820
- {
3821
- code: "ORB_S_COLLECTION_POLICY_CONFLICT",
3822
- category: "schema",
3823
- description: "Two entity declarations bind the same `persistent:` collection and declare DIFFERENT access directives. One table cannot honestly have two visibility rules, and the runtime's collection-level inheritance has no principled way to choose (`R-SHADOW-ENTITY-SHARES-COLLECTION-DIRECTIVES-DONT-APPLY`)."
3824
- },
3825
- {
3826
- code: "ORB_S_EXPECTATION_UNSATISFIED",
3827
- category: "schema",
3828
- description: "Compose link-check: an orbital's `expects entity X` / `expects entity X [identity]` names a requirement no orbital in the program provides. The message names WHO ASKED \u2014 the consumer orbital \u2014 so the repair is attributable."
3829
- },
3830
- {
3831
- code: "ORB_S_EXPECTATION_PROVIDER_MISMATCH",
3832
- category: "schema",
3833
- description: "Compose link-check: the named provider entity exists but lacks the expected kind (e.g. `expects entity Customer [identity]` where `Customer` carries no `[identity]` tag)."
3834
- },
3835
- {
3836
- code: "ORB_S_EXPECTED_FIELD_NOT_PROVIDED",
3837
- category: "schema",
3838
- description: "Compose link-check: the provider entity declares no field with an expected shape name. Names consumer, provider, and field."
3839
- },
3840
- {
3841
- code: "ORB_S_EXPECTED_FIELD_TYPE_MISMATCH",
3842
- category: "schema",
3843
- description: "Compose link-check: the provider has the expected field but with an incompatible type (per orbital-core's `type_compat`; literal unions use subset semantics \u2014 every expected member must be a provider member)."
3844
- },
3845
- {
3846
- code: "ORB_S_EXPECTATION_FIELD_UNDECLARED",
3847
- category: "schema",
3848
- description: "Standalone AND compose self-consistency: the consumer uses a field it did not declare \u2014 an `@user.<field>` read outside its `expects identity` shape, or a `persist` payload field outside its `expects entity` shape. The consumer's declaration is its own source of truth."
3849
- },
3850
- {
3851
- code: "ORB_S_INVARIANT_VIOLATED",
3852
- category: "schema",
3853
- description: "A spec proposition (`@invariant` on `expects entity`, `@holds` on an `expects trait` state) is broken: a write or transition of the program falsifies it on a counterexample the evaluator confirms."
3854
- },
3855
- {
3856
- code: "ORB_S_INVARIANT_UNPROVED",
3857
- category: "schema",
3858
- description: "A spec proposition the prover could not decide (an expression outside the decidable fragment, or a write whose effect on the proposition is over-approximated). Never a pass."
3859
- },
3860
- {
3861
- code: "ORB_U_CONFIG_UNKNOWN_KEY",
3862
- category: "schema",
3863
- description: 'A `uses A from "\u2026" { config { \u2026 } }` call-site override names a key the imported behavior\'s app-level `config {}` (`OrbitalSchema.config`, `Almadar_Orbital_Import.md` \xA74.5) does not declare.'
3864
- },
3865
- {
3866
- code: "ORB_S_SHARED_WITHOUT_PERSISTENCE_MODE",
3867
- category: "schema",
3868
- description: "L2 twin of `orbital-lolo`'s `LowerError::SharedEntityWithoutPersistenceMode` (`ORB_S_SHARED_WITHOUT_PERSISTENCE_MODE`): `EntityDefinition.shared && persistence.is_none()` on the input schema. Nothing about a `[shared]` entity may be inferred \u2014 it must say `persistent: <collection>` or `runtime` explicitly. Catches a `.orb` mutated directly (factory edits, agent rewrites) that bypasses the `.lolo` parse path. Runs before any persistence defaulting. Wave 2. Error severity."
3869
- },
3870
- {
3871
- code: "ORB_ID_UNKNOWN_REF",
3872
- category: "identity",
3873
- description: "A populated dual-carry id field points at an id that is neither a node declared in the schema's arena (orbital/entity/trait/page/emit-event) nor a `schema.ledger` entry. The edge is dangling."
3874
- },
3875
- {
3876
- code: "ORB_ID_NAME_MISMATCH",
3877
- category: "identity",
3878
- description: "Both a reference's name field and its id sibling are populated, but the ledger's `curName` for that id disagrees with the name (dual-carry drift)."
3879
- },
3880
- {
3881
- code: "ORB_ID_KIND_MISMATCH",
3882
- category: "identity",
3883
- description: "An id's kind prefix (`identity::id_kind_of`) disagrees with the reference position it occupies (e.g. an `ent_` id sitting in a trait `refId`)."
3884
- },
3885
- {
3886
- code: "ORB_ID_LEDGER_ORPHAN",
3887
- category: "identity",
3888
- description: "A ledger row whose id no node in the schema carries \u2014 a stale row left behind after its node was removed. Error severity."
3889
- },
3890
- {
3891
- code: "ORB_ID_DUPLICATE_EVENT_ID",
3892
- category: "identity",
3893
- description: "One event id is declared by two or more DIFFERENT traits in the same orbital (`stateMachine.events[].id` / `emits[].eventId`). Ids are the durable node keys of the identity graph; a shared id makes every id\u2192name resolution (identity normalize, id-primary dispatch) ambiguous. Inline's event-id hygiene derives per-instance ids at expansion, so this fires only on an artifact produced outside that path."
3894
- },
3895
- {
3896
- code: "ORB_ID_AUTHORED_WITHOUT_LEDGER",
3897
- category: "identity",
3898
- description: "A ledger-less `.orb` carries an authored declaration id that loading re-mints (`stamp::ensure_stamped`). Warning severity."
3899
- },
3900
- {
3901
- code: "ORB_BEHAVIOR_PACKAGE_NOT_INSTALLED",
3902
- category: "behavior_package",
3903
- description: "`<prefix>/<name>` names a prefix no installed behavior package declares."
3904
- },
3905
- {
3906
- code: "ORB_BEHAVIOR_NOT_FOUND",
3907
- category: "behavior_package",
3908
- description: "The prefix resolved to an installed package, but it has no behavior by that name (or `std/behaviors/<name>` matched neither the std source nor any other installed package)."
3909
- },
3910
- {
3911
- code: "ORB_BEHAVIOR_AMBIGUOUS",
3912
- category: "behavior_package",
3913
- description: "`std/behaviors/<name>` matched the same behavior name in two or more non-std installed packages."
3914
- },
3915
- {
3916
- code: "ORB_BEHAVIOR_PREFIX_CONFLICT",
3917
- category: "behavior_package",
3918
- description: "Two different installed packages declare the same `orb.prefix`."
3919
- },
3920
- {
3921
- code: "ORB_BEHAVIOR_NAME_DUPLICATE",
3922
- category: "behavior_package",
3923
- description: "A behavior name is duplicated within or across installed package sources."
3924
- },
3925
- {
3926
- code: "ORB_BEHAVIOR_PACKAGE_INVALID",
3927
- category: "behavior_package",
3928
- description: "An installed behavior package's registry cannot be read or indexed."
3929
- },
3930
- {
3931
- code: "ORB_GEN_INVALID_VALUE",
3932
- category: "generic",
3933
- description: "Generic invalid value"
3934
- },
3935
- {
3936
- code: "ORB_GEN_INVALID_REFERENCE",
3937
- category: "generic",
3938
- description: "Generic invalid reference format"
3939
- },
3940
- {
3941
- code: "ORB_X_UNKNOWN_THEME",
3942
- category: "generic",
3943
- description: "Theme reference names a theme not in the valid set (built-in `@almadar-ui/themes/` registry \u222A orbital-declared inline themes)"
3944
- },
3945
- {
3946
- code: "ORB_GEN_MISSING_FIELD",
3947
- category: "generic",
3948
- description: "Generic missing required field"
3949
- },
3950
- {
3951
- code: "ORB_GEN_DUPLICATE",
3952
- category: "generic",
3953
- description: "Generic duplicate entity/item"
3954
- }
3955
- ];
3956
-
3957
- // src/types/validation.ts
3958
- var validationCodes = validation_codes_default;
3959
- var ORBITAL_PATH_PREFIX = /^orbitals\[(\d+)(?: \([^\]]*\))?\]/;
3960
- function orbitalIndexOfValidationPath(path) {
3961
- if (Array.isArray(path)) {
3962
- if (path[0] === "orbitals") return typeof path[1] === "number" ? path[1] : null;
3963
- return typeof path[0] === "string" ? orbitalIndexOfValidationPath(path[0]) : null;
3964
- }
3965
- const m = typeof path === "string" ? ORBITAL_PATH_PREFIX.exec(path) : null;
3966
- return m ? Number(m[1]) : null;
3967
- }
3968
- var KNOWN_VALIDATION_ERROR_CODES = Object.fromEntries(
3969
- validationCodes.map((entry) => [entry.code, entry.code])
3970
- );
3971
- function isKnownValidationErrorCode(code) {
3972
- return code in KNOWN_VALIDATION_ERROR_CODES;
3973
- }
3974
-
3975
- // src/types/living.ts
3976
- function widenTier(tier) {
3977
- return tier;
3978
- }
3979
- var ARIA_LIVE = ["off", "polite", "assertive"];
3980
- var ARIA_CURRENT = ["page", "step", "location", "date", "time", "true", "false"];
3981
- var ARIA_PRESSED = ["true", "false", "mixed"];
3982
- var TEXT_DIRECTIONS = ["ltr", "rtl", "auto"];
3983
- var TAB_INDEX_VALUES = [-1, 0];
3984
- var ARIA_ROLES = [
3985
- "alert",
3986
- "alertdialog",
3987
- "application",
3988
- "article",
3989
- "banner",
3990
- "blockquote",
3991
- "button",
3992
- "caption",
3993
- "cell",
3994
- "checkbox",
3995
- "code",
3996
- "columnheader",
3997
- "combobox",
3998
- "complementary",
3999
- "contentinfo",
4000
- "definition",
4001
- "deletion",
4002
- "dialog",
4003
- "document",
4004
- "emphasis",
4005
- "feed",
4006
- "figure",
4007
- "form",
4008
- "generic",
4009
- "grid",
4010
- "gridcell",
4011
- "group",
4012
- "heading",
4013
- "img",
4014
- "insertion",
4015
- "link",
4016
- "list",
4017
- "listbox",
4018
- "listitem",
4019
- "log",
4020
- "main",
4021
- "marquee",
4022
- "math",
4023
- "menu",
4024
- "menubar",
4025
- "menuitem",
4026
- "menuitemcheckbox",
4027
- "menuitemradio",
4028
- "meter",
4029
- "navigation",
4030
- "none",
4031
- "note",
4032
- "option",
4033
- "paragraph",
4034
- "presentation",
4035
- "progressbar",
4036
- "radio",
4037
- "radiogroup",
4038
- "region",
4039
- "row",
4040
- "rowgroup",
4041
- "rowheader",
4042
- "scrollbar",
4043
- "search",
4044
- "searchbox",
4045
- "separator",
4046
- "slider",
4047
- "spinbutton",
4048
- "status",
4049
- "strong",
4050
- "subscript",
4051
- "superscript",
4052
- "switch",
4053
- "tab",
4054
- "table",
4055
- "tablist",
4056
- "tabpanel",
4057
- "term",
4058
- "textbox",
4059
- "time",
4060
- "timer",
4061
- "toolbar",
4062
- "tooltip",
4063
- "tree",
4064
- "treegrid",
4065
- "treeitem"
4066
- ];
4067
- var AriaRoleSchema = z.enum(ARIA_ROLES);
4068
- var ARIA_ROLE_SET = new Set(ARIA_ROLES);
4069
- function isAriaRole(value) {
4070
- return ARIA_ROLE_SET.has(value);
4071
- }
4072
- var A11Y_ATTRIBUTES = {
4073
- "aria-label": { types: ["string"], description: "Accessible name read by screen readers when the visible text is missing or not descriptive (e.g. an icon-only control)." },
4074
- "aria-labelledby": { types: ["string"], description: "Id of the element whose text names this one." },
4075
- "aria-describedby": { types: ["string"], description: "Id of the element whose text describes this one (help text, error)." },
4076
- "aria-live": { types: ["string"], enumValues: ARIA_LIVE, description: "Announce changes to this region: polite waits for a pause, assertive interrupts." },
4077
- "aria-current": { types: ["string"], enumValues: ARIA_CURRENT, description: "Marks the current item in a set: the current page, step, location, date or time." },
4078
- "aria-pressed": { types: ["string"], enumValues: ARIA_PRESSED, description: "Toggle-button state." },
4079
- "aria-expanded": { types: ["boolean"], description: "Whether the element it controls is expanded." },
4080
- "aria-selected": { types: ["boolean"], description: "Whether this item is selected (tabs, options, grid cells)." },
4081
- "aria-hidden": { types: ["boolean"], description: "Hide from assistive technology (decorative content only)." },
4082
- "aria-busy": { types: ["boolean"], description: "This region is updating; assistive technology waits before announcing it." },
4083
- role: { types: ["string"], enumValues: ARIA_ROLES, description: "WAI-ARIA role when the element's native semantics don't describe it." },
4084
- lang: { types: ["string"], description: "Language of this element's content (BCP 47, e.g. ar, sl, en)." },
4085
- dir: { types: ["string"], enumValues: TEXT_DIRECTIONS, description: "Text direction of this element's content." },
4086
- tabIndex: { types: ["number"], numericEnumValues: TAB_INDEX_VALUES, description: "0 puts the element in the Tab order; -1 makes it focusable only programmatically." }
4087
- };
4088
- var ACCESSIBLE_NAME_ATTRIBUTES = ["aria-label", "aria-labelledby"];
4089
-
4090
- // src/types/surface.ts
4091
- var SURFACE_MODES = ["auto", "none"];
4092
- var DIAGRAM_TONES = [
4093
- "ink",
4094
- "label",
4095
- "guide",
4096
- "axis",
4097
- "grid",
4098
- "highlight",
4099
- "fill",
4100
- "series-1",
4101
- "series-2",
4102
- "series-3",
4103
- "series-4",
4104
- "series-5",
4105
- "series-6",
4106
- "series-7",
4107
- "series-8",
4108
- "primary",
4109
- "accent",
4110
- "success",
4111
- "warning",
4112
- "error",
4113
- "info",
4114
- "muted"
4115
- ];
4116
- var DiagramToneSchema = z.enum(DIAGRAM_TONES);
4117
- var DIAGRAM_TONE_COLOR_KEYS = {
4118
- ink: "diagram-ink",
4119
- label: "diagram-label",
4120
- guide: "diagram-guide",
4121
- axis: "diagram-axis",
4122
- grid: "diagram-grid",
4123
- highlight: "diagram-highlight",
4124
- fill: "diagram-fill",
4125
- "series-1": "series-1",
4126
- "series-2": "series-2",
4127
- "series-3": "series-3",
4128
- "series-4": "series-4",
4129
- "series-5": "series-5",
4130
- "series-6": "series-6",
4131
- "series-7": "series-7",
4132
- "series-8": "series-8",
4133
- primary: "primary",
4134
- accent: "accent",
4135
- success: "success",
4136
- warning: "warning",
4137
- error: "error",
4138
- info: "info",
4139
- muted: "muted-foreground"
4140
- };
4141
- var DIAGRAM_STROKE_WEIGHTS = ["thin", "normal", "bold"];
4142
- var DiagramStrokeWeightSchema = z.enum(DIAGRAM_STROKE_WEIGHTS);
4143
- var DIAGRAM_TEXT_SIZES = ["xs", "sm", "base", "lg", "xl", "2xl"];
4144
- var DiagramTextSizeSchema = z.enum(DIAGRAM_TEXT_SIZES);
4145
- var DIAGRAM_TEXT_CASES = ["theme", "verbatim"];
4146
- var DiagramTextCaseSchema = z.enum(DIAGRAM_TEXT_CASES);
4147
- var TRAITS_SEGMENT = ".traits.";
4148
- var ORBITALS_SEGMENT = ".orbitals.";
4149
- var PASCAL = /^[A-Z][A-Za-z0-9]*$/;
4150
- var SPECIFIER = /^(?:[a-z0-9][a-z0-9-]*(?:\/behaviors)?|\.(?:\/[A-Za-z0-9_-]+)+)\/[A-Za-z0-9][A-Za-z0-9_-]*$/;
4151
- function splitLiteral(raw, segment) {
4152
- const at = raw.lastIndexOf(segment);
4153
- if (at <= 0) return void 0;
4154
- const behavior = raw.slice(0, at);
4155
- const name = raw.slice(at + segment.length);
4156
- if (!SPECIFIER.test(behavior) || !PASCAL.test(name)) return void 0;
4157
- return { behavior, name };
4158
- }
4159
- function parseTraitValueLiteral(raw) {
4160
- const parts = splitLiteral(raw, TRAITS_SEGMENT);
4161
- return parts === void 0 ? void 0 : { behavior: parts.behavior, trait: parts.name };
4162
- }
4163
- function parseOrbitalValueLiteral(raw) {
4164
- const parts = splitLiteral(raw, ORBITALS_SEGMENT);
4165
- return parts === void 0 ? void 0 : { behavior: parts.behavior, orbital: parts.name };
4166
- }
4167
- function parseBehaviorValueLiteral(raw) {
4168
- return parseTraitValueLiteral(raw) ?? parseOrbitalValueLiteral(raw);
4169
- }
4170
- function formatTraitValueLiteral(value) {
4171
- return `${value.behavior}${TRAITS_SEGMENT}${value.trait}`;
4172
- }
4173
- function formatOrbitalValueLiteral(value) {
4174
- return `${value.behavior}${ORBITALS_SEGMENT}${value.orbital}`;
4175
- }
4176
- function formatBehaviorValueLiteral(value) {
4177
- return isOrbitalValueShape(value) ? formatOrbitalValueLiteral(value) : formatTraitValueLiteral(value);
4178
- }
4179
- var TraitOverridesSchema = TraitReferenceObjectSchema.pick({
4180
- config: true,
4181
- events: true,
4182
- fields: true,
4183
- listens: true,
4184
- emitsScope: true,
4185
- linkedEntity: true
4186
- }).strict();
4187
- var TraitValueSchema = TraitOverridesSchema.extend({
4188
- behavior: z.string().regex(SPECIFIER),
4189
- trait: z.string().regex(PASCAL)
4190
- }).strict();
4191
- var OrbitalValueUseSchema = z.object({ from: z.string(), as: z.string().regex(PASCAL) }).strict();
4192
- var OrbitalValueSiblingSchema = z.object({
4193
- name: z.string().regex(PASCAL),
4194
- ref: z.string(),
4195
- linkedEntity: z.string().optional(),
4196
- config: z.record(z.string(), TraitConfigValueSchema).optional()
4197
- }).strict();
4198
- var OrbitalOverridesSchema = OrbitalRefObjectSchema.omit({ ref: true, refId: true, config: true, traits: true }).extend({
4199
- name: z.string().regex(PASCAL).optional(),
4200
- app: z.record(z.string(), TraitConfigValueSchema).optional(),
4201
- config: z.record(z.string(), TraitConfigValueSchema).optional(),
4202
- traits: z.record(z.string(), TraitOverridesSchema).optional(),
4203
- uses: z.array(OrbitalValueUseSchema).optional(),
4204
- siblings: z.array(OrbitalValueSiblingSchema).optional()
4205
- }).strict();
4206
- var OrbitalValueSchema = OrbitalOverridesSchema.extend({
4207
- behavior: z.string().regex(SPECIFIER),
4208
- orbital: z.string().regex(PASCAL)
4209
- }).strict();
4210
- var BehaviorValueSchema = z.union([TraitValueSchema, OrbitalValueSchema]);
4211
- function mergeTraitOverrides(base, overrides) {
4212
- const merged = { ...base };
4213
- if (overrides.config !== void 0) merged.config = { ...base.config, ...overrides.config };
4214
- if (overrides.events !== void 0) merged.events = { ...base.events, ...overrides.events };
4215
- if (overrides.fields !== void 0) merged.fields = { ...base.fields, ...overrides.fields };
4216
- if (overrides.listens !== void 0) merged.listens = overrides.listens;
4217
- if (overrides.emitsScope !== void 0) merged.emitsScope = overrides.emitsScope;
4218
- if (overrides.linkedEntity !== void 0) merged.linkedEntity = overrides.linkedEntity;
4219
- return merged;
4220
- }
4221
- function applyTraitOverrides(value, overrides) {
4222
- return { ...mergeTraitOverrides(value, overrides), behavior: value.behavior, trait: value.trait };
4223
- }
4224
- function mergeFieldsByName(base, next) {
4225
- const out = [...base ?? []];
4226
- for (const field of next) {
4227
- const at = field.name === void 0 ? -1 : out.findIndex((f) => f.name === field.name);
4228
- if (at >= 0) out[at] = field;
4229
- else out.push(field);
4230
- }
4231
- return out;
4232
- }
4233
- function applyOrbitalOverrides(value, overrides) {
4234
- const merged = { ...value, ...overrides, behavior: value.behavior, orbital: value.orbital };
4235
- if (overrides.app !== void 0) merged.app = { ...value.app, ...overrides.app };
4236
- if (overrides.config !== void 0) merged.config = { ...value.config, ...overrides.config };
4237
- if (overrides.events !== void 0) merged.events = { ...value.events, ...overrides.events };
4238
- if (overrides.fields !== void 0) merged.fields = { ...value.fields, ...overrides.fields };
4239
- if (overrides.pages !== void 0) merged.pages = { ...value.pages, ...overrides.pages };
4240
- if (overrides.pageModifiers !== void 0) merged.pageModifiers = { ...value.pageModifiers, ...overrides.pageModifiers };
4241
- if (overrides.roles !== void 0) merged.roles = { ...value.roles, ...overrides.roles };
4242
- if (overrides.entities !== void 0) merged.entities = { ...value.entities, ...overrides.entities };
4243
- if (overrides.mounts !== void 0) merged.mounts = { ...value.mounts, ...overrides.mounts };
4244
- if (overrides.mock !== void 0) merged.mock = { ...value.mock, ...overrides.mock };
4245
- if (overrides.extend !== void 0) merged.extend = mergeFieldsByName(value.extend, overrides.extend);
4246
- if (overrides.retype !== void 0) merged.retype = mergeFieldsByName(value.retype, overrides.retype);
4247
- if (overrides.uses !== void 0) {
4248
- const byAlias = new Map((value.uses ?? []).map((u) => [u.as, u]));
4249
- for (const use of overrides.uses) byAlias.set(use.as, use);
4250
- merged.uses = [...byAlias.values()];
4251
- }
4252
- if (overrides.siblings !== void 0) {
4253
- const byName = new Map((value.siblings ?? []).map((t) => [t.name, t]));
4254
- for (const sibling of overrides.siblings) {
4255
- const prior = byName.get(sibling.name);
4256
- byName.set(sibling.name, { ...prior, ...sibling, ...prior?.config !== void 0 || sibling.config !== void 0 ? { config: { ...prior?.config, ...sibling.config } } : {} });
4257
- }
4258
- merged.siblings = [...byName.values()];
4259
- }
4260
- if (overrides.traits !== void 0) {
4261
- const traits = { ...value.traits };
4262
- for (const [name, entry] of Object.entries(overrides.traits)) {
4263
- traits[name] = mergeTraitOverrides(traits[name] ?? {}, entry);
4264
- }
4265
- merged.traits = traits;
4266
- }
4267
- return merged;
4268
- }
4269
- function applyBehaviorOverrides(value, overrides) {
4270
- if (isOrbitalValueShape(value)) return applyOrbitalOverrides(value, OrbitalOverridesSchema.parse(overrides));
4271
- return applyTraitOverrides(value, TraitOverridesSchema.parse(overrides));
4272
- }
4273
- function isTraitValue(value) {
4274
- if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
4275
- if (!("behavior" in value) || !("trait" in value)) return false;
4276
- const { behavior, trait } = value;
4277
- return typeof behavior === "string" && SPECIFIER.test(behavior) && typeof trait === "string" && PASCAL.test(trait);
4278
- }
4279
- function isOrbitalValue(value) {
4280
- if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
4281
- if (!("behavior" in value) || !("orbital" in value)) return false;
4282
- const { behavior, orbital } = value;
4283
- return typeof behavior === "string" && SPECIFIER.test(behavior) && typeof orbital === "string" && PASCAL.test(orbital);
4284
- }
4285
- function behaviorRef(specifier) {
4286
- if (!SPECIFIER.test(specifier)) {
4287
- throw new Error(`behavior/ref: "${specifier}" is not a behavior specifier (<prefix>/<name>, std/behaviors/<name> or ./<dir>/<name>)`);
4288
- }
4289
- return { behavior: specifier };
4290
- }
4291
- function isBehaviorRefValue(value) {
4292
- return BehaviorRefSchema.safeParse(value).success;
4293
- }
4294
- function isOrbitalValueShape(value) {
4295
- return "orbital" in value;
4296
- }
4297
- var EXPOSURES = ["app", "experience", "palette", "both", "internal"];
4298
- var VectorSchema = z.array(z.number());
4299
- var CatalogScopeSchema = z.object({
4300
- paths: z.array(z.string().min(1)).min(1),
4301
- exposure: z.array(z.enum(EXPOSURES)).optional()
4302
- }).strict();
4303
- var BehaviorBridgeSchema = z.object({
4304
- listens: z.array(z.string().min(1)),
4305
- emits: z.array(z.string().min(1))
4306
- }).strict();
4307
- var BehaviorRefSchema = z.object({ behavior: z.string().regex(SPECIFIER), bridge: BehaviorBridgeSchema.optional(), resolved: z.string().min(1).optional() }).strict();
4308
- var BehaviorRefOverridesSchema = z.object({ bridge: BehaviorBridgeSchema }).strict();
4309
- function applyBehaviorRefOverrides(value, overrides) {
4310
- const parsed = BehaviorRefOverridesSchema.parse(overrides);
4311
- return { behavior: value.behavior, bridge: parsed.bridge };
4312
- }
4313
- var CatalogEntrySchema = z.object({
4314
- /** `<prefix>/<name>`. */
4315
- behavior: z.string(),
4316
- package: z.string(),
4317
- topic: z.string(),
4318
- level: z.enum(["atom", "molecule", "organism"]),
4319
- exposure: z.enum(EXPOSURES).optional(),
4320
- /** The `@almadar/ui` pattern the behavior is the factory of (`;; @pattern`); absent when it is not one. */
4321
- pattern: z.string().optional(),
4322
- description: z.string(),
4323
- capabilities: z.array(z.string()),
4324
- /** The behavior's traits as ready-to-bind values. */
4325
- traits: z.array(TraitValueSchema),
4326
- /** The behavior as a value (`.lolo` type `behavior`), ready to embed or store. */
4327
- value: BehaviorRefSchema,
4328
- /** Shipped embedding vectors, keyed by facet (`description`, `capabilities`). */
4329
- vectors: z.record(z.string(), VectorSchema),
4330
- /** The embedding model the vectors were stamped with. */
4331
- model: z.string()
4332
- }).strict();
4333
- var TraitKnobSchema = z.object({
4334
- key: z.string(),
4335
- type: z.string(),
4336
- default: TraitConfigValueSchema.optional(),
4337
- label: z.string().optional(),
4338
- description: z.string().optional(),
4339
- tier: z.string().optional(),
4340
- vector: VectorSchema.optional()
4341
- }).strict();
4342
- var TraitEventsSchema = z.object({
4343
- emits: z.array(z.string()),
4344
- listens: z.array(z.string()),
4345
- transitions: z.array(z.string()),
4346
- domain: z.array(z.string()).optional()
4347
- }).strict();
4348
- var TraitMachineObject = z.object({
4349
- linkedEntity: z.string().optional(),
4350
- stateMachine: StateMachineSchema
4351
- }).strict();
4352
- var TraitMachineSchema = TraitMachineObject;
4353
- var TraitSourceSchema = z.object({
4354
- text: z.string(),
4355
- transitions: z.array(z.object({ index: z.number().int(), start: z.number().int(), end: z.number().int() }).strict())
4356
- }).strict();
4357
- var TraitDescriptionObject = z.object({
4358
- value: TraitValueSchema,
4359
- knobs: z.array(TraitKnobSchema),
4360
- events: TraitEventsSchema,
4361
- machine: TraitMachineSchema.optional(),
4362
- source: TraitSourceSchema.optional(),
4363
- model: z.string()
4364
- }).strict();
4365
- var TraitDescriptionSchema = TraitDescriptionObject;
4366
- var DescribeTargetSchema = z.union([TraitValueSchema, OrbitalValueSchema, BehaviorRefSchema]);
4367
- var KnobFieldSchema = z.lazy(
4368
- () => z.object({
4369
- name: z.string(),
4370
- type: z.string(),
4371
- required: z.boolean().optional(),
4372
- values: z.array(z.string()).optional(),
4373
- properties: z.array(KnobFieldSchema).optional(),
4374
- default: TraitConfigValueSchema.optional(),
4375
- label: z.string().optional(),
4376
- description: z.string().optional(),
4377
- synonyms: z.string().optional(),
4378
- tier: z.string().optional(),
4379
- forwardedFrom: z.string().optional()
4380
- }).strict()
4381
- );
4382
- var OrbitalDescriptionSchema = z.object({
4383
- value: OrbitalValueSchema,
4384
- config: DeclaredTraitConfigSchema,
4385
- knobs: z.array(KnobFieldSchema),
4386
- entity: z.object({ name: z.string(), fields: z.array(EntityFieldSchema), identity: z.boolean().optional(), persistence: EntityPersistenceSchema.optional() }).strict().optional(),
4387
- /** Entities a sibling orbital owns that this one references: what an import of it maps through `entities {}`. */
4388
- borrows: z.array(z.string()),
4389
- /** What the orbital needs from its siblings at runtime, derived by `orb` (identity, entities, pages, events). */
4390
- expects: z.array(ExpectDeclarationSchema),
4391
- traits: z.array(z.object({
4392
- trait: z.string(),
4393
- config: DeclaredTraitConfigSchema,
4394
- knobs: z.array(KnobFieldSchema),
4395
- events: TraitEventsSchema,
4396
- /** Declared `-> @rebindable`: the trait may be bound to another record. */
4397
- rebindable: z.boolean().optional(),
4398
- /** The upstream trait this one composes (`trait X = Alias.traits.Y`), as written; absent for a trait the behavior defines itself. */
4399
- ref: z.string().optional(),
4400
- /** The trait's declared `@capabilities` tags. */
4401
- capabilities: z.array(z.string()).optional()
4402
- }).strict()),
4403
- /** Each page with the traits it mounts: what the behavior declares as standing on its own. */
4404
- pages: z.array(z.object({ name: z.string(), path: z.string(), traits: z.array(z.string()).optional(), label: z.string().optional(), icon: z.string().optional() }).strict()),
4405
- /** Controls the orbital leaves for an embedding organism (`emitsScope external`) that nothing in it handles: an importer must route each. */
4406
- forwards: z.array(z.object({ trait: z.string(), event: z.string(), via: z.array(z.string()) }).strict()).optional()
4407
- }).strict();
4408
- var BehaviorDescriptionSchema = z.object({
4409
- behavior: z.string(),
4410
- config: DeclaredTraitConfigSchema,
4411
- knobs: z.array(KnobFieldSchema),
4412
- orbitals: z.array(OrbitalDescriptionSchema),
4413
- /** The behaviors this one imports (`uses … from`): what it already contains. */
4414
- uses: z.array(z.string()).optional()
4415
- }).strict();
4416
- var EVAL_TIERS = ["none", "organism", "subset", "compose", "substrate", "free"];
4417
- function validPattern(p) {
4418
- try {
4419
- new RegExp(p.pattern, p.flags);
4420
- return true;
4421
- } catch {
4422
- return false;
4423
- }
4424
- }
4425
- var EvalPatternSchema = z.object({ pattern: z.string(), flags: z.string().optional() }).strict().refine(validPattern, { message: "pattern is not a valid regular expression" });
4426
- var EvalPredicateSchema = z.discriminatedUnion("kind", [
4427
- z.object({ kind: z.literal("entity") }).strict(),
4428
- z.object({ kind: z.literal("field"), required: z.boolean().optional() }).strict(),
4429
- z.object({ kind: z.literal("enumValue"), value: EvalPatternSchema }).strict(),
4430
- z.object({ kind: z.literal("roleGated") }).strict(),
4431
- z.object({ kind: z.literal("ownerScoped"), by: EvalPatternSchema.optional() }).strict(),
4432
- z.object({ kind: z.literal("feeds"), with: EvalPatternSchema }).strict(),
4433
- z.object({ kind: z.literal("notifies") }).strict(),
4434
- z.object({ kind: z.literal("input") }).strict(),
4435
- z.object({ kind: z.literal("agent") }).strict(),
4436
- z.object({ kind: z.literal("route"), path: z.string() }).strict(),
4437
- z.object({ kind: z.literal("rendered"), route: z.string().optional(), on: EvalPatternSchema.optional() }).strict(),
4438
- z.object({ kind: z.literal("absentText"), words: z.array(z.string()) }).strict(),
4439
- z.object({ kind: z.literal("absentEntity") }).strict(),
4440
- z.object({ kind: z.literal("orbital"), absent: z.boolean().optional() }).strict(),
4441
- z.object({ kind: z.literal("knob"), key: z.string().min(1), value: JsonValueSchema }).strict()
4442
- ]);
4443
- var EvalCheckSchema = z.object({
4444
- id: z.string().min(1),
4445
- introducedTurn: z.number().int().min(0),
4446
- nouns: EvalPatternSchema,
4447
- require: z.array(EvalPredicateSchema),
4448
- frameRoutes: z.array(z.string()).optional(),
4449
- coversDeclines: z.array(z.string()).optional()
4450
- }).strict();
4451
- var EvalSpecSchema = z.object({
4452
- id: z.string().min(1),
4453
- class: z.enum(["plain", "specific", "complex"]),
4454
- description: z.string().optional(),
4455
- turns: z.tuple([z.string()]).rest(z.string()),
4456
- checks: z.array(EvalCheckSchema),
4457
- expect: z.object({
4458
- tiers: z.array(z.enum(EVAL_TIERS)).optional(),
4459
- adopts: z.array(z.string()).optional(),
4460
- orbitals: z.array(z.string()).optional(),
4461
- validates: z.boolean().optional()
4462
- }).strict().optional(),
4463
- forbidSources: z.array(z.string()).optional()
4464
- }).strict().superRefine((spec, ctx) => {
4465
- for (const [i, check] of spec.checks.entries()) {
4466
- if (check.introducedTurn >= spec.turns.length) {
4467
- ctx.addIssue({ code: "custom", path: ["checks", i, "introducedTurn"], message: `introducedTurn ${check.introducedTurn} is past the spec's ${spec.turns.length} turns` });
4468
- }
4469
- }
4470
- });
4471
- function parseEvalSpec(input) {
4472
- const parsed = EvalSpecSchema.safeParse(input);
4473
- if (parsed.success) return parsed.data;
4474
- throw new Error(`invalid eval spec: ${parsed.error.issues.map((i) => `${i.path.join(".") || "(root)"}: ${i.message}`).join("; ")}`);
4475
- }
4476
- function evalPatternMatches(p, text) {
4477
- return new RegExp(p.pattern, p.flags).test(text);
4478
- }
4479
-
4480
- // src/types/tab-port.ts
4481
- var TabHostFailure = class extends Error {
4482
- constructor(kind, message) {
4483
- super(message);
4484
- this.kind = kind;
4485
- this.name = "TabHostFailure";
4486
- }
4487
- };
4488
- var ClientThemeSchema = z.object({
4489
- name: z.string().min(1),
4490
- displayName: z.string(),
4491
- hasLightMode: z.boolean(),
4492
- hasDarkMode: z.boolean()
4493
- }).strict();
4494
- var ClientManifestSchema = z.object({
4495
- locale: z.string().min(1),
4496
- direction: z.enum(["ltr", "rtl"]),
4497
- themes: z.array(ClientThemeSchema),
4498
- defaultTheme: z.string().min(1).nullable(),
4499
- defaultMode: z.enum(["light", "dark"]),
4500
- language: z.boolean()
4501
- }).strict();
4502
- function parseClientManifest(value) {
4503
- return ClientManifestSchema.parse(value);
4504
- }
4505
- var PayloadSlotSchema = z.object({
4506
- name: z.string(),
4507
- type: z.string(),
4508
- required: z.boolean(),
4509
- values: z.array(z.string()).optional(),
4510
- entity: z.string().optional()
4511
- });
4512
- var MachineRowSchema = z.object({
4513
- orbital: z.string(),
4514
- trait: z.string(),
4515
- from: z.string(),
4516
- event: z.string(),
4517
- to: z.string(),
4518
- guarded: z.boolean(),
4519
- payload: z.array(PayloadSlotSchema)
4520
- });
4521
- var EvalPathSchema = z.array(z.union([z.number(), z.string()]));
4522
- var EvalStepWireSchema = z.object({
4523
- kind: z.enum(["enter", "exit", "iter", "skip"]),
4524
- path: EvalPathSchema,
4525
- value: JsonValueSchema.optional(),
4526
- error: z.string().optional()
4527
- });
4528
- var PlayedEffectSchema = z.object({
4529
- type: z.string(),
4530
- args: z.array(JsonValueSchema),
4531
- status: z.enum(["executed", "failed", "skipped"]),
4532
- error: z.string().optional(),
4533
- routed: z.boolean()
4534
- });
4535
- var PropositionBindingsSchema = z.object({
4536
- entity: JsonValueSchema,
4537
- fromEntity: JsonValueSchema,
4538
- payload: JsonValueSchema
4539
- });
4540
- var PlayedEnsuresSchema = z.object({
4541
- proposition: JsonValueSchema,
4542
- verdict: z.enum(["held", "broken", "inconclusive"]),
4543
- reason: z.string().optional(),
4544
- counterexample: PropositionBindingsSchema.optional()
4545
- });
4546
- var PlayedEmitSchema = z.object({
4547
- type: z.string(),
4548
- payload: EventPayloadSchema.optional(),
4549
- timestamp: z.number()
4550
- });
4551
- var PlayedGuardSchema = z.object({
4552
- arm: z.number(),
4553
- guard: JsonValueSchema,
4554
- passed: z.boolean(),
4555
- trace: z.array(EvalStepWireSchema),
4556
- error: z.string().optional()
4557
- });
4558
- var EntityBindingSchema = z.object({
4559
- kind: z.enum(["none", "absent", "malformed", "inline", "named", "payload-unresolved", "context-unresolved"]),
4560
- entity: z.string(),
4561
- rows: z.number(),
4562
- readGated: z.boolean()
4563
- });
4564
- var TraitRefSchema2 = z.object({
4565
- name: z.string(),
4566
- resolved: z.boolean(),
4567
- overlayOnly: z.boolean()
4568
- });
4569
- var RenderedNodeSchema = z.object({
4570
- pattern: z.string(),
4571
- dynamic: z.boolean(),
4572
- supported: z.boolean(),
4573
- stub: z.boolean(),
4574
- binding: EntityBindingSchema,
4575
- traitRefs: z.array(TraitRefSchema2)
4576
- });
4577
- var RenderedSlotSchema = z.object({
4578
- slot: z.string(),
4579
- sourceTrait: z.string(),
4580
- ownerEntity: z.string(),
4581
- nodes: z.array(RenderedNodeSchema)
4582
- });
4583
- var PlayedStateSchema = z.object({ before: z.string().nullable(), after: z.string().nullable() });
4584
- var PlayedResultSchema = z.object({
4585
- trait: z.string(),
4586
- event: z.string(),
4587
- transitionFired: z.boolean(),
4588
- guard: z.enum(["pass", "fail", "none"]),
4589
- firedArm: z.number().optional(),
4590
- state: PlayedStateSchema,
4591
- effects: z.array(PlayedEffectSchema),
4592
- emitted: z.array(PlayedEmitSchema),
4593
- guards: z.array(PlayedGuardSchema),
4594
- ensures: z.array(PlayedEnsuresSchema),
4595
- rendered: z.array(RenderedSlotSchema).optional()
4596
- });
4597
- var PlayedStepSchema = z.object({
4598
- orbital: z.string(),
4599
- trait: z.string(),
4600
- from: z.string(),
4601
- event: z.string(),
4602
- payload: EventPayloadSchema,
4603
- result: PlayedResultSchema
4604
- });
4605
- var ProgramSourceLocationSchema = z.object({
4606
- path: z.string(),
4607
- line: z.number().int().positive(),
4608
- column: z.number().int().positive(),
4609
- length: z.number().int().nonnegative(),
4610
- endLine: z.number().int().positive(),
4611
- endColumn: z.number().int().positive(),
4612
- exact: z.boolean(),
4613
- scopeEndLine: z.number().int().positive().optional(),
4614
- scopeEndColumn: z.number().int().positive().optional(),
4615
- scopeLength: z.number().int().nonnegative().optional()
4616
- });
4617
- var ProgramSourceAnchorSchema = ProgramSourceLocationSchema.extend({
4618
- pointer: z.string(),
4619
- orbitalId: z.string().nullable(),
4620
- traitId: z.string().nullable(),
4621
- originTraitId: z.string()
4622
- });
4623
- var ProgramInspectionSchema = z.object({
4624
- program: OrbitalSchemaSchema,
4625
- authoredProgram: OrbitalSchemaSchema,
4626
- definitions: z.array(z.object({
4627
- traitId: z.string(),
4628
- definitionFingerprint: z.string(),
4629
- sourceDeclaration: SourceDeclarationMetadataSchema.extend({ path: z.string().nullable() }).nullable(),
4630
- sourceCandidates: z.array(z.string())
4631
- })),
4632
- composition: z.array(z.object({ traitId: z.string(), kind: z.enum(["trait-declaration", "orbital-reference"]), authoredPointer: z.string(), traitOverrideKey: z.string().nullable(), binding: JsonValueSchema, source: ProgramSourceLocationSchema.nullable() })),
4633
- sourceMap: z.array(ProgramSourceAnchorSchema),
4634
- imports: z.array(z.object({ path: z.string(), specifier: z.string(), program: z.string(), authoredProgram: OrbitalSchemaSchema })),
4635
- lazy: z.array(JsonValueSchema),
4636
- path: z.string(),
4637
- version: z.number().int().nonnegative().nullable(),
4638
- columnEncoding: z.literal("unicode-scalar"),
4639
- lengthEncoding: z.literal("utf-8-bytes"),
4640
- lineBase: z.literal(1),
4641
- columnBase: z.literal(1)
4642
- });
4643
-
4644
- export { A11Y_ATTRIBUTES, ACCESSIBLE_NAME_ATTRIBUTES, ACTION_OVERFLOW_TESTID, ACTION_TESTID_PREFIX, ARIA_CURRENT, ARIA_LIVE, ARIA_PRESSED, ARIA_ROLES, AriaRoleSchema, AwaitRenderSchema, BINDING_CONTEXT_RULES, BINDING_DOCS, BINDING_ROOTS, BehaviorBridgeSchema, BehaviorDescriptionSchema, BehaviorRefOverridesSchema, BehaviorRefSchema, BehaviorValueSchema, BindingSchema, CALL_KINDS, CONFIG_REF_EVENT_PATTERN, CatalogEntrySchema, CatalogScopeSchema, ClientManifestSchema, ClientThemeSchema, ComputedEventContractSchema, ComputedEventListenerSchema, ConfigFieldDeclarationSchema, ConfigProvenanceRecordSchema, DEFAULT_INTERACTION_MODELS, DESKTOP_KINDS, DIAGRAM_STROKE_WEIGHTS, DIAGRAM_TEXT_CASES, DIAGRAM_TEXT_SIZES, DIAGRAM_TONES, DIAGRAM_TONE_COLOR_KEYS, DeclaredTraitConfigSchema, DeploymentSchema, DescribeTargetSchema, DesktopKindSchema, DiagramStrokeWeightSchema, DiagramTextCaseSchema, DiagramTextSizeSchema, DiagramToneSchema, DispatchMemory, DispatchModeSchema, DispatchVisits, EMPTY_STATE_MARKER, EVAL_TIERS, EntityCallSchema, EntityFieldContractSchema, EntityRefSchema, EntityRefStringSchema, EvalSpecSchema, EventListenerSchema, EventPayloadFieldSchema, EventSchema, EventScopeSchema, EventSourceSchema, ExpectDeclarationSchema, ExpectationDiagnosticSchema, FORM_PATTERN, FS_MODES, FsGrantSchema, FsModeSchema, GESTURE_EVENT_PROPS, GuardSchema, HOST_SIGN_IN_ROUTE, InteractionModelSchema, KNOWN_VALIDATION_ERROR_CODES, KnobFieldSchema, LOADING_STATE_MARKER, LOG_SEVERITIES, LazyPageSchema, ListenSourceSchema, MachineRowSchema, McpServiceDefSchema, NATIVE_ID_PREFIX, NATIVE_ID_SEPARATOR, NET_KINDS, NetGrantSchema, NetKindSchema, OrbitalDefinitionSchema, OrbitalDescriptionSchema, OrbitalOverridesSchema, OrbitalPageSchema, OrbitalPageStrictSchema, OrbitalRefObjectSchema, OrbitalRefStringSchema, OrbitalSchema, OrbitalSchemaSchema, OrbitalTraitRefSchema, OrbitalUnitSchema, OrbitalValueSchema, OrbitalValueSiblingSchema, OrbitalValueUseSchema, OrganismExpectationsSchema, OsGrantsSchema, PATTERN_PROP_TYPE_ERROR_TESTID, PageAccessSchema, PageIndexingSchema, PageMetaSchema, PageModifiersSchema, PageRefObjectSchema, PageRefSchema, PageRefStringSchema, PageSchema, PageTraitRefSchema, PatternTypeSchema, PayloadFieldSchema, PayloadSlotSchema, PayloadTypeWhenSchema, PlayedStepSchema, ProgramInspectionSchema, ProgramSourceAnchorSchema, ProgramSourceLocationSchema, ProtocolSideSchema, ProtocolSpecSchema, REFERENCE_CONFIG_TYPES, RENDER_BINDING_MARKER, ROUTE_PROTOCOL, RequiredFieldSchema, RestAuthConfigSchema, RestServiceDefSchema, SECRET_CONFIG_TYPES, SEMANTIC_CHANGE_KINDS, SERVICE_TYPES, SKELETON_VARIANTS, STDIO_KINDS, SURFACE_MODES, SYS_KINDS, SchemaMetadataSchema, ServiceDefinitionSchema, ServiceRefObjectSchema, ServiceRefSchema, ServiceRefStringSchema, ServiceTypeSchema, SiteMetaSchema, SkeletonNodeSchema, SkeletonShapeSchema, SkeletonSpecSchema, SkeletonVariantSchema, SocketEventsSchema, SocketServiceDefSchema, StateMachineSchema, StateSchema, StdioKindSchema, SysKindSchema, TAB_INDEX_VALUES, TEXT_DIRECTIONS, TRAIT_MOUNT_ERROR_TESTID, TabHostFailure, TickIntervalSchema, TraitConfigSchema, TraitConfigValueSchema, TraitDataEntitySchema, TraitDescriptionSchema, TraitDispatchModeSchema, TraitEntityFieldSchema, TraitEventContractSchema, TraitEventListenerSchema, TraitEventsSchema, TraitFieldRefSchema, TraitKnobSchema, TraitMachineSchema, TraitOverridesSchema, TraitRefSchema, TraitReferenceSchema, TraitSchema, TraitSourceSchema, TraitTickSchema, TraitUIBindingSchema, TraitValueSchema, TransitionSchema, UseDeclarationSchema, VERIFICATION_DOM_ATTRS, ViewTypeSchema, actionTestId, actionTestIdMatches, applyBehaviorOverrides, applyBehaviorRefOverrides, applyOrbitalOverrides, applyTraitOverrides, behaviorRef, canonicalJson, configRefEventKnob, containsEntityBinding, containsPayloadBinding, createEmptyResolvedPage, createEmptyResolvedTrait, createLazyService, createResolvedField, createTypedEventBus, credentialStatusConnected, credentialStorageKey, dispatchScopeOf, dispatchVisitKey, evalPatternMatches, expectedEntityName, findService, formatBehaviorValueLiteral, formatOrbitalValueLiteral, formatTraitValueLiteral, gestureActionTestId, gestureOfActionTestId, getBindingExamples, getInteractionModelForDomain, getServiceNames, getTraitConfig, getTraitName, guardHolds, hasService, inferTsType, inlineTraitRefs, isAriaRole, isBehaviorRefValue, isCallRecord, isCallSiteConfigDeclaration, isCircuitEvent, isConfigFieldSchema, isConfigRedeclaration, isEntityCall, isEntityReference, isEntityReferenceAny, isHostSignInRoute, isImportedTraitRef, isInlineTrait, isKnownValidationErrorCode, isMcpService, isOrbitalDefinition, isOrbitalValue, isPageReference, isPageReferenceObject, isPageReferenceString, isPlanSnapshot, isReferenceConfigType, isRenderBindingMarker, isResolvedIR, isRestService, isRoutePage, isSecretConfigType, isServiceReference, isServiceReferenceObject, isSessionHistoryEntry, isSocketService, isStructuredLogEntry, isTraitFieldRef, isTraitValue, joinEventAddress, maskSecretConfigValues, mergeCallSiteConfigOverrides, nativeFieldId, nativeIds, nativePatternId, nativeRowId, nativeSlotId, normalizeCallSiteConfigToValues, normalizeTraitRef, orbitalIndexOfValidationPath, overrideDeclaredKnobs, parseBehaviorValueLiteral, parseClientManifest, parseEntityRef, parseEvalSpec, parseFetchOrder, parseImportedTraitRef, parseOrbitalRef, parseOrbitalSchema, parseOrbitalValueLiteral, parsePageRef, parseServiceRef, parseTraitValueLiteral, payloadTypeContainer, protocolName, resolveConfigRefEventName, resolveCredentialStatusIdentity, resolvePageMeta, safeParseOrbitalSchema, splitEventAddress, splitNativeIds, toBindingRoot, unionOsGrants, unwrapTraitRef, validateBindingInContext, widenTier };
4645
- //# sourceMappingURL=chunk-45I2O4SJ.js.map
4646
- //# sourceMappingURL=chunk-45I2O4SJ.js.map