@almadar/core 5.1.0 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import { d as EntityRow, aS as FieldValue, S as SExpr } from '../schema-CsX_xlhO.js';
2
- export { A as AGENT_DOMAIN_CATEGORIES, m as ALLOWED_CUSTOM_COMPONENTS, n as AgentDomainCategory, o as AgentDomainCategorySchema, p as AgentEffect, q as AllowedCustomComponent, r as AnimationDef, s as AnimationDefInput, t as AnimationDefSchema, g as AppSchema, u as AssetMap, v as AssetMapInput, w as AssetMapSchema, x as AssetMapping, y as AssetMappingInput, z as AssetMappingSchema, B as AtomicEffect, C as CORE_BINDINGS, D as CallServiceConfig, F as CallServiceEffect, G as ComputedEventContract, H as ComputedEventContractSchema, I as ComputedEventListener, J as ComputedEventListenerSchema, K as CoreBinding, L as CustomPatternDefinition, M as CustomPatternDefinitionInput, N as CustomPatternDefinitionSchema, Q as CustomPatternMap, R as CustomPatternMapInput, V as CustomPatternMapSchema, W as DerefEffect, X as DesignPreferences, Y as DesignPreferencesInput, Z as DesignPreferencesSchema, _ as DesignTokens, $ as DesignTokensInput, a0 as DesignTokensSchema, a1 as DespawnEffect, a2 as DoEffect, a3 as DomainCategory, a4 as DomainCategorySchema, a5 as DomainContext, a6 as DomainContextInput, a7 as DomainContextSchema, a8 as DomainVocabulary, a9 as DomainVocabularySchema, aa as ENTITY_ROLES, ab as Effect, ac as EffectInput, ad as EffectSchema, ae as EmitConfig, af as EmitEffect, E as Entity, ag as EntityCall, ah as EntityCallSchema, ai as EntityData, b as EntityField, aj as EntityFieldInput, ak as EntityFieldSchema, c as EntityPersistence, al as EntityPersistenceSchema, e as EntityRef, am as EntityRefSchema, an as EntityRefStringSchema, ao as EntityRole, ap as EntityRoleSchema, aq as EntitySchema, ar as EntitySemanticRole, as as EntitySemanticRoleSchema, at as EvalContext, au as Event, av as EventInput, aw as EventListener, ax as EventListenerSchema, ay as EventPayload, az as EventPayloadField, aA as EventPayloadFieldSchema, aB as EventSchema, aC as EventScope, aD as EventScopeSchema, aE as EventSemanticRole, aF as EventSemanticRoleSchema, aG as EventSource, aH as EventSourceSchema, aI as Expression, aJ as ExpressionInput, aK as ExpressionSchema, aL as FetchEffect, aM as Field, aN as FieldFormat, aO as FieldFormatSchema, aP as FieldSchema, aQ as FieldType, aR as FieldTypeSchema, aT as FullOrbitalUnit, aU as GAME_TYPES, aV as GameSubCategory, aW as GameSubCategorySchema, aX as GameType, aY as GameTypeSchema, aZ as Guard, a_ as GuardInput, a$ as GuardSchema, b0 as LogEffect, b1 as LogMeta, b2 as McpServiceDef, b3 as McpServiceDefSchema, b4 as NavigateEffect, b5 as NodeClassification, b6 as NodeClassificationSchema, b7 as NotifyEffect, aT as Orbital, b8 as OrbitalConfig, b9 as OrbitalConfigInput, ba as OrbitalConfigSchema, O as OrbitalDefinition, bb as OrbitalDefinitionSchema, bc as OrbitalEntity, bd as OrbitalEntityInput, be as OrbitalEntitySchema, bf as OrbitalInput, bg as OrbitalPage, bh as OrbitalPageInput, bi as OrbitalPageSchema, bj as OrbitalPageStrictInput, bk as OrbitalPageStrictSchema, g as OrbitalSchema, bl as OrbitalSchemaInput, bm as OrbitalSchemaSchema, bn as OrbitalTraitRef, bo as OrbitalTraitRefSchema, bp as OrbitalUnit, bq as OrbitalUnitSchema, br as OrbitalZodSchema, i as Page, P as PageRef, j as PageRefObject, bs as PageRefObjectSchema, bt as PageRefSchema, bu as PageRefStringSchema, bv as PageSchema, bw as PageTraitRef, bx as PageTraitRefSchema, by as ParsedBinding, bz as PayloadField, bA as PayloadFieldSchema, bB as PersistEffect, bC as PresentationType, bD as RefEffect, bE as RelatedLink, bF as RelatedLinkSchema, bG as RelationConfig, bH as RelationConfigSchema, bI as RenderItemLambda, bJ as RenderUIConfig, bK as RenderUIEffect, bL as RenderUINode, bM as RequiredField, bN as RequiredFieldSchema, bO as ResolvedAsset, bP as ResolvedAssetInput, bQ as ResolvedAssetSchema, bR as ResolvedPatternProps, bS as RestAuthConfig, bT as RestAuthConfigSchema, bU as RestServiceDef, bV as RestServiceDefSchema, bW as SERVICE_TYPES, bX as SExprAtom, bY as SExprAtomSchema, bZ as SExprInput, b_ as SExprSchema, b$ as SemanticAssetRef, c0 as SemanticAssetRefInput, c1 as SemanticAssetRefSchema, c2 as ServiceDefinition, c3 as ServiceDefinitionSchema, c4 as ServiceParams, c5 as ServiceRef, c6 as ServiceRefObject, c7 as ServiceRefObjectSchema, c8 as ServiceRefSchema, c9 as ServiceRefStringSchema, ca as ServiceType, cb as ServiceTypeSchema, cc as SetEffect, cd as SocketEvents, ce as SocketEventsSchema, cf as SocketServiceDef, cg as SocketServiceDefSchema, ch as SpawnEffect, l as State, ci as StateInput, cj as StateMachine, ck as StateMachineInput, cl as StateMachineSchema, cm as StateSchema, cn as StateSemanticRole, co as StateSemanticRoleSchema, cp as SuggestedGuard, cq as SuggestedGuardSchema, cr as SwapEffect, cs as ThemeDefinition, ct as ThemeDefinitionSchema, cu as ThemeRef, cv as ThemeRefSchema, cw as ThemeRefStringSchema, cx as ThemeTokens, cy as ThemeTokensSchema, cz as ThemeVariant, cA as ThemeVariantSchema, h as Trait, cB as TraitCategory, cC as TraitCategorySchema, cD as TraitDataEntity, cE as TraitDataEntitySchema, cF as TraitEntityField, cG as TraitEntityFieldSchema, T as TraitEventContract, cH as TraitEventContractSchema, a as TraitEventListener, cI as TraitEventListenerSchema, cJ as TraitInput, f as TraitRef, cK as TraitRefSchema, k as TraitReference, cL as TraitReferenceInput, cM as TraitReferenceSchema, cN as TraitSchema, cO as TraitTick, cP as TraitTickSchema, cQ as TraitUIBinding, cR as Transition, cS as TransitionInput, cT as TransitionSchema, cU as TypedEffect, cV as UISlot, cW as UISlotSchema, cX as UI_SLOTS, cY as UXHints, cZ as UXHintsSchema, U as UseDeclaration, c_ as UseDeclarationSchema, c$ as UserPersona, d0 as UserPersonaInput, d1 as UserPersonaSchema, d2 as VISUAL_STYLES, d3 as ViewType, d4 as ViewTypeSchema, d5 as VisualStyle, d6 as VisualStyleSchema, d7 as WatchEffect, d8 as WatchOptions, d9 as atomic, da as callService, db as collectBindings, dc as createAssetKey, dd as deref, de as deriveCollection, df as despawn, dg as doEffects, dh as emit, di as findService, dj as getArgs, dk as getDefaultAnimationsForRole, dl as getOperator, dm as getServiceNames, dn as getTraitConfig, dp as getTraitName, dq as hasService, dr as isBinding, ds as isCircuitEvent, dt as isEffect, du as isEntityCall, dv as isEntityReference, dw as isEntityReferenceAny, dx as isImportedTraitRef, dy as isInlineTrait, dz as isMcpService, dA as isOrbitalDefinition, dB as isPageReference, dC as isPageReferenceObject, dD as isPageReferenceString, dE as isRestService, dF as isRuntimeEntity, dG as isSExpr, dH as isSExprAtom, dI as isSExprCall, dJ as isSExprEffect, dK as isServiceReference, dL as isServiceReferenceObject, dM as isSingletonEntity, dN as isSocketService, dO as isThemeReference, dP as isValidBinding, dQ as navigate, dR as normalizeTraitRef, dS as notify, dT as parseAssetKey, dU as parseBinding, dV as parseEntityRef, dW as parseImportedTraitRef, dX as parseOrbitalSchema, dY as parsePageRef, dZ as parseServiceRef, d_ as persist, d$ as ref, e0 as renderUI, e1 as safeParseOrbitalSchema, e2 as set, e3 as sexpr, e4 as spawn, e5 as swap, e6 as validateAssetAnimations, e7 as walkSExpr, e8 as watch } from '../schema-CsX_xlhO.js';
1
+ import { e as EntityRow, aT as FieldValue, S as SExpr, b as TraitConfig, az as EventPayload } from '../schema-ks5fDpzp.js';
2
+ export { A as AGENT_DOMAIN_CATEGORIES, n as ALLOWED_CUSTOM_COMPONENTS, o as AgentDomainCategory, p as AgentDomainCategorySchema, q as AgentEffect, r as AllowedCustomComponent, s as AnimationDef, t as AnimationDefInput, u as AnimationDefSchema, h as AppSchema, v as AssetMap, w as AssetMapInput, x as AssetMapSchema, y as AssetMapping, z as AssetMappingInput, B as AssetMappingSchema, C as AtomicEffect, D as CORE_BINDINGS, F as CallServiceConfig, G as CallServiceEffect, H as ComputedEventContract, I as ComputedEventContractSchema, J as ComputedEventListener, K as ComputedEventListenerSchema, L as CoreBinding, M as CustomPatternDefinition, N as CustomPatternDefinitionInput, Q as CustomPatternDefinitionSchema, R as CustomPatternMap, V as CustomPatternMapInput, W as CustomPatternMapSchema, X as DerefEffect, Y as DesignPreferences, Z as DesignPreferencesInput, _ as DesignPreferencesSchema, $ as DesignTokens, a0 as DesignTokensInput, a1 as DesignTokensSchema, a2 as DespawnEffect, a3 as DoEffect, a4 as DomainCategory, a5 as DomainCategorySchema, a6 as DomainContext, a7 as DomainContextInput, a8 as DomainContextSchema, a9 as DomainVocabulary, aa as DomainVocabularySchema, ab as ENTITY_ROLES, ac as Effect, ad as EffectInput, ae as EffectSchema, af as EmitConfig, ag as EmitEffect, E as Entity, ah as EntityCall, ai as EntityCallSchema, aj as EntityData, c as EntityField, ak as EntityFieldInput, al as EntityFieldSchema, d as EntityPersistence, am as EntityPersistenceSchema, f as EntityRef, an as EntityRefSchema, ao as EntityRefStringSchema, ap as EntityRole, aq as EntityRoleSchema, ar as EntitySchema, as as EntitySemanticRole, at as EntitySemanticRoleSchema, au as EvalContext, av as Event, aw as EventInput, ax as EventListener, ay as EventListenerSchema, aA as EventPayloadField, aB as EventPayloadFieldSchema, aC as EventSchema, aD as EventScope, aE as EventScopeSchema, aF as EventSemanticRole, aG as EventSemanticRoleSchema, aH as EventSource, aI as EventSourceSchema, aJ as Expression, aK as ExpressionInput, aL as ExpressionSchema, aM as FetchEffect, aN as Field, aO as FieldFormat, aP as FieldFormatSchema, aQ as FieldSchema, aR as FieldType, aS as FieldTypeSchema, aU as FullOrbitalUnit, aV as GAME_TYPES, aW as GameSubCategory, aX as GameSubCategorySchema, aY as GameType, aZ as GameTypeSchema, a_ as Guard, a$ as GuardInput, b0 as GuardSchema, b1 as ListenSource, b2 as ListenSourceSchema, b3 as LogEffect, b4 as LogMeta, b5 as McpServiceDef, b6 as McpServiceDefSchema, b7 as NavigateEffect, b8 as NodeClassification, b9 as NodeClassificationSchema, ba as NotifyEffect, aU as Orbital, bb as OrbitalConfig, bc as OrbitalConfigInput, bd as OrbitalConfigSchema, O as OrbitalDefinition, be as OrbitalDefinitionSchema, bf as OrbitalEntity, bg as OrbitalEntityInput, bh as OrbitalEntitySchema, bi as OrbitalInput, bj as OrbitalPage, bk as OrbitalPageInput, bl as OrbitalPageSchema, bm as OrbitalPageStrictInput, bn as OrbitalPageStrictSchema, h as OrbitalSchema, bo as OrbitalSchemaInput, bp as OrbitalSchemaSchema, bq as OrbitalTraitRef, br as OrbitalTraitRefSchema, bs as OrbitalUnit, bt as OrbitalUnitSchema, bu as OrbitalZodSchema, j as Page, P as PageRef, k as PageRefObject, bv as PageRefObjectSchema, bw as PageRefSchema, bx as PageRefStringSchema, by as PageSchema, bz as PageTraitRef, bA as PageTraitRefSchema, bB as ParsedBinding, bC as PayloadField, bD as PayloadFieldSchema, bE as PersistEffect, bF as PresentationType, bG as RefEffect, bH as RelatedLink, bI as RelatedLinkSchema, bJ as RelationConfig, bK as RelationConfigSchema, bL as RenderItemLambda, bM as RenderUIConfig, bN as RenderUIEffect, bO as RenderUINode, bP as RequiredField, bQ as RequiredFieldSchema, bR as ResolvedAsset, bS as ResolvedAssetInput, bT as ResolvedAssetSchema, bU as ResolvedPatternProps, bV as RestAuthConfig, bW as RestAuthConfigSchema, bX as RestServiceDef, bY as RestServiceDefSchema, bZ as SERVICE_TYPES, b_ as SExprAtom, b$ as SExprAtomSchema, c0 as SExprInput, c1 as SExprSchema, c2 as SemanticAssetRef, c3 as SemanticAssetRefInput, c4 as SemanticAssetRefSchema, c5 as ServiceDefinition, c6 as ServiceDefinitionSchema, c7 as ServiceParams, c8 as ServiceRef, c9 as ServiceRefObject, ca as ServiceRefObjectSchema, cb as ServiceRefSchema, cc as ServiceRefStringSchema, cd as ServiceType, ce as ServiceTypeSchema, cf as SetEffect, cg as SocketEvents, ch as SocketEventsSchema, ci as SocketServiceDef, cj as SocketServiceDefSchema, ck as SpawnEffect, m as State, cl as StateInput, cm as StateMachine, cn as StateMachineInput, co as StateMachineSchema, cp as StateSchema, cq as StateSemanticRole, cr as StateSemanticRoleSchema, cs as SuggestedGuard, ct as SuggestedGuardSchema, cu as SwapEffect, cv as ThemeDefinition, cw as ThemeDefinitionSchema, cx as ThemeRef, cy as ThemeRefSchema, cz as ThemeRefStringSchema, cA as ThemeTokens, cB as ThemeTokensSchema, cC as ThemeVariant, cD as ThemeVariantSchema, i as Trait, cE as TraitCategory, cF as TraitCategorySchema, cG as TraitConfigObject, cH as TraitConfigSchema, cI as TraitConfigValue, cJ as TraitConfigValueSchema, cK as TraitDataEntity, cL as TraitDataEntitySchema, cM as TraitEntityField, cN as TraitEntityFieldSchema, T as TraitEventContract, cO as TraitEventContractSchema, a as TraitEventListener, cP as TraitEventListenerSchema, cQ as TraitInput, g as TraitRef, cR as TraitRefSchema, l as TraitReference, cS as TraitReferenceInput, cT as TraitReferenceSchema, cU as TraitSchema, cV as TraitTick, cW as TraitTickSchema, cX as TraitUIBinding, cY as Transition, cZ as TransitionInput, c_ as TransitionSchema, c$ as TypedEffect, d0 as UISlot, d1 as UISlotSchema, d2 as UI_SLOTS, d3 as UXHints, d4 as UXHintsSchema, U as UseDeclaration, d5 as UseDeclarationSchema, d6 as UserPersona, d7 as UserPersonaInput, d8 as UserPersonaSchema, d9 as VISUAL_STYLES, da as ViewType, db as ViewTypeSchema, dc as VisualStyle, dd as VisualStyleSchema, de as WatchEffect, df as WatchOptions, dg as atomic, dh as callService, di as collectBindings, dj as createAssetKey, dk as deref, dl as deriveCollection, dm as despawn, dn as doEffects, dp as emit, dq as findService, dr as getArgs, ds as getDefaultAnimationsForRole, dt as getOperator, du as getServiceNames, dv as getTraitConfig, dw as getTraitName, dx as hasService, dy as isBinding, dz as isCircuitEvent, dA as isEffect, dB as isEntityCall, dC as isEntityReference, dD as isEntityReferenceAny, dE as isImportedTraitRef, dF as isInlineTrait, dG as isMcpService, dH as isOrbitalDefinition, dI as isPageReference, dJ as isPageReferenceObject, dK as isPageReferenceString, dL as isRestService, dM as isRuntimeEntity, dN as isSExpr, dO as isSExprAtom, dP as isSExprCall, dQ as isSExprEffect, dR as isServiceReference, dS as isServiceReferenceObject, dT as isSingletonEntity, dU as isSocketService, dV as isThemeReference, dW as isValidBinding, dX as navigate, dY as normalizeTraitRef, dZ as notify, d_ as parseAssetKey, d$ as parseBinding, e0 as parseEntityRef, e1 as parseImportedTraitRef, e2 as parseOrbitalSchema, e3 as parsePageRef, e4 as parseServiceRef, e5 as persist, e6 as ref, e7 as renderUI, e8 as safeParseOrbitalSchema, e9 as set, ea as sexpr, eb as spawn, ec as swap, ed as validateAssetAnimations, ee as walkSExpr, ef as watch } from '../schema-ks5fDpzp.js';
3
3
  import { z } from 'zod';
4
4
  export { PATTERN_TYPES, PatternConfig, PatternType, isValidPatternType } from '@almadar/patterns';
5
5
 
@@ -749,15 +749,6 @@ interface LazyService<T> {
749
749
  */
750
750
  declare function createLazyService<T>(factory: () => T): LazyService<T>;
751
751
 
752
- /**
753
- * Shared Intermediate Representation Types
754
- *
755
- * Unified IR types used by both the compiler and runtime.
756
- * This is the single source of truth for IR structures.
757
- *
758
- * @packageDocumentation
759
- */
760
-
761
752
  /**
762
753
  * Transition source state specification.
763
754
  * - string: Single state name (e.g., 'Idle')
@@ -895,7 +886,7 @@ interface ResolvedTrait {
895
886
  ticks: ResolvedTraitTick[];
896
887
  listens: ResolvedTraitListener[];
897
888
  dataEntities: ResolvedTraitDataEntity[];
898
- config?: Record<string, unknown>;
889
+ config?: TraitConfig;
899
890
  ui?: ResolvedTraitUIBinding;
900
891
  }
901
892
  /**
@@ -909,7 +900,7 @@ interface ResolvedTraitBinding {
909
900
  /** Entity this trait operates on (if any) */
910
901
  linkedEntity?: string;
911
902
  /** Instance configuration */
912
- config?: Record<string, unknown>;
903
+ config?: TraitConfig;
913
904
  }
914
905
  interface ResolvedPattern {
915
906
  /** Pattern type (e.g., 'page-header', 'entity-list', 'game-canvas') */
@@ -1033,4 +1024,81 @@ declare function createResolvedField(field: {
1033
1024
  */
1034
1025
  declare function isResolvedIR(ir: unknown): ir is ResolvedIR;
1035
1026
 
1036
- export { type AgentCodeSearchResult, type AgentCompactResult, type AgentCompactStrategy, type AgentContext, type AgentGenerateOptions, type AgentMemoryCategory, type AgentMemoryRecord, type AppSummary, BINDING_CONTEXT_RULES, BINDING_DOCS, type BindingContext, BindingSchema, type CategorizedRemovals, type ChangeAuthor, type ChangeSetDocument, type ChangeSummary, type CreateFlow, DEFAULT_INTERACTION_MODELS, type DeleteFlow, type EditFlow, EntityRow, FieldValue, type GitHubLink, type HistoryMeta, type InteractionModel, type InteractionModelInput, InteractionModelSchema, type LazyService, type ListInteraction, type PageContentReduction, PatternTypeSchema, type PersistActionName, type ResolvedEntity, type ResolvedEntityBinding, type ResolvedField, type ResolvedIR, type ResolvedNavigation, type ResolvedPage, type ResolvedPattern, type ResolvedSection, type ResolvedSectionEvent, type ResolvedTrait, type ResolvedTraitBinding, type ResolvedTraitDataEntity, type ResolvedTraitEvent, type ResolvedTraitGuard, type ResolvedTraitListener, type ResolvedTraitState, type ResolvedTraitTick, type ResolvedTraitTransition, type ResolvedTraitUIBinding, SExpr, type SaveOptions, type SaveResult, type SchemaChange, type SemanticChangeKind, type SemanticSchemaChange, type ServiceAction, type ServiceActionName, type ServiceContract, type ServiceEvents, type SnapshotDocument, type StatsView, type StoreContract, type StoreFilter, type StoreFilterOp, type TransitionFrom, type ValidationDocument, type ValidationIssue, type ValidationMeta, type ValidationResults, type ViewFlow, createEmptyResolvedPage, createEmptyResolvedTrait, createLazyService, createResolvedField, createTypedEventBus, getAllPatternTypes, getBindingExamples, getInteractionModelForDomain, inferTsType, isResolvedIR, validateBindingInContext };
1027
+ /**
1028
+ * Context Extensions (framework concept)
1029
+ *
1030
+ * Open interface for consumer-supplied context that flows through guards,
1031
+ * effects, and evaluation. Generated code imports `ContextExtensions`
1032
+ * instead of `Record<string, unknown>` / `unknown` for the extensions bag,
1033
+ * so downstream type-checking verifies that every read of a context key
1034
+ * lines up with a declared interface member.
1035
+ *
1036
+ * Declaration-merging pattern — consumers augment this interface with
1037
+ * their own optional fields:
1038
+ *
1039
+ * ```ts
1040
+ * declare module '@almadar/core' {
1041
+ * interface ContextExtensions {
1042
+ * agent?: AgentContext;
1043
+ * auth?: AuthContext;
1044
+ * }
1045
+ * }
1046
+ * ```
1047
+ *
1048
+ * With no augmentation the interface is `{}` — `ctx.extensions.foo` is
1049
+ * a type error, which is the desired behavior: if the codegen hits a
1050
+ * context field that nobody declared, the consumer project is expected
1051
+ * to add the declaration rather than widen to `unknown`.
1052
+ *
1053
+ * @packageDocumentation
1054
+ */
1055
+ interface ContextExtensions {
1056
+ }
1057
+
1058
+ /**
1059
+ * Bus Event Types (framework concept)
1060
+ *
1061
+ * Canonical event shape for Almadar's cross-package event bus. Hoisted into
1062
+ * `@almadar/core` so `@almadar/ui`, `@almadar/runtime`, and generated code
1063
+ * all agree on the same structure. Replaces the previously divergent
1064
+ * `KFlowEvent` (ui) and `RuntimeEvent` (runtime) definitions.
1065
+ *
1066
+ * @packageDocumentation
1067
+ */
1068
+
1069
+ /**
1070
+ * Identifies the origin of a bus event. Used by cross-trait listeners to
1071
+ * filter emits from specific orbitals, traits, transitions, or ticks.
1072
+ *
1073
+ * `transition` and `tick` are optional runtime-internal details; most
1074
+ * consumers only care about `orbital` and `trait`.
1075
+ */
1076
+ interface BusEventSource {
1077
+ orbital?: string;
1078
+ trait?: string;
1079
+ transition?: string;
1080
+ tick?: string;
1081
+ }
1082
+ /**
1083
+ * An event flowing on the bus.
1084
+ *
1085
+ * The `source` field is structured so cross-trait listeners can match
1086
+ * `event.source?.orbital === 'X' && event.source?.trait === 'Y'` without
1087
+ * parsing a delimiter.
1088
+ */
1089
+ interface BusEvent {
1090
+ /** Event type identifier (e.g., 'CartItemLoaded', 'TASK_COMPLETED') */
1091
+ type: string;
1092
+ /** Optional structured payload */
1093
+ payload?: EventPayload;
1094
+ /** Timestamp when the event was emitted */
1095
+ timestamp: number;
1096
+ /** Optional origin info for filtering */
1097
+ source?: BusEventSource;
1098
+ }
1099
+ /** Bus event listener callback. */
1100
+ type BusEventListener = (event: BusEvent) => void;
1101
+ /** Returned by `on()` / `once()` to detach a listener. */
1102
+ type Unsubscribe = () => void;
1103
+
1104
+ export { type AgentCodeSearchResult, type AgentCompactResult, type AgentCompactStrategy, type AgentContext, type AgentGenerateOptions, type AgentMemoryCategory, type AgentMemoryRecord, type AppSummary, BINDING_CONTEXT_RULES, BINDING_DOCS, type BindingContext, BindingSchema, type BusEvent, type BusEventListener, type BusEventSource, type CategorizedRemovals, type ChangeAuthor, type ChangeSetDocument, type ChangeSummary, type ContextExtensions, type CreateFlow, DEFAULT_INTERACTION_MODELS, type DeleteFlow, type EditFlow, EntityRow, EventPayload, FieldValue, type GitHubLink, type HistoryMeta, type InteractionModel, type InteractionModelInput, InteractionModelSchema, type LazyService, type ListInteraction, type PageContentReduction, PatternTypeSchema, type PersistActionName, type ResolvedEntity, type ResolvedEntityBinding, type ResolvedField, type ResolvedIR, type ResolvedNavigation, type ResolvedPage, type ResolvedPattern, type ResolvedSection, type ResolvedSectionEvent, type ResolvedTrait, type ResolvedTraitBinding, type ResolvedTraitDataEntity, type ResolvedTraitEvent, type ResolvedTraitGuard, type ResolvedTraitListener, type ResolvedTraitState, type ResolvedTraitTick, type ResolvedTraitTransition, type ResolvedTraitUIBinding, SExpr, type SaveOptions, type SaveResult, type SchemaChange, type SemanticChangeKind, type SemanticSchemaChange, type ServiceAction, type ServiceActionName, type ServiceContract, type ServiceEvents, type SnapshotDocument, type StatsView, type StoreContract, type StoreFilter, type StoreFilterOp, TraitConfig, type TransitionFrom, type Unsubscribe, type ValidationDocument, type ValidationIssue, type ValidationMeta, type ValidationResults, type ViewFlow, createEmptyResolvedPage, createEmptyResolvedTrait, createLazyService, createResolvedField, createTypedEventBus, getAllPatternTypes, getBindingExamples, getInteractionModelForDomain, inferTsType, isResolvedIR, validateBindingInContext };
@@ -239,36 +239,6 @@ function isRuntimeEntity(entity) {
239
239
  function isSingletonEntity(entity) {
240
240
  return entity.persistence === "singleton";
241
241
  }
242
- var ViewTypeSchema = z.enum([
243
- "list",
244
- "detail",
245
- "create",
246
- "edit",
247
- "dashboard",
248
- "custom"
249
- ]);
250
- var PageTraitRefSchema = z.object({
251
- ref: z.string().min(1, "Trait ref is required"),
252
- linkedEntity: z.string().optional(),
253
- config: z.record(z.unknown()).optional()
254
- });
255
- var OrbitalPageStrictSchema = z.object({
256
- name: z.string().min(1, "Page name is required"),
257
- path: z.string().min(1, "Page path is required").startsWith("/", "Path must start with /"),
258
- primaryEntity: z.string().min(1, "Primary entity is required"),
259
- traits: z.array(PageTraitRefSchema).min(1, "Page must have at least one trait"),
260
- title: z.string().optional()
261
- }).strict();
262
- var OrbitalPageSchema = z.object({
263
- name: z.string().min(1, "Page name is required"),
264
- path: z.string().min(1, "Page path is required").startsWith("/", "Path must start with /"),
265
- viewType: ViewTypeSchema.optional(),
266
- title: z.string().optional(),
267
- primaryEntity: z.string().optional(),
268
- traits: z.array(PageTraitRefSchema).optional(),
269
- isInitial: z.boolean().optional()
270
- }).strict();
271
- var PageSchema = OrbitalPageSchema;
272
242
  var UI_SLOTS = [
273
243
  // App slots
274
244
  "main",
@@ -494,6 +464,17 @@ function isCircuitEvent(event) {
494
464
  }
495
465
 
496
466
  // src/types/trait.ts
467
+ var TraitConfigValueSchema = z.lazy(
468
+ () => z.union([
469
+ z.string(),
470
+ z.number(),
471
+ z.boolean(),
472
+ z.null(),
473
+ z.array(TraitConfigValueSchema),
474
+ z.record(TraitConfigValueSchema)
475
+ ])
476
+ );
477
+ var TraitConfigSchema = z.record(TraitConfigValueSchema);
497
478
  var TraitCategorySchema = z.enum([
498
479
  "lifecycle",
499
480
  "temporal",
@@ -566,12 +547,22 @@ var TraitEventContractSchema = z.object({
566
547
  payload: z.array(EventPayloadFieldSchema).optional(),
567
548
  scope: EventScopeSchema.optional()
568
549
  });
550
+ var ListenSourceSchema = z.union([
551
+ z.object({ kind: z.literal("any") }),
552
+ z.object({ kind: z.literal("trait"), trait: z.string().min(1) }),
553
+ z.object({
554
+ kind: z.literal("orbital"),
555
+ orbital: z.string().min(1),
556
+ trait: z.string().min(1)
557
+ })
558
+ ]);
569
559
  var TraitEventListenerSchema = z.object({
570
560
  event: z.string().min(1),
571
561
  triggers: z.string().min(1),
572
562
  guard: ExpressionSchema.optional(),
573
563
  scope: EventScopeSchema.optional(),
574
- payloadMapping: z.record(z.string()).optional()
564
+ payloadMapping: z.record(z.string()).optional(),
565
+ source: ListenSourceSchema.optional()
575
566
  });
576
567
  var RequiredFieldSchema = z.object({
577
568
  name: z.string().min(1),
@@ -588,7 +579,7 @@ var TraitReferenceSchema = z.object({
588
579
  z.string().min(1, "events key (atom event name) must be non-empty"),
589
580
  z.string().min(1, "events value (caller event name) must be non-empty")
590
581
  ).optional(),
591
- config: z.record(z.record(z.unknown())).optional(),
582
+ config: TraitConfigSchema.optional(),
592
583
  appliesTo: z.array(z.string()).optional(),
593
584
  // Phase F.7: zod accepts an array (the inliner validates element
594
585
  // shape). The full ListenDefinition shape isn't recursively encoded
@@ -639,7 +630,7 @@ var TraitRefSchema = z.union([
639
630
  z.string().min(1),
640
631
  z.object({
641
632
  ref: z.string().min(1),
642
- config: z.record(z.unknown()).optional(),
633
+ config: TraitConfigSchema.optional(),
643
634
  linkedEntity: z.string().optional(),
644
635
  name: z.string().optional(),
645
636
  // Phase F.4: same non-empty refine as TraitReferenceSchema.events.
@@ -684,6 +675,38 @@ function normalizeTraitRef(traitRef) {
684
675
  return traitRef;
685
676
  }
686
677
  var OrbitalTraitRefSchema = TraitRefSchema;
678
+
679
+ // src/types/page.ts
680
+ var ViewTypeSchema = z.enum([
681
+ "list",
682
+ "detail",
683
+ "create",
684
+ "edit",
685
+ "dashboard",
686
+ "custom"
687
+ ]);
688
+ var PageTraitRefSchema = z.object({
689
+ ref: z.string().min(1, "Trait ref is required"),
690
+ linkedEntity: z.string().optional(),
691
+ config: TraitConfigSchema.optional()
692
+ });
693
+ var OrbitalPageStrictSchema = z.object({
694
+ name: z.string().min(1, "Page name is required"),
695
+ path: z.string().min(1, "Page path is required").startsWith("/", "Path must start with /"),
696
+ primaryEntity: z.string().min(1, "Primary entity is required"),
697
+ traits: z.array(PageTraitRefSchema).min(1, "Page must have at least one trait"),
698
+ title: z.string().optional()
699
+ }).strict();
700
+ var OrbitalPageSchema = z.object({
701
+ name: z.string().min(1, "Page name is required"),
702
+ path: z.string().min(1, "Page path is required").startsWith("/", "Path must start with /"),
703
+ viewType: ViewTypeSchema.optional(),
704
+ title: z.string().optional(),
705
+ primaryEntity: z.string().optional(),
706
+ traits: z.array(PageTraitRefSchema).optional(),
707
+ isInitial: z.boolean().optional()
708
+ }).strict();
709
+ var PageSchema = OrbitalPageSchema;
687
710
  var DomainCategorySchema = z.enum([
688
711
  "healthcare",
689
712
  "education",
@@ -1359,6 +1382,6 @@ function isResolvedIR(ir) {
1359
1382
  return typeof r.appName === "string" && r.traits instanceof Map && r.pages instanceof Map;
1360
1383
  }
1361
1384
 
1362
- export { AGENT_DOMAIN_CATEGORIES, ALLOWED_CUSTOM_COMPONENTS, AgentDomainCategorySchema, 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, EntityCallSchema, 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, ServiceRefObjectSchema, 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, atomic, callService, collectBindings, createAssetKey, createEmptyResolvedPage, createEmptyResolvedTrait, createLazyService, createResolvedField, createTypedEventBus, deref, deriveCollection, despawn, doEffects, emit, findService, getAllPatternTypes, getArgs, getBindingExamples, getDefaultAnimationsForRole, getInteractionModelForDomain, getOperator, getServiceNames, getTraitConfig, getTraitName, hasService, inferTsType, isBinding, isCircuitEvent, isEffect, isEntityCall, isEntityReference, isEntityReferenceAny, isImportedTraitRef, isInlineTrait, isMcpService, isOrbitalDefinition, isPageReference, isPageReferenceObject, isPageReferenceString, isResolvedIR, isRestService, isRuntimeEntity, isSExpr, isSExprAtom, isSExprCall, isSExprEffect, isServiceReference, isServiceReferenceObject, isSingletonEntity, isSocketService, isThemeReference, isValidBinding, navigate, normalizeTraitRef, notify, parseAssetKey, parseBinding, parseEntityRef, parseImportedTraitRef, parseOrbitalSchema, parsePageRef, parseServiceRef, persist, ref, renderUI, safeParseOrbitalSchema, set, sexpr, spawn, swap, validateAssetAnimations, validateBindingInContext, walkSExpr, watch };
1385
+ export { AGENT_DOMAIN_CATEGORIES, ALLOWED_CUSTOM_COMPONENTS, AgentDomainCategorySchema, 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, EntityCallSchema, EntityFieldSchema, EntityPersistenceSchema, EntityRefSchema, EntityRefStringSchema, EntityRoleSchema, EntitySchema, EntitySemanticRoleSchema, EventListenerSchema, EventPayloadFieldSchema, EventSchema, EventScopeSchema, EventSemanticRoleSchema, EventSourceSchema, ExpressionSchema, FieldFormatSchema, FieldSchema, FieldTypeSchema, GAME_TYPES, GameSubCategorySchema, GameTypeSchema, GuardSchema, InteractionModelSchema, ListenSourceSchema, 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, ServiceRefObjectSchema, ServiceRefSchema, ServiceRefStringSchema, ServiceTypeSchema, SocketEventsSchema, SocketServiceDefSchema, StateMachineSchema, StateSchema, StateSemanticRoleSchema, SuggestedGuardSchema, ThemeDefinitionSchema, ThemeRefSchema, ThemeRefStringSchema, ThemeTokensSchema, ThemeVariantSchema, TraitCategorySchema, TraitConfigSchema, TraitConfigValueSchema, TraitDataEntitySchema, TraitEntityFieldSchema, TraitEventContractSchema, TraitEventListenerSchema, TraitRefSchema, TraitReferenceSchema, TraitSchema, TraitTickSchema, TransitionSchema, UISlotSchema, UI_SLOTS, UXHintsSchema, UseDeclarationSchema, UserPersonaSchema, VISUAL_STYLES, ViewTypeSchema, VisualStyleSchema, atomic, callService, collectBindings, createAssetKey, createEmptyResolvedPage, createEmptyResolvedTrait, createLazyService, createResolvedField, createTypedEventBus, deref, deriveCollection, despawn, doEffects, emit, findService, getAllPatternTypes, getArgs, getBindingExamples, getDefaultAnimationsForRole, getInteractionModelForDomain, getOperator, getServiceNames, getTraitConfig, getTraitName, hasService, inferTsType, isBinding, isCircuitEvent, isEffect, isEntityCall, isEntityReference, isEntityReferenceAny, isImportedTraitRef, isInlineTrait, isMcpService, isOrbitalDefinition, isPageReference, isPageReferenceObject, isPageReferenceString, isResolvedIR, isRestService, isRuntimeEntity, isSExpr, isSExprAtom, isSExprCall, isSExprEffect, isServiceReference, isServiceReferenceObject, isSingletonEntity, isSocketService, isThemeReference, isValidBinding, navigate, normalizeTraitRef, notify, parseAssetKey, parseBinding, parseEntityRef, parseImportedTraitRef, parseOrbitalSchema, parsePageRef, parseServiceRef, persist, ref, renderUI, safeParseOrbitalSchema, set, sexpr, spawn, swap, validateAssetAnimations, validateBindingInContext, walkSExpr, watch };
1363
1386
  //# sourceMappingURL=index.js.map
1364
1387
  //# sourceMappingURL=index.js.map