agent-relay 2.0.25 → 2.0.26

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 (59) hide show
  1. package/package.json +16 -16
  2. package/packages/api-types/package.json +1 -1
  3. package/packages/bridge/package.json +8 -8
  4. package/packages/cli-tester/package.json +1 -1
  5. package/packages/config/package.json +2 -2
  6. package/packages/continuity/package.json +1 -1
  7. package/packages/daemon/dist/consensus-integration.d.ts +2 -1
  8. package/packages/daemon/dist/consensus.d.ts +1 -3
  9. package/packages/daemon/dist/enhanced-features.d.ts +2 -1
  10. package/packages/daemon/dist/orchestrator.js +4 -3
  11. package/packages/daemon/dist/server.js +48 -0
  12. package/packages/daemon/package.json +12 -12
  13. package/packages/hooks/dist/inbox-check/types.d.ts +6 -1
  14. package/packages/hooks/dist/inbox-check/utils.d.ts +3 -3
  15. package/packages/hooks/package.json +4 -4
  16. package/packages/mcp/dist/client.d.ts +57 -46
  17. package/packages/mcp/dist/client.js +107 -81
  18. package/packages/mcp/dist/server.js +61 -1
  19. package/packages/mcp/dist/tools/index.d.ts +5 -0
  20. package/packages/mcp/dist/tools/index.js +5 -0
  21. package/packages/mcp/dist/tools/relay-broadcast.d.ts +20 -0
  22. package/packages/mcp/dist/tools/relay-broadcast.js +25 -0
  23. package/packages/mcp/dist/tools/relay-channel.d.ts +49 -0
  24. package/packages/mcp/dist/tools/relay-channel.js +76 -0
  25. package/packages/mcp/dist/tools/relay-consensus.d.ts +45 -0
  26. package/packages/mcp/dist/tools/relay-consensus.js +80 -0
  27. package/packages/mcp/dist/tools/relay-inbox.d.ts +1 -1
  28. package/packages/mcp/dist/tools/relay-send.d.ts +2 -2
  29. package/packages/mcp/dist/tools/relay-shadow.d.ts +30 -0
  30. package/packages/mcp/dist/tools/relay-shadow.js +55 -0
  31. package/packages/mcp/dist/tools/relay-subscribe.d.ts +27 -0
  32. package/packages/mcp/dist/tools/relay-subscribe.js +49 -0
  33. package/packages/mcp/package.json +3 -2
  34. package/packages/memory/package.json +2 -2
  35. package/packages/policy/package.json +2 -2
  36. package/packages/protocol/dist/types.d.ts +130 -2
  37. package/packages/protocol/package.json +1 -1
  38. package/packages/resiliency/package.json +1 -1
  39. package/packages/sdk/dist/client.d.ts +21 -1
  40. package/packages/sdk/dist/client.js +26 -2
  41. package/packages/sdk/dist/index.d.ts +1 -1
  42. package/packages/sdk/dist/protocol/index.d.ts +4 -2
  43. package/packages/sdk/dist/protocol/index.js +4 -2
  44. package/packages/sdk/package.json +2 -2
  45. package/packages/spawner/package.json +1 -1
  46. package/packages/state/package.json +1 -1
  47. package/packages/storage/package.json +2 -2
  48. package/packages/telemetry/package.json +1 -1
  49. package/packages/trajectory/package.json +2 -2
  50. package/packages/user-directory/package.json +2 -2
  51. package/packages/utils/package.json +1 -1
  52. package/packages/wrapper/package.json +6 -6
  53. package/scripts/post-publish-verify/README.md +80 -0
  54. package/scripts/post-publish-verify/run-verify.sh +127 -0
  55. package/scripts/post-publish-verify/verify-install.sh +249 -0
  56. package/packages/sdk/dist/protocol/framing.d.ts +0 -80
  57. package/packages/sdk/dist/protocol/framing.js +0 -206
  58. package/packages/sdk/dist/protocol/types.d.ts +0 -560
  59. package/packages/sdk/dist/protocol/types.js +0 -8
@@ -1,48 +1,15 @@
1
1
  /**
2
2
  * RelayClient - Client for connecting to the Agent Relay daemon
3
+ *
4
+ * This module uses @agent-relay/protocol for wire format handling
5
+ * to avoid code duplication with the SDK.
3
6
  */
4
7
  import { createConnection } from 'node:net';
5
8
  import { randomUUID } from 'node:crypto';
6
9
  import { discoverSocket } from './cloud.js';
7
10
  import { DaemonNotRunningError } from './errors.js';
8
- // Protocol version
9
- const PROTOCOL_VERSION = 1;
10
- /**
11
- * Encode a message envelope into a length-prefixed frame (legacy format).
12
- * Format: 4-byte big-endian length + JSON payload
13
- */
14
- function encodeFrame(envelope) {
15
- const json = JSON.stringify(envelope);
16
- const data = Buffer.from(json, 'utf-8');
17
- const header = Buffer.alloc(4);
18
- header.writeUInt32BE(data.length, 0);
19
- return Buffer.concat([header, data]);
20
- }
21
- /**
22
- * Frame parser for length-prefixed messages.
23
- */
24
- class FrameParser {
25
- buffer = Buffer.alloc(0);
26
- push(data) {
27
- this.buffer = Buffer.concat([this.buffer, data]);
28
- const frames = [];
29
- while (this.buffer.length >= 4) {
30
- const frameLength = this.buffer.readUInt32BE(0);
31
- const totalLength = 4 + frameLength;
32
- if (this.buffer.length < totalLength)
33
- break;
34
- const payload = this.buffer.subarray(4, totalLength);
35
- this.buffer = this.buffer.subarray(totalLength);
36
- try {
37
- frames.push(JSON.parse(payload.toString('utf-8')));
38
- }
39
- catch {
40
- // Skip malformed frames
41
- }
42
- }
43
- return frames;
44
- }
45
- }
11
+ // Import shared protocol types and framing utilities
12
+ import { encodeFrameLegacy, FrameParser, PROTOCOL_VERSION, } from '@agent-relay/protocol';
46
13
  export function createRelayClient(options) {
47
14
  const { agentName, project = 'default', timeout = 5000 } = options;
48
15
  // Prefer explicit socketPath option over discovery to avoid finding wrong daemon
@@ -55,9 +22,6 @@ export function createRelayClient(options) {
55
22
  /**
56
23
  * Fire-and-forget: Send a message without waiting for any response.
57
24
  * Used for SEND and SPAWN where we don't expect daemon to reply.
58
- * @param type Message type
59
- * @param payload Message payload (for SEND: must be SendPayload with kind, body, etc.)
60
- * @param envelopeProps Envelope-level routing (from, to) - NOT in payload!
61
25
  */
62
26
  function fireAndForget(type, payload, envelopeProps) {
63
27
  return new Promise((resolve, reject) => {
@@ -68,15 +32,12 @@ export function createRelayClient(options) {
68
32
  id,
69
33
  ts: Date.now(),
70
34
  payload,
35
+ from: envelopeProps?.from,
36
+ to: envelopeProps?.to,
71
37
  };
72
- // Add from/to at envelope level (required for SEND messages)
73
- if (envelopeProps?.from)
74
- envelope.from = envelopeProps.from;
75
- if (envelopeProps?.to)
76
- envelope.to = envelopeProps.to;
77
38
  const socket = createConnection(socketPath);
78
39
  socket.on('connect', () => {
79
- socket.write(encodeFrame(envelope));
40
+ socket.write(encodeFrameLegacy(envelope));
80
41
  socket.end();
81
42
  resolve();
82
43
  });
@@ -94,34 +55,26 @@ export function createRelayClient(options) {
94
55
  /**
95
56
  * Request-response: Send a message and wait for daemon to respond.
96
57
  * Used for queries (STATUS, INBOX, etc.) and blocking sends (waits for ACK).
97
- * @param type Message type
98
- * @param payload Message payload (for SEND: must be SendPayload with kind, body, etc.)
99
- * @param customTimeout Optional timeout override
100
- * @param payloadMeta Optional sync metadata for blocking sends
101
- * @param envelopeProps Envelope-level routing (from, to) - NOT in payload!
102
58
  */
103
59
  async function request(type, payload, customTimeout, payloadMeta, envelopeProps) {
104
60
  return new Promise((resolve, reject) => {
105
61
  const id = generateId();
106
62
  const correlationId = payloadMeta?.sync?.correlationId;
107
- // Build a proper protocol envelope
108
63
  const envelope = {
109
64
  v: PROTOCOL_VERSION,
110
65
  type,
111
66
  id,
112
67
  ts: Date.now(),
113
68
  payload,
69
+ from: envelopeProps?.from,
70
+ to: envelopeProps?.to,
114
71
  };
115
- // Add from/to at envelope level (required for SEND messages)
116
- if (envelopeProps?.from)
117
- envelope.from = envelopeProps.from;
118
- if (envelopeProps?.to)
119
- envelope.to = envelopeProps.to;
120
72
  if (payloadMeta) {
121
73
  envelope.payload_meta = payloadMeta;
122
74
  }
123
75
  let timedOut = false;
124
76
  const parser = new FrameParser();
77
+ parser.setLegacyMode(true); // Use legacy 4-byte header format
125
78
  const socket = createConnection(socketPath);
126
79
  const effectiveTimeout = customTimeout ?? timeout;
127
80
  const timeoutId = setTimeout(() => {
@@ -129,22 +82,20 @@ export function createRelayClient(options) {
129
82
  socket.destroy();
130
83
  reject(new Error(`Request timeout after ${effectiveTimeout}ms`));
131
84
  }, effectiveTimeout);
132
- socket.on('connect', () => socket.write(encodeFrame(envelope)));
85
+ socket.on('connect', () => socket.write(encodeFrameLegacy(envelope)));
133
86
  socket.on('data', (data) => {
134
- // Ignore data if we've already timed out
135
87
  if (timedOut)
136
88
  return;
137
89
  const frames = parser.push(data);
138
90
  for (const response of frames) {
139
91
  const responsePayload = response.payload;
140
- // Check if this is a response to our request (by id, replyTo, or correlationId for blocking sends)
92
+ // Check if this is a response to our request
141
93
  const isMatchingResponse = response.id === id ||
142
94
  responsePayload?.replyTo === id ||
143
95
  (correlationId && responsePayload?.correlationId === correlationId);
144
96
  if (isMatchingResponse) {
145
97
  clearTimeout(timeoutId);
146
98
  socket.end();
147
- // Handle error responses
148
99
  if (response.type === 'ERROR') {
149
100
  reject(new Error(responsePayload?.message || responsePayload?.code || 'Unknown error'));
150
101
  }
@@ -160,7 +111,6 @@ export function createRelayClient(options) {
160
111
  });
161
112
  socket.on('error', (err) => {
162
113
  clearTimeout(timeoutId);
163
- // Provide user-friendly error for common connection failures
164
114
  const errno = err.code;
165
115
  if (errno === 'ECONNREFUSED' || errno === 'ENOENT') {
166
116
  reject(new DaemonNotRunningError(`Cannot connect to daemon at ${socketPath}`));
@@ -173,30 +123,106 @@ export function createRelayClient(options) {
173
123
  }
174
124
  return {
175
125
  async send(to, message, opts = {}) {
176
- // Fire-and-forget: daemon doesn't respond to non-blocking SEND
177
- // from/to must be at envelope level, kind/body/thread in payload
178
- await fireAndForget('SEND', { kind: 'message', body: message, thread: opts.thread }, { from: agentName, to });
126
+ const payload = { kind: 'message', body: message, thread: opts.thread };
127
+ await fireAndForget('SEND', payload, { from: agentName, to });
179
128
  },
180
129
  async sendAndWait(to, message, opts = {}) {
181
- // Use proper SEND with sync.blocking - daemon handles the wait and returns ACK
182
- // from/to must be at envelope level, kind/body/thread in payload
183
130
  const waitTimeout = opts.timeoutMs || 30000;
184
131
  const correlationId = randomUUID();
185
- const r = await request('SEND', {
186
- kind: 'message',
187
- body: message,
188
- thread: opts.thread,
189
- }, waitTimeout + 5000, {
190
- sync: {
191
- blocking: true,
192
- correlationId,
193
- timeoutMs: waitTimeout,
194
- },
195
- }, { from: agentName, to });
132
+ const payload = { kind: 'message', body: message, thread: opts.thread };
133
+ const r = await request('SEND', payload, waitTimeout + 5000, { sync: { blocking: true, correlationId, timeoutMs: waitTimeout } }, { from: agentName, to });
196
134
  return { from: r.from ?? to, content: r.response ?? '', thread: opts.thread };
197
135
  },
136
+ async broadcast(message, opts = {}) {
137
+ const payload = { kind: opts.kind || 'message', body: message };
138
+ await fireAndForget('SEND', payload, { from: agentName, to: '*' });
139
+ },
140
+ async subscribe(topic) {
141
+ try {
142
+ await fireAndForget('SUBSCRIBE', { topic }, { from: agentName });
143
+ return { success: true };
144
+ }
145
+ catch (e) {
146
+ return { success: false, error: e instanceof Error ? e.message : String(e) };
147
+ }
148
+ },
149
+ async unsubscribe(topic) {
150
+ try {
151
+ await fireAndForget('UNSUBSCRIBE', { topic }, { from: agentName });
152
+ return { success: true };
153
+ }
154
+ catch (e) {
155
+ return { success: false, error: e instanceof Error ? e.message : String(e) };
156
+ }
157
+ },
158
+ async joinChannel(channel, displayName) {
159
+ try {
160
+ await fireAndForget('CHANNEL_JOIN', { channel, displayName }, { from: agentName });
161
+ return { success: true };
162
+ }
163
+ catch (e) {
164
+ return { success: false, error: e instanceof Error ? e.message : String(e) };
165
+ }
166
+ },
167
+ async leaveChannel(channel, reason) {
168
+ try {
169
+ await fireAndForget('CHANNEL_LEAVE', { channel, reason }, { from: agentName });
170
+ return { success: true };
171
+ }
172
+ catch (e) {
173
+ return { success: false, error: e instanceof Error ? e.message : String(e) };
174
+ }
175
+ },
176
+ async sendChannelMessage(channel, message, opts = {}) {
177
+ await fireAndForget('CHANNEL_MESSAGE', { channel, body: message, thread: opts.thread }, { from: agentName });
178
+ },
179
+ async bindAsShadow(primaryAgent, opts = {}) {
180
+ try {
181
+ await fireAndForget('SHADOW_BIND', { primaryAgent, speakOn: opts.speakOn }, { from: agentName });
182
+ return { success: true };
183
+ }
184
+ catch (e) {
185
+ return { success: false, error: e instanceof Error ? e.message : String(e) };
186
+ }
187
+ },
188
+ async unbindAsShadow(primaryAgent) {
189
+ try {
190
+ await fireAndForget('SHADOW_UNBIND', { primaryAgent }, { from: agentName });
191
+ return { success: true };
192
+ }
193
+ catch (e) {
194
+ return { success: false, error: e instanceof Error ? e.message : String(e) };
195
+ }
196
+ },
197
+ async createProposal(opts) {
198
+ try {
199
+ await fireAndForget('PROPOSAL_CREATE', {
200
+ id: opts.id,
201
+ description: opts.description,
202
+ options: opts.options,
203
+ votingMethod: opts.votingMethod || 'majority',
204
+ deadline: opts.deadline,
205
+ }, { from: agentName });
206
+ return { success: true };
207
+ }
208
+ catch (e) {
209
+ return { success: false, error: e instanceof Error ? e.message : String(e) };
210
+ }
211
+ },
212
+ async vote(opts) {
213
+ try {
214
+ await fireAndForget('VOTE', {
215
+ proposalId: opts.proposalId,
216
+ vote: opts.vote,
217
+ reason: opts.reason,
218
+ }, { from: agentName });
219
+ return { success: true };
220
+ }
221
+ catch (e) {
222
+ return { success: false, error: e instanceof Error ? e.message : String(e) };
223
+ }
224
+ },
198
225
  async spawn(opts) {
199
- // Fire-and-forget: daemon handles spawning, agent will message when ready
200
226
  try {
201
227
  const payload = {
202
228
  name: opts.name,
@@ -204,7 +230,7 @@ export function createRelayClient(options) {
204
230
  task: opts.task,
205
231
  model: opts.model,
206
232
  cwd: opts.cwd,
207
- spawnerName: agentName, // Parent agent making the spawn request
233
+ spawnerName: agentName,
208
234
  };
209
235
  await fireAndForget('SPAWN', payload);
210
236
  return { success: true };
@@ -1,7 +1,7 @@
1
1
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
2
2
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
3
3
  import { CallToolRequestSchema, ListToolsRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
4
- import { relaySendTool, relaySendSchema, handleRelaySend, relayInboxTool, relayInboxSchema, handleRelayInbox, relayWhoTool, relayWhoSchema, handleRelayWho, relaySpawnTool, relaySpawnSchema, handleRelaySpawn, relayReleaseTool, relayReleaseSchema, handleRelayRelease, relayStatusTool, relayStatusSchema, handleRelayStatus, relayLogsTool, relayLogsSchema, handleRelayLogs, relayMetricsTool, relayMetricsSchema, handleRelayMetrics, relayHealthTool, relayHealthSchema, handleRelayHealth, relayContinuityTool, relayContinuitySchema, handleRelayContinuity, relayConnectedTool, relayConnectedSchema, handleRelayConnected, relayRemoveAgentTool, relayRemoveAgentSchema, handleRelayRemoveAgent, } from './tools/index.js';
4
+ import { relaySendTool, relaySendSchema, handleRelaySend, relayInboxTool, relayInboxSchema, handleRelayInbox, relayWhoTool, relayWhoSchema, handleRelayWho, relaySpawnTool, relaySpawnSchema, handleRelaySpawn, relayReleaseTool, relayReleaseSchema, handleRelayRelease, relayStatusTool, relayStatusSchema, handleRelayStatus, relayLogsTool, relayLogsSchema, handleRelayLogs, relayMetricsTool, relayMetricsSchema, handleRelayMetrics, relayHealthTool, relayHealthSchema, handleRelayHealth, relayContinuityTool, relayContinuitySchema, handleRelayContinuity, relayConnectedTool, relayConnectedSchema, handleRelayConnected, relayRemoveAgentTool, relayRemoveAgentSchema, handleRelayRemoveAgent, relayBroadcastTool, relayBroadcastSchema, handleRelayBroadcast, relaySubscribeTool, relaySubscribeSchema, handleRelaySubscribe, relayUnsubscribeTool, relayUnsubscribeSchema, handleRelayUnsubscribe, relayChannelJoinTool, relayChannelJoinSchema, handleRelayChannelJoin, relayChannelLeaveTool, relayChannelLeaveSchema, handleRelayChannelLeave, relayChannelMessageTool, relayChannelMessageSchema, handleRelayChannelMessage, relayShadowBindTool, relayShadowBindSchema, handleRelayShadowBind, relayShadowUnbindTool, relayShadowUnbindSchema, handleRelayShadowUnbind, relayProposalTool, relayProposalSchema, handleRelayProposal, relayVoteTool, relayVoteSchema, handleRelayVote, } from './tools/index.js';
5
5
  import { protocolPrompt, getProtocolPrompt } from './prompts/index.js';
6
6
  import { agentsResource, getAgentsResource, inboxResource, getInboxResource, projectResource, getProjectResource, } from './resources/index.js';
7
7
  /**
@@ -20,6 +20,16 @@ const TOOLS = [
20
20
  relayMetricsTool,
21
21
  relayHealthTool,
22
22
  relayContinuityTool,
23
+ relayBroadcastTool,
24
+ relaySubscribeTool,
25
+ relayUnsubscribeTool,
26
+ relayChannelJoinTool,
27
+ relayChannelLeaveTool,
28
+ relayChannelMessageTool,
29
+ relayShadowBindTool,
30
+ relayShadowUnbindTool,
31
+ relayProposalTool,
32
+ relayVoteTool,
23
33
  ];
24
34
  /**
25
35
  * All available prompts
@@ -115,6 +125,56 @@ export function createMCPServer(client, config) {
115
125
  result = await handleRelayContinuity(client, input);
116
126
  break;
117
127
  }
128
+ case 'relay_broadcast': {
129
+ const input = relayBroadcastSchema.parse(args);
130
+ result = await handleRelayBroadcast(client, input);
131
+ break;
132
+ }
133
+ case 'relay_subscribe': {
134
+ const input = relaySubscribeSchema.parse(args);
135
+ result = await handleRelaySubscribe(client, input);
136
+ break;
137
+ }
138
+ case 'relay_unsubscribe': {
139
+ const input = relayUnsubscribeSchema.parse(args);
140
+ result = await handleRelayUnsubscribe(client, input);
141
+ break;
142
+ }
143
+ case 'relay_channel_join': {
144
+ const input = relayChannelJoinSchema.parse(args);
145
+ result = await handleRelayChannelJoin(client, input);
146
+ break;
147
+ }
148
+ case 'relay_channel_leave': {
149
+ const input = relayChannelLeaveSchema.parse(args);
150
+ result = await handleRelayChannelLeave(client, input);
151
+ break;
152
+ }
153
+ case 'relay_channel_message': {
154
+ const input = relayChannelMessageSchema.parse(args);
155
+ result = await handleRelayChannelMessage(client, input);
156
+ break;
157
+ }
158
+ case 'relay_shadow_bind': {
159
+ const input = relayShadowBindSchema.parse(args);
160
+ result = await handleRelayShadowBind(client, input);
161
+ break;
162
+ }
163
+ case 'relay_shadow_unbind': {
164
+ const input = relayShadowUnbindSchema.parse(args);
165
+ result = await handleRelayShadowUnbind(client, input);
166
+ break;
167
+ }
168
+ case 'relay_proposal': {
169
+ const input = relayProposalSchema.parse(args);
170
+ result = await handleRelayProposal(client, input);
171
+ break;
172
+ }
173
+ case 'relay_vote': {
174
+ const input = relayVoteSchema.parse(args);
175
+ result = await handleRelayVote(client, input);
176
+ break;
177
+ }
118
178
  default:
119
179
  return {
120
180
  content: [
@@ -10,4 +10,9 @@ export { relayHealthTool, relayHealthSchema, handleRelayHealth, type RelayHealth
10
10
  export { relayContinuityTool, relayContinuitySchema, handleRelayContinuity, type RelayContinuityInput, } from './relay-continuity.js';
11
11
  export { relayConnectedTool, relayConnectedSchema, handleRelayConnected, type RelayConnectedInput, } from './relay-connected.js';
12
12
  export { relayRemoveAgentTool, relayRemoveAgentSchema, handleRelayRemoveAgent, type RelayRemoveAgentInput, } from './relay-remove-agent.js';
13
+ export { relayBroadcastTool, relayBroadcastSchema, handleRelayBroadcast, type RelayBroadcastInput, } from './relay-broadcast.js';
14
+ export { relaySubscribeTool, relaySubscribeSchema, handleRelaySubscribe, type RelaySubscribeInput, relayUnsubscribeTool, relayUnsubscribeSchema, handleRelayUnsubscribe, type RelayUnsubscribeInput, } from './relay-subscribe.js';
15
+ export { relayChannelJoinTool, relayChannelJoinSchema, handleRelayChannelJoin, type RelayChannelJoinInput, relayChannelLeaveTool, relayChannelLeaveSchema, handleRelayChannelLeave, type RelayChannelLeaveInput, relayChannelMessageTool, relayChannelMessageSchema, handleRelayChannelMessage, type RelayChannelMessageInput, } from './relay-channel.js';
16
+ export { relayShadowBindTool, relayShadowBindSchema, handleRelayShadowBind, type RelayShadowBindInput, relayShadowUnbindTool, relayShadowUnbindSchema, handleRelayShadowUnbind, type RelayShadowUnbindInput, } from './relay-shadow.js';
17
+ export { relayProposalTool, relayProposalSchema, handleRelayProposal, type RelayProposalInput, relayVoteTool, relayVoteSchema, handleRelayVote, type RelayVoteInput, } from './relay-consensus.js';
13
18
  //# sourceMappingURL=index.d.ts.map
@@ -10,4 +10,9 @@ export { relayHealthTool, relayHealthSchema, handleRelayHealth, } from './relay-
10
10
  export { relayContinuityTool, relayContinuitySchema, handleRelayContinuity, } from './relay-continuity.js';
11
11
  export { relayConnectedTool, relayConnectedSchema, handleRelayConnected, } from './relay-connected.js';
12
12
  export { relayRemoveAgentTool, relayRemoveAgentSchema, handleRelayRemoveAgent, } from './relay-remove-agent.js';
13
+ export { relayBroadcastTool, relayBroadcastSchema, handleRelayBroadcast, } from './relay-broadcast.js';
14
+ export { relaySubscribeTool, relaySubscribeSchema, handleRelaySubscribe, relayUnsubscribeTool, relayUnsubscribeSchema, handleRelayUnsubscribe, } from './relay-subscribe.js';
15
+ export { relayChannelJoinTool, relayChannelJoinSchema, handleRelayChannelJoin, relayChannelLeaveTool, relayChannelLeaveSchema, handleRelayChannelLeave, relayChannelMessageTool, relayChannelMessageSchema, handleRelayChannelMessage, } from './relay-channel.js';
16
+ export { relayShadowBindTool, relayShadowBindSchema, handleRelayShadowBind, relayShadowUnbindTool, relayShadowUnbindSchema, handleRelayShadowUnbind, } from './relay-shadow.js';
17
+ export { relayProposalTool, relayProposalSchema, handleRelayProposal, relayVoteTool, relayVoteSchema, handleRelayVote, } from './relay-consensus.js';
13
18
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * relay_broadcast - Broadcast a message to all connected agents
3
+ */
4
+ import { z } from 'zod';
5
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js';
6
+ import type { RelayClient } from '../client.js';
7
+ export declare const relayBroadcastSchema: z.ZodObject<{
8
+ message: z.ZodString;
9
+ kind: z.ZodOptional<z.ZodEnum<["message", "action", "state", "thinking"]>>;
10
+ }, "strip", z.ZodTypeAny, {
11
+ message: string;
12
+ kind?: "message" | "action" | "state" | "thinking" | undefined;
13
+ }, {
14
+ message: string;
15
+ kind?: "message" | "action" | "state" | "thinking" | undefined;
16
+ }>;
17
+ export type RelayBroadcastInput = z.infer<typeof relayBroadcastSchema>;
18
+ export declare const relayBroadcastTool: Tool;
19
+ export declare function handleRelayBroadcast(client: RelayClient, input: RelayBroadcastInput): Promise<string>;
20
+ //# sourceMappingURL=relay-broadcast.d.ts.map
@@ -0,0 +1,25 @@
1
+ /**
2
+ * relay_broadcast - Broadcast a message to all connected agents
3
+ */
4
+ import { z } from 'zod';
5
+ export const relayBroadcastSchema = z.object({
6
+ message: z.string().describe('The message to broadcast to all agents'),
7
+ kind: z.enum(['message', 'action', 'state', 'thinking']).optional().describe('Message kind (default: message)'),
8
+ });
9
+ export const relayBroadcastTool = {
10
+ name: 'relay_broadcast',
11
+ description: 'Broadcast a message to ALL connected agents at once. Use this when you need to send the same message to everyone.',
12
+ inputSchema: {
13
+ type: 'object',
14
+ properties: {
15
+ message: { type: 'string', description: 'The message to broadcast to all agents' },
16
+ kind: { type: 'string', enum: ['message', 'action', 'state', 'thinking'], description: 'Message kind (default: message)' },
17
+ },
18
+ required: ['message'],
19
+ },
20
+ };
21
+ export async function handleRelayBroadcast(client, input) {
22
+ await client.broadcast(input.message, { kind: input.kind });
23
+ return 'Message broadcast to all agents';
24
+ }
25
+ //# sourceMappingURL=relay-broadcast.js.map
@@ -0,0 +1,49 @@
1
+ /**
2
+ * relay_channel_join / relay_channel_leave / relay_channel_message - Channel operations
3
+ */
4
+ import { z } from 'zod';
5
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js';
6
+ import type { RelayClient } from '../client.js';
7
+ export declare const relayChannelJoinSchema: z.ZodObject<{
8
+ channel: z.ZodString;
9
+ display_name: z.ZodOptional<z.ZodString>;
10
+ }, "strip", z.ZodTypeAny, {
11
+ channel: string;
12
+ display_name?: string | undefined;
13
+ }, {
14
+ channel: string;
15
+ display_name?: string | undefined;
16
+ }>;
17
+ export type RelayChannelJoinInput = z.infer<typeof relayChannelJoinSchema>;
18
+ export declare const relayChannelJoinTool: Tool;
19
+ export declare function handleRelayChannelJoin(client: RelayClient, input: RelayChannelJoinInput): Promise<string>;
20
+ export declare const relayChannelLeaveSchema: z.ZodObject<{
21
+ channel: z.ZodString;
22
+ reason: z.ZodOptional<z.ZodString>;
23
+ }, "strip", z.ZodTypeAny, {
24
+ channel: string;
25
+ reason?: string | undefined;
26
+ }, {
27
+ channel: string;
28
+ reason?: string | undefined;
29
+ }>;
30
+ export type RelayChannelLeaveInput = z.infer<typeof relayChannelLeaveSchema>;
31
+ export declare const relayChannelLeaveTool: Tool;
32
+ export declare function handleRelayChannelLeave(client: RelayClient, input: RelayChannelLeaveInput): Promise<string>;
33
+ export declare const relayChannelMessageSchema: z.ZodObject<{
34
+ channel: z.ZodString;
35
+ message: z.ZodString;
36
+ thread: z.ZodOptional<z.ZodString>;
37
+ }, "strip", z.ZodTypeAny, {
38
+ message: string;
39
+ channel: string;
40
+ thread?: string | undefined;
41
+ }, {
42
+ message: string;
43
+ channel: string;
44
+ thread?: string | undefined;
45
+ }>;
46
+ export type RelayChannelMessageInput = z.infer<typeof relayChannelMessageSchema>;
47
+ export declare const relayChannelMessageTool: Tool;
48
+ export declare function handleRelayChannelMessage(client: RelayClient, input: RelayChannelMessageInput): Promise<string>;
49
+ //# sourceMappingURL=relay-channel.d.ts.map
@@ -0,0 +1,76 @@
1
+ /**
2
+ * relay_channel_join / relay_channel_leave / relay_channel_message - Channel operations
3
+ */
4
+ import { z } from 'zod';
5
+ // Join channel
6
+ export const relayChannelJoinSchema = z.object({
7
+ channel: z.string().describe('The channel name to join (e.g., "#general")'),
8
+ display_name: z.string().optional().describe('Optional display name to use in the channel'),
9
+ });
10
+ export const relayChannelJoinTool = {
11
+ name: 'relay_channel_join',
12
+ description: 'Join a channel to participate in group conversations. Channels start with #.',
13
+ inputSchema: {
14
+ type: 'object',
15
+ properties: {
16
+ channel: { type: 'string', description: 'The channel name to join (e.g., "#general")' },
17
+ display_name: { type: 'string', description: 'Optional display name to use in the channel' },
18
+ },
19
+ required: ['channel'],
20
+ },
21
+ };
22
+ export async function handleRelayChannelJoin(client, input) {
23
+ const result = await client.joinChannel(input.channel, input.display_name);
24
+ if (result.success) {
25
+ return `Joined channel "${input.channel}"`;
26
+ }
27
+ return `Failed to join channel: ${result.error}`;
28
+ }
29
+ // Leave channel
30
+ export const relayChannelLeaveSchema = z.object({
31
+ channel: z.string().describe('The channel name to leave'),
32
+ reason: z.string().optional().describe('Optional reason for leaving'),
33
+ });
34
+ export const relayChannelLeaveTool = {
35
+ name: 'relay_channel_leave',
36
+ description: 'Leave a channel you are currently in.',
37
+ inputSchema: {
38
+ type: 'object',
39
+ properties: {
40
+ channel: { type: 'string', description: 'The channel name to leave' },
41
+ reason: { type: 'string', description: 'Optional reason for leaving' },
42
+ },
43
+ required: ['channel'],
44
+ },
45
+ };
46
+ export async function handleRelayChannelLeave(client, input) {
47
+ const result = await client.leaveChannel(input.channel, input.reason);
48
+ if (result.success) {
49
+ return `Left channel "${input.channel}"`;
50
+ }
51
+ return `Failed to leave channel: ${result.error}`;
52
+ }
53
+ // Send channel message
54
+ export const relayChannelMessageSchema = z.object({
55
+ channel: z.string().describe('The channel to send the message to'),
56
+ message: z.string().describe('The message content'),
57
+ thread: z.string().optional().describe('Optional thread ID for threaded conversations'),
58
+ });
59
+ export const relayChannelMessageTool = {
60
+ name: 'relay_channel_message',
61
+ description: 'Send a message to a channel. You must be a member of the channel.',
62
+ inputSchema: {
63
+ type: 'object',
64
+ properties: {
65
+ channel: { type: 'string', description: 'The channel to send the message to' },
66
+ message: { type: 'string', description: 'The message content' },
67
+ thread: { type: 'string', description: 'Optional thread ID for threaded conversations' },
68
+ },
69
+ required: ['channel', 'message'],
70
+ },
71
+ };
72
+ export async function handleRelayChannelMessage(client, input) {
73
+ await client.sendChannelMessage(input.channel, input.message, { thread: input.thread });
74
+ return `Message sent to channel "${input.channel}"`;
75
+ }
76
+ //# sourceMappingURL=relay-channel.js.map
@@ -0,0 +1,45 @@
1
+ /**
2
+ * relay_proposal / relay_vote - Consensus/voting operations
3
+ */
4
+ import { z } from 'zod';
5
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js';
6
+ import type { RelayClient } from '../client.js';
7
+ export declare const relayProposalSchema: z.ZodObject<{
8
+ id: z.ZodString;
9
+ description: z.ZodString;
10
+ options: z.ZodArray<z.ZodString, "many">;
11
+ voting_method: z.ZodOptional<z.ZodEnum<["majority", "supermajority", "unanimous", "weighted", "quorum"]>>;
12
+ deadline: z.ZodOptional<z.ZodNumber>;
13
+ }, "strip", z.ZodTypeAny, {
14
+ id: string;
15
+ description: string;
16
+ options: string[];
17
+ deadline?: number | undefined;
18
+ voting_method?: "majority" | "supermajority" | "unanimous" | "weighted" | "quorum" | undefined;
19
+ }, {
20
+ id: string;
21
+ description: string;
22
+ options: string[];
23
+ deadline?: number | undefined;
24
+ voting_method?: "majority" | "supermajority" | "unanimous" | "weighted" | "quorum" | undefined;
25
+ }>;
26
+ export type RelayProposalInput = z.infer<typeof relayProposalSchema>;
27
+ export declare const relayProposalTool: Tool;
28
+ export declare function handleRelayProposal(client: RelayClient, input: RelayProposalInput): Promise<string>;
29
+ export declare const relayVoteSchema: z.ZodObject<{
30
+ proposal_id: z.ZodString;
31
+ vote: z.ZodString;
32
+ reason: z.ZodOptional<z.ZodString>;
33
+ }, "strip", z.ZodTypeAny, {
34
+ vote: string;
35
+ proposal_id: string;
36
+ reason?: string | undefined;
37
+ }, {
38
+ vote: string;
39
+ proposal_id: string;
40
+ reason?: string | undefined;
41
+ }>;
42
+ export type RelayVoteInput = z.infer<typeof relayVoteSchema>;
43
+ export declare const relayVoteTool: Tool;
44
+ export declare function handleRelayVote(client: RelayClient, input: RelayVoteInput): Promise<string>;
45
+ //# sourceMappingURL=relay-consensus.d.ts.map