For AI agents: the complete documentation index is available at /en/llms.txt, the full documentation bundle is available at /en/llms-full.txt, and this page is available as Markdown at /en/reference/sdk/node/config/index.md.
  • English
  • node/config

    Functions

    FunctionDescription
    configSchemaRef生成文件内 $schema URL(jsDelivr 缓存 GitHub 上的公开 Schema)。 from 仅作调用点语义标注,便于日后若布局分叉再按位置扩展(OCP)。
    withConfigSchema在对象根写入 $schema(不覆盖已有);数组根勿调用。
    isConfigMetaKey配置元数据键`$schema 与 _ / _comment* 前缀,加载时跳过
    stripConfigMeta浅剥离对象上的元数据键(不递归数组元素内的对象以外的深层——调用方可再 strip)
    findMonorepoRoot从 startDir 向上查找 monorepo 根(package.json#name === sfmc-monorepo)。 找不到则返回 null(例如从 npm 装到 node_modules 的独立包)。
    resolveRuntimeRoot解析运行时根目录(SFMC_ROOT)。
    resolveRuntimePath将配置项中的相对路径解析为基于工作目录的绝对路径。 若本身已是绝对路径则直接返回;相对路径则相对于 runtimeRoot 进行解析。
    configDir获取配置文件存放目录路径(<runtimeRoot>/configs)。
    configPath获取指定配置文件的完整绝对路径(<runtimeRoot>/configs/<name>)。
    stateDir运行态临时状态与缓存目录路径(<runtimeRoot>/.sfmc)。 PID 文件、探活缓存与运行时产物的唯一权威存储目录。
    logsDir运行态日志输出目录路径(<runtimeRoot>/.sfmc/logs)。 各服务的持久化落盘日志统一存放在此处。
    logFile获取指定服务的持久化日志文件路径(<runtimeRoot>/.sfmc/logs/<name>.log)。
    qqRuntimeStatusPathqq-bridge 运行态心跳文件:/.sfmc/qq.runtime.json CLI Tab/status 用它探测「外部」qq 是否仍活着(与 db /api/health 对称)。
    moduleDir模块目录路径:<ROOT>/modules。
    modulePath模块系统文件路径(catalog / module-lock)。
    readJson同步读取 JSON 文件;失败时返回 fallback 或 undefined。
    writeJson原子写 JSON:写到临时文件再 rename,避免半写状态。 自动创建父目录。
    patchJson浅合并:读出现有 JSON,与 partial 合并,原子写回。 文件不存在视为 {}。
    ensureJson确保 JSON 文件存在。 - 存在 → 不动,返回现有内容(或 fallback) - 不存在 → 写入 seed(默认 {}),返回 seed
    ensureJsonConfig仓顶 config JSON 的 ensure 便捷版:拼接 configPath + ensureJson。
    ensureSchemaConfigensure 带 $schema 的配置对象(DRY:禁止各服务手写 ensureJsonConfig+withConfigSchema)。 返回磁盘内容(可能含元数据键);运行时业务请用 loadEnsuredConfig。
    loadEnsuredConfigensure 后剥离元数据,返回可交给业务逻辑的纯配置(LSP:与无 $schema 的契约一致)。
    ensureCoreConfigs按需 ensure 平台核心配置。新种类加到 CoreConfigKind + switch 即可(OCP)。 permissions 根为数组,不能走 withConfigSchema。

    Interfaces

    InterfaceDescription
    BdsUpdaterConfigBDS 自动更新器配置(configs/bds_updater.json)。
    QqEventsConfigMC 事件推群开关(qq_config.json → qq_events)。
    QQBridgeConfigQQ 桥接配置(configs/qq_config.json)。
    DBConfigdb-server 配置(configs/db_config.json)。
    RuntimeConfig运行时根目录元数据(configs/runtime.json)。
    TokenStore模块 HMAC token 存储(.sfmc/module-tokens.json 等)。

    Type Aliases

    Type AliasDescription
    QQBackendQQ 桥接后端:官方开放平台 Bot 或 LLBot(OneBot 11)。
    PermissionsConfigpermissions.json 根为数组(与 permissions.schema.json 一致;勿写成 { permissions: [] })
    ConfigSchemaId与 @sfmc-bds/sdk/schemas/.schema.json 文件名(不含后缀)对齐
    ConfigName仓顶服务读写的所有配置 JSON 文件名。 用字面量 union 防止拼写错误并提供 IDE 补全。
    ModuleFileName模块系统文件(不在 configs/ 下,但同属"项目根 + 仓顶服务管理"的范畴)。
    QqRuntimeStatus-
    CoreConfigKind平台核心配置种子集合(扩展新文件时只改此处 + switch)

    Variables

    VariableDescription
    DEFAULT_DB_CONFIGdb-server ensure 种子(无 $schema;写入前用 withConfigSchema)
    DEFAULT_QQ_EVENTS事件推群默认(改配置需重启)
    DEFAULT_QQ_CONFIGqq-bridge / db-server 共用种子
    DEFAULT_BDS_UPDATER_CONFIGbds-tools ensure 种子
    DEFAULT_PERMISSIONSpermissions.json 根为数组;默认空表
    MONOREPO_PACKAGE_NAME主仓根 package.json 的 name;walk-up 标记,勿改名。
    DEFAULT_QQ_LINK_CONFIG平台 QQ 绑定相关配置默认值(configs/qq_link.json)。 当前由向导 / db-server 播种;原 qq-link 模块 configs-default 已收编至此。

    References

    ModuleCatalog

    Re-exports ModuleCatalog


    ModuleCatalogEntry

    Re-exports ModuleCatalogEntry


    ModuleEntryPath

    Re-exports ModuleEntryPath


    ModuleLock

    Re-exports ModuleLock


    ModuleRuntimeState

    Re-exports ModuleRuntimeState


    Catalog

    Renames and re-exports ModuleCatalog