import { BaseMessage } from '@langchain/core/messages'; import { LayerDescriptionWrapper } from '../llm/generateLayerDescriptions'; import { AgentRegistry } from '../registry/agentRegistry'; import { HITLResponse } from '../hitl/types'; import { FieldSearchService } from '../services/fieldSearch'; import { LayerSearchService } from '../services/layerSearch'; import { UniqueValueCountInfo, SummaryStatisticsResult } from '@arcgis/core/smartMapping/statistics/types.js'; import { DomainUnion } from '@arcgis/core/layers/support/types'; export type FieldStatistics = { summaryStatistics: SummaryStatisticsResult | null; uniqueValues: UniqueValueCountInfo[] | null; }; export type FieldInfo = { name: string; alias: string; type: string; description: string; valueType: string; statistics?: FieldStatistics; domain?: DomainUnion; }; export type FieldsRegistry = Map; /** Registry mapping layer IDs to their description and associated field registry. */ export type LayersAndFieldsRegistry = Map; export type FieldVectors = { layerId: string; results: { name: string; score: number; }[]; }; export type VectorSearchFieldResults = FieldVectors[]; /** Sequence of AI and human messages that make up the chat history. */ export type ChatHistory = BaseMessage[]; export type Services = Readonly<{ /** Registry used to discover and invoke available agents. */ agentRegistry: AgentRegistry; /** Finds candidate layers using semantic (vector) search. */ layerSearch?: LayerSearchService; /** Finds relevant fields for given layers using semantic (vector) search. */ fieldSearch?: FieldSearchService; /** Registry of available layers and their fields for query / search (optional). */ layersAndFieldsRegistry?: LayersAndFieldsRegistry; /** Per-request cache for query embeddings - shared across all agents */ embeddingCache: QueryEmbeddingCache; }>; export type CustomConfigurableType = Record & { thread_id: string; /** Optional HITL response injected by the host application. */ hitlResponse: HITLResponse | null; /** Runtime services provided to agents and nodes. */ services: Services; agentId?: string; context?: unknown; }; /** Cache for query embeddings to avoid duplicate API calls within a request */ export type QueryEmbeddingCache = Map;