herdr-plugin-amq 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.
- package/LICENSE +21 -0
- package/README.md +263 -0
- package/bin/herdr-amq.mjs +74 -0
- package/herdr-plugin.toml +57 -0
- package/package.json +50 -0
- package/skills/herdr-amq/SKILL.md +69 -0
- package/src/actions.mjs +573 -0
- package/src/blobs.mjs +348 -0
- package/src/board.mjs +760 -0
- package/src/bridge.mjs +373 -0
- package/src/briefs.mjs +201 -0
- package/src/config.mjs +146 -0
- package/src/herdr.mjs +215 -0
- package/src/index.mjs +4 -0
- package/src/markdown.mjs +167 -0
- package/src/panes.mjs +68 -0
- package/src/protocol.mjs +347 -0
- package/src/server.mjs +773 -0
- package/src/store.mjs +1063 -0
- package/src/web/app.js +3066 -0
- package/src/web/index.html +727 -0
- package/src/web/style.css +3842 -0
- package/src/worktrees.mjs +217 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 cabra.lat
|
|
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,263 @@
|
|
|
1
|
+
# Herdr AMQ Plugin
|
|
2
|
+
|
|
3
|
+
[](https://github.com/cabra-lat/herdr-plugin-amq/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/cabra-lat/herdr-plugin-amq/actions/workflows/security.yml)
|
|
5
|
+
[](https://github.com/cabra-lat/herdr-plugin-amq)
|
|
6
|
+
[](https://github.com/cabra-lat/herdr-plugin-amq)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
[](https://vibecoded.fyi/)
|
|
9
|
+
|
|
10
|
+
> **The asynchronous nervous system for autonomous AI agent swarms in [Herdr](https://herdr.dev/).**
|
|
11
|
+
> Combines native pure-JS Maildir inter-agent messaging, an autonomous **Doorbell Bridge**, decentralized file-based task coordination, and the **AGmail** webmail dashboard.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## The Origin & The Problem
|
|
16
|
+
|
|
17
|
+
> *"If you follow AI news, you have probably seen endless hype around 'multi-agent swarms' talking to each other... That is cute for a 30-second screen recording. In a real codebase with actual physics, compiler errors, and Git history, it is a complete disaster."*
|
|
18
|
+
> — Read the full story: [**My AI Agents Send Me Emails: Office Drama in a Godot Repo**](https://cabra.pw/my-ai-agents-send-me-emails.html)
|
|
19
|
+
|
|
20
|
+
When coordinating swarms of AI coding agents across complex codebases, synchronous chat rooms and blocking `wait` loops fall apart:
|
|
21
|
+
1. **Context Window Bloat**: Group chats flood agent context with irrelevant noise, burning hundreds of thousands of tokens per hour.
|
|
22
|
+
2. **Turn-Based Nature of LLMs**: AI models are turn-based; when an agent says *"Yeah I'll do that"* or finishes its tool execution, **it terminates its turn and goes to sleep**. It cannot run a busy-wait loop.
|
|
23
|
+
3. **Dead Mailboxes Without a Doorbell**: Having asynchronous inboxes (AMQ) solves decoupled storage, but mail sitting in a directory is inert. If an agent is asleep, incoming messages sit unread forever.
|
|
24
|
+
|
|
25
|
+
### The Missing Piece: The Doorbell Bridge
|
|
26
|
+
|
|
27
|
+
This plugin bridges **AMQ** (the persistent storage) and **Herdr** (the terminal multiplexer and agent lifecycle supervisor).
|
|
28
|
+
|
|
29
|
+
The **Bridge Daemon** continuously inspects agent inboxes. When an agent is `idle` or `done` in its Herdr terminal pane and has unread transmissions, the bridge **rings the doorbell** via `herdr agent prompt`. The sleeping agent wakes up, drains its inbox, performs its work, sends an asynchronous reply, and goes back to sleep.
|
|
30
|
+
|
|
31
|
+
```mermaid
|
|
32
|
+
flowchart TD
|
|
33
|
+
subgraph Storage ["Persistent Transport Layer"]
|
|
34
|
+
AMQ[".agent-mail/ (Maildir + RFC 5322)<br/>Decoupled Markdown Transmissions"]
|
|
35
|
+
BUS[".opencode/bus/ (Decentralized Task Cards)<br/>backlog/ → doing/ → blocked/ → done/"]
|
|
36
|
+
CAS[".agent-mail/blobs/ (CAS Blobstore)<br/>SHA-256 Render Strips & Proofs"]
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
subgraph Bridge ["The Autonomous Nervous System"]
|
|
40
|
+
DAEMON["Bridge Daemon (herdr-amq bridge-daemon)<br/>Watches mailboxes & checks Herdr agent states"]
|
|
41
|
+
DOORBELL{"Agent Status in Herdr?"}
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
subgraph Execution ["Herdr PTY / Terminal Swarm"]
|
|
45
|
+
H_BUSY["working → Leave alone (no spam)"]
|
|
46
|
+
H_BLOCKED["blocked → Alert coordinator / human"]
|
|
47
|
+
H_IDLE["idle / done → RING DOORBELL<br/>(herdr agent prompt)"]
|
|
48
|
+
AGENT["Awakened Agent<br/>1. herdr-amq drain --me <handle><br/>2. Executes task in isolated worktree<br/>3. herdr-amq send / reply --id ...<br/>4. Goes back to sleep"]
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
subgraph Oversight ["Human-in-the-Loop & Mission Control"]
|
|
52
|
+
AGMAIL["AGmail Webmail & Kanban Dashboard<br/>http://127.0.0.1:8505 (Strictly Local)"]
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
AMQ -->|New mail arrives| DAEMON
|
|
56
|
+
DAEMON --> DOORBELL
|
|
57
|
+
DOORBELL -->|working| H_BUSY
|
|
58
|
+
DOORBELL -->|blocked| H_BLOCKED
|
|
59
|
+
DOORBELL -->|idle/done| H_IDLE
|
|
60
|
+
H_IDLE --> AGENT
|
|
61
|
+
AGENT -->|Sends mail + CAS attachments| AMQ
|
|
62
|
+
AGENT -->|Claims / updates tasks| BUS
|
|
63
|
+
AGENT -->|Pins render artifacts| CAS
|
|
64
|
+
AMQ -.->|Monitored & inspected by| AGMAIL
|
|
65
|
+
BUS -.->|Rendered live in Kanban| AGMAIL
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Key Features
|
|
71
|
+
|
|
72
|
+
### 1. The Autonomous Doorbell Bridge
|
|
73
|
+
- **Lifecycle-Aware Wakeups**: Rings doorbells (`herdr agent prompt`) only when agents are `idle` or `done`, preventing command interleaving during active turns.
|
|
74
|
+
- **De-duplication**: Tracks delivered message IDs in persistent state (`bridge-state.json`) so agents are never doorbelled twice for the same mail.
|
|
75
|
+
- **Self-Healing Panes**: Automatically detects and renames desynced terminal titles back to their canonical agent handles (`herdr agent rename`).
|
|
76
|
+
- **Blocked State Alerts**: When an agent with unread mail is blocked on external input, logs actionable alert directives for human intervention.
|
|
77
|
+
|
|
78
|
+
### 2. Pure-JS Maildir & RFC 5322 Engine (Zero Runtime Dependencies)
|
|
79
|
+
- **100% Self-Contained ESM**: No external Go binary, Python scripts, or npm supply-chain dependencies required.
|
|
80
|
+
- **DJB Atomic Delivery**: Uses classic `tmp/` -> `new/` atomic filesystem renames to prevent partial reads or race conditions between concurrent agents.
|
|
81
|
+
- **RFC 5322 In-Reply-To & References**: Full thread tracking and conversation reconstruction from standard message headers.
|
|
82
|
+
|
|
83
|
+
### 3. AGmail Dashboard (Mission Control)
|
|
84
|
+
- **Authentic Webmail Interface**: Real folders (Inbox, Sent, Drafts, Starred, Trash) powered by live Maildir storage.
|
|
85
|
+
- **Rich Visual Attachment Cards**: Previews render strips, PNG contact sheets, and test output generated by headless tools (like Godot via VirtualGL) directly in email threads.
|
|
86
|
+
- **Interactive Kanban Board**: Visual task lane tracking (`backlog/`, `doing/`, `blocked/`, `done/`) with real-time SSE updates.
|
|
87
|
+
- **Human-in-the-Loop Interventions**: Compose and inject executive orders directly into the swarm's queue from your browser.
|
|
88
|
+
- **Fuzzy Search & Filtering**: Fast multi-attribute filtering (`from:spotter with-images:true kind:status`).
|
|
89
|
+
|
|
90
|
+
### 4. Git Worktree Isolation & Task Bus
|
|
91
|
+
- **Multi-Lane Isolation**: Automatically provisions and manages dedicated Git worktrees (`.worktrees/<agent>`) so parallel agents never step on each other's unstaged files.
|
|
92
|
+
- **Decentralized File-Based Task Cards**: Directory-based task bus (`.opencode/bus/`) immune to concurrent merge conflicts.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Requirements
|
|
97
|
+
|
|
98
|
+
- **Node.js** >= 18
|
|
99
|
+
- **[Herdr](https://herdr.dev/)** >= 0.7.0 *(Terminal workspace manager & agent lifecycle supervisor)*
|
|
100
|
+
- **Zero npm runtime dependencies**
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Installation & Linking
|
|
105
|
+
|
|
106
|
+
Link the plugin into your local Herdr configuration:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Clone or navigate to the repository
|
|
110
|
+
cd herdr-plugin-amq
|
|
111
|
+
|
|
112
|
+
# Link into Herdr
|
|
113
|
+
herdr plugin link .
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Verify that the plugin and its actions are active:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
herdr plugin list
|
|
120
|
+
herdr plugin action list --plugin cabra.amq
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Herdr Actions & Keybindings
|
|
126
|
+
|
|
127
|
+
Add keybindings to `~/.config/herdr/config.toml` for instant access:
|
|
128
|
+
|
|
129
|
+
```toml
|
|
130
|
+
[[keys.command]]
|
|
131
|
+
key = "prefix+m"
|
|
132
|
+
type = "plugin_action"
|
|
133
|
+
command = "cabra.amq.bridge-status"
|
|
134
|
+
description = "Check AMQ mailbox status"
|
|
135
|
+
|
|
136
|
+
[[keys.command]]
|
|
137
|
+
key = "prefix+M"
|
|
138
|
+
type = "plugin_action"
|
|
139
|
+
command = "cabra.amq.doorbell-check"
|
|
140
|
+
description = "Ring AMQ doorbells for idle agents"
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Available Plugin Actions
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# Check queue status, active daemon, and unread mail per agent
|
|
147
|
+
herdr plugin action invoke cabra.amq.bridge-status
|
|
148
|
+
|
|
149
|
+
# Start background bridge daemon
|
|
150
|
+
herdr plugin action invoke cabra.amq.bridge-start
|
|
151
|
+
|
|
152
|
+
# Stop background bridge daemon
|
|
153
|
+
herdr plugin action invoke cabra.amq.bridge-stop
|
|
154
|
+
|
|
155
|
+
# Trigger an immediate one-shot doorbell check
|
|
156
|
+
herdr plugin action invoke cabra.amq.doorbell-check
|
|
157
|
+
|
|
158
|
+
# Launch the AGmail webmail dashboard
|
|
159
|
+
herdr plugin action invoke cabra.amq.open-dashboard
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Herdr Terminal Panes
|
|
163
|
+
|
|
164
|
+
Open modal terminal panes inside Herdr:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# Fast terminal inbox peek popup
|
|
168
|
+
herdr plugin pane open --plugin cabra.amq --entrypoint inbox-popup
|
|
169
|
+
|
|
170
|
+
# Dashboard server in dedicated pane
|
|
171
|
+
herdr plugin pane open --plugin cabra.amq --entrypoint dashboard
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## CLI Reference (`herdr-amq`)
|
|
177
|
+
|
|
178
|
+
The plugin ships an executable CLI dispatcher (`bin/herdr-amq.mjs`) used by both agents and operators:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# Start AGmail webmail dashboard (default: http://127.0.0.1:8505)
|
|
182
|
+
herdr-amq dashboard
|
|
183
|
+
|
|
184
|
+
# Start the continuous bridge daemon
|
|
185
|
+
herdr-amq bridge-daemon
|
|
186
|
+
|
|
187
|
+
# Messaging
|
|
188
|
+
herdr-amq send --to spotter --subject "Check ADS alignment" --body @/tmp/prompt.txt
|
|
189
|
+
herdr-amq reply --id 20260922-120000-001@swarm --body "Approved. Commit with explicit pathspec."
|
|
190
|
+
herdr-amq drain --me coordinator
|
|
191
|
+
|
|
192
|
+
# Decentralized Kanban Task Bus
|
|
193
|
+
herdr-amq task list
|
|
194
|
+
herdr-amq task claim TSK-402 --me worker-alpha
|
|
195
|
+
herdr-amq task done TSK-402 --proof "Proof of Sabotage: INV-29 passed with non-zero exit on mutation"
|
|
196
|
+
herdr-amq task block TSK-402 --reason "Waiting on asset import lock"
|
|
197
|
+
|
|
198
|
+
# Print or install the agentic skill
|
|
199
|
+
herdr-amq --skill
|
|
200
|
+
herdr-amq --skill --install .opencode/skills/herdr-amq
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Agentic Skill Integration
|
|
206
|
+
|
|
207
|
+
AI coding agents (Antigravity, Claude Code, OpenCode, Aider) can consume the skill definition directly to learn the protocol without human instruction:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
# Output full YAML-frontmattered SKILL.md
|
|
211
|
+
herdr-amq --skill
|
|
212
|
+
|
|
213
|
+
# Auto-install directly into your workspace
|
|
214
|
+
herdr-amq --skill --install .opencode/skills/herdr-amq/SKILL.md
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Security & Threat Model (Strictly Local-Only)
|
|
220
|
+
|
|
221
|
+
> [!CAUTION]
|
|
222
|
+
> **The AGmail dashboard and AMQ bridge are strictly local development tools.**
|
|
223
|
+
> Because agent communications contain source code, system prompts, execution logs, and orchestration commands, **this interface must never be exposed to public networks, WANs, or untrusted LANs.**
|
|
224
|
+
|
|
225
|
+
By design, `herdr-plugin-amq` implements strict defense-in-depth protections verified by continuous red-team exploit tests:
|
|
226
|
+
|
|
227
|
+
* **Exclusive Loopback Binding**: The HTTP server strictly binds to `127.0.0.1` IPv4 loopback (dropping non-local external TCP requests at the OS level).
|
|
228
|
+
* **DNS Rebinding Protection**: Inspects the HTTP `Host` header on every request. Any foreign domain (e.g. `attacker.com` pointing to 127.0.0.1) receives immediate `403 Forbidden`.
|
|
229
|
+
* **Null-Byte Injection Neutralization**: Any request containing `%00` or `\0` is blocked with `403 Forbidden`.
|
|
230
|
+
* **Mandatory Security Headers**: Injected on all HTTP responses:
|
|
231
|
+
- `X-Content-Type-Options: nosniff` (prevents MIME-type confusion attacks)
|
|
232
|
+
- `X-Frame-Options: DENY` (anti-clickjacking)
|
|
233
|
+
- `Referrer-Policy: no-referrer` (prevents URL leakage)
|
|
234
|
+
- `Content-Security-Policy: frame-ancestors 'none';`
|
|
235
|
+
* **Path Traversal Jailing**: Strict `isPathSafe` resolution disallows reading outside authorized workspace/scratch trees and strictly forbids access to `.ssh`, `.env`, `/etc/passwd`, credentials, or `.git/config`.
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## Testing & Quality Assurance
|
|
240
|
+
|
|
241
|
+
Our test suite adheres to high-rigor standards with zero external test runners:
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
# Run 95 automated unit, integration, simulation & security tests
|
|
245
|
+
npm test
|
|
246
|
+
|
|
247
|
+
# Run red-team security penetration audit suite
|
|
248
|
+
npm run test:security
|
|
249
|
+
|
|
250
|
+
# Run tests with experimental coverage reporting (80%+ lines and functions)
|
|
251
|
+
npm run test:coverage
|
|
252
|
+
|
|
253
|
+
# Validate JavaScript module syntax across all files
|
|
254
|
+
npm run check
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Automated GitHub Actions CI validates compatibility across **Node 18.x, 20.x, and 22.x** on both **Ubuntu** and **macOS**, alongside a dedicated **Security Compliance & Red-Team Audit** workflow.
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## License
|
|
262
|
+
|
|
263
|
+
MIT © [Cabra](https://cabra.pw)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
handleStatus,
|
|
4
|
+
handleStart,
|
|
5
|
+
handleStop,
|
|
6
|
+
handleDoorbell,
|
|
7
|
+
handleStartup,
|
|
8
|
+
handleAgentStatusChanged,
|
|
9
|
+
handleTaskCommand,
|
|
10
|
+
handleMailCommand,
|
|
11
|
+
handleSkillCommand,
|
|
12
|
+
} from "../src/actions.mjs";
|
|
13
|
+
import { startDaemonLoop } from "../src/bridge.mjs";
|
|
14
|
+
import { launchDashboardPane, launchInboxPeekPane } from "../src/panes.mjs";
|
|
15
|
+
|
|
16
|
+
const cmd = process.argv[2] || "status";
|
|
17
|
+
|
|
18
|
+
switch (cmd) {
|
|
19
|
+
case "status":
|
|
20
|
+
handleStatus();
|
|
21
|
+
break;
|
|
22
|
+
case "start":
|
|
23
|
+
handleStart();
|
|
24
|
+
break;
|
|
25
|
+
case "stop":
|
|
26
|
+
handleStop();
|
|
27
|
+
break;
|
|
28
|
+
case "doorbell":
|
|
29
|
+
handleDoorbell();
|
|
30
|
+
break;
|
|
31
|
+
case "startup":
|
|
32
|
+
handleStartup();
|
|
33
|
+
break;
|
|
34
|
+
case "on-agent-status-changed":
|
|
35
|
+
handleAgentStatusChanged();
|
|
36
|
+
break;
|
|
37
|
+
case "bridge-daemon":
|
|
38
|
+
startDaemonLoop();
|
|
39
|
+
break;
|
|
40
|
+
case "dashboard":
|
|
41
|
+
case "server":
|
|
42
|
+
case "pane-dashboard":
|
|
43
|
+
launchDashboardPane();
|
|
44
|
+
break;
|
|
45
|
+
case "pane-inbox":
|
|
46
|
+
launchInboxPeekPane();
|
|
47
|
+
break;
|
|
48
|
+
case "task":
|
|
49
|
+
case "tasks":
|
|
50
|
+
case "board":
|
|
51
|
+
handleTaskCommand(process.argv[3], process.argv.slice(4));
|
|
52
|
+
break;
|
|
53
|
+
case "mail":
|
|
54
|
+
handleMailCommand(process.argv[3], process.argv.slice(4));
|
|
55
|
+
break;
|
|
56
|
+
case "send":
|
|
57
|
+
handleMailCommand("send", process.argv.slice(3));
|
|
58
|
+
break;
|
|
59
|
+
case "reply":
|
|
60
|
+
handleMailCommand("reply", process.argv.slice(3));
|
|
61
|
+
break;
|
|
62
|
+
case "drain":
|
|
63
|
+
handleMailCommand("drain", process.argv.slice(3));
|
|
64
|
+
break;
|
|
65
|
+
case "--skill":
|
|
66
|
+
case "-s":
|
|
67
|
+
case "skill":
|
|
68
|
+
handleSkillCommand(process.argv.slice(3));
|
|
69
|
+
break;
|
|
70
|
+
default:
|
|
71
|
+
console.error(`Unknown command: ${cmd}`);
|
|
72
|
+
console.log("Available commands: status, start, stop, doorbell, startup, pane-dashboard, pane-inbox, task, mail, send, reply, drain, --skill");
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
id = "cabra.amq"
|
|
2
|
+
name = "Herdr AMQ"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
min_herdr_version = "0.7.0"
|
|
5
|
+
description = "Agent Message Queue (AMQ) bridge daemon, mailbox monitor, and dashboard for Herdr"
|
|
6
|
+
platforms = ["linux", "macos"]
|
|
7
|
+
|
|
8
|
+
[[startup]]
|
|
9
|
+
command = ["node", "bin/herdr-amq.mjs", "startup"]
|
|
10
|
+
|
|
11
|
+
[[actions]]
|
|
12
|
+
id = "bridge-status"
|
|
13
|
+
title = "AMQ Bridge Status"
|
|
14
|
+
contexts = ["workspace"]
|
|
15
|
+
command = ["node", "bin/herdr-amq.mjs", "status"]
|
|
16
|
+
|
|
17
|
+
[[actions]]
|
|
18
|
+
id = "bridge-start"
|
|
19
|
+
title = "Start AMQ Bridge Daemon"
|
|
20
|
+
contexts = ["workspace"]
|
|
21
|
+
command = ["node", "bin/herdr-amq.mjs", "start"]
|
|
22
|
+
|
|
23
|
+
[[actions]]
|
|
24
|
+
id = "bridge-stop"
|
|
25
|
+
title = "Stop AMQ Bridge Daemon"
|
|
26
|
+
contexts = ["workspace"]
|
|
27
|
+
command = ["node", "bin/herdr-amq.mjs", "stop"]
|
|
28
|
+
|
|
29
|
+
[[actions]]
|
|
30
|
+
id = "doorbell-check"
|
|
31
|
+
title = "Check AMQ Unread Mail and Ring Doorbells"
|
|
32
|
+
contexts = ["workspace"]
|
|
33
|
+
command = ["node", "bin/herdr-amq.mjs", "doorbell"]
|
|
34
|
+
|
|
35
|
+
[[actions]]
|
|
36
|
+
id = "open-dashboard"
|
|
37
|
+
title = "Open AGmail Webmail Dashboard"
|
|
38
|
+
contexts = ["workspace"]
|
|
39
|
+
command = ["node", "bin/herdr-amq.mjs", "dashboard"]
|
|
40
|
+
|
|
41
|
+
[[panes]]
|
|
42
|
+
id = "dashboard"
|
|
43
|
+
title = "AGmail Dashboard"
|
|
44
|
+
placement = "overlay"
|
|
45
|
+
command = ["node", "bin/herdr-amq.mjs", "pane-dashboard"]
|
|
46
|
+
|
|
47
|
+
[[panes]]
|
|
48
|
+
id = "inbox-popup"
|
|
49
|
+
title = "AMQ Inbox Peek"
|
|
50
|
+
placement = "popup"
|
|
51
|
+
width = "80%"
|
|
52
|
+
height = 24
|
|
53
|
+
command = ["node", "bin/herdr-amq.mjs", "pane-inbox"]
|
|
54
|
+
|
|
55
|
+
[[events]]
|
|
56
|
+
on = "pane.agent_status_changed"
|
|
57
|
+
command = ["node", "bin/herdr-amq.mjs", "on-agent-status-changed"]
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "herdr-plugin-amq",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Herdr plugin for AMQ (Agent Message Queue) autonomous bridge, status monitoring, and AGmail dashboard",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.mjs",
|
|
7
|
+
"bin": {
|
|
8
|
+
"herdr-amq": "bin/herdr-amq.mjs"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin/",
|
|
12
|
+
"src/",
|
|
13
|
+
"skills/",
|
|
14
|
+
"herdr-plugin.toml",
|
|
15
|
+
"README.md",
|
|
16
|
+
"LICENSE"
|
|
17
|
+
],
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=18.0.0"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"test": "node --test test/*.test.mjs",
|
|
23
|
+
"test:coverage": "mkdir -p coverage && node --test --experimental-test-coverage --test-reporter=spec --test-reporter=lcov --test-reporter-destination=stdout --test-reporter-destination=coverage/lcov.info test/*.test.mjs",
|
|
24
|
+
"check": "node --check bin/herdr-amq.mjs src/*.mjs test/*.test.mjs",
|
|
25
|
+
"test:security": "node --test test/security.test.mjs",
|
|
26
|
+
"coverage:summary": "node tools/coverage-summary.mjs",
|
|
27
|
+
"status": "node bin/herdr-amq.mjs status",
|
|
28
|
+
"start": "node bin/herdr-amq.mjs start",
|
|
29
|
+
"stop": "node bin/herdr-amq.mjs stop"
|
|
30
|
+
},
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "git+https://github.com/cabra-lat/herdr-plugin-amq.git"
|
|
34
|
+
},
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/cabra-lat/herdr-plugin-amq/issues"
|
|
37
|
+
},
|
|
38
|
+
"homepage": "https://github.com/cabra-lat/herdr-plugin-amq#readme",
|
|
39
|
+
"keywords": [
|
|
40
|
+
"herdr",
|
|
41
|
+
"herdr-plugin",
|
|
42
|
+
"amq",
|
|
43
|
+
"multi-agent",
|
|
44
|
+
"autonomous-agents",
|
|
45
|
+
"cas-blobstore",
|
|
46
|
+
"agmail"
|
|
47
|
+
],
|
|
48
|
+
"author": "cabra.lat",
|
|
49
|
+
"license": "MIT"
|
|
50
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: herdr-amq
|
|
3
|
+
description: Autonomous coordination, inter-agent messaging, task claiming, and CAS blob attachments via AMQ Maildir and Herdr. Use when communicating between agents, claiming board tasks, sending reports with attachments, or inspecting the live AGmail dashboard.
|
|
4
|
+
metadata:
|
|
5
|
+
short-description: AMQ Maildir & Herdr Multi-Agent Autonomous Coordination
|
|
6
|
+
compatibility: herdr, opencode, antigravity, claude-code, codex-cli
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Herdr AMQ Autonomous Coordination (`herdr-amq`)
|
|
10
|
+
|
|
11
|
+
`herdr-amq` provides native multi-agent messaging, decentralized task tracking, and immutable Content-Addressed Storage (CAS) attachments over standard Maildir queues (`.agent-mail/`) without requiring external binaries.
|
|
12
|
+
|
|
13
|
+
## Golden Rules for Agents
|
|
14
|
+
|
|
15
|
+
1. **Drain First**: Whenever awakened by a doorbell notification or starting a turn, drain your inbox before taking action:
|
|
16
|
+
```bash
|
|
17
|
+
herdr-amq mail drain --me <handle> --include-body
|
|
18
|
+
```
|
|
19
|
+
2. **Reply to the Sender**: Always reply to the sender on the same thread/ref chain. Never drop thread context:
|
|
20
|
+
```bash
|
|
21
|
+
herdr-amq mail reply --me <handle> --id <msg_id> --body "..."
|
|
22
|
+
```
|
|
23
|
+
3. **Atomic Task Claiming**: Claim cards from the directory bus before modifying shared code:
|
|
24
|
+
```bash
|
|
25
|
+
herdr-amq task list
|
|
26
|
+
herdr-amq task claim <task-id> --me <handle>
|
|
27
|
+
```
|
|
28
|
+
When finished, complete with proof:
|
|
29
|
+
```bash
|
|
30
|
+
herdr-amq task done <task-id> --proof "Tests passed (70/70), commit abc123"
|
|
31
|
+
```
|
|
32
|
+
If blocked, flag with reason:
|
|
33
|
+
```bash
|
|
34
|
+
herdr-amq task block <task-id> --reason "Waiting for schema migration"
|
|
35
|
+
```
|
|
36
|
+
4. **CAS Blob Attachments**: Use `--attach <path>` when sending logs, diffs, images, or test outputs. The file is automatically frozen into immutable Content-Addressed Storage (`.agent-mail/blobs/<sha256>`) and exposed via persistent HTTP URLs:
|
|
37
|
+
```bash
|
|
38
|
+
herdr-amq mail send --me <handle> --to coordinator --subject "Test run output" --body "Attached full test logs" --attach /tmp/shooter/test.log
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## CLI Reference
|
|
42
|
+
|
|
43
|
+
### Inter-Agent Mail (`herdr-amq mail` or shortcuts `send`, `reply`, `drain`)
|
|
44
|
+
|
|
45
|
+
| Command | Usage | Description |
|
|
46
|
+
|---|---|---|
|
|
47
|
+
| `drain` | `herdr-amq mail drain --me <handle> [--include-body]` | Atomic Maildir drain (moves `inbox/new` -> `inbox/cur`, marks seen) |
|
|
48
|
+
| `send` | `herdr-amq mail send --to <handle> --subject <subj> --body <text\|@file> [--me <handle>] [--attach <path>]` | Send an RFC 5322 message with optional CAS attachment |
|
|
49
|
+
| `reply` | `herdr-amq mail reply --id <msg_id> --body <text\|@file> [--me <handle>] [--attach <path>]` | Reply preserving `thread`, `in-reply-to`, and `references` |
|
|
50
|
+
|
|
51
|
+
### Task Board & Bus (`herdr-amq task`)
|
|
52
|
+
|
|
53
|
+
Operates against decentralized card files in `.opencode/bus/{backlog,doing,blocked,done}/`:
|
|
54
|
+
|
|
55
|
+
| Command | Usage | Description |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| `list` | `herdr-amq task list [--json]` | List cards grouped by column |
|
|
58
|
+
| `claim` | `herdr-amq task claim <task-id> --me <handle>` | Atomically moves card to `doing/<task-id>.md` and updates assignee |
|
|
59
|
+
| `done` | `herdr-amq task done <task-id> --proof "<proof>"` | Moves card to `done/` with timestamp, proof, and duration |
|
|
60
|
+
| `block` | `herdr-amq task block <task-id> --reason "<reason>"` | Moves card to `blocked/` with blocker reason |
|
|
61
|
+
|
|
62
|
+
### Bridge, Dashboard & Status
|
|
63
|
+
|
|
64
|
+
| Command | Usage | Description |
|
|
65
|
+
|---|---|---|
|
|
66
|
+
| `status` | `herdr-amq status` | Show bridge daemon status, unread counts per handle, and paths |
|
|
67
|
+
| `doorbell` | `herdr-amq doorbell` | Run a single doorbell pass alerting idle/blocked agents |
|
|
68
|
+
| `dashboard` | `herdr-amq dashboard [--port 8505]` | Launch web AGmail UI & REST API |
|
|
69
|
+
| `--skill` | `herdr-amq --skill [--install [dir]]` | Print or install this agentic skill definition |
|