import type { PersonalitySyncConfig } from './sync'; import type { BacktestProviderConfig, BacktestProviderSource, BacktestToolConfig } from './backtest'; import type { PlatformId } from './platforms/base'; declare const CONFIG_DIR: string; declare const CONFIG_FILE: string; export interface ConnectorConfig { connector_id: string; connector_token: string; server_url: string; ws_url: string; platform: PlatformId; gateway_url: string; gateway_secret: string; agent_model: string; heartbeat_interval_seconds: number; remote_maintenance_allowed?: boolean; /** 只有显式本机授权写入 v1,旧版自动生成的 allowed=true 不构成同意。 */ remote_maintenance_consent_version?: 1; personality_sync?: PersonalitySyncConfig; backtest_provider?: BacktestProviderConfig; backtest_provider_sources?: BacktestProviderSource[]; backtest_tools?: BacktestToolConfig[]; /** Hermes 独立 profile 名(v2 新增,'cutie' 为默认值;字段缺失表示 v1 遗留 config) */ hermes_profile?: string; } /** 平台无关的默认值——platform、gateway_url、agent_model 由 platform adapter 动态补全 */ declare const DEFAULT_CONFIG: Partial; /** 远程维护必须同时具备显式开关和当前 consent marker,legacy true fail-closed。 */ export declare function isRemoteMaintenanceAllowed(config: Pick): boolean; /** 本机显式切换远程维护授权;关闭时同步移除 consent marker。 */ export declare function setRemoteMaintenanceConsent(config: ConnectorConfig, allowed: boolean): ConnectorConfig; export declare function ensureConfigDir(): void; /** * 根据 platform 补全 gateway_url / agent_model 等平台相关字段。 * 只在字段缺失时补,不覆盖用户显式设置的值。返回是否有变更。 */ export declare function applyPlatformDefaults(config: ConnectorConfig): boolean; export declare function loadConfig(): ConnectorConfig | null; export declare function saveConfig(config: ConnectorConfig): void; /** * 合并 setup/pair 流程新构造的 config 和磁盘上既有 config。 * `next` 管理的字段(如 connector_id、gateway_url)以 `next` 为准; * `next` 不管理的既有字段(backtest_tools、backtest_provider、hermes_profile * 等,含未来新增字段)从 `existing` 透传,避免 setup/重新配对整体重写丢配置段 * (2026-07-03 Claw-1 事故:重新 setup 后 backtest_tools 丢失,connector 不再 * 上报 backtest_run capability)。 */ export declare function mergeConfigForSetup(existing: ConnectorConfig | null, next: ConnectorConfig): ConnectorConfig; export declare function deleteConfig(): void; export { CONFIG_DIR, CONFIG_FILE, DEFAULT_CONFIG }; /** 给 CLI 命令用:返回当前平台的默认 gateway_url(http://127.0.0.1:) */ export declare function platformDefaultGatewayUrl(platform: PlatformId): string; /** * 检测是否为 v1 遗留 Hermes config(只做检测,不做迁移副作用)。 * 触发条件(任一满足): * - hermes_profile 字段不存在(v2 配置必然有这个字段) * - gateway_url 指向 :8642(主 profile 端口,v2 cutie profile 永远不用 8642) * * 参数类型收窄到只读字段(platform / gateway_url / hermes_profile),让 * Hermes adapter 直接传自己的 narrow HermesAdapterConfig 进来,无需 `as never` cast。 */ export declare function isLegacyHermesConfig(config: { platform: string; gateway_url?: string; hermes_profile?: string; }): boolean;