import { type AutoUpdateConfig } from "./core/auto-update.js"; import type { LarkBrand } from "./platform/lark-cli.js"; /** 展开路径中的 ~ 为用户 home 目录 */ export declare function expandHome(p: string): string; export declare function resolveHomePath(homePath: string, cwd?: string): string; /** NIUBOT_HOME 默认 ~/.niubot */ declare const NIUBOT_HOME: string; export { NIUBOT_HOME }; export declare const AGENT_REGISTRY: { readonly claude: { readonly aliases: readonly ["claude", "claude-code"]; readonly command: "claude"; readonly versionArgs: readonly ["--version"]; }; readonly codex: { readonly aliases: readonly ["codex"]; readonly command: "codex"; readonly versionArgs: readonly ["--version"]; }; readonly traecli: { readonly aliases: readonly ["traecli", "trae-cli"]; readonly command: "traecli"; readonly versionArgs: readonly ["--version"]; }; readonly opencode: { readonly aliases: readonly ["opencode"]; readonly command: "opencode"; readonly versionArgs: readonly ["--version"]; }; readonly cursor: { readonly aliases: readonly ["cursor", "cursor-agent"]; readonly command: "cursor-agent"; readonly versionArgs: readonly ["--version"]; }; readonly pi: { readonly aliases: readonly ["pi", "pi-agent", "pi-coding-agent"]; readonly command: "pi"; readonly versionArgs: readonly ["--version"]; }; readonly grok: { readonly aliases: readonly ["grok", "grok-build"]; readonly command: "grok"; readonly versionArgs: readonly ["--version"]; }; }; /** 内置 agent backend 类型 */ export type BuiltinBackendType = keyof typeof AGENT_REGISTRY; /** 任意 backend 类型(内置) */ export type AgentBackendType = string; /** 单个 Bot 的配置 */ export interface BotConfig { /** 唯一标识,决定数据目录路径,初始化后不可修改 */ id: string; appId: string; appSecret: string; /** agent backend(可选,运行时从 DB 恢复或自动选择第一个可用 backend) */ backend?: string; /** agent 工作目录(默认 ~/niubot-workspace/) */ workingDirectory: string; /** 数据库路径(默认 ~/.niubot//niubot.db) */ dbPath: string; /** Bot profile 路径(默认 ~/.niubot//bot_profile.md) */ botProfilePath?: string; /** 旧版人格文件路径(兼容旧配置) */ personaPath?: string; /** 旧版 Bot 级长期做事规则路径(兼容旧配置) */ instructionsPath?: string; /** 项目级长期背景(可选;默认不创建 workspace .niubot/project.md) */ projectContextPath?: string; /** 主模型(可选,覆盖 backend 默认值) */ model?: string; /** 飞书品牌:feishu(国内)| lark(国际);用于 lark-cli 身份 profile 注册,默认 feishu */ brand?: LarkBrand; } export interface RestartConfig { sourceDirectory?: string; } export interface NiuBotConfig { /** 实际加载的配置文件;纯环境变量启动时为空。 */ configPath?: string; bots: BotConfig[]; /** 可选:重启脚本配置。默认使用当前运行包目录。 */ restart?: RestartConfig; /** 可选:自动升级配置。未配置或 enabled=false 时不启用。 */ autoUpdate?: AutoUpdateConfig; /** 可选:防休眠持久化开关。true 时 Engine 启动自动执行 /awake on。 */ keepAwake?: boolean; /** 展示时区(IANA)。未配置时默认 Asia/Shanghai。 */ timezone?: string; queue: { /** 消息缓冲合并窗口(ms),默认 1500 */ bufferMs: number; }; } export declare const BUILTIN_BACKENDS: Set<"claude" | "codex" | "traecli" | "opencode" | "cursor" | "pi" | "grok">; export declare const BUILTIN_BACKEND_LIST: BuiltinBackendType[]; /** 标准化 backend 名称:内置别名映射 */ export declare function normalizeBackend(raw: string | undefined): string | undefined; export declare function loadConfig(configPath?: string): NiuBotConfig; /** 原子修改配置文件中的 autoUpdate 布尔值,并保留 YAML 注释。 */ export declare function writeAutoUpdateEnabledToConfig(configPath: string, enabled: boolean): void; /** 原子修改配置文件中的展示时区,并保留 YAML 注释。 */ export declare function writeTimezoneToConfig(configPath: string, timezone: string): void; /** 原子修改配置文件中的 keepAwake 布尔值,并保留 YAML 注释。 */ export declare function writeKeepAwakeEnabledToConfig(configPath: string, enabled: boolean): void; /** 在公用锁内重读最新配置,再原子替换;避免多个程序内写入者相互覆盖。 */ export declare function updateConfigFileAtomically(configPath: string, update: (raw: string, format: "yaml" | "json") => string): void; /** 所有程序内的服务配置写入共用同一把跨进程锁。 */ export declare function configMutationLockPath(configPath: string): string;