claudito 0.1.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.
Files changed (123) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +500 -0
  3. package/dist/agents/agent-manager.d.ts +150 -0
  4. package/dist/agents/agent-manager.d.ts.map +1 -0
  5. package/dist/agents/agent-manager.js +560 -0
  6. package/dist/agents/agent-manager.js.map +1 -0
  7. package/dist/agents/claude-agent.d.ts +138 -0
  8. package/dist/agents/claude-agent.d.ts.map +1 -0
  9. package/dist/agents/claude-agent.js +608 -0
  10. package/dist/agents/claude-agent.js.map +1 -0
  11. package/dist/agents/index.d.ts +3 -0
  12. package/dist/agents/index.d.ts.map +1 -0
  13. package/dist/agents/index.js +21 -0
  14. package/dist/agents/index.js.map +1 -0
  15. package/dist/cli.d.ts +3 -0
  16. package/dist/cli.d.ts.map +1 -0
  17. package/dist/cli.js +115 -0
  18. package/dist/cli.js.map +1 -0
  19. package/dist/config/index.d.ts +18 -0
  20. package/dist/config/index.d.ts.map +1 -0
  21. package/dist/config/index.js +47 -0
  22. package/dist/config/index.js.map +1 -0
  23. package/dist/index.d.ts +2 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +35 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/repositories/conversation.d.ts +67 -0
  28. package/dist/repositories/conversation.d.ts.map +1 -0
  29. package/dist/repositories/conversation.js +233 -0
  30. package/dist/repositories/conversation.js.map +1 -0
  31. package/dist/repositories/index.d.ts +4 -0
  32. package/dist/repositories/index.d.ts.map +1 -0
  33. package/dist/repositories/index.js +20 -0
  34. package/dist/repositories/index.js.map +1 -0
  35. package/dist/repositories/project.d.ts +92 -0
  36. package/dist/repositories/project.d.ts.map +1 -0
  37. package/dist/repositories/project.js +279 -0
  38. package/dist/repositories/project.js.map +1 -0
  39. package/dist/repositories/settings.d.ts +44 -0
  40. package/dist/repositories/settings.d.ts.map +1 -0
  41. package/dist/repositories/settings.js +116 -0
  42. package/dist/repositories/settings.js.map +1 -0
  43. package/dist/routes/filesystem.d.ts +33 -0
  44. package/dist/routes/filesystem.d.ts.map +1 -0
  45. package/dist/routes/filesystem.js +211 -0
  46. package/dist/routes/filesystem.js.map +1 -0
  47. package/dist/routes/index.d.ts +11 -0
  48. package/dist/routes/index.d.ts.map +1 -0
  49. package/dist/routes/index.js +101 -0
  50. package/dist/routes/index.js.map +1 -0
  51. package/dist/routes/projects.d.ts +48 -0
  52. package/dist/routes/projects.d.ts.map +1 -0
  53. package/dist/routes/projects.js +578 -0
  54. package/dist/routes/projects.js.map +1 -0
  55. package/dist/routes/settings.d.ts +10 -0
  56. package/dist/routes/settings.d.ts.map +1 -0
  57. package/dist/routes/settings.js +30 -0
  58. package/dist/routes/settings.js.map +1 -0
  59. package/dist/server/index.d.ts +25 -0
  60. package/dist/server/index.d.ts.map +1 -0
  61. package/dist/server/index.js +104 -0
  62. package/dist/server/index.js.map +1 -0
  63. package/dist/services/index.d.ts +5 -0
  64. package/dist/services/index.d.ts.map +1 -0
  65. package/dist/services/index.js +21 -0
  66. package/dist/services/index.js.map +1 -0
  67. package/dist/services/instruction-generator.d.ts +47 -0
  68. package/dist/services/instruction-generator.d.ts.map +1 -0
  69. package/dist/services/instruction-generator.js +147 -0
  70. package/dist/services/instruction-generator.js.map +1 -0
  71. package/dist/services/project.d.ts +38 -0
  72. package/dist/services/project.d.ts.map +1 -0
  73. package/dist/services/project.js +80 -0
  74. package/dist/services/project.js.map +1 -0
  75. package/dist/services/roadmap-generator.d.ts +63 -0
  76. package/dist/services/roadmap-generator.d.ts.map +1 -0
  77. package/dist/services/roadmap-generator.js +290 -0
  78. package/dist/services/roadmap-generator.js.map +1 -0
  79. package/dist/services/roadmap.d.ts +72 -0
  80. package/dist/services/roadmap.d.ts.map +1 -0
  81. package/dist/services/roadmap.js +234 -0
  82. package/dist/services/roadmap.js.map +1 -0
  83. package/dist/utils/errors.d.ts +24 -0
  84. package/dist/utils/errors.d.ts.map +1 -0
  85. package/dist/utils/errors.js +80 -0
  86. package/dist/utils/errors.js.map +1 -0
  87. package/dist/utils/index.d.ts +6 -0
  88. package/dist/utils/index.d.ts.map +1 -0
  89. package/dist/utils/index.js +22 -0
  90. package/dist/utils/index.js.map +1 -0
  91. package/dist/utils/logger.d.ts +49 -0
  92. package/dist/utils/logger.d.ts.map +1 -0
  93. package/dist/utils/logger.js +172 -0
  94. package/dist/utils/logger.js.map +1 -0
  95. package/dist/utils/paths.d.ts +2 -0
  96. package/dist/utils/paths.d.ts.map +1 -0
  97. package/dist/utils/paths.js +19 -0
  98. package/dist/utils/paths.js.map +1 -0
  99. package/dist/utils/pid-tracker.d.ts +39 -0
  100. package/dist/utils/pid-tracker.d.ts.map +1 -0
  101. package/dist/utils/pid-tracker.js +171 -0
  102. package/dist/utils/pid-tracker.js.map +1 -0
  103. package/dist/utils/retry.d.ts +10 -0
  104. package/dist/utils/retry.d.ts.map +1 -0
  105. package/dist/utils/retry.js +65 -0
  106. package/dist/utils/retry.js.map +1 -0
  107. package/dist/websocket/index.d.ts +2 -0
  108. package/dist/websocket/index.d.ts.map +1 -0
  109. package/dist/websocket/index.js +18 -0
  110. package/dist/websocket/index.js.map +1 -0
  111. package/dist/websocket/websocket-server.d.ts +42 -0
  112. package/dist/websocket/websocket-server.d.ts.map +1 -0
  113. package/dist/websocket/websocket-server.js +140 -0
  114. package/dist/websocket/websocket-server.js.map +1 -0
  115. package/package.json +77 -0
  116. package/public/css/styles.css +1860 -0
  117. package/public/index.html +1004 -0
  118. package/public/js/app.js +5346 -0
  119. package/public/vendor/highlight-github-dark.min.css +10 -0
  120. package/public/vendor/highlight.min.js +1213 -0
  121. package/public/vendor/jquery.min.js +2 -0
  122. package/public/vendor/marked.min.js +69 -0
  123. package/public/vendor/tailwind.js +65 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Gustavo Falco
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,500 @@
1
+ # Claudito
2
+
3
+ [![npm version](https://badge.fury.io/js/claudito.svg)](https://www.npmjs.com/package/claudito)
4
+ [![CI](https://github.com/anthropics/claudito/actions/workflows/ci.yml/badge.svg)](https://github.com/anthropics/claudito/actions/workflows/ci.yml)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ A web-based manager for [Claude Code](https://docs.anthropic.com/en/docs/claude-code) agents. Run and monitor multiple Claude agents across different projects with a modern UI.
8
+
9
+ ![Claudito Screenshot](doc/images/preview-01.png)
10
+
11
+ ## Quick Start
12
+
13
+ ```bash
14
+ # Run directly with npx (no installation required)
15
+ npx claudito
16
+
17
+ # Or install globally
18
+ npm install -g claudito
19
+ claudito
20
+ ```
21
+
22
+ Open your browser at **http://localhost:3000** to access the web UI.
23
+
24
+ ## Table of Contents
25
+
26
+ - [Requirements](#requirements)
27
+ - [Installation](#installation)
28
+ - [Usage](#usage)
29
+ - [Features](#features)
30
+ - [Configuration](#configuration)
31
+ - [Data Storage](#data-storage)
32
+ - [API Reference](#api-reference)
33
+ - [Development](#development)
34
+ - [Testing the Package Locally](#testing-the-package-locally)
35
+ - [License](#license)
36
+
37
+ ## Requirements
38
+
39
+ | Requirement | Version |
40
+ |-------------|---------|
41
+ | **Node.js** | 18.0.0 or higher |
42
+ | **Claude Code CLI** | Latest version |
43
+
44
+ ### Installing Claude Code CLI
45
+
46
+ Before using Claudito, ensure you have the Claude Code CLI installed and configured:
47
+
48
+ ```bash
49
+ # Install Claude Code CLI (if not already installed)
50
+ npm install -g @anthropic-ai/claude-code
51
+
52
+ # Verify installation
53
+ claude --version
54
+
55
+ # Configure your API key (first time only)
56
+ claude auth
57
+ ```
58
+
59
+ For more details, see the [Claude Code documentation](https://docs.anthropic.com/en/docs/claude-code).
60
+
61
+ ## Installation
62
+
63
+ ### Option 1: Run with npx (Recommended)
64
+
65
+ No installation required. Run directly:
66
+
67
+ ```bash
68
+ npx claudito
69
+ ```
70
+
71
+ This downloads and runs the latest version automatically.
72
+
73
+ ### Option 2: Global Installation
74
+
75
+ Install once, run anywhere:
76
+
77
+ ```bash
78
+ npm install -g claudito
79
+ claudito
80
+ ```
81
+
82
+ ### Option 3: Local Installation
83
+
84
+ For development or integration into a project:
85
+
86
+ ```bash
87
+ npm install claudito
88
+ npx claudito
89
+ ```
90
+
91
+ ## Usage
92
+
93
+ ### Basic Usage
94
+
95
+ ```bash
96
+ # Start with defaults (localhost:3000)
97
+ claudito
98
+
99
+ # Specify a custom port
100
+ claudito --port 8080
101
+ claudito -p 8080
102
+
103
+ # Listen on all network interfaces
104
+ claudito --host 0.0.0.0
105
+
106
+ # Combine options
107
+ claudito -p 8080 --host 0.0.0.0
108
+ ```
109
+
110
+ ### CLI Options
111
+
112
+ | Option | Short | Description | Default |
113
+ |--------|-------|-------------|---------|
114
+ | `--port <port>` | `-p` | Server port | `3000` |
115
+ | `--host <host>` | `-h` | Server host | `localhost` |
116
+ | `--version` | `-v` | Show version number | - |
117
+ | `--help` | - | Show help message | - |
118
+
119
+ ### Environment Variables
120
+
121
+ All options can also be set via environment variables:
122
+
123
+ ```bash
124
+ # Linux/macOS
125
+ PORT=8080 HOST=0.0.0.0 LOG_LEVEL=debug claudito
126
+
127
+ # Windows (PowerShell)
128
+ $env:PORT=8080; $env:HOST="0.0.0.0"; claudito
129
+
130
+ # Windows (CMD)
131
+ set PORT=8080 && set HOST=0.0.0.0 && claudito
132
+ ```
133
+
134
+ | Variable | Default | Description |
135
+ |----------|---------|-------------|
136
+ | `PORT` | `3000` | Server port |
137
+ | `HOST` | `localhost` | Server host |
138
+ | `NODE_ENV` | `development` | Environment mode |
139
+ | `LOG_LEVEL` | `info` | Log level (debug/info/warn/error) |
140
+ | `MAX_CONCURRENT_AGENTS` | `3` | Maximum concurrent agents |
141
+
142
+ ## Features
143
+
144
+ ### Agent Modes
145
+
146
+ #### Interactive Mode (Default)
147
+ Chat with Claude in real-time. The agent auto-starts when you send your first message.
148
+
149
+ - Real-time streaming of Claude's responses
150
+ - See tool usage as it happens (file reads, edits, bash commands)
151
+ - Code diffs with syntax highlighting
152
+ - Send follow-up messages naturally
153
+
154
+ #### Autonomous Mode
155
+ Runs through ROADMAP.md milestones automatically.
156
+
157
+ - Parse and display ROADMAP.md structure
158
+ - Generate roadmaps via Claude
159
+ - Execute tasks sequentially
160
+ - Track completion status
161
+
162
+ ### Project Management
163
+
164
+ - **Add Projects**: Point to any directory with a codebase
165
+ - **Multi-Project Support**: Manage multiple projects simultaneously
166
+ - **Concurrent Execution**: Run multiple agents at once (configurable limit)
167
+ - **Queue System**: Automatic queuing when at max capacity
168
+
169
+ ### User Interface
170
+
171
+ | Feature | Description |
172
+ |---------|-------------|
173
+ | **Tabbed Interface** | Switch between Agent Output and Project Files |
174
+ | **File Browser** | Browse, view, and edit project files |
175
+ | **Syntax Highlighting** | 30+ languages supported via highlight.js |
176
+ | **Tool Visualization** | See Claude's tool usage with icons and arguments |
177
+ | **Code Diffs** | Side-by-side diff view for file changes |
178
+ | **Context Monitor** | View token usage and context window utilization |
179
+ | **Font Controls** | Adjust text size with +/- buttons |
180
+ | **Keyboard Shortcuts** | Configurable keybindings (Ctrl+Enter or Enter to send) |
181
+
182
+ ### Real-time Features
183
+
184
+ - **Live Streaming**: WebSocket-based real-time updates
185
+ - **Conversation Stats**: Duration, message count, tool calls, tokens
186
+ - **Resource Monitor**: Running and queued agent counts
187
+ - **Context Usage**: Token usage persisted even when agent is stopped
188
+
189
+ ### Additional Features
190
+
191
+ - **CLAUDE.md Editor**: Edit global and project-specific CLAUDE.md files
192
+ - **Conversation History**: Browse and restore previous conversations
193
+ - **Debug Panel**: View logs, process info, and troubleshoot issues
194
+ - **Offline Ready**: All assets served locally (no CDN dependencies)
195
+
196
+ ## Configuration
197
+
198
+ ### Global Settings
199
+
200
+ Access settings via the gear icon in the UI sidebar.
201
+
202
+ | Setting | Description | Default |
203
+ |---------|-------------|---------|
204
+ | `maxConcurrentAgents` | Maximum simultaneous agents (1-10) | `3` |
205
+ | `dangerouslySkipPermissions` | Skip Claude permission prompts | `true` |
206
+ | `sendWithCtrlEnter` | Ctrl+Enter sends (true) or Enter sends (false) | `true` |
207
+ | `historyLimit` | Max conversations in history | `25` |
208
+ | `agentPromptTemplate` | Template for autonomous mode instructions | (see below) |
209
+
210
+ ### Agent Prompt Template
211
+
212
+ Customize how instructions are given to agents in autonomous mode. Available variables:
213
+
214
+ - `${var:project-name}` - Project name
215
+ - `${var:phase-title}` - Current phase from ROADMAP.md
216
+ - `${var:milestone-title}` - Current milestone title
217
+ - `${var:milestone-item}` - Specific task to work on
218
+
219
+ ## Data Storage
220
+
221
+ All data is stored locally in your home directory:
222
+
223
+ ```
224
+ ~/.claudito/
225
+ ├── projects/
226
+ │ └── index.json # Project registry
227
+ ├── settings.json # Global settings
228
+ └── pids.json # Active process tracking
229
+
230
+ {project-root}/.claudito/
231
+ ├── status.json # Project status
232
+ └── conversations/
233
+ └── {id}.json # Conversation history
234
+ ```
235
+
236
+ ## API Reference
237
+
238
+ ### Health Check
239
+
240
+ ```
241
+ GET /api/health
242
+ ```
243
+
244
+ ### Projects
245
+
246
+ ```
247
+ GET /api/projects # List all projects
248
+ POST /api/projects # Create project
249
+ GET /api/projects/:id # Get project details
250
+ DELETE /api/projects/:id # Delete project
251
+ ```
252
+
253
+ ### Agent Control
254
+
255
+ ```
256
+ POST /api/projects/:id/agent/start # Start agent
257
+ POST /api/projects/:id/agent/stop # Stop agent
258
+ POST /api/projects/:id/agent/send # Send message
259
+ GET /api/projects/:id/agent/status # Get status
260
+ GET /api/projects/:id/agent/context # Get context usage
261
+ ```
262
+
263
+ ### Roadmap
264
+
265
+ ```
266
+ GET /api/projects/:id/roadmap # Get roadmap
267
+ POST /api/projects/:id/roadmap/generate # Generate roadmap
268
+ PUT /api/projects/:id/roadmap # Modify roadmap
269
+ ```
270
+
271
+ ### Settings
272
+
273
+ ```
274
+ GET /api/settings # Get settings
275
+ PUT /api/settings # Update settings
276
+ ```
277
+
278
+ ### WebSocket
279
+
280
+ Connect to `ws://localhost:3000` for real-time updates:
281
+
282
+ ```javascript
283
+ const ws = new WebSocket('ws://localhost:3000');
284
+
285
+ // Subscribe to project updates
286
+ ws.send(JSON.stringify({ type: 'subscribe', projectId: 'your-project-id' }));
287
+
288
+ // Message types received:
289
+ // - agent_message: Real-time agent output
290
+ // - agent_status: Status changes (running/stopped/error)
291
+ // - queue_change: Queue updates
292
+ ```
293
+
294
+ ## Development
295
+
296
+ ### Setup
297
+
298
+ ```bash
299
+ git clone https://github.com/anthropics/claudito.git
300
+ cd claudito
301
+ npm install
302
+ ```
303
+
304
+ ### Commands
305
+
306
+ | Command | Description |
307
+ |---------|-------------|
308
+ | `npm run dev` | Start development server with hot reload |
309
+ | `npm run build` | Build TypeScript to dist/ |
310
+ | `npm start` | Run production build |
311
+ | `npm test` | Run all tests |
312
+ | `npm run test:coverage` | Run tests with coverage |
313
+ | `npm run lint` | Run ESLint |
314
+ | `npm run lint:fix` | Fix ESLint issues |
315
+ | `npm run format` | Format code with Prettier |
316
+
317
+ ### Project Structure
318
+
319
+ ```
320
+ claudito/
321
+ ├── src/
322
+ │ ├── index.ts # Library entry point
323
+ │ ├── cli.ts # CLI entry point
324
+ │ ├── config/ # Configuration loading
325
+ │ ├── server/ # Express server
326
+ │ ├── routes/ # API routes
327
+ │ ├── services/ # Business logic
328
+ │ ├── repositories/ # Data persistence
329
+ │ ├── agents/ # Claude agent management
330
+ │ ├── websocket/ # WebSocket server
331
+ │ └── utils/ # Utilities
332
+ ├── public/ # Static frontend assets
333
+ ├── test/ # Test files
334
+ └── doc/ # Documentation
335
+ ```
336
+
337
+ ## Testing the Package Locally
338
+
339
+ Before publishing, you can test the package locally to verify everything works correctly.
340
+
341
+ ### Method 1: npm pack (Recommended)
342
+
343
+ Create a tarball and install it:
344
+
345
+ ```bash
346
+ # Build the project
347
+ npm run build
348
+
349
+ # Create the package tarball
350
+ npm pack
351
+
352
+ # This creates claudito-0.1.0.tgz (version may vary)
353
+
354
+ # Install globally from the tarball
355
+ npm install -g ./claudito-0.1.0.tgz
356
+
357
+ # Test the CLI
358
+ claudito --help
359
+ claudito --version
360
+ claudito # Starts the server
361
+
362
+ # Uninstall when done
363
+ npm uninstall -g claudito
364
+ ```
365
+
366
+ ### Method 2: npm link
367
+
368
+ Create a symlink for development:
369
+
370
+ ```bash
371
+ # Build first
372
+ npm run build
373
+
374
+ # Create global symlink
375
+ npm link
376
+
377
+ # Now 'claudito' command is available globally
378
+ claudito --help
379
+ claudito
380
+
381
+ # Unlink when done
382
+ npm unlink -g claudito
383
+ ```
384
+
385
+ ### Method 3: Dry Run
386
+
387
+ Preview what would be published without creating a file:
388
+
389
+ ```bash
390
+ # See what files would be included
391
+ npm pack --dry-run
392
+
393
+ # Check package size and contents
394
+ npm publish --dry-run
395
+ ```
396
+
397
+ ### Method 4: Local npx
398
+
399
+ Test as if running with npx:
400
+
401
+ ```bash
402
+ # Build the project
403
+ npm run build
404
+
405
+ # Run the CLI directly
406
+ node dist/cli.js --help
407
+ node dist/cli.js
408
+
409
+ # Or use npm script
410
+ npm run cli -- --help
411
+ npm run cli -- --port 8080
412
+ ```
413
+
414
+ ### Verifying the Package Contents
415
+
416
+ Check that the package includes everything needed:
417
+
418
+ ```bash
419
+ # List all files that will be published
420
+ npm pack --dry-run 2>&1 | grep "npm notice"
421
+
422
+ # Expected contents:
423
+ # - dist/ (compiled JavaScript)
424
+ # - public/ (frontend assets)
425
+ # - README.md
426
+ # - LICENSE
427
+ # - package.json
428
+ ```
429
+
430
+ ### Testing in a Clean Environment
431
+
432
+ For thorough testing, install in an isolated directory:
433
+
434
+ ```bash
435
+ # Create test directory
436
+ mkdir /tmp/claudito-test
437
+ cd /tmp/claudito-test
438
+
439
+ # Install from tarball
440
+ npm init -y
441
+ npm install /path/to/claudito-0.1.0.tgz
442
+
443
+ # Run via npx
444
+ npx claudito --help
445
+
446
+ # Clean up
447
+ cd ..
448
+ rm -rf /tmp/claudito-test
449
+ ```
450
+
451
+ ## Troubleshooting
452
+
453
+ ### "claude: command not found"
454
+
455
+ The Claude Code CLI is not installed or not in your PATH:
456
+
457
+ ```bash
458
+ npm install -g @anthropic-ai/claude-code
459
+ ```
460
+
461
+ ### Port already in use
462
+
463
+ Another process is using port 3000:
464
+
465
+ ```bash
466
+ # Use a different port
467
+ claudito --port 3001
468
+
469
+ # Or find and kill the process using port 3000
470
+ # Linux/macOS:
471
+ lsof -i :3000
472
+ kill -9 <PID>
473
+
474
+ # Windows:
475
+ netstat -ano | findstr :3000
476
+ taskkill /PID <PID> /F
477
+ ```
478
+
479
+ ### Agent not responding
480
+
481
+ Check the Debug panel (gear icon > Debug) to view:
482
+ - Process status and PID
483
+ - Recent logs
484
+ - Last executed command
485
+
486
+ ## Contributing
487
+
488
+ 1. Fork the repository
489
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
490
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
491
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
492
+ 5. Open a Pull Request
493
+
494
+ ## License
495
+
496
+ MIT License - see [LICENSE](LICENSE) for details.
497
+
498
+ ---
499
+
500
+ Made with Claude Code
@@ -0,0 +1,150 @@
1
+ import { ClaudeAgent, AgentMessage, AgentStatus, AgentMode, ProcessInfo, ContextUsage } from './claude-agent';
2
+ import { ProjectRepository, ConversationRepository, SettingsRepository } from '../repositories';
3
+ import { InstructionGenerator, RoadmapParser } from '../services';
4
+ export interface AgentManagerEvents {
5
+ message: (projectId: string, message: AgentMessage) => void;
6
+ status: (projectId: string, status: AgentStatus) => void;
7
+ queueChange: (queue: QueuedProject[]) => void;
8
+ milestoneStarted: (projectId: string, milestone: MilestoneRef) => void;
9
+ milestoneCompleted: (projectId: string, milestone: MilestoneRef, reason: string) => void;
10
+ milestoneFailed: (projectId: string, milestone: MilestoneRef | null, reason: string) => void;
11
+ loopCompleted: (projectId: string) => void;
12
+ }
13
+ export interface QueuedProject {
14
+ projectId: string;
15
+ instructions: string;
16
+ queuedAt: string;
17
+ }
18
+ export interface AgentResourceStatus {
19
+ runningCount: number;
20
+ maxConcurrent: number;
21
+ queuedCount: number;
22
+ queuedProjects: QueuedProject[];
23
+ }
24
+ export interface AgentLoopState {
25
+ isLooping: boolean;
26
+ currentMilestone: MilestoneRef | null;
27
+ currentConversationId: string | null;
28
+ }
29
+ export interface MilestoneRef {
30
+ phaseId: string;
31
+ phaseTitle: string;
32
+ milestoneId: string;
33
+ milestoneTitle: string;
34
+ pendingTasks: string[];
35
+ }
36
+ export interface AgentCompletionResponse {
37
+ status: 'COMPLETE' | 'FAILED';
38
+ reason: string;
39
+ }
40
+ export interface TrackedProcessInfo {
41
+ pid: number;
42
+ projectId: string;
43
+ startedAt: string;
44
+ }
45
+ export interface OrphanCleanupResult {
46
+ foundCount: number;
47
+ killedCount: number;
48
+ killedPids: number[];
49
+ failedPids: number[];
50
+ skippedPids: number[];
51
+ }
52
+ export interface ImageData {
53
+ type: string;
54
+ data: string;
55
+ }
56
+ export interface AgentManager {
57
+ startAgent(projectId: string, instructions: string): Promise<void>;
58
+ startInteractiveAgent(projectId: string, initialMessage?: string, images?: ImageData[]): Promise<void>;
59
+ sendInput(projectId: string, input: string, images?: ImageData[]): void;
60
+ stopAgent(projectId: string): Promise<void>;
61
+ stopAllAgents(): Promise<void>;
62
+ getAgentStatus(projectId: string): AgentStatus;
63
+ getAgentMode(projectId: string): AgentMode | null;
64
+ isRunning(projectId: string): boolean;
65
+ isQueued(projectId: string): boolean;
66
+ getResourceStatus(): AgentResourceStatus;
67
+ removeFromQueue(projectId: string): void;
68
+ setMaxConcurrentAgents(max: number): void;
69
+ startAutonomousLoop(projectId: string): Promise<void>;
70
+ stopAutonomousLoop(projectId: string): void;
71
+ getLoopState(projectId: string): AgentLoopState | null;
72
+ getLastCommand(projectId: string): string | null;
73
+ getProcessInfo(projectId: string): ProcessInfo | null;
74
+ getContextUsage(projectId: string): ContextUsage | null;
75
+ getQueuedMessageCount(projectId: string): number;
76
+ getQueuedMessages(projectId: string): string[];
77
+ getTrackedProcesses(): TrackedProcessInfo[];
78
+ cleanupOrphanProcesses(): Promise<OrphanCleanupResult>;
79
+ on<K extends keyof AgentManagerEvents>(event: K, listener: AgentManagerEvents[K]): void;
80
+ off<K extends keyof AgentManagerEvents>(event: K, listener: AgentManagerEvents[K]): void;
81
+ }
82
+ export interface AgentFactory {
83
+ create(projectId: string, projectPath: string, mode: AgentMode): ClaudeAgent;
84
+ }
85
+ export interface AgentManagerDependencies {
86
+ projectRepository: ProjectRepository;
87
+ conversationRepository: ConversationRepository;
88
+ settingsRepository: SettingsRepository;
89
+ instructionGenerator: InstructionGenerator;
90
+ roadmapParser: RoadmapParser;
91
+ agentFactory?: AgentFactory;
92
+ maxConcurrentAgents?: number;
93
+ }
94
+ export declare class DefaultAgentManager implements AgentManager {
95
+ private readonly agents;
96
+ private readonly queue;
97
+ private readonly loopStates;
98
+ private readonly projectRepository;
99
+ private readonly conversationRepository;
100
+ private readonly settingsRepository;
101
+ private readonly instructionGenerator;
102
+ private readonly roadmapParser;
103
+ private readonly agentFactory;
104
+ private _maxConcurrentAgents;
105
+ private readonly logger;
106
+ private readonly pidTracker;
107
+ private readonly listeners;
108
+ constructor(deps: AgentManagerDependencies);
109
+ setMaxConcurrentAgents(max: number): void;
110
+ private get maxConcurrentAgents();
111
+ startAgent(projectId: string, instructions: string): Promise<void>;
112
+ startInteractiveAgent(projectId: string, initialMessage?: string, images?: ImageData[]): Promise<void>;
113
+ sendInput(projectId: string, input: string, images?: ImageData[]): void;
114
+ private buildMultimodalContent;
115
+ getAgentMode(projectId: string): AgentMode | null;
116
+ startAutonomousLoop(projectId: string): Promise<void>;
117
+ stopAutonomousLoop(projectId: string): void;
118
+ getLoopState(projectId: string): AgentLoopState | null;
119
+ getLastCommand(projectId: string): string | null;
120
+ getProcessInfo(projectId: string): ProcessInfo | null;
121
+ getContextUsage(projectId: string): ContextUsage | null;
122
+ getQueuedMessageCount(projectId: string): number;
123
+ getQueuedMessages(projectId: string): string[];
124
+ private runNextMilestone;
125
+ private createMilestoneRef;
126
+ private cleanupLoop;
127
+ private loadRoadmap;
128
+ private parseAgentResponse;
129
+ private startAgentImmediately;
130
+ private addToQueue;
131
+ private emitQueueChange;
132
+ stopAgent(projectId: string): Promise<void>;
133
+ stopAllAgents(): Promise<void>;
134
+ getAgentStatus(projectId: string): AgentStatus;
135
+ isRunning(projectId: string): boolean;
136
+ isQueued(projectId: string): boolean;
137
+ getResourceStatus(): AgentResourceStatus;
138
+ removeFromQueue(projectId: string): void;
139
+ getTrackedProcesses(): TrackedProcessInfo[];
140
+ cleanupOrphanProcesses(): Promise<OrphanCleanupResult>;
141
+ on<K extends keyof AgentManagerEvents>(event: K, listener: AgentManagerEvents[K]): void;
142
+ off<K extends keyof AgentManagerEvents>(event: K, listener: AgentManagerEvents[K]): void;
143
+ private setupAgentListeners;
144
+ private handleAgentExit;
145
+ private handleStatusChange;
146
+ private processQueue;
147
+ private saveContextUsageIfNeeded;
148
+ private emit;
149
+ }
150
+ //# sourceMappingURL=agent-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-manager.d.ts","sourceRoot":"","sources":["../../src/agents/agent-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EAEX,YAAY,EACZ,WAAW,EACX,SAAS,EACT,WAAW,EACX,YAAY,EACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,iBAAiB,EAEjB,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,oBAAoB,EACpB,aAAa,EAGd,MAAM,aAAa,CAAC;AAGrB,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;IAC5D,MAAM,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IACzD,WAAW,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;IAC9C,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,KAAK,IAAI,CAAC;IACvE,kBAAkB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACzF,eAAe,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7F,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CACl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