import { type SqliteDb } from "./sqlite-db"; export interface ConnectorSecurityConfig { enabled: boolean; values: Record; } /** Dashboard-managed configuration for a connector channel. */ export interface ConnectorConfigRecord { channel: string; type: string; values: Record; security?: ConnectorSecurityConfig; configuredAt: string; updatedAt: string; } /** A successfully launched connector instance eligible for auto-reconnect. */ export interface ConnectorConnectionRecord { channel: string; instanceId: string; connectArgs: string[]; lastSuccessfulArgs: string[]; enabled: boolean; updatedAt: string; lastConnectedAt: string; } export declare function ensureConnectorSchema(db: SqliteDb): void; export interface SqliteConnectorStoreOptions { dbPath?: string; } /** * SQLite-backed store for connector configuration and credentials. * Replaces the legacy `~/.cline/data/connectors/settings.json` file; any * existing legacy file is imported on first open and renamed so the two * stores cannot diverge. */ export declare class SqliteConnectorStore { private readonly dbPath; private db; constructor(options?: SqliteConnectorStoreOptions); private getRawDb; close(): void; getConfig(channel: string): ConnectorConfigRecord | undefined; listConfigs(): ConnectorConfigRecord[]; getConnection(channel: string, instanceId: string): ConnectorConnectionRecord | undefined; listConnections(channel?: string): ConnectorConnectionRecord[]; /** * Create or update dashboard configuration. If exactly one persisted * instance exists, its desired reconnect arguments may be updated * atomically. With multiple instances, only the channel-wide dashboard * configuration is updated because choosing reconnect args is ambiguous. */ upsertConfig(entry: { channel: string; type?: string; values: Record; security?: ConnectorSecurityConfig; updateConnectArgs?: (existing: { config?: ConnectorConfigRecord; connection: ConnectorConnectionRecord; }) => string[]; configuredAt?: string; updatedAt?: string; }): void; /** * Record a successful `cline connect ` start: keep the exact args * (auth flags included) for auto-reconnect and re-enable the channel. */ recordConnected(channel: string, instanceId: string, connectArgs: string[]): void; /** Toggle auto-reconnect for one instance or every instance in a channel. */ setEnabled(channel: string, enabled: boolean, instanceId?: string): void; deleteConnection(channel: string, instanceId: string): boolean; disableAll(): void; /** * Remove only dashboard-managed configuration. Persisted CLI instances live * in a separate table and are intentionally unaffected. */ deleteConfig(channel: string): boolean; /** * One-time import of the legacy JSON settings file. Existing DB rows win; * the file is renamed (not deleted) afterwards so older builds cannot keep * writing to a store that is no longer read. */ private importLegacyJsonSettings; } /** * Convenience wrapper that opens the store, runs `fn`, and always closes the * DB handle. Suitable for the infrequent configure/connect/stop operations; * long-lived processes that poll the store should hold their own instance. */ export declare function withConnectorStore(fn: (store: SqliteConnectorStore) => T): T;