Skip to content

Commit 53eb065

Browse files
authored
feat: add Coder Agents client detection (#212)
1 parent 4fd7ded commit 53eb065

4 files changed

Lines changed: 30 additions & 10 deletions

File tree

client.go

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@ type Client string
1010
const (
1111
// Possible values for the "client" field in interception records.
1212
// Must be kept in sync with documentation: https://github.com/coder/coder/blob/90c11f3386578da053ec5cd9f1475835b980e7c7/docs/ai-coder/ai-bridge/monitoring.md?plain=1#L36-L44
13-
ClientClaudeCode Client = "Claude Code"
14-
ClientCodex Client = "Codex"
15-
ClientZed Client = "Zed"
16-
ClientCopilotVSC Client = "GitHub Copilot (VS Code)"
17-
ClientCopilotCLI Client = "GitHub Copilot (CLI)"
18-
ClientKilo Client = "Kilo Code"
19-
ClientMux Client = "Mux"
20-
ClientRoo Client = "Roo Code"
21-
ClientCursor Client = "Cursor"
22-
ClientUnknown Client = "Unknown"
13+
ClientClaudeCode Client = "Claude Code"
14+
ClientCodex Client = "Codex"
15+
ClientZed Client = "Zed"
16+
ClientCopilotVSC Client = "GitHub Copilot (VS Code)"
17+
ClientCopilotCLI Client = "GitHub Copilot (CLI)"
18+
ClientKilo Client = "Kilo Code"
19+
ClientCoderAgents Client = "Coder Agents"
20+
ClientMux Client = "Mux"
21+
ClientRoo Client = "Roo Code"
22+
ClientCursor Client = "Cursor"
23+
ClientUnknown Client = "Unknown"
2324
)
2425

2526
// guessClient attempts to guess the client application from the request headers.
@@ -47,6 +48,8 @@ func guessClient(r *http.Request) Client {
4748
return ClientKilo
4849
case strings.HasPrefix(userAgent, "roo-code/") || originator == "roo-code":
4950
return ClientRoo
51+
case strings.HasPrefix(userAgent, "coder-agents/"):
52+
return ClientCoderAgents
5053
case r.Header.Get("x-cursor-client-version") != "":
5154
return ClientCursor
5255
}

client_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ func TestGuessClient(t *testing.T) {
6666
headers: map[string]string{"Originator": "roo-code"},
6767
wantClient: ClientRoo,
6868
},
69+
{
70+
name: "coder_agents",
71+
userAgent: "coder-agents/v2.24.0 (linux/amd64)",
72+
wantClient: ClientCoderAgents,
73+
},
74+
{
75+
name: "coder_agents_dev",
76+
userAgent: "coder-agents/v0.0.0-devel (darwin/arm64)",
77+
wantClient: ClientCoderAgents,
78+
},
6979
{
7080
name: "cursor_x_cursor_client_version",
7181
userAgent: "connect-es/1.6.1",

session.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ func guessSessionID(client Client, r *http.Request) *string {
6565
return cleanRef(r.Header.Get("X-Client-Session-Id"))
6666
case ClientKilo:
6767
return cleanRef(r.Header.Get("X-KILOCODE-TASKID"))
68+
case ClientCoderAgents:
69+
return nil // Session ID support planned in a follow-up.
6870
case ClientRoo:
6971
return nil // RooCode doesn't send a session ID.
7072
case ClientCursor:

session_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ func TestGuessSessionID(t *testing.T) {
125125
name: "kilo_without_task_id",
126126
client: ClientKilo,
127127
},
128+
// Coder Agents.
129+
{
130+
name: "coder_agents_returns_empty",
131+
client: ClientCoderAgents,
132+
},
128133
// Roo.
129134
{
130135
name: "roo_returns_empty",

0 commit comments

Comments
 (0)