@almadar/core 10.29.0 → 10.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{builders-DcBjE_Uw.d.ts → builders-DDcCVboe.d.ts} +2567 -906
- package/dist/builders.d.ts +3 -3
- package/dist/builders.js +161 -17
- package/dist/builders.js.map +1 -1
- package/dist/factory/index.d.ts +5 -4
- package/dist/factory-runtime/index.d.ts +63 -18
- package/dist/factory-runtime/index.js +202 -94
- package/dist/factory-runtime/index.js.map +1 -1
- package/dist/index.d.ts +8 -9
- package/dist/index.js +1308 -592
- package/dist/index.js.map +1 -1
- package/dist/{pattern-types-JZordBZv.d.ts → pattern-types-VDIr2TkX.d.ts} +375 -48
- package/dist/patterns/component-mapping.json +13 -3
- package/dist/patterns/event-contracts.json +10 -3
- package/dist/patterns/index.d.ts +2167 -787
- package/dist/patterns/index.js +1063 -563
- package/dist/patterns/index.js.map +1 -1
- package/dist/patterns/patterns-registry.json +995 -554
- package/dist/patterns/registry.json +995 -554
- package/dist/{trait-B_CzfDSi.d.ts → trait-DE6VU4Cd.d.ts} +507 -128
- package/dist/types/index.d.ts +47 -19
- package/dist/types/index.js +222 -24
- package/dist/types/index.js.map +1 -1
- package/dist/{types-CGC5A1-T.d.ts → types-DSfz2mr5.d.ts} +3 -59
- package/package.json +1 -1
package/dist/types/index.js
CHANGED
|
@@ -1,6 +1,165 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
3
|
// src/types/orbital.ts
|
|
4
|
+
var ID_PREFIXES = {
|
|
5
|
+
orbital: "orb_",
|
|
6
|
+
entity: "ent_",
|
|
7
|
+
trait: "trt_",
|
|
8
|
+
event: "evt_",
|
|
9
|
+
page: "pag_",
|
|
10
|
+
service: "svc_",
|
|
11
|
+
theme: "thm_",
|
|
12
|
+
palette: "pal_"
|
|
13
|
+
};
|
|
14
|
+
function brand(value) {
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
function makeIdKind(kind) {
|
|
18
|
+
const prefix = ID_PREFIXES[kind];
|
|
19
|
+
const is = (value) => value.startsWith(prefix) && value.length > prefix.length;
|
|
20
|
+
const as = (value) => {
|
|
21
|
+
if (!is(value)) {
|
|
22
|
+
throw new Error(
|
|
23
|
+
`Expected ${kind} id (prefix "${prefix}"), got: ${JSON.stringify(value)}`
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
return brand(value);
|
|
27
|
+
};
|
|
28
|
+
return { prefix, is, as };
|
|
29
|
+
}
|
|
30
|
+
var orbitalKind = makeIdKind("orbital");
|
|
31
|
+
var entityKind = makeIdKind("entity");
|
|
32
|
+
var traitKind = makeIdKind("trait");
|
|
33
|
+
var eventKind = makeIdKind("event");
|
|
34
|
+
var pageKind = makeIdKind("page");
|
|
35
|
+
var serviceKind = makeIdKind("service");
|
|
36
|
+
var themeKind = makeIdKind("theme");
|
|
37
|
+
var paletteKind = makeIdKind("palette");
|
|
38
|
+
var isOrbitalId = orbitalKind.is;
|
|
39
|
+
var asOrbitalId = orbitalKind.as;
|
|
40
|
+
var isEntityId = entityKind.is;
|
|
41
|
+
var asEntityId = entityKind.as;
|
|
42
|
+
var isTraitId = traitKind.is;
|
|
43
|
+
var asTraitId = traitKind.as;
|
|
44
|
+
var isEventId = eventKind.is;
|
|
45
|
+
var asEventId = eventKind.as;
|
|
46
|
+
var isPageId = pageKind.is;
|
|
47
|
+
var asPageId = pageKind.as;
|
|
48
|
+
var isServiceId = serviceKind.is;
|
|
49
|
+
var asServiceId = serviceKind.as;
|
|
50
|
+
var isThemeId = themeKind.is;
|
|
51
|
+
var asThemeId = themeKind.as;
|
|
52
|
+
var isPaletteEntryId = paletteKind.is;
|
|
53
|
+
var asPaletteEntryId = paletteKind.as;
|
|
54
|
+
function idPrefix(kind) {
|
|
55
|
+
return ID_PREFIXES[kind];
|
|
56
|
+
}
|
|
57
|
+
function idKindOf(id) {
|
|
58
|
+
for (const kind of Object.keys(ID_PREFIXES)) {
|
|
59
|
+
const prefix = ID_PREFIXES[kind];
|
|
60
|
+
if (id.startsWith(prefix) && id.length > prefix.length) return kind;
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
65
|
+
var TIME_LEN = 10;
|
|
66
|
+
var RANDOM_LEN = 16;
|
|
67
|
+
function randomBytes(len) {
|
|
68
|
+
const g = globalThis;
|
|
69
|
+
if (g.crypto?.getRandomValues) {
|
|
70
|
+
return g.crypto.getRandomValues(new Uint8Array(len));
|
|
71
|
+
}
|
|
72
|
+
throw new Error("mintId: no crypto.getRandomValues available in this runtime");
|
|
73
|
+
}
|
|
74
|
+
function encodeTime(now) {
|
|
75
|
+
let value = now;
|
|
76
|
+
let out = "";
|
|
77
|
+
for (let i = 0; i < TIME_LEN; i++) {
|
|
78
|
+
const mod = value % 32;
|
|
79
|
+
out = CROCKFORD[mod] + out;
|
|
80
|
+
value = (value - mod) / 32;
|
|
81
|
+
}
|
|
82
|
+
return out;
|
|
83
|
+
}
|
|
84
|
+
function encodeRandom() {
|
|
85
|
+
const bytes = randomBytes(RANDOM_LEN);
|
|
86
|
+
let out = "";
|
|
87
|
+
for (let i = 0; i < RANDOM_LEN; i++) {
|
|
88
|
+
out += CROCKFORD[bytes[i] & 31];
|
|
89
|
+
}
|
|
90
|
+
return out;
|
|
91
|
+
}
|
|
92
|
+
function ulid() {
|
|
93
|
+
return encodeTime(Date.now()) + encodeRandom();
|
|
94
|
+
}
|
|
95
|
+
function mintId(kind) {
|
|
96
|
+
return brand(ID_PREFIXES[kind] + ulid());
|
|
97
|
+
}
|
|
98
|
+
function ledgerResolveName(ledger, kind, name) {
|
|
99
|
+
for (const [id, entry] of Object.entries(ledger.entries)) {
|
|
100
|
+
if (entry.kind === kind && entry.curName === name) return id;
|
|
101
|
+
}
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
function ledgerRename(ledger, id, to, at) {
|
|
105
|
+
const entry = ledger.entries[id];
|
|
106
|
+
if (entry === void 0) return ledger;
|
|
107
|
+
const updated = {
|
|
108
|
+
...entry,
|
|
109
|
+
curName: to,
|
|
110
|
+
renames: [...entry.renames, { from: entry.curName, to, at }]
|
|
111
|
+
};
|
|
112
|
+
return { ...ledger, entries: { ...ledger.entries, [id]: updated } };
|
|
113
|
+
}
|
|
114
|
+
function ledgerCurName(ledger, id) {
|
|
115
|
+
return ledger.entries[id]?.curName ?? null;
|
|
116
|
+
}
|
|
117
|
+
var OrbitalIdSchema = z.string().refine(isOrbitalId, { message: `Expected an orbital id (prefix "${ID_PREFIXES.orbital}")` });
|
|
118
|
+
var EntityIdSchema = z.string().refine(isEntityId, { message: `Expected an entity id (prefix "${ID_PREFIXES.entity}")` });
|
|
119
|
+
var TraitIdSchema = z.string().refine(isTraitId, { message: `Expected a trait id (prefix "${ID_PREFIXES.trait}")` });
|
|
120
|
+
var EventIdSchema = z.string().refine(isEventId, { message: `Expected an event id (prefix "${ID_PREFIXES.event}")` });
|
|
121
|
+
var PageIdSchema = z.string().refine(isPageId, { message: `Expected a page id (prefix "${ID_PREFIXES.page}")` });
|
|
122
|
+
var ServiceIdSchema = z.string().refine(isServiceId, { message: `Expected a service id (prefix "${ID_PREFIXES.service}")` });
|
|
123
|
+
var ThemeIdSchema = z.string().refine(isThemeId, { message: `Expected a theme id (prefix "${ID_PREFIXES.theme}")` });
|
|
124
|
+
var PaletteEntryIdSchema = z.string().refine(isPaletteEntryId, { message: `Expected a palette-entry id (prefix "${ID_PREFIXES.palette}")` });
|
|
125
|
+
var LedgerKindSchema = z.enum([
|
|
126
|
+
"orbital",
|
|
127
|
+
"entity",
|
|
128
|
+
"trait",
|
|
129
|
+
"event",
|
|
130
|
+
"page",
|
|
131
|
+
"service",
|
|
132
|
+
"theme"
|
|
133
|
+
]);
|
|
134
|
+
var LedgerEntrySchema = z.object({
|
|
135
|
+
id: z.string(),
|
|
136
|
+
kind: LedgerKindSchema,
|
|
137
|
+
bakedName: z.string(),
|
|
138
|
+
curName: z.string(),
|
|
139
|
+
renames: z.array(
|
|
140
|
+
z.object({ from: z.string(), to: z.string(), at: z.string() })
|
|
141
|
+
),
|
|
142
|
+
owner: z.enum(["std", "io", "workspace"]),
|
|
143
|
+
parent: TraitIdSchema.optional()
|
|
144
|
+
});
|
|
145
|
+
var IdentityLedgerSchema = z.object({
|
|
146
|
+
schemaVersion: z.literal(1),
|
|
147
|
+
entries: z.record(LedgerEntrySchema)
|
|
148
|
+
});
|
|
149
|
+
var JsonValueSchema = z.lazy(
|
|
150
|
+
() => z.union([z.string(), z.number(), z.boolean(), z.null(), z.array(JsonValueSchema), z.record(JsonValueSchema)])
|
|
151
|
+
);
|
|
152
|
+
function isJsonPrimitive(value) {
|
|
153
|
+
return value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
154
|
+
}
|
|
155
|
+
function isJsonObject(value) {
|
|
156
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
157
|
+
}
|
|
158
|
+
function isJsonArray(value) {
|
|
159
|
+
return Array.isArray(value);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// src/types/field.ts
|
|
4
163
|
var FieldTypeSchema = z.enum([
|
|
5
164
|
"string",
|
|
6
165
|
"number",
|
|
@@ -25,6 +184,7 @@ var RelationCardinalitySchema = z.enum([
|
|
|
25
184
|
]);
|
|
26
185
|
var RelationConfigSchema = z.object({
|
|
27
186
|
entity: z.string().min(1, "Target entity is required"),
|
|
187
|
+
entityId: EntityIdSchema.optional(),
|
|
28
188
|
field: z.string().optional(),
|
|
29
189
|
cardinality: RelationCardinalitySchema.optional(),
|
|
30
190
|
onDelete: z.enum(["cascade", "nullify", "restrict"]).optional(),
|
|
@@ -35,6 +195,7 @@ var RelationConfigSchema = z.object({
|
|
|
35
195
|
}).transform((data) => {
|
|
36
196
|
const normalized = {
|
|
37
197
|
entity: data.entity || data.target || "",
|
|
198
|
+
entityId: data.entityId,
|
|
38
199
|
cardinality: data.cardinality || data.type,
|
|
39
200
|
field: data.field,
|
|
40
201
|
onDelete: data.onDelete
|
|
@@ -62,7 +223,7 @@ var EntityFieldSchema = z.lazy(() => {
|
|
|
62
223
|
const baseFieldShape = {
|
|
63
224
|
name: z.string().min(1, "Field name is required").optional(),
|
|
64
225
|
required: z.boolean().optional(),
|
|
65
|
-
default:
|
|
226
|
+
default: JsonValueSchema.optional(),
|
|
66
227
|
format: FieldFormatSchema.optional(),
|
|
67
228
|
min: z.number().optional(),
|
|
68
229
|
max: z.number().optional(),
|
|
@@ -526,6 +687,7 @@ var PayloadFieldSchema = z.object({
|
|
|
526
687
|
});
|
|
527
688
|
var EventSchema = z.object({
|
|
528
689
|
key: z.string().min(1, "Event key is required"),
|
|
690
|
+
id: EventIdSchema.optional(),
|
|
529
691
|
name: z.string().min(1, "Event name is required"),
|
|
530
692
|
description: z.string().optional(),
|
|
531
693
|
synonyms: z.string().optional(),
|
|
@@ -543,6 +705,7 @@ var TransitionSchema = z.object({
|
|
|
543
705
|
from: z.string().min(1, "Transition source state is required"),
|
|
544
706
|
to: z.string().min(1, "Transition target state is required"),
|
|
545
707
|
event: z.string().min(1, "Transition event is required"),
|
|
708
|
+
eventId: EventIdSchema.optional(),
|
|
546
709
|
guard: ExpressionSchema.nullish(),
|
|
547
710
|
effects: z.array(EffectSchema).optional(),
|
|
548
711
|
description: z.string().nullish()
|
|
@@ -593,6 +756,10 @@ function normalizeCallSiteConfigToValues(config) {
|
|
|
593
756
|
}
|
|
594
757
|
return hasAny ? out : void 0;
|
|
595
758
|
}
|
|
759
|
+
var REFERENCE_CONFIG_TYPES = ["entity", "trait", "event"];
|
|
760
|
+
function isReferenceConfigType(type) {
|
|
761
|
+
return REFERENCE_CONFIG_TYPES.includes(type);
|
|
762
|
+
}
|
|
596
763
|
var ConfigFieldItemsDeclarationSchema = z.lazy(
|
|
597
764
|
() => z.object({
|
|
598
765
|
type: z.string().optional(),
|
|
@@ -603,6 +770,7 @@ var ConfigFieldItemsDeclarationSchema = z.lazy(
|
|
|
603
770
|
var ConfigFieldDeclarationSchema = z.object({
|
|
604
771
|
type: z.string(),
|
|
605
772
|
default: TraitConfigValueSchema.optional(),
|
|
773
|
+
refId: z.string().optional(),
|
|
606
774
|
required: z.boolean().optional(),
|
|
607
775
|
label: z.string().optional(),
|
|
608
776
|
description: z.string().optional(),
|
|
@@ -646,7 +814,7 @@ var TraitEntityFieldSchema = z.object({
|
|
|
646
814
|
"enum"
|
|
647
815
|
]),
|
|
648
816
|
required: z.boolean().optional(),
|
|
649
|
-
default:
|
|
817
|
+
default: TraitConfigValueSchema.optional(),
|
|
650
818
|
values: z.array(z.string()).optional(),
|
|
651
819
|
items: ConfigFieldItemsDeclarationSchema.optional(),
|
|
652
820
|
properties: z.lazy(() => z.record(TraitEntityFieldSchema)).optional()
|
|
@@ -668,9 +836,11 @@ var TraitTickSchema = z.object({
|
|
|
668
836
|
interval: z.union([z.literal("frame"), z.number().positive()]),
|
|
669
837
|
appliesTo: z.array(z.string()).optional(),
|
|
670
838
|
pages: z.array(z.string()).optional(),
|
|
839
|
+
pageIds: z.array(PageIdSchema).optional(),
|
|
671
840
|
guard: ExpressionSchema.optional(),
|
|
672
841
|
effects: z.array(EffectSchema).min(1),
|
|
673
|
-
emits: z.array(z.string()).optional()
|
|
842
|
+
emits: z.array(z.string()).optional(),
|
|
843
|
+
emitIds: z.array(EventIdSchema).optional()
|
|
674
844
|
});
|
|
675
845
|
var EventScopeSchema = z.enum(["internal", "external"]);
|
|
676
846
|
var EventPayloadFieldSchema = z.object({
|
|
@@ -720,6 +890,7 @@ var TraitEventContractSchema = z.object({
|
|
|
720
890
|
/^([A-Za-z][A-Za-z0-9_]*|@config\.[A-Za-z_][A-Za-z0-9_]*)$/,
|
|
721
891
|
"Event name must start with a letter and contain only letters, digits, and underscores, or be a `@config.<knob>` reference"
|
|
722
892
|
),
|
|
893
|
+
eventId: EventIdSchema.optional(),
|
|
723
894
|
description: z.string().optional(),
|
|
724
895
|
synonyms: z.string().optional(),
|
|
725
896
|
tier: z.string().optional(),
|
|
@@ -728,16 +899,24 @@ var TraitEventContractSchema = z.object({
|
|
|
728
899
|
});
|
|
729
900
|
var ListenSourceSchema = z.union([
|
|
730
901
|
z.object({ kind: z.literal("any") }),
|
|
731
|
-
z.object({
|
|
902
|
+
z.object({
|
|
903
|
+
kind: z.literal("trait"),
|
|
904
|
+
trait: z.string().min(1),
|
|
905
|
+
traitId: TraitIdSchema.optional()
|
|
906
|
+
}),
|
|
732
907
|
z.object({
|
|
733
908
|
kind: z.literal("orbital"),
|
|
734
909
|
orbital: z.string().min(1),
|
|
735
|
-
trait: z.string().min(1)
|
|
910
|
+
trait: z.string().min(1),
|
|
911
|
+
orbitalId: OrbitalIdSchema.optional(),
|
|
912
|
+
traitId: TraitIdSchema.optional()
|
|
736
913
|
})
|
|
737
914
|
]);
|
|
738
915
|
var TraitEventListenerSchema = z.object({
|
|
739
916
|
event: z.string().min(1),
|
|
917
|
+
eventId: EventIdSchema.optional(),
|
|
740
918
|
triggers: z.string().min(1),
|
|
919
|
+
triggersId: EventIdSchema.optional(),
|
|
741
920
|
description: z.string().optional(),
|
|
742
921
|
synonyms: z.string().optional(),
|
|
743
922
|
tier: z.string().optional(),
|
|
@@ -753,14 +932,20 @@ var RequiredFieldSchema = z.object({
|
|
|
753
932
|
});
|
|
754
933
|
var TraitReferenceSchema = z.object({
|
|
755
934
|
ref: z.string().min(1),
|
|
935
|
+
refId: TraitIdSchema.optional(),
|
|
936
|
+
// V4 local declaration id (see the interface doc) — declared so the
|
|
937
|
+
// strip-mode zod gate carries it through instead of dropping it.
|
|
938
|
+
id: TraitIdSchema.optional(),
|
|
756
939
|
// Phase 1.2: optional registry path disambiguator, pairs with `ref`.
|
|
757
940
|
from: z.string().optional(),
|
|
758
941
|
linkedEntity: z.string().optional(),
|
|
942
|
+
linkedEntityId: EntityIdSchema.optional(),
|
|
759
943
|
name: z.string().optional(),
|
|
760
944
|
events: z.record(
|
|
761
945
|
z.string().min(1, "events key (atom event name) must be non-empty"),
|
|
762
946
|
z.string().min(1, "events value (caller event name) must be non-empty")
|
|
763
947
|
).optional(),
|
|
948
|
+
eventIds: z.record(z.string().min(1), EventIdSchema).optional(),
|
|
764
949
|
fields: z.record(
|
|
765
950
|
z.string().min(1, "fields key (canonical field name) must be non-empty"),
|
|
766
951
|
z.string().min(1, "fields value (consumer field name) must be non-empty")
|
|
@@ -779,12 +964,11 @@ var TraitReferenceSchema = z.object({
|
|
|
779
964
|
listens: z.array(z.unknown()).optional(),
|
|
780
965
|
emitsScope: z.enum(["internal", "external"]).optional(),
|
|
781
966
|
// Phase F.8: per-transition effects override. The keys are event
|
|
782
|
-
// names (the transition triggers AFTER renames)
|
|
783
|
-
//
|
|
784
|
-
// shape during application, so the schema accepts loose `unknown[]`.
|
|
967
|
+
// names (the transition triggers AFTER renames); values are SExpr
|
|
968
|
+
// effect tuples.
|
|
785
969
|
effects: z.record(
|
|
786
970
|
z.string().min(1, "effects override key (event name) must be non-empty"),
|
|
787
|
-
z.array(
|
|
971
|
+
z.array(SExprSchema)
|
|
788
972
|
).optional()
|
|
789
973
|
}).refine(
|
|
790
974
|
(ref2) => {
|
|
@@ -810,6 +994,7 @@ var SourceBehaviorMetadataSchema = z.object({
|
|
|
810
994
|
originalName: z.string().min(1)
|
|
811
995
|
});
|
|
812
996
|
var TraitSchema = z.object({
|
|
997
|
+
id: TraitIdSchema.optional(),
|
|
813
998
|
name: z.string().min(1),
|
|
814
999
|
description: z.string().optional(),
|
|
815
1000
|
description_visual_prompt: z.string().optional(),
|
|
@@ -821,6 +1006,9 @@ var TraitSchema = z.object({
|
|
|
821
1006
|
capabilities: z.array(z.string()).optional(),
|
|
822
1007
|
scope: TraitScopeSchema,
|
|
823
1008
|
linkedEntity: z.string().optional(),
|
|
1009
|
+
linkedEntityId: EntityIdSchema.optional(),
|
|
1010
|
+
entityRefIds: z.record(z.string().min(1), EntityIdSchema).optional(),
|
|
1011
|
+
traitEmbedIds: z.record(z.string().min(1), TraitIdSchema).optional(),
|
|
824
1012
|
requiredFields: z.array(RequiredFieldSchema).optional(),
|
|
825
1013
|
dataEntities: z.array(TraitDataEntitySchema).optional(),
|
|
826
1014
|
stateMachine: StateMachineSchema.optional(),
|
|
@@ -894,10 +1082,13 @@ var ViewTypeSchema = z.enum([
|
|
|
894
1082
|
]);
|
|
895
1083
|
var PageTraitRefSchema = z.object({
|
|
896
1084
|
ref: z.string().min(1, "Trait ref is required"),
|
|
1085
|
+
refId: TraitIdSchema.optional(),
|
|
897
1086
|
linkedEntity: z.string().optional(),
|
|
1087
|
+
linkedEntityId: EntityIdSchema.optional(),
|
|
898
1088
|
config: TraitConfigSchema.optional()
|
|
899
1089
|
});
|
|
900
1090
|
var OrbitalPageStrictSchema = z.object({
|
|
1091
|
+
id: PageIdSchema.optional(),
|
|
901
1092
|
name: z.string().min(1, "Page name is required"),
|
|
902
1093
|
path: z.string().min(1, "Page path is required").startsWith("/", "Path must start with /"),
|
|
903
1094
|
primaryEntity: z.string().min(1, "Primary entity is required"),
|
|
@@ -905,6 +1096,7 @@ var OrbitalPageStrictSchema = z.object({
|
|
|
905
1096
|
title: z.string().optional()
|
|
906
1097
|
}).strict();
|
|
907
1098
|
var OrbitalPageSchema = z.object({
|
|
1099
|
+
id: PageIdSchema.optional(),
|
|
908
1100
|
name: z.string().min(1, "Page name is required"),
|
|
909
1101
|
path: z.string().min(1, "Page path is required").startsWith("/", "Path must start with /"),
|
|
910
1102
|
viewType: ViewTypeSchema.optional(),
|
|
@@ -1481,11 +1673,14 @@ var PageRefStringSchema = z.string().regex(
|
|
|
1481
1673
|
);
|
|
1482
1674
|
var PageRefObjectSchema = z.object({
|
|
1483
1675
|
ref: PageRefStringSchema,
|
|
1676
|
+
refId: PageIdSchema.optional(),
|
|
1484
1677
|
// Phase 1.2: optional registry path disambiguator, pairs with `ref`.
|
|
1485
1678
|
from: z.string().optional(),
|
|
1486
1679
|
path: z.string().startsWith("/").optional(),
|
|
1487
1680
|
linkedEntity: z.string().optional(),
|
|
1488
|
-
|
|
1681
|
+
linkedEntityId: EntityIdSchema.optional(),
|
|
1682
|
+
traits: z.array(TraitRefSchema).optional(),
|
|
1683
|
+
traitRefIds: z.array(TraitIdSchema).optional()
|
|
1489
1684
|
});
|
|
1490
1685
|
var PageRefSchema = z.union([
|
|
1491
1686
|
PageSchema,
|
|
@@ -1539,6 +1734,7 @@ var ComputedEventListenerSchema = z.object({
|
|
|
1539
1734
|
payloadMapping: z.record(z.string()).optional()
|
|
1540
1735
|
});
|
|
1541
1736
|
var OrbitalDefinitionSchema = z.object({
|
|
1737
|
+
id: OrbitalIdSchema.optional(),
|
|
1542
1738
|
name: z.string().min(1, "Orbital name is required"),
|
|
1543
1739
|
description: z.string().optional(),
|
|
1544
1740
|
visual_prompt: z.string().optional(),
|
|
@@ -1603,7 +1799,12 @@ var OrbitalSchemaSchema = z.object({
|
|
|
1603
1799
|
orbitals: z.array(OrbitalSchema).min(1, "At least one orbital is required"),
|
|
1604
1800
|
services: z.array(ServiceDefinitionSchema).optional(),
|
|
1605
1801
|
config: OrbitalConfigSchema.optional(),
|
|
1606
|
-
_metadata: SchemaMetadataSchema.optional()
|
|
1802
|
+
_metadata: SchemaMetadataSchema.optional(),
|
|
1803
|
+
// V4 identity — optional/dual-carry until the Phase-7 flip. Present on
|
|
1804
|
+
// id-carrying `.orb` files so `parseOrbitalSchema` preserves them instead
|
|
1805
|
+
// of stripping unknown keys.
|
|
1806
|
+
schemaVersion: z.number().optional(),
|
|
1807
|
+
ledger: IdentityLedgerSchema.optional()
|
|
1607
1808
|
});
|
|
1608
1809
|
function parseOrbitalSchema(data) {
|
|
1609
1810
|
return OrbitalSchemaSchema.parse(data);
|
|
@@ -1943,11 +2144,13 @@ var PATTERN_TYPES = [
|
|
|
1943
2144
|
"orbital-visualization",
|
|
1944
2145
|
"overlay",
|
|
1945
2146
|
"page-header",
|
|
2147
|
+
"page-transition",
|
|
1946
2148
|
"pagination",
|
|
1947
2149
|
"pattern-tile",
|
|
1948
2150
|
"physics-canvas",
|
|
1949
2151
|
"popover",
|
|
1950
2152
|
"positioned-canvas",
|
|
2153
|
+
"presence",
|
|
1951
2154
|
"pricing-card",
|
|
1952
2155
|
"pricing-grid",
|
|
1953
2156
|
"pricing-organism",
|
|
@@ -2152,17 +2355,6 @@ function isResolvedIR(ir) {
|
|
|
2152
2355
|
return typeof r.appName === "string" && r.traits instanceof Map && r.pages instanceof Map;
|
|
2153
2356
|
}
|
|
2154
2357
|
|
|
2155
|
-
// src/types/json.ts
|
|
2156
|
-
function isJsonPrimitive(value) {
|
|
2157
|
-
return value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
2158
|
-
}
|
|
2159
|
-
function isJsonObject(value) {
|
|
2160
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
2161
|
-
}
|
|
2162
|
-
function isJsonArray(value) {
|
|
2163
|
-
return Array.isArray(value);
|
|
2164
|
-
}
|
|
2165
|
-
|
|
2166
2358
|
// src/types/validation.ts
|
|
2167
2359
|
var KNOWN_VALIDATION_ERROR_CODES = {
|
|
2168
2360
|
// Binding (`@entity.X`, `@payload.Y`, `@state.Z`, `@now`, ...)
|
|
@@ -2327,7 +2519,13 @@ var KNOWN_VALIDATION_ERROR_CODES = {
|
|
|
2327
2519
|
ORB_X_PAYLOAD_MISMATCH: "ORB_X_PAYLOAD_MISMATCH",
|
|
2328
2520
|
ORB_X_RENDER_UI_EVENT_LITERAL_STALE: "ORB_X_RENDER_UI_EVENT_LITERAL_STALE",
|
|
2329
2521
|
ORB_X_UNRESOLVED_PATTERN_FIELD_REF: "ORB_X_UNRESOLVED_PATTERN_FIELD_REF",
|
|
2330
|
-
ORB_X_UNUSED_EMISSION: "ORB_X_UNUSED_EMISSION"
|
|
2522
|
+
ORB_X_UNUSED_EMISSION: "ORB_X_UNUSED_EMISSION",
|
|
2523
|
+
// Identity — V4 dual-carry id integrity (`ORB_ID_*`). Mirrors
|
|
2524
|
+
// `orbital-compiler/src/phases/validation/id_integrity.rs`.
|
|
2525
|
+
ORB_ID_UNKNOWN_REF: "ORB_ID_UNKNOWN_REF",
|
|
2526
|
+
ORB_ID_NAME_MISMATCH: "ORB_ID_NAME_MISMATCH",
|
|
2527
|
+
ORB_ID_KIND_MISMATCH: "ORB_ID_KIND_MISMATCH",
|
|
2528
|
+
ORB_ID_LEDGER_ORPHAN: "ORB_ID_LEDGER_ORPHAN"
|
|
2331
2529
|
};
|
|
2332
2530
|
function isKnownValidationErrorCode(code) {
|
|
2333
2531
|
return code in KNOWN_VALIDATION_ERROR_CODES;
|
|
@@ -2338,6 +2536,6 @@ function widenTier(tier) {
|
|
|
2338
2536
|
return tier;
|
|
2339
2537
|
}
|
|
2340
2538
|
|
|
2341
|
-
export { AGENT_DOMAIN_CATEGORIES, ALLOWED_CUSTOM_COMPONENTS, ANIMATION_NAMES, ASSET_ASPECTS, ASSET_DIMENSIONS, AgentDomainCategorySchema, AnimationDefSchema, AnimationNameSchema, AssetAspectSchema, AssetCatalogEntrySchema, AssetCatalogSchema, AssetDimensionSchema, AssetSchema, BINDING_CONTEXT_RULES, BINDING_DOCS, BINDING_ROOTS, BindingSchema, CAMERA_MODES, CONFIG_REF_EVENT_PATTERN, CORE_BINDINGS, CameraModeSchema, CameraSchema, ColorSliceSchema, ColorTokensSchema, ComputedEventContractSchema, ComputedEventListenerSchema, ConfigFieldDeclarationSchema, ConfigProvenanceRecordSchema, CustomPatternDefinitionSchema, CustomPatternMapSchema, DEFAULT_INTERACTION_MODELS, DeclaredTraitConfigSchema, DensitySliceSchema, DensityTokensSchema, DesignPreferencesSchema, DesignTokensSchema, DomainCategorySchema, DomainContextSchema, DomainVocabularySchema, ENTITY_ROLES, EffectSchema, ElevationSliceSchema, ElevationTokensSchema, EntityCallSchema, EntityFieldContractSchema, EntityFieldSchema, EntityPersistenceSchema, EntityRefSchema, EntityRefStringSchema, EntityRoleSchema, EntitySchema, EntitySemanticRoleSchema, EventListenerSchema, EventPayloadFieldSchema, EventSchema, EventScopeSchema, EventSemanticRoleSchema, EventSourceSchema, ExpressionSchema, FieldFormatSchema, FieldSchema, FieldTypeSchema, GameSubCategorySchema, GeometrySliceSchema, GeometryTokensSchema, GuardSchema, IconFamilySchema, IconographySliceSchema, IconographyTokensSchema, IllustrationSliceSchema, IllustrationStyleSchema, IllustrationTokensSchema, InteractionModelSchema, KNOWN_VALIDATION_ERROR_CODES, ListenSourceSchema, McpServiceDefSchema, MotionDurationKeySchema, MotionDurationPaletteSchema, MotionEasingKeySchema, MotionEasingPaletteSchema, MotionIntentMapSchema, MotionIntentSchema, MotionSliceSchema, MotionTokensSchema, NodeClassificationSchema, OrbitalConfigSchema, OrbitalDefinitionSchema, OrbitalEntitySchema, OrbitalPageSchema, OrbitalPageStrictSchema, OrbitalSchemaSchema, OrbitalTraitRefSchema, OrbitalUnitSchema, OrbitalSchema as OrbitalZodSchema, PATTERN_TYPES, PageRefObjectSchema, PageRefSchema, PageRefStringSchema, PageSchema, PageTraitRefSchema, PatternTypeSchema, PayloadFieldSchema, RelatedLinkSchema, RelationConfigSchema, RequiredFieldSchema, RestAuthConfigSchema, RestServiceDefSchema, SERVICE_TYPES, SExprAtomSchema, SExprSchema, SPRITE_DIRECTIONS, ScenePosSchema, SchemaMetadataSchema, SemanticAssetRefSchema, ServiceDefinitionSchema, ServiceRefObjectSchema, ServiceRefSchema, ServiceRefStringSchema, ServiceTypeSchema, SkinSpecSchema, SocketEventsSchema, SocketServiceDefSchema, SpacingScaleSchema, SpriteDirectionSchema, SpriteSheetAtlasSchema, StateMachineSchema, StateSchema, StateSemanticRoleSchema, SubTextureSchema, SuggestedGuardSchema, TextureAtlasSchema, ThemeDefinitionSchema, ThemeRefSchema, ThemeRefStringSchema, ThemeTokensSchema, ThemeVariantSchema, TilesheetSchema, TraitCategorySchema, TraitConfigSchema, TraitConfigValueSchema, TraitDataEntitySchema, TraitEntityFieldSchema, TraitEventContractSchema, TraitEventListenerSchema, TraitFieldRefSchema, TraitRefSchema, TraitReferenceSchema, TraitSchema, TraitTickSchema, TransitionSchema, TypeIntentMapSchema, TypeIntentSchema, TypeScaleEntrySchema, TypeScaleSchema, TypeScaleTokensSchema, TypeSizeKeySchema, TypeSliceSchema, TypeSlotSchema, TypeWeightSchema, UISlotSchema, UI_SLOTS, UXHintsSchema, UseDeclarationSchema, UserPersonaSchema, VISUAL_STYLES, ViewTypeSchema, VisualStyleSchema, atomic, callService, collectBindings, configRefEventKnob, createAssetKey, createEmptyResolvedPage, createEmptyResolvedTrait, createLazyService, createResolvedField, createTypedEventBus, deref, deriveCollection, despawn, doEffects, emit, findService, getArgs, getBindingExamples, getDefaultAnimationsForRole, getInteractionModelForDomain, getOperator, getServiceNames, getTraitConfig, getTraitName, hasService, inferTsType, isBinding, isCallSiteConfigDeclaration, isCircuitEvent, isEffect, isEntityCall, isEntityReference, isEntityReferenceAny, isEventPayloadValue, isFieldValue, isImportedTraitRef, isInlineTrait, isJsonArray, isJsonObject, isJsonPrimitive, isKnownValidationErrorCode, isMcpService, isOrbitalDefinition, isPageReference, isPageReferenceObject, isPageReferenceString, isPlanSnapshot, isResolvedIR, isRestService, isRuntimeEntity, isSExpr, isSExprAtom, isSExprCall, isSExprEffect, isServiceReference, isServiceReferenceObject, isSessionHistoryEntry, isSocketService, isThemeReference, isTraitFieldRef, isValidBinding, isValidPatternType, navigate, normalizeCallSiteConfigToValues, normalizeTraitRef, notify, parseAssetKey, parseBinding, parseEntityRef, parseImportedTraitRef, parseOrbitalSchema, parsePageRef, parseServiceRef, persist, persistenceModeAllowsOverrides, ref, renderUI, resolveConfigRefEventName, safeParseOrbitalSchema, set, sexpr, spawn, swap, toBindingRoot, validateAssetAnimations, validateBindingInContext, walkSExpr, watch, widenTier };
|
|
2539
|
+
export { AGENT_DOMAIN_CATEGORIES, ALLOWED_CUSTOM_COMPONENTS, ANIMATION_NAMES, ASSET_ASPECTS, ASSET_DIMENSIONS, AgentDomainCategorySchema, AnimationDefSchema, AnimationNameSchema, AssetAspectSchema, AssetCatalogEntrySchema, AssetCatalogSchema, AssetDimensionSchema, AssetSchema, BINDING_CONTEXT_RULES, BINDING_DOCS, BINDING_ROOTS, BindingSchema, CAMERA_MODES, CONFIG_REF_EVENT_PATTERN, CORE_BINDINGS, CameraModeSchema, CameraSchema, ColorSliceSchema, ColorTokensSchema, ComputedEventContractSchema, ComputedEventListenerSchema, ConfigFieldDeclarationSchema, ConfigProvenanceRecordSchema, CustomPatternDefinitionSchema, CustomPatternMapSchema, DEFAULT_INTERACTION_MODELS, DeclaredTraitConfigSchema, DensitySliceSchema, DensityTokensSchema, DesignPreferencesSchema, DesignTokensSchema, DomainCategorySchema, DomainContextSchema, DomainVocabularySchema, ENTITY_ROLES, EffectSchema, ElevationSliceSchema, ElevationTokensSchema, EntityCallSchema, EntityFieldContractSchema, EntityFieldSchema, EntityIdSchema, EntityPersistenceSchema, EntityRefSchema, EntityRefStringSchema, EntityRoleSchema, EntitySchema, EntitySemanticRoleSchema, EventIdSchema, EventListenerSchema, EventPayloadFieldSchema, EventSchema, EventScopeSchema, EventSemanticRoleSchema, EventSourceSchema, ExpressionSchema, FieldFormatSchema, FieldSchema, FieldTypeSchema, GameSubCategorySchema, GeometrySliceSchema, GeometryTokensSchema, GuardSchema, IconFamilySchema, IconographySliceSchema, IconographyTokensSchema, IdentityLedgerSchema, IllustrationSliceSchema, IllustrationStyleSchema, IllustrationTokensSchema, InteractionModelSchema, KNOWN_VALIDATION_ERROR_CODES, LedgerEntrySchema, LedgerKindSchema, ListenSourceSchema, McpServiceDefSchema, MotionDurationKeySchema, MotionDurationPaletteSchema, MotionEasingKeySchema, MotionEasingPaletteSchema, MotionIntentMapSchema, MotionIntentSchema, MotionSliceSchema, MotionTokensSchema, NodeClassificationSchema, OrbitalConfigSchema, OrbitalDefinitionSchema, OrbitalEntitySchema, OrbitalIdSchema, OrbitalPageSchema, OrbitalPageStrictSchema, OrbitalSchemaSchema, OrbitalTraitRefSchema, OrbitalUnitSchema, OrbitalSchema as OrbitalZodSchema, PATTERN_TYPES, PageIdSchema, PageRefObjectSchema, PageRefSchema, PageRefStringSchema, PageSchema, PageTraitRefSchema, PaletteEntryIdSchema, PatternTypeSchema, PayloadFieldSchema, REFERENCE_CONFIG_TYPES, RelatedLinkSchema, RelationConfigSchema, RequiredFieldSchema, RestAuthConfigSchema, RestServiceDefSchema, SERVICE_TYPES, SExprAtomSchema, SExprSchema, SPRITE_DIRECTIONS, ScenePosSchema, SchemaMetadataSchema, SemanticAssetRefSchema, ServiceDefinitionSchema, ServiceIdSchema, ServiceRefObjectSchema, ServiceRefSchema, ServiceRefStringSchema, ServiceTypeSchema, SkinSpecSchema, SocketEventsSchema, SocketServiceDefSchema, SpacingScaleSchema, SpriteDirectionSchema, SpriteSheetAtlasSchema, StateMachineSchema, StateSchema, StateSemanticRoleSchema, SubTextureSchema, SuggestedGuardSchema, TextureAtlasSchema, ThemeDefinitionSchema, ThemeIdSchema, ThemeRefSchema, ThemeRefStringSchema, ThemeTokensSchema, ThemeVariantSchema, TilesheetSchema, TraitCategorySchema, TraitConfigSchema, TraitConfigValueSchema, TraitDataEntitySchema, TraitEntityFieldSchema, TraitEventContractSchema, TraitEventListenerSchema, TraitFieldRefSchema, TraitIdSchema, TraitRefSchema, TraitReferenceSchema, TraitSchema, TraitTickSchema, TransitionSchema, TypeIntentMapSchema, TypeIntentSchema, TypeScaleEntrySchema, TypeScaleSchema, TypeScaleTokensSchema, TypeSizeKeySchema, TypeSliceSchema, TypeSlotSchema, TypeWeightSchema, UISlotSchema, UI_SLOTS, UXHintsSchema, UseDeclarationSchema, UserPersonaSchema, VISUAL_STYLES, ViewTypeSchema, VisualStyleSchema, asEntityId, asEventId, asOrbitalId, asPageId, asPaletteEntryId, asServiceId, asThemeId, asTraitId, atomic, callService, collectBindings, configRefEventKnob, createAssetKey, createEmptyResolvedPage, createEmptyResolvedTrait, createLazyService, createResolvedField, createTypedEventBus, deref, deriveCollection, despawn, doEffects, emit, findService, getArgs, getBindingExamples, getDefaultAnimationsForRole, getInteractionModelForDomain, getOperator, getServiceNames, getTraitConfig, getTraitName, hasService, idKindOf, idPrefix, inferTsType, isBinding, isCallSiteConfigDeclaration, isCircuitEvent, isEffect, isEntityCall, isEntityId, isEntityReference, isEntityReferenceAny, isEventId, isEventPayloadValue, isFieldValue, isImportedTraitRef, isInlineTrait, isJsonArray, isJsonObject, isJsonPrimitive, isKnownValidationErrorCode, isMcpService, isOrbitalDefinition, isOrbitalId, isPageId, isPageReference, isPageReferenceObject, isPageReferenceString, isPaletteEntryId, isPlanSnapshot, isReferenceConfigType, isResolvedIR, isRestService, isRuntimeEntity, isSExpr, isSExprAtom, isSExprCall, isSExprEffect, isServiceId, isServiceReference, isServiceReferenceObject, isSessionHistoryEntry, isSocketService, isThemeId, isThemeReference, isTraitFieldRef, isTraitId, isValidBinding, isValidPatternType, ledgerCurName, ledgerRename, ledgerResolveName, mintId, navigate, normalizeCallSiteConfigToValues, normalizeTraitRef, notify, parseAssetKey, parseBinding, parseEntityRef, parseImportedTraitRef, parseOrbitalSchema, parsePageRef, parseServiceRef, persist, persistenceModeAllowsOverrides, ref, renderUI, resolveConfigRefEventName, safeParseOrbitalSchema, set, sexpr, spawn, swap, toBindingRoot, validateAssetAnimations, validateBindingInContext, walkSExpr, watch, widenTier };
|
|
2342
2540
|
//# sourceMappingURL=index.js.map
|
|
2343
2541
|
//# sourceMappingURL=index.js.map
|