agent-relay 2.2.23 → 2.3.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 (133) hide show
  1. package/dist/index.cjs +199 -3
  2. package/package.json +64 -21
  3. package/packages/acp-bridge/package.json +2 -2
  4. package/packages/api-types/package.json +1 -1
  5. package/packages/benchmark/package.json +5 -5
  6. package/packages/bridge/package.json +7 -7
  7. package/packages/cli-tester/package.json +1 -1
  8. package/packages/config/package.json +2 -2
  9. package/packages/continuity/package.json +2 -2
  10. package/packages/daemon/dist/cloud-sync.d.ts +13 -1
  11. package/packages/daemon/dist/cloud-sync.d.ts.map +1 -1
  12. package/packages/daemon/dist/cloud-sync.js +169 -5
  13. package/packages/daemon/dist/cloud-sync.js.map +1 -1
  14. package/packages/daemon/dist/server.d.ts +5 -0
  15. package/packages/daemon/dist/server.d.ts.map +1 -1
  16. package/packages/daemon/dist/server.js +50 -0
  17. package/packages/daemon/dist/server.js.map +1 -1
  18. package/packages/daemon/package.json +12 -12
  19. package/packages/daemon/src/cloud-sync.ts +201 -5
  20. package/packages/daemon/src/server.ts +61 -0
  21. package/packages/hooks/package.json +4 -4
  22. package/packages/mcp/package.json +5 -5
  23. package/packages/memory/package.json +2 -2
  24. package/packages/policy/package.json +2 -2
  25. package/packages/protocol/package.json +1 -1
  26. package/packages/resiliency/package.json +1 -1
  27. package/packages/sdk/dist/client.d.ts +1 -1
  28. package/packages/sdk/dist/client.js +2 -2
  29. package/packages/sdk/package.json +3 -3
  30. package/packages/sdk/src/client.ts +2 -2
  31. package/packages/sdk-ts/README.md +65 -0
  32. package/packages/sdk-ts/dist/__tests__/integration.test.d.ts +2 -0
  33. package/packages/sdk-ts/dist/__tests__/integration.test.d.ts.map +1 -0
  34. package/packages/sdk-ts/dist/__tests__/integration.test.js +139 -0
  35. package/packages/sdk-ts/dist/__tests__/integration.test.js.map +1 -0
  36. package/packages/sdk-ts/dist/__tests__/quickstart.test.d.ts +2 -0
  37. package/packages/sdk-ts/dist/__tests__/quickstart.test.d.ts.map +1 -0
  38. package/packages/sdk-ts/dist/__tests__/quickstart.test.js +176 -0
  39. package/packages/sdk-ts/dist/__tests__/quickstart.test.js.map +1 -0
  40. package/packages/sdk-ts/dist/browser.d.ts +16 -0
  41. package/packages/sdk-ts/dist/browser.d.ts.map +1 -0
  42. package/packages/sdk-ts/dist/browser.js +19 -0
  43. package/packages/sdk-ts/dist/browser.js.map +1 -0
  44. package/packages/sdk-ts/dist/client.d.ts +91 -0
  45. package/packages/sdk-ts/dist/client.d.ts.map +1 -0
  46. package/packages/sdk-ts/dist/client.js +360 -0
  47. package/packages/sdk-ts/dist/client.js.map +1 -0
  48. package/packages/sdk-ts/dist/consensus-helpers.d.ts +103 -0
  49. package/packages/sdk-ts/dist/consensus-helpers.d.ts.map +1 -0
  50. package/packages/sdk-ts/dist/consensus-helpers.js +147 -0
  51. package/packages/sdk-ts/dist/consensus-helpers.js.map +1 -0
  52. package/packages/sdk-ts/dist/consensus.d.ts +72 -0
  53. package/packages/sdk-ts/dist/consensus.d.ts.map +1 -0
  54. package/packages/sdk-ts/dist/consensus.js +378 -0
  55. package/packages/sdk-ts/dist/consensus.js.map +1 -0
  56. package/packages/sdk-ts/dist/examples/demo.d.ts +2 -0
  57. package/packages/sdk-ts/dist/examples/demo.d.ts.map +1 -0
  58. package/packages/sdk-ts/dist/examples/demo.js +63 -0
  59. package/packages/sdk-ts/dist/examples/demo.js.map +1 -0
  60. package/packages/sdk-ts/dist/examples/example.d.ts +2 -0
  61. package/packages/sdk-ts/dist/examples/example.d.ts.map +1 -0
  62. package/packages/sdk-ts/dist/examples/example.js +80 -0
  63. package/packages/sdk-ts/dist/examples/example.js.map +1 -0
  64. package/packages/sdk-ts/dist/examples/quickstart.d.ts +2 -0
  65. package/packages/sdk-ts/dist/examples/quickstart.d.ts.map +1 -0
  66. package/packages/sdk-ts/dist/examples/quickstart.js +56 -0
  67. package/packages/sdk-ts/dist/examples/quickstart.js.map +1 -0
  68. package/packages/sdk-ts/dist/examples/ralph-loop.d.ts +2 -0
  69. package/packages/sdk-ts/dist/examples/ralph-loop.d.ts.map +1 -0
  70. package/packages/sdk-ts/dist/examples/ralph-loop.js +281 -0
  71. package/packages/sdk-ts/dist/examples/ralph-loop.js.map +1 -0
  72. package/packages/sdk-ts/dist/index.d.ts +9 -0
  73. package/packages/sdk-ts/dist/index.d.ts.map +1 -0
  74. package/packages/sdk-ts/dist/index.js +9 -0
  75. package/packages/sdk-ts/dist/index.js.map +1 -0
  76. package/packages/sdk-ts/dist/logs.d.ts +47 -0
  77. package/packages/sdk-ts/dist/logs.d.ts.map +1 -0
  78. package/packages/sdk-ts/dist/logs.js +137 -0
  79. package/packages/sdk-ts/dist/logs.js.map +1 -0
  80. package/packages/sdk-ts/dist/protocol.d.ts +249 -0
  81. package/packages/sdk-ts/dist/protocol.d.ts.map +1 -0
  82. package/packages/sdk-ts/dist/protocol.js +2 -0
  83. package/packages/sdk-ts/dist/protocol.js.map +1 -0
  84. package/packages/sdk-ts/dist/pty.d.ts +8 -0
  85. package/packages/sdk-ts/dist/pty.d.ts.map +1 -0
  86. package/packages/sdk-ts/dist/pty.js +14 -0
  87. package/packages/sdk-ts/dist/pty.js.map +1 -0
  88. package/packages/sdk-ts/dist/relay.d.ts +118 -0
  89. package/packages/sdk-ts/dist/relay.d.ts.map +1 -0
  90. package/packages/sdk-ts/dist/relay.js +355 -0
  91. package/packages/sdk-ts/dist/relay.js.map +1 -0
  92. package/packages/sdk-ts/dist/relaycast.d.ts +57 -0
  93. package/packages/sdk-ts/dist/relaycast.d.ts.map +1 -0
  94. package/packages/sdk-ts/dist/relaycast.js +110 -0
  95. package/packages/sdk-ts/dist/relaycast.js.map +1 -0
  96. package/packages/sdk-ts/dist/shadow.d.ts +100 -0
  97. package/packages/sdk-ts/dist/shadow.d.ts.map +1 -0
  98. package/packages/sdk-ts/dist/shadow.js +174 -0
  99. package/packages/sdk-ts/dist/shadow.js.map +1 -0
  100. package/packages/sdk-ts/package.json +75 -0
  101. package/packages/sdk-ts/scripts/bundle-agent-relay.mjs +53 -0
  102. package/packages/sdk-ts/src/__tests__/integration.test.ts +170 -0
  103. package/packages/sdk-ts/src/__tests__/quickstart.test.ts +198 -0
  104. package/packages/sdk-ts/src/browser.ts +57 -0
  105. package/packages/sdk-ts/src/client.ts +491 -0
  106. package/packages/sdk-ts/src/consensus-helpers.ts +253 -0
  107. package/packages/sdk-ts/src/consensus.ts +506 -0
  108. package/packages/sdk-ts/src/examples/demo.ts +88 -0
  109. package/packages/sdk-ts/src/examples/example.ts +91 -0
  110. package/packages/sdk-ts/src/examples/quickstart.ts +72 -0
  111. package/packages/sdk-ts/src/examples/ralph-loop.ts +352 -0
  112. package/packages/sdk-ts/src/examples/sample-prd.json +37 -0
  113. package/packages/sdk-ts/src/index.ts +8 -0
  114. package/packages/sdk-ts/src/logs.ts +163 -0
  115. package/packages/sdk-ts/src/protocol.ts +266 -0
  116. package/packages/sdk-ts/src/pty.ts +16 -0
  117. package/packages/sdk-ts/src/relay.ts +454 -0
  118. package/packages/sdk-ts/src/relaycast.ts +143 -0
  119. package/packages/sdk-ts/src/shadow.ts +230 -0
  120. package/packages/sdk-ts/tsconfig.json +16 -0
  121. package/packages/spawner/package.json +1 -1
  122. package/packages/state/package.json +1 -1
  123. package/packages/storage/package.json +2 -2
  124. package/packages/telemetry/package.json +1 -1
  125. package/packages/trajectory/package.json +2 -2
  126. package/packages/user-directory/package.json +2 -2
  127. package/packages/utils/package.json +3 -3
  128. package/packages/wrapper/dist/client.js +1 -1
  129. package/packages/wrapper/package.json +6 -6
  130. package/packages/wrapper/src/client.test.ts +1 -1
  131. package/packages/wrapper/src/client.ts +1 -1
  132. package/packages/mcp/SPEC.md +0 -1922
  133. package/packages/mcp/STAFFING_PLAN.md +0 -294
@@ -1,294 +0,0 @@
1
- # MCP Server Implementation - Staffing Plan
2
-
3
- > Generated from analysis of SPEC.md
4
-
5
- ## Overview
6
-
7
- **Goal**: Give AI agents (Claude, Codex, Gemini, Cursor) native MCP tools for Agent Relay communication.
8
-
9
- **Estimated Total Effort**: 12-16 hours across 4-6 agents
10
-
11
- ---
12
-
13
- ## Phase 1: Core Infrastructure
14
-
15
- **Agent**: MCPInfra
16
- **CLI**: claude
17
- **Duration**: ~2-3 hours
18
- **Branch**: feature/mcp-infrastructure
19
-
20
- ### Tasks
21
- 1. Create package structure (packages/mcp/)
22
- 2. Set up package.json, tsconfig.json
23
- 3. Implement src/discover.ts - socket discovery with priority:
24
- - RELAY_SOCKET env var
25
- - RELAY_PROJECT env var
26
- - CWD .relay/config.json
27
- - Scan data directory
28
- 4. Implement src/client.ts - RelayClient class
29
- - Socket connection to daemon
30
- - Frame parsing with @agent-relay/protocol
31
- - Handshake (HELLO/WELCOME)
32
- - Message handlers
33
- 5. Implement src/errors.ts - Error types
34
- - RelayError, DaemonNotRunningError, AgentNotFoundError, TimeoutError
35
- 6. Write tests/discover.test.ts
36
-
37
- ### Acceptance Criteria
38
- - Package builds with npm run build
39
- - Discovery finds socket in all priority scenarios
40
- - Client connects to running daemon
41
- - All tests pass
42
-
43
- ---
44
-
45
- ## Phase 2a: MCP Tools (Group 1)
46
-
47
- **Agent**: MCPTools1
48
- **CLI**: claude
49
- **Duration**: ~3-4 hours
50
- **Branch**: feature/mcp-tools-messaging
51
- **Depends on**: Phase 1
52
-
53
- ### Tasks
54
- 1. Implement src/tools/relay-send.ts
55
- - Direct messages, channels, broadcast
56
- - Thread support
57
- - await_response with timeout
58
- 2. Implement src/tools/relay-inbox.ts
59
- - Filter by sender, channel
60
- - Limit and unread_only options
61
- 3. Implement src/tools/relay-who.ts
62
- - List online agents
63
- - Include idle flag, parent info
64
- 4. Write unit tests for all 3 tools
65
-
66
- ### Acceptance Criteria
67
- - relay_send sends to agents, channels, broadcast
68
- - relay_send with await_response blocks and returns reply
69
- - relay_inbox returns filtered messages
70
- - relay_who lists agents with status
71
- - All tests pass
72
-
73
- ---
74
-
75
- ## Phase 2b: MCP Tools (Group 2)
76
-
77
- **Agent**: MCPTools2
78
- **CLI**: claude
79
- **Duration**: ~3-4 hours
80
- **Branch**: feature/mcp-tools-spawn
81
- **Depends on**: Phase 1
82
- **Parallel with**: Phase 2a
83
-
84
- ### Tasks
85
- 1. Implement src/tools/relay-spawn.ts
86
- - Spawn worker with name, cli, task
87
- - Optional model and cwd
88
- 2. Implement src/tools/relay-release.ts
89
- - Release worker by name
90
- - Optional reason
91
- 3. Implement src/tools/relay-status.ts
92
- - Connection state
93
- - Agent name, project, socket info
94
- 4. Implement src/tools/index.ts - exports
95
- 5. Write unit tests for all 3 tools
96
-
97
- ### Acceptance Criteria
98
- - relay_spawn creates worker agents
99
- - relay_release terminates workers
100
- - relay_status returns connection diagnostics
101
- - All tests pass
102
-
103
- ---
104
-
105
- ## Phase 3: MCP Server Assembly
106
-
107
- **Agent**: MCPServer
108
- **CLI**: claude
109
- **Duration**: ~2-3 hours
110
- **Branch**: feature/mcp-server
111
- **Depends on**: Phase 2a + 2b
112
-
113
- ### Tasks
114
- 1. Implement src/index.ts - MCP server entry point
115
- - Wire all 6 tools
116
- - Handle tool calls
117
- - Connect to relay daemon on startup
118
- 2. Implement src/bin.ts - CLI binary
119
- - install command
120
- - serve command
121
- 3. Implement src/prompts/protocol.ts
122
- - Full protocol documentation prompt
123
- 4. Implement src/resources/
124
- - agents.ts - relay://agents
125
- - inbox.ts - relay://inbox
126
- - project.ts - relay://project
127
- 5. Write integration tests
128
-
129
- ### Acceptance Criteria
130
- - npx @agent-relay/mcp serve starts MCP server
131
- - All 6 tools callable via MCP protocol
132
- - Protocol prompt available
133
- - Resources return live data
134
- - Integration tests pass
135
-
136
- ---
137
-
138
- ## Phase 4: Installation System
139
-
140
- **Agent**: MCPInstall
141
- **CLI**: claude
142
- **Duration**: ~2 hours
143
- **Branch**: feature/mcp-install
144
- **Depends on**: Phase 3
145
-
146
- ### Tasks
147
- 1. Implement src/install.ts - editor installation logic
148
- - Detect installed editors (Claude, Cursor, VS Code)
149
- - Read/modify editor config files
150
- 2. Implement src/install-cli.ts - CLI wrapper
151
- 3. Add agent-relay mcp command to main CLI
152
- - agent-relay mcp install
153
- - agent-relay mcp serve
154
- 4. Update agent-relay setup to offer MCP install
155
- 5. Write install tests
156
-
157
- ### Acceptance Criteria
158
- - npx @agent-relay/mcp install auto-detects editors
159
- - Claude Code config updated correctly
160
- - Cursor config updated correctly
161
- - agent-relay mcp install works from main CLI
162
-
163
- ---
164
-
165
- ## Phase 5: Cloud Integration
166
-
167
- **Agent**: MCPCloud
168
- **CLI**: claude
169
- **Duration**: ~1-2 hours
170
- **Branch**: feature/mcp-cloud
171
- **Depends on**: Phase 4
172
-
173
- ### Tasks
174
- 1. Update deploy/workspace/Dockerfile
175
- - Install @agent-relay/mcp globally
176
- - Pre-configure Claude Code settings
177
- - Pre-configure Cursor settings
178
- 2. Set environment variables for socket discovery
179
- 3. Test with all CLI tools in workspace
180
-
181
- ### Acceptance Criteria
182
- - New workspaces have MCP pre-configured
183
- - Claude Code in workspace has relay tools
184
- - Cursor in workspace has relay tools
185
- - Socket discovery works via RELAY_PROJECT env
186
-
187
- ---
188
-
189
- ## Dependency Graph
190
-
191
- Phase 1 (MCPInfra)
192
- |
193
- v
194
- +---------+
195
- | |
196
- v v
197
- Phase 2a Phase 2b [PARALLEL]
198
- | |
199
- +----+----+
200
- |
201
- v
202
- Phase 3 (MCPServer)
203
- |
204
- v
205
- Phase 4 (MCPInstall)
206
- |
207
- v
208
- Phase 5 (MCPCloud)
209
-
210
- ---
211
-
212
- ## Spawn Commands Reference
213
-
214
- ### Phase 1 - Spawn MCPInfra
215
- NAME: MCPInfra
216
- CLI: claude
217
- TASK: Implement MCP core infrastructure per packages/mcp/SPEC.md Phase 1:
218
- 1. Create packages/mcp/ structure
219
- 2. Implement src/discover.ts (socket discovery)
220
- 3. Implement src/client.ts (RelayClient)
221
- 4. Implement src/errors.ts
222
- 5. Write tests/discover.test.ts
223
- BRANCH: feature/mcp-infrastructure
224
-
225
- ### Phase 2a - Spawn MCPTools1 (after Phase 1)
226
- NAME: MCPTools1
227
- CLI: claude
228
- TASK: Implement MCP messaging tools per packages/mcp/SPEC.md:
229
- 1. src/tools/relay-send.ts
230
- 2. src/tools/relay-inbox.ts
231
- 3. src/tools/relay-who.ts
232
- 4. Unit tests for all 3
233
- BRANCH: feature/mcp-tools-messaging
234
-
235
- ### Phase 2b - Spawn MCPTools2 (after Phase 1, parallel with 2a)
236
- NAME: MCPTools2
237
- CLI: claude
238
- TASK: Implement MCP spawn/control tools per packages/mcp/SPEC.md:
239
- 1. src/tools/relay-spawn.ts
240
- 2. src/tools/relay-release.ts
241
- 3. src/tools/relay-status.ts
242
- 4. src/tools/index.ts (exports)
243
- 5. Unit tests for all 3
244
- BRANCH: feature/mcp-tools-spawn
245
-
246
- ### Phase 3 - Spawn MCPServer (after Phase 2a + 2b)
247
- NAME: MCPServer
248
- CLI: claude
249
- TASK: Assemble MCP server per packages/mcp/SPEC.md Phase 3:
250
- 1. src/index.ts - MCP server entry point
251
- 2. src/bin.ts - CLI binary
252
- 3. src/prompts/protocol.ts
253
- 4. src/resources/ (agents, inbox, project)
254
- 5. Integration tests
255
- BRANCH: feature/mcp-server
256
-
257
- ### Phase 4 - Spawn MCPInstall (after Phase 3)
258
- NAME: MCPInstall
259
- CLI: claude
260
- TASK: Implement MCP installation per packages/mcp/SPEC.md Phase 4:
261
- 1. src/install.ts - editor detection
262
- 2. src/install-cli.ts
263
- 3. Add agent-relay mcp command
264
- 4. Update agent-relay setup
265
- 5. Install tests
266
- BRANCH: feature/mcp-install
267
-
268
- ### Phase 5 - Spawn MCPCloud (after Phase 4)
269
- NAME: MCPCloud
270
- CLI: claude
271
- TASK: Cloud integration per packages/mcp/SPEC.md Phase 5:
272
- 1. Update deploy/workspace/Dockerfile
273
- 2. Pre-configure Claude Code and Cursor
274
- 3. Set RELAY_PROJECT env
275
- 4. Test in workspace container
276
- BRANCH: feature/mcp-cloud
277
-
278
- ---
279
-
280
- ## Open Questions
281
-
282
- 1. **Daemon Protocol**: Does current daemon support SPAWN, RELEASE, WHO, INBOX message types, or do those need to be added first?
283
- 2. **Package Publishing**: When should @agent-relay/mcp be published to npm?
284
- 3. **Priority**: Local-first or cloud-first testing?
285
-
286
- ---
287
-
288
- ## Quick Start for New Session
289
-
290
- To resume this work:
291
- 1. Read this file and SPEC.md
292
- 2. Check which phases are complete (look for merged branches)
293
- 3. Spawn the next agent in sequence
294
- 4. Monitor progress via relay messages