CreateAgentFromRequest validates and persists one AGENT.md definition from a shared create-agent request. It is the single authoring path reused by the HTTP handler and the agh__agent_create native tool.
( ctx context.Context, req contract.CreateAgentRequest, homePaths aghconfig.HomePaths, workspaces WorkspaceService, transportName string, )
| 16 | // shared create-agent request. It is the single authoring path reused by the |
| 17 | // HTTP handler and the agh__agent_create native tool. |
| 18 | func CreateAgentFromRequest( |
| 19 | ctx context.Context, |
| 20 | req contract.CreateAgentRequest, |
| 21 | homePaths aghconfig.HomePaths, |
| 22 | workspaces WorkspaceService, |
| 23 | transportName string, |
| 24 | ) (aghconfig.AgentDef, error) { |
| 25 | draft, err := createAgentDraftFromRequest(req) |
| 26 | if err != nil { |
| 27 | return aghconfig.AgentDef{}, err |
| 28 | } |
| 29 | path, err := createAgentDefinitionPathFor(ctx, req, homePaths, workspaces, transportName) |
| 30 | if err != nil { |
| 31 | return aghconfig.AgentDef{}, err |
| 32 | } |
| 33 | return aghconfig.CreateAgentDefFile(path, draft, false) |
| 34 | } |
| 35 | |
| 36 | func createAgentDefinitionPathFor( |
| 37 | ctx context.Context, |
no test coverage detected