@almadar/core 5.4.0 → 5.6.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/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { h as OrbitalSchema, m as State, O as OrbitalDefinition } from './schema-4TWKcBt4.js';
2
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, 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, e as EntityRow, ar as EntitySchema, as as EntitySemanticRole, at as EntitySemanticRoleSchema, au as EvalContext, av as Event, aw as EventInput, ax as EventListener, ay as EventListenerSchema, az as EventPayload, aA as EventPayloadField, aB as EventPayloadFieldSchema, aC as EventPayloadValue, aD as EventSchema, aE as EventScope, aF as EventScopeSchema, aG as EventSemanticRole, aH as EventSemanticRoleSchema, aI as EventSource, aJ as EventSourceSchema, aK as Expression, aL as ExpressionInput, aM as ExpressionSchema, aN as FetchEffect, aO as Field, aP as FieldFormat, aQ as FieldFormatSchema, aR as FieldSchema, aS as FieldType, aT as FieldTypeSchema, aU as FieldValue, aV as FullOrbitalUnit, aW as GAME_TYPES, aX as GameSubCategory, aY as GameSubCategorySchema, aZ as GameType, a_ as GameTypeSchema, a$ as Guard, b0 as GuardInput, b1 as GuardSchema, b2 as ListenSource, b3 as ListenSourceSchema, b4 as LogEffect, b5 as LogMeta, b6 as McpServiceDef, b7 as McpServiceDefSchema, b8 as NavigateEffect, b9 as NodeClassification, ba as NodeClassificationSchema, bb as NotifyEffect, aV as Orbital, bc as OrbitalConfig, bd as OrbitalConfigInput, be as OrbitalConfigSchema, bf as OrbitalDefinitionSchema, bg as OrbitalEntity, bh as OrbitalEntityInput, bi as OrbitalEntitySchema, bj as OrbitalInput, bk as OrbitalPage, bl as OrbitalPageInput, bm as OrbitalPageSchema, bn as OrbitalPageStrictInput, bo as OrbitalPageStrictSchema, bp as OrbitalSchemaInput, bq as OrbitalSchemaSchema, br as OrbitalTraitRef, bs as OrbitalTraitRefSchema, bt as OrbitalUnit, bu as OrbitalUnitSchema, bv as OrbitalZodSchema, j as Page, P as PageRef, k as PageRefObject, bw as PageRefObjectSchema, bx as PageRefSchema, by as PageRefStringSchema, bz as PageSchema, bA as PageTraitRef, bB as PageTraitRefSchema, bC as ParsedBinding, bD as PayloadField, bE as PayloadFieldSchema, bF as PersistEffect, bG as PresentationType, bH as RefEffect, bI as RelatedLink, bJ as RelatedLinkSchema, bK as RelationConfig, bL as RelationConfigSchema, bM as RenderItemLambda, bN as RenderUIConfig, bO as RenderUIEffect, bP as RenderUINode, bQ as RequiredField, bR as RequiredFieldSchema, bS as ResolvedAsset, bT as ResolvedAssetInput, bU as ResolvedAssetSchema, bV as ResolvedPatternProps, bW as RestAuthConfig, bX as RestAuthConfigSchema, bY as RestServiceDef, bZ as RestServiceDefSchema, b_ as SERVICE_TYPES, S as SExpr, b$ as SExprAtom, c0 as SExprAtomSchema, c1 as SExprInput, c2 as SExprSchema, c3 as SemanticAssetRef, c4 as SemanticAssetRefInput, c5 as SemanticAssetRefSchema, c6 as ServiceDefinition, c7 as ServiceDefinitionSchema, c8 as ServiceParams, c9 as ServiceRef, ca as ServiceRefObject, cb as ServiceRefObjectSchema, cc as ServiceRefSchema, cd as ServiceRefStringSchema, ce as ServiceType, cf as ServiceTypeSchema, cg as SetEffect, ch as SocketEvents, ci as SocketEventsSchema, cj as SocketServiceDef, ck as SocketServiceDefSchema, cl as SpawnEffect, cm as StateInput, cn as StateMachine, co as StateMachineInput, cp as StateMachineSchema, cq as StateSchema, cr as StateSemanticRole, cs as StateSemanticRoleSchema, ct as SuggestedGuard, cu as SuggestedGuardSchema, cv as SwapEffect, cw as ThemeDefinition, cx as ThemeDefinitionSchema, cy as ThemeRef, cz as ThemeRefSchema, cA as ThemeRefStringSchema, cB as ThemeTokens, cC as ThemeTokensSchema, cD as ThemeVariant, cE as ThemeVariantSchema, i as Trait, cF as TraitCategory, cG as TraitCategorySchema, b as TraitConfig, cH as TraitConfigObject, cI as TraitConfigSchema, cJ as TraitConfigValue, cK as TraitConfigValueSchema, cL as TraitDataEntity, cM as TraitDataEntitySchema, cN as TraitEntityField, cO as TraitEntityFieldSchema, T as TraitEventContract, cP as TraitEventContractSchema, a as TraitEventListener, cQ as TraitEventListenerSchema, cR as TraitInput, g as TraitRef, cS as TraitRefSchema, l as TraitReference, cT as TraitReferenceInput, cU as TraitReferenceSchema, cV as TraitSchema, cW as TraitTick, cX as TraitTickSchema, cY as TraitUIBinding, cZ as Transition, c_ as TransitionInput, c$ as TransitionSchema, d0 as TypedEffect, d1 as UISlot, d2 as UISlotSchema, d3 as UI_SLOTS, d4 as UXHints, d5 as UXHintsSchema, U as UseDeclaration, d6 as UseDeclarationSchema, d7 as UserPersona, d8 as UserPersonaInput, d9 as UserPersonaSchema, da as VISUAL_STYLES, db as ViewType, dc as ViewTypeSchema, dd as VisualStyle, de as VisualStyleSchema, df as WatchEffect, dg as WatchOptions, dh as atomic, di as callService, dj as collectBindings, dk as createAssetKey, dl as deref, dm as deriveCollection, dn as despawn, dp as doEffects, dq as emit, dr as findService, ds as getArgs, dt as getDefaultAnimationsForRole, du as getOperator, dv as getServiceNames, dw as getTraitConfig, dx as getTraitName, dy as hasService, dz as isBinding, dA as isCircuitEvent, dB as isEffect, dC as isEntityCall, dD as isEntityReference, dE as isEntityReferenceAny, dF as isImportedTraitRef, dG as isInlineTrait, dH as isMcpService, dI as isOrbitalDefinition, dJ as isPageReference, dK as isPageReferenceObject, dL as isPageReferenceString, dM as isRestService, dN as isRuntimeEntity, dO as isSExpr, dP as isSExprAtom, dQ as isSExprCall, dR as isSExprEffect, dS as isServiceReference, dT as isServiceReferenceObject, dU as isSingletonEntity, dV as isSocketService, dW as isThemeReference, dX as isValidBinding, dY as navigate, dZ as normalizeTraitRef, d_ as notify, d$ as parseAssetKey, e0 as parseBinding, e1 as parseEntityRef, e2 as parseImportedTraitRef, e3 as parseOrbitalSchema, e4 as parsePageRef, e5 as parseServiceRef, e6 as persist, e7 as ref, e8 as renderUI, e9 as safeParseOrbitalSchema, ea as set, eb as sexpr, ec as spawn, ed as swap, ee as validateAssetAnimations, ef as walkSExpr, eg as watch } from './schema-4TWKcBt4.js';
3
3
  import { ResolvedIR, ResolvedEntity, ResolvedPage, ResolvedTrait, SchemaChange, CategorizedRemovals, PageContentReduction, SemanticSchemaChange } from './types/index.js';
4
- export { AgentCodeSearchResult, AgentCompactResult, AgentCompactStrategy, AgentContext, AgentGenerateOptions, AgentMemoryCategory, AgentMemoryRecord, AppSummary, BINDING_CONTEXT_RULES, BINDING_DOCS, BINDING_ROOTS, BindingContext, BindingRoot, BindingSchema, BusEvent, BusEventListener, BusEventSource, ChangeAuthor, ChangeSetDocument, ChangeSummary, ContextExtensions, CreateFlow, DEFAULT_INTERACTION_MODELS, DeleteFlow, EditFlow, GitHubLink, HistoryMeta, InteractionModel, InteractionModelInput, InteractionModelSchema, LazyService, ListInteraction, PatternTypeSchema, PersistActionName, ResolvedEntityBinding, ResolvedField, ResolvedNavigation, ResolvedPattern, ResolvedSection, ResolvedSectionEvent, ResolvedTraitBinding, ResolvedTraitDataEntity, ResolvedTraitEvent, ResolvedTraitGuard, ResolvedTraitListener, ResolvedTraitState, ResolvedTraitTick, ResolvedTraitTransition, ResolvedTraitUIBinding, SaveOptions, SaveResult, SemanticChangeKind, ServiceAction, ServiceActionName, ServiceContract, ServiceEvents, SnapshotDocument, StatsView, StoreContract, StoreFilter, StoreFilterOp, TransitionFrom, Unsubscribe, ValidationDocument, ValidationIssue, ValidationMeta, ValidationResults, ViewFlow, createEmptyResolvedPage, createEmptyResolvedTrait, createLazyService, createResolvedField, createTypedEventBus, getAllPatternTypes, getBindingExamples, getInteractionModelForDomain, inferTsType, isResolvedIR, toBindingRoot, validateBindingInContext } from './types/index.js';
4
+ export { AgentCodeSearchResult, AgentCompactResult, AgentCompactStrategy, AgentContext, AgentGenerateOptions, AgentMemoryCategory, AgentMemoryRecord, AppSummary, AssetLoadStatus, BINDING_CONTEXT_RULES, BINDING_DOCS, BINDING_ROOTS, BindingContext, BindingRoot, BindingSchema, BridgeHealth, BusEvent, BusEventListener, BusEventSource, ChangeAuthor, ChangeSetDocument, ChangeSummary, CheckStatus, ContextExtensions, CreateFlow, DEFAULT_INTERACTION_MODELS, DeleteFlow, EditFlow, EffectTrace, EventKey, EventLogEntry, GitHubLink, HistoryMeta, InteractionModel, InteractionModelInput, InteractionModelSchema, LazyService, ListInteraction, OrbitalVerificationAPI, PatternTypeSchema, PersistActionName, ResolvedEntityBinding, ResolvedField, ResolvedNavigation, ResolvedPattern, ResolvedSection, ResolvedSectionEvent, ResolvedTraitBinding, ResolvedTraitDataEntity, ResolvedTraitEvent, ResolvedTraitGuard, ResolvedTraitListener, ResolvedTraitState, ResolvedTraitTick, ResolvedTraitTransition, ResolvedTraitUIBinding, SaveOptions, SaveResult, SemanticChangeKind, ServerResponseTrace, ServiceAction, ServiceActionName, ServiceContract, ServiceEvents, SnapshotDocument, StatsView, StoreContract, StoreFilter, StoreFilterOp, TraitStateSnapshot, TransitionFrom, TransitionTrace, Unsubscribe, ValidationDocument, ValidationIssue, ValidationMeta, ValidationResults, VerificationCheck, VerificationSnapshot, VerificationSummary, ViewFlow, createEmptyResolvedPage, createEmptyResolvedTrait, createLazyService, createResolvedField, createTypedEventBus, getAllPatternTypes, getBindingExamples, getInteractionModelForDomain, inferTsType, isResolvedIR, toBindingRoot, validateBindingInContext } from './types/index.js';
5
5
  export { ASTNode, ComparisonCondition, ComparisonOperator, DomainBehavior, DomainChunk, DomainDocument, DomainEffect, DomainEntity, DomainField, DomainFieldType, DomainGuard, DomainPage, DomainPageAction, DomainPageSection, DomainRelationship, DomainTick, DomainToSchemaResult, DomainTransition, EFFECT_REGISTRY, EffectMapping, EffectType, FIELD_TYPE_REGISTRY, FieldCheckCondition, FieldReference, FieldTypeMapping, GUARD_REGISTRY, GuardCondition, GuardMapping, KEYWORDS, Lexer, LogicalCondition, LogicalOperator, MULTI_WORD_KEYWORDS, MappingStore, MergeResult, ParseError, ParseResult, RelationshipType, SchemaToDomainResult, SectionMapping, SourceLocation, SourceRange, Token, TokenType, UserCheckCondition, applySectionUpdate, computeSchemaHash, convertDomainToSchema, convertEntitiesToDomain, convertPagesToDomain, convertSchemaToDomain, convertTraitsToDomain, createMappingStore, deleteSection, detectChanges, domainKeywordToSchemaType, findMapping, findMappingByPath, findMappingsByType, formatBehaviorToDomain, formatBehaviorToSchema, formatDomainGuardToSchema, formatEntityToDomain, formatEntityToSchema, formatGuardConditionToDomain, formatGuardToDomain, formatGuardToSchema, formatMergeSummary, formatPageToDomain, formatPageToSchema, formatSchemaEntityToDomain, formatSchemaGuardToDomain, formatSchemaPageToDomain, formatSchemaTraitToDomain, generateDomainLanguageReference, generateSectionId, getEffectMapping, getFieldTypeMapping, getGuardMapping, getRegisteredEffects, getRegisteredFieldTypes, getRegisteredGuards, getRegistryStats, getSchemaPath, hasSchemaChanged, isEffectRegistered, isFieldTypeRegistered, isGuardRegistered, mergeDomainChunks, parseBehavior, parseDomainEffect, parseDomainEffects, parseDomainGuard, parseEntity, parseGuard, parsePage, parseSectionId, removeMapping, resolveConflict, schemaEntityToDomainEntity, schemaPageToDomainPage, schemaTraitToDomainBehavior, schemaTypeToDomainKeyword, tokenize, updateMappingRange, updateSchemaHash, upsertMapping, validateDomainChunk } from './domain-language/index.js';
6
6
  export { C as ComposeBehaviorsInput, a as ComposeBehaviorsResult, E as EventWiringEntry, L as LayoutStrategy, b as applyEventWiring, c as composeBehaviors, d as detectLayoutStrategy } from './compose-behaviors-B6kpM8Iy.js';
7
7
  export { BFSNode, BFSPathNode, EdgeWalkTransition, GraphTransition, GuardPayload, ReplayStep, ReplayTransition, StateEdge, WalkStep, buildEdgeCoveringWalk, buildGuardPayloads, buildReplayPaths, buildStateGraph, collectReachableStates, extractPayloadFieldRef, walkStatePairs } from './state-machine/index.js';
@@ -1109,6 +1109,27 @@ interface ContextExtensions {
1109
1109
  * @packageDocumentation
1110
1110
  */
1111
1111
 
1112
+ /**
1113
+ * Declared event key. A trait's event names (INIT, SAVE, CLOSE,
1114
+ * CONFIRM_REMOVE, ...) flow through the orbital schema and the UI as
1115
+ * strings; this alias marks "this string is a declared event key, not
1116
+ * arbitrary text."
1117
+ *
1118
+ * Component props typed as `EventKey` are detected by the pattern-sync
1119
+ * tool (`tools/almadar-pattern-sync/parser.ts`) via a TS-type lookup and
1120
+ * marked as `kind: "event"` in the patterns registry
1121
+ * (`@almadar/patterns`). Consumers of the registry — the Rust compiler's
1122
+ * inline phase and the `@almadar/runtime` preprocess — read that marker
1123
+ * to apply call-site `events: { OLD: NEW }` renames to render-ui trees
1124
+ * without name-matching heuristics.
1125
+ *
1126
+ * Plain alias over `string`. Not branded because event keys originate
1127
+ * from user data at runtime (orb schema literals, bus emits), so cast
1128
+ * friction would buy nothing. The value of the alias is at the type
1129
+ * surface — it's a marker the pattern-sync tool can find via
1130
+ * `getSymbolAtLocation`.
1131
+ */
1132
+ type EventKey = string;
1112
1133
  /**
1113
1134
  * Identifies the origin of a bus event. Used by cross-trait listeners to
1114
1135
  * filter emits from specific orbitals, traits, transitions, or ticks.
@@ -1131,7 +1152,7 @@ interface BusEventSource {
1131
1152
  */
1132
1153
  interface BusEvent {
1133
1154
  /** Event type identifier (e.g., 'CartItemLoaded', 'TASK_COMPLETED') */
1134
- type: string;
1155
+ type: EventKey;
1135
1156
  /** Optional structured payload */
1136
1157
  payload?: EventPayload;
1137
1158
  /** Timestamp when the event was emitted */
@@ -1144,4 +1165,195 @@ type BusEventListener = (event: BusEvent) => void;
1144
1165
  /** Returned by `on()` / `once()` to detach a listener. */
1145
1166
  type Unsubscribe = () => void;
1146
1167
 
1147
- export { type AgentCodeSearchResult, type AgentCompactResult, type AgentCompactStrategy, type AgentContext, type AgentGenerateOptions, type AgentMemoryCategory, type AgentMemoryRecord, type AppSummary, BINDING_CONTEXT_RULES, BINDING_DOCS, BINDING_ROOTS, type BindingContext, type BindingRoot, 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, toBindingRoot, validateBindingInContext };
1168
+ /**
1169
+ * Verification Types (framework concept)
1170
+ *
1171
+ * The `window.__orbitalVerification` bridge is the single observation
1172
+ * point Playwright-based verifiers (`orbital-verify`, `runtime-verify`,
1173
+ * `@almadar-io/verify`) use to read runtime state out of a live app.
1174
+ * Its shape was previously duplicated between `@almadar/ui`'s
1175
+ * `verificationRegistry.ts` (producer) and `@almadar-io/verify`'s
1176
+ * `state-bridge.ts` (consumer). Every added field had to be mirrored
1177
+ * by hand; one side drifting silently broke the other.
1178
+ *
1179
+ * Hoisting the wire types into `@almadar/core` closes that gap the same
1180
+ * way {@link BusEvent} closed the UI/runtime event-shape drift. The
1181
+ * registry still owns the state machine, the schedule, and the window
1182
+ * exposure — this module owns only the shapes both sides agree on.
1183
+ *
1184
+ * @packageDocumentation
1185
+ */
1186
+
1187
+ /**
1188
+ * Outcome of a single verification check. `warn` is non-fatal in the
1189
+ * overall pass/fail tally; `pending` means the check has been registered
1190
+ * but not yet resolved.
1191
+ */
1192
+ type CheckStatus = "pass" | "fail" | "pending" | "warn";
1193
+ interface VerificationCheck {
1194
+ id: string;
1195
+ label: string;
1196
+ status: CheckStatus;
1197
+ details?: string;
1198
+ /** Timestamp (ms since epoch) when the status last changed. */
1199
+ updatedAt: number;
1200
+ }
1201
+ /**
1202
+ * Trace of a single effect as it ran on a transition. `args` are left
1203
+ * as `unknown[]` because different effect kinds have different argument
1204
+ * shapes; consumers narrow via `type` before inspecting.
1205
+ */
1206
+ interface EffectTrace {
1207
+ type: string;
1208
+ args: unknown[];
1209
+ status: "executed" | "failed" | "skipped";
1210
+ error?: string;
1211
+ durationMs?: number;
1212
+ }
1213
+ /** What the server returned for a forwarded event. */
1214
+ interface ServerResponseTrace {
1215
+ orbitalName: string;
1216
+ success: boolean;
1217
+ clientEffects: number;
1218
+ dataEntities: Record<string, number>;
1219
+ emittedEvents: string[];
1220
+ error?: string;
1221
+ timestamp: number;
1222
+ }
1223
+ interface TransitionTrace {
1224
+ id: string;
1225
+ traitName: string;
1226
+ from: string;
1227
+ to: string;
1228
+ event: string;
1229
+ guardExpression?: string;
1230
+ guardResult?: boolean;
1231
+ effects: EffectTrace[];
1232
+ /** Populated when the event round-tripped to the server. */
1233
+ serverResponse?: ServerResponseTrace;
1234
+ timestamp: number;
1235
+ }
1236
+ interface BridgeHealth {
1237
+ connected: boolean;
1238
+ eventsForwarded: number;
1239
+ eventsReceived: number;
1240
+ lastError?: string;
1241
+ lastHeartbeat: number;
1242
+ }
1243
+ interface VerificationSummary {
1244
+ totalChecks: number;
1245
+ passed: number;
1246
+ failed: number;
1247
+ warnings: number;
1248
+ pending: number;
1249
+ }
1250
+ /**
1251
+ * Per-trait state snapshot exposed to the verifier so it can assert
1252
+ * that reducer data (populated by fetch/persist transitions) and the
1253
+ * last dispatched payload land in the DOM correctly (VG4/VG6/VG11a/b/c).
1254
+ *
1255
+ * Mirrors what `useTraitStateMachine` / generated trait logic hooks
1256
+ * keep internally, without the verifier having to parse rendered text.
1257
+ */
1258
+ interface TraitStateSnapshot {
1259
+ /** Trait name as declared in the schema. */
1260
+ traitName: string;
1261
+ /** Current state machine state. */
1262
+ currentState: string;
1263
+ /** Declared state names for this trait (non-empty for healthy refs). */
1264
+ states: string[];
1265
+ /** Declared event keys for this trait (non-empty for healthy refs). */
1266
+ events: string[];
1267
+ /**
1268
+ * Entity data keyed by entity name. Uses {@link EntityRow} — the
1269
+ * canonical persisted-entity shape the server returns and the trait
1270
+ * reducer stores. Consumers that need full field-level types can cast
1271
+ * down to the generated entity (e.g. `data['CartItem'] as CartItem[]`).
1272
+ * Snapshot-on-read; mutating the returned arrays does not affect the
1273
+ * live reducer.
1274
+ */
1275
+ data: Record<string, EntityRow[]>;
1276
+ /** Payload of the last event the state machine processed, if any. */
1277
+ lastPayload?: EventPayload;
1278
+ /**
1279
+ * Last event the walker (or a UI click) dispatched into this trait.
1280
+ * Used by VG11a to resolve `@payload.X` expected values.
1281
+ */
1282
+ lastEventDispatched?: {
1283
+ event: string;
1284
+ payload?: EventPayload;
1285
+ source?: BusEventSource;
1286
+ timestamp: number;
1287
+ };
1288
+ /**
1289
+ * Bus events received from the server's `emittedEvents` cascade
1290
+ * since the last user dispatch. VG4 compares the length against the
1291
+ * number of `emit: { success/failure: ... }` entries on the
1292
+ * triggering transition.
1293
+ */
1294
+ cascadeReceived: Array<{
1295
+ event: string;
1296
+ payload?: EventPayload;
1297
+ timestamp: number;
1298
+ }>;
1299
+ }
1300
+ interface VerificationSnapshot {
1301
+ checks: VerificationCheck[];
1302
+ transitions: TransitionTrace[];
1303
+ bridge: BridgeHealth | null;
1304
+ summary: VerificationSummary;
1305
+ /**
1306
+ * Per-trait reducer snapshots. Empty on older runtimes that predate
1307
+ * the Foundation 1 expansion; non-empty once any trait hook has
1308
+ * registered a snapshot getter.
1309
+ */
1310
+ traits: TraitStateSnapshot[];
1311
+ }
1312
+ /** Asset load status exposed for canvas-based game verification. */
1313
+ type AssetLoadStatus = "loaded" | "failed" | "pending";
1314
+ /**
1315
+ * Entry recorded on the verification event log. The registry clamps
1316
+ * the log size (see `verificationRegistry`'s internal `MAX_EVENT_LOG`)
1317
+ * so long runs don't grow unbounded.
1318
+ */
1319
+ interface EventLogEntry {
1320
+ type: string;
1321
+ payload?: EventPayload;
1322
+ timestamp: number;
1323
+ }
1324
+ /**
1325
+ * The object attached to `window.__orbitalVerification`. Every optional
1326
+ * member is wired up by a corresponding `bind*` / `register*` call on
1327
+ * the registry (e.g. `bindEventBus` populates `sendEvent`). Consumers
1328
+ * should null-check before calling — an older bundle might expose only
1329
+ * the core readers.
1330
+ */
1331
+ interface OrbitalVerificationAPI {
1332
+ getSnapshot: () => VerificationSnapshot;
1333
+ getChecks: () => VerificationCheck[];
1334
+ getTransitions: () => TransitionTrace[];
1335
+ getBridge: () => BridgeHealth | null;
1336
+ getSummary: () => VerificationSummary;
1337
+ /** Wait for a specific event to be processed. Resolves to null on timeout. */
1338
+ waitForTransition: (event: string, timeoutMs?: number) => Promise<TransitionTrace | null>;
1339
+ /**
1340
+ * Send an event into the runtime. Requires {@link bindEventBus} (in
1341
+ * `@almadar/ui`) to have run at least once. Payload typed as
1342
+ * {@link EventPayload} so callers can't slip non-bus-shaped data in.
1343
+ */
1344
+ sendEvent?: (event: string, payload?: EventPayload) => void;
1345
+ /** Current state name for a given trait, if known. */
1346
+ getTraitState?: (traitName: string) => string | undefined;
1347
+ /** Per-trait reducer snapshots (VG4/VG6/VG11a/b/c). */
1348
+ getTraitSnapshots?: () => TraitStateSnapshot[];
1349
+ /** Canvas frame capture. Populated by game organisms on mount. */
1350
+ captureFrame?: () => string | null;
1351
+ /** Asset-url → load-status map. Populated by game organisms. */
1352
+ assetStatus?: Record<string, AssetLoadStatus>;
1353
+ /** Rolling event bus log. Populated by `bindEventBus`. */
1354
+ eventLog?: EventLogEntry[];
1355
+ /** Clear the event log in place. */
1356
+ clearEventLog?: () => void;
1357
+ }
1358
+
1359
+ export { type AgentCodeSearchResult, type AgentCompactResult, type AgentCompactStrategy, type AgentContext, type AgentGenerateOptions, type AgentMemoryCategory, type AgentMemoryRecord, type AppSummary, type AssetLoadStatus, BINDING_CONTEXT_RULES, BINDING_DOCS, BINDING_ROOTS, type BindingContext, type BindingRoot, BindingSchema, type BridgeHealth, type BusEvent, type BusEventListener, type BusEventSource, type CategorizedRemovals, type ChangeAuthor, type ChangeSetDocument, type ChangeSummary, type CheckStatus, type ContextExtensions, type CreateFlow, DEFAULT_INTERACTION_MODELS, type DeleteFlow, type EditFlow, type EffectTrace, EntityRow, type EventKey, type EventLogEntry, EventPayload, FieldValue, type GitHubLink, type HistoryMeta, type InteractionModel, type InteractionModelInput, InteractionModelSchema, type LazyService, type ListInteraction, type OrbitalVerificationAPI, 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 ServerResponseTrace, type ServiceAction, type ServiceActionName, type ServiceContract, type ServiceEvents, type SnapshotDocument, type StatsView, type StoreContract, type StoreFilter, type StoreFilterOp, TraitConfig, type TraitStateSnapshot, type TransitionFrom, type TransitionTrace, type Unsubscribe, type ValidationDocument, type ValidationIssue, type ValidationMeta, type ValidationResults, type VerificationCheck, type VerificationSnapshot, type VerificationSummary, type ViewFlow, createEmptyResolvedPage, createEmptyResolvedTrait, createLazyService, createResolvedField, createTypedEventBus, getAllPatternTypes, getBindingExamples, getInteractionModelForDomain, inferTsType, isResolvedIR, toBindingRoot, validateBindingInContext };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/core",
3
- "version": "5.4.0",
3
+ "version": "5.6.0",
4
4
  "description": "Core schema types and definitions for Almadar",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",