import type { Vector3 } from '@holoscript/core'; /** * Spatial Context Provider * Sprint 4 Priority 4 - Spatial Context Awareness * * Manages spatial context for agents, providing real-time updates about * nearby entities, regions, and visibility. */ import { EventEmitter } from 'events'; import { SpatialContext, SpatialEntity, Region, SpatialEvent, SpatialAwarenessConfig } from './SpatialTypes'; import { SpatialQuery, QueryResult } from './SpatialQuery'; /** * Events emitted by the spatial context provider */ export interface SpatialContextProviderEvents { 'entity:entered': (agentId: string, event: SpatialEvent) => void; 'entity:exited': (agentId: string, event: SpatialEvent) => void; 'region:entered': (agentId: string, event: SpatialEvent) => void; 'region:exited': (agentId: string, event: SpatialEvent) => void; 'visibility:changed': (agentId: string, event: SpatialEvent) => void; 'context:updated': (agentId: string, context: SpatialContext) => void; } /** * Provides spatial context to agents */ export declare class SpatialContextProvider extends EventEmitter { private agents; private entities; private regions; private queryExecutor; private updateInterval; private isRunning; constructor(); /** * Start the spatial context provider */ start(): void; /** * Stop the spatial context provider */ stop(): void; /** * Manual update (for testing or custom update loops) */ update(): void; /** * Register an agent for spatial awareness */ registerAgent(agentId: string, position: Vector3, config?: Partial): void; /** * Unregister an agent */ unregisterAgent(agentId: string): void; /** * Update agent position */ updateAgentPosition(agentId: string, position: Vector3, velocity?: Vector3): void; /** * Get agent's current spatial context */ getContext(agentId: string): SpatialContext | null; /** * Add or update an entity */ setEntity(entity: SpatialEntity): void; /** * Remove an entity */ removeEntity(entityId: string): void; /** * Batch update entities */ setEntities(entities: SpatialEntity[]): void; /** * Get all entities */ getEntities(): SpatialEntity[]; /** * Add or update a region */ setRegion(region: Region): void; /** * Remove a region */ removeRegion(regionId: string): void; /** * Subscribe to region events for an agent */ subscribeToRegion(agentId: string, regionId: string, callback: (event: SpatialEvent) => void): void; /** * Unsubscribe from region events */ unsubscribeFromRegion(agentId: string, regionId: string): void; /** * Execute a spatial query */ query(query: SpatialQuery): QueryResult[]; /** * Find nearest entities to position */ findNearest(from: Vector3, count?: number, typeFilter?: string[]): QueryResult[]; /** * Find entities within radius */ findWithin(from: Vector3, radius: number, typeFilter?: string[]): QueryResult[]; /** * Find visible entities from position */ findVisible(from: Vector3, direction?: Vector3, fov?: number, maxDistance?: number): QueryResult[]; /** * Update context for a single agent */ private updateAgentContext; /** * Find entities within radius of position */ private findEntitiesInRadius; /** * Find regions containing position */ private findRegionsContaining; /** * Check if position is in region */ private isInRegion; /** * Check for entity enter/exit events */ private checkEntityEvents; /** * Check for region enter/exit events */ private checkRegionEvents; /** * Compute sight lines to entities */ private computeSightLines; /** * Check if line between two points is blocked */ private isLineBlocked; /** * Get entity radius */ private getEntityRadius; /** * Dot product */ private dot3; /** * Rebuild the query executor index */ private rebuildQueryIndex; /** * Get minimum update interval */ private getMinUpdateInterval; } //# sourceMappingURL=SpatialContextProvider.d.ts.map