agent-relay 2.1.13 → 2.1.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.
- package/dist/index.cjs +37571 -50918
- package/dist/src/cli/index.js +1 -1
- package/dist/src/cli/index.js.map +1 -1
- package/package.json +18 -18
- package/packages/acp-bridge/package.json +2 -2
- package/packages/api-types/package.json +1 -1
- package/packages/benchmark/datasets/quick-test.yaml +20 -0
- package/packages/benchmark/dist/runners/base.d.ts.map +1 -1
- package/packages/benchmark/dist/runners/base.js +1 -0
- package/packages/benchmark/dist/runners/base.js.map +1 -1
- package/packages/benchmark/package.json +4 -4
- package/packages/benchmark/src/runners/base.ts +1 -0
- package/packages/bridge/dist/spawner.d.ts.map +1 -1
- package/packages/bridge/dist/spawner.js +2 -30
- package/packages/bridge/dist/spawner.js.map +1 -1
- package/packages/bridge/package.json +7 -8
- package/packages/bridge/src/spawner.ts +2 -29
- package/packages/cli-tester/package.json +1 -1
- package/packages/config/dist/teams-config.d.ts +7 -1
- package/packages/config/dist/teams-config.d.ts.map +1 -1
- package/packages/config/dist/teams-config.js +88 -34
- package/packages/config/dist/teams-config.js.map +1 -1
- package/packages/config/package.json +2 -2
- package/packages/config/src/teams-config.ts +106 -39
- package/packages/continuity/package.json +2 -2
- package/packages/daemon/dist/server.d.ts.map +1 -1
- package/packages/daemon/dist/server.js +18 -0
- package/packages/daemon/dist/server.js.map +1 -1
- package/packages/daemon/dist/spawn-manager.d.ts +8 -0
- package/packages/daemon/dist/spawn-manager.d.ts.map +1 -1
- package/packages/daemon/dist/spawn-manager.js +14 -3
- package/packages/daemon/dist/spawn-manager.js.map +1 -1
- package/packages/daemon/package.json +12 -12
- package/packages/daemon/src/server.ts +17 -0
- package/packages/daemon/src/spawn-manager.ts +21 -3
- package/packages/hooks/package.json +4 -4
- package/packages/mcp/CHANGELOG.md +28 -0
- package/packages/mcp/README.md +31 -0
- package/packages/mcp/dist/bin.js +18 -5
- package/packages/mcp/dist/bin.js.map +1 -1
- package/packages/mcp/dist/{client.d.ts → client-adapter.d.ts} +22 -36
- package/packages/mcp/dist/client-adapter.d.ts.map +1 -0
- package/packages/mcp/dist/client-adapter.js +227 -0
- package/packages/mcp/dist/client-adapter.js.map +1 -0
- package/packages/mcp/dist/hybrid-client.d.ts +1 -31
- package/packages/mcp/dist/hybrid-client.d.ts.map +1 -1
- package/packages/mcp/dist/hybrid-client.js +3 -153
- package/packages/mcp/dist/hybrid-client.js.map +1 -1
- package/packages/mcp/dist/index.d.ts +2 -3
- package/packages/mcp/dist/index.d.ts.map +1 -1
- package/packages/mcp/dist/index.js +4 -3
- package/packages/mcp/dist/index.js.map +1 -1
- package/packages/mcp/dist/resources/agents.d.ts +1 -1
- package/packages/mcp/dist/resources/agents.d.ts.map +1 -1
- package/packages/mcp/dist/resources/inbox.d.ts +1 -1
- package/packages/mcp/dist/resources/inbox.d.ts.map +1 -1
- package/packages/mcp/dist/resources/project.d.ts +1 -1
- package/packages/mcp/dist/resources/project.d.ts.map +1 -1
- package/packages/mcp/dist/server.d.ts +5 -1
- package/packages/mcp/dist/server.d.ts.map +1 -1
- package/packages/mcp/dist/server.js.map +1 -1
- package/packages/mcp/dist/simple.d.ts +1 -1
- package/packages/mcp/dist/simple.d.ts.map +1 -1
- package/packages/mcp/dist/simple.js +1 -1
- package/packages/mcp/dist/simple.js.map +1 -1
- package/packages/mcp/dist/tools/relay-broadcast.d.ts +1 -1
- package/packages/mcp/dist/tools/relay-broadcast.d.ts.map +1 -1
- package/packages/mcp/dist/tools/relay-channel.d.ts +1 -1
- package/packages/mcp/dist/tools/relay-channel.d.ts.map +1 -1
- package/packages/mcp/dist/tools/relay-connected.d.ts +1 -1
- package/packages/mcp/dist/tools/relay-connected.d.ts.map +1 -1
- package/packages/mcp/dist/tools/relay-consensus.d.ts +7 -7
- package/packages/mcp/dist/tools/relay-consensus.d.ts.map +1 -1
- package/packages/mcp/dist/tools/relay-continuity.d.ts +1 -1
- package/packages/mcp/dist/tools/relay-continuity.d.ts.map +1 -1
- package/packages/mcp/dist/tools/relay-health.d.ts +1 -1
- package/packages/mcp/dist/tools/relay-health.d.ts.map +1 -1
- package/packages/mcp/dist/tools/relay-inbox.d.ts +2 -2
- package/packages/mcp/dist/tools/relay-inbox.d.ts.map +1 -1
- package/packages/mcp/dist/tools/relay-logs.d.ts +1 -1
- package/packages/mcp/dist/tools/relay-logs.d.ts.map +1 -1
- package/packages/mcp/dist/tools/relay-messages.d.ts +7 -7
- package/packages/mcp/dist/tools/relay-messages.d.ts.map +1 -1
- package/packages/mcp/dist/tools/relay-metrics.d.ts +1 -1
- package/packages/mcp/dist/tools/relay-metrics.d.ts.map +1 -1
- package/packages/mcp/dist/tools/relay-metrics.js +4 -4
- package/packages/mcp/dist/tools/relay-metrics.js.map +1 -1
- package/packages/mcp/dist/tools/relay-release.d.ts +1 -1
- package/packages/mcp/dist/tools/relay-release.d.ts.map +1 -1
- package/packages/mcp/dist/tools/relay-remove-agent.d.ts +1 -1
- package/packages/mcp/dist/tools/relay-remove-agent.d.ts.map +1 -1
- package/packages/mcp/dist/tools/relay-send.d.ts +3 -3
- package/packages/mcp/dist/tools/relay-send.d.ts.map +1 -1
- package/packages/mcp/dist/tools/relay-shadow.d.ts +1 -1
- package/packages/mcp/dist/tools/relay-shadow.d.ts.map +1 -1
- package/packages/mcp/dist/tools/relay-spawn.d.ts +3 -3
- package/packages/mcp/dist/tools/relay-spawn.d.ts.map +1 -1
- package/packages/mcp/dist/tools/relay-status.d.ts +1 -1
- package/packages/mcp/dist/tools/relay-status.d.ts.map +1 -1
- package/packages/mcp/dist/tools/relay-subscribe.d.ts +1 -1
- package/packages/mcp/dist/tools/relay-subscribe.d.ts.map +1 -1
- package/packages/mcp/dist/tools/relay-who.d.ts +1 -1
- package/packages/mcp/dist/tools/relay-who.d.ts.map +1 -1
- package/packages/mcp/package.json +13 -4
- package/packages/mcp/src/bin.ts +21 -6
- package/packages/mcp/src/client-adapter.ts +346 -0
- package/packages/mcp/src/hybrid-client.ts +3 -202
- package/packages/mcp/src/index.ts +12 -5
- package/packages/mcp/src/resources/agents.ts +1 -1
- package/packages/mcp/src/resources/inbox.ts +1 -1
- package/packages/mcp/src/resources/project.ts +1 -1
- package/packages/mcp/src/server.ts +5 -1
- package/packages/mcp/src/simple.ts +1 -1
- package/packages/mcp/src/tools/relay-broadcast.ts +1 -1
- package/packages/mcp/src/tools/relay-channel.ts +1 -1
- package/packages/mcp/src/tools/relay-connected.ts +1 -1
- package/packages/mcp/src/tools/relay-consensus.ts +1 -1
- package/packages/mcp/src/tools/relay-continuity.ts +1 -1
- package/packages/mcp/src/tools/relay-health.ts +1 -1
- package/packages/mcp/src/tools/relay-inbox.ts +1 -1
- package/packages/mcp/src/tools/relay-logs.ts +1 -1
- package/packages/mcp/src/tools/relay-messages.ts +1 -1
- package/packages/mcp/src/tools/relay-metrics.ts +7 -5
- package/packages/mcp/src/tools/relay-release.ts +1 -1
- package/packages/mcp/src/tools/relay-remove-agent.ts +1 -1
- package/packages/mcp/src/tools/relay-send.ts +1 -1
- package/packages/mcp/src/tools/relay-shadow.ts +1 -1
- package/packages/mcp/src/tools/relay-spawn.ts +1 -1
- package/packages/mcp/src/tools/relay-status.ts +1 -1
- package/packages/mcp/src/tools/relay-subscribe.ts +1 -1
- package/packages/mcp/src/tools/relay-who.ts +1 -1
- package/packages/mcp/tests/client.test.ts +332 -432
- package/packages/memory/package.json +2 -2
- package/packages/policy/package.json +2 -2
- package/packages/protocol/package.json +1 -1
- package/packages/resiliency/package.json +1 -1
- package/packages/sdk/README.md +185 -0
- package/packages/sdk/dist/client.d.ts +1 -1
- package/packages/sdk/dist/client.d.ts.map +1 -1
- package/packages/sdk/dist/client.js +2 -1
- package/packages/sdk/dist/client.js.map +1 -1
- package/packages/sdk/dist/standalone.d.ts +2 -0
- package/packages/sdk/dist/standalone.d.ts.map +1 -1
- package/packages/sdk/dist/standalone.js +6 -1
- package/packages/sdk/dist/standalone.js.map +1 -1
- package/packages/sdk/package.json +3 -4
- package/packages/sdk/src/client.ts +2 -2
- package/packages/sdk/src/standalone.ts +8 -1
- package/packages/spawner/package.json +1 -1
- package/packages/state/package.json +1 -1
- package/packages/storage/package.json +2 -2
- package/packages/storage/src/jsonl-adapter.test.ts +3 -1
- package/packages/telemetry/package.json +1 -1
- package/packages/trajectory/package.json +2 -2
- package/packages/user-directory/package.json +2 -2
- package/packages/utils/package.json +3 -3
- package/packages/wrapper/dist/relay-pty-orchestrator.d.ts.map +1 -1
- package/packages/wrapper/dist/relay-pty-orchestrator.js +13 -0
- package/packages/wrapper/dist/relay-pty-orchestrator.js.map +1 -1
- package/packages/wrapper/package.json +6 -6
- package/packages/wrapper/src/relay-pty-orchestrator.ts +14 -0
- package/packages/mcp/dist/client.d.ts.map +0 -1
- package/packages/mcp/dist/client.js +0 -320
- package/packages/mcp/dist/client.js.map +0 -1
- package/packages/mcp/src/client.ts +0 -485
|
@@ -1,217 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* IMPORTANT: The file-based writes ONLY work when relay-pty is wrapping the agent.
|
|
5
|
-
* relay-pty watches for ->relay-file:* triggers in agent output and processes outbox files.
|
|
6
|
-
* The daemon does NOT watch outbox directories directly.
|
|
7
|
-
*
|
|
8
|
-
* For pure MCP tools (not wrapped by relay-pty), use createRelayClient() instead,
|
|
9
|
-
* which communicates directly with the daemon via socket.
|
|
10
|
-
*
|
|
11
|
-
* This hybrid client is designed for scenarios where:
|
|
12
|
-
* - An agent is wrapped by relay-pty
|
|
13
|
-
* - File-based writes avoid socket connection overhead
|
|
14
|
-
* - Socket is still used for queries (getInbox, listAgents, etc.)
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { existsSync, mkdirSync, writeFileSync, readFileSync, readdirSync, statSync } from 'node:fs';
|
|
18
|
-
import { join, dirname } from 'node:path';
|
|
19
|
-
import { randomUUID } from 'node:crypto';
|
|
20
|
-
import type { RelayClient } from './client.js';
|
|
21
|
-
import { createRelayClient } from './client.js';
|
|
22
|
-
import type { AckPayload } from '@agent-relay/protocol';
|
|
23
|
-
import { discoverSocket } from './cloud.js';
|
|
24
|
-
|
|
25
|
-
export interface HybridClientOptions {
|
|
26
|
-
/** Agent name */
|
|
27
|
-
agentName: string;
|
|
28
|
-
/** Project root directory (where .agent-relay lives) */
|
|
29
|
-
projectRoot: string;
|
|
30
|
-
/** Socket path (optional, will discover if not provided) */
|
|
31
|
-
socketPath?: string;
|
|
32
|
-
/** Project ID */
|
|
33
|
-
project?: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Create a hybrid client that uses file-based for writes, socket for queries.
|
|
38
|
-
*/
|
|
39
|
-
export function createHybridClient(options: HybridClientOptions): RelayClient {
|
|
40
|
-
const { agentName, projectRoot, project = 'default' } = options;
|
|
41
|
-
|
|
42
|
-
// Setup directories
|
|
43
|
-
const relayDir = join(projectRoot, '.agent-relay');
|
|
44
|
-
const outboxDir = join(relayDir, 'outbox', agentName);
|
|
45
|
-
const inboxDir = join(relayDir, 'inbox', agentName);
|
|
46
|
-
|
|
47
|
-
// Ensure directories exist
|
|
48
|
-
if (!existsSync(outboxDir)) {
|
|
49
|
-
mkdirSync(outboxDir, { recursive: true });
|
|
50
|
-
}
|
|
51
|
-
if (!existsSync(inboxDir)) {
|
|
52
|
-
mkdirSync(inboxDir, { recursive: true });
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Get socket path for queries
|
|
56
|
-
// Use discoverSocket() which respects cloud workspace config and env overrides.
|
|
57
|
-
// Only fall back to relayDir/relay.sock for non-cloud local development.
|
|
58
|
-
const discovery = discoverSocket();
|
|
59
|
-
const socketPath = options.socketPath || discovery?.socketPath || join(relayDir, 'relay.sock');
|
|
60
|
-
|
|
61
|
-
if (process.env.DEBUG || process.env.RELAY_DEBUG) {
|
|
62
|
-
console.debug('[hybrid-client] Socket path:', socketPath, 'source:', discovery?.source ?? 'fallback', 'isCloud:', discovery?.isCloud ?? false);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Create socket client for queries only
|
|
66
|
-
let socketClient: RelayClient | null = null;
|
|
67
|
-
const getSocketClient = () => {
|
|
68
|
-
if (!socketClient) {
|
|
69
|
-
socketClient = createRelayClient({
|
|
70
|
-
agentName,
|
|
71
|
-
socketPath,
|
|
72
|
-
project,
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
return socketClient;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
// File-based send (write to outbox)
|
|
79
|
-
const send = async (to: string, message: string, opts: { thread?: string } = {}): Promise<void> => {
|
|
80
|
-
let content = `TO: ${to}\n`;
|
|
81
|
-
if (opts.thread) {
|
|
82
|
-
content += `THREAD: ${opts.thread}\n`;
|
|
83
|
-
}
|
|
84
|
-
content += `\n${message}`;
|
|
85
|
-
|
|
86
|
-
const msgPath = join(outboxDir, 'msg');
|
|
87
|
-
writeFileSync(msgPath, content);
|
|
88
|
-
// NOTE: relay-pty (not daemon) watches for ->relay-file:msg trigger.
|
|
89
|
-
// The agent must output "->relay-file:msg" for relay-pty to process.
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
// File-based sendAndWait (for now, delegate to socket - can improve later)
|
|
93
|
-
const sendAndWait = async (
|
|
94
|
-
to: string,
|
|
95
|
-
message: string,
|
|
96
|
-
opts: { thread?: string; timeoutMs?: number } = {}
|
|
97
|
-
): Promise<AckPayload> => {
|
|
98
|
-
// For await responses, we still use socket since we need the response
|
|
99
|
-
// TODO: Implement file-based request/response pattern
|
|
100
|
-
return getSocketClient().sendAndWait(to, message, opts);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
// File-based spawn
|
|
104
|
-
const spawn = async (opts: {
|
|
105
|
-
name: string;
|
|
106
|
-
cli: string;
|
|
107
|
-
task: string;
|
|
108
|
-
model?: string;
|
|
109
|
-
cwd?: string;
|
|
110
|
-
}): Promise<{ success: boolean; error?: string }> => {
|
|
111
|
-
let content = `KIND: spawn\n`;
|
|
112
|
-
content += `NAME: ${opts.name}\n`;
|
|
113
|
-
content += `CLI: ${opts.cli}\n`;
|
|
114
|
-
if (opts.model) {
|
|
115
|
-
content += `MODEL: ${opts.model}\n`;
|
|
116
|
-
}
|
|
117
|
-
if (opts.cwd) {
|
|
118
|
-
content += `CWD: ${opts.cwd}\n`;
|
|
119
|
-
}
|
|
120
|
-
content += `\n${opts.task}`;
|
|
121
|
-
|
|
122
|
-
const spawnPath = join(outboxDir, 'spawn');
|
|
123
|
-
writeFileSync(spawnPath, content);
|
|
124
|
-
return { success: true };
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
// File-based release
|
|
128
|
-
const release = async (name: string, reason?: string): Promise<{ success: boolean; error?: string }> => {
|
|
129
|
-
let content = `KIND: release\n`;
|
|
130
|
-
content += `NAME: ${name}\n`;
|
|
131
|
-
if (reason) {
|
|
132
|
-
content += `\n${reason}`;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const releasePath = join(outboxDir, 'release');
|
|
136
|
-
writeFileSync(releasePath, content);
|
|
137
|
-
return { success: true };
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
// File-based continuity (NEW - not in original MCP)
|
|
141
|
-
const saveContinuity = async (state: {
|
|
142
|
-
currentTask?: string;
|
|
143
|
-
completed?: string;
|
|
144
|
-
inProgress?: string;
|
|
145
|
-
keyDecisions?: string;
|
|
146
|
-
files?: string;
|
|
147
|
-
}): Promise<void> => {
|
|
148
|
-
let content = `KIND: continuity\n`;
|
|
149
|
-
content += `ACTION: save\n\n`;
|
|
150
|
-
if (state.currentTask) content += `Current task: ${state.currentTask}\n`;
|
|
151
|
-
if (state.completed) content += `Completed: ${state.completed}\n`;
|
|
152
|
-
if (state.inProgress) content += `In progress: ${state.inProgress}\n`;
|
|
153
|
-
if (state.keyDecisions) content += `Key decisions: ${state.keyDecisions}\n`;
|
|
154
|
-
if (state.files) content += `Files: ${state.files}\n`;
|
|
155
|
-
|
|
156
|
-
const continuityPath = join(outboxDir, 'continuity');
|
|
157
|
-
writeFileSync(continuityPath, content);
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
const loadContinuity = async (): Promise<void> => {
|
|
161
|
-
const content = `KIND: continuity\nACTION: load\n`;
|
|
162
|
-
const continuityPath = join(outboxDir, 'continuity');
|
|
163
|
-
writeFileSync(continuityPath, content);
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
const markUncertain = async (item: string): Promise<void> => {
|
|
167
|
-
const content = `KIND: continuity\nACTION: uncertain\n\n${item}`;
|
|
168
|
-
const continuityPath = join(outboxDir, 'continuity');
|
|
169
|
-
writeFileSync(continuityPath, content);
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
// Socket-based queries (these work fine over socket)
|
|
173
|
-
const getStatus = async () => getSocketClient().getStatus();
|
|
174
|
-
const getInbox = async (opts?: Parameters<RelayClient['getInbox']>[0]) => getSocketClient().getInbox(opts);
|
|
175
|
-
const listAgents = async (opts?: Parameters<RelayClient['listAgents']>[0]) => getSocketClient().listAgents(opts);
|
|
176
|
-
const getHealth = async (opts?: Parameters<RelayClient['getHealth']>[0]) => getSocketClient().getHealth(opts);
|
|
177
|
-
const getMetrics = async (opts?: Parameters<RelayClient['getMetrics']>[0]) => getSocketClient().getMetrics(opts);
|
|
178
|
-
|
|
179
|
-
return {
|
|
180
|
-
send,
|
|
181
|
-
sendAndWait,
|
|
182
|
-
spawn,
|
|
183
|
-
release,
|
|
184
|
-
getStatus,
|
|
185
|
-
getInbox,
|
|
186
|
-
listAgents,
|
|
187
|
-
getHealth,
|
|
188
|
-
getMetrics,
|
|
189
|
-
// Extended methods (not in base RelayClient interface but useful)
|
|
190
|
-
saveContinuity,
|
|
191
|
-
loadContinuity,
|
|
192
|
-
markUncertain,
|
|
193
|
-
} as unknown as RelayClient & {
|
|
194
|
-
saveContinuity: typeof saveContinuity;
|
|
195
|
-
loadContinuity: typeof loadContinuity;
|
|
196
|
-
markUncertain: typeof markUncertain;
|
|
197
|
-
};
|
|
198
|
-
}
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
199
3
|
|
|
200
4
|
/**
|
|
201
|
-
* Discover project root
|
|
5
|
+
* Discover project root by locating a .agent-relay directory.
|
|
202
6
|
*/
|
|
203
7
|
export function discoverProjectRoot(): string | null {
|
|
204
|
-
// Check RELAY_SOCKET env var
|
|
205
8
|
const socketEnv = process.env.RELAY_SOCKET;
|
|
206
9
|
if (socketEnv) {
|
|
207
|
-
// Socket path is like /path/to/project/.agent-relay/relay.sock
|
|
208
10
|
const match = socketEnv.match(/^(.+)\/\.agent-relay\/relay\.sock$/);
|
|
209
11
|
if (match) {
|
|
210
12
|
return match[1];
|
|
211
13
|
}
|
|
212
14
|
}
|
|
213
15
|
|
|
214
|
-
// Search from cwd upward
|
|
215
16
|
let dir = process.cwd();
|
|
216
17
|
while (dir !== '/') {
|
|
217
18
|
if (existsSync(join(dir, '.agent-relay'))) {
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
// Client interface
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
// Client interface (SDK adapter)
|
|
2
|
+
export {
|
|
3
|
+
createRelayClient,
|
|
4
|
+
createRelayClientAdapter,
|
|
5
|
+
type RelayClient,
|
|
6
|
+
type QueryMessage,
|
|
7
|
+
type HealthResponse,
|
|
8
|
+
type MetricsResponse,
|
|
9
|
+
type MessagesResponse,
|
|
10
|
+
} from './client-adapter.js';
|
|
4
11
|
|
|
5
|
-
//
|
|
6
|
-
export {
|
|
12
|
+
// Project discovery helper
|
|
13
|
+
export { discoverProjectRoot } from './hybrid-client.js';
|
|
7
14
|
|
|
8
15
|
// Simple programmatic API (no MCP protocol overhead)
|
|
9
16
|
export {
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
ListResourcesRequestSchema,
|
|
9
9
|
ReadResourceRequestSchema,
|
|
10
10
|
} from '@modelcontextprotocol/sdk/types.js';
|
|
11
|
-
import type { RelayClient } from './client.js';
|
|
11
|
+
import type { RelayClient } from './client-adapter.js';
|
|
12
12
|
import {
|
|
13
13
|
relaySendTool,
|
|
14
14
|
relaySendSchema,
|
|
@@ -143,6 +143,10 @@ const RESOURCES = [agentsResource, inboxResource, projectResource];
|
|
|
143
143
|
export interface MCPServerConfig {
|
|
144
144
|
name?: string;
|
|
145
145
|
version?: string;
|
|
146
|
+
agentName?: string;
|
|
147
|
+
project?: string;
|
|
148
|
+
projectRoot?: string;
|
|
149
|
+
socketPath?: string;
|
|
146
150
|
}
|
|
147
151
|
|
|
148
152
|
/**
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
import { createRelayClient, type RelayClient, type RelayClientOptions } from './client.js';
|
|
18
|
+
import { createRelayClient, type RelayClient, type RelayClientOptions } from './client-adapter.js';
|
|
19
19
|
import type { AckPayload } from '@agent-relay/protocol';
|
|
20
20
|
|
|
21
21
|
export interface Message {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
-
import type { RelayClient } from '../client.js';
|
|
7
|
+
import type { RelayClient } from '../client-adapter.js';
|
|
8
8
|
|
|
9
9
|
export const relayBroadcastSchema = z.object({
|
|
10
10
|
message: z.string().describe('The message to broadcast to all agents'),
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
-
import type { RelayClient } from '../client.js';
|
|
7
|
+
import type { RelayClient } from '../client-adapter.js';
|
|
8
8
|
|
|
9
9
|
// Join channel
|
|
10
10
|
export const relayChannelJoinSchema = z.object({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
-
import type { RelayClient } from '../client.js';
|
|
3
|
+
import type { RelayClient } from '../client-adapter.js';
|
|
4
4
|
|
|
5
5
|
export const relayConnectedSchema = z.object({
|
|
6
6
|
project: z.string().optional().describe('Filter by project (for multi-project setups)'),
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
-
import type { RelayClient } from '../client.js';
|
|
7
|
+
import type { RelayClient } from '../client-adapter.js';
|
|
8
8
|
|
|
9
9
|
// Create proposal
|
|
10
10
|
export const relayProposalSchema = z.object({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
-
import type { RelayClient } from '../client.js';
|
|
3
|
+
import type { RelayClient } from '../client-adapter.js';
|
|
4
4
|
|
|
5
5
|
export const relayContinuitySchema = z.object({
|
|
6
6
|
action: z.enum(['save', 'load', 'uncertain']).describe('Action: save state, load previous state, or mark uncertainty'),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
-
import type { RelayClient, HealthResponse } from '../client.js';
|
|
3
|
+
import type { RelayClient, HealthResponse } from '../client-adapter.js';
|
|
4
4
|
|
|
5
5
|
export const relayHealthSchema = z.object({
|
|
6
6
|
include_crashes: z.boolean().optional().default(true).describe('Include recent crash history'),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
-
import type { RelayClient } from '../client.js';
|
|
3
|
+
import type { RelayClient } from '../client-adapter.js';
|
|
4
4
|
|
|
5
5
|
export const relayInboxSchema = z.object({
|
|
6
6
|
limit: z.number().optional().default(10).describe('Max messages to return'),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
-
import type { RelayClient } from '../client.js';
|
|
3
|
+
import type { RelayClient } from '../client-adapter.js';
|
|
4
4
|
import fs from 'node:fs';
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
import { promisify } from 'node:util';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
-
import type { RelayClient } from '../client.js';
|
|
7
|
+
import type { RelayClient } from '../client-adapter.js';
|
|
8
8
|
|
|
9
9
|
export const relayQueryMessagesSchema = z.object({
|
|
10
10
|
limit: z.number().optional().describe('Maximum number of messages to return (default: 100)'),
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
-
import type { RelayClient, MetricsResponse } from '../client.js';
|
|
3
|
+
import type { RelayClient, MetricsResponse } from '../client-adapter.js';
|
|
4
|
+
|
|
5
|
+
type AgentMetric = MetricsResponse['agents'][number];
|
|
4
6
|
|
|
5
7
|
export const relayMetricsSchema = z.object({
|
|
6
8
|
agent: z.string().optional().describe('Filter metrics to a specific agent'),
|
|
@@ -70,9 +72,9 @@ export async function handleRelayMetrics(
|
|
|
70
72
|
|
|
71
73
|
// Filter to specific agent if requested
|
|
72
74
|
if (input.agent) {
|
|
73
|
-
agents = agents.filter(a => a.name === input.agent);
|
|
75
|
+
agents = agents.filter((a: AgentMetric) => a.name === input.agent);
|
|
74
76
|
if (agents.length === 0) {
|
|
75
|
-
const available = data.agents.map(a => a.name).join(', ');
|
|
77
|
+
const available = data.agents.map((a: AgentMetric) => a.name).join(', ');
|
|
76
78
|
return `Agent "${input.agent}" not found.\n\nAvailable agents: ${available || 'none'}`;
|
|
77
79
|
}
|
|
78
80
|
}
|
|
@@ -115,8 +117,8 @@ export async function handleRelayMetrics(
|
|
|
115
117
|
}
|
|
116
118
|
|
|
117
119
|
// Add recommendations for high resource usage
|
|
118
|
-
const criticalAgents = agents.filter(a => a.alertLevel === 'critical');
|
|
119
|
-
const warningAgents = agents.filter(a => a.alertLevel === 'warning');
|
|
120
|
+
const criticalAgents = agents.filter((a: AgentMetric) => a.alertLevel === 'critical');
|
|
121
|
+
const warningAgents = agents.filter((a: AgentMetric) => a.alertLevel === 'warning');
|
|
120
122
|
|
|
121
123
|
if (criticalAgents.length > 0 || warningAgents.length > 0) {
|
|
122
124
|
lines.push('');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
-
import type { RelayClient } from '../client.js';
|
|
3
|
+
import type { RelayClient } from '../client-adapter.js';
|
|
4
4
|
|
|
5
5
|
export const relayReleaseSchema = z.object({
|
|
6
6
|
name: z.string().describe('Name of the worker to release'),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
-
import type { RelayClient } from '../client.js';
|
|
3
|
+
import type { RelayClient } from '../client-adapter.js';
|
|
4
4
|
|
|
5
5
|
export const relayRemoveAgentSchema = z.object({
|
|
6
6
|
name: z.string().describe('Name of the agent to remove from the registry'),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
-
import type { RelayClient } from '../client.js';
|
|
3
|
+
import type { RelayClient } from '../client-adapter.js';
|
|
4
4
|
|
|
5
5
|
export const relaySendSchema = z.object({
|
|
6
6
|
to: z.string().describe('Target: agent name, #channel, or * for broadcast'),
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
-
import type { RelayClient } from '../client.js';
|
|
7
|
+
import type { RelayClient } from '../client-adapter.js';
|
|
8
8
|
|
|
9
9
|
// Bind as shadow
|
|
10
10
|
export const relayShadowBindSchema = z.object({
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
-
import type { RelayClient } from '../client.js';
|
|
7
|
+
import type { RelayClient } from '../client-adapter.js';
|
|
8
8
|
|
|
9
9
|
// Subscribe schema and tool
|
|
10
10
|
export const relaySubscribeSchema = z.object({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
-
import type { RelayClient } from '../client.js';
|
|
3
|
+
import type { RelayClient } from '../client-adapter.js';
|
|
4
4
|
|
|
5
5
|
export const relayWhoSchema = z.object({
|
|
6
6
|
include_idle: z.boolean().optional().default(true).describe('Include idle agents'),
|