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,560 +0,0 @@
1
- /**
2
- * Agent Relay Protocol Types
3
- * @agent-relay/sdk
4
- *
5
- * These types define the wire protocol for agent-to-agent communication.
6
- */
7
- export declare const PROTOCOL_VERSION = 1;
8
- export type MessageType = 'HELLO' | 'WELCOME' | 'SEND' | 'DELIVER' | 'ACK' | 'NACK' | 'PING' | 'PONG' | 'ERROR' | 'BUSY' | 'RESUME' | 'BYE' | 'STATE' | 'SYNC' | 'SYNC_SNAPSHOT' | 'SYNC_DELTA' | 'SUBSCRIBE' | 'UNSUBSCRIBE' | 'SHADOW_BIND' | 'SHADOW_UNBIND' | 'LOG' | 'CHANNEL_JOIN' | 'CHANNEL_LEAVE' | 'CHANNEL_MESSAGE' | 'CHANNEL_INFO' | 'CHANNEL_MEMBERS' | 'CHANNEL_TYPING' | 'SPAWN' | 'SPAWN_RESULT' | 'RELEASE' | 'RELEASE_RESULT' | 'STATUS' | 'STATUS_RESPONSE' | 'INBOX' | 'INBOX_RESPONSE' | 'LIST_AGENTS' | 'LIST_AGENTS_RESPONSE' | 'LIST_CONNECTED_AGENTS' | 'LIST_CONNECTED_AGENTS_RESPONSE' | 'REMOVE_AGENT' | 'REMOVE_AGENT_RESPONSE' | 'HEALTH' | 'HEALTH_RESPONSE' | 'METRICS' | 'METRICS_RESPONSE';
9
- export type PayloadKind = 'message' | 'action' | 'state' | 'thinking';
10
- /**
11
- * Base envelope structure for all protocol messages.
12
- */
13
- export interface Envelope<T = unknown> {
14
- /** Protocol version */
15
- v: number;
16
- /** Message type */
17
- type: MessageType;
18
- /** Unique message ID */
19
- id: string;
20
- /** Timestamp (Unix ms) */
21
- ts: number;
22
- /** Sender name */
23
- from?: string;
24
- /** Recipient name or '*' for broadcast */
25
- to?: string | '*';
26
- /** Topic for pub/sub */
27
- topic?: string;
28
- /** Message payload */
29
- payload: T;
30
- }
31
- /**
32
- * Entity type distinguishes between AI agents and human users.
33
- */
34
- export type EntityType = 'agent' | 'user';
35
- export interface HelloPayload {
36
- /** Agent name */
37
- agent: string;
38
- /** Client capabilities */
39
- capabilities: {
40
- ack: boolean;
41
- resume: boolean;
42
- max_inflight: number;
43
- supports_topics: boolean;
44
- };
45
- /** Entity type: 'agent' (default) or 'user' */
46
- entityType?: EntityType;
47
- /** CLI identifier (claude, codex, gemini, etc.) */
48
- cli?: string;
49
- /** Program identifier */
50
- program?: string;
51
- /** Model identifier */
52
- model?: string;
53
- /** Task/role description */
54
- task?: string;
55
- /** Working directory */
56
- workingDirectory?: string;
57
- /** Display name for human users */
58
- displayName?: string;
59
- /** Avatar URL for human users */
60
- avatarUrl?: string;
61
- /** Session resume info */
62
- session?: {
63
- resume_token?: string;
64
- };
65
- }
66
- export interface WelcomePayload {
67
- /** Session ID assigned by server */
68
- session_id: string;
69
- /** Token for session resume */
70
- resume_token?: string;
71
- /** Server configuration */
72
- server: {
73
- max_frame_bytes: number;
74
- heartbeat_ms: number;
75
- };
76
- }
77
- export interface SendPayload {
78
- /** Message type */
79
- kind: PayloadKind;
80
- /** Message body */
81
- body: string;
82
- /** Optional structured data */
83
- data?: Record<string, unknown>;
84
- /** Thread ID for grouping related messages */
85
- thread?: string;
86
- }
87
- export interface SyncMeta {
88
- /** Correlation ID for matching responses */
89
- correlationId: string;
90
- /** Timeout for blocking sends (ms) */
91
- timeoutMs?: number;
92
- /** Whether sender should block awaiting ACK */
93
- blocking: boolean;
94
- }
95
- export interface SendMeta {
96
- requires_ack?: boolean;
97
- ttl_ms?: number;
98
- /** Importance level (0-100, higher = more important) */
99
- importance?: number;
100
- /** Correlation ID for replies */
101
- replyTo?: string;
102
- /** Sync metadata for blocking sends */
103
- sync?: SyncMeta;
104
- }
105
- export interface DeliveryInfo {
106
- /** Delivery sequence number */
107
- seq: number;
108
- /** Session ID */
109
- session_id: string;
110
- /** Original 'to' field ('*' indicates broadcast) */
111
- originalTo?: string;
112
- }
113
- export interface AckPayload {
114
- /** ID of the message being acknowledged */
115
- ack_id: string;
116
- /** Sequence number */
117
- seq: number;
118
- /** Cumulative acknowledgment */
119
- cumulative_seq?: number;
120
- /** Selective acknowledgments */
121
- sack?: number[];
122
- /**
123
- * Correlation ID for matching ACK to original blocking SEND.
124
- * Set by daemon when forwarding ACK back to the sender.
125
- */
126
- correlationId?: string;
127
- /**
128
- * Response status for sync messaging.
129
- * Common values: 'OK', 'ERROR', 'ACCEPTED', 'REJECTED'.
130
- * Allows richer status codes than a simple boolean.
131
- */
132
- response?: string;
133
- /**
134
- * Optional structured response data.
135
- * Can contain any additional information the responder wants to include.
136
- */
137
- responseData?: unknown;
138
- }
139
- export interface NackPayload {
140
- /** ID of the message being rejected */
141
- ack_id: string;
142
- /** Rejection code */
143
- code?: 'BUSY' | 'INVALID' | 'FORBIDDEN' | 'STALE';
144
- /** Legacy reason field */
145
- reason?: 'busy' | 'invalid' | 'forbidden';
146
- /** Human-readable message */
147
- message?: string;
148
- }
149
- export interface BusyPayload {
150
- /** Time before retry (ms) */
151
- retry_after_ms: number;
152
- /** Current queue depth */
153
- queue_depth: number;
154
- }
155
- export interface PingPayload {
156
- nonce: string;
157
- }
158
- export interface PongPayload {
159
- nonce: string;
160
- }
161
- export type ErrorCode = 'BAD_REQUEST' | 'UNAUTHORIZED' | 'NOT_FOUND' | 'INTERNAL' | 'RESUME_TOO_OLD';
162
- export interface ErrorPayload {
163
- /** Error code */
164
- code: ErrorCode;
165
- /** Error message */
166
- message: string;
167
- /** Whether the error is fatal (connection should be closed) */
168
- fatal: boolean;
169
- }
170
- export interface LogPayload {
171
- /** Log/output data */
172
- data: string;
173
- /** Timestamp (defaults to envelope ts) */
174
- timestamp?: number;
175
- }
176
- export interface SyncStream {
177
- topic: string;
178
- peer: string;
179
- last_seq: number;
180
- server_last_seq?: number;
181
- }
182
- export interface SyncPayload {
183
- session_id: string;
184
- streams: SyncStream[];
185
- }
186
- /**
187
- * Attachment metadata for messages.
188
- */
189
- export interface MessageAttachment {
190
- id: string;
191
- filename: string;
192
- mimeType: string;
193
- size?: number;
194
- url?: string;
195
- data?: string;
196
- }
197
- /**
198
- * Payload for CHANNEL_JOIN message.
199
- */
200
- export interface ChannelJoinPayload {
201
- /** Channel to join (e.g., '#general') */
202
- channel: string;
203
- /** Display name for the channel member list */
204
- displayName?: string;
205
- /** Avatar URL */
206
- avatarUrl?: string;
207
- /** Member name to add (for admin operations) */
208
- member?: string;
209
- }
210
- /**
211
- * Payload for CHANNEL_LEAVE message.
212
- */
213
- export interface ChannelLeavePayload {
214
- /** Channel to leave */
215
- channel: string;
216
- /** Reason for leaving */
217
- reason?: string;
218
- /** Member name to remove (for admin operations) */
219
- member?: string;
220
- }
221
- /**
222
- * Payload for CHANNEL_MESSAGE.
223
- */
224
- export interface ChannelMessagePayload {
225
- /** Target channel */
226
- channel: string;
227
- /** Message content */
228
- body: string;
229
- /** Thread ID for threaded replies */
230
- thread?: string;
231
- /** Mentioned usernames/agent names */
232
- mentions?: string[];
233
- /** File attachments */
234
- attachments?: MessageAttachment[];
235
- /** Optional structured data */
236
- data?: Record<string, unknown>;
237
- }
238
- export type SpeakOnTrigger = 'SESSION_END' | 'CODE_WRITTEN' | 'REVIEW_REQUEST' | 'EXPLICIT_ASK' | 'ALL_MESSAGES';
239
- export interface ShadowConfig {
240
- /** Primary agent this shadow is attached to */
241
- primaryAgent: string;
242
- /** When the shadow should speak */
243
- speakOn: SpeakOnTrigger[];
244
- /** Receive messages TO the primary */
245
- receiveIncoming?: boolean;
246
- /** Receive messages FROM the primary */
247
- receiveOutgoing?: boolean;
248
- }
249
- export interface ShadowBindPayload {
250
- primaryAgent: string;
251
- speakOn?: SpeakOnTrigger[];
252
- receiveIncoming?: boolean;
253
- receiveOutgoing?: boolean;
254
- }
255
- export interface ShadowUnbindPayload {
256
- primaryAgent: string;
257
- }
258
- export interface SpawnPayload {
259
- /** Name for the new agent */
260
- name: string;
261
- /** CLI to use (claude, codex, gemini, etc.) */
262
- cli: string;
263
- /** Task description */
264
- task: string;
265
- /** Team name */
266
- team?: string;
267
- /** Working directory */
268
- cwd?: string;
269
- /** Socket path for the spawned agent */
270
- socketPath?: string;
271
- /** Parent agent name */
272
- spawnerName?: string;
273
- /** Interactive mode */
274
- interactive?: boolean;
275
- /** Spawn as shadow of this agent */
276
- shadowOf?: string;
277
- /** Shadow speak-on triggers */
278
- shadowSpeakOn?: SpeakOnTrigger[];
279
- /** User ID for cloud persistence */
280
- userId?: string;
281
- }
282
- export interface SpawnPolicyDecision {
283
- allowed: boolean;
284
- reason?: string;
285
- quotaRemaining?: number;
286
- }
287
- export interface SpawnResultPayload {
288
- /** Correlation ID (matches original SPAWN envelope ID) */
289
- replyTo: string;
290
- /** Whether spawn succeeded */
291
- success: boolean;
292
- /** Spawned agent name */
293
- name: string;
294
- /** Process ID (if successful) */
295
- pid?: number;
296
- /** Error message (if failed) */
297
- error?: string;
298
- /** Policy decision (if blocked) */
299
- policyDecision?: SpawnPolicyDecision;
300
- }
301
- export interface ReleasePayload {
302
- /** Agent name to release */
303
- name: string;
304
- }
305
- export interface ReleaseResultPayload {
306
- /** Correlation ID */
307
- replyTo: string;
308
- /** Whether release succeeded */
309
- success: boolean;
310
- /** Released agent name */
311
- name: string;
312
- /** Error message (if failed) */
313
- error?: string;
314
- }
315
- export type ConsensusType = 'majority' | 'supermajority' | 'unanimous' | 'weighted' | 'quorum';
316
- export type VoteValue = 'approve' | 'reject' | 'abstain';
317
- export type ProposalStatus = 'pending' | 'approved' | 'rejected' | 'expired' | 'cancelled';
318
- /**
319
- * Options for creating a consensus proposal.
320
- */
321
- export interface CreateProposalOptions {
322
- /** Proposal title */
323
- title: string;
324
- /** Detailed description */
325
- description: string;
326
- /** Agents allowed to vote */
327
- participants: string[];
328
- /** Consensus type (default: majority) */
329
- consensusType?: ConsensusType;
330
- /** Timeout in milliseconds (default: 5 minutes) */
331
- timeoutMs?: number;
332
- /** Minimum votes required (for quorum type) */
333
- quorum?: number;
334
- /** Threshold for supermajority (0-1, default 0.67) */
335
- threshold?: number;
336
- }
337
- /**
338
- * Options for voting on a proposal.
339
- */
340
- export interface VoteOptions {
341
- /** Proposal ID to vote on */
342
- proposalId: string;
343
- /** Vote value */
344
- value: VoteValue;
345
- /** Optional reason for the vote */
346
- reason?: string;
347
- }
348
- /**
349
- * Payload for STATUS request.
350
- */
351
- export interface StatusPayload {
352
- }
353
- /**
354
- * Response payload for STATUS request.
355
- */
356
- export interface StatusResponsePayload {
357
- version?: string;
358
- uptime?: number;
359
- agentCount?: number;
360
- messageCount?: number;
361
- }
362
- /**
363
- * Payload for INBOX request.
364
- */
365
- export interface InboxPayload {
366
- agent: string;
367
- limit?: number;
368
- unreadOnly?: boolean;
369
- from?: string;
370
- channel?: string;
371
- }
372
- /**
373
- * A stored message in the inbox.
374
- */
375
- export interface InboxMessage {
376
- id: string;
377
- from: string;
378
- body: string;
379
- channel?: string;
380
- thread?: string;
381
- timestamp: number;
382
- }
383
- /**
384
- * Response payload for INBOX request.
385
- */
386
- export interface InboxResponsePayload {
387
- messages: InboxMessage[];
388
- }
389
- /**
390
- * Payload for LIST_AGENTS request.
391
- */
392
- export interface ListAgentsPayload {
393
- includeIdle?: boolean;
394
- project?: string;
395
- }
396
- /**
397
- * Agent info returned by LIST_AGENTS.
398
- */
399
- export interface AgentInfo {
400
- name: string;
401
- cli?: string;
402
- idle?: boolean;
403
- parent?: string;
404
- task?: string;
405
- connectedAt?: number;
406
- }
407
- /**
408
- * Response payload for LIST_AGENTS request.
409
- */
410
- export interface ListAgentsResponsePayload {
411
- agents: AgentInfo[];
412
- }
413
- /**
414
- * Payload for LIST_CONNECTED_AGENTS request.
415
- * Returns only currently connected agents (not historical/registered agents).
416
- */
417
- export interface ListConnectedAgentsPayload {
418
- project?: string;
419
- }
420
- /**
421
- * Response payload for LIST_CONNECTED_AGENTS request.
422
- */
423
- export interface ListConnectedAgentsResponsePayload {
424
- agents: AgentInfo[];
425
- }
426
- /**
427
- * Payload for REMOVE_AGENT request.
428
- * Removes an agent from the registry (sessions, agents.json).
429
- */
430
- export interface RemoveAgentPayload {
431
- name: string;
432
- /** If true, also removes all messages from/to this agent */
433
- removeMessages?: boolean;
434
- }
435
- /**
436
- * Response payload for REMOVE_AGENT request.
437
- */
438
- export interface RemoveAgentResponsePayload {
439
- success: boolean;
440
- removed: boolean;
441
- message?: string;
442
- }
443
- /**
444
- * Payload for HEALTH request.
445
- */
446
- export interface HealthPayload {
447
- includeCrashes?: boolean;
448
- includeAlerts?: boolean;
449
- }
450
- /**
451
- * A crash record.
452
- */
453
- export interface CrashRecord {
454
- id: string;
455
- agentName: string;
456
- crashedAt: string;
457
- likelyCause: string;
458
- summary?: string;
459
- }
460
- /**
461
- * An alert record.
462
- */
463
- export interface AlertRecord {
464
- id: string;
465
- agentName: string;
466
- alertType: string;
467
- message: string;
468
- createdAt: string;
469
- }
470
- /**
471
- * Response payload for HEALTH request.
472
- */
473
- export interface HealthResponsePayload {
474
- healthScore: number;
475
- summary: string;
476
- issues: Array<{
477
- severity: string;
478
- message: string;
479
- }>;
480
- recommendations: string[];
481
- crashes: CrashRecord[];
482
- alerts: AlertRecord[];
483
- stats: {
484
- totalCrashes24h: number;
485
- totalAlerts24h: number;
486
- agentCount: number;
487
- };
488
- }
489
- /**
490
- * Payload for METRICS request.
491
- */
492
- export interface MetricsPayload {
493
- agent?: string;
494
- }
495
- /**
496
- * Metrics for a single agent.
497
- */
498
- export interface AgentMetrics {
499
- name: string;
500
- pid?: number;
501
- status: string;
502
- rssBytes?: number;
503
- cpuPercent?: number;
504
- trend?: string;
505
- alertLevel?: string;
506
- highWatermark?: number;
507
- uptimeMs?: number;
508
- }
509
- /**
510
- * Response payload for METRICS request.
511
- */
512
- export interface MetricsResponsePayload {
513
- agents: AgentMetrics[];
514
- system: {
515
- totalMemory: number;
516
- freeMemory: number;
517
- heapUsed: number;
518
- };
519
- }
520
- export type HelloEnvelope = Envelope<HelloPayload>;
521
- export type WelcomeEnvelope = Envelope<WelcomePayload>;
522
- export type SendEnvelope = Envelope<SendPayload> & {
523
- payload_meta?: SendMeta;
524
- };
525
- export type DeliverEnvelope = Envelope<SendPayload> & {
526
- delivery: DeliveryInfo;
527
- payload_meta?: SendMeta;
528
- };
529
- export type AckEnvelope = Envelope<AckPayload>;
530
- export type NackEnvelope = Envelope<NackPayload>;
531
- export type PingEnvelope = Envelope<PingPayload>;
532
- export type PongEnvelope = Envelope<PongPayload>;
533
- export type ErrorEnvelope = Envelope<ErrorPayload>;
534
- export type BusyEnvelope = Envelope<BusyPayload>;
535
- export type LogEnvelope = Envelope<LogPayload>;
536
- export type ShadowBindEnvelope = Envelope<ShadowBindPayload>;
537
- export type ShadowUnbindEnvelope = Envelope<ShadowUnbindPayload>;
538
- export type SyncEnvelope = Envelope<SyncPayload>;
539
- export type SpawnEnvelope = Envelope<SpawnPayload>;
540
- export type SpawnResultEnvelope = Envelope<SpawnResultPayload>;
541
- export type ReleaseEnvelope = Envelope<ReleasePayload>;
542
- export type ReleaseResultEnvelope = Envelope<ReleaseResultPayload>;
543
- export type ChannelJoinEnvelope = Envelope<ChannelJoinPayload>;
544
- export type ChannelLeaveEnvelope = Envelope<ChannelLeavePayload>;
545
- export type ChannelMessageEnvelope = Envelope<ChannelMessagePayload>;
546
- export type StatusEnvelope = Envelope<StatusPayload>;
547
- export type StatusResponseEnvelope = Envelope<StatusResponsePayload>;
548
- export type InboxEnvelope = Envelope<InboxPayload>;
549
- export type InboxResponseEnvelope = Envelope<InboxResponsePayload>;
550
- export type ListAgentsEnvelope = Envelope<ListAgentsPayload>;
551
- export type ListAgentsResponseEnvelope = Envelope<ListAgentsResponsePayload>;
552
- export type ListConnectedAgentsEnvelope = Envelope<ListConnectedAgentsPayload>;
553
- export type ListConnectedAgentsResponseEnvelope = Envelope<ListConnectedAgentsResponsePayload>;
554
- export type RemoveAgentEnvelope = Envelope<RemoveAgentPayload>;
555
- export type RemoveAgentResponseEnvelope = Envelope<RemoveAgentResponsePayload>;
556
- export type HealthEnvelope = Envelope<HealthPayload>;
557
- export type HealthResponseEnvelope = Envelope<HealthResponsePayload>;
558
- export type MetricsEnvelope = Envelope<MetricsPayload>;
559
- export type MetricsResponseEnvelope = Envelope<MetricsResponsePayload>;
560
- //# sourceMappingURL=types.d.ts.map
@@ -1,8 +0,0 @@
1
- /**
2
- * Agent Relay Protocol Types
3
- * @agent-relay/sdk
4
- *
5
- * These types define the wire protocol for agent-to-agent communication.
6
- */
7
- export const PROTOCOL_VERSION = 1;
8
- //# sourceMappingURL=types.js.map