@almadar/core 10.34.0 → 10.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{builders-DFOj9_N8.d.ts → builders-CBL9rED-.d.ts} +117 -117
- package/dist/builders.d.ts +3 -3
- package/dist/builders.js +2 -2
- package/dist/builders.js.map +1 -1
- package/dist/{effect-D9WY6JgN.d.ts → effect-Cd6ibbZc.d.ts} +6 -1
- package/dist/factory/index.d.ts +5 -5
- package/dist/factory-runtime/index.d.ts +3 -3
- package/dist/factory-runtime/index.js +3 -4
- package/dist/factory-runtime/index.js.map +1 -1
- package/dist/index.d.ts +115 -21
- package/dist/index.js +243 -11
- package/dist/index.js.map +1 -1
- package/dist/patterns/component-mapping.json +1 -1
- package/dist/patterns/event-contracts.json +1 -1
- package/dist/patterns/index.d.ts +182 -5
- package/dist/patterns/index.js +90 -3
- package/dist/patterns/index.js.map +1 -1
- package/dist/patterns/integrators-registry.json +30 -0
- package/dist/patterns/patterns-registry.json +58 -1
- package/dist/patterns/registry.json +58 -1
- package/dist/{trait-6_gs33fs.d.ts → trait-X5mQAMtW.d.ts} +26 -21
- package/dist/types/index.d.ts +116 -11
- package/dist/types/index.js +72 -3
- package/dist/types/index.js.map +1 -1
- package/dist/{types-CeGT3YB1.d.ts → types-DujRcijG.d.ts} +2 -2
- package/package.json +1 -1
package/dist/types/index.js
CHANGED
|
@@ -922,7 +922,7 @@ var TraitEventListenerSchema = z.object({
|
|
|
922
922
|
tier: z.string().optional(),
|
|
923
923
|
guard: ExpressionSchema.optional(),
|
|
924
924
|
scope: EventScopeSchema.optional(),
|
|
925
|
-
payloadMapping: z.record(
|
|
925
|
+
payloadMapping: z.record(SExprSchema).optional(),
|
|
926
926
|
source: ListenSourceSchema.optional()
|
|
927
927
|
});
|
|
928
928
|
var RequiredFieldSchema = z.object({
|
|
@@ -1731,7 +1731,7 @@ var ComputedEventListenerSchema = z.object({
|
|
|
1731
1731
|
source: EventSourceSchema,
|
|
1732
1732
|
triggers: z.string().min(1),
|
|
1733
1733
|
guard: ExpressionSchema.optional(),
|
|
1734
|
-
payloadMapping: z.record(
|
|
1734
|
+
payloadMapping: z.record(SExprSchema).optional()
|
|
1735
1735
|
});
|
|
1736
1736
|
var OrbitalDefinitionSchema = z.object({
|
|
1737
1737
|
id: OrbitalIdSchema.optional(),
|
|
@@ -1923,6 +1923,75 @@ function isTraitFieldRef(value) {
|
|
|
1923
1923
|
}
|
|
1924
1924
|
var TraitFieldRefSchema = z.string().regex(TRAIT_REF_PATTERN, "expected `@trait.<TraitName>` reference");
|
|
1925
1925
|
|
|
1926
|
+
// src/types/user.ts
|
|
1927
|
+
var ANONYMOUS_USER = {
|
|
1928
|
+
id: "anonymous",
|
|
1929
|
+
role: "anonymous",
|
|
1930
|
+
permissions: []
|
|
1931
|
+
};
|
|
1932
|
+
var DERIVED_CLAIM_KEYS = ["id", "name", "displayName", "email"];
|
|
1933
|
+
function normalizeUserContext(claims) {
|
|
1934
|
+
if (!claims) return void 0;
|
|
1935
|
+
const id = claims.id ?? claims.uid;
|
|
1936
|
+
if (typeof id !== "string" || id.length === 0) return void 0;
|
|
1937
|
+
const user = { id };
|
|
1938
|
+
for (const [key, value] of Object.entries(claims)) {
|
|
1939
|
+
if (value === void 0 || DERIVED_CLAIM_KEYS.includes(key)) continue;
|
|
1940
|
+
user[key] = value;
|
|
1941
|
+
}
|
|
1942
|
+
const name = claims.name ?? claims.displayName;
|
|
1943
|
+
if (typeof name === "string" && name.length > 0) user.name = name;
|
|
1944
|
+
if (typeof claims.email === "string" && claims.email.length > 0) user.email = claims.email;
|
|
1945
|
+
return user;
|
|
1946
|
+
}
|
|
1947
|
+
var MOCK_PERSONAS = [
|
|
1948
|
+
{ id: "admin-1", name: "Ada Admin", email: "ada@example.com", role: "admin", permissions: ["read", "write", "delete"] },
|
|
1949
|
+
{ id: "staff-1", name: "Sam Staff", email: "sam@example.com", role: "staff", permissions: ["read", "write"] },
|
|
1950
|
+
{ id: "member-1", name: "Maya Member", email: "maya@example.com", role: "member", permissions: ["read"] },
|
|
1951
|
+
{ id: "customer-1", name: "Cai Customer", email: "cai@example.com", role: "customer", permissions: ["read"] }
|
|
1952
|
+
];
|
|
1953
|
+
function findMockPersona(idOrRole) {
|
|
1954
|
+
return MOCK_PERSONAS.find((p) => p.id === idOrRole) ?? MOCK_PERSONAS.find((p) => p.role === idOrRole);
|
|
1955
|
+
}
|
|
1956
|
+
function resolvePersonaSpec(spec) {
|
|
1957
|
+
const raw = spec.trim();
|
|
1958
|
+
if (!raw.startsWith("{")) {
|
|
1959
|
+
const seeded = findMockPersona(raw);
|
|
1960
|
+
if (!seeded) {
|
|
1961
|
+
throw new Error(
|
|
1962
|
+
`Persona "${raw}" is not a seeded persona id or role. Known: ${MOCK_PERSONAS.map((p) => `${p.id}/${p.role}`).join(", ")}`
|
|
1963
|
+
);
|
|
1964
|
+
}
|
|
1965
|
+
return seeded;
|
|
1966
|
+
}
|
|
1967
|
+
let claims;
|
|
1968
|
+
try {
|
|
1969
|
+
claims = JSON.parse(raw);
|
|
1970
|
+
} catch {
|
|
1971
|
+
throw new Error(`Persona is not valid JSON: ${raw}`);
|
|
1972
|
+
}
|
|
1973
|
+
const user = normalizeUserContext(claims);
|
|
1974
|
+
if (!user) {
|
|
1975
|
+
throw new Error(`Persona needs an "id" (or "uid"): ${raw}`);
|
|
1976
|
+
}
|
|
1977
|
+
return user;
|
|
1978
|
+
}
|
|
1979
|
+
var DEV_TOKEN_PREFIX = "almadar-dev.";
|
|
1980
|
+
function encodeDevIdentityToken(user) {
|
|
1981
|
+
return DEV_TOKEN_PREFIX + encodeURIComponent(JSON.stringify(user));
|
|
1982
|
+
}
|
|
1983
|
+
function decodeDevIdentityToken(token) {
|
|
1984
|
+
if (!token.startsWith(DEV_TOKEN_PREFIX)) return void 0;
|
|
1985
|
+
try {
|
|
1986
|
+
const claims = JSON.parse(
|
|
1987
|
+
decodeURIComponent(token.slice(DEV_TOKEN_PREFIX.length))
|
|
1988
|
+
);
|
|
1989
|
+
return normalizeUserContext(claims);
|
|
1990
|
+
} catch {
|
|
1991
|
+
return void 0;
|
|
1992
|
+
}
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1926
1995
|
// src/types/agent.ts
|
|
1927
1996
|
function isSessionHistoryEntry(value) {
|
|
1928
1997
|
if (typeof value !== "object" || value === null) return false;
|
|
@@ -2536,6 +2605,6 @@ function widenTier(tier) {
|
|
|
2536
2605
|
return tier;
|
|
2537
2606
|
}
|
|
2538
2607
|
|
|
2539
|
-
export { AGENT_DOMAIN_CATEGORIES, ALLOWED_CUSTOM_COMPONENTS, ANIMATION_NAMES, ASSET_ASPECTS, ASSET_DIMENSIONS, AgentDomainCategorySchema, AnimationDefSchema, AnimationNameSchema, AssetAspectSchema, AssetCatalogEntrySchema, AssetCatalogSchema, AssetDimensionSchema, AssetSchema, BINDING_CONTEXT_RULES, BINDING_DOCS, BINDING_ROOTS, BindingSchema, CAMERA_MODES, CONFIG_REF_EVENT_PATTERN, CORE_BINDINGS, CameraModeSchema, CameraSchema, ColorSliceSchema, ColorTokensSchema, ComputedEventContractSchema, ComputedEventListenerSchema, ConfigFieldDeclarationSchema, ConfigProvenanceRecordSchema, CustomPatternDefinitionSchema, CustomPatternMapSchema, DEFAULT_INTERACTION_MODELS, DeclaredTraitConfigSchema, DensitySliceSchema, DensityTokensSchema, DesignPreferencesSchema, DesignTokensSchema, DomainCategorySchema, DomainContextSchema, DomainVocabularySchema, ENTITY_ROLES, EffectSchema, ElevationSliceSchema, ElevationTokensSchema, EntityCallSchema, EntityFieldContractSchema, EntityFieldSchema, EntityIdSchema, EntityPersistenceSchema, EntityRefSchema, EntityRefStringSchema, EntityRoleSchema, EntitySchema, EntitySemanticRoleSchema, EventIdSchema, EventListenerSchema, EventPayloadFieldSchema, EventSchema, EventScopeSchema, EventSemanticRoleSchema, EventSourceSchema, ExpressionSchema, FieldFormatSchema, FieldSchema, FieldTypeSchema, GameSubCategorySchema, GeometrySliceSchema, GeometryTokensSchema, GuardSchema, IconFamilySchema, IconographySliceSchema, IconographyTokensSchema, IdentityLedgerSchema, IllustrationSliceSchema, IllustrationStyleSchema, IllustrationTokensSchema, InteractionModelSchema, KNOWN_VALIDATION_ERROR_CODES, LedgerEntrySchema, LedgerKindSchema, ListenSourceSchema, McpServiceDefSchema, MotionDurationKeySchema, MotionDurationPaletteSchema, MotionEasingKeySchema, MotionEasingPaletteSchema, MotionIntentMapSchema, MotionIntentSchema, MotionSliceSchema, MotionTokensSchema, NodeClassificationSchema, OrbitalConfigSchema, OrbitalDefinitionSchema, OrbitalEntitySchema, OrbitalIdSchema, OrbitalPageSchema, OrbitalPageStrictSchema, OrbitalSchemaSchema, OrbitalTraitRefSchema, OrbitalUnitSchema, OrbitalSchema as OrbitalZodSchema, PATTERN_TYPES, PageIdSchema, PageRefObjectSchema, PageRefSchema, PageRefStringSchema, PageSchema, PageTraitRefSchema, PaletteEntryIdSchema, PatternTypeSchema, PayloadFieldSchema, REFERENCE_CONFIG_TYPES, RelatedLinkSchema, RelationConfigSchema, RequiredFieldSchema, RestAuthConfigSchema, RestServiceDefSchema, SERVICE_TYPES, SExprAtomSchema, SExprSchema, SPRITE_DIRECTIONS, ScenePosSchema, SchemaMetadataSchema, SemanticAssetRefSchema, ServiceDefinitionSchema, ServiceIdSchema, ServiceRefObjectSchema, ServiceRefSchema, ServiceRefStringSchema, ServiceTypeSchema, SkinSpecSchema, SocketEventsSchema, SocketServiceDefSchema, SpacingScaleSchema, SpriteDirectionSchema, SpriteSheetAtlasSchema, StateMachineSchema, StateSchema, StateSemanticRoleSchema, SubTextureSchema, SuggestedGuardSchema, TextureAtlasSchema, ThemeDefinitionSchema, ThemeIdSchema, ThemeRefSchema, ThemeRefStringSchema, ThemeTokensSchema, ThemeVariantSchema, TilesheetSchema, TraitCategorySchema, TraitConfigSchema, TraitConfigValueSchema, TraitDataEntitySchema, TraitEntityFieldSchema, TraitEventContractSchema, TraitEventListenerSchema, TraitFieldRefSchema, TraitIdSchema, TraitRefSchema, TraitReferenceSchema, TraitSchema, TraitTickSchema, TransitionSchema, TypeIntentMapSchema, TypeIntentSchema, TypeScaleEntrySchema, TypeScaleSchema, TypeScaleTokensSchema, TypeSizeKeySchema, TypeSliceSchema, TypeSlotSchema, TypeWeightSchema, UISlotSchema, UI_SLOTS, UXHintsSchema, UseDeclarationSchema, UserPersonaSchema, VISUAL_STYLES, ViewTypeSchema, VisualStyleSchema, asEntityId, asEventId, asOrbitalId, asPageId, asPaletteEntryId, asServiceId, asThemeId, asTraitId, atomic, callService, collectBindings, configRefEventKnob, createAssetKey, createEmptyResolvedPage, createEmptyResolvedTrait, createLazyService, createResolvedField, createTypedEventBus, deref, deriveCollection, despawn, doEffects, emit, findService, getArgs, getBindingExamples, getDefaultAnimationsForRole, getInteractionModelForDomain, getOperator, getServiceNames, getTraitConfig, getTraitName, hasService, idKindOf, idPrefix, inferTsType, isBinding, isCallSiteConfigDeclaration, isCircuitEvent, isEffect, isEntityCall, isEntityId, isEntityReference, isEntityReferenceAny, isEventId, isEventPayloadValue, isFieldValue, isImportedTraitRef, isInlineTrait, isJsonArray, isJsonObject, isJsonPrimitive, isKnownValidationErrorCode, isMcpService, isOrbitalDefinition, isOrbitalId, isPageId, isPageReference, isPageReferenceObject, isPageReferenceString, isPaletteEntryId, isPlanSnapshot, isReferenceConfigType, isResolvedIR, isRestService, isRuntimeEntity, isSExpr, isSExprAtom, isSExprCall, isSExprEffect, isServiceId, isServiceReference, isServiceReferenceObject, isSessionHistoryEntry, isSocketService, isThemeId, isThemeReference, isTraitFieldRef, isTraitId, isValidBinding, isValidPatternType, ledgerCurName, ledgerRename, ledgerResolveName, mintId, navigate, normalizeCallSiteConfigToValues, normalizeTraitRef, notify, parseAssetKey, parseBinding, parseEntityRef, parseImportedTraitRef, parseOrbitalSchema, parsePageRef, parseServiceRef, persist, persistenceModeAllowsOverrides, ref, renderUI, resolveConfigRefEventName, safeParseOrbitalSchema, set, sexpr, spawn, swap, toBindingRoot, validateAssetAnimations, validateBindingInContext, walkSExpr, watch, widenTier };
|
|
2608
|
+
export { AGENT_DOMAIN_CATEGORIES, ALLOWED_CUSTOM_COMPONENTS, ANIMATION_NAMES, ANONYMOUS_USER, ASSET_ASPECTS, ASSET_DIMENSIONS, AgentDomainCategorySchema, AnimationDefSchema, AnimationNameSchema, AssetAspectSchema, AssetCatalogEntrySchema, AssetCatalogSchema, AssetDimensionSchema, AssetSchema, BINDING_CONTEXT_RULES, BINDING_DOCS, BINDING_ROOTS, BindingSchema, CAMERA_MODES, CONFIG_REF_EVENT_PATTERN, CORE_BINDINGS, CameraModeSchema, CameraSchema, ColorSliceSchema, ColorTokensSchema, ComputedEventContractSchema, ComputedEventListenerSchema, ConfigFieldDeclarationSchema, ConfigProvenanceRecordSchema, CustomPatternDefinitionSchema, CustomPatternMapSchema, DEFAULT_INTERACTION_MODELS, DEV_TOKEN_PREFIX, DeclaredTraitConfigSchema, DensitySliceSchema, DensityTokensSchema, DesignPreferencesSchema, DesignTokensSchema, DomainCategorySchema, DomainContextSchema, DomainVocabularySchema, ENTITY_ROLES, EffectSchema, ElevationSliceSchema, ElevationTokensSchema, EntityCallSchema, EntityFieldContractSchema, EntityFieldSchema, EntityIdSchema, EntityPersistenceSchema, EntityRefSchema, EntityRefStringSchema, EntityRoleSchema, EntitySchema, EntitySemanticRoleSchema, EventIdSchema, EventListenerSchema, EventPayloadFieldSchema, EventSchema, EventScopeSchema, EventSemanticRoleSchema, EventSourceSchema, ExpressionSchema, FieldFormatSchema, FieldSchema, FieldTypeSchema, GameSubCategorySchema, GeometrySliceSchema, GeometryTokensSchema, GuardSchema, IconFamilySchema, IconographySliceSchema, IconographyTokensSchema, IdentityLedgerSchema, IllustrationSliceSchema, IllustrationStyleSchema, IllustrationTokensSchema, InteractionModelSchema, KNOWN_VALIDATION_ERROR_CODES, LedgerEntrySchema, LedgerKindSchema, ListenSourceSchema, MOCK_PERSONAS, McpServiceDefSchema, MotionDurationKeySchema, MotionDurationPaletteSchema, MotionEasingKeySchema, MotionEasingPaletteSchema, MotionIntentMapSchema, MotionIntentSchema, MotionSliceSchema, MotionTokensSchema, NodeClassificationSchema, OrbitalConfigSchema, OrbitalDefinitionSchema, OrbitalEntitySchema, OrbitalIdSchema, OrbitalPageSchema, OrbitalPageStrictSchema, OrbitalSchemaSchema, OrbitalTraitRefSchema, OrbitalUnitSchema, OrbitalSchema as OrbitalZodSchema, PATTERN_TYPES, PageIdSchema, PageRefObjectSchema, PageRefSchema, PageRefStringSchema, PageSchema, PageTraitRefSchema, PaletteEntryIdSchema, PatternTypeSchema, PayloadFieldSchema, REFERENCE_CONFIG_TYPES, RelatedLinkSchema, RelationConfigSchema, RequiredFieldSchema, RestAuthConfigSchema, RestServiceDefSchema, SERVICE_TYPES, SExprAtomSchema, SExprSchema, SPRITE_DIRECTIONS, ScenePosSchema, SchemaMetadataSchema, SemanticAssetRefSchema, ServiceDefinitionSchema, ServiceIdSchema, ServiceRefObjectSchema, ServiceRefSchema, ServiceRefStringSchema, ServiceTypeSchema, SkinSpecSchema, SocketEventsSchema, SocketServiceDefSchema, SpacingScaleSchema, SpriteDirectionSchema, SpriteSheetAtlasSchema, StateMachineSchema, StateSchema, StateSemanticRoleSchema, SubTextureSchema, SuggestedGuardSchema, TextureAtlasSchema, ThemeDefinitionSchema, ThemeIdSchema, ThemeRefSchema, ThemeRefStringSchema, ThemeTokensSchema, ThemeVariantSchema, TilesheetSchema, TraitCategorySchema, TraitConfigSchema, TraitConfigValueSchema, TraitDataEntitySchema, TraitEntityFieldSchema, TraitEventContractSchema, TraitEventListenerSchema, TraitFieldRefSchema, TraitIdSchema, TraitRefSchema, TraitReferenceSchema, TraitSchema, TraitTickSchema, TransitionSchema, TypeIntentMapSchema, TypeIntentSchema, TypeScaleEntrySchema, TypeScaleSchema, TypeScaleTokensSchema, TypeSizeKeySchema, TypeSliceSchema, TypeSlotSchema, TypeWeightSchema, UISlotSchema, UI_SLOTS, UXHintsSchema, UseDeclarationSchema, UserPersonaSchema, VISUAL_STYLES, ViewTypeSchema, VisualStyleSchema, asEntityId, asEventId, asOrbitalId, asPageId, asPaletteEntryId, asServiceId, asThemeId, asTraitId, atomic, callService, collectBindings, configRefEventKnob, createAssetKey, createEmptyResolvedPage, createEmptyResolvedTrait, createLazyService, createResolvedField, createTypedEventBus, decodeDevIdentityToken, deref, deriveCollection, despawn, doEffects, emit, encodeDevIdentityToken, findMockPersona, findService, getArgs, getBindingExamples, getDefaultAnimationsForRole, getInteractionModelForDomain, getOperator, getServiceNames, getTraitConfig, getTraitName, hasService, idKindOf, idPrefix, inferTsType, isBinding, isCallSiteConfigDeclaration, isCircuitEvent, isEffect, isEntityCall, isEntityId, isEntityReference, isEntityReferenceAny, isEventId, isEventPayloadValue, isFieldValue, isImportedTraitRef, isInlineTrait, isJsonArray, isJsonObject, isJsonPrimitive, isKnownValidationErrorCode, isMcpService, isOrbitalDefinition, isOrbitalId, isPageId, isPageReference, isPageReferenceObject, isPageReferenceString, isPaletteEntryId, isPlanSnapshot, isReferenceConfigType, isResolvedIR, isRestService, isRuntimeEntity, isSExpr, isSExprAtom, isSExprCall, isSExprEffect, isServiceId, isServiceReference, isServiceReferenceObject, isSessionHistoryEntry, isSocketService, isThemeId, isThemeReference, isTraitFieldRef, isTraitId, isValidBinding, isValidPatternType, ledgerCurName, ledgerRename, ledgerResolveName, mintId, navigate, normalizeCallSiteConfigToValues, normalizeTraitRef, normalizeUserContext, notify, parseAssetKey, parseBinding, parseEntityRef, parseImportedTraitRef, parseOrbitalSchema, parsePageRef, parseServiceRef, persist, persistenceModeAllowsOverrides, ref, renderUI, resolveConfigRefEventName, resolvePersonaSpec, safeParseOrbitalSchema, set, sexpr, spawn, swap, toBindingRoot, validateAssetAnimations, validateBindingInContext, walkSExpr, watch, widenTier };
|
|
2540
2609
|
//# sourceMappingURL=index.js.map
|
|
2541
2610
|
//# sourceMappingURL=index.js.map
|