@almadar/core 10.86.0 → 10.88.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.
Files changed (41) hide show
  1. package/dist/builders.d.ts +5 -4
  2. package/dist/builders.js +70 -29
  3. package/dist/builders.js.map +1 -1
  4. package/dist/{effect-BgDiw_bG.d.ts → effect-DMA97JxX.d.ts} +22 -6
  5. package/dist/{entityAccess-DK5S_2cT.d.ts → entityAccess-B5_Y9zF5.d.ts} +2 -2
  6. package/dist/{expression-Fk8bQWef.d.ts → expression-WfTp2arD.d.ts} +2 -65
  7. package/dist/factory/index.d.ts +6 -5
  8. package/dist/factory/index.js +1194 -401
  9. package/dist/factory/index.js.map +1 -1
  10. package/dist/factory-runtime/index.d.ts +35 -5
  11. package/dist/factory-runtime/index.js +129 -52
  12. package/dist/factory-runtime/index.js.map +1 -1
  13. package/dist/i18n/index.d.ts +124 -2
  14. package/dist/i18n/index.js +680 -382
  15. package/dist/i18n/index.js.map +1 -1
  16. package/dist/{index-ChYsqVJj.d.ts → index-CYE40P_7.d.ts} +18 -5
  17. package/dist/index.d.ts +82 -14
  18. package/dist/index.js +2058 -696
  19. package/dist/index.js.map +1 -1
  20. package/dist/json-D8gmyK3l.d.ts +65 -0
  21. package/dist/mock/index.d.ts +129 -12
  22. package/dist/mock/index.js +192 -61
  23. package/dist/mock/index.js.map +1 -1
  24. package/dist/patterns/component-mapping.json +1 -1
  25. package/dist/patterns/event-contracts.json +1 -1
  26. package/dist/patterns/index.d.ts +2525 -609
  27. package/dist/patterns/index.js +1238 -384
  28. package/dist/patterns/index.js.map +1 -1
  29. package/dist/patterns/integrators-registry.json +107 -23
  30. package/dist/patterns/patterns-registry.json +1170 -400
  31. package/dist/patterns/registry.json +1170 -400
  32. package/dist/patterns/services-registry.json +170 -35
  33. package/dist/{schema-BhfQb1oe.d.ts → schema-ex9koAoK.d.ts} +46845 -21335
  34. package/dist/state-machine/index.d.ts +2 -1
  35. package/dist/trait-BJAX5TJK.d.ts +10683 -0
  36. package/dist/types/index.d.ts +7 -6
  37. package/dist/types/index.js +134 -43
  38. package/dist/types/index.js.map +1 -1
  39. package/dist/{types-CCAmdxcH.d.ts → types-kHQhEEXQ.d.ts} +19 -3
  40. package/package.json +4 -3
  41. package/dist/trait-pavNlGqm.d.ts +0 -5385
@@ -1,8 +1,9 @@
1
- import { I as IdentityLedger, A as AnyPatternConfig, U as UISlot, c as Effect, h as RenderBinding, i as RenderUIEffect, d as EntityId, e as Entity, E as EntityField, a as EntityPersistence, f as EntityRow } from './effect-BgDiw_bG.js';
2
- import { a as OrbitalDefinition, O as OrbitalSchema, U as UseDeclaration, E as EntityRef, b as ExpectDeclaration, P as PageRef, c as Page, d as PageRefObject } from './schema-BhfQb1oe.js';
3
- import { b as TraitConfig, h as Trait, T as TraitEventListener, i as CallSiteConfig, k as TraitEventContract, d as TraitRef, a as TraitReference } from './trait-pavNlGqm.js';
4
- import { S as SExpr } from './expression-Fk8bQWef.js';
1
+ import { I as IdentityLedger, A as AnyPatternConfig, U as UISlot, c as Effect, i as RenderBinding, j as RenderUIEffect, d as EntityId, e as Entity, E as EntityField, a as EntityPersistence, g as EntityRow } from './effect-DMA97JxX.js';
2
+ import { a as OrbitalDefinition, O as OrbitalSchema, U as UseDeclaration, E as EntityRef, b as ExpectDeclaration, P as PageRef, c as Page, d as PageRefObject } from './schema-ex9koAoK.js';
3
+ import { b as TraitConfig, h as Trait, T as TraitEventListener, i as CallSiteConfig, k as TraitEventContract, d as TraitRef, a as TraitReference } from './trait-BJAX5TJK.js';
4
+ import { S as SExpr } from './expression-WfTp2arD.js';
5
5
  import 'zod';
6
+ import './json-D8gmyK3l.js';
6
7
 
7
8
  /**
8
9
  * Event Wiring
package/dist/builders.js CHANGED
@@ -419,6 +419,9 @@ var EntityPersistenceSchema = z.enum([
419
419
  ]);
420
420
  var OrbitalEntitySchema = z.object({
421
421
  name: z.string().min(1, "Entity name is required"),
422
+ // V4 arena id (`EntityDefinition.id`); declared so the strip-mode zod gate
423
+ // carries an imported entity's id through instead of erasing it.
424
+ id: EntityIdSchema.optional(),
422
425
  persistence: EntityPersistenceSchema.default("persistent"),
423
426
  shared: z.boolean().optional(),
424
427
  // Must stay in step with the Rust serde field (`EntityDefinition.identity`,
@@ -507,7 +510,8 @@ var PayloadFieldSchema = z.object({
507
510
  type: z.string().min(1),
508
511
  required: z.boolean().optional(),
509
512
  properties: z.lazy(() => z.array(PayloadFieldSchema)).optional(),
510
- typeWhen: z.array(PayloadTypeWhenSchema).optional()
513
+ typeWhen: z.array(PayloadTypeWhenSchema).optional(),
514
+ entity: z.string().min(1).optional()
511
515
  });
512
516
  var EventSchema = z.object({
513
517
  key: z.string().min(1, "Event key is required"),
@@ -517,6 +521,7 @@ var EventSchema = z.object({
517
521
  synonyms: z.string().optional(),
518
522
  tier: z.string().optional(),
519
523
  payloadSchema: z.array(PayloadFieldSchema).optional(),
524
+ payloadEntity: z.string().optional(),
520
525
  classification: z.enum(["domain", "system"]).optional(),
521
526
  semanticRole: z.string().optional()
522
527
  });
@@ -575,7 +580,8 @@ var ConfigFieldDeclarationSchema = z.object({
575
580
  values: z.array(z.string()).optional(),
576
581
  synonyms: z.string().optional(),
577
582
  items: ConfigFieldItemsDeclarationSchema.optional(),
578
- properties: z.lazy(() => z.record(TraitEntityFieldSchema)).optional()
583
+ properties: z.lazy(() => z.record(TraitEntityFieldSchema)).optional(),
584
+ forwardedFrom: z.string().optional()
579
585
  });
580
586
  var DeclaredTraitConfigSchema = z.record(
581
587
  ConfigFieldDeclarationSchema
@@ -597,31 +603,32 @@ var TraitCategorySchema = z.enum([
597
603
  "game-board",
598
604
  "game-puzzle"
599
605
  ]);
606
+ var TRAIT_FIELD_TYPES = [
607
+ "string",
608
+ "number",
609
+ "boolean",
610
+ "date",
611
+ "array",
612
+ "object",
613
+ "timestamp",
614
+ "datetime",
615
+ "enum",
616
+ "email",
617
+ "url",
618
+ "phone",
619
+ "uuid",
620
+ "image",
621
+ "trait",
622
+ "slot",
623
+ "pattern",
624
+ "node",
625
+ "event",
626
+ "scalar",
627
+ "union"
628
+ ];
600
629
  var TraitEntityFieldSchema = z.object({
601
630
  name: z.string().min(1),
602
- type: z.enum([
603
- "string",
604
- "number",
605
- "boolean",
606
- "date",
607
- "array",
608
- "object",
609
- "timestamp",
610
- "datetime",
611
- "enum",
612
- "email",
613
- "url",
614
- "phone",
615
- "uuid",
616
- "image",
617
- "trait",
618
- "slot",
619
- "pattern",
620
- // `node` was missing here while being a real `TraitFieldType` member
621
- // — the same latent-drift trap `event` would otherwise repeat.
622
- "node",
623
- "event"
624
- ]),
631
+ type: z.enum(TRAIT_FIELD_TYPES),
625
632
  required: z.boolean().optional(),
626
633
  default: TraitConfigValueSchema.optional(),
627
634
  values: z.array(z.string()).optional(),
@@ -676,7 +683,7 @@ var EventPayloadFieldSchema = z.object({
676
683
  type: z.string().min(1),
677
684
  required: z.boolean().optional(),
678
685
  description: z.string().optional(),
679
- entityType: z.string().optional(),
686
+ entity: z.string().optional(),
680
687
  properties: z.lazy(() => z.array(EventPayloadFieldSchema)).optional(),
681
688
  typeWhen: z.array(PayloadTypeWhenSchema).optional()
682
689
  });
@@ -701,6 +708,7 @@ var TraitEventContractSchema = z.object({
701
708
  definerKnob: z.string().optional(),
702
709
  scopeOverridden: z.boolean().optional(),
703
710
  payloadSchema: z.array(EventPayloadFieldSchema).optional(),
711
+ payloadEntity: z.string().optional(),
704
712
  scope: EventScopeSchema.optional()
705
713
  });
706
714
  var ListenSourceSchema = z.union([
@@ -733,8 +741,7 @@ var TraitEventListenerSchema = z.object({
733
741
  });
734
742
  var RequiredFieldSchema = z.object({
735
743
  name: z.string().min(1),
736
- // `node` was missing here too (same drift as TraitEntityFieldSchema above).
737
- type: z.enum(["string", "number", "boolean", "date", "array", "object", "timestamp", "datetime", "enum", "email", "url", "phone", "uuid", "image", "trait", "slot", "pattern", "node", "event"]),
744
+ type: z.enum(TRAIT_FIELD_TYPES),
738
745
  description: z.string().optional()
739
746
  });
740
747
  var TraitReferenceSchema = z.object({
@@ -753,6 +760,7 @@ var TraitReferenceSchema = z.object({
753
760
  z.string().min(1, "events value (caller event name) must be non-empty")
754
761
  ).optional(),
755
762
  eventIds: z.record(z.string().min(1), EventIdSchema).optional(),
763
+ _resolved: z.lazy(() => TraitSchema).optional(),
756
764
  // 3-II type-parameter arguments (see `TraitReference.typeArgs`).
757
765
  typeArgs: z.record(
758
766
  z.string().min(1, "typeArgs key (declared param name) must be non-empty"),
@@ -1374,7 +1382,8 @@ var UseDeclarationSchema = z.object({
1374
1382
  as: z.string().min(1, "Alias is required").regex(
1375
1383
  /^[A-Z][a-zA-Z0-9]*$/,
1376
1384
  'Alias must be PascalCase (e.g., "Health", "GameCore")'
1377
- )
1385
+ ),
1386
+ config: DeclaredTraitConfigSchema.optional()
1378
1387
  });
1379
1388
  var ExpectDeclarationSchema = z.discriminatedUnion("kind", [
1380
1389
  z.object({
@@ -1457,6 +1466,25 @@ var PageRefSchema = z.union([
1457
1466
  PageRefStringSchema,
1458
1467
  PageRefObjectSchema
1459
1468
  ]);
1469
+ var OrbitalRefStringSchema = z.string().regex(
1470
+ /^[A-Z][a-zA-Z0-9]*\.orbitals\.[A-Z][a-zA-Z0-9]*$/,
1471
+ 'Orbital reference must be "Alias.orbitals.OrbitalName"'
1472
+ );
1473
+ var OrbitalRefObjectSchema = z.object({
1474
+ ref: OrbitalRefStringSchema,
1475
+ refId: OrbitalIdSchema.optional(),
1476
+ entity: z.string().optional(),
1477
+ fields: z.record(z.string()).optional(),
1478
+ pages: z.record(z.string()).optional(),
1479
+ omit: z.array(z.string()).optional(),
1480
+ only: z.array(z.string()).optional(),
1481
+ config: DeclaredTraitConfigSchema.optional(),
1482
+ events: z.record(z.string()).optional(),
1483
+ roles: z.record(z.string(), z.array(z.string())).optional(),
1484
+ entities: z.record(z.string(), z.string()).optional(),
1485
+ mounts: z.record(z.string(), z.array(z.string())).optional(),
1486
+ extend: z.array(EntityFieldSchema).optional()
1487
+ });
1460
1488
  z.string().regex(
1461
1489
  /^([A-Z][a-zA-Z0-9]*\.traits\.)?[A-Z][a-zA-Z0-9]*$/,
1462
1490
  'Trait reference must be "TraitName" or "Alias.traits.TraitName"'
@@ -1504,6 +1532,15 @@ z.object({
1504
1532
  services: z.array(ServiceRefSchema).optional(),
1505
1533
  // Components (inline or reference)
1506
1534
  entity: EntityRefSchema,
1535
+ // Mirrors the `OrbitalDefinition.auxiliaryEntities` type field — WAS
1536
+ // undeclared here, so `OrbitalSchemaSchema.safeParse` (every load through
1537
+ // `external-loader.ts`) silently stripped it on every externally-loaded
1538
+ // orbital (zod drops unrecognized keys by default), while a schema parsed
1539
+ // directly via `JSON.parse` kept it. Found via the entity-field auto-merge
1540
+ // rebind-target fallback landing on the wrong entity for any RECURSIVELY
1541
+ // loaded `uses` file (`packages/almadar-runtime/src/resolver/
1542
+ // reference-resolver.ts`'s `mergeImportedEntityFieldsIntoOrbital`).
1543
+ auxiliaryEntities: z.array(EntityRefSchema).optional(),
1507
1544
  traits: z.array(TraitRefSchema),
1508
1545
  pages: z.array(PageRefSchema),
1509
1546
  // Event interface (trait-centric model) - computed by resolver
@@ -1511,6 +1548,10 @@ z.object({
1511
1548
  listens: z.array(ComputedEventListenerSchema).optional(),
1512
1549
  // Filter for exposed events (trait-centric model)
1513
1550
  exposes: z.array(z.string()).optional(),
1551
+ // This orbital's own declared knobs (§4.5)
1552
+ config: DeclaredTraitConfigSchema.optional(),
1553
+ // Transient — set by lowering, cleared by inline/resolve
1554
+ reference: OrbitalRefObjectSchema.optional(),
1514
1555
  // Context fields - persisted throughout orbital lifecycle
1515
1556
  domainContext: DomainContextSchema.optional(),
1516
1557
  design: DesignPreferencesSchema.optional(),