@almadar/core 10.8.0 → 10.10.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
@@ -527,6 +527,9 @@ var TraitConfigValueSchema = z.lazy(
527
527
  ])
528
528
  );
529
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
+ }
530
533
  var ConfigFieldDeclarationSchema = z.object({
531
534
  type: z.string(),
532
535
  default: TraitConfigValueSchema.optional(),
@@ -669,7 +672,11 @@ var TraitReferenceSchema = z.object({
669
672
  z.string().min(1, "fields key (canonical field name) must be non-empty"),
670
673
  z.string().min(1, "fields value (consumer field name) must be non-empty")
671
674
  ).optional(),
672
- 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(),
673
680
  appliesTo: z.array(z.string()).optional(),
674
681
  // Phase F.7: zod accepts an array (the inliner validates element
675
682
  // shape). The full ListenDefinition shape isn't recursively encoded
@@ -2988,6 +2995,7 @@ function generateQuestions(plan, catalog, ruleOverlay) {
2988
2995
  const signature = findSignature(catalog, call.organism, call.orbital);
2989
2996
  if (!signature) continue;
2990
2997
  out.push(...configKeyQuestions(call, signature));
2998
+ out.push(...entityFieldQuestions(call, signature));
2991
2999
  out.push(...capabilityQuestions(call, signature, ruleCapabilities));
2992
3000
  }
2993
3001
  return out;
@@ -3121,6 +3129,68 @@ function stringifyDefault(v) {
3121
3129
  if (Array.isArray(v)) return `${v.length} item${v.length === 1 ? "" : "s"}`;
3122
3130
  return "object";
3123
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
+ if (Array.isArray(f.values) && f.values.length > 0) {
3180
+ return { ...base, type: "enum", values: f.values };
3181
+ }
3182
+ return { ...base, type: "string" };
3183
+ case "relation":
3184
+ if (f.relation !== void 0) {
3185
+ return { ...base, type: "relation", relation: f.relation };
3186
+ }
3187
+ return { ...base, type: "string" };
3188
+ default: {
3189
+ f.type;
3190
+ return { ...base, type: "string" };
3191
+ }
3192
+ }
3193
+ }
3124
3194
  function capabilityQuestions(call, signature, ruleCapabilities) {
3125
3195
  const entityName = call.params.entityName ?? signature.entities[0]?.name ?? call.orbital;
3126
3196
  const seen = /* @__PURE__ */ new Set();
@@ -4354,6 +4424,6 @@ function buildPayloadForEdge(transition, guardCase) {
4354
4424
  return {};
4355
4425
  }
4356
4426
 
4357
- 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, 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 };
4427
+ 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 };
4358
4428
  //# sourceMappingURL=index.js.map
4359
4429
  //# sourceMappingURL=index.js.map