/**
 * Chat-connection configuration loaded from
 * `~/.opensquid/config.json` `chat_connections` block. Per-platform
 * blocks are independent — having one configured doesn't require any
 * of the others.
 *
 * Shape:
 * ```json
 * {
 *   "version": 1,
 *   "chat_connections": {
 *     "telegram": { "bot_token": "...", "allowlist_chat_ids": ["8075471258"] },
 *     "discord":  { "bot_token": "...", "allowlist_user_ids":  ["..."] },
 *     "slack":    { "bot_token": "xoxb-...", "app_token": "xapp-...", "allowlist_user_ids": ["..."] }
 *   }
 * }
 * ```
 *
 * Tokens are stored in cleartext in `config.json`; advise users to
 * `chmod 600 ~/.opensquid/config.json` (the file lives in a hidden
 * dir already, so this is a small additional hardening — not a real
 * defense against a compromised user account).
 *
 * Ported from `src.legacy/chat/config.ts` for CAT.1b. Two relocations
 * vs. the legacy module:
 *   - The host `config.json` is read/written here directly, keyed on
 *     `OPENSQUID_HOME()` (runtime/paths), instead of the legacy
 *     `codex/store.js` data-root + `../config.js` engine helpers. The
 *     new tree split engine-binary discovery into a SEPARATE
 *     `engine-config.json` (src/engine/config.ts), so `config.json` is
 *     now the chat stack's own file — but we still round-trip unknown
 *     top-level keys so we never clobber a field another writer owns.
 *   - The token resolver imports from the relocated `./env-token.js`.
 */
import { type EnvSource } from './env-token.js';
export type ChatPlatform = 'telegram' | 'discord' | 'slack';
export interface TelegramConfig {
    bot_token: string;
    /**
     * Chat ids the bot will accept messages from. Empty = accept from any
     * chat (NOT recommended — the bot is publicly addressable via Telegram).
     */
    allowlist_chat_ids?: string[];
}
export interface DiscordConfig {
    bot_token: string;
    /** User ids whose DMs / @-mentions the bot will respond to. Empty = bot owner only. */
    allowlist_user_ids?: string[];
}
export interface SlackConfig {
    /** Bot User OAuth Token — starts with `xoxb-`. Used for Web API calls. */
    bot_token: string;
    /**
     * App-level Token — starts with `xapp-`. Required for Socket Mode
     * (the no-public-ingress connection style we use).
     */
    app_token: string;
    /** User ids the bot will respond to. Empty = bot owner only. */
    allowlist_user_ids?: string[];
}
export interface ChatConnectionsConfig {
    telegram?: TelegramConfig;
    discord?: DiscordConfig;
    slack?: SlackConfig;
}
export declare function loadChatConfig(): Promise<ChatConnectionsConfig>;
export interface ChatTokenSources {
    telegram?: EnvSource;
    discord?: EnvSource;
    slack_bot?: EnvSource;
    slack_app?: EnvSource;
    env_file_path?: string;
}
/**
 * Like loadChatConfig but also returns which source each token came
 * from. The chat-daemon uses this to log "[chat-daemon] telegram
 * bot_token source: env-file (~/.loop/.env)" so operators can debug
 * "which bot is this daemon actually using" without exposing the
 * secret.
 */
export declare function loadChatConfigWithSources(): Promise<{
    config: ChatConnectionsConfig;
    sources: ChatTokenSources;
}>;
export declare function overlayEnvTokens(base: ChatConnectionsConfig): Promise<ChatConnectionsConfig>;
export declare function saveChatConfig(chat: ChatConnectionsConfig): Promise<void>;
/**
 * Set a single platform's config block. Convenience for the future
 * `opensquid chat setup <platform>` wizard.
 */
export declare function setPlatformConfig<P extends ChatPlatform>(platform: P, config: P extends 'telegram' ? TelegramConfig : P extends 'discord' ? DiscordConfig : SlackConfig): Promise<void>;
/**
 * Forget a single platform's config block. Reverts that platform to
 * inactive on the next opensquid restart.
 */
export declare function forgetPlatformConfig(platform: ChatPlatform): Promise<void>;
export interface ConfigValidationIssue {
    platform: ChatPlatform;
    field: string;
    problem: string;
}
/**
 * Surface obvious config errors without trying to validate the token
 * against the live API (that happens on adapter start). Catches
 * empty-string / undefined / shape mistakes before opening a connection.
 */
export declare function validateChatConfig(config: ChatConnectionsConfig): ConfigValidationIssue[];
/** Which platforms have any non-empty config block? */
export declare function configuredPlatforms(config: ChatConnectionsConfig): ChatPlatform[];
//# sourceMappingURL=config.d.ts.map