NewFileSubagentManager 创建基于文件的子代理管理器
()
| 90 | |
| 91 | // NewFileSubagentManager 创建基于文件的子代理管理器 |
| 92 | func NewFileSubagentManager() *FileSubagentManager { |
| 93 | // 创建数据目录 |
| 94 | dataDir := filepath.Join(os.TempDir(), "agentsdk_subagents") |
| 95 | _ = os.MkdirAll(dataDir, 0755) |
| 96 | |
| 97 | sm := &FileSubagentManager{ |
| 98 | agents: make(map[string]*SubagentInstance), |
| 99 | dataDir: dataDir, |
| 100 | } |
| 101 | |
| 102 | // 加载现有子代理 |
| 103 | _ = sm.loadSubagents() |
| 104 | |
| 105 | return sm |
| 106 | } |
| 107 | |
| 108 | // StartSubagent 启动子代理 |
| 109 | func (sm *FileSubagentManager) StartSubagent(ctx context.Context, config *SubagentConfig) (*SubagentInstance, error) { |
no test coverage detected