Skip to content

Commit 8f7c1ad

Browse files
committed
chore: more route updates
1 parent f1c4539 commit 8f7c1ad

4 files changed

Lines changed: 44 additions & 35 deletions

File tree

src/agentpool_server/opencode_server/ENDPOINTS.md

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# OpenCode API Compatibility Checklist
22

33
This document tracks the implementation status of OpenCode-compatible API endpoints.
4-
Last audited against OpenCode source: **2026-02-24**
4+
Last audited against OpenCode source: **2026-03-24**
55

66
## Status Legend
77
- [ ] Not implemented
@@ -20,6 +20,7 @@ Last audited against OpenCode source: **2026-02-24**
2020
| [x] | GET | `/global/config` | Get global configuration |
2121
| [x] | PATCH | `/global/config` | Update global configuration |
2222
| [x] | POST | `/global/dispose` | Dispose all instances |
23+
| [~] | POST | `/global/upgrade` | Upgrade opencode (stub - not applicable) |
2324

2425
---
2526

@@ -29,6 +30,7 @@ Last audited against OpenCode source: **2026-02-24**
2930
|--------|--------|------|-------------|
3031
| [x] | GET | `/project` | List all projects |
3132
| [x] | GET | `/project/current` | Get the current project |
33+
| [x] | POST | `/project/git/init` | Initialize git repository |
3234
| [x] | PATCH | `/project/{projectID}` | Update project (name, icon, commands) |
3335
| [x] | GET | `/path` | Get the current path |
3436
| [x] | GET | `/vcs` | Get VCS info for current project |
@@ -174,7 +176,7 @@ Last audited against OpenCode source: **2026-02-24**
174176

175177
---
176178

177-
## Worktrees (Experimental)
179+
## Worktrees & Workspaces (Experimental)
178180

179181
| Status | Method | Path | Description |
180182
|--------|--------|------|-------------|
@@ -193,12 +195,20 @@ Last audited against OpenCode source: **2026-02-24**
193195
| Status | Method | Path | Description |
194196
|--------|--------|------|-------------|
195197
| [x] | GET | `/lsp` | Get LSP server status |
196-
| [x] | POST | `/lsp/start` | Start an LSP server |
197-
| [x] | POST | `/lsp/stop` | Stop an LSP server |
198-
| [x] | GET | `/lsp/servers` | List available LSP servers |
199-
| [x] | GET | `/lsp/diagnostics` | Get LSP diagnostics (CLI-based) |
200198
| [x] | GET | `/formatter` | Get formatter status (stub) |
201199

200+
### AgentPool Extensions (commented out, not in upstream OpenCode)
201+
202+
These routes were agentpool-specific extensions. OpenCode handles diagnostics
203+
internally via tool call results, not HTTP endpoints.
204+
205+
| Status | Method | Path | Description |
206+
|--------|--------|------|-------------|
207+
| [-] | POST | `/lsp/start` | Start an LSP server (commented out) |
208+
| [-] | POST | `/lsp/stop` | Stop an LSP server (commented out) |
209+
| [-] | GET | `/lsp/servers` | List available LSP servers (commented out) |
210+
| [-] | GET | `/lsp/diagnostics` | Get LSP diagnostics (commented out) |
211+
202212
---
203213

204214
## MCP
@@ -416,3 +426,15 @@ _PARAM_NAME_MAP = {
416426
"line_hint": "lineHint",
417427
}
418428
```
429+
430+
---
431+
432+
## Notes
433+
434+
- **Diagnostics**: OpenCode does NOT expose diagnostics via HTTP routes. Diagnostics are
435+
handled internally — LSP servers push them to in-process clients, and tools (`write`,
436+
`edit`, `apply_patch`) include them in their return metadata after file operations.
437+
- **LSP extensions**: The `/lsp/start`, `/lsp/stop`, `/lsp/servers`, `/lsp/diagnostics`
438+
routes are agentpool extensions commented out in `lsp_routes.py`.
439+
- **Upgrade**: The `/global/upgrade` route is stubbed since it's not applicable to agentpool.
440+
- **Git init**: The `/project/git/init` route is stubbed — could be implemented later.

src/agentpool_server/opencode_server/routes/agent_routes.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323
Agent,
2424
AuthInfo,
2525
Command,
26-
FormatterStatus,
2726
LogRequest,
28-
LspStatus,
2927
McpAuthorizationResponse,
3028
McpResource,
3129
MCPStatus,
@@ -484,33 +482,6 @@ async def list_tools_with_schemas( # noqa: D417
484482
return result
485483

486484

487-
@router.get("/lsp")
488-
async def get_lsp_status(state: StateDep) -> list[LspStatus]:
489-
"""Get LSP server status.
490-
491-
Returns status of all running LSP servers.
492-
"""
493-
return [
494-
LspStatus(
495-
id=server_id,
496-
name=server_id,
497-
status="connected" if server_state.initialized else "error",
498-
root=server_state.root_uri or "",
499-
)
500-
for server_id, server_state in state.lsp_manager._servers.items()
501-
]
502-
503-
504-
@router.get("/formatter")
505-
async def get_formatter_status(state: StateDep) -> list[FormatterStatus]:
506-
"""Get formatter status.
507-
508-
Returns empty list - formatters not supported yet.
509-
"""
510-
_ = state
511-
return []
512-
513-
514485
@router.get("/provider/auth")
515486
async def get_provider_auth(state: StateDep) -> dict[str, list[ProviderAuthMethod]]:
516487
"""Get provider authentication methods.

src/agentpool_server/opencode_server/routes/app_routes.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ async def get_project_current(state: StateDep) -> Project:
8282
return _project_data_to_response(project)
8383

8484

85+
@router.post("/project/git/init")
86+
async def init_git(state: StateDep) -> Project:
87+
"""Initialize git repository for current project."""
88+
cwd = state.agent.env.cwd or state.working_dir
89+
await state.agent.env.execute_command(f"git init {cwd}")
90+
project = await _get_current_project(state)
91+
return _project_data_to_response(project)
92+
93+
8594
@router.patch("/project/{project_id}")
8695
async def update_project(project_id: str, update: ProjectUpdateRequest, state: StateDep) -> Project:
8796
"""Update project metadata (name, settings).

src/agentpool_server/opencode_server/routes/global_routes.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,13 @@ async def global_dispose(state: StateDep) -> bool:
114114
return True
115115

116116

117+
@router.post("/global/upgrade")
118+
async def global_upgrade(state: StateDep) -> dict[str, object]:
119+
"""Upgrade opencode (stub - not applicable for agentpool)."""
120+
_ = state
121+
return {"success": False, "error": "Upgrade not supported in agentpool"}
122+
123+
117124
@router.post("/instance/dispose")
118125
async def instance_dispose(state: StateDep) -> bool:
119126
"""Dispose the current instance."""

0 commit comments

Comments
 (0)