/** * Agent 配置管理器 * * 职责: * 1. 启动时扫描 project + user 两层 agents 目录,读取 .json * 2. 提供 CRUD(list / get / create / update / delete / enable / disable) * 3. 通过 chokidar 监听两层目录的变更,去抖 200ms 后增量重载并 emit resource:changed * 4. 导出为 OpenCode 兼容格式(用于同步到 opencode 配置) * * 覆盖语义:项目级与用户级同名时,项目级 wins;两个版本都保留在 records 中。 */ import type { ResourceScope } from '../types.js'; import type { AgentConfig, AgentInput, AgentSummary } from './types.js'; export type { AgentSummary }; /** * Agent Registry 类 */ export declare class AgentRegistry { private state; private reloadTimeout?; /** * 初始化:扫描两层目录 + 启动 watcher */ init(): Promise; /** * 释放 watcher */ dispose(): Promise; /** * 调度延迟重载(去抖) */ private scheduleReload; /** * 全量重载 */ private reload; /** * 列出所有 agent(合并两层,项目级 shadow 用户级) * 返回所有条目(包括被遮蔽的用户层条目),便于 UI 展示完整状态 */ list(): AgentSummary[]; /** * 获取单个 agent 完整配置(winning 或指定 scope) */ get(name: string, scope?: ResourceScope): AgentConfig | null; /** * 创建新 agent */ create(name: string, input: AgentInput, scope?: ResourceScope): Promise; /** * 更新 agent */ update(name: string, input: Partial, scope?: ResourceScope): Promise; /** * 删除 agent */ delete(name: string, scope?: ResourceScope): Promise; /** * 启用/禁用 agent */ toggle(name: string, enabled: boolean, scope?: ResourceScope): Promise; /** * 导出为 OpenCode 兼容格式(用于同步到 opencode 配置) * 返回 Record */ exportForOpenCode(): Record; }>; } /** * 获取全局 Agent registry 单例 */ export declare function getAgentRegistry(): AgentRegistry; //# sourceMappingURL=manager.d.ts.map