@almadar/core 10.7.0 → 10.9.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.js CHANGED
@@ -180,6 +180,11 @@ var SemanticAssetRefSchema = z.object({
180
180
  dimension: AssetDimensionSchema.optional(),
181
181
  aspect: AssetAspectSchema.optional()
182
182
  });
183
+ var AssetSchema = SemanticAssetRefSchema.extend({
184
+ url: z.string(),
185
+ name: z.string().optional(),
186
+ thumbnailUrl: z.string().optional()
187
+ });
183
188
  var ResolvedAssetSchema = z.object({
184
189
  basePath: z.string(),
185
190
  path: z.string(),
@@ -522,6 +527,9 @@ var TraitConfigValueSchema = z.lazy(
522
527
  ])
523
528
  );
524
529
  var TraitConfigSchema = z.record(TraitConfigValueSchema);
530
+ function isCallSiteConfigDeclaration(entry) {
531
+ return typeof entry === "object" && entry !== null && !Array.isArray(entry) && "type" in entry && typeof entry.type === "string";
532
+ }
525
533
  var ConfigFieldDeclarationSchema = z.object({
526
534
  type: z.string(),
527
535
  default: TraitConfigValueSchema.optional(),
@@ -664,7 +672,11 @@ var TraitReferenceSchema = z.object({
664
672
  z.string().min(1, "fields key (canonical field name) must be non-empty"),
665
673
  z.string().min(1, "fields value (consumer field name) must be non-empty")
666
674
  ).optional(),
667
- config: TraitConfigSchema.optional(),
675
+ // Each value is either a plain wiring value (TraitConfigValue) or an
676
+ // annotated ConfigFieldDeclaration. Declaration form is tried first
677
+ // (it's more specific — has a `"type"` string key); plain values fall
678
+ // through to the recursive TraitConfigValue union.
679
+ config: z.record(z.union([ConfigFieldDeclarationSchema, TraitConfigValueSchema])).optional(),
668
680
  appliesTo: z.array(z.string()).optional(),
669
681
  // Phase F.7: zod accepts an array (the inliner validates element
670
682
  // shape). The full ListenDefinition shape isn't recursively encoded
@@ -2983,6 +2995,7 @@ function generateQuestions(plan, catalog, ruleOverlay) {
2983
2995
  const signature = findSignature(catalog, call.organism, call.orbital);
2984
2996
  if (!signature) continue;
2985
2997
  out.push(...configKeyQuestions(call, signature));
2998
+ out.push(...entityFieldQuestions(call, signature));
2986
2999
  out.push(...capabilityQuestions(call, signature, ruleCapabilities));
2987
3000
  }
2988
3001
  return out;
@@ -3116,6 +3129,62 @@ function stringifyDefault(v) {
3116
3129
  if (Array.isArray(v)) return `${v.length} item${v.length === 1 ? "" : "s"}`;
3117
3130
  return "object";
3118
3131
  }
3132
+ function entityFieldQuestions(call, signature) {
3133
+ if (signature.entities.length === 0) return [];
3134
+ const entity = signature.entities[0];
3135
+ const entityName = call.params.entityName ?? entity.name;
3136
+ const defaultFields = entity.fields.map(
3137
+ signatureFieldToEntityField
3138
+ );
3139
+ const weight = tierWeight("domain");
3140
+ return [
3141
+ {
3142
+ id: `${call.orbital}.__entityFields`,
3143
+ orbitalName: call.orbital,
3144
+ question: `What fields should a ${entityName} have?`,
3145
+ reason: `Defines the data model for ${entityName}. Add domain-specific fields or confirm the canonical defaults.`,
3146
+ inputType: "fieldList",
3147
+ mutationTemplate: {
3148
+ kind: "set-orbital-entity-fields",
3149
+ orbitalName: call.orbital
3150
+ },
3151
+ defaultValue: defaultFields,
3152
+ tier: "domain",
3153
+ weight,
3154
+ priority: weight
3155
+ }
3156
+ ];
3157
+ }
3158
+ function signatureFieldToEntityField(f) {
3159
+ const base = {
3160
+ name: f.name,
3161
+ required: f.required,
3162
+ description: f.description,
3163
+ synonyms: f.synonyms,
3164
+ intrinsic: f.intrinsic
3165
+ };
3166
+ switch (f.type) {
3167
+ case "string":
3168
+ case "number":
3169
+ case "boolean":
3170
+ case "date":
3171
+ case "timestamp":
3172
+ case "datetime":
3173
+ return { ...base, type: f.type };
3174
+ case "array":
3175
+ return { ...base, type: "array" };
3176
+ case "object":
3177
+ return { ...base, type: "object" };
3178
+ case "enum":
3179
+ return { ...base, type: "string" };
3180
+ case "relation":
3181
+ return { ...base, type: "string" };
3182
+ default: {
3183
+ f.type;
3184
+ return { ...base, type: "string" };
3185
+ }
3186
+ }
3187
+ }
3119
3188
  function capabilityQuestions(call, signature, ruleCapabilities) {
3120
3189
  const entityName = call.params.entityName ?? signature.entities[0]?.name ?? call.orbital;
3121
3190
  const seen = /* @__PURE__ */ new Set();
@@ -4349,6 +4418,6 @@ function buildPayloadForEdge(transition, guardCase) {
4349
4418
  return {};
4350
4419
  }
4351
4420
 
4352
- export { AGENT_DOMAIN_CATEGORIES, ALLOWED_CUSTOM_COMPONENTS, ASSET_ASPECTS, ASSET_DIMENSIONS, AgentDomainCategorySchema, AnimationDefSchema, AssetAspectSchema, AssetCatalogEntrySchema, AssetCatalogSchema, AssetDimensionSchema, AssetMapSchema, AssetMappingSchema, BINDING_CONTEXT_RULES, BINDING_DOCS, BINDING_ROOTS, BindingSchema, CORE_BINDINGS, 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, EntityPersistenceSchema, EntityRefSchema, EntityRefStringSchema, EntityRoleSchema, EntitySchema, EntitySemanticRoleSchema, EventListenerSchema, EventPayloadFieldSchema, EventSchema, EventScopeSchema, EventSemanticRoleSchema, EventSourceSchema, ExpressionSchema, FieldFormatSchema, FieldSchema, FieldTypeSchema, GAME_TYPES, GameSubCategorySchema, GameTypeSchema, GeometrySliceSchema, GeometryTokensSchema, GuardSchema, IconFamilySchema, IconographySliceSchema, IconographyTokensSchema, IllustrationSliceSchema, IllustrationStyleSchema, IllustrationTokensSchema, InteractionModelSchema, KNOWN_VALIDATION_ERROR_CODES, ListenSourceSchema, McpServiceDefSchema, MotionDurationKeySchema, MotionDurationPaletteSchema, MotionEasingKeySchema, MotionEasingPaletteSchema, MotionIntentMapSchema, MotionIntentSchema, MotionSliceSchema, MotionTokensSchema, 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, SchemaMetadataSchema, SemanticAssetRefSchema, ServiceDefinitionSchema, ServiceRefObjectSchema, ServiceRefSchema, ServiceRefStringSchema, ServiceTypeSchema, SkinSpecSchema, SocketEventsSchema, SocketServiceDefSchema, SpacingScaleSchema, StateMachineSchema, StateSchema, StateSemanticRoleSchema, SuggestedGuardSchema, ThemeDefinitionSchema, ThemeRefSchema, ThemeRefStringSchema, ThemeTokensSchema, ThemeVariantSchema, TraitCategorySchema, TraitConfigSchema, TraitConfigValueSchema, TraitDataEntitySchema, TraitEntityFieldSchema, TraitEventContractSchema, TraitEventListenerSchema, TraitFieldRefSchema, TraitRefSchema, TraitReferenceSchema, TraitSchema, TraitTickSchema, TransitionSchema, TypeIntentMapSchema, TypeIntentSchema, TypeScaleEntrySchema, TypeScaleSchema, TypeScaleTokensSchema, TypeSizeKeySchema, TypeSliceSchema, TypeSlotSchema, TypeWeightSchema, UISlotSchema, UI_SLOTS, UXHintsSchema, UseDeclarationSchema, UserPersonaSchema, VISUAL_STYLES, ViewTypeSchema, VisualStyleSchema, answerToMutations, answersToMutations, applyEventWiring, applyFactoryCallPlanMutation, applyRenderOverlay, atomic, buildEdgeCoveringWalk, buildGuardPayloads, buildReplayPaths, buildStateGraph, callService, categorizeRemovals, classifyWorkflow, clearSchemaCache, collectBindings, collectReachableStates, composeBehaviors, constTruth, createAssetKey, createEmptyResolvedPage, createEmptyResolvedTrait, createLazyService, createResolvedField, createTypedEventBus, deref, deriveCollection, deriveInputType, despawn, detectLayoutStrategy, detectPageContentReduction, diffFactoryCalls, diffOrbitalSchemas, diffSchemaSemantics, diffSchemas, doEffects, emit, extractPayloadFieldRef, findService, fingerprintNode, generateQuestions, getAllPatternTypes, getArgs, getBindingExamples, getDefaultAnimationsForRole, getEntity, getInteractionModelForDomain, getOperator, getPage, getPages, getRemovals, getSchemaCacheStats, getServiceNames, getTrait, getTraitConfig, getTraitName, hasService, hasSignificantPageReduction, inferTsType, insertChildAtPath, isBinding, isCircuitEvent, isDestructiveChange, isEffect, isEntityCall, isEntityReference, isEntityReferenceAny, isImportedTraitRef, isInlineTrait, isJsonArray, isJsonObject, isJsonPrimitive, isKnownValidationErrorCode, isMcpService, isOrbitalDefinition, isPageReference, isPageReferenceObject, isPageReferenceString, isResolvedIR, isRestService, isRuntimeEntity, isSExpr, isSExprAtom, isSExprCall, isSExprEffect, isServiceReference, isServiceReferenceObject, isSingletonEntity, isSocketService, isThemeReference, isTraitFieldRef, isValidBinding, navigate, navigatePatternPath, normalizeTraitRef, notify, parseAssetKey, parseBinding, parseEntityRef, parseImportedTraitRef, parseOrbitalSchema, parsePageRef, parseServiceRef, persist, ref, removeChildAtPath, renderUI, replaceChildAtPath, requiresConfirmation, safeParseOrbitalSchema, schemaToIR, set, setPropAtPath, sexpr, spawn, summarizeOrbital, summarizeSchema, swap, toBindingRoot, translateOverlaysToParams, validateAssetAnimations, validateBindingInContext, walkSExpr, walkStatePairs, watch, widenTier };
4421
+ export { AGENT_DOMAIN_CATEGORIES, ALLOWED_CUSTOM_COMPONENTS, ASSET_ASPECTS, ASSET_DIMENSIONS, AgentDomainCategorySchema, AnimationDefSchema, AssetAspectSchema, AssetCatalogEntrySchema, AssetCatalogSchema, AssetDimensionSchema, AssetMapSchema, AssetMappingSchema, AssetSchema, BINDING_CONTEXT_RULES, BINDING_DOCS, BINDING_ROOTS, BindingSchema, CORE_BINDINGS, 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, EntityPersistenceSchema, EntityRefSchema, EntityRefStringSchema, EntityRoleSchema, EntitySchema, EntitySemanticRoleSchema, EventListenerSchema, EventPayloadFieldSchema, EventSchema, EventScopeSchema, EventSemanticRoleSchema, EventSourceSchema, ExpressionSchema, FieldFormatSchema, FieldSchema, FieldTypeSchema, GAME_TYPES, GameSubCategorySchema, GameTypeSchema, GeometrySliceSchema, GeometryTokensSchema, GuardSchema, IconFamilySchema, IconographySliceSchema, IconographyTokensSchema, IllustrationSliceSchema, IllustrationStyleSchema, IllustrationTokensSchema, InteractionModelSchema, KNOWN_VALIDATION_ERROR_CODES, ListenSourceSchema, McpServiceDefSchema, MotionDurationKeySchema, MotionDurationPaletteSchema, MotionEasingKeySchema, MotionEasingPaletteSchema, MotionIntentMapSchema, MotionIntentSchema, MotionSliceSchema, MotionTokensSchema, 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, SchemaMetadataSchema, SemanticAssetRefSchema, ServiceDefinitionSchema, ServiceRefObjectSchema, ServiceRefSchema, ServiceRefStringSchema, ServiceTypeSchema, SkinSpecSchema, SocketEventsSchema, SocketServiceDefSchema, SpacingScaleSchema, StateMachineSchema, StateSchema, StateSemanticRoleSchema, SuggestedGuardSchema, ThemeDefinitionSchema, ThemeRefSchema, ThemeRefStringSchema, ThemeTokensSchema, ThemeVariantSchema, TraitCategorySchema, TraitConfigSchema, TraitConfigValueSchema, TraitDataEntitySchema, TraitEntityFieldSchema, TraitEventContractSchema, TraitEventListenerSchema, TraitFieldRefSchema, TraitRefSchema, TraitReferenceSchema, TraitSchema, TraitTickSchema, TransitionSchema, TypeIntentMapSchema, TypeIntentSchema, TypeScaleEntrySchema, TypeScaleSchema, TypeScaleTokensSchema, TypeSizeKeySchema, TypeSliceSchema, TypeSlotSchema, TypeWeightSchema, UISlotSchema, UI_SLOTS, UXHintsSchema, UseDeclarationSchema, UserPersonaSchema, VISUAL_STYLES, ViewTypeSchema, VisualStyleSchema, answerToMutations, answersToMutations, applyEventWiring, applyFactoryCallPlanMutation, applyRenderOverlay, atomic, buildEdgeCoveringWalk, buildGuardPayloads, buildReplayPaths, buildStateGraph, callService, categorizeRemovals, classifyWorkflow, clearSchemaCache, collectBindings, collectReachableStates, composeBehaviors, constTruth, createAssetKey, createEmptyResolvedPage, createEmptyResolvedTrait, createLazyService, createResolvedField, createTypedEventBus, deref, deriveCollection, deriveInputType, despawn, detectLayoutStrategy, detectPageContentReduction, diffFactoryCalls, diffOrbitalSchemas, diffSchemaSemantics, diffSchemas, doEffects, emit, extractPayloadFieldRef, findService, fingerprintNode, generateQuestions, getAllPatternTypes, getArgs, getBindingExamples, getDefaultAnimationsForRole, getEntity, getInteractionModelForDomain, getOperator, getPage, getPages, getRemovals, getSchemaCacheStats, getServiceNames, getTrait, getTraitConfig, getTraitName, hasService, hasSignificantPageReduction, inferTsType, insertChildAtPath, isBinding, isCallSiteConfigDeclaration, isCircuitEvent, isDestructiveChange, isEffect, isEntityCall, isEntityReference, isEntityReferenceAny, isImportedTraitRef, isInlineTrait, isJsonArray, isJsonObject, isJsonPrimitive, isKnownValidationErrorCode, isMcpService, isOrbitalDefinition, isPageReference, isPageReferenceObject, isPageReferenceString, isResolvedIR, isRestService, isRuntimeEntity, isSExpr, isSExprAtom, isSExprCall, isSExprEffect, isServiceReference, isServiceReferenceObject, isSingletonEntity, isSocketService, isThemeReference, isTraitFieldRef, isValidBinding, navigate, navigatePatternPath, normalizeTraitRef, notify, parseAssetKey, parseBinding, parseEntityRef, parseImportedTraitRef, parseOrbitalSchema, parsePageRef, parseServiceRef, persist, ref, removeChildAtPath, renderUI, replaceChildAtPath, requiresConfirmation, safeParseOrbitalSchema, schemaToIR, set, setPropAtPath, sexpr, spawn, summarizeOrbital, summarizeSchema, swap, toBindingRoot, translateOverlaysToParams, validateAssetAnimations, validateBindingInContext, walkSExpr, walkStatePairs, watch, widenTier };
4353
4422
  //# sourceMappingURL=index.js.map
4354
4423
  //# sourceMappingURL=index.js.map