agent-relay 2.0.13 → 2.0.15

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 (143) hide show
  1. package/bin/relay-pty-darwin-arm64 +0 -0
  2. package/bin/relay-pty-darwin-x64 +0 -0
  3. package/bin/relay-pty-linux-x64 +0 -0
  4. package/deploy/workspace/codex.config.toml +5 -0
  5. package/deploy/workspace/entrypoint.sh +10 -2
  6. package/dist/dashboard/out/404.html +1 -1
  7. package/dist/dashboard/out/app/onboarding.html +1 -1
  8. package/dist/dashboard/out/app/onboarding.txt +1 -1
  9. package/dist/dashboard/out/app.html +1 -1
  10. package/dist/dashboard/out/app.txt +1 -1
  11. package/dist/dashboard/out/cloud/link.html +1 -1
  12. package/dist/dashboard/out/cloud/link.txt +1 -1
  13. package/dist/dashboard/out/connect-repos.html +1 -1
  14. package/dist/dashboard/out/connect-repos.txt +1 -1
  15. package/dist/dashboard/out/history.html +1 -1
  16. package/dist/dashboard/out/history.txt +1 -1
  17. package/dist/dashboard/out/index.html +1 -1
  18. package/dist/dashboard/out/index.txt +1 -1
  19. package/dist/dashboard/out/login.html +1 -1
  20. package/dist/dashboard/out/login.txt +1 -1
  21. package/dist/dashboard/out/metrics.html +1 -1
  22. package/dist/dashboard/out/metrics.txt +1 -1
  23. package/dist/dashboard/out/pricing.html +1 -1
  24. package/dist/dashboard/out/pricing.txt +1 -1
  25. package/dist/dashboard/out/providers/setup/claude.html +1 -1
  26. package/dist/dashboard/out/providers/setup/claude.txt +1 -1
  27. package/dist/dashboard/out/providers/setup/codex.html +1 -1
  28. package/dist/dashboard/out/providers/setup/codex.txt +1 -1
  29. package/dist/dashboard/out/providers/setup/cursor.html +1 -1
  30. package/dist/dashboard/out/providers/setup/cursor.txt +1 -1
  31. package/dist/dashboard/out/providers.html +1 -1
  32. package/dist/dashboard/out/providers.txt +1 -1
  33. package/dist/dashboard/out/signup.html +1 -1
  34. package/dist/dashboard/out/signup.txt +1 -1
  35. package/dist/src/cli/index.js +131 -21
  36. package/package.json +20 -19
  37. package/packages/api-types/package.json +1 -1
  38. package/packages/bridge/dist/index.d.ts +1 -1
  39. package/packages/bridge/dist/index.js +1 -1
  40. package/packages/bridge/dist/spawner.d.ts +18 -0
  41. package/packages/bridge/dist/spawner.js +124 -38
  42. package/packages/bridge/package.json +8 -7
  43. package/packages/cloud/package.json +6 -6
  44. package/packages/config/package.json +2 -2
  45. package/packages/continuity/package.json +1 -1
  46. package/packages/daemon/dist/connection.js +5 -1
  47. package/packages/daemon/dist/relay-ledger.d.ts +3 -1
  48. package/packages/daemon/dist/relay-ledger.js +8 -2
  49. package/packages/daemon/dist/router.js +13 -0
  50. package/packages/daemon/dist/server.d.ts +7 -0
  51. package/packages/daemon/dist/server.js +342 -4
  52. package/packages/daemon/package.json +12 -12
  53. package/packages/dashboard/dist/server.js +29 -5
  54. package/packages/dashboard/package.json +13 -12
  55. package/packages/dashboard/ui-dist/404.html +1 -1
  56. package/packages/dashboard/ui-dist/app/onboarding.html +1 -1
  57. package/packages/dashboard/ui-dist/app/onboarding.txt +1 -1
  58. package/packages/dashboard/ui-dist/app.html +1 -1
  59. package/packages/dashboard/ui-dist/app.txt +1 -1
  60. package/packages/dashboard/ui-dist/cloud/link.html +1 -1
  61. package/packages/dashboard/ui-dist/cloud/link.txt +1 -1
  62. package/packages/dashboard/ui-dist/connect-repos.html +1 -1
  63. package/packages/dashboard/ui-dist/connect-repos.txt +1 -1
  64. package/packages/dashboard/ui-dist/history.html +1 -1
  65. package/packages/dashboard/ui-dist/history.txt +1 -1
  66. package/packages/dashboard/ui-dist/index.html +1 -1
  67. package/packages/dashboard/ui-dist/index.txt +1 -1
  68. package/packages/dashboard/ui-dist/login.html +1 -1
  69. package/packages/dashboard/ui-dist/login.txt +1 -1
  70. package/packages/dashboard/ui-dist/metrics.html +1 -1
  71. package/packages/dashboard/ui-dist/metrics.txt +1 -1
  72. package/packages/dashboard/ui-dist/pricing.html +1 -1
  73. package/packages/dashboard/ui-dist/pricing.txt +1 -1
  74. package/packages/dashboard/ui-dist/providers/setup/claude.html +1 -1
  75. package/packages/dashboard/ui-dist/providers/setup/claude.txt +1 -1
  76. package/packages/dashboard/ui-dist/providers/setup/codex.html +1 -1
  77. package/packages/dashboard/ui-dist/providers/setup/codex.txt +1 -1
  78. package/packages/dashboard/ui-dist/providers/setup/cursor.html +1 -1
  79. package/packages/dashboard/ui-dist/providers/setup/cursor.txt +1 -1
  80. package/packages/dashboard/ui-dist/providers.html +1 -1
  81. package/packages/dashboard/ui-dist/providers.txt +1 -1
  82. package/packages/dashboard/ui-dist/signup.html +1 -1
  83. package/packages/dashboard/ui-dist/signup.txt +1 -1
  84. package/packages/dashboard-server/dist/server.js +29 -5
  85. package/packages/dashboard-server/package.json +12 -12
  86. package/packages/hooks/package.json +4 -4
  87. package/packages/mcp/README.md +24 -3
  88. package/packages/mcp/dist/bin.js +13 -5
  89. package/packages/mcp/dist/client.d.ts +54 -1
  90. package/packages/mcp/dist/client.js +132 -18
  91. package/packages/mcp/dist/cloud.d.ts +12 -0
  92. package/packages/mcp/dist/cloud.js +125 -1
  93. package/packages/mcp/dist/file-transport.d.ts +97 -0
  94. package/packages/mcp/dist/file-transport.js +197 -0
  95. package/packages/mcp/dist/hybrid-client.d.ts +28 -0
  96. package/packages/mcp/dist/hybrid-client.js +159 -0
  97. package/packages/mcp/dist/index.d.ts +4 -2
  98. package/packages/mcp/dist/index.js +6 -2
  99. package/packages/mcp/dist/install.d.ts +23 -1
  100. package/packages/mcp/dist/install.js +229 -31
  101. package/packages/mcp/dist/server.js +7 -1
  102. package/packages/mcp/dist/simple.d.ts +1 -1
  103. package/packages/mcp/dist/tools/index.d.ts +1 -0
  104. package/packages/mcp/dist/tools/index.js +1 -0
  105. package/packages/mcp/dist/tools/relay-continuity.d.ts +35 -0
  106. package/packages/mcp/dist/tools/relay-continuity.js +101 -0
  107. package/packages/mcp/dist/tools/relay-health.d.ts +1 -4
  108. package/packages/mcp/dist/tools/relay-health.js +7 -15
  109. package/packages/mcp/dist/tools/relay-logs.js +4 -2
  110. package/packages/mcp/dist/tools/relay-metrics.d.ts +1 -4
  111. package/packages/mcp/dist/tools/relay-metrics.js +4 -15
  112. package/packages/mcp/dist/tools/relay-send.d.ts +2 -2
  113. package/packages/mcp/package.json +3 -2
  114. package/packages/memory/package.json +2 -2
  115. package/packages/policy/package.json +2 -2
  116. package/packages/protocol/dist/relay-pty-schemas.d.ts +14 -0
  117. package/packages/protocol/dist/types.d.ts +152 -2
  118. package/packages/protocol/package.json +1 -1
  119. package/packages/resiliency/package.json +1 -1
  120. package/packages/sdk/dist/client.js +7 -0
  121. package/packages/sdk/package.json +2 -2
  122. package/packages/spawner/package.json +1 -1
  123. package/packages/state/package.json +1 -1
  124. package/packages/storage/package.json +2 -2
  125. package/packages/telemetry/package.json +1 -1
  126. package/packages/trajectory/package.json +2 -2
  127. package/packages/user-directory/package.json +2 -2
  128. package/packages/utils/dist/logger.js +3 -1
  129. package/packages/utils/package.json +1 -1
  130. package/packages/wrapper/dist/relay-pty-orchestrator.d.ts +28 -1
  131. package/packages/wrapper/dist/relay-pty-orchestrator.js +292 -37
  132. package/packages/wrapper/package.json +6 -6
  133. package/scripts/demos/README.md +79 -0
  134. package/scripts/demos/server-capacity.sh +69 -0
  135. package/scripts/demos/sprint-planning.sh +73 -0
  136. /package/dist/dashboard/out/_next/static/{Fa21F5wPUusvLUxj67gGm → bq6ZiKOzerlXFO47thgmf}/_buildManifest.js +0 -0
  137. /package/dist/dashboard/out/_next/static/{Fa21F5wPUusvLUxj67gGm → bq6ZiKOzerlXFO47thgmf}/_ssgManifest.js +0 -0
  138. /package/packages/dashboard/ui-dist/_next/static/{Fa21F5wPUusvLUxj67gGm → QTQdtgzP39wQJMKOsufyD}/_buildManifest.js +0 -0
  139. /package/packages/dashboard/ui-dist/_next/static/{Fa21F5wPUusvLUxj67gGm → QTQdtgzP39wQJMKOsufyD}/_ssgManifest.js +0 -0
  140. /package/packages/dashboard/ui-dist/_next/static/{coRjSO5QkUdvCiJRCqxfi → bq6ZiKOzerlXFO47thgmf}/_buildManifest.js +0 -0
  141. /package/packages/dashboard/ui-dist/_next/static/{coRjSO5QkUdvCiJRCqxfi → bq6ZiKOzerlXFO47thgmf}/_ssgManifest.js +0 -0
  142. /package/packages/dashboard/ui-dist/_next/static/{yKnlyfJx-NzAy4kPAGkMr → cVzRYB5TNHLQXh3CNCQ5b}/_buildManifest.js +0 -0
  143. /package/packages/dashboard/ui-dist/_next/static/{yKnlyfJx-NzAy4kPAGkMr → cVzRYB5TNHLQXh3CNCQ5b}/_ssgManifest.js +0 -0
@@ -3,18 +3,15 @@ import type { Tool } from '@modelcontextprotocol/sdk/types.js';
3
3
  import type { RelayClient } from '../client.js';
4
4
  export declare const relayMetricsSchema: z.ZodObject<{
5
5
  agent: z.ZodOptional<z.ZodString>;
6
- port: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
7
6
  }, "strip", z.ZodTypeAny, {
8
- port: number;
9
7
  agent?: string | undefined;
10
8
  }, {
11
9
  agent?: string | undefined;
12
- port?: number | undefined;
13
10
  }>;
14
11
  export type RelayMetricsInput = z.infer<typeof relayMetricsSchema>;
15
12
  export declare const relayMetricsTool: Tool;
16
13
  /**
17
14
  * Get memory and resource metrics for agents.
18
15
  */
19
- export declare function handleRelayMetrics(_client: RelayClient, input: RelayMetricsInput): Promise<string>;
16
+ export declare function handleRelayMetrics(client: RelayClient, input: RelayMetricsInput): Promise<string>;
20
17
  //# sourceMappingURL=relay-metrics.d.ts.map
@@ -1,7 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  export const relayMetricsSchema = z.object({
3
3
  agent: z.string().optional().describe('Filter metrics to a specific agent'),
4
- port: z.number().optional().default(3888).describe('Dashboard port (default: 3888)'),
5
4
  });
6
5
  export const relayMetricsTool = {
7
6
  name: 'relay_metrics',
@@ -27,11 +26,6 @@ Example: Get metrics for specific agent
27
26
  type: 'string',
28
27
  description: 'Filter metrics to a specific agent',
29
28
  },
30
- port: {
31
- type: 'number',
32
- description: 'Dashboard port (default: 3888)',
33
- default: 3888,
34
- },
35
29
  },
36
30
  required: [],
37
31
  },
@@ -60,14 +54,9 @@ function formatUptime(ms) {
60
54
  /**
61
55
  * Get memory and resource metrics for agents.
62
56
  */
63
- export async function handleRelayMetrics(_client, input) {
64
- const port = input.port || 3888;
57
+ export async function handleRelayMetrics(client, input) {
65
58
  try {
66
- const response = await fetch(`http://localhost:${port}/api/metrics/agents`);
67
- if (!response.ok) {
68
- throw new Error(`HTTP ${response.status}`);
69
- }
70
- const data = await response.json();
59
+ const data = await client.getMetrics({ agent: input.agent });
71
60
  let agents = data.agents;
72
61
  // Filter to specific agent if requested
73
62
  if (input.agent) {
@@ -126,8 +115,8 @@ export async function handleRelayMetrics(_client, input) {
126
115
  }
127
116
  catch (err) {
128
117
  const error = err;
129
- if (error.code === 'ECONNREFUSED') {
130
- return `Cannot connect to dashboard at port ${port}. Is the daemon running?\n\nRun 'agent-relay up' to start the daemon.`;
118
+ if (error.code === 'ECONNREFUSED' || error.code === 'ENOENT') {
119
+ return `Cannot connect to daemon. Is the daemon running?\n\nRun 'agent-relay up' to start the daemon.`;
131
120
  }
132
121
  return `Failed to fetch metrics: ${error.message || String(err)}`;
133
122
  }
@@ -8,14 +8,14 @@ export declare const relaySendSchema: z.ZodObject<{
8
8
  await_response: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
9
9
  timeout_ms: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
10
10
  }, "strip", z.ZodTypeAny, {
11
- to: string;
12
11
  message: string;
12
+ to: string;
13
13
  await_response: boolean;
14
14
  timeout_ms: number;
15
15
  thread?: string | undefined;
16
16
  }, {
17
- to: string;
18
17
  message: string;
18
+ to: string;
19
19
  thread?: string | undefined;
20
20
  await_response?: boolean | undefined;
21
21
  timeout_ms?: number | undefined;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/mcp",
3
- "version": "2.0.13",
3
+ "version": "2.0.15",
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,8 +47,9 @@
47
47
  "prepublishOnly": "npm run clean && npm run build && npm test"
48
48
  },
49
49
  "dependencies": {
50
- "@agent-relay/config": "2.0.13",
50
+ "@agent-relay/config": "2.0.15",
51
51
  "@modelcontextprotocol/sdk": "^1.0.0",
52
+ "smol-toml": "^1.6.0",
52
53
  "zod": "^3.23.8"
53
54
  },
54
55
  "devDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/memory",
3
- "version": "2.0.13",
3
+ "version": "2.0.15",
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.13"
25
+ "@agent-relay/hooks": "2.0.15"
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.13",
3
+ "version": "2.0.15",
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.13"
25
+ "@agent-relay/config": "2.0.15"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^22.19.3",
@@ -151,6 +151,11 @@ export type InjectRequest = {
151
151
  type: 'status';
152
152
  } | {
153
153
  type: 'shutdown';
154
+ } | {
155
+ /** Send just Enter key (for stuck input recovery) */
156
+ type: 'send_enter';
157
+ /** Message ID this is for (for tracking) */
158
+ id: string;
154
159
  };
155
160
  /**
156
161
  * Response from relay-pty socket
@@ -187,6 +192,15 @@ export type InjectResponse = {
187
192
  type: 'error';
188
193
  /** Error message */
189
194
  message: string;
195
+ } | {
196
+ /** SendEnter result (for stuck input recovery) */
197
+ type: 'send_enter_result';
198
+ /** Message ID this is for */
199
+ id: string;
200
+ /** Whether Enter was sent successfully */
201
+ success: boolean;
202
+ /** Unix timestamp in milliseconds */
203
+ timestamp: number;
190
204
  };
191
205
  /**
192
206
  * The final format injected into the recipient agent's PTY as plain text.
@@ -5,7 +5,7 @@
5
5
  * These types define the wire protocol for agent-to-agent communication.
6
6
  */
7
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';
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' | 'HEALTH' | 'HEALTH_RESPONSE' | 'METRICS' | 'METRICS_RESPONSE';
9
9
  export type PayloadKind = 'message' | 'action' | 'state' | 'thinking';
10
10
  /**
11
11
  * Base envelope structure for all protocol messages.
@@ -158,7 +158,7 @@ export interface PingPayload {
158
158
  export interface PongPayload {
159
159
  nonce: string;
160
160
  }
161
- export type ErrorCode = 'BAD_REQUEST' | 'UNAUTHORIZED' | 'NOT_FOUND' | 'INTERNAL' | 'RESUME_TOO_OLD';
161
+ export type ErrorCode = 'BAD_REQUEST' | 'UNAUTHORIZED' | 'NOT_FOUND' | 'INTERNAL' | 'RESUME_TOO_OLD' | 'DUPLICATE_CONNECTION';
162
162
  export interface ErrorPayload {
163
163
  /** Error code */
164
164
  code: ErrorCode;
@@ -266,6 +266,8 @@ export interface SpawnPayload {
266
266
  team?: string;
267
267
  /** Working directory */
268
268
  cwd?: string;
269
+ /** Model override (alternative to cli:model format) */
270
+ model?: string;
269
271
  /** Socket path for the spawned agent */
270
272
  socketPath?: string;
271
273
  /** Parent agent name */
@@ -303,6 +305,8 @@ export interface SpawnResultPayload {
303
305
  export interface ReleasePayload {
304
306
  /** Agent name to release */
305
307
  name: string;
308
+ /** Reason for releasing the agent */
309
+ reason?: string;
306
310
  }
307
311
  export interface ReleaseResultPayload {
308
312
  /** Correlation ID */
@@ -340,4 +344,150 @@ export type ReleaseResultEnvelope = Envelope<ReleaseResultPayload>;
340
344
  export type ChannelJoinEnvelope = Envelope<ChannelJoinPayload>;
341
345
  export type ChannelLeaveEnvelope = Envelope<ChannelLeavePayload>;
342
346
  export type ChannelMessageEnvelope = Envelope<ChannelMessagePayload>;
347
+ /**
348
+ * Payload for STATUS request.
349
+ */
350
+ export interface StatusPayload {
351
+ }
352
+ /**
353
+ * Payload for STATUS_RESPONSE.
354
+ */
355
+ export interface StatusResponsePayload {
356
+ /** Daemon version */
357
+ version?: string;
358
+ /** Uptime in milliseconds */
359
+ uptime?: number;
360
+ /** Whether cloud sync is connected */
361
+ cloudConnected?: boolean;
362
+ /** Number of connected agents */
363
+ agentCount?: number;
364
+ }
365
+ /**
366
+ * Payload for INBOX request.
367
+ */
368
+ export interface InboxPayload {
369
+ /** Agent name to get inbox for */
370
+ agent: string;
371
+ /** Maximum number of messages to return */
372
+ limit?: number;
373
+ /** Only return unread messages */
374
+ unreadOnly?: boolean;
375
+ /** Filter by sender */
376
+ from?: string;
377
+ /** Filter by channel */
378
+ channel?: string;
379
+ }
380
+ /**
381
+ * Payload for INBOX_RESPONSE.
382
+ */
383
+ export interface InboxResponsePayload {
384
+ /** Messages in the inbox */
385
+ messages: Array<{
386
+ id: string;
387
+ from: string;
388
+ body: string;
389
+ channel?: string;
390
+ thread?: string;
391
+ timestamp: number;
392
+ }>;
393
+ }
394
+ /**
395
+ * Payload for LIST_AGENTS request.
396
+ */
397
+ export interface ListAgentsPayload {
398
+ /** Include idle agents */
399
+ includeIdle?: boolean;
400
+ /** Filter by project */
401
+ project?: string;
402
+ }
403
+ /**
404
+ * Payload for LIST_AGENTS_RESPONSE.
405
+ */
406
+ export interface ListAgentsResponsePayload {
407
+ /** List of agents */
408
+ agents: Array<{
409
+ name: string;
410
+ cli?: string;
411
+ idle?: boolean;
412
+ parent?: string;
413
+ }>;
414
+ }
415
+ export type StatusEnvelope = Envelope<StatusPayload>;
416
+ export type StatusResponseEnvelope = Envelope<StatusResponsePayload>;
417
+ export type InboxEnvelope = Envelope<InboxPayload>;
418
+ export type InboxResponseEnvelope = Envelope<InboxResponsePayload>;
419
+ export type ListAgentsEnvelope = Envelope<ListAgentsPayload>;
420
+ export type ListAgentsResponseEnvelope = Envelope<ListAgentsResponsePayload>;
421
+ /**
422
+ * Payload for HEALTH request.
423
+ */
424
+ export interface HealthPayload {
425
+ /** Include crash history */
426
+ includeCrashes?: boolean;
427
+ /** Include alerts */
428
+ includeAlerts?: boolean;
429
+ }
430
+ /**
431
+ * Payload for HEALTH_RESPONSE.
432
+ */
433
+ export interface HealthResponsePayload {
434
+ healthScore: number;
435
+ summary: string;
436
+ issues: Array<{
437
+ severity: string;
438
+ message: string;
439
+ }>;
440
+ recommendations: string[];
441
+ crashes: Array<{
442
+ id: string;
443
+ agentName: string;
444
+ crashedAt: string;
445
+ likelyCause: string;
446
+ summary?: string;
447
+ }>;
448
+ alerts: Array<{
449
+ id: string;
450
+ agentName: string;
451
+ alertType: string;
452
+ message: string;
453
+ createdAt: string;
454
+ }>;
455
+ stats: {
456
+ totalCrashes24h: number;
457
+ totalAlerts24h: number;
458
+ agentCount: number;
459
+ };
460
+ }
461
+ /**
462
+ * Payload for METRICS request.
463
+ */
464
+ export interface MetricsPayload {
465
+ /** Filter to specific agent */
466
+ agent?: string;
467
+ }
468
+ /**
469
+ * Payload for METRICS_RESPONSE.
470
+ */
471
+ export interface MetricsResponsePayload {
472
+ agents: Array<{
473
+ name: string;
474
+ pid?: number;
475
+ status: string;
476
+ rssBytes?: number;
477
+ cpuPercent?: number;
478
+ trend?: string;
479
+ alertLevel?: string;
480
+ highWatermark?: number;
481
+ uptimeMs?: number;
482
+ }>;
483
+ system: {
484
+ totalMemory: number;
485
+ freeMemory: number;
486
+ heapUsed: number;
487
+ };
488
+ }
489
+ export type HealthEnvelope = Envelope<HealthPayload>;
490
+ export type HealthResponseEnvelope = Envelope<HealthResponsePayload>;
491
+ export type MetricsEnvelope = Envelope<MetricsPayload>;
492
+ export type MetricsResponseEnvelope = Envelope<MetricsResponsePayload>;
343
493
  //# sourceMappingURL=types.d.ts.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/protocol",
3
- "version": "2.0.13",
3
+ "version": "2.0.15",
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.13",
3
+ "version": "2.0.15",
4
4
  "description": "Health monitoring, logging, metrics, and crash resilience utilities for Agent Relay",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -644,6 +644,13 @@ export class RelayClient {
644
644
  this.resumeToken = undefined;
645
645
  this.sessionId = undefined;
646
646
  }
647
+ // Fatal errors (like DUPLICATE_CONNECTION) should prevent reconnection
648
+ if (envelope.payload.fatal) {
649
+ if (!this.config.quiet) {
650
+ console.error('[sdk] Fatal error received, will not reconnect:', envelope.payload.message);
651
+ }
652
+ this._destroyed = true;
653
+ }
647
654
  }
648
655
  handleDisconnect() {
649
656
  this.parser.reset();
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/sdk",
3
- "version": "2.0.13",
3
+ "version": "2.0.15",
4
4
  "description": "Lightweight SDK for agent-to-agent communication via Agent Relay",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -55,7 +55,7 @@
55
55
  "access": "public"
56
56
  },
57
57
  "dependencies": {
58
- "@agent-relay/protocol": "2.0.13"
58
+ "@agent-relay/protocol": "2.0.15"
59
59
  },
60
60
  "engines": {
61
61
  "node": ">=18.0.0"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/spawner",
3
- "version": "2.0.13",
3
+ "version": "2.0.15",
4
4
  "description": "Agent spawning types and utilities for Agent Relay",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/state",
3
- "version": "2.0.13",
3
+ "version": "2.0.15",
4
4
  "description": "Agent state persistence for non-hook CLIs (Codex, Gemini, etc.)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/storage",
3
- "version": "2.0.13",
3
+ "version": "2.0.15",
4
4
  "description": "Storage adapters and interfaces for Relay message/session persistence",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -56,7 +56,7 @@
56
56
  }
57
57
  },
58
58
  "dependencies": {
59
- "@agent-relay/protocol": "2.0.13"
59
+ "@agent-relay/protocol": "2.0.15"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@types/node": "^22.19.3",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/telemetry",
3
- "version": "2.0.13",
3
+ "version": "2.0.15",
4
4
  "description": "Anonymous telemetry for Agent Relay usage analytics",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/trajectory",
3
- "version": "2.0.13",
3
+ "version": "2.0.15",
4
4
  "description": "Trajectory integration utilities (trail/PDERO) for Relay",
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.13"
25
+ "@agent-relay/config": "2.0.15"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^22.19.3",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/user-directory",
3
- "version": "2.0.13",
3
+ "version": "2.0.15",
4
4
  "description": "User directory service for agent-relay (per-user credential storage)",
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/resiliency": "2.0.13"
25
+ "@agent-relay/resiliency": "2.0.15"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^22.19.3",
@@ -54,8 +54,10 @@ function log(level, component, msg, extra) {
54
54
  // Write to file if configured
55
55
  if (LOG_FILE) {
56
56
  fs.appendFileSync(LOG_FILE, formatted + '\n');
57
+ // When logging to file, skip console output to avoid polluting TUI terminals
58
+ return;
57
59
  }
58
- // Write to console (stderr for WARN/ERROR)
60
+ // Only write to console if no log file is configured (fallback mode)
59
61
  if (level === 'ERROR' || level === 'WARN') {
60
62
  console.error(formatted);
61
63
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/utils",
3
- "version": "2.0.13",
3
+ "version": "2.0.15",
4
4
  "description": "Shared utilities for agent-relay: logging, name generation, command resolution, update checking",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -16,7 +16,8 @@
16
16
  * @see docs/RUST_WRAPPER_DESIGN.md for protocol details
17
17
  */
18
18
  import { BaseWrapper, type BaseWrapperConfig } from './base-wrapper.js';
19
- import type { SendPayload, SendMeta } from '@agent-relay/protocol/types';
19
+ import type { SendPayload, SendMeta, Envelope } from '@agent-relay/protocol/types';
20
+ import type { ChannelMessagePayload } from '@agent-relay/protocol/channels';
20
21
  interface StatusResponse {
21
22
  type: 'status';
22
23
  agent_idle: boolean;
@@ -92,6 +93,7 @@ export declare class RelayPtyOrchestrator extends BaseWrapper {
92
93
  private lastParsedLength;
93
94
  private isInteractive;
94
95
  private pendingInjections;
96
+ private pendingSendEnter;
95
97
  private backpressureActive;
96
98
  private readyForMessages;
97
99
  private throttle;
@@ -116,10 +118,12 @@ export declare class RelayPtyOrchestrator extends BaseWrapper {
116
118
  constructor(config: RelayPtyOrchestratorConfig);
117
119
  /**
118
120
  * Debug log - only outputs when debug is enabled
121
+ * Writes to log file to avoid polluting TUI output
119
122
  */
120
123
  private log;
121
124
  /**
122
125
  * Error log - always outputs (errors are important)
126
+ * Writes to log file to avoid polluting TUI output
123
127
  */
124
128
  private logError;
125
129
  /**
@@ -210,6 +214,14 @@ export declare class RelayPtyOrchestrator extends BaseWrapper {
210
214
  * Disconnect from socket
211
215
  */
212
216
  private disconnectSocket;
217
+ /** Timer for socket reconnection */
218
+ private socketReconnectTimer?;
219
+ /** Current reconnection attempt count */
220
+ private socketReconnectAttempt;
221
+ /**
222
+ * Schedule a socket reconnection attempt with exponential backoff
223
+ */
224
+ private scheduleSocketReconnect;
213
225
  /**
214
226
  * Send a request to the socket and optionally wait for response
215
227
  */
@@ -224,6 +236,15 @@ export declare class RelayPtyOrchestrator extends BaseWrapper {
224
236
  * If verification fails, retries up to MAX_RETRIES times.
225
237
  */
226
238
  private handleInjectResult;
239
+ /**
240
+ * Handle SendEnter result (stuck input recovery)
241
+ * Called when relay-pty responds to a SendEnter request
242
+ */
243
+ private handleSendEnterResult;
244
+ /**
245
+ * Do a full retry with message content (used when SendEnter fails or for subsequent retries)
246
+ */
247
+ private doFullRetry;
227
248
  /**
228
249
  * Handle backpressure notification
229
250
  */
@@ -240,6 +261,12 @@ export declare class RelayPtyOrchestrator extends BaseWrapper {
240
261
  * Override handleIncomingMessage to trigger queue processing
241
262
  */
242
263
  protected handleIncomingMessage(from: string, payload: SendPayload, messageId: string, meta?: SendMeta, originalTo?: string): void;
264
+ /**
265
+ * Override handleIncomingChannelMessage to trigger queue processing.
266
+ * Without this override, channel messages would be queued but processMessageQueue()
267
+ * would never be called, causing messages to get stuck until the queue monitor runs.
268
+ */
269
+ protected handleIncomingChannelMessage(from: string, channel: string, body: string, envelope: Envelope<ChannelMessagePayload>): void;
243
270
  /**
244
271
  * Start the queue monitor to periodically check for stuck messages.
245
272
  * This ensures messages don't get orphaned in the queue when the agent is idle.