agentdev-webui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/agent-api.js +530 -0
- package/lib/auth.js +127 -0
- package/lib/config.js +53 -0
- package/lib/database.js +762 -0
- package/lib/device-flow.js +257 -0
- package/lib/email.js +420 -0
- package/lib/encryption.js +112 -0
- package/lib/github.js +339 -0
- package/lib/history.js +143 -0
- package/lib/pwa.js +107 -0
- package/lib/redis-logs.js +226 -0
- package/lib/routes.js +680 -0
- package/migrations/000_create_database.sql +33 -0
- package/migrations/001_create_agentdev_schema.sql +135 -0
- package/migrations/001_create_agentdev_schema.sql.old +100 -0
- package/migrations/001_create_agentdev_schema_fixed.sql +135 -0
- package/migrations/002_add_github_token.sql +17 -0
- package/migrations/003_add_agent_logs_table.sql +23 -0
- package/migrations/004_remove_oauth_columns.sql +11 -0
- package/migrations/005_add_projects.sql +44 -0
- package/migrations/006_project_github_token.sql +7 -0
- package/migrations/007_project_repositories.sql +12 -0
- package/migrations/008_add_notifications.sql +20 -0
- package/migrations/009_unified_oauth.sql +153 -0
- package/migrations/README.md +97 -0
- package/package.json +37 -0
- package/public/css/styles.css +1140 -0
- package/public/device.html +384 -0
- package/public/docs.html +862 -0
- package/public/docs.md +697 -0
- package/public/favicon.svg +5 -0
- package/public/index.html +271 -0
- package/public/js/app.js +2379 -0
- package/public/login.html +224 -0
- package/public/profile.html +394 -0
- package/public/register.html +392 -0
- package/public/reset-password.html +349 -0
- package/public/verify-email.html +177 -0
- package/server.js +1450 -0
package/public/docs.md
ADDED
|
@@ -0,0 +1,697 @@
|
|
|
1
|
+
# AgentDev Client
|
|
2
|
+
|
|
3
|
+
Distributed agent system for automated GitHub ticket processing with Claude CLI.
|
|
4
|
+
|
|
5
|
+
AgentDev is a distributed agent management platform that connects local machines running Claude CLI to a central server. Agents automatically pick up GitHub tickets tagged with `@claude`, execute the work, and stream logs back to the web dashboard in real-time.
|
|
6
|
+
|
|
7
|
+
- Run automated agents on any machine with Claude CLI installed
|
|
8
|
+
- Agents poll the server for available tickets and execute them autonomously
|
|
9
|
+
- Real-time log streaming to the web dashboard via SSE
|
|
10
|
+
- GitHub project board integration for ticket status tracking
|
|
11
|
+
- Multi-project support with per-agent project assignment
|
|
12
|
+
- Device flow authentication for secure agent registration
|
|
13
|
+
|
|
14
|
+
## Architecture
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
┌──────────────────────────────────┐
|
|
18
|
+
│ Agent Machine (your laptop/VM) │
|
|
19
|
+
│ │
|
|
20
|
+
│ $ agentdev start │
|
|
21
|
+
│ ├── Polls for tickets (10s) │
|
|
22
|
+
│ ├── Runs Claude CLI │
|
|
23
|
+
│ └── Streams logs back │
|
|
24
|
+
│ │
|
|
25
|
+
│ ~/agentdev-workspace/ │
|
|
26
|
+
│ ├── repo-a/ │
|
|
27
|
+
│ ├── repo-b/ │
|
|
28
|
+
│ └── repo-c/ │
|
|
29
|
+
└──────────────┬───────────────────┘
|
|
30
|
+
│ HTTPS (Bearer JWT)
|
|
31
|
+
▼
|
|
32
|
+
┌──────────────────────────────────┐
|
|
33
|
+
│ AgentDev Server │
|
|
34
|
+
│ agentdev.datatamer.ai │
|
|
35
|
+
│ │
|
|
36
|
+
│ ├── Assign tickets to agents │
|
|
37
|
+
│ ├── Store OAuth tokens (enc) │
|
|
38
|
+
│ ├── Aggregate & broadcast logs │
|
|
39
|
+
│ └── GitHub project board sync │
|
|
40
|
+
└──────────────┬───────────────────┘
|
|
41
|
+
│
|
|
42
|
+
▼
|
|
43
|
+
┌──────────────────────────────────┐
|
|
44
|
+
│ GitHub │
|
|
45
|
+
│ ├── Issues (tickets) │
|
|
46
|
+
│ ├── Project Board (statuses) │
|
|
47
|
+
│ └── Repositories (code) │
|
|
48
|
+
└──────────────────────────────────┘
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
### Prerequisites
|
|
54
|
+
|
|
55
|
+
| Requirement | Version | Check |
|
|
56
|
+
|-------------|---------|-------|
|
|
57
|
+
| Node.js | 18+ | `node --version` |
|
|
58
|
+
| Claude CLI | latest | `claude --version` |
|
|
59
|
+
| Git | any | `git --version` |
|
|
60
|
+
|
|
61
|
+
### Install via npm
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npm install -g @datatamer/agentdev
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Verify Installation
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
agentdev --version
|
|
71
|
+
# 1.0.0
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
> **Note:** The GitHub CLI (`gh`) is optional. AgentDev includes its own GitHub API integration via `agentdev gh`.
|
|
75
|
+
|
|
76
|
+
## Quick Start
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# 1. Register your agent with the server
|
|
80
|
+
agentdev register
|
|
81
|
+
|
|
82
|
+
# 2. Approve the device code in your browser
|
|
83
|
+
# Visit the URL shown and enter the code
|
|
84
|
+
|
|
85
|
+
# 3. Start processing tickets
|
|
86
|
+
agentdev start
|
|
87
|
+
|
|
88
|
+
# 4. Check status
|
|
89
|
+
agentdev status
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
That's it. Your agent will poll for tickets, execute them with Claude CLI, and stream logs to the dashboard.
|
|
93
|
+
|
|
94
|
+
## Agent Registration
|
|
95
|
+
|
|
96
|
+
Each agent must be registered with the server before it can claim work. Registration uses the OAuth 2.0 Device Authorization Grant flow.
|
|
97
|
+
|
|
98
|
+
### Step 1: Run Register
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
agentdev register
|
|
102
|
+
# or with options:
|
|
103
|
+
agentdev register --url https://agentdev.datatamer.ai --name my-agent
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
| Option | Default | Description |
|
|
107
|
+
|--------|---------|-------------|
|
|
108
|
+
| `-u, --url` | `https://agentdev.datatamer.ai` | Server URL |
|
|
109
|
+
| `-n, --name` | System hostname | Agent display name |
|
|
110
|
+
|
|
111
|
+
### Step 2: Approve in Browser
|
|
112
|
+
|
|
113
|
+
The terminal will display a user code and verification URL:
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
✓ Device code obtained
|
|
117
|
+
Code: ABCD-EFGH
|
|
118
|
+
Visit: https://agentdev.datatamer.ai/device
|
|
119
|
+
Waiting for approval...
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
1. Open the verification URL in your browser
|
|
123
|
+
2. Log in to AgentDev if not already signed in
|
|
124
|
+
3. Enter the user code displayed in your terminal
|
|
125
|
+
4. Select the project to assign the agent to
|
|
126
|
+
5. Click "Approve Agent"
|
|
127
|
+
|
|
128
|
+
### Step 3: Confirmation
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
✓ Agent registered successfully!
|
|
132
|
+
Agent ID: agent-1704067200-abc123
|
|
133
|
+
Project: DataTamer (#1)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Your agent token and project configuration are saved to `~/.config/agentdev/config.json`.
|
|
137
|
+
|
|
138
|
+
## Device Flow Authentication
|
|
139
|
+
|
|
140
|
+
AgentDev uses the OAuth 2.0 Device Authorization Grant (RFC 8628) for agent authentication. This is ideal for headless servers and CLI tools that can't open a browser.
|
|
141
|
+
|
|
142
|
+
### How It Works
|
|
143
|
+
|
|
144
|
+
1. Agent requests a device code from the server
|
|
145
|
+
2. Server returns a short user code (e.g., `ABCD-EFGH`) and verification URL
|
|
146
|
+
3. User visits the URL in a browser and enters the code
|
|
147
|
+
4. User approves and selects a project for the agent
|
|
148
|
+
5. Agent polls the server until the code is approved (every 5 seconds)
|
|
149
|
+
6. Server returns a JWT token valid for 90 days
|
|
150
|
+
|
|
151
|
+
### JWT Token
|
|
152
|
+
|
|
153
|
+
| Field | Description |
|
|
154
|
+
|-------|-------------|
|
|
155
|
+
| `agent_id` | Unique agent identifier |
|
|
156
|
+
| `user_id` | ID of the user who approved the agent |
|
|
157
|
+
| `project_id` | Assigned project ID |
|
|
158
|
+
| `type` | Always `"agent"` |
|
|
159
|
+
| `exp` | Expires in 90 days |
|
|
160
|
+
|
|
161
|
+
## Configuration
|
|
162
|
+
|
|
163
|
+
Configuration is stored at `~/.config/agentdev/config.json` and managed via the `agentdev config` command or set automatically during registration.
|
|
164
|
+
|
|
165
|
+
### Config File
|
|
166
|
+
|
|
167
|
+
```json
|
|
168
|
+
{
|
|
169
|
+
"api_url": "https://agentdev.datatamer.ai",
|
|
170
|
+
"agent_token": "eyJhbGciOi...",
|
|
171
|
+
"agent_id": "agent-1704067200-abc123",
|
|
172
|
+
"agent_name": "my-laptop",
|
|
173
|
+
"max_concurrent": 1,
|
|
174
|
+
"github_org": "data-tamer",
|
|
175
|
+
"project_id": "PVT_kwDOCJIWbs4AnuSZ",
|
|
176
|
+
"project_number": 1,
|
|
177
|
+
"status_field_id": "PVTSSF_lADOCJIWbs4AnuSZzgfaWGs",
|
|
178
|
+
"status_options": {
|
|
179
|
+
"TODO": "f75ad846",
|
|
180
|
+
"IN_PROGRESS": "47fc9ee4",
|
|
181
|
+
"TEST": "c48bc058",
|
|
182
|
+
"DONE": "98236657"
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Managing Config
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
# View all settings
|
|
191
|
+
agentdev config get
|
|
192
|
+
|
|
193
|
+
# View a specific key
|
|
194
|
+
agentdev config get api_url
|
|
195
|
+
|
|
196
|
+
# Update a setting
|
|
197
|
+
agentdev config set api_url https://agentdev.datatamer.ai
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## CLI Commands
|
|
201
|
+
|
|
202
|
+
### agentdev register
|
|
203
|
+
|
|
204
|
+
Register this agent with the AgentDev server using device flow authentication.
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
agentdev register [--url <url>] [--name <name>]
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
| Option | Default | Description |
|
|
211
|
+
|--------|---------|-------------|
|
|
212
|
+
| `-u, --url` | `https://agentdev.datatamer.ai` | Server URL |
|
|
213
|
+
| `-n, --name` | hostname | Agent name |
|
|
214
|
+
|
|
215
|
+
### agentdev start
|
|
216
|
+
|
|
217
|
+
Start the agent in daemon mode. Continuously polls for work and executes tickets.
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
agentdev start [--concurrent <number>]
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
| Option | Default | Description |
|
|
224
|
+
|--------|---------|-------------|
|
|
225
|
+
| `-c, --concurrent` | `1` | Max concurrent tickets |
|
|
226
|
+
|
|
227
|
+
Behavior:
|
|
228
|
+
|
|
229
|
+
- Polls for work every **10 seconds**
|
|
230
|
+
- Sends heartbeat every **30 seconds**
|
|
231
|
+
- Syncs Claude skills to `~/.claude/commands/`
|
|
232
|
+
- Fetches GitHub OAuth tokens from server
|
|
233
|
+
- 30-second backoff on errors
|
|
234
|
+
- Graceful shutdown on SIGINT/SIGTERM
|
|
235
|
+
|
|
236
|
+
### agentdev cron
|
|
237
|
+
|
|
238
|
+
Run in batch/cron mode. Processes all available tickets in cycles with a configurable interval.
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
agentdev cron [--interval <minutes>] [--max-tickets <number>]
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
| Option | Default | Description |
|
|
245
|
+
|--------|---------|-------------|
|
|
246
|
+
| `-i, --interval` | `5` | Minutes between cycles |
|
|
247
|
+
| `-m, --max-tickets` | `10` | Max tickets per cycle |
|
|
248
|
+
|
|
249
|
+
Ideal for CI/CD pipelines or scheduled batch processing.
|
|
250
|
+
|
|
251
|
+
### agentdev status
|
|
252
|
+
|
|
253
|
+
Display the agent's registration status and configuration.
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
agentdev status
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Shows: agent ID, name, API URL, registration status, config file location.
|
|
260
|
+
|
|
261
|
+
### agentdev config
|
|
262
|
+
|
|
263
|
+
View and modify configuration values.
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
# View all config
|
|
267
|
+
agentdev config get
|
|
268
|
+
|
|
269
|
+
# View single key
|
|
270
|
+
agentdev config get api_url
|
|
271
|
+
|
|
272
|
+
# Set a value
|
|
273
|
+
agentdev config set max_concurrent 2
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### agentdev ticket
|
|
277
|
+
|
|
278
|
+
Create and manage tickets from the command line.
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
# Create a ticket
|
|
282
|
+
agentdev ticket create -R my-repo \
|
|
283
|
+
--title "Fix login bug" \
|
|
284
|
+
--body "The login form crashes on submit" \
|
|
285
|
+
--claude
|
|
286
|
+
|
|
287
|
+
# Output (JSON)
|
|
288
|
+
agentdev ticket create -R my-repo --title "..." --json
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
| Option | Description |
|
|
292
|
+
|--------|-------------|
|
|
293
|
+
| `-R <repo>` | Repository name (under the org) |
|
|
294
|
+
| `--title` | Issue title |
|
|
295
|
+
| `--body` | Issue body text |
|
|
296
|
+
| `--body-file` | Read body from file |
|
|
297
|
+
| `--claude / --no-claude` | Append `@claude` tag (default: true) |
|
|
298
|
+
| `--json` | Output as JSON |
|
|
299
|
+
|
|
300
|
+
Creates the GitHub issue, adds it to the project board, and sets status to "Todo".
|
|
301
|
+
|
|
302
|
+
### agentdev gh
|
|
303
|
+
|
|
304
|
+
GitHub CLI replacement with pre-configured authentication. Uses the agent's OAuth token.
|
|
305
|
+
|
|
306
|
+
#### Issues
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
# View an issue
|
|
310
|
+
agentdev gh issue view 42 -R owner/repo
|
|
311
|
+
|
|
312
|
+
# Create an issue
|
|
313
|
+
agentdev gh issue create -R owner/repo --title "Bug" --body "Details"
|
|
314
|
+
|
|
315
|
+
# Comment on an issue
|
|
316
|
+
agentdev gh issue comment 42 -R owner/repo --body "Fixed in PR #43"
|
|
317
|
+
|
|
318
|
+
# Reopen an issue
|
|
319
|
+
agentdev gh issue reopen 42 -R owner/repo
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
#### Pull Requests
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
# Create a PR
|
|
326
|
+
agentdev gh pr create -R owner/repo \
|
|
327
|
+
--title "Fix bug" --body "Description" \
|
|
328
|
+
--head feature-branch --base main
|
|
329
|
+
|
|
330
|
+
# View a PR
|
|
331
|
+
agentdev gh pr view 43 -R owner/repo --json state,title
|
|
332
|
+
|
|
333
|
+
# Merge a PR
|
|
334
|
+
agentdev gh pr merge 43 -R owner/repo --squash
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
#### Project Board
|
|
338
|
+
|
|
339
|
+
```bash
|
|
340
|
+
# Update project item status
|
|
341
|
+
agentdev gh project item-edit \
|
|
342
|
+
--id ITEM_ID \
|
|
343
|
+
--project-id PROJECT_ID \
|
|
344
|
+
--field-id FIELD_ID \
|
|
345
|
+
--single-select-option-id OPTION_ID
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
#### Raw API
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
# GraphQL
|
|
352
|
+
agentdev gh api graphql -f query='{ viewer { login } }'
|
|
353
|
+
|
|
354
|
+
# REST
|
|
355
|
+
agentdev gh api rest /repos/owner/repo/issues -X GET
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
### agentdev openspec
|
|
359
|
+
|
|
360
|
+
Spec-driven development commands. Wraps the `@fission-ai/openspec` CLI.
|
|
361
|
+
|
|
362
|
+
```bash
|
|
363
|
+
# Initialize openspec in a repo
|
|
364
|
+
agentdev openspec init
|
|
365
|
+
|
|
366
|
+
# List artifacts
|
|
367
|
+
agentdev openspec list --specs --sort recent
|
|
368
|
+
|
|
369
|
+
# Show artifact details
|
|
370
|
+
agentdev openspec show my-feature --json
|
|
371
|
+
|
|
372
|
+
# Validate artifacts
|
|
373
|
+
agentdev openspec validate --all --strict
|
|
374
|
+
|
|
375
|
+
# Get implementation instructions
|
|
376
|
+
agentdev openspec instructions my-artifact --change feature-x
|
|
377
|
+
|
|
378
|
+
# Archive a completed change
|
|
379
|
+
agentdev openspec archive my-change --yes
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### agentdev onboard
|
|
383
|
+
|
|
384
|
+
Interactive repository discovery and environment skill generation.
|
|
385
|
+
|
|
386
|
+
```bash
|
|
387
|
+
agentdev onboard [--workspace <path>] [--no-claude] [--force]
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
| Option | Default | Description |
|
|
391
|
+
|--------|---------|-------------|
|
|
392
|
+
| `-w, --workspace` | current dir | Workspace root to scan |
|
|
393
|
+
| `--no-claude` | false | Use templates instead of Claude generation |
|
|
394
|
+
| `--force` | false | Overwrite existing skills |
|
|
395
|
+
|
|
396
|
+
The onboard command:
|
|
397
|
+
|
|
398
|
+
1. Scans the workspace for git repositories
|
|
399
|
+
2. Detects language, framework, databases, test runner, Docker setup
|
|
400
|
+
3. Prompts you to select repos to onboard
|
|
401
|
+
4. Asks for environment details (deploy method, test commands, DB connections)
|
|
402
|
+
5. Generates Claude skill files at `.claude/commands/env-<name>.md`
|
|
403
|
+
6. Saves structured metadata to `.claude/repo-spec.json`
|
|
404
|
+
|
|
405
|
+
#### Detected Technologies
|
|
406
|
+
|
|
407
|
+
| Category | Detected |
|
|
408
|
+
|----------|----------|
|
|
409
|
+
| Languages | JavaScript, TypeScript, Python |
|
|
410
|
+
| Frameworks | Next.js, Express, Fastify, FastAPI, Django, Flask |
|
|
411
|
+
| Databases | PostgreSQL, MySQL, MongoDB, Redis, SQLite |
|
|
412
|
+
| ORMs | Prisma, SQLAlchemy, Mongoose |
|
|
413
|
+
| Test Runners | Jest, Vitest, Mocha, pytest, Playwright |
|
|
414
|
+
| Package Managers | npm, yarn, pnpm, pip, poetry, uv |
|
|
415
|
+
|
|
416
|
+
## How Agents Work
|
|
417
|
+
|
|
418
|
+
```
|
|
419
|
+
Agent starts: agentdev start
|
|
420
|
+
│
|
|
421
|
+
├── Sync Claude skills to ~/.claude/commands/
|
|
422
|
+
├── Fetch OAuth tokens (GitHub) from server
|
|
423
|
+
├── Start heartbeat (every 30s)
|
|
424
|
+
│
|
|
425
|
+
▼
|
|
426
|
+
┌─── Poll Loop (every 10s) ──────────────────────────┐
|
|
427
|
+
│ │
|
|
428
|
+
│ GET /api/agent/work │
|
|
429
|
+
│ ├── No ticket → print "." → wait 10s → loop │
|
|
430
|
+
│ └── Ticket found ↓ │
|
|
431
|
+
│ │
|
|
432
|
+
│ Execute Ticket │
|
|
433
|
+
│ ├── Set GH_TOKEN in env │
|
|
434
|
+
│ ├── Spawn: claude -p --dangerously-skip-perms │
|
|
435
|
+
│ │ /auto-ticket-workflow │
|
|
436
|
+
│ ├── Stream logs → POST /api/agent/logs (2s batch) │
|
|
437
|
+
│ ├── Check stop signal (every 5s) │
|
|
438
|
+
│ └── On exit → POST /api/agent/complete │
|
|
439
|
+
│ │
|
|
440
|
+
│ Loop back ↑ │
|
|
441
|
+
└──────────────────────────────────────────────────────┘
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
### Heartbeat
|
|
445
|
+
|
|
446
|
+
Every **30 seconds**, the agent sends a heartbeat to keep its status updated on the server.
|
|
447
|
+
|
|
448
|
+
```
|
|
449
|
+
POST /api/agent/heartbeat
|
|
450
|
+
Authorization: Bearer <token>
|
|
451
|
+
|
|
452
|
+
{
|
|
453
|
+
"status": "idle", // or "busy"
|
|
454
|
+
"current_ticket": null // or ticket ID
|
|
455
|
+
}
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
If the server doesn't receive a heartbeat for an extended period, the agent is considered offline.
|
|
459
|
+
|
|
460
|
+
### Ticket Execution
|
|
461
|
+
|
|
462
|
+
When an agent claims a ticket, it:
|
|
463
|
+
|
|
464
|
+
1. Sets `GH_TOKEN` environment variable from the server's OAuth tokens
|
|
465
|
+
2. Creates a temp file for Claude output (avoids pipe buffering)
|
|
466
|
+
3. Spawns Claude CLI:
|
|
467
|
+
```bash
|
|
468
|
+
claude -p --dangerously-skip-permissions \
|
|
469
|
+
--output-format stream-json --verbose
|
|
470
|
+
```
|
|
471
|
+
4. Sends the `/auto-ticket-workflow` skill as the prompt
|
|
472
|
+
5. Tails the output file and parses stream-json in real-time
|
|
473
|
+
6. Batches parsed logs to the server every 2 seconds
|
|
474
|
+
7. Polls `/api/agent/should-stop` every 5 seconds (kills process if requested)
|
|
475
|
+
8. On process exit, reports completion via `/api/agent/complete`
|
|
476
|
+
|
|
477
|
+
### Log Streaming
|
|
478
|
+
|
|
479
|
+
Logs are batched and uploaded to the server in real-time:
|
|
480
|
+
|
|
481
|
+
- **Batch interval:** every 2 seconds
|
|
482
|
+
- **Batch size:** up to 10 log entries
|
|
483
|
+
- **Parsed content:** text output, tool calls, tool results, cost info
|
|
484
|
+
|
|
485
|
+
The server stores logs in PostgreSQL and broadcasts them to the web dashboard via SSE (Server-Sent Events).
|
|
486
|
+
|
|
487
|
+
## API Reference
|
|
488
|
+
|
|
489
|
+
### Device Flow Endpoints
|
|
490
|
+
|
|
491
|
+
#### POST /api/agent/device/code
|
|
492
|
+
|
|
493
|
+
Request a new device code for agent registration.
|
|
494
|
+
|
|
495
|
+
```json
|
|
496
|
+
// Request
|
|
497
|
+
{
|
|
498
|
+
"agent_name": "my-agent",
|
|
499
|
+
"capabilities": {
|
|
500
|
+
"cpu_cores": 8,
|
|
501
|
+
"memory_gb": 16,
|
|
502
|
+
"platform": "linux",
|
|
503
|
+
"arch": "x64",
|
|
504
|
+
"tools": ["git", "node", "claude"]
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
// Response (200)
|
|
509
|
+
{
|
|
510
|
+
"device_code": "a1b2c3d4...",
|
|
511
|
+
"user_code": "ABCD-EFGH",
|
|
512
|
+
"verification_uri": "https://agentdev.datatamer.ai/device",
|
|
513
|
+
"expires_in": 600,
|
|
514
|
+
"interval": 5
|
|
515
|
+
}
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
#### POST /api/agent/device/token
|
|
519
|
+
|
|
520
|
+
Poll for token after user approves the device code.
|
|
521
|
+
|
|
522
|
+
```json
|
|
523
|
+
// Request
|
|
524
|
+
{ "device_code": "a1b2c3d4..." }
|
|
525
|
+
|
|
526
|
+
// Response (200 - approved)
|
|
527
|
+
{
|
|
528
|
+
"access_token": "eyJhbGciOi...",
|
|
529
|
+
"token_type": "Bearer",
|
|
530
|
+
"expires_in": 7776000,
|
|
531
|
+
"agent_id": "agent-1704067200-abc123",
|
|
532
|
+
"project_id": 1
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
// Response (428 - still pending)
|
|
536
|
+
{ "error": "authorization_pending" }
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
### Agent API Endpoints
|
|
540
|
+
|
|
541
|
+
All endpoints require `Authorization: Bearer <token>`.
|
|
542
|
+
|
|
543
|
+
| Method | Endpoint | Description |
|
|
544
|
+
|--------|----------|-------------|
|
|
545
|
+
| POST | `/api/agent/heartbeat` | Send agent heartbeat with status |
|
|
546
|
+
| GET | `/api/agent/work` | Claim the next available ticket |
|
|
547
|
+
| GET | `/api/agent/oauth` | Get GitHub OAuth token |
|
|
548
|
+
| POST | `/api/agent/logs` | Upload log entries |
|
|
549
|
+
| POST | `/api/agent/complete` | Mark ticket as complete/failed |
|
|
550
|
+
| GET | `/api/agent/should-stop` | Check for stop signal |
|
|
551
|
+
| GET | `/api/agent/project-config` | Get project board configuration |
|
|
552
|
+
|
|
553
|
+
#### GET /api/agent/work
|
|
554
|
+
|
|
555
|
+
Claims the next available ticket for the agent's assigned project.
|
|
556
|
+
|
|
557
|
+
```json
|
|
558
|
+
// Response (ticket available)
|
|
559
|
+
{
|
|
560
|
+
"ticket": {
|
|
561
|
+
"id": "ticket-uuid",
|
|
562
|
+
"github_issue_number": 42,
|
|
563
|
+
"github_repo": "agentdev-webui",
|
|
564
|
+
"title": "Implement dark mode",
|
|
565
|
+
"description": "Add dark theme support"
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
// Response (no tickets)
|
|
570
|
+
{ "ticket": null }
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
#### POST /api/agent/logs
|
|
574
|
+
|
|
575
|
+
Upload log entries. Batched by the client.
|
|
576
|
+
|
|
577
|
+
```json
|
|
578
|
+
// Request
|
|
579
|
+
{
|
|
580
|
+
"logs": ["Log line 1", "Log line 2"],
|
|
581
|
+
"ticket_id": "ticket-uuid"
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
// Response
|
|
585
|
+
{ "success": true, "count": 2 }
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
#### POST /api/agent/complete
|
|
589
|
+
|
|
590
|
+
Report ticket completion or failure.
|
|
591
|
+
|
|
592
|
+
```json
|
|
593
|
+
// Request
|
|
594
|
+
{
|
|
595
|
+
"ticket_id": "ticket-uuid",
|
|
596
|
+
"success": true,
|
|
597
|
+
"error_message": null
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
// Response
|
|
601
|
+
{ "success": true }
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
#### GET /api/agent/should-stop?ticket_id=ID
|
|
605
|
+
|
|
606
|
+
Check if the user has requested to stop this ticket's execution.
|
|
607
|
+
|
|
608
|
+
```json
|
|
609
|
+
// Response
|
|
610
|
+
{ "should_stop": false }
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
### GitHub Integration
|
|
614
|
+
|
|
615
|
+
The client includes a built-in GitHub API module (`agentdev gh`) that supports:
|
|
616
|
+
|
|
617
|
+
- **REST API** — Issues, PRs, file uploads, generic REST calls
|
|
618
|
+
- **GraphQL API** — Project board operations, custom queries
|
|
619
|
+
- **Token resolution** — CLI arg → `GH_TOKEN` env → server OAuth
|
|
620
|
+
|
|
621
|
+
This eliminates the dependency on the `gh` CLI while providing full GitHub API access.
|
|
622
|
+
|
|
623
|
+
## Workspace Setup
|
|
624
|
+
|
|
625
|
+
### Default Workspace
|
|
626
|
+
|
|
627
|
+
When you run `agentdev start`, the agent uses `~/agentdev-workspace/` by default.
|
|
628
|
+
|
|
629
|
+
### Custom Workspace
|
|
630
|
+
|
|
631
|
+
```bash
|
|
632
|
+
# Set for current session
|
|
633
|
+
export AGENTDEV_WORKSPACE=/path/to/your/repos
|
|
634
|
+
agentdev start
|
|
635
|
+
|
|
636
|
+
# Set permanently
|
|
637
|
+
echo 'export AGENTDEV_WORKSPACE=/path/to/repos' >> ~/.bashrc
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
> **Tip:** Using a custom workspace lets agents work with your existing cloned repos, avoiding redundant clones.
|
|
641
|
+
|
|
642
|
+
## Claude Skills
|
|
643
|
+
|
|
644
|
+
On startup, the agent syncs skill files from the package to `~/.claude/commands/`:
|
|
645
|
+
|
|
646
|
+
| Skill File | Purpose |
|
|
647
|
+
|------------|---------|
|
|
648
|
+
| `agentdev-gh.md` | GitHub CLI command reference for Claude |
|
|
649
|
+
| `agentdev-openspec.md` | OpenSpec workflow reference for Claude |
|
|
650
|
+
| `auto-ticket.md` | Full ticket workflow (proposal → implement → test → deploy) |
|
|
651
|
+
|
|
652
|
+
These skills are used as prompts when Claude executes tickets.
|
|
653
|
+
|
|
654
|
+
## Environment Variables
|
|
655
|
+
|
|
656
|
+
| Variable | Description | Default |
|
|
657
|
+
|----------|-------------|---------|
|
|
658
|
+
| `GH_TOKEN` | GitHub personal access token | From server OAuth |
|
|
659
|
+
| `AGENTDEV_WORKSPACE` | Workspace directory path | `~/agentdev-workspace` |
|
|
660
|
+
| `CLAUDE_BIN` | Path to Claude CLI binary | `claude` |
|
|
661
|
+
| `TICKET_NUMBER` | Current ticket (set by executor) | — |
|
|
662
|
+
| `REPO` | Current repository (set by executor) | — |
|
|
663
|
+
| `AGENT_ID` | Agent identifier (set by executor) | — |
|
|
664
|
+
|
|
665
|
+
## Troubleshooting
|
|
666
|
+
|
|
667
|
+
### Agent not picking up tickets
|
|
668
|
+
|
|
669
|
+
- Verify the agent is running: `agentdev status`
|
|
670
|
+
- Check that tickets exist on the project board with status "Todo"
|
|
671
|
+
- Ensure tickets have `@claude` in the description
|
|
672
|
+
- Verify GitHub OAuth is configured in your Profile
|
|
673
|
+
- Check that the agent is assigned to the correct project
|
|
674
|
+
|
|
675
|
+
### Registration fails
|
|
676
|
+
|
|
677
|
+
- Ensure the server URL is reachable: `curl https://agentdev.datatamer.ai`
|
|
678
|
+
- The device code expires after 10 minutes — re-run `agentdev register`
|
|
679
|
+
- Make sure you're logged into the web dashboard when approving
|
|
680
|
+
|
|
681
|
+
### "claude: command not found"
|
|
682
|
+
|
|
683
|
+
Install Claude CLI from [claude.ai/download](https://claude.ai/download) and ensure it's in your PATH.
|
|
684
|
+
|
|
685
|
+
### Token expired
|
|
686
|
+
|
|
687
|
+
Agent tokens expire after 90 days. Re-register:
|
|
688
|
+
|
|
689
|
+
```bash
|
|
690
|
+
agentdev register
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
### Check config file
|
|
694
|
+
|
|
695
|
+
```bash
|
|
696
|
+
cat ~/.config/agentdev/config.json
|
|
697
|
+
```
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
|
2
|
+
<rect width="32" height="32" rx="6" fill="#1a1a2e"/>
|
|
3
|
+
<path d="M16 6 L26 24 H6 Z" fill="none" stroke="#4ade80" stroke-width="2.5" stroke-linejoin="round"/>
|
|
4
|
+
<circle cx="16" cy="17" r="3" fill="#4ade80"/>
|
|
5
|
+
</svg>
|