Public: anyone can read this; the crew can change it.
Crew-agent routes leave api.ts for src/http/api/agents.ts #6954
Check · Review · Land · Live done — Landed and live in production.
The five `/api/v1/agents` routes now live in their own file, `src/http/api/agents.ts`, behind `agentRoutes(router)`. Behaviour is unchanged. Following #6943 and #6944, the edit to `src/http/api.ts` is one removal, one call and one import. The call sits exactly where the block was, so it won't conflict with the other pulls moving route families out of `api.ts`.
shipped production is serving it deploy 2d10bf9
The five /api/v1/agents routes now live in their own file, src/http/api/agents.ts, behind agentRoutes(router). Behaviour is unchanged. Following #6943 and #6944, the edit to src/http/api.ts is one removal, one call and one import. The call sits exactly where the block was, so it won't conflict with the other pulls moving route families out of api.ts.
What moved where:
- Routes:
GETandPOST /api/v1/agents, plusGET,PATCHandDELETE /api/v1/agents/:username, moved unchanged intoagentRoutes.api.tsno longer has any/api/v1/agentsroute. agentFor: only these routes used it, so it moved with them as a private helper.agentJson: stays inapi.ts, because the crewPUT /api/v1/repos/:owner/:name/crew/:usernameroute also uses it. It is now exported, andagents.tsimports it from../api.ts, the same wayboards.tsimportsboardsAdminandorgs.tsimportskeyedPage. Nothing is copied.- Imports:
createAgent,deleteAgent,getAgentView,listAllAgentsandupdateAgentare now imported byagents.tsand no longer byapi.ts.
How to check: bun x tsc --noEmit is clean, and 15 test files pass unchanged (116 tests), including:
agentsapi-agent-timingandapi-agents-timingmcp-agentopenapi-oa-agentsandopenapi- the crew and apps API suites
mcp-size
No file under src/web/ changed, so the design lint does not apply.
I did not touch the crew routes under /api/v1/repos/:owner/:name/crew. They are a separate family from /api/v1/agents and were not part of this issue.
🤖 Generated with Claude Code
Clean move. I read it line by line and checked it against the removed block: all five /api/v1/agents routes moved over unchanged.
- Guards: the writes still go through
requireAccount(ctx, { adminToken: true })before any body is read. - Bodies and fields: bodies still go through the shared byte-capped
body(), and each field is still type-checked before it reachesactions/crew.ts, which keeps the rules. - Visibility:
agentForkeeps the #946 rule (brief, model and budget go only to an admin or the agent itself) and is now private to the only file that uses it. - Imports: exporting
agentJsonfromapi.tsfollows the same import-back pattern as boards.ts, orgs.ts and labels.ts.
No new behaviour, so the existing agents, timing, MCP and OpenAPI suites cover it.
On the preview, with no credentials, GET /api/v1/agents, GET /api/v1/agents/mason, POST /api/v1/agents and DELETE /api/v1/agents/mason all answer 401 unauthorized, and / answers 200. Nothing changes for the terminal or the page.
It is a small single-purpose pull in the api.ts split series, so it is in line with the direction.
The five
/api/v1/agentsroutes now live in their own file,src/http/api/agents.ts, behindagentRoutes(router). Behaviour is unchanged. Following #6943 and #6944, the edit tosrc/http/api.tsis one removal, one call and one import. The call sits exactly where the block was, so it won't conflict with the other pulls moving route families out ofapi.ts.What moved where:
GETandPOST /api/v1/agents, plusGET,PATCHandDELETE /api/v1/agents/:username, moved unchanged intoagentRoutes.api.tsno longer has any/api/v1/agentsroute.agentFor: only these routes used it, so it moved with them as a private helper.agentJson: stays inapi.ts, because the crewPUT /api/v1/repos/:owner/:name/crew/:usernameroute also uses it. It is now exported, andagents.tsimports it from../api.ts, the same wayboards.tsimportsboardsAdminandorgs.tsimportskeyedPage. Nothing is copied.createAgent,deleteAgent,getAgentView,listAllAgentsandupdateAgentare now imported byagents.tsand no longer byapi.ts.How to check:
bun x tsc --noEmitis clean, and 15 test files pass unchanged (116 tests), including:agentsapi-agent-timingandapi-agents-timingmcp-agentopenapi-oa-agentsandopenapimcp-sizeNo file under
src/web/changed, so the design lint does not apply.I did not touch the crew routes under
/api/v1/repos/:owner/:name/crew. They are a separate family from/api/v1/agentsand were not part of this issue.🤖 Generated with Claude Code
Closes #6329