/** * Agent Discovery * * Discovers agent tables by querying the agent_chat_module config table * at runtime. The module stores schema_id, table names, and table IDs * when provisioned — no smart tags needed. * * Results are cached per-database with a TTL so the REST middleware * doesn't hit the database on every request. * * Discovery is keyed by `database_id`, as every other module lookup is: one * serving database holds several tenants' schemas, so an unkeyed lookup does * not fail — it resolves a neighbouring tenant's agent tables, and the cache * then serves that for its whole TTL. */ import { Pool } from 'pg'; export interface AgentTableInfo { /** The PostgreSQL schema name (e.g. 'agent_public') */ schemaName: string; /** The table name (e.g. 'agent_thread') */ tableName: string; } export interface AgentDiscovery { thread: AgentTableInfo | null; message: AgentTableInfo | null; task: AgentTableInfo | null; } /** Clear all cached discovery results (for testing) */ export declare function clearAgentDiscoveryCache(): void; /** * Look up agent table info for a database, querying the module config table. * Results are cached per database id with a 60s TTL. */ export declare function getAgentDiscovery(pool: Pool, databaseId: string): Promise;