@mono-agent/agent-orchestrator 0.1.0
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/README.md +44 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +357 -0
- package/dist/index.js.map +1 -0
- package/package.json +34 -0
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# @mono-agent/agent-orchestrator
|
|
2
|
+
|
|
3
|
+
## Category
|
|
4
|
+
|
|
5
|
+
Category: `execution`
|
|
6
|
+
|
|
7
|
+
## Responsibility
|
|
8
|
+
|
|
9
|
+
Reusable orchestration helpers for exposing named collaborator responders to an orchestrator runtime. The first surface is a loopback MCP tool named `ask_collaborator` that lets the orchestrator model decide which collaborator to ask, and how many times, before producing its final answer.
|
|
10
|
+
|
|
11
|
+
## Install / Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm --filter @mono-agent/agent-orchestrator run build
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { createCollaboratorToolRuntimeExtension } from "@mono-agent/agent-orchestrator";
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Hosts create one request-scoped extension, merge `extension.runtimeOptions` into the orchestrator runtime call, and call `extension.cleanup()` after the request. Collaborators are plain `AgentResponder` instances, so hosts can wrap local agents, A2A consumers, or other adapter-owned responders without this package depending on those adapters.
|
|
22
|
+
|
|
23
|
+
## Public API
|
|
24
|
+
|
|
25
|
+
- `createCollaboratorToolRuntimeExtension`
|
|
26
|
+
- `DEFAULT_COLLABORATOR_TOOL_NAME`, `DEFAULT_COLLABORATOR_MCP_SERVER_NAME`, `DEFAULT_COLLABORATOR_MAX_CALLS`
|
|
27
|
+
- `OrchestratorCollaborator`
|
|
28
|
+
- `CollaboratorToolRuntimeExtension`, `CollaboratorToolRuntimeOptions`, `CollaboratorToolMcpServerConfig`
|
|
29
|
+
|
|
30
|
+
## Dependency Boundary
|
|
31
|
+
|
|
32
|
+
This package may depend on core agent contracts and the MCP TypeScript SDK. It must not depend on communication adapters, the agent harness, operator surfaces, host demos, or concrete runtime packages.
|
|
33
|
+
|
|
34
|
+
## What This Package Does Not Own
|
|
35
|
+
|
|
36
|
+
It does not start Telegram, WhatsApp, or A2A transports, discover remote agents, persist memory, record run artifacts, or decide which collaborator to ask. It only exposes host-provided collaborators as a bounded MCP tool for a runtime to call.
|
|
37
|
+
|
|
38
|
+
## Verification
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pnpm --filter @mono-agent/agent-orchestrator run build
|
|
42
|
+
pnpm --filter @mono-agent/agent-orchestrator run typecheck
|
|
43
|
+
pnpm --filter @mono-agent/agent-orchestrator run test
|
|
44
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { AgentMessageStream, AgentRequestBase, AgentResponder, AgentResponse } from "@mono-agent/agent-contracts";
|
|
2
|
+
export declare const DEFAULT_COLLABORATOR_TOOL_NAME = "ask_collaborator";
|
|
3
|
+
export declare const DEFAULT_COLLABORATOR_MCP_SERVER_NAME = "collaborators";
|
|
4
|
+
export declare const DEFAULT_COLLABORATOR_MAX_CALLS = 6;
|
|
5
|
+
export interface OrchestratorCollaborator {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly label: string;
|
|
8
|
+
readonly description?: string;
|
|
9
|
+
readonly responder: AgentResponder<AgentRequestBase, AgentMessageStream, AgentResponse>;
|
|
10
|
+
readonly timeoutMs?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface CollaboratorToolRuntimeOptions extends Record<string, unknown> {
|
|
13
|
+
readonly allowedTools: readonly string[];
|
|
14
|
+
readonly mcpServers: Record<string, CollaboratorToolMcpServerConfig>;
|
|
15
|
+
}
|
|
16
|
+
export interface CollaboratorToolMcpServerConfig {
|
|
17
|
+
readonly type: "http";
|
|
18
|
+
readonly url: string;
|
|
19
|
+
}
|
|
20
|
+
export interface CollaboratorToolRuntimeExtension {
|
|
21
|
+
readonly url: string;
|
|
22
|
+
readonly toolName: string;
|
|
23
|
+
readonly serverName: string;
|
|
24
|
+
readonly runtimeOptions: CollaboratorToolRuntimeOptions;
|
|
25
|
+
cleanup(): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
export interface CreateCollaboratorToolRuntimeExtensionOptions {
|
|
28
|
+
readonly collaborators: readonly OrchestratorCollaborator[];
|
|
29
|
+
readonly conversationId: string;
|
|
30
|
+
readonly originalUserMessage: string;
|
|
31
|
+
readonly abortSignal: AbortSignal;
|
|
32
|
+
readonly maxCalls?: number;
|
|
33
|
+
readonly host?: string;
|
|
34
|
+
readonly port?: number;
|
|
35
|
+
readonly path?: string;
|
|
36
|
+
readonly toolName?: string;
|
|
37
|
+
readonly serverName?: string;
|
|
38
|
+
/** Allow binding a non-loopback host. Fail-closed (loopback-only) by default. */
|
|
39
|
+
readonly allowNonLoopback?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export declare function createCollaboratorToolRuntimeExtension(options: CreateCollaboratorToolRuntimeExtensionOptions): Promise<CollaboratorToolRuntimeExtension>;
|
|
42
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,aAAa,EACd,MAAM,6BAA6B,CAAC;AAIrC,eAAO,MAAM,8BAA8B,qBAAqB,CAAC;AACjE,eAAO,MAAM,oCAAoC,kBAAkB,CAAC;AACpE,eAAO,MAAM,8BAA8B,IAAI,CAAC;AAEhD,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,Q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,MAAM,CAAC;IAC7B,iFAAiF;IACjF,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CACrC;AAgBD,wBAAsB,sCAAsC,CAC1D,OAAO,EAAE,6CAA6C,GACrD,OAAO,CAAC,gCAAgC,CAAC,CA2F3C"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import { createMcpExpressApp } from "@modelcontextprotocol/sdk/server/express.js";
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
4
|
+
import { assertSafeBind } from "@mono-agent/settings";
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
export const DEFAULT_COLLABORATOR_TOOL_NAME = "ask_collaborator";
|
|
7
|
+
export const DEFAULT_COLLABORATOR_MCP_SERVER_NAME = "collaborators";
|
|
8
|
+
export const DEFAULT_COLLABORATOR_MAX_CALLS = 6;
|
|
9
|
+
export async function createCollaboratorToolRuntimeExtension(options) {
|
|
10
|
+
const host = normalizeHost(options.host);
|
|
11
|
+
assertSafeBind(host, options.allowNonLoopback === true, (boundHost) => new Error(`Collaborator MCP server refuses to bind a non-loopback host (${boundHost}) unless allowNonLoopback is true.`));
|
|
12
|
+
const port = normalizePort(options.port);
|
|
13
|
+
const path = normalizeMcpPath(options.path);
|
|
14
|
+
const toolName = normalizeIdentifier(options.toolName ?? DEFAULT_COLLABORATOR_TOOL_NAME, "toolName");
|
|
15
|
+
const serverName = normalizeIdentifier(options.serverName ?? DEFAULT_COLLABORATOR_MCP_SERVER_NAME, "serverName");
|
|
16
|
+
const maxCalls = normalizeMaxCalls(options.maxCalls);
|
|
17
|
+
const conversationId = normalizeNonEmpty(options.conversationId, "conversationId");
|
|
18
|
+
const originalUserMessage = normalizeNonEmpty(options.originalUserMessage, "originalUserMessage");
|
|
19
|
+
const collaborators = normalizeCollaborators(options.collaborators);
|
|
20
|
+
let callCount = 0;
|
|
21
|
+
// Passing host to createMcpExpressApp enables the MCP SDK's DNS-rebinding protection.
|
|
22
|
+
const app = createMcpExpressApp({ host });
|
|
23
|
+
app.post(path, async (req, res) => {
|
|
24
|
+
const server = createRequestMcpServer({
|
|
25
|
+
toolName,
|
|
26
|
+
collaborators,
|
|
27
|
+
maxCalls,
|
|
28
|
+
conversationId,
|
|
29
|
+
originalUserMessage,
|
|
30
|
+
parentAbortSignal: options.abortSignal,
|
|
31
|
+
incrementCallCount: () => {
|
|
32
|
+
callCount += 1;
|
|
33
|
+
return callCount;
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
const transport = new StreamableHTTPServerTransport({ sessionIdGenerator: undefined });
|
|
37
|
+
try {
|
|
38
|
+
await server.connect(transport);
|
|
39
|
+
await transport.handleRequest(req, res, req.body);
|
|
40
|
+
res.on("close", () => {
|
|
41
|
+
void transport.close().catch(() => undefined);
|
|
42
|
+
void server.close().catch(() => undefined);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
if (!res.headersSent) {
|
|
47
|
+
res.status(500).json({
|
|
48
|
+
jsonrpc: "2.0",
|
|
49
|
+
error: {
|
|
50
|
+
code: -32603,
|
|
51
|
+
message: error instanceof Error ? error.message : String(error),
|
|
52
|
+
},
|
|
53
|
+
id: null,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
await transport.close().catch(() => undefined);
|
|
57
|
+
await server.close().catch(() => undefined);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
app.get(path, (_req, res) => {
|
|
61
|
+
res.status(405).json({ error: "method_not_allowed" });
|
|
62
|
+
});
|
|
63
|
+
app.delete(path, (_req, res) => {
|
|
64
|
+
res.status(405).json({ error: "method_not_allowed" });
|
|
65
|
+
});
|
|
66
|
+
const httpServer = await listen(app, host, port);
|
|
67
|
+
const address = httpServer.address();
|
|
68
|
+
if (address === null || typeof address === "string") {
|
|
69
|
+
await closeHttpServer(httpServer);
|
|
70
|
+
throw new Error("Collaborator MCP server did not expose a TCP address.");
|
|
71
|
+
}
|
|
72
|
+
const url = `http://${host}:${address.port}${path}`;
|
|
73
|
+
let cleaned = false;
|
|
74
|
+
const cleanup = async () => {
|
|
75
|
+
if (cleaned) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
cleaned = true;
|
|
79
|
+
await closeHttpServer(httpServer);
|
|
80
|
+
};
|
|
81
|
+
return {
|
|
82
|
+
url,
|
|
83
|
+
toolName,
|
|
84
|
+
serverName,
|
|
85
|
+
runtimeOptions: {
|
|
86
|
+
allowedTools: [toolName],
|
|
87
|
+
mcpServers: {
|
|
88
|
+
[serverName]: { type: "http", url },
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
cleanup,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function createRequestMcpServer(input) {
|
|
95
|
+
const server = new McpServer({ name: "mono-agent-collaborators", version: "0.1.0" });
|
|
96
|
+
server.registerTool(input.toolName, {
|
|
97
|
+
title: "Ask collaborator",
|
|
98
|
+
description: collaboratorToolDescription(input.collaborators),
|
|
99
|
+
inputSchema: {
|
|
100
|
+
id: z.string().min(1).describe("Collaborator id to ask."),
|
|
101
|
+
message: z.string().min(1).describe("Specific request for the collaborator."),
|
|
102
|
+
reason: z.string().min(1).optional().describe("Why this collaborator is being asked."),
|
|
103
|
+
},
|
|
104
|
+
}, async (args, extra) => {
|
|
105
|
+
const callIndex = input.incrementCallCount();
|
|
106
|
+
if (callIndex > input.maxCalls) {
|
|
107
|
+
return visibleToolError(`Collaborator call limit of ${input.maxCalls} was reached.`);
|
|
108
|
+
}
|
|
109
|
+
const parsed = normalizeAskArgs(args);
|
|
110
|
+
const collaborator = input.collaborators.get(parsed.id);
|
|
111
|
+
if (collaborator === undefined) {
|
|
112
|
+
return visibleToolError(`Unknown collaborator "${parsed.id}". Available collaborators: ${[...input.collaborators.keys()].join(", ")}.`);
|
|
113
|
+
}
|
|
114
|
+
const signal = composeAbortSignal({
|
|
115
|
+
signals: [input.parentAbortSignal, extra.signal],
|
|
116
|
+
...(collaborator.timeoutMs === undefined ? {} : { timeoutMs: collaborator.timeoutMs }),
|
|
117
|
+
});
|
|
118
|
+
try {
|
|
119
|
+
if (signal.signal.aborted) {
|
|
120
|
+
throw new Error("Collaborator request was cancelled before it started.");
|
|
121
|
+
}
|
|
122
|
+
const result = await askCollaborator({
|
|
123
|
+
collaborator,
|
|
124
|
+
callIndex,
|
|
125
|
+
conversationId: input.conversationId,
|
|
126
|
+
originalUserMessage: input.originalUserMessage,
|
|
127
|
+
ask: parsed,
|
|
128
|
+
abortSignal: signal.signal,
|
|
129
|
+
});
|
|
130
|
+
return result;
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
return visibleToolError(formatCollaboratorError(collaborator, error));
|
|
134
|
+
}
|
|
135
|
+
finally {
|
|
136
|
+
signal.cleanup();
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
return server;
|
|
140
|
+
}
|
|
141
|
+
async function askCollaborator(input) {
|
|
142
|
+
const chunks = [];
|
|
143
|
+
const response = await input.collaborator.responder.respond({
|
|
144
|
+
conversationId: `${input.conversationId}:${input.collaborator.id}`,
|
|
145
|
+
text: collaboratorRequestText(input.originalUserMessage, input.ask),
|
|
146
|
+
abortSignal: input.abortSignal,
|
|
147
|
+
metadata: {
|
|
148
|
+
collaborator: {
|
|
149
|
+
id: input.collaborator.id,
|
|
150
|
+
label: input.collaborator.label,
|
|
151
|
+
callIndex: input.callIndex,
|
|
152
|
+
...(input.ask.reason === undefined ? {} : { reason: input.ask.reason }),
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
}, {
|
|
156
|
+
append: async (delta) => {
|
|
157
|
+
chunks.push(delta);
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
const text = normalizeOptionalText(response.text) ?? normalizeOptionalText(chunks.join(""));
|
|
161
|
+
if (text === undefined) {
|
|
162
|
+
return visibleToolError(`${input.collaborator.label} returned no text.`);
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
content: [{ type: "text", text }],
|
|
166
|
+
structuredContent: {
|
|
167
|
+
status: "succeeded",
|
|
168
|
+
collaborator: {
|
|
169
|
+
id: input.collaborator.id,
|
|
170
|
+
label: input.collaborator.label,
|
|
171
|
+
},
|
|
172
|
+
text,
|
|
173
|
+
...(response.metadata === undefined ? {} : { metadata: response.metadata }),
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
function collaboratorRequestText(originalUserMessage, ask) {
|
|
178
|
+
return [
|
|
179
|
+
"Original user request:",
|
|
180
|
+
originalUserMessage,
|
|
181
|
+
"",
|
|
182
|
+
"Orchestrator request:",
|
|
183
|
+
ask.message,
|
|
184
|
+
...(ask.reason === undefined ? [] : ["", "Reason:", ask.reason]),
|
|
185
|
+
].join("\n");
|
|
186
|
+
}
|
|
187
|
+
function visibleToolError(message) {
|
|
188
|
+
return {
|
|
189
|
+
isError: true,
|
|
190
|
+
content: [{ type: "text", text: message }],
|
|
191
|
+
structuredContent: {
|
|
192
|
+
status: "failed",
|
|
193
|
+
error: message,
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
function collaboratorToolDescription(collaborators) {
|
|
198
|
+
const lines = [
|
|
199
|
+
"Ask one named collaborator for help before producing the final answer. You may call this tool multiple times when useful.",
|
|
200
|
+
"Available collaborators:",
|
|
201
|
+
];
|
|
202
|
+
for (const collaborator of collaborators.values()) {
|
|
203
|
+
lines.push(`- ${collaborator.id}: ${collaborator.label}${collaborator.description === undefined ? "" : ` - ${collaborator.description}`}`);
|
|
204
|
+
}
|
|
205
|
+
return lines.join("\n");
|
|
206
|
+
}
|
|
207
|
+
function normalizeCollaborators(collaborators) {
|
|
208
|
+
if (!Array.isArray(collaborators) || collaborators.length === 0) {
|
|
209
|
+
throw new TypeError("collaborators must contain at least one collaborator.");
|
|
210
|
+
}
|
|
211
|
+
const out = new Map();
|
|
212
|
+
for (const collaborator of collaborators) {
|
|
213
|
+
const id = normalizeIdentifier(collaborator.id, "collaborator.id");
|
|
214
|
+
if (out.has(id)) {
|
|
215
|
+
throw new TypeError(`Duplicate collaborator id "${id}".`);
|
|
216
|
+
}
|
|
217
|
+
if (typeof collaborator.responder?.respond !== "function") {
|
|
218
|
+
throw new TypeError(`Collaborator "${id}" must expose responder.respond().`);
|
|
219
|
+
}
|
|
220
|
+
out.set(id, {
|
|
221
|
+
id,
|
|
222
|
+
label: normalizeNonEmpty(collaborator.label, "collaborator.label"),
|
|
223
|
+
...(collaborator.description === undefined
|
|
224
|
+
? {}
|
|
225
|
+
: { description: normalizeNonEmpty(collaborator.description, "collaborator.description") }),
|
|
226
|
+
responder: collaborator.responder,
|
|
227
|
+
...(collaborator.timeoutMs === undefined ? {} : { timeoutMs: normalizeTimeoutMs(collaborator.timeoutMs) }),
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
return out;
|
|
231
|
+
}
|
|
232
|
+
function normalizeAskArgs(value) {
|
|
233
|
+
if (!isRecord(value)) {
|
|
234
|
+
throw new TypeError("ask_collaborator arguments must be an object.");
|
|
235
|
+
}
|
|
236
|
+
const normalized = {
|
|
237
|
+
id: normalizeIdentifier(value.id, "id"),
|
|
238
|
+
message: normalizeNonEmpty(value.message, "message"),
|
|
239
|
+
};
|
|
240
|
+
if (value.reason !== undefined) {
|
|
241
|
+
normalized.reason = normalizeNonEmpty(value.reason, "reason");
|
|
242
|
+
}
|
|
243
|
+
return normalized;
|
|
244
|
+
}
|
|
245
|
+
function normalizeIdentifier(value, field) {
|
|
246
|
+
const normalized = normalizeNonEmpty(value, field);
|
|
247
|
+
if (!/^[A-Za-z0-9_-]+$/u.test(normalized)) {
|
|
248
|
+
throw new TypeError(`${field} may only contain letters, numbers, underscores, and hyphens.`);
|
|
249
|
+
}
|
|
250
|
+
return normalized;
|
|
251
|
+
}
|
|
252
|
+
function normalizeNonEmpty(value, field) {
|
|
253
|
+
if (typeof value !== "string") {
|
|
254
|
+
throw new TypeError(`${field} must be a string.`);
|
|
255
|
+
}
|
|
256
|
+
const normalized = value.trim();
|
|
257
|
+
if (normalized.length === 0) {
|
|
258
|
+
throw new TypeError(`${field} must not be empty.`);
|
|
259
|
+
}
|
|
260
|
+
return normalized;
|
|
261
|
+
}
|
|
262
|
+
function normalizeHost(value) {
|
|
263
|
+
return value === undefined ? "127.0.0.1" : normalizeNonEmpty(value, "host");
|
|
264
|
+
}
|
|
265
|
+
function normalizePort(value) {
|
|
266
|
+
if (value === undefined) {
|
|
267
|
+
return 0;
|
|
268
|
+
}
|
|
269
|
+
if (!Number.isInteger(value) || value < 0 || value > 65535) {
|
|
270
|
+
throw new TypeError("port must be an integer from 0 to 65535.");
|
|
271
|
+
}
|
|
272
|
+
return value;
|
|
273
|
+
}
|
|
274
|
+
function normalizeMaxCalls(value) {
|
|
275
|
+
const normalized = value ?? DEFAULT_COLLABORATOR_MAX_CALLS;
|
|
276
|
+
if (!Number.isInteger(normalized) || normalized < 1) {
|
|
277
|
+
throw new TypeError("maxCalls must be a positive integer.");
|
|
278
|
+
}
|
|
279
|
+
return normalized;
|
|
280
|
+
}
|
|
281
|
+
function normalizeTimeoutMs(value) {
|
|
282
|
+
if (!Number.isInteger(value) || value < 1) {
|
|
283
|
+
throw new TypeError("timeoutMs must be a positive integer.");
|
|
284
|
+
}
|
|
285
|
+
return value;
|
|
286
|
+
}
|
|
287
|
+
function normalizeMcpPath(value) {
|
|
288
|
+
const normalized = value === undefined ? "/mcp" : normalizeNonEmpty(value, "path");
|
|
289
|
+
return normalized.startsWith("/") ? normalized : `/${normalized}`;
|
|
290
|
+
}
|
|
291
|
+
function normalizeOptionalText(value) {
|
|
292
|
+
if (typeof value !== "string") {
|
|
293
|
+
return undefined;
|
|
294
|
+
}
|
|
295
|
+
const normalized = value.trim();
|
|
296
|
+
return normalized.length === 0 ? undefined : normalized;
|
|
297
|
+
}
|
|
298
|
+
function composeAbortSignal(input) {
|
|
299
|
+
const controller = new AbortController();
|
|
300
|
+
const abort = () => {
|
|
301
|
+
if (!controller.signal.aborted) {
|
|
302
|
+
controller.abort();
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
const cleanupCallbacks = [];
|
|
306
|
+
for (const signal of input.signals) {
|
|
307
|
+
if (signal.aborted) {
|
|
308
|
+
abort();
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
312
|
+
cleanupCallbacks.push(() => signal.removeEventListener("abort", abort));
|
|
313
|
+
}
|
|
314
|
+
let timeout;
|
|
315
|
+
if (input.timeoutMs !== undefined) {
|
|
316
|
+
timeout = setTimeout(abort, input.timeoutMs);
|
|
317
|
+
}
|
|
318
|
+
return {
|
|
319
|
+
signal: controller.signal,
|
|
320
|
+
cleanup() {
|
|
321
|
+
for (const cleanup of cleanupCallbacks) {
|
|
322
|
+
cleanup();
|
|
323
|
+
}
|
|
324
|
+
if (timeout !== undefined) {
|
|
325
|
+
clearTimeout(timeout);
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
async function listen(app, host, port) {
|
|
331
|
+
return await new Promise((resolve, reject) => {
|
|
332
|
+
const server = app.listen(port, host, () => {
|
|
333
|
+
server.off("error", reject);
|
|
334
|
+
resolve(server);
|
|
335
|
+
});
|
|
336
|
+
server.once("error", reject);
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
async function closeHttpServer(server) {
|
|
340
|
+
await new Promise((resolve, reject) => {
|
|
341
|
+
server.close((error) => {
|
|
342
|
+
if (error === undefined) {
|
|
343
|
+
resolve();
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
reject(error);
|
|
347
|
+
});
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
function formatCollaboratorError(collaborator, error) {
|
|
351
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
352
|
+
return `${collaborator.label} failed: ${reason}`;
|
|
353
|
+
}
|
|
354
|
+
function isRecord(value) {
|
|
355
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
356
|
+
}
|
|
357
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AAQnG,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,MAAM,CAAC,MAAM,8BAA8B,GAAG,kBAAkB,CAAC;AACjE,MAAM,CAAC,MAAM,oCAAoC,GAAG,eAAe,CAAC;AACpE,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC;AA2DhD,MAAM,CAAC,KAAK,UAAU,sCAAsC,CAC1D,OAAsD;IAEtD,MAAM,IAAI,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,gBAAgB,KAAK,IAAI,EAAE,CAAC,SAAS,EAAE,EAAE,CACpE,IAAI,KAAK,CACP,gEAAgE,SAAS,oCAAoC,CAC9G,CAAC,CAAC;IACL,MAAM,IAAI,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,MAAM,IAAI,GAAG,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,MAAM,QAAQ,GAAG,mBAAmB,CAAC,OAAO,CAAC,QAAQ,IAAI,8BAA8B,EAAE,UAAU,CAAC,CAAC;IACrG,MAAM,UAAU,GAAG,mBAAmB,CAAC,OAAO,CAAC,UAAU,IAAI,oC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,KAAK,EAAE,EAAE;YACrB,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,OAAO,EAAE,CAAC;gBACV,OAAO;YACT,CAAC;YACD,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,uBAAuB,CAAC,YAAoC,EAAE,KAAc;IACnF,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACtE,OAAO,GAAG,YAAY,CAAC,KAAK,YAAY,MAAM,EAAE,CAAC;AACnD,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mono-agent/agent-orchestrator",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Reusable collaborator tool orchestration for agent runtimes.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"private": false,
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
22
|
+
"@mono-agent/agent-contracts": "0.1.0",
|
|
23
|
+
"@mono-agent/settings": "0.1.0",
|
|
24
|
+
"zod": "^4.4.3"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsc -p tsconfig.build.json",
|
|
31
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
32
|
+
"test": "vitest run --passWithNoTests"
|
|
33
|
+
}
|
|
34
|
+
}
|