( ctx context.Context, ws Workspace, scan workspaceScan, )
| 278 | } |
| 279 | |
| 280 | func (r *Resolver) buildResolvedWorkspace( |
| 281 | ctx context.Context, |
| 282 | ws Workspace, |
| 283 | scan workspaceScan, |
| 284 | ) (ResolvedWorkspace, error) { |
| 285 | if err := checkContext(ctx); err != nil { |
| 286 | return ResolvedWorkspace{}, err |
| 287 | } |
| 288 | |
| 289 | cfg, err := r.loadConfig(ws.RootDir) |
| 290 | if err != nil { |
| 291 | return ResolvedWorkspace{}, fmt.Errorf("workspace: load config for %q: %w", ws.RootDir, err) |
| 292 | } |
| 293 | applyDefaultAgentOverride(&cfg, ws.DefaultAgent) |
| 294 | resolvedSandbox, err := resolveWorkspaceSandbox(ws, &cfg) |
| 295 | if err != nil { |
| 296 | return ResolvedWorkspace{}, fmt.Errorf("workspace: resolve sandbox for %q: %w", ws.ID, err) |
| 297 | } |
| 298 | |
| 299 | agents, agentDiagnostics, err := loadAgents(ctx, scan.agents) |
| 300 | if err != nil { |
| 301 | return ResolvedWorkspace{}, err |
| 302 | } |
| 303 | |
| 304 | skills := mergeSkillPaths(scan.skills) |
| 305 | |
| 306 | return ResolvedWorkspace{ |
| 307 | Workspace: cloneWorkspace(ws), |
| 308 | Config: cloneConfig(&cfg), |
| 309 | Agents: cloneAgentDefs(agents), |
| 310 | AgentDiagnostics: append([]AgentDiagnostic(nil), agentDiagnostics...), |
| 311 | Skills: cloneSkillPaths(skills), |
| 312 | Sandbox: cloneSandboxResolved(resolvedSandbox), |
| 313 | ResolvedAt: r.now(), |
| 314 | }, nil |
| 315 | } |
| 316 | |
| 317 | func resolveWorkspaceSandbox(ws Workspace, cfg *aghconfig.Config) (sandbox.Resolved, error) { |
| 318 | ref := strings.TrimSpace(ws.SandboxRef) |
no test coverage detected