import { BUILT_IN_TYPE_NAMES } from './entity-types-defaults.js'; export type FieldType = 'string' | 'number' | 'boolean' | 'date' | 'datetime' | 'duration' | 'time' | 'date-fixed' | 'date-floating' | 'reference' | 'enum' | 'array' | 'object'; export interface FieldDef { key: string; type: FieldType; label?: string; required?: boolean; default?: unknown; values?: string[]; targetType?: string; } /** Maps a field from the template entity to the spawned child entity */ export interface FieldMapping { from?: string; to?: string; target?: string; value?: string; default?: unknown; } export interface DateSeriesScheduling { cadenceField: string; cadenceDetailsField: string; blackoutField: string; } export interface SpawnerConfig { mode: 'date-series' | 'template'; targetTypeField?: string; titlePattern?: string; dedupeFields?: string[]; scheduling?: DateSeriesScheduling; fieldMapping?: FieldMapping[]; childrenField?: string; } export type TemporalAnchor = 'date' | 'datetime' | 'daterange'; export interface TemporalConfig { /** Which temporal construct this type uses */ anchor: TemporalAnchor; /** Frontmatter field holding the primary date or datetime value */ field: string; /** * For 'daterange': the end date/datetime field. * Window relevance is measured from the START date (field), not end. */ endField?: string; /** For 'daterange': duration field, used when endField is absent */ durationField?: string; /** * Window of importance relative to today. * A node is considered relevant when: * today ∈ [node.date − windowDaysBefore, node.date + windowDaysAfter] * * Examples: * Executive calendar: windowDaysBefore=7, windowDaysAfter=14 * Soccer season: windowDaysBefore=14, windowDaysAfter=120 * TV show premiere: windowDaysBefore=0, windowDaysAfter=3 */ windowDaysBefore: number; windowDaysAfter: number; /** * Days after the anchor date to move the node to .archive/. * Undefined = never auto-archive. * The archive cron job runs daily and moves expired nodes. */ deleteAfterDays?: number; } export interface RelevanceConfig { /** * Weights for composite relevance score. Active signals are normalized to * sum to 1.0 automatically — only declare the signals your type uses. * Signals with no config (spatial, goalAlignment, etc.) are excluded unless * their sub-config is also present. */ weights?: { semantic?: number; recency?: number; graphProximity?: number; coOccurrence?: number; centrality?: number; spatial?: number; goalAlignment?: number; socialProximity?: number; behavioral?: number; }; /** Recency half-life in days. Default: 30. */ recencyHalfLifeDays?: number; /** Max graph hops for proximity traversal. Default: 2. */ graphDepth?: number; /** Edge labels to follow during graph proximity. Absent = all edges. */ anchorRelationships?: string[]; /** * Spatial scoring. Requires entities to have a coordinates field * holding { lat: number; lng: number }. */ spatial?: { /** Frontmatter field holding { lat, lng }. Default: 'coordinates'. */ coordinatesField?: string; /** Distance (km) at which spatial score reaches 0. Default: 50. */ maxDistanceKm?: number; }; /** * Goal alignment scoring. Traverses the graph from each candidate node * looking for active goal nodes. Closer = higher score. */ goalAlignment?: { /** Max hops to search for a connected goal. Default: 3. */ maxHops?: number; }; /** * Social proximity scoring. Reads a relationship-type field on the node * and maps it to a static weight. */ socialProximity?: { /** Frontmatter field holding the relationship type. Default: 'relationship'. */ relationshipField?: string; /** * Weight map from relationship type to score [0, 1]. * Default: { family: 1.0, friend: 0.75, colleague: 0.5, acquaintance: 0.25, professional: 0.4 } */ weights?: Record; }; } export interface EntityTypeConfig { name: string; plural: string; directory: string; description?: string; defaultTags?: string[]; fields: FieldDef[]; completionField?: string; completionValue?: string; spawner?: SpawnerConfig; calendarDateField?: string; calendarEndField?: string; calendarDurationField?: string; /** Temporal window configuration — drives relevance filtering and auto-archive */ temporal?: TemporalConfig; /** Non-temporal relevance scoring configuration */ relevance?: RelevanceConfig; /** @deprecated Use temporal.windowDaysBefore instead */ timeWindowDaysPast?: number; /** @deprecated Use temporal.windowDaysAfter instead */ timeWindowDaysFuture?: number; } export declare function invalidateCache(): void; /** * Load entity type configs. Returns vault file contents if present, * otherwise falls back to built-in defaults. */ export declare function loadEntityTypes(): Promise; /** * Save entity type configs to the vault file. */ export declare function saveEntityTypes(types: EntityTypeConfig[]): Promise; /** * Write entity-types.json with built-in defaults if it doesn't already exist. * Called by `phaibel init`. */ export declare function initEntityTypes(): Promise; /** * Get the config for a specific entity type by name. */ export declare function getEntityType(name: string): Promise; /** * List all registered entity type names. */ export declare function listEntityTypeNames(): Promise; /** * Get all entity types that have a spawner config. */ export declare function getSpawnerTypes(): Promise; /** * Add a new entity type. Throws if name already exists. * Creates the entity directory and a .cxms.md context file. */ export declare function addEntityType(config: EntityTypeConfig): Promise; /** * Replace an entity type by name. Throws if not found. */ export declare function updateEntityType(name: string, config: EntityTypeConfig): Promise; /** * Remove an entity type by name. Throws if not found or is built-in. */ export declare function removeEntityType(name: string): Promise; export { BUILT_IN_TYPE_NAMES }; /** @deprecated Use ContextTypeConfig */ export type ContextTypeConfig = EntityTypeConfig; /** @deprecated Use loadContextTypes() */ export declare const loadContextTypes: typeof loadEntityTypes; /** @deprecated Use getContextType() */ export declare const getContextType: typeof getEntityType; /** @deprecated Use listContextTypeNames() */ export declare const listContextTypeNames: typeof listEntityTypeNames; //# sourceMappingURL=entity-type-config.d.ts.map