agent-relay 0.1.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/README.md +56 -730
  2. package/dist/cli/index.d.ts +6 -1
  3. package/dist/cli/index.d.ts.map +1 -1
  4. package/dist/cli/index.js +109 -1521
  5. package/dist/cli/index.js.map +1 -1
  6. package/dist/daemon/server.d.ts +8 -1
  7. package/dist/daemon/server.d.ts.map +1 -1
  8. package/dist/daemon/server.js +23 -7
  9. package/dist/daemon/server.js.map +1 -1
  10. package/dist/index.d.ts +0 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +0 -1
  13. package/dist/index.js.map +1 -1
  14. package/dist/storage/adapter.d.ts +43 -0
  15. package/dist/storage/adapter.d.ts.map +1 -1
  16. package/dist/storage/adapter.js +105 -1
  17. package/dist/storage/adapter.js.map +1 -1
  18. package/dist/storage/sqlite-adapter.d.ts +1 -0
  19. package/dist/storage/sqlite-adapter.d.ts.map +1 -1
  20. package/dist/storage/sqlite-adapter.js +26 -0
  21. package/dist/storage/sqlite-adapter.js.map +1 -1
  22. package/dist/utils/project-namespace.d.ts +46 -0
  23. package/dist/utils/project-namespace.d.ts.map +1 -0
  24. package/dist/utils/project-namespace.js +111 -0
  25. package/dist/utils/project-namespace.js.map +1 -0
  26. package/dist/wrapper/client.d.ts +1 -1
  27. package/dist/wrapper/client.d.ts.map +1 -1
  28. package/dist/wrapper/client.js +1 -1
  29. package/dist/wrapper/client.js.map +1 -1
  30. package/dist/wrapper/index.d.ts +0 -1
  31. package/dist/wrapper/index.d.ts.map +1 -1
  32. package/dist/wrapper/index.js +2 -3
  33. package/dist/wrapper/index.js.map +1 -1
  34. package/dist/wrapper/tmux-wrapper.d.ts +5 -0
  35. package/dist/wrapper/tmux-wrapper.d.ts.map +1 -1
  36. package/dist/wrapper/tmux-wrapper.js +94 -19
  37. package/dist/wrapper/tmux-wrapper.js.map +1 -1
  38. package/docs/AGENTS.md +386 -0
  39. package/docs/CLI-SIMPLIFICATION-COMPLETE.md +48 -0
  40. package/docs/CONTRIBUTING.md +151 -0
  41. package/docs/TMUX_IMPLEMENTATION_NOTES.md +364 -0
  42. package/docs/removable-code-analysis.md +24 -0
  43. package/install.sh +10 -2
  44. package/package.json +3 -4
  45. package/dist/games/index.d.ts +0 -2
  46. package/dist/games/index.d.ts.map +0 -1
  47. package/dist/games/index.js +0 -2
  48. package/dist/games/index.js.map +0 -1
  49. package/dist/games/tictactoe.d.ts +0 -24
  50. package/dist/games/tictactoe.d.ts.map +0 -1
  51. package/dist/games/tictactoe.js +0 -160
  52. package/dist/games/tictactoe.js.map +0 -1
  53. package/dist/supervisor/inbox.d.ts +0 -38
  54. package/dist/supervisor/inbox.d.ts.map +0 -1
  55. package/dist/supervisor/inbox.js +0 -162
  56. package/dist/supervisor/inbox.js.map +0 -1
  57. package/dist/supervisor/index.d.ts +0 -10
  58. package/dist/supervisor/index.d.ts.map +0 -1
  59. package/dist/supervisor/index.js +0 -10
  60. package/dist/supervisor/index.js.map +0 -1
  61. package/dist/supervisor/spawner.d.ts +0 -54
  62. package/dist/supervisor/spawner.d.ts.map +0 -1
  63. package/dist/supervisor/spawner.js +0 -282
  64. package/dist/supervisor/spawner.js.map +0 -1
  65. package/dist/supervisor/state.d.ts +0 -132
  66. package/dist/supervisor/state.d.ts.map +0 -1
  67. package/dist/supervisor/state.js +0 -465
  68. package/dist/supervisor/state.js.map +0 -1
  69. package/dist/supervisor/supervisor.d.ts +0 -67
  70. package/dist/supervisor/supervisor.d.ts.map +0 -1
  71. package/dist/supervisor/supervisor.js +0 -263
  72. package/dist/supervisor/supervisor.js.map +0 -1
  73. package/dist/supervisor/types.d.ts +0 -139
  74. package/dist/supervisor/types.d.ts.map +0 -1
  75. package/dist/supervisor/types.js +0 -12
  76. package/dist/supervisor/types.js.map +0 -1
  77. package/dist/webhook/spawner.d.ts +0 -79
  78. package/dist/webhook/spawner.d.ts.map +0 -1
  79. package/dist/webhook/spawner.js +0 -288
  80. package/dist/webhook/spawner.js.map +0 -1
  81. package/dist/wrapper/pty-wrapper.d.ts +0 -125
  82. package/dist/wrapper/pty-wrapper.d.ts.map +0 -1
  83. package/dist/wrapper/pty-wrapper.js +0 -494
  84. package/dist/wrapper/pty-wrapper.js.map +0 -1
  85. /package/{CHANGELOG.md → docs/CHANGELOG.md} +0 -0
  86. /package/{PROTOCOL.md → docs/PROTOCOL.md} +0 -0
package/docs/AGENTS.md ADDED
@@ -0,0 +1,386 @@
1
+ * Use the `bd` tool instead of markdown to coordinate all work and tasks.
2
+ * NEVER commit changes unless the user explicitly asks you to.
3
+
4
+ # Using bv as an AI sidecar
5
+
6
+ bv is a fast terminal UI for Beads projects (.beads/beads.jsonl). It renders lists/details and precomputes dependency metrics (PageRank, critical path, cycles, etc.) so you instantly see blockers and execution order. For agents, it's a graph sidecar: instead of parsing JSONL or risking hallucinated traversal, call the robot flags to get deterministic, dependency-aware outputs.
7
+
8
+ *IMPORTANT: As an agent, you must ONLY use bv with the robot flags, otherwise you'll get stuck in the interactive TUI that's intended for human usage only!*
9
+
10
+ - bv --robot-help — shows all AI-facing commands.
11
+ - bv --robot-insights — JSON graph metrics (PageRank, betweenness, HITS, critical path, cycles) with top-N summaries for quick triage.
12
+ - bv --robot-plan — JSON execution plan: parallel tracks, items per track, and unblocks lists showing what each item frees up.
13
+ - bv --robot-priority — JSON priority recommendations with reasoning and confidence.
14
+ - bv --robot-recipes — list recipes (default, actionable, blocked, etc.); apply via bv --recipe <name> to pre-filter/sort before other flags.
15
+ - bv --robot-diff --diff-since <commit|date> — JSON diff of issue changes, new/closed items, and cycles introduced/resolved.
16
+
17
+ Use these commands instead of hand-rolling graph logic; bv already computes the hard parts so agents can act safely and quickly.
18
+
19
+ ## Integrating with Beads (dependency-aware task planning)
20
+
21
+ Beads provides a lightweight, dependency-aware issue database and a CLI (`bd`) for selecting "ready work," setting priorities, and tracking status. Project: [steveyegge/beads](https://github.com/steveyegge/beads)
22
+
23
+ Recommended conventions
24
+ - **Single source of truth**: Use **Beads** for task status/priority/dependencies.
25
+ - **Shared identifiers**: Use the Beads issue id (e.g., `bd-123`) as identifiers and prefix message subjects with `[bd-123]`.
26
+
27
+ Typical flow (agents)
28
+ 1) **Pick ready work** (Beads)
29
+ - `bd ready --json` → choose one item (highest priority, no blockers)
30
+ 2) **Announce start**
31
+ - Update status: `bd update <id> --status=in_progress`
32
+ 3) **Work and update**
33
+ - Make progress on the task
34
+ 4) **Complete**
35
+ - `bd close <id> --reason "Completed"` (Beads is status authority)
36
+
37
+ Pitfalls to avoid
38
+ - Don't create or manage tasks in markdown; treat Beads as the single task queue.
39
+ - Always include `bd-###` in commit messages for traceability.
40
+
41
+ ---
42
+
43
+ # Agent Instructions for agent-relay
44
+
45
+ > **Copy this file to your project** to enable AI agents to communicate with each other using agent-relay.
46
+
47
+ ## Overview
48
+
49
+ This project uses [agent-relay](https://github.com/khaliqgant/agent-relay) for real-time agent-to-agent messaging. There are two communication modes:
50
+
51
+ 1. **Tmux Wrapper Mode (Recommended)** - Real-time messaging via Unix sockets with tmux session management
52
+ 2. **File-Based Team Mode** - Asynchronous messaging via file system (simpler, more reliable)
53
+
54
+ ---
55
+
56
+ ## Quick Start: Tmux Wrapper (Recommended)
57
+
58
+ Use the tmux wrapper for real-time messaging:
59
+
60
+ ```bash
61
+ # Start daemon (dashboard starts automatically)
62
+ relay -f # foreground mode with dashboard
63
+
64
+ # Wrap your agent with tmux (real-time)
65
+ relay wrap -n PlayerX claude
66
+ relay wrap -n PlayerO claude
67
+ ```
68
+
69
+ ### Flags
70
+ - `-q, --quiet` - Disable debug logging
71
+ - `--no-dashboard` - Disable web dashboard
72
+ - `--stop` - Stop the daemon
73
+ - `--status` - Show daemon status
74
+
75
+ ### Why tmux?
76
+ - Real terminal: you attach directly to tmux (no double PTY).
77
+ - Background capture/parse of `@relay:` without touching stdout.
78
+ - Reliable injection via `tmux send-keys`.
79
+
80
+ ---
81
+
82
+ ## Team Communication
83
+
84
+ If you have an INSTRUCTIONS.md file in `/tmp/agent-relay-team/{YourName}/`, use these commands:
85
+
86
+ ```bash
87
+ # Check your inbox (non-blocking)
88
+ relay team check -n YourName --no-wait
89
+
90
+ # Send message to teammate
91
+ relay team send -n YourName -t RecipientName -m "Your message"
92
+
93
+ # Broadcast to all
94
+ relay team send -n YourName -t "*" -m "Your message"
95
+
96
+ # Team status
97
+ relay team status
98
+ ```
99
+
100
+ **Check your inbox periodically and broadcast status updates!**
101
+
102
+ ---
103
+
104
+ ## Quick Reference
105
+
106
+ ### Sending Messages (Real-Time Mode)
107
+
108
+ **Inline format** (simple messages):
109
+ ```
110
+ @relay:AgentName Your message here
111
+ @relay:* Broadcast to all agents
112
+ ```
113
+
114
+ **Block format** (structured data):
115
+ ```
116
+ [[RELAY]]{"to":"AgentName","type":"message","body":"Your message"}[[/RELAY]]
117
+ ```
118
+
119
+ ### Receiving Messages
120
+
121
+ Messages appear in your terminal as:
122
+ ```
123
+ Relay message from SenderName: Message content here
124
+ ```
125
+
126
+ Or in your inbox file as:
127
+ ```markdown
128
+ ## Message from SenderName | 2024-01-15T10:30:00Z
129
+ Message content here
130
+ ```
131
+
132
+ ---
133
+
134
+ ## Mode 1: Tmux Wrapper (Real-Time) - RECOMMENDED
135
+
136
+ Use this when you're wrapped with `relay wrap`.
137
+
138
+ ### CRITICAL: How to Send Messages
139
+
140
+ **You (the AI agent) must OUTPUT the @relay pattern as part of your response.** Do not wait for user input. The pattern is detected from your terminal output.
141
+
142
+ **Correct - Output this directly:**
143
+ ```
144
+ @relay:PlayerO I've finished the API refactor. Ready for your review.
145
+ ```
146
+
147
+ **Wrong - Don't use bash commands for real-time messaging:**
148
+ ```bash
149
+ # This uses file-based inbox, NOT real-time socket delivery
150
+ relay team send -n MyName -t PlayerO -m "message"
151
+ ```
152
+
153
+ ### Pattern Requirements
154
+
155
+ The `@relay:` pattern must appear on its own line. It can have common terminal/markdown prefixes:
156
+
157
+ ```
158
+ @relay:AgentName message Works
159
+ @relay:AgentName message Works (leading whitespace OK)
160
+ > @relay:AgentName message Works (input prompt OK)
161
+ $ @relay:AgentName message Works (shell prompt OK)
162
+ - @relay:AgentName message Works (list items OK)
163
+ * @relay:AgentName message Works (asterisk lists OK)
164
+ Some text @relay:AgentName msg Won't work (not at line start)
165
+ ```
166
+
167
+ ### Examples
168
+
169
+ **Direct message:**
170
+ ```
171
+ @relay:PlayerO Your turn! I played X at center.
172
+ ```
173
+
174
+ **Broadcast to all agents:**
175
+ ```
176
+ @relay:* I've completed the authentication module. Ready for review.
177
+ ```
178
+
179
+ **Structured data:**
180
+ ```
181
+ [[RELAY]]
182
+ {"to": "PlayerO", "type": "action", "body": "Task completed", "data": {"files": ["auth.ts"]}}
183
+ [[/RELAY]]
184
+ ```
185
+
186
+ ### Receiving Messages
187
+
188
+ When another agent sends you a message, it appears in your terminal as:
189
+ ```
190
+ Relay message from PlayerO: Their message content here
191
+ ```
192
+
193
+ Respond by outputting another `@relay:` pattern.
194
+
195
+ ### IMPORTANT: Handling Truncated Messages
196
+
197
+ Long messages (>500 chars) are truncated to prevent terminal flooding. You'll see:
198
+ ```
199
+ Relay message from PlayerO: Beginning of message... [TRUNCATED - run "relay read abc123def" for full message]
200
+ ```
201
+
202
+ **When you see a truncated message, you MUST run the command to read the full content:**
203
+ ```bash
204
+ relay read abc123def
205
+ ```
206
+
207
+ This retrieves the complete message from the database. Always do this before responding to ensure you have the full context.
208
+
209
+ ### Escaping
210
+
211
+ To output literal `@relay:` without triggering the parser:
212
+ ```
213
+ \@relay: This won't be sent as a message
214
+ ```
215
+
216
+ ---
217
+
218
+ ## Mode 2: File-Based Team Mode (Asynchronous)
219
+
220
+ Use this for scripts, automation, or when tmux wrapping isn't available.
221
+
222
+ ### Setup a Team
223
+
224
+ ```bash
225
+ # Create team from JSON config
226
+ relay team setup -f team-config.json
227
+
228
+ # Or use inline JSON
229
+ relay team setup -c '{"name":"myteam","agents":[{"name":"Dev","cli":"claude","role":"Developer"}]}'
230
+
231
+ # Start a team (setup + listen for messages)
232
+ relay team start -f team-config.json
233
+ ```
234
+
235
+ ### Sending Messages
236
+
237
+ ```bash
238
+ # Send to one agent
239
+ relay team send -n YourName -t RecipientName -m "Your message"
240
+
241
+ # Broadcast to all agents
242
+ relay team send -n YourName -t "*" -m "Broadcast message"
243
+ ```
244
+
245
+ ### Reading Messages
246
+
247
+ ```bash
248
+ # Read inbox (non-blocking)
249
+ relay team check -n YourName --no-wait
250
+
251
+ # Wait for messages (blocking)
252
+ relay team check -n YourName
253
+
254
+ # Read and clear inbox
255
+ relay team check -n YourName --clear
256
+ ```
257
+
258
+ ### Message Format in Inbox
259
+
260
+ Messages in your inbox file look like:
261
+ ```markdown
262
+ ## Message from SenderName | 2024-01-15T10:30:00Z
263
+ The actual message content here.
264
+
265
+ ## Message from AnotherAgent | 2024-01-15T10:31:00Z
266
+ Another message.
267
+ ```
268
+
269
+ ---
270
+
271
+ ## Available Commands
272
+
273
+ Just 4 commands:
274
+
275
+ | Command | Description |
276
+ |---------|-------------|
277
+ | `relay` | Start daemon + dashboard (`--no-dashboard` to disable, `--stop`, `--status`) |
278
+ | `relay wrap` | Wrap agent CLI with relay messaging |
279
+ | `relay team` | Team operations (subcommands below) |
280
+ | `relay read` | Read full message by ID (for truncated messages) |
281
+
282
+ ### Team Subcommands
283
+
284
+ | Subcommand | Description |
285
+ |------------|-------------|
286
+ | `relay team setup` | Create a team from JSON config |
287
+ | `relay team status` | Show team status with message counts |
288
+ | `relay team send` | Send message to teammate(s) |
289
+ | `relay team check` | Check your inbox |
290
+ | `relay team listen` | Watch inboxes and spawn agents on messages |
291
+ | `relay team start` | Start a team (setup + listen + spawn) |
292
+
293
+ ---
294
+
295
+ ## Message Types
296
+
297
+ | Type | Use Case |
298
+ |------|----------|
299
+ | `message` | General communication (default) |
300
+ | `action` | Commands, task assignments |
301
+ | `state` | Status updates, progress reports |
302
+ | `thinking` | Share reasoning (for transparency) |
303
+
304
+ ---
305
+
306
+ ## Coordination Patterns
307
+
308
+ ### Task Handoff
309
+
310
+ ```
311
+ @relay:Developer TASK: Implement user registration endpoint
312
+ Requirements:
313
+ - POST /api/register
314
+ - Validate email format
315
+ - Hash password with bcrypt
316
+ - Return JWT token
317
+ ```
318
+
319
+ ### Status Updates
320
+
321
+ ```
322
+ @relay:* STATUS: Starting work on authentication module
323
+ @relay:* DONE: Authentication module complete, ready for review
324
+ @relay:Reviewer REVIEW: Please review src/auth/*.ts
325
+ ```
326
+
327
+ ### Requesting Help
328
+
329
+ ```
330
+ @relay:Architect QUESTION: Should we use JWT or session-based auth?
331
+ @relay:* BLOCKED: Need database credentials to proceed
332
+ ```
333
+
334
+ ### Code Review Flow
335
+
336
+ ```
337
+ # Developer requests review
338
+ @relay:Reviewer REVIEW: src/api/users.ts - Added pagination support
339
+
340
+ # Reviewer provides feedback
341
+ @relay:Developer FEEDBACK: Line 45 - Consider using cursor-based pagination for better performance
342
+
343
+ # Developer confirms fix
344
+ @relay:Reviewer FIXED: Updated to cursor-based pagination, please re-review
345
+ ```
346
+
347
+ ---
348
+
349
+ ## Agent Naming
350
+
351
+ Agent names follow the AdjectiveNoun format:
352
+ - `BlueLake`, `GreenCastle`, `RedMountain`, `SwiftFalcon`
353
+
354
+ Names are auto-generated if not specified, or you can set your own with `-n`:
355
+ ```bash
356
+ relay wrap -n MyCustomName claude
357
+ ```
358
+
359
+ ---
360
+
361
+ ## Troubleshooting
362
+
363
+ | Issue | Solution |
364
+ |-------|----------|
365
+ | Messages not sending | Check daemon: `relay --status` |
366
+ | Inbox empty | Verify agent name and data directory |
367
+ | Socket not found | Start daemon: `relay -f` |
368
+ | Permission denied | Check data directory permissions |
369
+
370
+ ### Check Daemon Status
371
+ ```bash
372
+ relay --status
373
+ ```
374
+
375
+ ### Restart Daemon
376
+ ```bash
377
+ relay --stop && relay -f
378
+ ```
379
+
380
+ ---
381
+
382
+ ## More Information
383
+
384
+ - [Full Documentation](https://github.com/khaliqgant/agent-relay)
385
+ - [Protocol Specification](https://github.com/khaliqgant/agent-relay/blob/main/docs/PROTOCOL.md)
386
+ - [Examples](https://github.com/khaliqgant/agent-relay/tree/main/examples)
@@ -0,0 +1,48 @@
1
+ # CLI Simplification - Complete
2
+
3
+ ## Summary
4
+ Reduced CLI from **14 commands** to **4 commands**.
5
+
6
+ ## New CLI Structure
7
+
8
+ ```
9
+ relay # Start daemon + dashboard (default)
10
+ relay --no-dashboard # Start without dashboard
11
+ relay --stop # Stop daemon
12
+ relay --status # Check status
13
+ relay -f # Foreground mode
14
+
15
+ relay wrap <cmd> # Wrap agent CLI with messaging
16
+ relay wrap -n Name claude
17
+
18
+ relay team setup # Create team from JSON
19
+ relay team status # Show team status
20
+ relay team send # Send message
21
+ relay team check # Check inbox
22
+ relay team listen # Watch for messages
23
+ relay team start # All-in-one start
24
+
25
+ relay read <id> # Read full truncated message
26
+ ```
27
+
28
+ ## Files Changed
29
+ - `src/cli/index.ts` - Simplified main CLI (was 1100+ lines, now ~200)
30
+ - `src/cli/team.ts` - New team subcommand module
31
+ - `docs/AGENTS.md` - Updated documentation
32
+
33
+ ## Beads Tasks Closed
34
+ - agent-relay-cli-simplify (main issue)
35
+ - agent-relay-85z (dashboard → start)
36
+ - agent-relay-4ft (project → status)
37
+ - agent-relay-bd0 (team-* → team subcommand)
38
+ - agent-relay-f3q (msg-read → read)
39
+ - agent-relay-7yo (docs update)
40
+
41
+ ## Remaining
42
+ - agent-relay-8z1: Add CLI tests (optional)
43
+
44
+ ## Key Changes
45
+ 1. Dashboard starts by default (use --no-dashboard to disable)
46
+ 2. All team commands under `relay team` namespace
47
+ 3. Removed: project, send, dashboard as separate commands
48
+ 4. Status/stop are now flags on main command
@@ -0,0 +1,151 @@
1
+ # Contributing to agent-relay
2
+
3
+ Thank you for your interest in contributing to agent-relay! This document provides guidelines for contributing to the project.
4
+
5
+ ## Getting Started
6
+
7
+ ### Prerequisites
8
+
9
+ - Node.js >= 18 (20+ recommended)
10
+ - npm
11
+ - macOS or Linux (Windows support is not currently tested)
12
+
13
+ ### Development Setup
14
+
15
+ ```bash
16
+ # Clone the repository
17
+ git clone https://github.com/khaliqgant/agent-relay.git
18
+ cd agent-relay
19
+
20
+ # Install dependencies
21
+ npm install
22
+
23
+ # Build the project
24
+ npm run build
25
+
26
+ # Run tests
27
+ npm test
28
+
29
+ # Start development mode (watch for changes)
30
+ npm run dev
31
+ ```
32
+
33
+ ### Project Structure
34
+
35
+ ```
36
+ agent-relay/
37
+ ├── src/
38
+ │ ├── cli/ # CLI commands (start, wrap, send, etc.)
39
+ │ ├── daemon/ # Relay daemon and message router
40
+ │ ├── wrapper/ # PTY wrapper and message parsing
41
+ │ ├── supervisor/ # Spawn-per-message agent supervisor
42
+ │ ├── games/ # Game engines (Hearts, Tic-tac-toe)
43
+ │ └── utils/ # Utilities (name generator, etc.)
44
+ ├── examples/ # Usage examples
45
+ ├── dist/ # Compiled output
46
+ └── tests/ # Test files
47
+ ```
48
+
49
+ ## How to Contribute
50
+
51
+ ### Reporting Bugs
52
+
53
+ 1. Check if the bug has already been reported in [Issues](https://github.com/khaliqgant/agent-relay/issues)
54
+ 2. If not, create a new issue with:
55
+ - Clear, descriptive title
56
+ - Steps to reproduce
57
+ - Expected vs actual behavior
58
+ - Your environment (OS, Node version)
59
+ - Relevant logs or error messages
60
+
61
+ ### Suggesting Features
62
+
63
+ 1. Check existing issues and discussions first
64
+ 2. Open a new issue with the "feature request" label
65
+ 3. Describe the use case and proposed solution
66
+
67
+ ### Submitting Pull Requests
68
+
69
+ 1. Fork the repository
70
+ 2. Create a feature branch: `git checkout -b feature/your-feature-name`
71
+ 3. Make your changes
72
+ 4. Ensure tests pass: `npm test`
73
+ 5. Ensure linting passes: `npm run lint`
74
+ 6. Commit with a descriptive message
75
+ 7. Push to your fork
76
+ 8. Open a Pull Request
77
+
78
+ ### Pull Request Guidelines
79
+
80
+ - Keep PRs focused on a single change
81
+ - Include tests for new functionality
82
+ - Update documentation as needed
83
+ - Follow existing code style
84
+ - Write clear commit messages
85
+
86
+ ## Code Style
87
+
88
+ - TypeScript with strict mode
89
+ - Use ESLint configuration provided
90
+ - Prefer async/await over callbacks
91
+ - Use meaningful variable and function names
92
+ - Add JSDoc comments for public APIs
93
+
94
+ ### Example
95
+
96
+ ```typescript
97
+ /**
98
+ * Send a message to another agent.
99
+ * @param recipient - Target agent name or '*' for broadcast
100
+ * @param body - Message content
101
+ * @param type - Message type (default: 'message')
102
+ * @returns true if message was sent successfully
103
+ */
104
+ sendMessage(recipient: string, body: string, type?: MessageType): boolean {
105
+ // Implementation
106
+ }
107
+ ```
108
+
109
+ ## Testing
110
+
111
+ ```bash
112
+ # Run all tests
113
+ npm test
114
+
115
+ # Run tests in watch mode
116
+ npm run test:watch
117
+
118
+ # Run specific test file
119
+ npm test -- src/wrapper/parser.test.ts
120
+ ```
121
+
122
+ ### Writing Tests
123
+
124
+ - Place tests next to source files (`.test.ts`) or in `tests/`
125
+ - Use descriptive test names
126
+ - Test both success and failure cases
127
+ - Mock external dependencies
128
+
129
+ ## Documentation
130
+
131
+ - Update README.md for user-facing changes
132
+ - Add JSDoc comments for new public APIs
133
+ - Update examples if adding new features
134
+ - Keep `docs/PROTOCOL.md` updated for protocol changes
135
+
136
+ ## Release Process
137
+
138
+ 1. Update version in `package.json`
139
+ 2. Update `docs/CHANGELOG.md`
140
+ 3. Create a GitHub release
141
+ 4. npm publish is automated via GitHub Actions
142
+
143
+ ## Getting Help
144
+
145
+ - Open an issue for bugs or feature requests
146
+ - Check existing issues and documentation first
147
+ - Be respectful and constructive in discussions
148
+
149
+ ## License
150
+
151
+ By contributing, you agree that your contributions will be licensed under the MIT License.