diragent 0.1.1 → 0.1.2

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.
Files changed (2) hide show
  1. package/README.md +344 -33
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,57 +1,368 @@
1
- # Dirigent
1
+ # Diragent 🎭
2
2
 
3
3
  > AI Agent Orchestration Platform
4
4
 
5
5
  Enterprise-grade orchestration for AI coding agents. Self-hosted, simple to deploy, powerful to scale.
6
6
 
7
+ [![npm version](https://img.shields.io/npm/v/diragent.svg)](https://www.npmjs.com/package/diragent)
8
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
9
+
10
+ ## Why Diragent?
11
+
12
+ Managing multiple AI coding agents (Claude Code, Codex, Cursor, etc.) across projects is chaos. Diragent brings order:
13
+
14
+ - **One dashboard** to see all your agents
15
+ - **Spawn agents on demand** with different models and configs
16
+ - **Real-time logs** streaming from every agent
17
+ - **Enterprise controls** - authentication, audit trails, resource limits
18
+ - **Self-hosted** - your infrastructure, your data, full control
19
+
20
+ ## Requirements
21
+
22
+ - Node.js 20+
23
+ - Linux/macOS (Windows WSL supported)
24
+ - AI agent CLIs installed (e.g., `claude`, `codex`)
25
+
26
+ ## Installation
27
+
28
+ ```bash
29
+ npm install -g diragent
30
+ ```
31
+
7
32
  ## Quick Start
8
33
 
34
+ ### 1. Initialize Workspace
35
+
9
36
  ```bash
10
- curl -fsSL https://get.dirigent.dev | bash
11
37
  diragent init
38
+ ```
39
+
40
+ This creates a `.dirigent/` folder with:
41
+ - `config.json` - Server configuration
42
+ - `data/` - SQLite database
43
+ - `logs/` - Server logs
44
+ - `workspaces/` - Agent workspaces
45
+
46
+ **Important:** Save the admin token shown during init - you'll need it for dashboard access.
47
+
48
+ ### 2. Start the Server
49
+
50
+ ```bash
51
+ # Foreground (see logs directly)
12
52
  diragent up
53
+
54
+ # Background (daemon mode)
55
+ diragent up -d
56
+ ```
57
+
58
+ ### 3. Access the Dashboard
59
+
60
+ Open **http://localhost:3000** in your browser.
61
+
62
+ Login with your admin token (shown during `diragent init`).
63
+
64
+ The dashboard shows:
65
+ - **Stats** - Total agents, running, idle, errors
66
+ - **Agent List** - All agents with status indicators
67
+ - **Spawn Modal** - Create new agents
68
+ - **Agent Details** - Logs, send messages, stop agents
69
+
70
+ ### 4. Spawn Your First Agent
71
+
72
+ **Via Dashboard:**
73
+ 1. Click "Spawn Agent"
74
+ 2. Select template (Claude, Codex, Custom)
75
+ 3. Optionally set name, workspace, initial task
76
+ 4. Click "Spawn"
77
+
78
+ **Via CLI:**
79
+ ```bash
80
+ # Spawn a Claude Code agent
81
+ diragent agent spawn claude
82
+
83
+ # Spawn with custom name and workspace
84
+ diragent agent spawn claude --name my-agent --workspace /path/to/project
85
+
86
+ # Spawn with an initial task
87
+ diragent agent spawn claude --task "Build a REST API for user management"
88
+
89
+ # Spawn Codex agent
90
+ diragent agent spawn codex
91
+ ```
92
+
93
+ ### 5. Interact with Agents
94
+
95
+ **Send messages:**
96
+ ```bash
97
+ diragent agent send <agent-id> "Add authentication to the API"
98
+ ```
99
+
100
+ **View logs:**
101
+ ```bash
102
+ # Last 50 lines
103
+ diragent agent logs <agent-id>
104
+
105
+ # Stream logs in real-time
106
+ diragent agent logs <agent-id> -f
107
+ ```
108
+
109
+ **Stop an agent:**
110
+ ```bash
111
+ diragent agent stop <agent-id>
112
+ ```
113
+
114
+ ## Installing AI Agent CLIs
115
+
116
+ Diragent orchestrates external AI agent CLIs. Install the ones you need:
117
+
118
+ ### Claude Code (Anthropic)
119
+ ```bash
120
+ # Via npm
121
+ npm install -g @anthropic-ai/claude-code
122
+
123
+ # Authenticate
124
+ claude auth
125
+ ```
126
+
127
+ ### Codex (OpenAI)
128
+ ```bash
129
+ npm install -g @openai/codex
130
+
131
+ # Set API key
132
+ export OPENAI_API_KEY=your-key
13
133
  ```
14
134
 
15
- ## Features
135
+ ### Custom Agents
16
136
 
17
- - 🤖 **Multi-Agent Orchestration** - Spawn, monitor, and coordinate AI agents
18
- - 🏢 **Enterprise Ready** - Role-based access, audit logs, compliance controls
19
- - 🔒 **Self-Hosted** - Your infrastructure, your data, your control
20
- - 📊 **Real-time Dashboard** - Monitor all agents from a single pane
21
- - 🔌 **Agent Agnostic** - Works with Claude Code, Codex, OpenCode, and more
22
- - ⚡ **Simple Install** - One command setup on any Linux VM
137
+ Add custom agent templates in `.dirigent/config.json`:
138
+
139
+ ```json
140
+ {
141
+ "agents": {
142
+ "templates": {
143
+ "my-custom-agent": {
144
+ "driver": "subprocess",
145
+ "command": ["python", "/path/to/my_agent.py"],
146
+ "env": {
147
+ "MY_API_KEY": "xxx"
148
+ }
149
+ }
150
+ }
151
+ }
152
+ }
153
+ ```
154
+
155
+ Then spawn: `diragent agent spawn my-custom-agent`
156
+
157
+ ## Configuration
158
+
159
+ Edit `.dirigent/config.json`:
160
+
161
+ ```json
162
+ {
163
+ "server": {
164
+ "port": 3000,
165
+ "host": "0.0.0.0"
166
+ },
167
+ "auth": {
168
+ "enabled": true,
169
+ "adminToken": "your-token-here"
170
+ },
171
+ "agents": {
172
+ "maxConcurrent": 10,
173
+ "defaultTimeout": 3600,
174
+ "templates": {
175
+ "claude": {
176
+ "driver": "claude-code",
177
+ "model": "claude-sonnet-4-5"
178
+ },
179
+ "codex": {
180
+ "driver": "codex",
181
+ "model": "codex-1"
182
+ }
183
+ }
184
+ },
185
+ "logging": {
186
+ "level": "info"
187
+ }
188
+ }
189
+ ```
190
+
191
+ ### Configuration Options
192
+
193
+ | Option | Description | Default |
194
+ |--------|-------------|---------|
195
+ | `server.port` | HTTP server port | 3000 |
196
+ | `server.host` | Bind address | 0.0.0.0 |
197
+ | `auth.enabled` | Enable authentication | true |
198
+ | `auth.adminToken` | Admin access token | Generated |
199
+ | `agents.maxConcurrent` | Max simultaneous agents | 10 |
200
+ | `agents.defaultTimeout` | Agent timeout (seconds) | 3600 |
201
+
202
+ ## CLI Reference
203
+
204
+ ```bash
205
+ diragent init [options] # Initialize workspace
206
+ -y, --yes # Accept defaults
207
+ --port <port> # Server port (default: 3000)
208
+
209
+ diragent up [options] # Start server
210
+ -d, --detach # Run in background
211
+
212
+ diragent down [options] # Stop server
213
+ -f, --force # Force kill all agents
214
+
215
+ diragent status [options] # Show status
216
+ -j, --json # JSON output
217
+
218
+ diragent agent list # List agents
219
+ -a, --all # Include stopped
220
+ -j, --json # JSON output
221
+
222
+ diragent agent spawn <template> [options]
223
+ -n, --name <name> # Agent name
224
+ -w, --workspace <path> # Working directory
225
+ -t, --task <task> # Initial task
226
+ --model <model> # Model override
227
+
228
+ diragent agent stop <id> # Stop agent
229
+ -f, --force # Force kill
230
+
231
+ diragent agent send <id> <message> # Send message
232
+
233
+ diragent agent logs <id> # View logs
234
+ -f, --follow # Stream logs
235
+ -n, --lines <n> # Number of lines
236
+
237
+ diragent logs [options] # Server logs
238
+ -f, --follow # Stream logs
239
+
240
+ diragent config [options] # View/edit config
241
+ --get <key> # Get value
242
+ --set <key=value> # Set value
243
+ --edit # Open in editor
244
+ ```
245
+
246
+ ## REST API
247
+
248
+ Base URL: `http://localhost:3000/api`
249
+
250
+ All endpoints require `Authorization: Bearer <token>` header.
251
+
252
+ ### Endpoints
253
+
254
+ ```
255
+ GET /api/status # Server status and stats
256
+ GET /api/agents # List agents (?all=true for stopped)
257
+ POST /api/agents # Spawn agent
258
+ GET /api/agents/:id # Get agent details
259
+ DELETE /api/agents/:id # Stop agent (?force=true)
260
+ POST /api/agents/:id/send # Send message
261
+ GET /api/agents/:id/logs # Get logs (?lines=100)
262
+ GET /api/templates # List available templates
263
+ ```
264
+
265
+ ### Example: Spawn via API
266
+
267
+ ```bash
268
+ curl -X POST http://localhost:3000/api/agents \
269
+ -H "Authorization: Bearer YOUR_TOKEN" \
270
+ -H "Content-Type: application/json" \
271
+ -d '{
272
+ "template": "claude",
273
+ "name": "api-builder",
274
+ "task": "Create a REST API"
275
+ }'
276
+ ```
277
+
278
+ ## WebSocket API
279
+
280
+ Connect to `ws://localhost:3000/ws` for real-time updates.
281
+
282
+ ```javascript
283
+ const socket = io('http://localhost:3000');
284
+
285
+ // Authenticate
286
+ socket.emit('auth', { token: 'YOUR_TOKEN' });
287
+
288
+ // Subscribe to agent updates
289
+ socket.emit('subscribe:agents');
290
+
291
+ // Subscribe to specific agent logs
292
+ socket.emit('subscribe:logs', { agentId: 'xxx' });
293
+
294
+ // Listen for events
295
+ socket.on('agent:created', (data) => console.log('New agent:', data));
296
+ socket.on('agent:running', (data) => console.log('Agent started:', data));
297
+ socket.on('agent:stopped', (data) => console.log('Agent stopped:', data));
298
+ socket.on('agent:log', (data) => console.log('Log:', data));
299
+ ```
23
300
 
24
301
  ## Architecture
25
302
 
26
303
  ```
27
- ┌─────────────────────────────────────────────────────┐
28
- Dirigent Dashboard
29
- (React + WebSocket Real-time)
30
- └─────────────────────┬───────────────────────────────┘
31
-
32
- ┌─────────────────────▼───────────────────────────────┐
33
- │ Control Plane │
34
- ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌──────────┐
35
- Auth & │ Agent │ │ Task │ │ Audit & │ │
36
- │ │ RBAC │ │ Registry│ │ Router │ │ Logging
37
- └─────────┘ └─────────┘ └─────────┘ └──────────┘
38
- └─────────────────────┬───────────────────────────────┘
39
-
40
- ┌─────────────────────▼───────────────────────────────┐
41
- │ Agent Runtime │
42
- ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌──────────┐
43
- Agent 1 │ │ Agent 2 │ │ Agent 3 │ │ Agent N │ │
44
- │ (Claude)│ │ (Codex) │ │ (Custom)│ │ ... │
45
- └─────────┘ └─────────┘ └─────────┘ └──────────┘
46
- └─────────────────────────────────────────────────────┘
304
+ ┌─────────────────────────────────────────────────────────────┐
305
+ Dashboard
306
+ Real-time UI (WebSocket)
307
+ │ http://localhost:3000 │
308
+ └─────────────────────────┬───────────────────────────────────┘
309
+
310
+ ┌─────────────────────────▼───────────────────────────────────┐
311
+ Control Plane
312
+ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
313
+ │ │ REST │ │WebSocket │ │ SQLite │ │ Auth &
314
+ │ API │ │ Server │ │ DB │ Audit
315
+ │ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
316
+ └─────────────────────────┬───────────────────────────────────┘
317
+
318
+ ┌─────────────────────────▼───────────────────────────────────┐
319
+ Agent Manager
320
+
321
+ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐
322
+ │ Claude │ │ Codex │ │ Custom │ .... │ │
323
+ │ │ Agent │ │ Agent │ │ Agent │ │ │ │
324
+ │ └─────────┘ └─────────┘ └─────────┘ └─────────┘ │
325
+ │ │
326
+ │ Each agent runs as a subprocess with: │
327
+ │ - Isolated workspace │
328
+ │ - Captured stdout/stderr → logs │
329
+ │ - stdin for message passing │
330
+ └─────────────────────────────────────────────────────────────┘
47
331
  ```
48
332
 
333
+ ## Troubleshooting
334
+
335
+ ### "Agent not found" error
336
+ The agent may have stopped. Check with `diragent agent list -a` to see all agents including stopped ones.
337
+
338
+ ### Dashboard not loading
339
+ 1. Check server is running: `diragent status`
340
+ 2. Check port is not in use: `lsof -i :3000`
341
+ 3. Check logs: `diragent logs`
342
+
343
+ ### Agent won't spawn
344
+ 1. Ensure the agent CLI is installed (e.g., `which claude`)
345
+ 2. Check you haven't hit `maxConcurrent` limit
346
+ 3. Check agent logs for errors
347
+
348
+ ### Authentication issues
349
+ Your admin token is in `.dirigent/config.json` under `auth.adminToken`.
350
+
351
+ ## Roadmap
352
+
353
+ - [ ] Multi-node deployment
354
+ - [ ] Agent-to-agent communication
355
+ - [ ] Task queuing and scheduling
356
+ - [ ] Prometheus metrics
357
+ - [ ] RBAC and team management
358
+ - [ ] Kubernetes operator
359
+
49
360
  ## License
50
361
 
51
362
  Apache 2.0 - Free to use, modify, and distribute.
52
363
 
53
- ## Commercial Support
54
-
55
- Enterprise support, custom integrations, and managed hosting available.
56
- Contact: hello@dirigent.dev
364
+ ## Links
57
365
 
366
+ - **npm:** https://www.npmjs.com/package/diragent
367
+ - **GitHub:** https://github.com/anindyar/dirigent
368
+ - **Issues:** https://github.com/anindyar/dirigent/issues
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diragent",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "AI Agent Orchestration Platform - Enterprise-grade orchestration for AI coding agents",
5
5
  "author": "Anindya Roy <anindya@anindya.me>",
6
6
  "license": "Apache-2.0",