import { SmrtClassOptions, SmrtCollection, SmrtObject } from '@happyvertical/smrt-core'; /** * AgentConfig stores agent configuration in the database * * Each config record maps to a UI slot for an agent configuration owner: * - agentId: The durable config owner ID (persona ID for persona-backed * instances; Agent STI row ID for legacy/singleton instances) * - agentClass: The canonical agent type (qualified name when available) * - slotId: The configuration slot (e.g., 'sources', 'settings') * - configData: JSON object containing the configuration * * @example * ```typescript * // Save config for an agent slot * const config = new AgentConfig({ * agentId: agent.id, * agentClass: 'Praeco', * slotId: 'sources', * configData: { scrapers: ['civicweb', 'govstack'] }, * db: options.db * }); * await config.initialize(); * await config.save(); * ``` */ export declare class AgentConfig extends SmrtObject { /** * Tenant ID for multi-tenant isolation * Nullable to support both tenant-scoped and global agent configs */ tenantId: string | null; /** * Durable configuration owner ID. * * The database column retains the historical `agent_id` name for backward * compatibility. Persona-backed runtimes store their `AgentPersona.id` here; * legacy runtimes store the persisted Agent STI row id. */ agentId: string; /** * Canonical agent type for this config (qualified name when available) */ agentClass: string; /** * UI slot ID (e.g., 'sources', 'settings', 'reports') */ slotId: string; /** * Configuration data stored as JSON * * Sensitive (#1540) for backward compatibility with legacy blobs, so this is * excluded from generated API/MCP responses and rejected as a `where` filter * key. New settings schemas must keep credentials in a dedicated secrets * service rather than this field. */ configData: Record; /** * Schema version for future migrations */ schemaVersion: number; /** * Load all configs for a specific agent * * @param agentId - Agent instance ID * @param options - Database options * @returns Map of slotId → configData */ static forAgent(agentId: string, options: SmrtClassOptions): Promise>>; /** * Load configs for multiple agents in a single query. * * @param agentIds - Agent instance IDs * @param options - Database options * @returns Map of agentId -> (slotId -> configData) */ static forAgents(agentIds: string[], options: SmrtClassOptions): Promise>>>; /** * Load config for a specific agent and slot * * @param agentId - Agent instance ID * @param slotId - UI slot ID * @param options - Database options * @returns Config data or undefined if not found */ static forSlot(agentId: string, slotId: string, options: SmrtClassOptions): Promise | undefined>; /** * Save or update config for an agent slot * * @param data - Config data including agentId, agentClass, slotId, configData * @param options - Database options * @returns Saved AgentConfig instance */ static saveSlot(data: { agentId: string; agentClass: string; slotId: string; configData: Record; }, options: SmrtClassOptions): Promise; } /** * Collection for AgentConfig objects */ export declare class AgentConfigCollection extends SmrtCollection { static readonly _itemClass: typeof AgentConfig; /** * Find all configs for a specific tenant * @param tenantId - Tenant ID to filter by * @returns Array of AgentConfig objects for the tenant */ findByTenant(tenantId: string): Promise; /** * Find all global configs (not associated with any tenant). * * Routes through the shared tenant-global helper so it does not throw under * an active tenant context (an explicit `tenant_id IS NULL` filter would be * flagged as an isolation violation). (#1600) * * @returns Array of global AgentConfig objects */ findGlobal(): Promise; /** * Find configs for a tenant including global configs. * * Fails closed if an active tenant context requests a different tenant's * rows; the admin/system path keeps the cross-tenant capability. (#1600) * * @param tenantId - Tenant ID to include * @returns Array of AgentConfig objects for the tenant and global configs */ findWithGlobals(tenantId: string): Promise; } //# sourceMappingURL=config.d.ts.map