aicodeman 0.2.8
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/LICENSE +21 -0
- package/README.md +403 -0
- package/dist/ai-checker-base.d.ts +175 -0
- package/dist/ai-checker-base.d.ts.map +1 -0
- package/dist/ai-checker-base.js +424 -0
- package/dist/ai-checker-base.js.map +1 -0
- package/dist/ai-idle-checker.d.ts +53 -0
- package/dist/ai-idle-checker.d.ts.map +1 -0
- package/dist/ai-idle-checker.js +141 -0
- package/dist/ai-idle-checker.js.map +1 -0
- package/dist/ai-plan-checker.d.ts +52 -0
- package/dist/ai-plan-checker.d.ts.map +1 -0
- package/dist/ai-plan-checker.js +103 -0
- package/dist/ai-plan-checker.js.map +1 -0
- package/dist/bash-tool-parser.d.ts +191 -0
- package/dist/bash-tool-parser.d.ts.map +1 -0
- package/dist/bash-tool-parser.js +598 -0
- package/dist/bash-tool-parser.js.map +1 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +460 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/buffer-limits.d.ts +59 -0
- package/dist/config/buffer-limits.d.ts.map +1 -0
- package/dist/config/buffer-limits.js +74 -0
- package/dist/config/buffer-limits.js.map +1 -0
- package/dist/config/map-limits.d.ts +40 -0
- package/dist/config/map-limits.d.ts.map +1 -0
- package/dist/config/map-limits.js +52 -0
- package/dist/config/map-limits.js.map +1 -0
- package/dist/file-stream-manager.d.ts +148 -0
- package/dist/file-stream-manager.d.ts.map +1 -0
- package/dist/file-stream-manager.js +351 -0
- package/dist/file-stream-manager.js.map +1 -0
- package/dist/hooks-config.d.ts +31 -0
- package/dist/hooks-config.d.ts.map +1 -0
- package/dist/hooks-config.js +115 -0
- package/dist/hooks-config.js.map +1 -0
- package/dist/image-watcher.d.ts +86 -0
- package/dist/image-watcher.d.ts.map +1 -0
- package/dist/image-watcher.js +275 -0
- package/dist/image-watcher.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +54 -0
- package/dist/index.js.map +1 -0
- package/dist/mux-factory.d.ts +13 -0
- package/dist/mux-factory.d.ts.map +1 -0
- package/dist/mux-factory.js +19 -0
- package/dist/mux-factory.js.map +1 -0
- package/dist/mux-interface.d.ts +145 -0
- package/dist/mux-interface.d.ts.map +1 -0
- package/dist/mux-interface.js +9 -0
- package/dist/mux-interface.js.map +1 -0
- package/dist/plan-orchestrator.d.ts +123 -0
- package/dist/plan-orchestrator.d.ts.map +1 -0
- package/dist/plan-orchestrator.js +500 -0
- package/dist/plan-orchestrator.js.map +1 -0
- package/dist/prompts/index.d.ts +9 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +9 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/planner.d.ts +14 -0
- package/dist/prompts/planner.d.ts.map +1 -0
- package/dist/prompts/planner.js +83 -0
- package/dist/prompts/planner.js.map +1 -0
- package/dist/prompts/research-agent.d.ts +10 -0
- package/dist/prompts/research-agent.d.ts.map +1 -0
- package/dist/prompts/research-agent.js +143 -0
- package/dist/prompts/research-agent.js.map +1 -0
- package/dist/push-store.d.ts +41 -0
- package/dist/push-store.d.ts.map +1 -0
- package/dist/push-store.js +168 -0
- package/dist/push-store.js.map +1 -0
- package/dist/ralph-config.d.ts +67 -0
- package/dist/ralph-config.d.ts.map +1 -0
- package/dist/ralph-config.js +134 -0
- package/dist/ralph-config.js.map +1 -0
- package/dist/ralph-loop.d.ts +124 -0
- package/dist/ralph-loop.d.ts.map +1 -0
- package/dist/ralph-loop.js +418 -0
- package/dist/ralph-loop.js.map +1 -0
- package/dist/ralph-tracker.d.ts +1081 -0
- package/dist/ralph-tracker.d.ts.map +1 -0
- package/dist/ralph-tracker.js +3343 -0
- package/dist/ralph-tracker.js.map +1 -0
- package/dist/respawn-controller.d.ts +1182 -0
- package/dist/respawn-controller.d.ts.map +1 -0
- package/dist/respawn-controller.js +2754 -0
- package/dist/respawn-controller.js.map +1 -0
- package/dist/run-summary.d.ts +123 -0
- package/dist/run-summary.d.ts.map +1 -0
- package/dist/run-summary.js +325 -0
- package/dist/run-summary.js.map +1 -0
- package/dist/session-lifecycle-log.d.ts +36 -0
- package/dist/session-lifecycle-log.d.ts.map +1 -0
- package/dist/session-lifecycle-log.js +101 -0
- package/dist/session-lifecycle-log.js.map +1 -0
- package/dist/session-manager.d.ts +97 -0
- package/dist/session-manager.d.ts.map +1 -0
- package/dist/session-manager.js +224 -0
- package/dist/session-manager.js.map +1 -0
- package/dist/session.d.ts +686 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +2025 -0
- package/dist/session.js.map +1 -0
- package/dist/state-store.d.ts +189 -0
- package/dist/state-store.d.ts.map +1 -0
- package/dist/state-store.js +730 -0
- package/dist/state-store.js.map +1 -0
- package/dist/subagent-watcher.d.ts +345 -0
- package/dist/subagent-watcher.d.ts.map +1 -0
- package/dist/subagent-watcher.js +1469 -0
- package/dist/subagent-watcher.js.map +1 -0
- package/dist/task-queue.d.ts +108 -0
- package/dist/task-queue.d.ts.map +1 -0
- package/dist/task-queue.js +235 -0
- package/dist/task-queue.js.map +1 -0
- package/dist/task-tracker.d.ts +306 -0
- package/dist/task-tracker.d.ts.map +1 -0
- package/dist/task-tracker.js +488 -0
- package/dist/task-tracker.js.map +1 -0
- package/dist/task.d.ts +73 -0
- package/dist/task.d.ts.map +1 -0
- package/dist/task.js +177 -0
- package/dist/task.js.map +1 -0
- package/dist/team-watcher.d.ts +53 -0
- package/dist/team-watcher.d.ts.map +1 -0
- package/dist/team-watcher.js +313 -0
- package/dist/team-watcher.js.map +1 -0
- package/dist/templates/case-template.md +461 -0
- package/dist/templates/claude-md.d.ts +26 -0
- package/dist/templates/claude-md.d.ts.map +1 -0
- package/dist/templates/claude-md.js +74 -0
- package/dist/templates/claude-md.js.map +1 -0
- package/dist/tmux-manager.d.ts +181 -0
- package/dist/tmux-manager.d.ts.map +1 -0
- package/dist/tmux-manager.js +1405 -0
- package/dist/tmux-manager.js.map +1 -0
- package/dist/transcript-watcher.d.ts +110 -0
- package/dist/transcript-watcher.d.ts.map +1 -0
- package/dist/transcript-watcher.js +338 -0
- package/dist/transcript-watcher.js.map +1 -0
- package/dist/tunnel-manager.d.ts +54 -0
- package/dist/tunnel-manager.d.ts.map +1 -0
- package/dist/tunnel-manager.js +251 -0
- package/dist/tunnel-manager.js.map +1 -0
- package/dist/types.d.ts +1139 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +215 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/buffer-accumulator.d.ts +111 -0
- package/dist/utils/buffer-accumulator.d.ts.map +1 -0
- package/dist/utils/buffer-accumulator.js +172 -0
- package/dist/utils/buffer-accumulator.js.map +1 -0
- package/dist/utils/claude-cli-resolver.d.ts +26 -0
- package/dist/utils/claude-cli-resolver.d.ts.map +1 -0
- package/dist/utils/claude-cli-resolver.js +78 -0
- package/dist/utils/claude-cli-resolver.js.map +1 -0
- package/dist/utils/cleanup-manager.d.ts +165 -0
- package/dist/utils/cleanup-manager.d.ts.map +1 -0
- package/dist/utils/cleanup-manager.js +274 -0
- package/dist/utils/cleanup-manager.js.map +1 -0
- package/dist/utils/index.d.ts +19 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +19 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/lru-map.d.ts +140 -0
- package/dist/utils/lru-map.d.ts.map +1 -0
- package/dist/utils/lru-map.js +234 -0
- package/dist/utils/lru-map.js.map +1 -0
- package/dist/utils/nice-wrapper.d.ts +13 -0
- package/dist/utils/nice-wrapper.d.ts.map +1 -0
- package/dist/utils/nice-wrapper.js +17 -0
- package/dist/utils/nice-wrapper.js.map +1 -0
- package/dist/utils/opencode-cli-resolver.d.ts +21 -0
- package/dist/utils/opencode-cli-resolver.d.ts.map +1 -0
- package/dist/utils/opencode-cli-resolver.js +67 -0
- package/dist/utils/opencode-cli-resolver.js.map +1 -0
- package/dist/utils/regex-patterns.d.ts +64 -0
- package/dist/utils/regex-patterns.d.ts.map +1 -0
- package/dist/utils/regex-patterns.js +74 -0
- package/dist/utils/regex-patterns.js.map +1 -0
- package/dist/utils/stale-expiration-map.d.ts +159 -0
- package/dist/utils/stale-expiration-map.d.ts.map +1 -0
- package/dist/utils/stale-expiration-map.js +277 -0
- package/dist/utils/stale-expiration-map.js.map +1 -0
- package/dist/utils/string-similarity.d.ts +108 -0
- package/dist/utils/string-similarity.d.ts.map +1 -0
- package/dist/utils/string-similarity.js +189 -0
- package/dist/utils/string-similarity.js.map +1 -0
- package/dist/utils/token-validation.d.ts +39 -0
- package/dist/utils/token-validation.d.ts.map +1 -0
- package/dist/utils/token-validation.js +59 -0
- package/dist/utils/token-validation.js.map +1 -0
- package/dist/utils/type-safety.d.ts +33 -0
- package/dist/utils/type-safety.d.ts.map +1 -0
- package/dist/utils/type-safety.js +35 -0
- package/dist/utils/type-safety.js.map +1 -0
- package/dist/web/public/app.js +491 -0
- package/dist/web/public/app.js.br +0 -0
- package/dist/web/public/app.js.gz +0 -0
- package/dist/web/public/index.html +1675 -0
- package/dist/web/public/index.html.br +0 -0
- package/dist/web/public/index.html.gz +0 -0
- package/dist/web/public/manifest.json +8 -0
- package/dist/web/public/mobile.css +1 -0
- package/dist/web/public/mobile.css.br +0 -0
- package/dist/web/public/mobile.css.gz +0 -0
- package/dist/web/public/ralph-wizard.js +1037 -0
- package/dist/web/public/ralph-wizard.js.br +0 -0
- package/dist/web/public/ralph-wizard.js.gz +0 -0
- package/dist/web/public/styles.css +1 -0
- package/dist/web/public/styles.css.br +0 -0
- package/dist/web/public/styles.css.gz +0 -0
- package/dist/web/public/sw.js +67 -0
- package/dist/web/public/sw.js.br +0 -0
- package/dist/web/public/sw.js.gz +0 -0
- package/dist/web/public/upload.html +155 -0
- package/dist/web/public/upload.html.br +0 -0
- package/dist/web/public/upload.html.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-fit.min.js +1 -0
- package/dist/web/public/vendor/xterm-addon-fit.min.js.br +0 -0
- package/dist/web/public/vendor/xterm-addon-fit.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-unicode11.min.js +1 -0
- package/dist/web/public/vendor/xterm-addon-unicode11.min.js.br +0 -0
- package/dist/web/public/vendor/xterm-addon-unicode11.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-webgl.min.js +2 -0
- package/dist/web/public/vendor/xterm-addon-webgl.min.js.br +0 -0
- package/dist/web/public/vendor/xterm-addon-webgl.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm.css +209 -0
- package/dist/web/public/vendor/xterm.css.br +0 -0
- package/dist/web/public/vendor/xterm.css.gz +0 -0
- package/dist/web/public/vendor/xterm.min.js +9 -0
- package/dist/web/public/vendor/xterm.min.js.br +0 -0
- package/dist/web/public/vendor/xterm.min.js.gz +0 -0
- package/dist/web/schemas.d.ts +479 -0
- package/dist/web/schemas.d.ts.map +1 -0
- package/dist/web/schemas.js +448 -0
- package/dist/web/schemas.js.map +1 -0
- package/dist/web/server.d.ts +207 -0
- package/dist/web/server.d.ts.map +1 -0
- package/dist/web/server.js +5784 -0
- package/dist/web/server.js.map +1 -0
- package/package.json +110 -0
- package/scripts/postinstall.js +390 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Claudeman Contributors
|
|
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,403 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/images/codeman-title.svg" alt="Codeman" height="60">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h2 align="center">The missing control plane for AI coding agents</h2>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<em>Agent Visualization • Zero-Lag Input Overlay • Mobile-First UI • Respawn Controller • Multi-Session Dashboard </em>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-1e3a5f?style=flat-square" alt="License: MIT"></a>
|
|
13
|
+
<a href="https://nodejs.org/"><img src="https://img.shields.io/badge/Node.js-18%2B-22c55e?style=flat-square&logo=node.js&logoColor=white" alt="Node.js 18+"></a>
|
|
14
|
+
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-5.5-3b82f6?style=flat-square&logo=typescript&logoColor=white" alt="TypeScript 5.5"></a>
|
|
15
|
+
<a href="https://fastify.dev/"><img src="https://img.shields.io/badge/Fastify-5.x-1e3a5f?style=flat-square&logo=fastify&logoColor=white" alt="Fastify"></a>
|
|
16
|
+
<img src="https://img.shields.io/badge/Tests-1435%20total-22c55e?style=flat-square" alt="Tests">
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
<p align="center">
|
|
20
|
+
<img src="docs/images/subagent-demo.gif" alt="Codeman — parallel subagent visualization" width="900">
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Quick Start - Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
curl -fsSL https://raw.githubusercontent.com/Ark0N/Codeman/master/install.sh | bash
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
This installs Node.js and tmux if missing, clones Codeman to `~/.codeman/app`, and builds it. You'll need at least one AI coding CLI installed — [Claude Code](https://docs.anthropic.com/en/docs/claude-code) or [OpenCode](https://opencode.ai) (or both). After install:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
codeman web
|
|
35
|
+
# Open http://localhost:3000 — press Ctrl+Enter to start your first session
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Update to latest version:**
|
|
39
|
+
```bash
|
|
40
|
+
curl -fsSL https://raw.githubusercontent.com/Ark0N/Codeman/master/install.sh | bash -s update
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
<details>
|
|
44
|
+
<summary><strong>Run as a background service</strong></summary>
|
|
45
|
+
|
|
46
|
+
**Linux (systemd):**
|
|
47
|
+
```bash
|
|
48
|
+
mkdir -p ~/.config/systemd/user && printf '[Unit]\nDescription=Codeman Web Server\nAfter=network.target\n\n[Service]\nType=simple\nExecStart=%s %s/dist/index.js web\nRestart=always\nRestartSec=10\n\n[Install]\nWantedBy=default.target\n' "$(which node)" "$HOME/.codeman/app" > ~/.config/systemd/user/codeman-web.service && systemctl --user daemon-reload && systemctl --user enable --now codeman-web && loginctl enable-linger $USER
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**macOS (launchd):**
|
|
52
|
+
```bash
|
|
53
|
+
mkdir -p ~/Library/LaunchAgents && printf '<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n<plist version="1.0"><dict><key>Label</key><string>com.codeman.web</string><key>ProgramArguments</key><array><string>%s</string><string>%s/dist/index.js</string><string>web</string></array><key>RunAtLoad</key><true/><key>KeepAlive</key><true/><key>StandardOutPath</key><string>/tmp/codeman.log</string><key>StandardErrorPath</key><string>/tmp/codeman.log</string></dict></plist>\n' "$(which node)" "$HOME/.codeman/app" > ~/Library/LaunchAgents/com.codeman.web.plist && launchctl load ~/Library/LaunchAgents/com.codeman.web.plist
|
|
54
|
+
```
|
|
55
|
+
</details>
|
|
56
|
+
|
|
57
|
+
<details>
|
|
58
|
+
<summary><strong>Windows (WSL)</strong></summary>
|
|
59
|
+
|
|
60
|
+
```powershell
|
|
61
|
+
wsl bash -c "curl -fsSL https://raw.githubusercontent.com/Ark0N/Codeman/master/install.sh | bash"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Codeman requires tmux, so Windows users need [WSL](https://learn.microsoft.com/en-us/windows/wsl/install). If you don't have WSL yet: run `wsl --install` in an admin PowerShell, reboot, open Ubuntu, then install your preferred AI coding CLI inside WSL ([Claude Code](https://docs.anthropic.com/en/docs/claude-code) or [OpenCode](https://opencode.ai)). After installing, `http://localhost:3000` is accessible from your Windows browser.
|
|
65
|
+
</details>
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Mobile-Optimized Web UI
|
|
70
|
+
|
|
71
|
+
The most responsive AI coding agent experience on any phone. Full xterm.js terminal with local echo, swipe navigation, and a touch-optimized interface designed for real remote work.
|
|
72
|
+
|
|
73
|
+
<table>
|
|
74
|
+
<tr>
|
|
75
|
+
<td rowspan="8" width="320"><img src="docs/screenshots/mobile-keyboard-open.png" alt="Mobile — keyboard open" width="300"></td>
|
|
76
|
+
<th>Terminal Apps</th>
|
|
77
|
+
<th>Codeman Mobile</th>
|
|
78
|
+
</tr>
|
|
79
|
+
<tr><td>200-300ms input lag over remote</td><td><b>Local echo — instant feedback</b></td></tr>
|
|
80
|
+
<tr><td>Tiny text, no context</td><td>Full xterm.js terminal</td></tr>
|
|
81
|
+
<tr><td>No session management</td><td>Swipe between sessions</td></tr>
|
|
82
|
+
<tr><td>No notifications</td><td>Push alerts for approvals and idle</td></tr>
|
|
83
|
+
<tr><td>Manual reconnect</td><td>tmux persistence</td></tr>
|
|
84
|
+
<tr><td>No agent visibility</td><td>Background agents in real-time</td></tr>
|
|
85
|
+
<tr><td>Copy-paste slash commands</td><td>One-tap <code>/init</code></tr>
|
|
86
|
+
</table>
|
|
87
|
+
|
|
88
|
+
- **Swipe navigation** — left/right on the terminal to switch sessions (80px threshold, 300ms)
|
|
89
|
+
- **Keyboard accessory bar** — `/init`, `/clear`, `/compact` quick-action buttons above the virtual keyboard. Destructive commands (`/clear`, `/compact`) require a double-press to confirm — first tap arms the button, second tap executes — so you never fire one by accident on a bumpy commute
|
|
90
|
+
- **Smart keyboard handling** — toolbar and terminal shift up when keyboard opens (uses `visualViewport` API with 100px threshold for iOS address bar drift)
|
|
91
|
+
- **Safe area support** — respects iPhone notch and home indicator via `env(safe-area-inset-*)`
|
|
92
|
+
- **44px touch targets** — all buttons meet iOS Human Interface Guidelines minimum sizes
|
|
93
|
+
- **Bottom sheet case picker** — slide-up modal replaces the desktop dropdown
|
|
94
|
+
- **Native momentum scrolling** — `-webkit-overflow-scrolling: touch` for buttery scroll
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
codeman web --https
|
|
98
|
+
# Open on your phone: https://<your-ip>:3000
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
> `localhost` works over plain HTTP. Use `--https` when accessing from another device, or use [Tailscale](https://tailscale.com/) (recommended) — it provides a private network so you can access `http://<tailscale-ip>:3000` from your phone without TLS certificates.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Live Agent Visualization
|
|
106
|
+
|
|
107
|
+
Watch background agents work in real-time. Codeman monitors agent activity and displays each agent in a draggable floating window with animated Matrix-style connection lines back to the parent session.
|
|
108
|
+
|
|
109
|
+
<p align="center">
|
|
110
|
+
<img src="docs/images/subagent-spawn.png" alt="Subagent Visualization" width="900">
|
|
111
|
+
</p>
|
|
112
|
+
|
|
113
|
+
- **Floating terminal windows** — draggable, resizable panels for each agent with a live activity log showing every tool call, file read, and progress update as it happens
|
|
114
|
+
- **Connection lines** — animated green lines linking parent sessions to their child agents, updating in real-time as agents spawn and complete
|
|
115
|
+
- **Status & model badges** — green (active), yellow (idle), blue (completed) indicators with Haiku/Sonnet/Opus model color coding
|
|
116
|
+
- **Auto-behavior** — windows auto-open on spawn, auto-minimize on completion, tab badge shows "AGENT" or "AGENTS (n)" count
|
|
117
|
+
- **Nested agents** — supports 3-level hierarchies (lead session -> teammate agents -> sub-subagents)
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Zero-Lag Input Overlay
|
|
122
|
+
|
|
123
|
+
When accessing your coding agent remotely (VPN, Tailscale, SSH tunnel), every keystroke normally takes 200-300ms to round-trip. Codeman implements a **Mosh-inspired local echo system** that makes typing feel instant regardless of latency.
|
|
124
|
+
|
|
125
|
+
A pixel-perfect DOM overlay inside xterm.js renders keystrokes at 0ms. Background forwarding silently sends every character to the PTY in 50ms debounced batches, so Tab completion, `Ctrl+R` history search, and all shell features work normally. When the server echo arrives 200-300ms later, the overlay seamlessly disappears and the real terminal text takes over — the transition is invisible.
|
|
126
|
+
|
|
127
|
+
- **Ink-proof architecture** — lives as a `<span>` at z-index 7 inside `.xterm-screen`, completely immune to Ink's constant screen redraws (two previous attempts using `terminal.write()` failed because Ink corrupts injected buffer content)
|
|
128
|
+
- **Font-matched rendering** — reads `fontFamily`, `fontSize`, `fontWeight`, and `letterSpacing` from xterm.js computed styles so overlay text is visually indistinguishable from real terminal output
|
|
129
|
+
- **Full editing** — backspace, retype, paste (multi-char), cursor tracking, multi-line wrap when input exceeds terminal width
|
|
130
|
+
- **Persistent across reconnects** — unsent input survives page reloads via localStorage
|
|
131
|
+
- **Enabled by default** — works on both desktop and mobile, during idle and busy sessions
|
|
132
|
+
|
|
133
|
+
> Extracted as a standalone library: [`xterm-zerolag-input`](https://www.npmjs.com/package/xterm-zerolag-input) — see [Published Packages](#published-packages).
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Respawn Controller
|
|
138
|
+
|
|
139
|
+
The core of autonomous work. When the agent goes idle, the Respawn Controller detects it, sends a continue prompt, cycles context management commands for fresh context, and resumes — running **24+ hours** completely unattended.
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
WATCHING → IDLE DETECTED → SEND UPDATE → /clear → /init → CONTINUE → WATCHING
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
- **Multi-layer idle detection** — completion messages, AI-powered idle check, output silence, token stability
|
|
146
|
+
- **Circuit breaker** — prevents respawn thrashing when Claude is stuck (CLOSED -> HALF_OPEN -> OPEN states, tracks consecutive no-progress and repeated errors)
|
|
147
|
+
- **Health scoring** — 0-100 health score with component scores for cycle success, circuit breaker state, iteration progress, and stuck recovery
|
|
148
|
+
- **Built-in presets** — `solo-work` (3s idle, 60min), `subagent-workflow` (45s, 240min), `team-lead` (90s, 480min), `ralph-todo` (8s, 480min), `overnight-autonomous` (10s, 480min)
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Multi-Session Dashboard
|
|
153
|
+
|
|
154
|
+
Run **20 parallel sessions** with full visibility — real-time xterm.js terminals at 60fps, per-session token and cost tracking, tab-based navigation, and one-click management.
|
|
155
|
+
|
|
156
|
+
<p align="center">
|
|
157
|
+
<img src="docs/screenshots/multi-session-dashboard.png" alt="Multi-Session Dashboard" width="800">
|
|
158
|
+
</p>
|
|
159
|
+
|
|
160
|
+
### Persistent Sessions
|
|
161
|
+
|
|
162
|
+
Every session runs inside **tmux** — sessions survive server restarts, network drops, and machine sleep. Auto-recovery on startup with dual redundancy. Ghost session discovery finds orphaned tmux sessions. Managed sessions are environment-tagged so the agent won't kill its own session.
|
|
163
|
+
|
|
164
|
+
### Smart Token Management
|
|
165
|
+
|
|
166
|
+
| Threshold | Action | Result |
|
|
167
|
+
|-----------|--------|--------|
|
|
168
|
+
| **110k tokens** | Auto `/compact` | Context summarized, work continues |
|
|
169
|
+
| **140k tokens** | Auto `/clear` | Fresh start with `/init` |
|
|
170
|
+
|
|
171
|
+
### Notifications
|
|
172
|
+
|
|
173
|
+
Real-time desktop alerts when sessions need attention — `permission_prompt` and `elicitation_dialog` trigger critical red tab blinks, `idle_prompt` triggers yellow blinks. Click any notification to jump directly to the affected session. Hooks auto-configured per case directory.
|
|
174
|
+
|
|
175
|
+
### Ralph / Todo Tracking
|
|
176
|
+
|
|
177
|
+
Auto-detects Ralph Loops, `<promise>` tags, TodoWrite progress (`4/9 complete`), and iteration counters (`[5/50]`) with real-time progress rings and elapsed time tracking.
|
|
178
|
+
|
|
179
|
+
<p align="center">
|
|
180
|
+
<img src="docs/images/ralph-tracker-8tasks-44percent.png" alt="Ralph Loop Tracking" width="800">
|
|
181
|
+
</p>
|
|
182
|
+
|
|
183
|
+
### Run Summary
|
|
184
|
+
|
|
185
|
+
Click the chart icon on any session tab to see a timeline of everything that happened — respawn cycles, token milestones, auto-compact triggers, idle/working transitions, hook events, errors, and more.
|
|
186
|
+
|
|
187
|
+
### Zero-Flicker Terminal
|
|
188
|
+
|
|
189
|
+
Terminal-based AI agents (Claude Code's Ink, OpenCode's Bubble Tea) redraw the screen on every state change. Codeman implements a 6-layer anti-flicker pipeline for smooth 60fps output across all sessions:
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
PTY Output → 16ms Server Batch → DEC 2026 Wrap → SSE → Client rAF → xterm.js (60fps)
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Remote Access — Cloudflare Tunnel
|
|
198
|
+
|
|
199
|
+
Access Codeman from your phone or any device outside your local network using a free [Cloudflare quick tunnel](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/do-more-with-tunnels/trycloudflare/) — no port forwarding, no DNS, no static IP required.
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
Browser (phone/tablet) → Cloudflare Edge (HTTPS) → cloudflared → localhost:3000
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**Prerequisites:** Install [`cloudflared`](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/) and set `CODEMAN_PASSWORD` in your environment.
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
# Quick start
|
|
209
|
+
./scripts/tunnel.sh start # Start tunnel, prints public URL
|
|
210
|
+
./scripts/tunnel.sh url # Show current URL
|
|
211
|
+
./scripts/tunnel.sh stop # Stop tunnel
|
|
212
|
+
./scripts/tunnel.sh status # Service status + URL
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
The script auto-installs a systemd user service on first run. The tunnel URL is a randomly generated `*.trycloudflare.com` address that changes each time the tunnel restarts.
|
|
216
|
+
|
|
217
|
+
<details>
|
|
218
|
+
<summary><strong>Persistent tunnel (survives reboots)</strong></summary>
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
# Enable as a persistent service
|
|
222
|
+
systemctl --user enable codeman-tunnel
|
|
223
|
+
loginctl enable-linger $USER
|
|
224
|
+
|
|
225
|
+
# Or via the Codeman web UI: Settings → Tunnel → Toggle On
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
</details>
|
|
229
|
+
|
|
230
|
+
<details>
|
|
231
|
+
<summary><strong>Authentication</strong></summary>
|
|
232
|
+
|
|
233
|
+
1. First request → browser shows Basic Auth prompt (username: `admin` or `CODEMAN_USERNAME`)
|
|
234
|
+
2. On success → server issues a `codeman_session` cookie (24h TTL, auto-extends on activity)
|
|
235
|
+
3. Subsequent requests authenticate silently via cookie
|
|
236
|
+
4. 10 failed attempts per IP → 429 rate limit (15-minute decay)
|
|
237
|
+
|
|
238
|
+
**Always set `CODEMAN_PASSWORD`** before exposing via tunnel — without it, anyone with the URL has full access to your sessions.
|
|
239
|
+
|
|
240
|
+
</details>
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## SSH Alternative (`sc`)
|
|
245
|
+
|
|
246
|
+
If you prefer SSH (Termius, Blink, etc.), the `sc` command is a thumb-friendly session chooser:
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
sc # Interactive chooser
|
|
250
|
+
sc 2 # Quick attach to session 2
|
|
251
|
+
sc -l # List sessions
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
Single-digit selection (1-9), color-coded status, token counts, auto-refresh. Detach with `Ctrl+A D`.
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## Keyboard Shortcuts
|
|
259
|
+
|
|
260
|
+
| Shortcut | Action |
|
|
261
|
+
|----------|--------|
|
|
262
|
+
| `Ctrl+Enter` | Quick-start session |
|
|
263
|
+
| `Ctrl+W` | Close session |
|
|
264
|
+
| `Ctrl+Tab` | Next session |
|
|
265
|
+
| `Ctrl+K` | Kill all sessions |
|
|
266
|
+
| `Ctrl+L` | Clear terminal |
|
|
267
|
+
| `Ctrl+Shift+R` | Restore terminal size |
|
|
268
|
+
| `Ctrl/Cmd +/-` | Font size |
|
|
269
|
+
| `Escape` | Close panels |
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## API
|
|
274
|
+
|
|
275
|
+
### Sessions
|
|
276
|
+
| Method | Endpoint | Description |
|
|
277
|
+
|--------|----------|-------------|
|
|
278
|
+
| `GET` | `/api/sessions` | List all |
|
|
279
|
+
| `POST` | `/api/quick-start` | Create case + start session |
|
|
280
|
+
| `DELETE` | `/api/sessions/:id` | Delete session |
|
|
281
|
+
| `POST` | `/api/sessions/:id/input` | Send input |
|
|
282
|
+
|
|
283
|
+
### Respawn
|
|
284
|
+
| Method | Endpoint | Description |
|
|
285
|
+
|--------|----------|-------------|
|
|
286
|
+
| `POST` | `/api/sessions/:id/respawn/enable` | Enable with config + timer |
|
|
287
|
+
| `POST` | `/api/sessions/:id/respawn/stop` | Stop controller |
|
|
288
|
+
| `PUT` | `/api/sessions/:id/respawn/config` | Update config |
|
|
289
|
+
|
|
290
|
+
### Ralph / Todo
|
|
291
|
+
| Method | Endpoint | Description |
|
|
292
|
+
|--------|----------|-------------|
|
|
293
|
+
| `GET` | `/api/sessions/:id/ralph-state` | Get loop state + todos |
|
|
294
|
+
| `POST` | `/api/sessions/:id/ralph-config` | Configure tracking |
|
|
295
|
+
|
|
296
|
+
### Subagents
|
|
297
|
+
| Method | Endpoint | Description |
|
|
298
|
+
|--------|----------|-------------|
|
|
299
|
+
| `GET` | `/api/subagents` | List all background agents |
|
|
300
|
+
| `GET` | `/api/subagents/:id` | Agent info and status |
|
|
301
|
+
| `GET` | `/api/subagents/:id/transcript` | Full activity transcript |
|
|
302
|
+
| `DELETE` | `/api/subagents/:id` | Kill agent process |
|
|
303
|
+
|
|
304
|
+
### System
|
|
305
|
+
| Method | Endpoint | Description |
|
|
306
|
+
|--------|----------|-------------|
|
|
307
|
+
| `GET` | `/api/events` | SSE stream |
|
|
308
|
+
| `GET` | `/api/status` | Full app state |
|
|
309
|
+
| `POST` | `/api/hook-event` | Hook callbacks |
|
|
310
|
+
| `GET` | `/api/sessions/:id/run-summary` | Timeline + stats |
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
## Architecture
|
|
315
|
+
|
|
316
|
+
```mermaid
|
|
317
|
+
flowchart TB
|
|
318
|
+
subgraph Codeman["CODEMAN"]
|
|
319
|
+
subgraph Frontend["Frontend Layer"]
|
|
320
|
+
UI["Web UI<br/><small>xterm.js + Agent Windows</small>"]
|
|
321
|
+
API["REST API<br/><small>Fastify</small>"]
|
|
322
|
+
SSE["SSE Events<br/><small>/api/events</small>"]
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
subgraph Core["Core Layer"]
|
|
326
|
+
SM["Session Manager"]
|
|
327
|
+
S1["Session (PTY)"]
|
|
328
|
+
S2["Session (PTY)"]
|
|
329
|
+
RC["Respawn Controller"]
|
|
330
|
+
end
|
|
331
|
+
|
|
332
|
+
subgraph Detection["Detection Layer"]
|
|
333
|
+
RT["Ralph Tracker"]
|
|
334
|
+
SW["Subagent Watcher<br/><small>~/.claude/projects/*/subagents</small>"]
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
subgraph Persistence["Persistence Layer"]
|
|
338
|
+
SCR["Mux Manager<br/><small>(tmux)</small>"]
|
|
339
|
+
SS["State Store<br/><small>state.json</small>"]
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
subgraph External["External"]
|
|
343
|
+
CLI["AI CLI<br/><small>Claude Code / OpenCode</small>"]
|
|
344
|
+
BG["Background Agents<br/><small>(Task tool)</small>"]
|
|
345
|
+
end
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
UI <--> API
|
|
349
|
+
API <--> SSE
|
|
350
|
+
API --> SM
|
|
351
|
+
SM --> S1
|
|
352
|
+
SM --> S2
|
|
353
|
+
SM --> RC
|
|
354
|
+
SM --> SS
|
|
355
|
+
S1 --> RT
|
|
356
|
+
S1 --> SCR
|
|
357
|
+
S2 --> SCR
|
|
358
|
+
RC --> SCR
|
|
359
|
+
SCR --> CLI
|
|
360
|
+
SW --> BG
|
|
361
|
+
SW --> SSE
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
## Development
|
|
367
|
+
|
|
368
|
+
```bash
|
|
369
|
+
npm install
|
|
370
|
+
npx tsx src/index.ts web # Dev mode
|
|
371
|
+
npm run build # Production build
|
|
372
|
+
npm test # Run tests
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
See [CLAUDE.md](./CLAUDE.md) for full documentation.
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
379
|
+
## Published Packages
|
|
380
|
+
|
|
381
|
+
### [`xterm-zerolag-input`](https://www.npmjs.com/package/xterm-zerolag-input)
|
|
382
|
+
|
|
383
|
+
[](https://www.npmjs.com/package/xterm-zerolag-input)
|
|
384
|
+
|
|
385
|
+
Instant keystroke feedback overlay for xterm.js. Eliminates perceived input latency over high-RTT connections by rendering typed characters immediately as a pixel-perfect DOM overlay. Zero dependencies, configurable prompt detection, full state machine with 78 tests.
|
|
386
|
+
|
|
387
|
+
```bash
|
|
388
|
+
npm install xterm-zerolag-input
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
[Full documentation](packages/xterm-zerolag-input/README.md)
|
|
392
|
+
|
|
393
|
+
---
|
|
394
|
+
|
|
395
|
+
## License
|
|
396
|
+
|
|
397
|
+
MIT — see [LICENSE](LICENSE)
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
<p align="center">
|
|
402
|
+
<strong>Track sessions. Visualize agents. Control respawn. Let it run while you sleep.</strong>
|
|
403
|
+
</p>
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Base Class for AI Checker Components
|
|
3
|
+
*
|
|
4
|
+
* Provides shared functionality for AI-powered checkers that spawn fresh Claude CLI
|
|
5
|
+
* sessions to analyze terminal output. This base class handles:
|
|
6
|
+
* - Mux session spawning and cleanup
|
|
7
|
+
* - Temp file management for output capture
|
|
8
|
+
* - Polling for completion markers
|
|
9
|
+
* - Cooldown management
|
|
10
|
+
* - Error handling and consecutive error tracking
|
|
11
|
+
* - Event emission for state changes
|
|
12
|
+
*
|
|
13
|
+
* Subclasses implement:
|
|
14
|
+
* - `muxNamePrefix`: Prefix for mux session names (e.g., 'codeman-aicheck-')
|
|
15
|
+
* - `doneMarker`: Completion marker in output file (e.g., '__AICHECK_DONE__')
|
|
16
|
+
* - `tempFilePrefix`: Prefix for temp files (e.g., 'codeman-aicheck')
|
|
17
|
+
* - `logPrefix`: Prefix for log messages (e.g., '[AiIdleChecker]')
|
|
18
|
+
* - `buildPrompt()`: Build the prompt from terminal buffer
|
|
19
|
+
* - `parseVerdict()`: Parse the verdict from AI output
|
|
20
|
+
* - `getPositiveVerdict()`: Return the "positive" verdict that doesn't trigger cooldown
|
|
21
|
+
* - `defaultConfig`: Default configuration values
|
|
22
|
+
*
|
|
23
|
+
* @module ai-checker-base
|
|
24
|
+
*/
|
|
25
|
+
import { EventEmitter } from 'node:events';
|
|
26
|
+
/** Base configuration shared by all AI checkers */
|
|
27
|
+
export interface AiCheckerConfigBase {
|
|
28
|
+
/** Whether the checker is enabled */
|
|
29
|
+
enabled: boolean;
|
|
30
|
+
/** Model to use for the check */
|
|
31
|
+
model: string;
|
|
32
|
+
/** Maximum characters of terminal buffer to send */
|
|
33
|
+
maxContextChars: number;
|
|
34
|
+
/** Timeout for the check in ms */
|
|
35
|
+
checkTimeoutMs: number;
|
|
36
|
+
/** Cooldown after negative verdict in ms */
|
|
37
|
+
cooldownMs: number;
|
|
38
|
+
/** Cooldown after errors in ms */
|
|
39
|
+
errorCooldownMs: number;
|
|
40
|
+
/** Max consecutive errors before disabling */
|
|
41
|
+
maxConsecutiveErrors: number;
|
|
42
|
+
}
|
|
43
|
+
/** Status values shared by all AI checkers */
|
|
44
|
+
export type AiCheckerStatus = 'ready' | 'checking' | 'cooldown' | 'disabled' | 'error';
|
|
45
|
+
/** Base result structure for all AI checkers */
|
|
46
|
+
export interface AiCheckerResultBase<V extends string> {
|
|
47
|
+
verdict: V;
|
|
48
|
+
reasoning: string;
|
|
49
|
+
durationMs: number;
|
|
50
|
+
}
|
|
51
|
+
/** Base state structure for all AI checkers */
|
|
52
|
+
export interface AiCheckerStateBase<V extends string> {
|
|
53
|
+
status: AiCheckerStatus;
|
|
54
|
+
lastVerdict: V | null;
|
|
55
|
+
lastReasoning: string | null;
|
|
56
|
+
lastCheckDurationMs: number | null;
|
|
57
|
+
cooldownEndsAt: number | null;
|
|
58
|
+
consecutiveErrors: number;
|
|
59
|
+
totalChecks: number;
|
|
60
|
+
disabledReason: string | null;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Abstract base class for AI-powered checkers.
|
|
64
|
+
* Handles spawning Claude CLI in a mux session to analyze terminal output.
|
|
65
|
+
*
|
|
66
|
+
* @template V - The verdict type (e.g., 'IDLE' | 'WORKING' | 'ERROR')
|
|
67
|
+
* @template C - The configuration type
|
|
68
|
+
* @template R - The result type
|
|
69
|
+
* @template S - The state type
|
|
70
|
+
*/
|
|
71
|
+
export declare abstract class AiCheckerBase<V extends string, C extends AiCheckerConfigBase, R extends AiCheckerResultBase<V>, S extends AiCheckerStateBase<V>> extends EventEmitter {
|
|
72
|
+
protected config: C;
|
|
73
|
+
protected sessionId: string;
|
|
74
|
+
protected _status: AiCheckerStatus;
|
|
75
|
+
protected lastVerdict: V | null;
|
|
76
|
+
protected lastReasoning: string | null;
|
|
77
|
+
protected lastCheckDurationMs: number | null;
|
|
78
|
+
protected cooldownEndsAt: number | null;
|
|
79
|
+
protected cooldownTimer: NodeJS.Timeout | null;
|
|
80
|
+
protected consecutiveErrors: number;
|
|
81
|
+
protected totalChecks: number;
|
|
82
|
+
protected disabledReason: string | null;
|
|
83
|
+
protected checkMuxName: string | null;
|
|
84
|
+
protected checkTempFile: string | null;
|
|
85
|
+
protected checkPromptFile: string | null;
|
|
86
|
+
protected checkPollTimer: NodeJS.Timeout | null;
|
|
87
|
+
protected checkTimeoutTimer: NodeJS.Timeout | null;
|
|
88
|
+
protected checkStartTime: number;
|
|
89
|
+
protected checkCancelled: boolean;
|
|
90
|
+
protected checkResolve: ((result: R) => void) | null;
|
|
91
|
+
/** Prefix for mux session names (e.g., 'codeman-aicheck-') */
|
|
92
|
+
protected abstract readonly muxNamePrefix: string;
|
|
93
|
+
/** Marker written to temp file when check is complete */
|
|
94
|
+
protected abstract readonly doneMarker: string;
|
|
95
|
+
/** Prefix for temp files (e.g., 'codeman-aicheck') */
|
|
96
|
+
protected abstract readonly tempFilePrefix: string;
|
|
97
|
+
/** Prefix for log messages (e.g., '[AiIdleChecker]') */
|
|
98
|
+
protected abstract readonly logPrefix: string;
|
|
99
|
+
/** Description for log messages (e.g., 'AI idle check', 'AI plan check') */
|
|
100
|
+
protected abstract readonly checkDescription: string;
|
|
101
|
+
/**
|
|
102
|
+
* Build the prompt to send to Claude.
|
|
103
|
+
* @param terminalBuffer - The trimmed and stripped terminal buffer
|
|
104
|
+
* @returns The complete prompt string
|
|
105
|
+
*/
|
|
106
|
+
protected abstract buildPrompt(terminalBuffer: string): string;
|
|
107
|
+
/**
|
|
108
|
+
* Parse the verdict from Claude's output.
|
|
109
|
+
* @param output - The raw output from Claude (without done marker)
|
|
110
|
+
* @returns The parsed verdict and reasoning, or null if unparseable
|
|
111
|
+
*/
|
|
112
|
+
protected abstract parseVerdict(output: string): {
|
|
113
|
+
verdict: V;
|
|
114
|
+
reasoning: string;
|
|
115
|
+
} | null;
|
|
116
|
+
/**
|
|
117
|
+
* Get the "positive" verdict that indicates success and doesn't trigger cooldown.
|
|
118
|
+
* For idle checker this is 'IDLE', for plan checker this is 'PLAN_MODE'.
|
|
119
|
+
*/
|
|
120
|
+
protected abstract getPositiveVerdict(): V;
|
|
121
|
+
/**
|
|
122
|
+
* Get the "negative" verdict that triggers cooldown.
|
|
123
|
+
* For idle checker this is 'WORKING', for plan checker this is 'NOT_PLAN_MODE'.
|
|
124
|
+
*/
|
|
125
|
+
protected abstract getNegativeVerdict(): V;
|
|
126
|
+
/**
|
|
127
|
+
* Get the error verdict value.
|
|
128
|
+
*/
|
|
129
|
+
protected abstract getErrorVerdict(): V;
|
|
130
|
+
/**
|
|
131
|
+
* Create an error result.
|
|
132
|
+
*/
|
|
133
|
+
protected abstract createErrorResult(reasoning: string, durationMs: number): R;
|
|
134
|
+
/**
|
|
135
|
+
* Create a success result.
|
|
136
|
+
*/
|
|
137
|
+
protected abstract createResult(verdict: V, reasoning: string, durationMs: number): R;
|
|
138
|
+
constructor(sessionId: string, defaultConfig: C, config?: Partial<C>);
|
|
139
|
+
/** Get the current status */
|
|
140
|
+
get status(): AiCheckerStatus;
|
|
141
|
+
/** Get comprehensive state for UI display */
|
|
142
|
+
getState(): S;
|
|
143
|
+
/** Check if the checker is on cooldown */
|
|
144
|
+
isOnCooldown(): boolean;
|
|
145
|
+
/** Get remaining cooldown time in ms */
|
|
146
|
+
getCooldownRemainingMs(): number;
|
|
147
|
+
/**
|
|
148
|
+
* Run an AI check against the provided terminal buffer.
|
|
149
|
+
* Spawns a fresh Claude CLI in a tmux session, captures output to temp file.
|
|
150
|
+
*
|
|
151
|
+
* @param terminalBuffer - Raw terminal output to analyze
|
|
152
|
+
* @returns The verdict result
|
|
153
|
+
*/
|
|
154
|
+
check(terminalBuffer: string): Promise<R>;
|
|
155
|
+
/**
|
|
156
|
+
* Cancel an in-progress check.
|
|
157
|
+
* Kills the mux session and cleans up.
|
|
158
|
+
*/
|
|
159
|
+
cancel(): void;
|
|
160
|
+
/** Reset all state for a new cycle */
|
|
161
|
+
reset(): void;
|
|
162
|
+
/** Update configuration at runtime */
|
|
163
|
+
updateConfig(config: Partial<C>): void;
|
|
164
|
+
/** Get current config */
|
|
165
|
+
getConfig(): C;
|
|
166
|
+
private runCheck;
|
|
167
|
+
private parseOutput;
|
|
168
|
+
private cleanupCheck;
|
|
169
|
+
private handleError;
|
|
170
|
+
private startCooldown;
|
|
171
|
+
private clearCooldown;
|
|
172
|
+
private disable;
|
|
173
|
+
private log;
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=ai-checker-base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-checker-base.d.ts","sourceRoot":"","sources":["../src/ai-checker-base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAMH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA4B3C,mDAAmD;AACnD,MAAM,WAAW,mBAAmB;IAClC,qCAAqC;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