@almadar/core 1.0.0 → 1.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.
package/dist/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
- export { ALLOWED_CUSTOM_COMPONENTS, AllowedCustomComponent, AnimationDef, AnimationDefInput, AnimationDefSchema, AppSchema, AssetMap, AssetMapInput, AssetMapSchema, AssetMapping, AssetMappingInput, AssetMappingSchema, BINDING_CONTEXT_RULES, BINDING_DOCS, BindingContext, BindingSchema, CORE_BINDINGS, CallServiceConfig, ComputedEventContract, ComputedEventContractSchema, ComputedEventListener, ComputedEventListenerSchema, CoreBinding, CreateFlow, CustomPatternDefinition, CustomPatternDefinitionInput, CustomPatternDefinitionSchema, CustomPatternMap, CustomPatternMapInput, CustomPatternMapSchema, DEFAULT_INTERACTION_MODELS, DeleteFlow, DesignPreferences, DesignPreferencesInput, DesignPreferencesSchema, DesignTokens, DesignTokensInput, DesignTokensSchema, DomainCategory, DomainCategorySchema, DomainContext, DomainContextInput, DomainContextSchema, DomainVocabulary, DomainVocabularySchema, ENTITY_ROLES, EditFlow, Effect, EffectInput, EffectSchema, Entity, EntityField, EntityFieldInput, EntityFieldSchema, EntityPersistence, EntityPersistenceSchema, EntityRef, EntityRefSchema, EntityRefStringSchema, EntityRole, EntityRoleSchema, EntitySchema, EntitySemanticRole, EntitySemanticRoleSchema, Event, EventInput, EventListener, EventListenerSchema, EventPayloadField, EventPayloadFieldSchema, EventSchema, EventScope, EventScopeSchema, EventSemanticRole, EventSemanticRoleSchema, EventSource, EventSourceSchema, Expression, ExpressionInput, ExpressionSchema, Field, FieldFormat, FieldFormatSchema, FieldSchema, FieldType, FieldTypeSchema, FullOrbitalUnit, GAME_TYPES, GameSubCategory, GameSubCategorySchema, GameType, GameTypeSchema, Guard, GuardInput, GuardSchema, InteractionModel, InteractionModelInput, InteractionModelSchema, ListInteraction, McpServiceDef, McpServiceDefSchema, NodeClassification, NodeClassificationSchema, OPERATORS, OPERATOR_CATEGORIES, OperatorCategory, OperatorMeta, OperatorName, FullOrbitalUnit as Orbital, OrbitalConfig, OrbitalConfigInput, OrbitalConfigSchema, OrbitalDefinition, OrbitalDefinitionSchema, OrbitalEntity, OrbitalEntityInput, OrbitalEntitySchema, OrbitalInput, OrbitalPage, OrbitalPageInput, OrbitalPageSchema, OrbitalPageStrictInput, OrbitalPageStrictSchema, AppSchema as OrbitalSchema, OrbitalSchemaInput, OrbitalSchemaSchema, OrbitalTraitRef, OrbitalTraitRefSchema, OrbitalUnit, OrbitalUnitSchema, OrbitalZodSchema, PATTERN_TYPES, Page, PageRef, PageRefObject, PageRefObjectSchema, PageRefSchema, PageRefStringSchema, PageSchema, PageTraitRef, PageTraitRefSchema, ParsedBinding, PatternConfig, PatternType, PatternTypeSchema, PayloadField, PayloadFieldSchema, PresentationType, RelatedLink, RelatedLinkSchema, RelationConfig, RelationConfigSchema, RequiredField, RequiredFieldSchema, ResolvedAsset, ResolvedAssetInput, ResolvedAssetSchema, ResolvedEntity, ResolvedEntityBinding, ResolvedField, ResolvedIR, ResolvedNavigation, ResolvedPage, ResolvedPattern, ResolvedSection, ResolvedSectionEvent, ResolvedTrait, ResolvedTraitBinding, ResolvedTraitDataEntity, ResolvedTraitEvent, ResolvedTraitGuard, ResolvedTraitListener, ResolvedTraitState, ResolvedTraitTick, ResolvedTraitTransition, ResolvedTraitUIBinding, RestAuthConfig, RestAuthConfigSchema, RestServiceDef, RestServiceDefSchema, SERVICE_TYPES, SExpr, SExprAtom, SExprAtomSchema, SExprInput, SExprSchema, SemanticAssetRef, SemanticAssetRefInput, SemanticAssetRefSchema, ServiceDefinition, ServiceDefinitionSchema, ServiceRef, ServiceRefSchema, ServiceRefStringSchema, ServiceType, ServiceTypeSchema, SocketEvents, SocketEventsSchema, SocketServiceDef, SocketServiceDefSchema, State, StateInput, StateMachine, StateMachineInput, StateMachineSchema, StateSchema, StateSemanticRole, StateSemanticRoleSchema, SuggestedGuard, SuggestedGuardSchema, ThemeDefinition, ThemeDefinitionSchema, ThemeRef, ThemeRefSchema, ThemeRefStringSchema, ThemeTokens, ThemeTokensSchema, ThemeVariant, ThemeVariantSchema, Trait, TraitCategory, TraitCategorySchema, TraitDataEntity, TraitDataEntitySchema, TraitEntityField, TraitEntityFieldSchema, TraitEventContract, TraitEventContractSchema, TraitEventListener, TraitEventListenerSchema, TraitInput, TraitRef, TraitRefSchema, TraitReference, TraitReferenceInput, TraitReferenceSchema, TraitSchema, TraitTick, TraitTickSchema, TraitUIBinding, Transition, TransitionFrom, TransitionInput, TransitionSchema, UISlot, UISlotSchema, UI_SLOTS, UXHints, UXHintsSchema, UseDeclaration, UseDeclarationSchema, UserPersona, UserPersonaInput, UserPersonaSchema, VISUAL_STYLES, ViewFlow, ViewType, ViewTypeSchema, VisualStyle, VisualStyleSchema, callService, collectBindings, createAssetKey, createEmptyResolvedPage, createEmptyResolvedTrait, createResolvedField, deriveCollection, despawn, doEffects, emit, findService, getAllOperators, getAllPatternTypes, getArgs, getBindingExamples, getDefaultAnimationsForRole, getInteractionModelForDomain, getOperator, getOperatorMeta, getOperatorsByCategory, getServiceNames, getTraitConfig, getTraitName, hasService, inferTsType, isBinding, isEffect, isEffectOperator, isEntityReference, isGuardOperator, isImportedTraitRef, isInlineTrait, isKnownOperator, isMcpService, isOrbitalDefinition, isPageReference, isPageReferenceObject, isPageReferenceString, isResolvedIR, isRestService, isRuntimeEntity, isSExpr, isSExprAtom, isSExprCall, isSExprEffect, isServiceReference, isSingletonEntity, isSocketService, isThemeReference, isValidBinding, isValidPatternType, navigate, normalizeTraitRef, notify, parseAssetKey, parseBinding, parseEntityRef, parseImportedTraitRef, parseOrbitalSchema, parsePageRef, parseServiceRef, persist, renderUI, safeParseOrbitalSchema, set, sexpr, spawn, validateAssetAnimations, validateBindingInContext, validateOperatorArity, walkSExpr } from './src/types/index.js';
1
+ export { ALLOWED_CUSTOM_COMPONENTS, AllowedCustomComponent, AnimationDef, AnimationDefInput, AnimationDefSchema, AppSchema, AssetMap, AssetMapInput, AssetMapSchema, AssetMapping, AssetMappingInput, AssetMappingSchema, BINDING_CONTEXT_RULES, BINDING_DOCS, BindingContext, BindingSchema, CORE_BINDINGS, CallServiceConfig, ComputedEventContract, ComputedEventContractSchema, ComputedEventListener, ComputedEventListenerSchema, CoreBinding, CreateFlow, CustomPatternDefinition, CustomPatternDefinitionInput, CustomPatternDefinitionSchema, CustomPatternMap, CustomPatternMapInput, CustomPatternMapSchema, DEFAULT_INTERACTION_MODELS, DeleteFlow, DesignPreferences, DesignPreferencesInput, DesignPreferencesSchema, DesignTokens, DesignTokensInput, DesignTokensSchema, DomainCategory, DomainCategorySchema, DomainContext, DomainContextInput, DomainContextSchema, DomainVocabulary, DomainVocabularySchema, ENTITY_ROLES, EditFlow, Effect, EffectInput, EffectSchema, Entity, EntityField, EntityFieldInput, EntityFieldSchema, EntityPersistence, EntityPersistenceSchema, EntityRef, EntityRefSchema, EntityRefStringSchema, EntityRole, EntityRoleSchema, EntitySchema, EntitySemanticRole, EntitySemanticRoleSchema, Event, EventInput, EventListener, EventListenerSchema, EventPayloadField, EventPayloadFieldSchema, EventSchema, EventScope, EventScopeSchema, EventSemanticRole, EventSemanticRoleSchema, EventSource, EventSourceSchema, Expression, ExpressionInput, ExpressionSchema, Field, FieldFormat, FieldFormatSchema, FieldSchema, FieldType, FieldTypeSchema, FullOrbitalUnit, GAME_TYPES, GameSubCategory, GameSubCategorySchema, GameType, GameTypeSchema, Guard, GuardInput, GuardSchema, InteractionModel, InteractionModelInput, InteractionModelSchema, ListInteraction, McpServiceDef, McpServiceDefSchema, NodeClassification, NodeClassificationSchema, OperatorName, FullOrbitalUnit as Orbital, OrbitalConfig, OrbitalConfigInput, OrbitalConfigSchema, OrbitalDefinition, OrbitalDefinitionSchema, OrbitalEntity, OrbitalEntityInput, OrbitalEntitySchema, OrbitalInput, OrbitalPage, OrbitalPageInput, OrbitalPageSchema, OrbitalPageStrictInput, OrbitalPageStrictSchema, AppSchema as OrbitalSchema, OrbitalSchemaInput, OrbitalSchemaSchema, OrbitalTraitRef, OrbitalTraitRefSchema, OrbitalUnit, OrbitalUnitSchema, OrbitalZodSchema, Page, PageRef, PageRefObject, PageRefObjectSchema, PageRefSchema, PageRefStringSchema, PageSchema, PageTraitRef, PageTraitRefSchema, ParsedBinding, PatternTypeSchema, PayloadField, PayloadFieldSchema, PresentationType, RelatedLink, RelatedLinkSchema, RelationConfig, RelationConfigSchema, RequiredField, RequiredFieldSchema, ResolvedAsset, ResolvedAssetInput, ResolvedAssetSchema, ResolvedEntity, ResolvedEntityBinding, ResolvedField, ResolvedIR, ResolvedNavigation, ResolvedPage, ResolvedPattern, ResolvedSection, ResolvedSectionEvent, ResolvedTrait, ResolvedTraitBinding, ResolvedTraitDataEntity, ResolvedTraitEvent, ResolvedTraitGuard, ResolvedTraitListener, ResolvedTraitState, ResolvedTraitTick, ResolvedTraitTransition, ResolvedTraitUIBinding, RestAuthConfig, RestAuthConfigSchema, RestServiceDef, RestServiceDefSchema, SERVICE_TYPES, SExpr, SExprAtom, SExprAtomSchema, SExprInput, SExprSchema, SemanticAssetRef, SemanticAssetRefInput, SemanticAssetRefSchema, ServiceDefinition, ServiceDefinitionSchema, ServiceRef, ServiceRefSchema, ServiceRefStringSchema, ServiceType, ServiceTypeSchema, SocketEvents, SocketEventsSchema, SocketServiceDef, SocketServiceDefSchema, State, StateInput, StateMachine, StateMachineInput, StateMachineSchema, StateSchema, StateSemanticRole, StateSemanticRoleSchema, SuggestedGuard, SuggestedGuardSchema, ThemeDefinition, ThemeDefinitionSchema, ThemeRef, ThemeRefSchema, ThemeRefStringSchema, ThemeTokens, ThemeTokensSchema, ThemeVariant, ThemeVariantSchema, Trait, TraitCategory, TraitCategorySchema, TraitDataEntity, TraitDataEntitySchema, TraitEntityField, TraitEntityFieldSchema, TraitEventContract, TraitEventContractSchema, TraitEventListener, TraitEventListenerSchema, TraitInput, TraitRef, TraitRefSchema, TraitReference, TraitReferenceInput, TraitReferenceSchema, TraitSchema, TraitTick, TraitTickSchema, TraitUIBinding, Transition, TransitionFrom, TransitionInput, TransitionSchema, UISlot, UISlotSchema, UI_SLOTS, UXHints, UXHintsSchema, UseDeclaration, UseDeclarationSchema, UserPersona, UserPersonaInput, UserPersonaSchema, VISUAL_STYLES, ViewFlow, ViewType, ViewTypeSchema, VisualStyle, VisualStyleSchema, callService, collectBindings, createAssetKey, createEmptyResolvedPage, createEmptyResolvedTrait, createResolvedField, deriveCollection, despawn, doEffects, emit, findService, getAllOperators, getAllPatternTypes, getArgs, getBindingExamples, getDefaultAnimationsForRole, getInteractionModelForDomain, getOperator, getServiceNames, getTraitConfig, getTraitName, hasService, inferTsType, isBinding, isEffect, isEntityReference, isImportedTraitRef, isInlineTrait, isMcpService, isOrbitalDefinition, isPageReference, isPageReferenceObject, isPageReferenceString, isResolvedIR, isRestService, isRuntimeEntity, isSExpr, isSExprAtom, isSExprCall, isSExprEffect, isServiceReference, isSingletonEntity, isSocketService, isThemeReference, isValidBinding, navigate, normalizeTraitRef, notify, parseAssetKey, parseBinding, parseEntityRef, parseImportedTraitRef, parseOrbitalSchema, parsePageRef, parseServiceRef, persist, renderUI, safeParseOrbitalSchema, set, sexpr, spawn, validateAssetAnimations, validateBindingInContext, walkSExpr } from './src/types/index.js';
2
+ export { CATEGORIES, CategoryMeta, OPERATORS, OPERATORS_SCHEMA, OPERATOR_NAMES, OperatorCategory, OperatorMeta, OperatorStats, OperatorsSchema, TargetPlatform, getOperatorMeta, getOperatorStats, getOperatorsByCategory, getOperatorsForTarget, isEffectOperator, isGuardOperator, isKnownOperator, validateOperatorArity } from '@almadar/operators';
3
+ export { PATTERN_TYPES, PatternConfig, PatternType, isValidPatternType } from '@almadar/patterns';
2
4
  import 'zod';
package/dist/index.js CHANGED
@@ -1,4 +1,8 @@
1
1
  import { z } from 'zod';
2
+ import { OPERATOR_NAMES } from '@almadar/operators';
3
+ export { CATEGORIES, OPERATORS, OPERATORS_SCHEMA, OPERATOR_NAMES, getOperatorMeta, getOperatorStats, getOperatorsByCategory, getOperatorsForTarget, isEffectOperator, isGuardOperator, isKnownOperator, validateOperatorArity } from '@almadar/operators';
4
+ import { PATTERN_TYPES } from '@almadar/patterns';
5
+ export { PATTERN_TYPES, isValidPatternType } from '@almadar/patterns';
2
6
 
3
7
  // src/types/orbital.ts
4
8
  var FieldTypeSchema = z.enum([
@@ -208,6 +212,7 @@ var OrbitalPageSchema = z.object({
208
212
  }).strict();
209
213
  var PageSchema = OrbitalPageSchema;
210
214
  var UI_SLOTS = [
215
+ // App slots
211
216
  "main",
212
217
  "sidebar",
213
218
  "modal",
@@ -215,11 +220,24 @@ var UI_SLOTS = [
215
220
  "overlay",
216
221
  "center",
217
222
  "toast",
218
- "hud-top",
219
- "hud-bottom",
220
223
  "floating",
221
- "system"
224
+ "system",
222
225
  // For invisible system components (InputListener, CollisionDetector)
226
+ "content",
227
+ "screen",
228
+ // Game HUD slots
229
+ "hud",
230
+ "hud-top",
231
+ "hud-bottom",
232
+ "hud.health",
233
+ "hud.score",
234
+ "hud.inventory",
235
+ "hud.stamina",
236
+ // Game overlay slots
237
+ "overlay.inventory",
238
+ "overlay.dialogue",
239
+ "overlay.menu",
240
+ "overlay.pause"
223
241
  ];
224
242
  var UISlotSchema = z.enum(UI_SLOTS);
225
243
  var EffectSchema = z.array(z.unknown()).min(1).refine(
@@ -240,14 +258,16 @@ function navigate(path, params) {
240
258
  return params ? ["navigate", path, params] : ["navigate", path];
241
259
  }
242
260
  function renderUI(target, pattern, props) {
243
- const patternObj = pattern ? { ...pattern } : null;
244
- return props ? ["render-ui", target, patternObj, props] : ["render-ui", target, patternObj];
261
+ return props ? ["render-ui", target, pattern, props] : ["render-ui", target, pattern];
245
262
  }
246
263
  function persist(action, entity, data) {
264
+ if (action === "create" || action === "update") {
265
+ return ["persist", action, entity, data];
266
+ }
247
267
  return data ? ["persist", action, entity, data] : ["persist", action, entity];
248
268
  }
249
- function callService(service, config) {
250
- return ["call-service", service, config];
269
+ function callService(serviceName, config) {
270
+ return ["call-service", serviceName, config];
251
271
  }
252
272
  function spawn(entity, initialState) {
253
273
  return initialState ? ["spawn", entity, initialState] : ["spawn", entity];
@@ -492,6 +512,7 @@ var TraitSchema = z.object({
492
512
  description: z.string().optional(),
493
513
  description_visual_prompt: z.string().optional(),
494
514
  category: TraitCategorySchema.optional(),
515
+ linkedEntity: z.string().optional(),
495
516
  requiredFields: z.array(RequiredFieldSchema).optional(),
496
517
  dataEntities: z.array(TraitDataEntitySchema).optional(),
497
518
  stateMachine: StateMachineSchema.optional(),
@@ -942,449 +963,7 @@ function parseOrbitalSchema(data) {
942
963
  function safeParseOrbitalSchema(data) {
943
964
  return OrbitalSchemaSchema.safeParse(data);
944
965
  }
945
-
946
- // src/types/operators.ts
947
- var OPERATOR_CATEGORIES = [
948
- "arithmetic",
949
- "comparison",
950
- "logic",
951
- "control",
952
- "effect",
953
- "collection",
954
- // Standard library categories
955
- "std-math",
956
- "std-str",
957
- "std-array",
958
- "std-object",
959
- "std-validate",
960
- "std-time",
961
- "std-format",
962
- "std-async",
963
- "std-nn",
964
- "std-tensor",
965
- "std-train"
966
- ];
967
- var OPERATORS = {
968
- // ============================================================================
969
- // Arithmetic Operators
970
- // ============================================================================
971
- "+": {
972
- category: "arithmetic",
973
- minArity: 2,
974
- maxArity: null,
975
- description: "Add numbers",
976
- hasSideEffects: false,
977
- returnType: "number"
978
- },
979
- "-": {
980
- category: "arithmetic",
981
- minArity: 1,
982
- maxArity: 2,
983
- description: "Subtract numbers or negate",
984
- hasSideEffects: false,
985
- returnType: "number"
986
- },
987
- "*": {
988
- category: "arithmetic",
989
- minArity: 2,
990
- maxArity: null,
991
- description: "Multiply numbers",
992
- hasSideEffects: false,
993
- returnType: "number"
994
- },
995
- "/": {
996
- category: "arithmetic",
997
- minArity: 2,
998
- maxArity: 2,
999
- description: "Divide numbers",
1000
- hasSideEffects: false,
1001
- returnType: "number"
1002
- },
1003
- "%": {
1004
- category: "arithmetic",
1005
- minArity: 2,
1006
- maxArity: 2,
1007
- description: "Modulo (remainder)",
1008
- hasSideEffects: false,
1009
- returnType: "number"
1010
- },
1011
- abs: {
1012
- category: "arithmetic",
1013
- minArity: 1,
1014
- maxArity: 1,
1015
- description: "Absolute value",
1016
- hasSideEffects: false,
1017
- returnType: "number"
1018
- },
1019
- min: {
1020
- category: "arithmetic",
1021
- minArity: 2,
1022
- maxArity: null,
1023
- description: "Minimum of values",
1024
- hasSideEffects: false,
1025
- returnType: "number"
1026
- },
1027
- max: {
1028
- category: "arithmetic",
1029
- minArity: 2,
1030
- maxArity: null,
1031
- description: "Maximum of values",
1032
- hasSideEffects: false,
1033
- returnType: "number"
1034
- },
1035
- floor: {
1036
- category: "arithmetic",
1037
- minArity: 1,
1038
- maxArity: 1,
1039
- description: "Round down to integer",
1040
- hasSideEffects: false,
1041
- returnType: "number"
1042
- },
1043
- ceil: {
1044
- category: "arithmetic",
1045
- minArity: 1,
1046
- maxArity: 1,
1047
- description: "Round up to integer",
1048
- hasSideEffects: false,
1049
- returnType: "number"
1050
- },
1051
- round: {
1052
- category: "arithmetic",
1053
- minArity: 1,
1054
- maxArity: 1,
1055
- description: "Round to nearest integer",
1056
- hasSideEffects: false,
1057
- returnType: "number"
1058
- },
1059
- clamp: {
1060
- category: "arithmetic",
1061
- minArity: 3,
1062
- maxArity: 3,
1063
- description: "Clamp value between min and max",
1064
- hasSideEffects: false,
1065
- returnType: "number"
1066
- },
1067
- // ============================================================================
1068
- // Comparison Operators
1069
- // ============================================================================
1070
- "=": {
1071
- category: "comparison",
1072
- minArity: 2,
1073
- maxArity: 2,
1074
- description: "Equal to",
1075
- hasSideEffects: false,
1076
- returnType: "boolean"
1077
- },
1078
- "!=": {
1079
- category: "comparison",
1080
- minArity: 2,
1081
- maxArity: 2,
1082
- description: "Not equal to",
1083
- hasSideEffects: false,
1084
- returnType: "boolean"
1085
- },
1086
- "<": {
1087
- category: "comparison",
1088
- minArity: 2,
1089
- maxArity: 2,
1090
- description: "Less than",
1091
- hasSideEffects: false,
1092
- returnType: "boolean"
1093
- },
1094
- ">": {
1095
- category: "comparison",
1096
- minArity: 2,
1097
- maxArity: 2,
1098
- description: "Greater than",
1099
- hasSideEffects: false,
1100
- returnType: "boolean"
1101
- },
1102
- "<=": {
1103
- category: "comparison",
1104
- minArity: 2,
1105
- maxArity: 2,
1106
- description: "Less than or equal to",
1107
- hasSideEffects: false,
1108
- returnType: "boolean"
1109
- },
1110
- ">=": {
1111
- category: "comparison",
1112
- minArity: 2,
1113
- maxArity: 2,
1114
- description: "Greater than or equal to",
1115
- hasSideEffects: false,
1116
- returnType: "boolean"
1117
- },
1118
- // ============================================================================
1119
- // Logic Operators
1120
- // ============================================================================
1121
- and: {
1122
- category: "logic",
1123
- minArity: 2,
1124
- maxArity: null,
1125
- description: "Logical AND (short-circuit)",
1126
- hasSideEffects: false,
1127
- returnType: "boolean"
1128
- },
1129
- or: {
1130
- category: "logic",
1131
- minArity: 2,
1132
- maxArity: null,
1133
- description: "Logical OR (short-circuit)",
1134
- hasSideEffects: false,
1135
- returnType: "boolean"
1136
- },
1137
- not: {
1138
- category: "logic",
1139
- minArity: 1,
1140
- maxArity: 1,
1141
- description: "Logical NOT",
1142
- hasSideEffects: false,
1143
- returnType: "boolean"
1144
- },
1145
- if: {
1146
- category: "logic",
1147
- minArity: 3,
1148
- maxArity: 3,
1149
- description: "Conditional expression (if condition then else)",
1150
- hasSideEffects: false,
1151
- returnType: "any"
1152
- },
1153
- // ============================================================================
1154
- // Control Operators
1155
- // ============================================================================
1156
- let: {
1157
- category: "control",
1158
- minArity: 2,
1159
- maxArity: 2,
1160
- description: "Bind local variables: [let, [[name, value], ...], body]",
1161
- hasSideEffects: false,
1162
- returnType: "any"
1163
- },
1164
- do: {
1165
- category: "control",
1166
- minArity: 1,
1167
- maxArity: null,
1168
- description: "Execute expressions in sequence, return last",
1169
- hasSideEffects: true,
1170
- returnType: "any"
1171
- },
1172
- when: {
1173
- category: "control",
1174
- minArity: 2,
1175
- maxArity: 2,
1176
- description: "Execute effect only when condition is true",
1177
- hasSideEffects: true,
1178
- returnType: "void"
1179
- },
1180
- fn: {
1181
- category: "control",
1182
- minArity: 2,
1183
- maxArity: 2,
1184
- description: "Lambda expression: [fn, varName, body] or [fn, [vars], body]",
1185
- hasSideEffects: false,
1186
- returnType: "any"
1187
- },
1188
- // ============================================================================
1189
- // Effect Operators
1190
- // ============================================================================
1191
- set: {
1192
- category: "effect",
1193
- minArity: 2,
1194
- maxArity: 2,
1195
- description: "Set a binding to a value",
1196
- hasSideEffects: true,
1197
- returnType: "void"
1198
- },
1199
- emit: {
1200
- category: "effect",
1201
- minArity: 1,
1202
- maxArity: 2,
1203
- description: "Emit an event with optional payload",
1204
- hasSideEffects: true,
1205
- returnType: "void"
1206
- },
1207
- persist: {
1208
- category: "effect",
1209
- minArity: 2,
1210
- maxArity: 3,
1211
- description: "Persist data (create/update/delete)",
1212
- hasSideEffects: true,
1213
- returnType: "void"
1214
- },
1215
- navigate: {
1216
- category: "effect",
1217
- minArity: 1,
1218
- maxArity: 2,
1219
- description: "Navigate to a route",
1220
- hasSideEffects: true,
1221
- returnType: "void"
1222
- },
1223
- notify: {
1224
- category: "effect",
1225
- minArity: 1,
1226
- maxArity: 2,
1227
- description: "Show a notification",
1228
- hasSideEffects: true,
1229
- returnType: "void"
1230
- },
1231
- spawn: {
1232
- category: "effect",
1233
- minArity: 1,
1234
- maxArity: 2,
1235
- description: "Spawn a new entity instance",
1236
- hasSideEffects: true,
1237
- returnType: "void"
1238
- },
1239
- despawn: {
1240
- category: "effect",
1241
- minArity: 0,
1242
- maxArity: 1,
1243
- description: "Despawn an entity instance",
1244
- hasSideEffects: true,
1245
- returnType: "void"
1246
- },
1247
- "call-service": {
1248
- category: "effect",
1249
- minArity: 2,
1250
- maxArity: 3,
1251
- description: "Call an external service",
1252
- hasSideEffects: true,
1253
- returnType: "void"
1254
- },
1255
- "render-ui": {
1256
- category: "effect",
1257
- minArity: 2,
1258
- maxArity: 3,
1259
- description: "Render UI to a slot",
1260
- hasSideEffects: true,
1261
- returnType: "void"
1262
- },
1263
- // ============================================================================
1264
- // Collection Operators
1265
- // ============================================================================
1266
- map: {
1267
- category: "collection",
1268
- minArity: 2,
1269
- maxArity: 2,
1270
- description: "Transform each element in collection",
1271
- hasSideEffects: false,
1272
- returnType: "array"
1273
- },
1274
- filter: {
1275
- category: "collection",
1276
- minArity: 2,
1277
- maxArity: 2,
1278
- description: "Filter collection by predicate",
1279
- hasSideEffects: false,
1280
- returnType: "array"
1281
- },
1282
- find: {
1283
- category: "collection",
1284
- minArity: 2,
1285
- maxArity: 2,
1286
- description: "Find first element matching predicate",
1287
- hasSideEffects: false,
1288
- returnType: "any"
1289
- },
1290
- count: {
1291
- category: "collection",
1292
- minArity: 1,
1293
- maxArity: 1,
1294
- description: "Count elements in collection",
1295
- hasSideEffects: false,
1296
- returnType: "number"
1297
- },
1298
- sum: {
1299
- category: "collection",
1300
- minArity: 1,
1301
- maxArity: 2,
1302
- description: "Sum values in collection",
1303
- hasSideEffects: false,
1304
- returnType: "number"
1305
- },
1306
- first: {
1307
- category: "collection",
1308
- minArity: 1,
1309
- maxArity: 1,
1310
- description: "Get first element",
1311
- hasSideEffects: false,
1312
- returnType: "any"
1313
- },
1314
- last: {
1315
- category: "collection",
1316
- minArity: 1,
1317
- maxArity: 1,
1318
- description: "Get last element",
1319
- hasSideEffects: false,
1320
- returnType: "any"
1321
- },
1322
- nth: {
1323
- category: "collection",
1324
- minArity: 2,
1325
- maxArity: 2,
1326
- description: "Get element at index",
1327
- hasSideEffects: false,
1328
- returnType: "any"
1329
- },
1330
- concat: {
1331
- category: "collection",
1332
- minArity: 2,
1333
- maxArity: null,
1334
- description: "Concatenate collections",
1335
- hasSideEffects: false,
1336
- returnType: "array"
1337
- },
1338
- includes: {
1339
- category: "collection",
1340
- minArity: 2,
1341
- maxArity: 2,
1342
- description: "Check if collection includes element",
1343
- hasSideEffects: false,
1344
- returnType: "boolean"
1345
- },
1346
- empty: {
1347
- category: "collection",
1348
- minArity: 1,
1349
- maxArity: 1,
1350
- description: "Check if collection is empty",
1351
- hasSideEffects: false,
1352
- returnType: "boolean"
1353
- }
1354
- };
1355
- function getOperatorMeta(operator) {
1356
- return OPERATORS[operator];
1357
- }
1358
- function isKnownOperator(operator) {
1359
- return operator in OPERATORS;
1360
- }
1361
- function isEffectOperator(operator) {
1362
- const meta = OPERATORS[operator];
1363
- return meta?.hasSideEffects ?? false;
1364
- }
1365
- function isGuardOperator(operator) {
1366
- const meta = OPERATORS[operator];
1367
- return meta !== void 0 && !meta.hasSideEffects;
1368
- }
1369
- function getOperatorsByCategory(category) {
1370
- return Object.entries(OPERATORS).filter(([_, meta]) => meta.category === category).map(([name]) => name);
1371
- }
1372
- function getAllOperators() {
1373
- return Object.keys(OPERATORS);
1374
- }
1375
- function validateOperatorArity(operator, argCount) {
1376
- const meta = OPERATORS[operator];
1377
- if (!meta) {
1378
- return `Unknown operator: ${operator}`;
1379
- }
1380
- if (argCount < meta.minArity) {
1381
- return `Operator '${operator}' requires at least ${meta.minArity} argument(s), got ${argCount}`;
1382
- }
1383
- if (meta.maxArity !== null && argCount > meta.maxArity) {
1384
- return `Operator '${operator}' accepts at most ${meta.maxArity} argument(s), got ${argCount}`;
1385
- }
1386
- return null;
1387
- }
966
+ var getAllOperators = () => OPERATOR_NAMES;
1388
967
  var BindingSchema = z.string().refine(
1389
968
  (val) => {
1390
969
  if (!val.startsWith("@")) return false;
@@ -1498,35 +1077,10 @@ var DEFAULT_INTERACTION_MODELS = {
1498
1077
  function getInteractionModelForDomain(domain) {
1499
1078
  return DEFAULT_INTERACTION_MODELS[domain] ?? DEFAULT_INTERACTION_MODELS.business;
1500
1079
  }
1501
- var PATTERN_TYPES = [
1502
- // Display patterns
1503
- "entity-table",
1504
- "entity-list",
1505
- "entity-cards",
1506
- "entity-grid",
1507
- // Form patterns
1508
- "form",
1509
- "form-section",
1510
- // Header patterns
1511
- "page-header",
1512
- // Stats patterns
1513
- "stats",
1514
- "stat-card",
1515
- // Layout patterns
1516
- "master-detail",
1517
- "dashboard-grid",
1518
- // Game patterns
1519
- "game-canvas",
1520
- "game-hud",
1521
- "game-controls"
1522
- ];
1523
1080
  var PatternTypeSchema = z.string();
1524
1081
  function getAllPatternTypes() {
1525
1082
  return [...PATTERN_TYPES];
1526
1083
  }
1527
- function isValidPatternType(patternType) {
1528
- return PATTERN_TYPES.includes(patternType);
1529
- }
1530
1084
 
1531
1085
  // src/types/ir.ts
1532
1086
  function createEmptyResolvedTrait(name, source) {
@@ -1590,6 +1144,6 @@ function isResolvedIR(ir) {
1590
1144
  return typeof r.appName === "string" && r.traits instanceof Map && r.pages instanceof Map;
1591
1145
  }
1592
1146
 
1593
- export { ALLOWED_CUSTOM_COMPONENTS, AnimationDefSchema, AssetMapSchema, AssetMappingSchema, BINDING_CONTEXT_RULES, BINDING_DOCS, BindingSchema, CORE_BINDINGS, ComputedEventContractSchema, ComputedEventListenerSchema, CustomPatternDefinitionSchema, CustomPatternMapSchema, DEFAULT_INTERACTION_MODELS, DesignPreferencesSchema, DesignTokensSchema, DomainCategorySchema, DomainContextSchema, DomainVocabularySchema, ENTITY_ROLES, EffectSchema, EntityFieldSchema, EntityPersistenceSchema, EntityRefSchema, EntityRefStringSchema, EntityRoleSchema, EntitySchema, EntitySemanticRoleSchema, EventListenerSchema, EventPayloadFieldSchema, EventSchema, EventScopeSchema, EventSemanticRoleSchema, EventSourceSchema, ExpressionSchema, FieldFormatSchema, FieldSchema, FieldTypeSchema, GAME_TYPES, GameSubCategorySchema, GameTypeSchema, GuardSchema, InteractionModelSchema, McpServiceDefSchema, NodeClassificationSchema, OPERATORS, OPERATOR_CATEGORIES, OrbitalConfigSchema, OrbitalDefinitionSchema, OrbitalEntitySchema, OrbitalPageSchema, OrbitalPageStrictSchema, OrbitalSchemaSchema, OrbitalTraitRefSchema, OrbitalUnitSchema, OrbitalSchema as OrbitalZodSchema, PATTERN_TYPES, PageRefObjectSchema, PageRefSchema, PageRefStringSchema, PageSchema, PageTraitRefSchema, PatternTypeSchema, PayloadFieldSchema, RelatedLinkSchema, RelationConfigSchema, RequiredFieldSchema, ResolvedAssetSchema, RestAuthConfigSchema, RestServiceDefSchema, SERVICE_TYPES, SExprAtomSchema, SExprSchema, SemanticAssetRefSchema, ServiceDefinitionSchema, ServiceRefSchema, ServiceRefStringSchema, ServiceTypeSchema, SocketEventsSchema, SocketServiceDefSchema, StateMachineSchema, StateSchema, StateSemanticRoleSchema, SuggestedGuardSchema, ThemeDefinitionSchema, ThemeRefSchema, ThemeRefStringSchema, ThemeTokensSchema, ThemeVariantSchema, TraitCategorySchema, TraitDataEntitySchema, TraitEntityFieldSchema, TraitEventContractSchema, TraitEventListenerSchema, TraitRefSchema, TraitReferenceSchema, TraitSchema, TraitTickSchema, TransitionSchema, UISlotSchema, UI_SLOTS, UXHintsSchema, UseDeclarationSchema, UserPersonaSchema, VISUAL_STYLES, ViewTypeSchema, VisualStyleSchema, callService, collectBindings, createAssetKey, createEmptyResolvedPage, createEmptyResolvedTrait, createResolvedField, deriveCollection, despawn, doEffects, emit, findService, getAllOperators, getAllPatternTypes, getArgs, getBindingExamples, getDefaultAnimationsForRole, getInteractionModelForDomain, getOperator, getOperatorMeta, getOperatorsByCategory, getServiceNames, getTraitConfig, getTraitName, hasService, inferTsType, isBinding, isEffect, isEffectOperator, isEntityReference, isGuardOperator, isImportedTraitRef, isInlineTrait, isKnownOperator, isMcpService, isOrbitalDefinition, isPageReference, isPageReferenceObject, isPageReferenceString, isResolvedIR, isRestService, isRuntimeEntity, isSExpr, isSExprAtom, isSExprCall, isSExprEffect, isServiceReference, isSingletonEntity, isSocketService, isThemeReference, isValidBinding, isValidPatternType, navigate, normalizeTraitRef, notify, parseAssetKey, parseBinding, parseEntityRef, parseImportedTraitRef, parseOrbitalSchema, parsePageRef, parseServiceRef, persist, renderUI, safeParseOrbitalSchema, set, sexpr, spawn, validateAssetAnimations, validateBindingInContext, validateOperatorArity, walkSExpr };
1147
+ export { ALLOWED_CUSTOM_COMPONENTS, AnimationDefSchema, AssetMapSchema, AssetMappingSchema, BINDING_CONTEXT_RULES, BINDING_DOCS, BindingSchema, CORE_BINDINGS, ComputedEventContractSchema, ComputedEventListenerSchema, CustomPatternDefinitionSchema, CustomPatternMapSchema, DEFAULT_INTERACTION_MODELS, DesignPreferencesSchema, DesignTokensSchema, DomainCategorySchema, DomainContextSchema, DomainVocabularySchema, ENTITY_ROLES, EffectSchema, EntityFieldSchema, EntityPersistenceSchema, EntityRefSchema, EntityRefStringSchema, EntityRoleSchema, EntitySchema, EntitySemanticRoleSchema, EventListenerSchema, EventPayloadFieldSchema, EventSchema, EventScopeSchema, EventSemanticRoleSchema, EventSourceSchema, ExpressionSchema, FieldFormatSchema, FieldSchema, FieldTypeSchema, GAME_TYPES, GameSubCategorySchema, GameTypeSchema, GuardSchema, InteractionModelSchema, McpServiceDefSchema, NodeClassificationSchema, OrbitalConfigSchema, OrbitalDefinitionSchema, OrbitalEntitySchema, OrbitalPageSchema, OrbitalPageStrictSchema, OrbitalSchemaSchema, OrbitalTraitRefSchema, OrbitalUnitSchema, OrbitalSchema as OrbitalZodSchema, PageRefObjectSchema, PageRefSchema, PageRefStringSchema, PageSchema, PageTraitRefSchema, PatternTypeSchema, PayloadFieldSchema, RelatedLinkSchema, RelationConfigSchema, RequiredFieldSchema, ResolvedAssetSchema, RestAuthConfigSchema, RestServiceDefSchema, SERVICE_TYPES, SExprAtomSchema, SExprSchema, SemanticAssetRefSchema, ServiceDefinitionSchema, ServiceRefSchema, ServiceRefStringSchema, ServiceTypeSchema, SocketEventsSchema, SocketServiceDefSchema, StateMachineSchema, StateSchema, StateSemanticRoleSchema, SuggestedGuardSchema, ThemeDefinitionSchema, ThemeRefSchema, ThemeRefStringSchema, ThemeTokensSchema, ThemeVariantSchema, TraitCategorySchema, TraitDataEntitySchema, TraitEntityFieldSchema, TraitEventContractSchema, TraitEventListenerSchema, TraitRefSchema, TraitReferenceSchema, TraitSchema, TraitTickSchema, TransitionSchema, UISlotSchema, UI_SLOTS, UXHintsSchema, UseDeclarationSchema, UserPersonaSchema, VISUAL_STYLES, ViewTypeSchema, VisualStyleSchema, callService, collectBindings, createAssetKey, createEmptyResolvedPage, createEmptyResolvedTrait, createResolvedField, deriveCollection, despawn, doEffects, emit, findService, getAllOperators, getAllPatternTypes, getArgs, getBindingExamples, getDefaultAnimationsForRole, getInteractionModelForDomain, getOperator, getServiceNames, getTraitConfig, getTraitName, hasService, inferTsType, isBinding, isEffect, isEntityReference, isImportedTraitRef, isInlineTrait, isMcpService, isOrbitalDefinition, isPageReference, isPageReferenceObject, isPageReferenceString, isResolvedIR, isRestService, isRuntimeEntity, isSExpr, isSExprAtom, isSExprCall, isSExprEffect, isServiceReference, isSingletonEntity, isSocketService, isThemeReference, isValidBinding, navigate, normalizeTraitRef, notify, parseAssetKey, parseBinding, parseEntityRef, parseImportedTraitRef, parseOrbitalSchema, parsePageRef, parseServiceRef, persist, renderUI, safeParseOrbitalSchema, set, sexpr, spawn, validateAssetAnimations, validateBindingInContext, walkSExpr };
1594
1148
  //# sourceMappingURL=index.js.map
1595
1149
  //# sourceMappingURL=index.js.map