agent-relay 2.0.4 → 2.0.6

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 (131) hide show
  1. package/dist/dashboard/out/404.html +1 -1
  2. package/dist/dashboard/out/app/onboarding.html +1 -1
  3. package/dist/dashboard/out/app/onboarding.txt +1 -1
  4. package/dist/dashboard/out/app.html +1 -1
  5. package/dist/dashboard/out/app.txt +1 -1
  6. package/dist/dashboard/out/cloud/link.html +1 -1
  7. package/dist/dashboard/out/cloud/link.txt +1 -1
  8. package/dist/dashboard/out/connect-repos.html +1 -1
  9. package/dist/dashboard/out/connect-repos.txt +1 -1
  10. package/dist/dashboard/out/history.html +1 -1
  11. package/dist/dashboard/out/history.txt +1 -1
  12. package/dist/dashboard/out/index.html +1 -1
  13. package/dist/dashboard/out/index.txt +1 -1
  14. package/dist/dashboard/out/login.html +1 -1
  15. package/dist/dashboard/out/login.txt +1 -1
  16. package/dist/dashboard/out/metrics.html +1 -1
  17. package/dist/dashboard/out/metrics.txt +1 -1
  18. package/dist/dashboard/out/pricing.html +1 -1
  19. package/dist/dashboard/out/pricing.txt +1 -1
  20. package/dist/dashboard/out/providers/setup/claude.html +1 -1
  21. package/dist/dashboard/out/providers/setup/claude.txt +1 -1
  22. package/dist/dashboard/out/providers/setup/codex.html +1 -1
  23. package/dist/dashboard/out/providers/setup/codex.txt +1 -1
  24. package/dist/dashboard/out/providers/setup/cursor.html +1 -1
  25. package/dist/dashboard/out/providers/setup/cursor.txt +1 -1
  26. package/dist/dashboard/out/providers.html +1 -1
  27. package/dist/dashboard/out/providers.txt +1 -1
  28. package/dist/dashboard/out/signup.html +1 -1
  29. package/dist/dashboard/out/signup.txt +1 -1
  30. package/dist/src/cli/index.js +61 -3
  31. package/package.json +14 -12
  32. package/packages/api-types/package.json +1 -1
  33. package/packages/bridge/dist/spawner.d.ts +2 -0
  34. package/packages/bridge/dist/spawner.js +24 -6
  35. package/packages/bridge/dist/types.d.ts +2 -0
  36. package/packages/bridge/package.json +7 -7
  37. package/packages/cloud/package.json +6 -6
  38. package/packages/config/package.json +2 -2
  39. package/packages/continuity/package.json +1 -1
  40. package/packages/daemon/dist/router.d.ts +2 -1
  41. package/packages/daemon/dist/router.js +142 -52
  42. package/packages/daemon/dist/server.d.ts +3 -0
  43. package/packages/daemon/dist/server.js +31 -1
  44. package/packages/daemon/dist/spawn-manager.d.ts +5 -0
  45. package/packages/daemon/dist/spawn-manager.js +44 -1
  46. package/packages/daemon/package.json +12 -11
  47. package/packages/dashboard/dist/server.js +2 -0
  48. package/packages/dashboard/package.json +12 -12
  49. package/packages/dashboard/ui-dist/404.html +1 -1
  50. package/packages/dashboard/ui-dist/app/onboarding.html +1 -1
  51. package/packages/dashboard/ui-dist/app/onboarding.txt +1 -1
  52. package/packages/dashboard/ui-dist/app.html +1 -1
  53. package/packages/dashboard/ui-dist/app.txt +1 -1
  54. package/packages/dashboard/ui-dist/cloud/link.html +1 -1
  55. package/packages/dashboard/ui-dist/cloud/link.txt +1 -1
  56. package/packages/dashboard/ui-dist/connect-repos.html +1 -1
  57. package/packages/dashboard/ui-dist/connect-repos.txt +1 -1
  58. package/packages/dashboard/ui-dist/history.html +1 -1
  59. package/packages/dashboard/ui-dist/history.txt +1 -1
  60. package/packages/dashboard/ui-dist/index.html +1 -1
  61. package/packages/dashboard/ui-dist/index.txt +1 -1
  62. package/packages/dashboard/ui-dist/login.html +1 -1
  63. package/packages/dashboard/ui-dist/login.txt +1 -1
  64. package/packages/dashboard/ui-dist/metrics.html +1 -1
  65. package/packages/dashboard/ui-dist/metrics.txt +1 -1
  66. package/packages/dashboard/ui-dist/pricing.html +1 -1
  67. package/packages/dashboard/ui-dist/pricing.txt +1 -1
  68. package/packages/dashboard/ui-dist/providers/setup/claude.html +1 -1
  69. package/packages/dashboard/ui-dist/providers/setup/claude.txt +1 -1
  70. package/packages/dashboard/ui-dist/providers/setup/codex.html +1 -1
  71. package/packages/dashboard/ui-dist/providers/setup/codex.txt +1 -1
  72. package/packages/dashboard/ui-dist/providers/setup/cursor.html +1 -1
  73. package/packages/dashboard/ui-dist/providers/setup/cursor.txt +1 -1
  74. package/packages/dashboard/ui-dist/providers.html +1 -1
  75. package/packages/dashboard/ui-dist/providers.txt +1 -1
  76. package/packages/dashboard/ui-dist/signup.html +1 -1
  77. package/packages/dashboard/ui-dist/signup.txt +1 -1
  78. package/packages/dashboard-server/dist/server.js +2 -0
  79. package/packages/dashboard-server/dist/user-bridge.d.ts +7 -3
  80. package/packages/dashboard-server/dist/user-bridge.js +48 -30
  81. package/packages/dashboard-server/package.json +12 -12
  82. package/packages/hooks/package.json +4 -4
  83. package/packages/mcp/README.md +19 -135
  84. package/packages/mcp/dist/client.js +67 -27
  85. package/packages/mcp/dist/cloud.js +1 -18
  86. package/packages/mcp/dist/prompts/protocol.d.ts +1 -1
  87. package/packages/mcp/dist/prompts/protocol.js +6 -14
  88. package/packages/mcp/package.json +2 -1
  89. package/packages/memory/package.json +2 -2
  90. package/packages/policy/package.json +2 -2
  91. package/packages/protocol/dist/types.d.ts +2 -0
  92. package/packages/protocol/package.json +1 -1
  93. package/packages/resiliency/package.json +1 -1
  94. package/packages/sdk/README.md +43 -160
  95. package/packages/sdk/dist/client.d.ts +3 -99
  96. package/packages/sdk/dist/client.js +6 -113
  97. package/packages/sdk/dist/index.d.ts +0 -1
  98. package/packages/sdk/dist/index.js +0 -2
  99. package/packages/sdk/dist/standalone.js +0 -1
  100. package/packages/sdk/package.json +2 -2
  101. package/packages/spawner/package.json +1 -1
  102. package/packages/state/package.json +1 -1
  103. package/packages/storage/package.json +2 -2
  104. package/packages/telemetry/dist/client.d.ts +19 -0
  105. package/packages/telemetry/dist/client.js +126 -0
  106. package/packages/telemetry/dist/config.d.ts +29 -0
  107. package/packages/telemetry/dist/config.js +88 -0
  108. package/packages/telemetry/dist/events.d.ts +106 -0
  109. package/packages/telemetry/dist/events.js +10 -0
  110. package/packages/telemetry/dist/index.d.ts +8 -0
  111. package/packages/telemetry/dist/index.js +7 -0
  112. package/packages/telemetry/dist/machine-id.d.ts +12 -0
  113. package/packages/telemetry/dist/machine-id.js +58 -0
  114. package/packages/telemetry/dist/posthog-config.d.ts +16 -0
  115. package/packages/telemetry/dist/posthog-config.js +33 -0
  116. package/packages/telemetry/package.json +41 -0
  117. package/packages/trajectory/package.json +2 -2
  118. package/packages/user-directory/package.json +2 -2
  119. package/packages/utils/package.json +1 -1
  120. package/packages/wrapper/dist/relay-pty-orchestrator.js +38 -29
  121. package/packages/wrapper/package.json +6 -6
  122. package/packages/sdk/dist/discovery.d.ts +0 -29
  123. package/packages/sdk/dist/discovery.js +0 -126
  124. /package/dist/dashboard/out/_next/static/{72btMIJ64BCAB4UgVkpaq → lIJs7zSKBaI58kpqegulQ}/_buildManifest.js +0 -0
  125. /package/dist/dashboard/out/_next/static/{72btMIJ64BCAB4UgVkpaq → lIJs7zSKBaI58kpqegulQ}/_ssgManifest.js +0 -0
  126. /package/packages/dashboard/ui-dist/_next/static/{0AsOfRemPXJmtynCKT-rx → KIxE0Ds_zdGuDJDQu7_sb}/_buildManifest.js +0 -0
  127. /package/packages/dashboard/ui-dist/_next/static/{0AsOfRemPXJmtynCKT-rx → KIxE0Ds_zdGuDJDQu7_sb}/_ssgManifest.js +0 -0
  128. /package/packages/dashboard/ui-dist/_next/static/{72btMIJ64BCAB4UgVkpaq → SoK46dEi3IsNBVWXD9x0L}/_buildManifest.js +0 -0
  129. /package/packages/dashboard/ui-dist/_next/static/{72btMIJ64BCAB4UgVkpaq → SoK46dEi3IsNBVWXD9x0L}/_ssgManifest.js +0 -0
  130. /package/packages/dashboard/ui-dist/_next/static/{clUN2n0bz9HCjKI0qlOxU → lIJs7zSKBaI58kpqegulQ}/_buildManifest.js +0 -0
  131. /package/packages/dashboard/ui-dist/_next/static/{clUN2n0bz9HCjKI0qlOxU → lIJs7zSKBaI58kpqegulQ}/_ssgManifest.js +0 -0
@@ -91,21 +91,13 @@ Channel messages include the channel:
91
91
  Relay message from Alice [msg-id-456] [#general]: Hello team!
92
92
  \`\`\`
93
93
 
94
- ### ACK/DONE Protocol
95
- When assigned a task:
96
- 1. Send ACK immediately: "ACK: Starting work on X"
94
+ ### Optional: ACK/DONE Convention
95
+ Some applications use ACK/DONE conventions for task tracking. If your application uses this pattern:
96
+ 1. Send ACK when starting: "ACK: Starting work on X"
97
97
  2. Send progress updates as needed
98
98
  3. Send DONE when complete: "DONE: Completed X with result Y"
99
99
 
100
- Example:
101
- \`\`\`
102
- # When receiving a task
103
- relay_send(to="Lead", message="ACK: Starting test suite run")
104
-
105
- # ... do work ...
106
-
107
- relay_send(to="Lead", message="DONE: All 42 tests passed")
108
- \`\`\`
100
+ Note: This is an application-level convention, not a protocol requirement. Check your application's documentation for expected message formats.
109
101
 
110
102
  ## Best Practices
111
103
 
@@ -116,9 +108,9 @@ relay_send(to="Lead", message="DONE: All 42 tests passed")
116
108
  - Use channels for team announcements
117
109
 
118
110
  ### For Worker Agents
119
- - ACK immediately when receiving tasks
111
+ - Respond promptly when receiving tasks
120
112
  - Send progress updates for long tasks
121
- - Send DONE with results when complete
113
+ - Report results when complete
122
114
  - Ask clarifying questions if needed
123
115
 
124
116
  ### Message Etiquette
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/mcp",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
4
4
  "description": "MCP server for Agent Relay - native messaging tools for AI agents in Claude, Cursor, and VS Code",
5
5
  "author": "Agent Workforce Inc.",
6
6
  "license": "Apache-2.0",
@@ -47,6 +47,7 @@
47
47
  "prepublishOnly": "npm run clean && npm run build && npm test"
48
48
  },
49
49
  "dependencies": {
50
+ "@agent-relay/config": "2.0.6",
50
51
  "@modelcontextprotocol/sdk": "^1.0.0",
51
52
  "zod": "^3.23.8"
52
53
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/memory",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
4
4
  "description": "Semantic memory storage and retrieval system for agent-relay with multiple backend support",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -22,7 +22,7 @@
22
22
  "test:watch": "vitest"
23
23
  },
24
24
  "dependencies": {
25
- "@agent-relay/hooks": "2.0.4"
25
+ "@agent-relay/hooks": "2.0.6"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^22.19.3",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/policy",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
4
4
  "description": "Agent policy management with multi-level fallback (repo, local PRPM, cloud workspace)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -22,7 +22,7 @@
22
22
  "test:watch": "vitest"
23
23
  },
24
24
  "dependencies": {
25
- "@agent-relay/config": "2.0.4"
25
+ "@agent-relay/config": "2.0.6"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^22.19.3",
@@ -278,6 +278,8 @@ export interface SpawnPayload {
278
278
  shadowSpeakOn?: SpeakOnTrigger[];
279
279
  /** User ID for cloud persistence */
280
280
  userId?: string;
281
+ /** Include ACK/DONE workflow conventions in agent instructions (default: false) */
282
+ includeWorkflowConventions?: boolean;
281
283
  }
282
284
  export interface SpawnPolicyDecision {
283
285
  allowed: boolean;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/protocol",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
4
4
  "description": "Wire protocol types and framing for Agent Relay",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/resiliency",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
4
4
  "description": "Health monitoring, logging, metrics, and crash resilience utilities for Agent Relay",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,17 +1,15 @@
1
1
  # @agent-relay/sdk
2
2
 
3
- Dead simple agent-to-agent communication for AI agent systems.
3
+ Dead simple agent-to-agent communication.
4
4
 
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- npm install @agent-relay/sdk
8
+ npm install @agent-relay/sdk @agent-relay/daemon
9
9
  ```
10
10
 
11
11
  ## Quick Start
12
12
 
13
- ### Standalone (In-Process Daemon)
14
-
15
13
  ```typescript
16
14
  import { createRelay } from '@agent-relay/sdk';
17
15
 
@@ -34,7 +32,9 @@ alice.sendMessage('Bob', 'Hello!');
34
32
  await relay.stop();
35
33
  ```
36
34
 
37
- ### Two-Agent Shortcut
35
+ That's it. No daemon to start, no config files, no setup.
36
+
37
+ ## Even Simpler: Two Agents
38
38
 
39
39
  ```typescript
40
40
  import { createPair } from '@agent-relay/sdk';
@@ -47,163 +47,56 @@ alice.sendMessage('bob', 'Hey!');
47
47
  await stop();
48
48
  ```
49
49
 
50
- ### With External Daemon
51
-
52
- If you're running `agent-relay up` separately:
53
-
54
- ```typescript
55
- import { RelayClient } from '@agent-relay/sdk';
56
-
57
- // Socket path is auto-discovered from your project's .agent-relay/relay.sock
58
- const client = new RelayClient({ agentName: 'MyAgent' });
59
-
60
- await client.connect();
61
- client.sendMessage('OtherAgent', 'Hello!');
62
- ```
63
-
64
- ## Socket Discovery
65
-
66
- The SDK automatically discovers the daemon socket in this order:
67
-
68
- 1. `RELAY_SOCKET` environment variable
69
- 2. Cloud workspace socket (if `WORKSPACE_ID` is set)
70
- 3. **Project-local socket** (`{projectRoot}/.agent-relay/relay.sock`)
71
- 4. Legacy fallback (`/tmp/agent-relay.sock`)
72
-
73
- You can also use the discovery API directly:
74
-
75
- ```typescript
76
- import { discoverSocket, getDefaultSocketPath } from '@agent-relay/sdk';
77
-
78
- // Get detailed discovery info
79
- const { socketPath, projectId, source } = discoverSocket();
80
- console.log(`Using socket: ${socketPath} (source: ${source})`);
81
-
82
- // Or just get the path
83
- const socketPath = getDefaultSocketPath();
84
- ```
85
-
86
- ## Integration Guide (for Libraries like AgentSwarm)
87
-
88
- If you're building a library that integrates with Agent Relay:
89
-
90
- ### Option 1: Use the SDK Client (Recommended)
91
-
92
- ```typescript
93
- import { RelayClient, discoverSocket } from '@agent-relay/sdk';
94
-
95
- class MyAgentOrchestrator {
96
- private client: RelayClient;
97
-
98
- async connect(agentName: string) {
99
- // Auto-discovers socket path
100
- this.client = new RelayClient({
101
- agentName,
102
- reconnect: true, // Auto-reconnect on disconnect
103
- });
104
-
105
- await this.client.connect();
106
- }
107
-
108
- async sendTask(to: string, task: string) {
109
- return this.client.sendMessage(to, task);
110
- }
50
+ ## Features
111
51
 
112
- async waitForResponse(to: string, message: string, timeoutMs = 30000) {
113
- return this.client.sendAndWait(to, message, { timeoutMs });
114
- }
52
+ | Feature | Description |
53
+ |---------|-------------|
54
+ | **Zero config** | Just import and go |
55
+ | **Auto-reconnect** | Handles disconnections automatically |
56
+ | **Message deduplication** | No duplicate deliveries |
57
+ | **Sync messaging** | Wait for acknowledgment |
58
+ | **Broadcast** | Send to all agents with `*` |
59
+ | **Channels** | Group messaging with `#channel` |
115
60
 
116
- onMessage(handler: (from: string, body: string) => void) {
117
- this.client.onMessage = (from, payload) => {
118
- handler(from, payload.body);
119
- };
120
- }
121
- }
122
- ```
61
+ ## API Reference
123
62
 
124
- ### Option 2: Use MCP Simple API (If Using MCP)
63
+ ### createRelay(config?)
125
64
 
126
- If your agents use MCP, the `@agent-relay/mcp` package has an even simpler API:
65
+ Creates a standalone relay with an in-process daemon.
127
66
 
128
67
  ```typescript
129
- import { createTools } from '@agent-relay/mcp';
130
-
131
- const tools = createTools('Orchestrator');
132
-
133
- // Send messages
134
- await tools.send('Worker1', 'Run the test suite');
135
-
136
- // Spawn workers
137
- await tools.spawn({
138
- name: 'Worker1',
139
- cli: 'claude',
140
- task: 'Run tests and report results',
68
+ const relay = await createRelay({
69
+ socketPath: '/tmp/my-relay.sock', // Optional custom socket
70
+ quiet: true, // Suppress logs (default: true)
141
71
  });
142
72
 
143
- // Check messages
144
- const messages = await tools.inbox();
145
-
146
- // List online agents
147
- const agents = await tools.who();
73
+ // Create clients
74
+ const agent = await relay.client('MyAgent');
148
75
 
149
- // Release workers
150
- await tools.release('Worker1');
76
+ // Stop everything
77
+ await relay.stop();
151
78
  ```
152
79
 
153
- ### Option 3: HTTP API (For Non-Node Environments)
80
+ ### createPair(name1, name2, config?)
154
81
 
155
- If the daemon is running with dashboard, use the HTTP API:
82
+ Shortcut to create two connected agents.
156
83
 
157
- ```bash
158
- # Spawn an agent
159
- curl -X POST http://localhost:3888/api/spawn \
160
- -H 'Content-Type: application/json' \
161
- -d '{"name": "Worker1", "cli": "claude", "task": "Run tests"}'
162
-
163
- # List agents
164
- curl http://localhost:3888/api/spawned
165
-
166
- # Release an agent
167
- curl -X DELETE http://localhost:3888/api/spawned/Worker1
84
+ ```typescript
85
+ const { alice, bob, stop } = await createPair('alice', 'bob');
168
86
  ```
169
87
 
170
- ## Features
171
-
172
- | Feature | Description |
173
- |---------|-------------|
174
- | **Auto-discovery** | Finds daemon socket automatically |
175
- | **Auto-reconnect** | Handles disconnections automatically |
176
- | **Message deduplication** | No duplicate deliveries |
177
- | **Sync messaging** | Wait for acknowledgment |
178
- | **Broadcast** | Send to all agents with `*` |
179
- | **Channels** | Group messaging with `#channel` |
180
-
181
- ## API Reference
182
-
183
88
  ### RelayClient
184
89
 
185
- ```typescript
186
- import { RelayClient } from '@agent-relay/sdk';
187
-
188
- const client = new RelayClient({
189
- agentName: 'MyAgent', // Required: your agent's name
190
- socketPath: '/custom/path', // Optional: override auto-discovery
191
- reconnect: true, // Optional: auto-reconnect (default: true)
192
- quiet: false, // Optional: suppress logs (default: false)
193
- });
194
-
195
- // Connect to daemon
196
- await client.connect();
90
+ The client for agent communication.
197
91
 
92
+ ```typescript
198
93
  // Send messages
199
94
  client.sendMessage('OtherAgent', 'Hello!');
200
95
  client.sendMessage('#general', 'Channel message');
201
96
  client.sendMessage('*', 'Broadcast to everyone');
202
97
 
203
98
  // Wait for acknowledgment
204
- const ack = await client.sendAndWait('OtherAgent', 'Important message', {
205
- timeoutMs: 30000,
206
- });
99
+ const ack = await client.sendAndWait('OtherAgent', 'Important message');
207
100
 
208
101
  // Receive messages
209
102
  client.onMessage = (from, payload, messageId, meta, originalTo) => {
@@ -224,20 +117,23 @@ client.onStateChange = (state) => {
224
117
  client.disconnect();
225
118
  ```
226
119
 
227
- ### Socket Discovery
120
+ ## Using with External Daemon
121
+
122
+ If you're running `agent-relay up` separately (e.g., for the dashboard), use the client directly:
228
123
 
229
124
  ```typescript
230
- import { discoverSocket, getDefaultSocketPath } from '@agent-relay/sdk';
125
+ import { RelayClient } from '@agent-relay/sdk';
231
126
 
232
- // Get full discovery result
233
- const result = discoverSocket();
234
- // { socketPath: string, projectId: string, source: 'env' | 'cloud' | 'project' | 'legacy' }
127
+ const client = new RelayClient({
128
+ agentName: 'MyAgent',
129
+ socketPath: '/tmp/agent-relay.sock',
130
+ });
235
131
 
236
- // Get just the path
237
- const socketPath = getDefaultSocketPath();
132
+ await client.connect();
133
+ client.sendMessage('OtherAgent', 'Hello!');
238
134
  ```
239
135
 
240
- ### Channels
136
+ ## Advanced: Channels
241
137
 
242
138
  ```typescript
243
139
  // Join a channel
@@ -255,7 +151,7 @@ client.onChannelMessage = (from, channel, body, envelope) => {
255
151
  client.leaveChannel('#general');
256
152
  ```
257
153
 
258
- ### Shadow Agents
154
+ ## Advanced: Shadow Agents
259
155
 
260
156
  Monitor another agent's communication:
261
157
 
@@ -270,19 +166,6 @@ client.bindAsShadow('PrimaryAgent', {
270
166
  client.unbindAsShadow('PrimaryAgent');
271
167
  ```
272
168
 
273
- ## Environment Variables
274
-
275
- | Variable | Description |
276
- |----------|-------------|
277
- | `RELAY_SOCKET` | Override daemon socket path |
278
- | `RELAY_PROJECT` | Override project name |
279
- | `WORKSPACE_ID` | Cloud workspace ID (auto-detects cloud socket) |
280
-
281
- ## Requirements
282
-
283
- - Node.js 18+
284
- - Agent Relay daemon running (`agent-relay up`)
285
-
286
169
  ## License
287
170
 
288
171
  MIT
@@ -45,39 +45,7 @@ export interface ClientConfig {
45
45
  reconnectMaxDelayMs: number;
46
46
  }
47
47
  /**
48
- * RelayClient - Agent-to-agent communication client for Agent Relay.
49
- *
50
- * The client automatically discovers the daemon socket path. You only need to provide
51
- * your agent name. Use `connect()` to establish a connection, then send/receive messages.
52
- *
53
- * @example Basic Usage
54
- * ```typescript
55
- * import { RelayClient } from '@agent-relay/sdk';
56
- *
57
- * const client = new RelayClient({ agentName: 'MyAgent' });
58
- * await client.connect();
59
- *
60
- * // Send messages
61
- * client.sendMessage('OtherAgent', 'Hello!');
62
- * client.sendMessage('#general', 'Channel message');
63
- * client.sendMessage('*', 'Broadcast');
64
- *
65
- * // Receive messages
66
- * client.onMessage = (from, payload) => {
67
- * console.log(`${from}: ${payload.body}`);
68
- * };
69
- *
70
- * // Disconnect when done
71
- * client.disconnect();
72
- * ```
73
- *
74
- * @example Wait for Response
75
- * ```typescript
76
- * const response = await client.sendAndWait('Worker', 'Do this task', {
77
- * timeoutMs: 30000,
78
- * });
79
- * console.log(`Worker replied: ${response.content}`);
80
- * ```
48
+ * RelayClient for agent-to-agent communication.
81
49
  */
82
50
  export declare class RelayClient {
83
51
  private config;
@@ -94,32 +62,12 @@ export declare class RelayClient {
94
62
  private writeQueue;
95
63
  private writeScheduled;
96
64
  private pendingSyncAcks;
97
- /**
98
- * Callback for receiving direct messages.
99
- * @param from - Name of the sending agent
100
- * @param payload - Message payload containing body, kind, and optional data
101
- * @param messageId - Unique message identifier
102
- * @param meta - Optional metadata (sync info, etc.)
103
- * @param originalTo - Original recipient (useful for detecting broadcasts when originalTo='*')
104
- */
105
65
  onMessage?: (from: string, payload: SendPayload, messageId: string, meta?: SendMeta, originalTo?: string) => void;
106
66
  /**
107
67
  * Callback for channel messages.
108
- * @param from - Name of the sending agent
109
- * @param channel - Channel name (e.g., '#general')
110
- * @param body - Message body text
111
- * @param envelope - Full message envelope with metadata
112
68
  */
113
69
  onChannelMessage?: (from: string, channel: string, body: string, envelope: Envelope<ChannelMessagePayload>) => void;
114
- /**
115
- * Callback for connection state changes.
116
- * @param state - New connection state: 'DISCONNECTED' | 'CONNECTING' | 'HANDSHAKING' | 'READY' | 'BACKOFF'
117
- */
118
70
  onStateChange?: (state: ClientState) => void;
119
- /**
120
- * Callback for errors.
121
- * @param error - The error that occurred
122
- */
123
71
  onError?: (error: Error) => void;
124
72
  constructor(config?: Partial<ClientConfig>);
125
73
  get state(): ClientState;
@@ -138,30 +86,7 @@ export declare class RelayClient {
138
86
  */
139
87
  destroy(): void;
140
88
  /**
141
- * Send a message to another agent, channel, or broadcast.
142
- *
143
- * @param to - Recipient: agent name, '#channel', or '*' for broadcast
144
- * @param body - Message content
145
- * @param kind - Message type (default: 'message')
146
- * @param data - Optional structured data to include
147
- * @param thread - Optional thread ID for conversation threading
148
- * @param meta - Optional metadata (sync info, etc.)
149
- * @returns true if message was queued, false if not connected
150
- *
151
- * @example
152
- * ```typescript
153
- * // Direct message
154
- * client.sendMessage('Worker1', 'Start the task');
155
- *
156
- * // Channel message
157
- * client.sendMessage('#general', 'Team update');
158
- *
159
- * // Broadcast to all agents
160
- * client.sendMessage('*', 'System announcement');
161
- *
162
- * // With structured data
163
- * client.sendMessage('Worker1', 'Process this', 'task', { priority: 'high' });
164
- * ```
89
+ * Send a message to another agent.
165
90
  */
166
91
  sendMessage(to: string, body: string, kind?: PayloadKind, data?: Record<string, unknown>, thread?: string, meta?: SendMeta): boolean;
167
92
  /**
@@ -169,28 +94,7 @@ export declare class RelayClient {
169
94
  */
170
95
  sendAck(payload: AckPayload): boolean;
171
96
  /**
172
- * Send a message and wait for acknowledgment response.
173
- *
174
- * This is useful for request-response patterns where you need to wait for
175
- * the recipient to process your message and reply.
176
- *
177
- * @param to - Recipient agent name
178
- * @param body - Message content
179
- * @param options - Options including timeout, thread, etc.
180
- * @returns Promise that resolves with the ACK payload when recipient responds
181
- * @throws Error if client not ready or timeout exceeded
182
- *
183
- * @example
184
- * ```typescript
185
- * try {
186
- * const response = await client.sendAndWait('Worker', 'Process this task', {
187
- * timeoutMs: 30000, // 30 second timeout
188
- * });
189
- * console.log('Worker responded:', response);
190
- * } catch (err) {
191
- * console.error('Worker did not respond in time');
192
- * }
193
- * ```
97
+ * Send a message and wait for ACK response.
194
98
  */
195
99
  sendAndWait(to: string, body: string, options?: SyncOptions): Promise<AckPayload>;
196
100
  /**