@directive-run/ai 1.13.0 → 1.14.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/dist/anthropic.d.cts +1 -1
- package/dist/anthropic.d.ts +1 -1
- package/dist/{chunk-XV2QSBBE.cjs → chunk-2TD4ZSGZ.cjs} +7 -7
- package/dist/{chunk-XV2QSBBE.cjs.map → chunk-2TD4ZSGZ.cjs.map} +1 -1
- package/dist/chunk-5JQ2A3JK.js +2 -0
- package/dist/chunk-5JQ2A3JK.js.map +1 -0
- package/dist/chunk-A22KLB23.cjs +67 -0
- package/dist/chunk-A22KLB23.cjs.map +1 -0
- package/dist/chunk-A5K77UDX.cjs +4 -0
- package/dist/chunk-A5K77UDX.cjs.map +1 -0
- package/dist/chunk-DN5NAJM6.js +6 -0
- package/dist/chunk-DN5NAJM6.js.map +1 -0
- package/dist/chunk-FABDFT74.cjs +6 -0
- package/dist/chunk-FABDFT74.cjs.map +1 -0
- package/dist/chunk-FBT73WFY.js +2 -0
- package/dist/chunk-FBT73WFY.js.map +1 -0
- package/dist/chunk-FFRWQNK7.cjs +7 -0
- package/dist/chunk-FFRWQNK7.cjs.map +1 -0
- package/dist/chunk-IR3IHBVQ.cjs +2 -0
- package/dist/chunk-IR3IHBVQ.cjs.map +1 -0
- package/dist/chunk-IUGSMTBE.js +16 -0
- package/dist/{chunk-Q3PQLWBR.js.map → chunk-IUGSMTBE.js.map} +1 -1
- package/dist/chunk-J2Q5KKPN.js +37 -0
- package/dist/chunk-J2Q5KKPN.js.map +1 -0
- package/dist/chunk-K64WKZ22.cjs +2 -0
- package/dist/chunk-K64WKZ22.cjs.map +1 -0
- package/dist/chunk-LKY4K5TV.cjs +11 -0
- package/dist/chunk-LKY4K5TV.cjs.map +1 -0
- package/dist/chunk-LXUMJKGJ.js +67 -0
- package/dist/chunk-LXUMJKGJ.js.map +1 -0
- package/dist/chunk-NNAQ4ZH2.js +11 -0
- package/dist/chunk-NNAQ4ZH2.js.map +1 -0
- package/dist/chunk-PD772MSE.cjs +30 -0
- package/dist/chunk-PD772MSE.cjs.map +1 -0
- package/dist/chunk-POBEEJR6.js +30 -0
- package/dist/chunk-POBEEJR6.js.map +1 -0
- package/dist/chunk-QRXWLD6H.js +4 -0
- package/dist/chunk-QRXWLD6H.js.map +1 -0
- package/dist/chunk-UR4ZGO7V.js +7 -0
- package/dist/chunk-UR4ZGO7V.js.map +1 -0
- package/dist/chunk-UR5BMWEN.js +2 -0
- package/dist/chunk-UR5BMWEN.js.map +1 -0
- package/dist/chunk-WOFIBIPW.cjs +2 -0
- package/dist/chunk-WOFIBIPW.cjs.map +1 -0
- package/dist/chunk-XN5LUOVS.cjs +37 -0
- package/dist/chunk-XN5LUOVS.cjs.map +1 -0
- package/dist/debug-timeline-DpnRMnLU.d.cts +87 -0
- package/dist/debug-timeline-L13P-U2I.d.ts +87 -0
- package/dist/devtools.cjs +2 -0
- package/dist/devtools.cjs.map +1 -0
- package/dist/devtools.d.cts +354 -0
- package/dist/devtools.d.ts +354 -0
- package/dist/devtools.js +2 -0
- package/dist/devtools.js.map +1 -0
- package/dist/evals.cjs +2 -0
- package/dist/evals.cjs.map +1 -0
- package/dist/evals.d.cts +361 -0
- package/dist/evals.d.ts +361 -0
- package/dist/evals.js +2 -0
- package/dist/evals.js.map +1 -0
- package/dist/gemini.d.cts +1 -1
- package/dist/gemini.d.ts +1 -1
- package/dist/guardrails.cjs +2 -0
- package/dist/guardrails.cjs.map +1 -0
- package/dist/guardrails.d.cts +618 -0
- package/dist/guardrails.d.ts +618 -0
- package/dist/guardrails.js +2 -0
- package/dist/guardrails.js.map +1 -0
- package/dist/health-monitor-C6xoXrQz.d.cts +55 -0
- package/dist/health-monitor-qL9RNMH3.d.ts +55 -0
- package/dist/index.cjs +21 -99
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1197 -4735
- package/dist/index.d.ts +1197 -4735
- package/dist/index.js +21 -99
- package/dist/index.js.map +1 -1
- package/dist/mcp.cjs +2 -0
- package/dist/mcp.cjs.map +1 -0
- package/dist/mcp.d.cts +450 -0
- package/dist/mcp.d.ts +450 -0
- package/dist/mcp.js +2 -0
- package/dist/mcp.js.map +1 -0
- package/dist/multi-agent-orchestrator-QWWQKKGX.js +2 -0
- package/dist/{multi-agent-orchestrator-4PXNYRHB.js.map → multi-agent-orchestrator-QWWQKKGX.js.map} +1 -1
- package/dist/multi-agent-orchestrator-Y5U4JCFO.cjs +2 -0
- package/dist/{multi-agent-orchestrator-KFGTEGE5.cjs.map → multi-agent-orchestrator-Y5U4JCFO.cjs.map} +1 -1
- package/dist/multi-agent.cjs +2 -0
- package/dist/multi-agent.cjs.map +1 -0
- package/dist/multi-agent.d.cts +1429 -0
- package/dist/multi-agent.d.ts +1429 -0
- package/dist/multi-agent.js +2 -0
- package/dist/multi-agent.js.map +1 -0
- package/dist/ollama.d.cts +1 -1
- package/dist/ollama.d.ts +1 -1
- package/dist/openai.d.cts +2 -2
- package/dist/openai.d.ts +2 -2
- package/dist/{orchestrator-types-CTfIKk0W.d.ts → orchestrator-types-DGBhL6mc.d.ts} +5 -138
- package/dist/{orchestrator-types-Bh8r3_Sq.d.cts → orchestrator-types-DeIMRLR7.d.cts} +5 -138
- package/dist/predicate.cjs +2 -0
- package/dist/predicate.cjs.map +1 -0
- package/dist/predicate.d.cts +371 -0
- package/dist/predicate.d.ts +371 -0
- package/dist/predicate.js +2 -0
- package/dist/predicate.js.map +1 -0
- package/dist/{semantic-cache-nBpQqILc.d.cts → semantic-cache-DM7ev7NQ.d.cts} +1 -1
- package/dist/{semantic-cache-nBpQqILc.d.ts → semantic-cache-DM7ev7NQ.d.ts} +1 -1
- package/dist/testing.cjs +1 -1
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +4 -2
- package/dist/testing.d.ts +4 -2
- package/dist/testing.js +1 -1
- package/dist/testing.js.map +1 -1
- package/dist/{types-CRmwFnVk.d.cts → types-DJ09LjZX.d.cts} +1 -1
- package/dist/{types-CRmwFnVk.d.ts → types-DJ09LjZX.d.ts} +1 -1
- package/package.json +32 -2
- package/dist/chunk-Q3PQLWBR.js +0 -16
- package/dist/chunk-RW4R3O5P.js +0 -72
- package/dist/chunk-RW4R3O5P.js.map +0 -1
- package/dist/chunk-X3VQ5F7D.cjs +0 -72
- package/dist/chunk-X3VQ5F7D.cjs.map +0 -1
- package/dist/multi-agent-orchestrator-4PXNYRHB.js +0 -2
- package/dist/multi-agent-orchestrator-KFGTEGE5.cjs +0 -2
package/dist/mcp.d.ts
ADDED
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
import { Plugin } from '@directive-run/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* MCP Type Definitions
|
|
5
|
+
*
|
|
6
|
+
* Model Context Protocol types for Directive integration.
|
|
7
|
+
* These types are compatible with the MCP specification but don't require
|
|
8
|
+
* the MCP SDK as a dependency.
|
|
9
|
+
*
|
|
10
|
+
* @see https://modelcontextprotocol.io/
|
|
11
|
+
*/
|
|
12
|
+
/** MCP Transport type */
|
|
13
|
+
type MCPTransport = "stdio" | "sse" | "websocket";
|
|
14
|
+
/** MCP Server connection configuration */
|
|
15
|
+
interface MCPServerConfig {
|
|
16
|
+
/** Unique name for this server */
|
|
17
|
+
name: string;
|
|
18
|
+
/** Transport protocol */
|
|
19
|
+
transport: MCPTransport;
|
|
20
|
+
/** For stdio: command to run */
|
|
21
|
+
command?: string;
|
|
22
|
+
/** For stdio: command arguments */
|
|
23
|
+
args?: string[];
|
|
24
|
+
/** For stdio: environment variables */
|
|
25
|
+
env?: Record<string, string>;
|
|
26
|
+
/** For sse/websocket: URL to connect to */
|
|
27
|
+
url?: string;
|
|
28
|
+
/** Optional authentication */
|
|
29
|
+
auth?: {
|
|
30
|
+
type: "bearer" | "api-key" | "oauth";
|
|
31
|
+
token?: string;
|
|
32
|
+
apiKey?: string;
|
|
33
|
+
};
|
|
34
|
+
/** Connection timeout (ms) */
|
|
35
|
+
timeout?: number;
|
|
36
|
+
/** Retry configuration */
|
|
37
|
+
retry?: {
|
|
38
|
+
maxAttempts?: number;
|
|
39
|
+
backoffMs?: number;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/** MCP Tool definition */
|
|
43
|
+
interface MCPTool {
|
|
44
|
+
/** Tool name (must be unique within server) */
|
|
45
|
+
name: string;
|
|
46
|
+
/** Human-readable description */
|
|
47
|
+
description?: string;
|
|
48
|
+
/** JSON Schema for tool input */
|
|
49
|
+
inputSchema: MCPJsonSchema;
|
|
50
|
+
}
|
|
51
|
+
/** MCP Resource definition */
|
|
52
|
+
interface MCPResource {
|
|
53
|
+
/** Resource URI */
|
|
54
|
+
uri: string;
|
|
55
|
+
/** Human-readable name */
|
|
56
|
+
name: string;
|
|
57
|
+
/** Resource description */
|
|
58
|
+
description?: string;
|
|
59
|
+
/** MIME type */
|
|
60
|
+
mimeType?: string;
|
|
61
|
+
}
|
|
62
|
+
/** MCP Prompt definition */
|
|
63
|
+
interface MCPPrompt {
|
|
64
|
+
/** Prompt name */
|
|
65
|
+
name: string;
|
|
66
|
+
/** Prompt description */
|
|
67
|
+
description?: string;
|
|
68
|
+
/** Arguments the prompt accepts */
|
|
69
|
+
arguments?: MCPPromptArgument[];
|
|
70
|
+
}
|
|
71
|
+
/** MCP Prompt argument */
|
|
72
|
+
interface MCPPromptArgument {
|
|
73
|
+
name: string;
|
|
74
|
+
description?: string;
|
|
75
|
+
required?: boolean;
|
|
76
|
+
}
|
|
77
|
+
/** JSON Schema type (subset used by MCP) */
|
|
78
|
+
interface MCPJsonSchema {
|
|
79
|
+
type?: string;
|
|
80
|
+
description?: string;
|
|
81
|
+
properties?: Record<string, MCPJsonSchema>;
|
|
82
|
+
required?: string[];
|
|
83
|
+
items?: MCPJsonSchema;
|
|
84
|
+
enum?: unknown[];
|
|
85
|
+
default?: unknown;
|
|
86
|
+
[key: string]: unknown;
|
|
87
|
+
}
|
|
88
|
+
/** Result from calling an MCP tool */
|
|
89
|
+
interface MCPToolResult {
|
|
90
|
+
/** Tool output content */
|
|
91
|
+
content: MCPContent[];
|
|
92
|
+
/** Whether the tool call failed */
|
|
93
|
+
isError?: boolean;
|
|
94
|
+
}
|
|
95
|
+
/** MCP Content types */
|
|
96
|
+
type MCPContent = MCPTextContent | MCPImageContent | MCPResourceContent;
|
|
97
|
+
/** Text content */
|
|
98
|
+
interface MCPTextContent {
|
|
99
|
+
type: "text";
|
|
100
|
+
text: string;
|
|
101
|
+
}
|
|
102
|
+
/** Image content */
|
|
103
|
+
interface MCPImageContent {
|
|
104
|
+
type: "image";
|
|
105
|
+
data: string;
|
|
106
|
+
mimeType: string;
|
|
107
|
+
}
|
|
108
|
+
/** Resource reference content */
|
|
109
|
+
interface MCPResourceContent {
|
|
110
|
+
type: "resource";
|
|
111
|
+
resource: {
|
|
112
|
+
uri: string;
|
|
113
|
+
mimeType?: string;
|
|
114
|
+
text?: string;
|
|
115
|
+
blob?: string;
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/** Result from reading an MCP resource */
|
|
119
|
+
interface MCPResourceResult {
|
|
120
|
+
contents: Array<{
|
|
121
|
+
uri: string;
|
|
122
|
+
mimeType?: string;
|
|
123
|
+
text?: string;
|
|
124
|
+
blob?: string;
|
|
125
|
+
}>;
|
|
126
|
+
}
|
|
127
|
+
/** Result from getting an MCP prompt */
|
|
128
|
+
interface MCPPromptResult {
|
|
129
|
+
description?: string;
|
|
130
|
+
messages: Array<{
|
|
131
|
+
role: "user" | "assistant";
|
|
132
|
+
content: MCPContent;
|
|
133
|
+
}>;
|
|
134
|
+
}
|
|
135
|
+
/** MCP Client capabilities */
|
|
136
|
+
interface MCPCapabilities {
|
|
137
|
+
tools?: boolean;
|
|
138
|
+
resources?: boolean;
|
|
139
|
+
prompts?: boolean;
|
|
140
|
+
sampling?: boolean;
|
|
141
|
+
logging?: boolean;
|
|
142
|
+
}
|
|
143
|
+
/** MCP Client interface (for custom implementations) */
|
|
144
|
+
interface MCPClient {
|
|
145
|
+
/** Connect to the server */
|
|
146
|
+
connect(): Promise<void>;
|
|
147
|
+
/** Disconnect from the server */
|
|
148
|
+
disconnect(): Promise<void>;
|
|
149
|
+
/** Check if connected */
|
|
150
|
+
isConnected(): boolean;
|
|
151
|
+
/** Get server capabilities */
|
|
152
|
+
getCapabilities(): MCPCapabilities;
|
|
153
|
+
/** List available tools */
|
|
154
|
+
listTools(): Promise<MCPTool[]>;
|
|
155
|
+
/** Call a tool */
|
|
156
|
+
callTool(name: string, args: Record<string, unknown>): Promise<MCPToolResult>;
|
|
157
|
+
/** List available resources */
|
|
158
|
+
listResources(): Promise<MCPResource[]>;
|
|
159
|
+
/** Read a resource */
|
|
160
|
+
readResource(uri: string): Promise<MCPResourceResult>;
|
|
161
|
+
/** Subscribe to resource changes */
|
|
162
|
+
subscribeResource?(uri: string, callback: (resource: MCPResource) => void): () => void;
|
|
163
|
+
/** List available prompts */
|
|
164
|
+
listPrompts(): Promise<MCPPrompt[]>;
|
|
165
|
+
/** Get a prompt with arguments */
|
|
166
|
+
getPrompt(name: string, args?: Record<string, string>): Promise<MCPPromptResult>;
|
|
167
|
+
}
|
|
168
|
+
/** Constraint configuration for an MCP tool */
|
|
169
|
+
interface MCPToolConstraint {
|
|
170
|
+
/** Require human approval before calling */
|
|
171
|
+
requireApproval?: boolean;
|
|
172
|
+
/** Maximum argument size (bytes) */
|
|
173
|
+
maxArgSize?: number;
|
|
174
|
+
/** Constraint that must be true to allow the tool */
|
|
175
|
+
when?: (facts: Record<string, unknown>, args: Record<string, unknown>) => boolean | Promise<boolean>;
|
|
176
|
+
/** Requirement to emit when constraint is violated */
|
|
177
|
+
require?: {
|
|
178
|
+
type: string;
|
|
179
|
+
[key: string]: unknown;
|
|
180
|
+
};
|
|
181
|
+
/** Rate limit (calls per minute) */
|
|
182
|
+
rateLimit?: number;
|
|
183
|
+
/** Timeout for tool execution (ms) */
|
|
184
|
+
timeout?: number;
|
|
185
|
+
}
|
|
186
|
+
/** Mapping of MCP resources to Directive facts */
|
|
187
|
+
interface MCPResourceMapping {
|
|
188
|
+
/** Resource URI pattern (glob or regex) */
|
|
189
|
+
pattern: string | RegExp;
|
|
190
|
+
/** Fact key to sync to */
|
|
191
|
+
factKey: string;
|
|
192
|
+
/** Transform resource content before setting fact */
|
|
193
|
+
transform?: (content: string) => unknown;
|
|
194
|
+
/** Sync mode */
|
|
195
|
+
mode: "poll" | "subscribe" | "manual";
|
|
196
|
+
/** Poll interval (ms) for 'poll' mode */
|
|
197
|
+
pollInterval?: number;
|
|
198
|
+
}
|
|
199
|
+
/** MCP Approval request */
|
|
200
|
+
interface MCPApprovalRequest {
|
|
201
|
+
id: string;
|
|
202
|
+
server: string;
|
|
203
|
+
tool: string;
|
|
204
|
+
args: Record<string, unknown>;
|
|
205
|
+
requestedAt: number;
|
|
206
|
+
}
|
|
207
|
+
/** MCP Adapter events */
|
|
208
|
+
interface MCPAdapterEvents {
|
|
209
|
+
/** Server connected */
|
|
210
|
+
onConnect?: (server: string) => void;
|
|
211
|
+
/** Server disconnected */
|
|
212
|
+
onDisconnect?: (server: string, reason?: string) => void;
|
|
213
|
+
/** Tool called */
|
|
214
|
+
onToolCall?: (server: string, tool: string, args: Record<string, unknown>) => void;
|
|
215
|
+
/** Tool result received */
|
|
216
|
+
onToolResult?: (server: string, tool: string, result: MCPToolResult) => void;
|
|
217
|
+
/** Resource updated */
|
|
218
|
+
onResourceUpdate?: (server: string, uri: string, content: MCPResourceResult) => void;
|
|
219
|
+
/** Error occurred */
|
|
220
|
+
onError?: (server: string, error: Error) => void;
|
|
221
|
+
/** Approval required for tool call */
|
|
222
|
+
onApprovalRequest?: (request: MCPApprovalRequest) => void;
|
|
223
|
+
/** Approval resolved */
|
|
224
|
+
onApprovalResolved?: (requestId: string, approved: boolean) => void;
|
|
225
|
+
}
|
|
226
|
+
/** MCP Adapter configuration */
|
|
227
|
+
interface MCPAdapterConfig {
|
|
228
|
+
/** MCP servers to connect to */
|
|
229
|
+
servers: MCPServerConfig[];
|
|
230
|
+
/** Tool-specific constraints */
|
|
231
|
+
toolConstraints?: Record<string, MCPToolConstraint>;
|
|
232
|
+
/** Resource to fact mappings */
|
|
233
|
+
resourceMappings?: MCPResourceMapping[];
|
|
234
|
+
/** Event handlers */
|
|
235
|
+
events?: MCPAdapterEvents;
|
|
236
|
+
/** Auto-connect on adapter creation */
|
|
237
|
+
autoConnect?: boolean;
|
|
238
|
+
/** Reconnect on disconnect */
|
|
239
|
+
autoReconnect?: boolean;
|
|
240
|
+
/** Custom MCP client factory (for testing or custom implementations) */
|
|
241
|
+
clientFactory?: (config: MCPServerConfig) => MCPClient;
|
|
242
|
+
/** Enable debug logging for stub client (default: false) */
|
|
243
|
+
debug?: boolean;
|
|
244
|
+
/** Approval timeout in milliseconds (default: 300000 = 5 minutes) */
|
|
245
|
+
approvalTimeoutMs?: number;
|
|
246
|
+
/** Allow callToolDirect() which bypasses all constraints (default: false) */
|
|
247
|
+
allowDirectCalls?: boolean;
|
|
248
|
+
}
|
|
249
|
+
/** Requirement to call an MCP tool */
|
|
250
|
+
interface MCPCallToolRequirement {
|
|
251
|
+
type: "MCP_CALL_TOOL";
|
|
252
|
+
server: string;
|
|
253
|
+
tool: string;
|
|
254
|
+
args: Record<string, unknown>;
|
|
255
|
+
[key: string]: unknown;
|
|
256
|
+
}
|
|
257
|
+
/** Requirement to read an MCP resource */
|
|
258
|
+
interface MCPReadResourceRequirement {
|
|
259
|
+
type: "MCP_READ_RESOURCE";
|
|
260
|
+
server: string;
|
|
261
|
+
uri: string;
|
|
262
|
+
[key: string]: unknown;
|
|
263
|
+
}
|
|
264
|
+
/** Requirement to get an MCP prompt */
|
|
265
|
+
interface MCPGetPromptRequirement {
|
|
266
|
+
type: "MCP_GET_PROMPT";
|
|
267
|
+
server: string;
|
|
268
|
+
prompt: string;
|
|
269
|
+
args?: Record<string, string>;
|
|
270
|
+
[key: string]: unknown;
|
|
271
|
+
}
|
|
272
|
+
/** Requirement to sync MCP resources */
|
|
273
|
+
interface MCPSyncResourcesRequirement {
|
|
274
|
+
type: "MCP_SYNC_RESOURCES";
|
|
275
|
+
server?: string;
|
|
276
|
+
pattern?: string | RegExp;
|
|
277
|
+
[key: string]: unknown;
|
|
278
|
+
}
|
|
279
|
+
/** Union of all MCP requirements */
|
|
280
|
+
type MCPRequirement = MCPCallToolRequirement | MCPReadResourceRequirement | MCPGetPromptRequirement | MCPSyncResourcesRequirement;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* MCP Adapter - Model Context Protocol Integration for Directive
|
|
284
|
+
*
|
|
285
|
+
* Provides seamless integration between Directive's constraint system and MCP servers:
|
|
286
|
+
* - MCP tools become Directive resolvers with constraint-driven access control
|
|
287
|
+
* - MCP resources sync to Directive facts
|
|
288
|
+
* - MCP prompts available through requirements
|
|
289
|
+
*
|
|
290
|
+
* @example
|
|
291
|
+
* ```typescript
|
|
292
|
+
* import { createMCPAdapter } from '@directive-run/ai';
|
|
293
|
+
*
|
|
294
|
+
* const mcpAdapter = createMCPAdapter({
|
|
295
|
+
* servers: [
|
|
296
|
+
* { name: 'filesystem', transport: 'stdio', command: 'mcp-server-filesystem' },
|
|
297
|
+
* { name: 'github', transport: 'sse', url: 'https://mcp.github.com' }
|
|
298
|
+
* ],
|
|
299
|
+
* toolConstraints: {
|
|
300
|
+
* 'filesystem.write': { requireApproval: true },
|
|
301
|
+
* 'github.create_pr': { when: (facts) => facts.reviewComplete }
|
|
302
|
+
* }
|
|
303
|
+
* });
|
|
304
|
+
*
|
|
305
|
+
* const system = createSystem({
|
|
306
|
+
* module: myModule,
|
|
307
|
+
* plugins: [mcpAdapter.plugin]
|
|
308
|
+
* });
|
|
309
|
+
* ```
|
|
310
|
+
*/
|
|
311
|
+
|
|
312
|
+
/** State of an MCP server connection */
|
|
313
|
+
interface MCPServerState {
|
|
314
|
+
config: MCPServerConfig;
|
|
315
|
+
client: MCPClient | null;
|
|
316
|
+
tools: MCPTool[];
|
|
317
|
+
resources: MCPResource[];
|
|
318
|
+
status: "disconnected" | "connecting" | "connected" | "error";
|
|
319
|
+
error?: Error;
|
|
320
|
+
lastSync?: number;
|
|
321
|
+
}
|
|
322
|
+
/** MCP Adapter instance */
|
|
323
|
+
interface MCPAdapter {
|
|
324
|
+
/** Plugin to add to Directive system */
|
|
325
|
+
plugin: Plugin;
|
|
326
|
+
/** Connect to all configured servers */
|
|
327
|
+
connect(): Promise<void>;
|
|
328
|
+
/** Connect to a specific server */
|
|
329
|
+
connectServer(name: string): Promise<void>;
|
|
330
|
+
/** Disconnect from all servers */
|
|
331
|
+
disconnect(): Promise<void>;
|
|
332
|
+
/** Disconnect from a specific server */
|
|
333
|
+
disconnectServer(name: string): Promise<void>;
|
|
334
|
+
/** Get all available tools across all servers */
|
|
335
|
+
getTools(): Map<string, MCPTool[]>;
|
|
336
|
+
/** Get all available resources across all servers */
|
|
337
|
+
getResources(): Map<string, MCPResource[]>;
|
|
338
|
+
/**
|
|
339
|
+
* Call a tool with constraint checking (recommended).
|
|
340
|
+
* Applies rate limits, argument size limits, approval workflow, and custom constraints.
|
|
341
|
+
* @param server - Server name
|
|
342
|
+
* @param tool - Tool name
|
|
343
|
+
* @param args - Tool arguments
|
|
344
|
+
* @param facts - Current facts for constraint evaluation
|
|
345
|
+
*/
|
|
346
|
+
callTool(server: string, tool: string, args: Record<string, unknown>, facts: Record<string, unknown>): Promise<MCPToolResult>;
|
|
347
|
+
/**
|
|
348
|
+
* Call a tool directly, bypassing all constraints (rate limits, approvals, etc.).
|
|
349
|
+
* Use only for trusted internal calls where constraint checking is not needed.
|
|
350
|
+
*/
|
|
351
|
+
callToolDirect(server: string, tool: string, args: Record<string, unknown>): Promise<MCPToolResult>;
|
|
352
|
+
/** Read a resource directly */
|
|
353
|
+
readResource(server: string, uri: string): Promise<MCPResourceResult>;
|
|
354
|
+
/** Sync resources to facts */
|
|
355
|
+
syncResources(facts: Record<string, unknown>): Promise<void>;
|
|
356
|
+
/** Get server status */
|
|
357
|
+
getServerStatus(name: string): MCPServerState | undefined;
|
|
358
|
+
/** Get all server statuses */
|
|
359
|
+
getAllServerStatuses(): Map<string, MCPServerState>;
|
|
360
|
+
/** Approve a pending tool call request */
|
|
361
|
+
approve(requestId: string): void;
|
|
362
|
+
/** Reject a pending tool call request */
|
|
363
|
+
reject(requestId: string, reason?: string): void;
|
|
364
|
+
/** Get pending approval requests */
|
|
365
|
+
getPendingApprovals(): MCPApprovalRequest[];
|
|
366
|
+
/** Get the rejection reason for a request (if available) */
|
|
367
|
+
getRejectionReason(requestId: string): string | undefined;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Create an MCP adapter for Directive integration.
|
|
371
|
+
*
|
|
372
|
+
* @example
|
|
373
|
+
* ```typescript
|
|
374
|
+
* const adapter = createMCPAdapter({
|
|
375
|
+
* servers: [
|
|
376
|
+
* { name: 'fs', transport: 'stdio', command: 'mcp-server-filesystem' },
|
|
377
|
+
* ],
|
|
378
|
+
* toolConstraints: {
|
|
379
|
+
* 'fs.write_file': {
|
|
380
|
+
* requireApproval: true,
|
|
381
|
+
* maxArgSize: 10000,
|
|
382
|
+
* timeout: 30000,
|
|
383
|
+
* },
|
|
384
|
+
* },
|
|
385
|
+
* resourceMappings: [
|
|
386
|
+
* {
|
|
387
|
+
* pattern: 'file://*.json',
|
|
388
|
+
* factKey: 'jsonFiles',
|
|
389
|
+
* mode: 'poll',
|
|
390
|
+
* pollInterval: 5000,
|
|
391
|
+
* },
|
|
392
|
+
* ],
|
|
393
|
+
* });
|
|
394
|
+
*
|
|
395
|
+
* // Add to system
|
|
396
|
+
* const system = createSystem({
|
|
397
|
+
* module: myModule,
|
|
398
|
+
* plugins: [adapter.plugin],
|
|
399
|
+
* });
|
|
400
|
+
*
|
|
401
|
+
* // Connect to servers
|
|
402
|
+
* await adapter.connect();
|
|
403
|
+
* ```
|
|
404
|
+
*/
|
|
405
|
+
declare function createMCPAdapter(config: MCPAdapterConfig): MCPAdapter;
|
|
406
|
+
/**
|
|
407
|
+
* Convert MCP tools to a format suitable for LLM tool calling.
|
|
408
|
+
*
|
|
409
|
+
* @example
|
|
410
|
+
* ```typescript
|
|
411
|
+
* const adapter = createMCPAdapter({ servers: [...] });
|
|
412
|
+
* await adapter.connect();
|
|
413
|
+
*
|
|
414
|
+
* const tools = adapter.getTools();
|
|
415
|
+
* const llmTools = convertToolsForLLM(tools);
|
|
416
|
+
* // Use with OpenAI/Anthropic/etc.
|
|
417
|
+
* ```
|
|
418
|
+
*/
|
|
419
|
+
declare function convertToolsForLLM(tools: Map<string, MCPTool[]>): Array<{
|
|
420
|
+
type: "function";
|
|
421
|
+
function: {
|
|
422
|
+
name: string;
|
|
423
|
+
description: string;
|
|
424
|
+
parameters: Record<string, unknown>;
|
|
425
|
+
};
|
|
426
|
+
}>;
|
|
427
|
+
/**
|
|
428
|
+
* Create a requirement to call an MCP tool.
|
|
429
|
+
*
|
|
430
|
+
* @example
|
|
431
|
+
* ```typescript
|
|
432
|
+
* const req = mcpCallTool('filesystem', 'read_file', { path: '/etc/hosts' });
|
|
433
|
+
* // { type: 'MCP_CALL_TOOL', server: 'filesystem', tool: 'read_file', args: { path: '/etc/hosts' } }
|
|
434
|
+
* ```
|
|
435
|
+
*/
|
|
436
|
+
declare function mcpCallTool(server: string, tool: string, args: Record<string, unknown>): MCPCallToolRequirement;
|
|
437
|
+
/**
|
|
438
|
+
* Create a requirement to read an MCP resource.
|
|
439
|
+
*/
|
|
440
|
+
declare function mcpReadResource(server: string, uri: string): MCPReadResourceRequirement;
|
|
441
|
+
/**
|
|
442
|
+
* Create a requirement to get an MCP prompt.
|
|
443
|
+
*/
|
|
444
|
+
declare function mcpGetPrompt(server: string, prompt: string, args?: Record<string, string>): MCPGetPromptRequirement;
|
|
445
|
+
/**
|
|
446
|
+
* Create a requirement to sync MCP resources.
|
|
447
|
+
*/
|
|
448
|
+
declare function mcpSyncResources(server?: string, pattern?: string | RegExp): MCPSyncResourcesRequirement;
|
|
449
|
+
|
|
450
|
+
export { type MCPAdapter, type MCPAdapterConfig, type MCPApprovalRequest, type MCPCallToolRequirement, type MCPGetPromptRequirement, type MCPReadResourceRequirement, type MCPRequirement, type MCPResource, type MCPServerConfig, type MCPSyncResourcesRequirement, type MCPTool, type MCPToolConstraint, type MCPToolResult, convertToolsForLLM, createMCPAdapter, mcpCallTool, mcpGetPrompt, mcpReadResource, mcpSyncResources };
|
package/dist/mcp.js
ADDED
package/dist/mcp.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"mcp.js"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export{N as Semaphore,ia as aggregateTokens,_ as allReadyStrategy,la as capabilityRoute,ha as collectOutputs,ja as composePatterns,fa as concatResults,aa as costEfficientStrategy,ra as createMultiAgentOrchestrator,W as dag,na as debate,pa as derivedConstraint,Q as diffCheckpoints,ka as findAgentsByCapability,R as forkFromCheckpoint,P as getCheckpointProgress,O as getPatternStep,Z as goal,$ as highestImpactStrategy,T as parallel,ca as patternFromJSON,ba as patternToJSON,ga as pickBestResult,Y as race,X as reflect,ea as runAgentRequirement,oa as runDebate,da as selectAgent,U as sequential,M as shallowEqual,ma as spawnOnCondition,qa as spawnPool,V as supervisor,S as validateDagAcyclic}from'./chunk-LXUMJKGJ.js';import'./chunk-UR5BMWEN.js';import'./chunk-FBT73WFY.js';import'./chunk-UR4ZGO7V.js';//# sourceMappingURL=multi-agent-orchestrator-QWWQKKGX.js.map
|
|
2
|
+
//# sourceMappingURL=multi-agent-orchestrator-QWWQKKGX.js.map
|
package/dist/{multi-agent-orchestrator-4PXNYRHB.js.map → multi-agent-orchestrator-QWWQKKGX.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"multi-agent-orchestrator-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"multi-agent-orchestrator-QWWQKKGX.js"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkA22KLB23_cjs=require('./chunk-A22KLB23.cjs');require('./chunk-K64WKZ22.cjs'),require('./chunk-WOFIBIPW.cjs'),require('./chunk-FFRWQNK7.cjs');Object.defineProperty(exports,"Semaphore",{enumerable:true,get:function(){return chunkA22KLB23_cjs.N}});Object.defineProperty(exports,"aggregateTokens",{enumerable:true,get:function(){return chunkA22KLB23_cjs.ia}});Object.defineProperty(exports,"allReadyStrategy",{enumerable:true,get:function(){return chunkA22KLB23_cjs._}});Object.defineProperty(exports,"capabilityRoute",{enumerable:true,get:function(){return chunkA22KLB23_cjs.la}});Object.defineProperty(exports,"collectOutputs",{enumerable:true,get:function(){return chunkA22KLB23_cjs.ha}});Object.defineProperty(exports,"composePatterns",{enumerable:true,get:function(){return chunkA22KLB23_cjs.ja}});Object.defineProperty(exports,"concatResults",{enumerable:true,get:function(){return chunkA22KLB23_cjs.fa}});Object.defineProperty(exports,"costEfficientStrategy",{enumerable:true,get:function(){return chunkA22KLB23_cjs.aa}});Object.defineProperty(exports,"createMultiAgentOrchestrator",{enumerable:true,get:function(){return chunkA22KLB23_cjs.ra}});Object.defineProperty(exports,"dag",{enumerable:true,get:function(){return chunkA22KLB23_cjs.W}});Object.defineProperty(exports,"debate",{enumerable:true,get:function(){return chunkA22KLB23_cjs.na}});Object.defineProperty(exports,"derivedConstraint",{enumerable:true,get:function(){return chunkA22KLB23_cjs.pa}});Object.defineProperty(exports,"diffCheckpoints",{enumerable:true,get:function(){return chunkA22KLB23_cjs.Q}});Object.defineProperty(exports,"findAgentsByCapability",{enumerable:true,get:function(){return chunkA22KLB23_cjs.ka}});Object.defineProperty(exports,"forkFromCheckpoint",{enumerable:true,get:function(){return chunkA22KLB23_cjs.R}});Object.defineProperty(exports,"getCheckpointProgress",{enumerable:true,get:function(){return chunkA22KLB23_cjs.P}});Object.defineProperty(exports,"getPatternStep",{enumerable:true,get:function(){return chunkA22KLB23_cjs.O}});Object.defineProperty(exports,"goal",{enumerable:true,get:function(){return chunkA22KLB23_cjs.Z}});Object.defineProperty(exports,"highestImpactStrategy",{enumerable:true,get:function(){return chunkA22KLB23_cjs.$}});Object.defineProperty(exports,"parallel",{enumerable:true,get:function(){return chunkA22KLB23_cjs.T}});Object.defineProperty(exports,"patternFromJSON",{enumerable:true,get:function(){return chunkA22KLB23_cjs.ca}});Object.defineProperty(exports,"patternToJSON",{enumerable:true,get:function(){return chunkA22KLB23_cjs.ba}});Object.defineProperty(exports,"pickBestResult",{enumerable:true,get:function(){return chunkA22KLB23_cjs.ga}});Object.defineProperty(exports,"race",{enumerable:true,get:function(){return chunkA22KLB23_cjs.Y}});Object.defineProperty(exports,"reflect",{enumerable:true,get:function(){return chunkA22KLB23_cjs.X}});Object.defineProperty(exports,"runAgentRequirement",{enumerable:true,get:function(){return chunkA22KLB23_cjs.ea}});Object.defineProperty(exports,"runDebate",{enumerable:true,get:function(){return chunkA22KLB23_cjs.oa}});Object.defineProperty(exports,"selectAgent",{enumerable:true,get:function(){return chunkA22KLB23_cjs.da}});Object.defineProperty(exports,"sequential",{enumerable:true,get:function(){return chunkA22KLB23_cjs.U}});Object.defineProperty(exports,"shallowEqual",{enumerable:true,get:function(){return chunkA22KLB23_cjs.M}});Object.defineProperty(exports,"spawnOnCondition",{enumerable:true,get:function(){return chunkA22KLB23_cjs.ma}});Object.defineProperty(exports,"spawnPool",{enumerable:true,get:function(){return chunkA22KLB23_cjs.qa}});Object.defineProperty(exports,"supervisor",{enumerable:true,get:function(){return chunkA22KLB23_cjs.V}});Object.defineProperty(exports,"validateDagAcyclic",{enumerable:true,get:function(){return chunkA22KLB23_cjs.S}});//# sourceMappingURL=multi-agent-orchestrator-Y5U4JCFO.cjs.map
|
|
2
|
+
//# sourceMappingURL=multi-agent-orchestrator-Y5U4JCFO.cjs.map
|
package/dist/{multi-agent-orchestrator-KFGTEGE5.cjs.map → multi-agent-orchestrator-Y5U4JCFO.cjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"multi-agent-orchestrator-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"multi-agent-orchestrator-Y5U4JCFO.cjs"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkFABDFT74_cjs=require('./chunk-FABDFT74.cjs'),chunkA22KLB23_cjs=require('./chunk-A22KLB23.cjs');require('./chunk-K64WKZ22.cjs'),require('./chunk-WOFIBIPW.cjs'),require('./chunk-FFRWQNK7.cjs');Object.defineProperty(exports,"createAgentNetwork",{enumerable:true,get:function(){return chunkFABDFT74_cjs.c}});Object.defineProperty(exports,"createDelegator",{enumerable:true,get:function(){return chunkFABDFT74_cjs.e}});Object.defineProperty(exports,"createMessageBus",{enumerable:true,get:function(){return chunkFABDFT74_cjs.b}});Object.defineProperty(exports,"createPubSub",{enumerable:true,get:function(){return chunkFABDFT74_cjs.f}});Object.defineProperty(exports,"createResponder",{enumerable:true,get:function(){return chunkFABDFT74_cjs.d}});Object.defineProperty(exports,"explainGoal",{enumerable:true,get:function(){return chunkFABDFT74_cjs.j}});Object.defineProperty(exports,"getDependencyGraph",{enumerable:true,get:function(){return chunkFABDFT74_cjs.g}});Object.defineProperty(exports,"patternToMermaid",{enumerable:true,get:function(){return chunkFABDFT74_cjs.a}});Object.defineProperty(exports,"planGoal",{enumerable:true,get:function(){return chunkFABDFT74_cjs.i}});Object.defineProperty(exports,"validateGoal",{enumerable:true,get:function(){return chunkFABDFT74_cjs.h}});Object.defineProperty(exports,"InMemoryCheckpointStore",{enumerable:true,get:function(){return chunkA22KLB23_cjs.y}});Object.defineProperty(exports,"MAX_BREAKPOINT_HISTORY",{enumerable:true,get:function(){return chunkA22KLB23_cjs.s}});Object.defineProperty(exports,"ReflectionExhaustedError",{enumerable:true,get:function(){return chunkA22KLB23_cjs.K}});Object.defineProperty(exports,"Semaphore",{enumerable:true,get:function(){return chunkA22KLB23_cjs.N}});Object.defineProperty(exports,"aggregateTokens",{enumerable:true,get:function(){return chunkA22KLB23_cjs.ia}});Object.defineProperty(exports,"allReadyStrategy",{enumerable:true,get:function(){return chunkA22KLB23_cjs._}});Object.defineProperty(exports,"capabilityRoute",{enumerable:true,get:function(){return chunkA22KLB23_cjs.la}});Object.defineProperty(exports,"collectOutputs",{enumerable:true,get:function(){return chunkA22KLB23_cjs.ha}});Object.defineProperty(exports,"composePatterns",{enumerable:true,get:function(){return chunkA22KLB23_cjs.ja}});Object.defineProperty(exports,"concatResults",{enumerable:true,get:function(){return chunkA22KLB23_cjs.fa}});Object.defineProperty(exports,"costEfficientStrategy",{enumerable:true,get:function(){return chunkA22KLB23_cjs.aa}});Object.defineProperty(exports,"createBreakpointId",{enumerable:true,get:function(){return chunkA22KLB23_cjs.t}});Object.defineProperty(exports,"createCheckpointId",{enumerable:true,get:function(){return chunkA22KLB23_cjs.w}});Object.defineProperty(exports,"createInitialBreakpointState",{enumerable:true,get:function(){return chunkA22KLB23_cjs.v}});Object.defineProperty(exports,"createMultiAgentOrchestrator",{enumerable:true,get:function(){return chunkA22KLB23_cjs.ra}});Object.defineProperty(exports,"dag",{enumerable:true,get:function(){return chunkA22KLB23_cjs.W}});Object.defineProperty(exports,"debate",{enumerable:true,get:function(){return chunkA22KLB23_cjs.na}});Object.defineProperty(exports,"derivedConstraint",{enumerable:true,get:function(){return chunkA22KLB23_cjs.pa}});Object.defineProperty(exports,"diffCheckpoints",{enumerable:true,get:function(){return chunkA22KLB23_cjs.Q}});Object.defineProperty(exports,"findAgentsByCapability",{enumerable:true,get:function(){return chunkA22KLB23_cjs.ka}});Object.defineProperty(exports,"forkFromCheckpoint",{enumerable:true,get:function(){return chunkA22KLB23_cjs.R}});Object.defineProperty(exports,"getCheckpointProgress",{enumerable:true,get:function(){return chunkA22KLB23_cjs.P}});Object.defineProperty(exports,"getPatternStep",{enumerable:true,get:function(){return chunkA22KLB23_cjs.O}});Object.defineProperty(exports,"goal",{enumerable:true,get:function(){return chunkA22KLB23_cjs.Z}});Object.defineProperty(exports,"highestImpactStrategy",{enumerable:true,get:function(){return chunkA22KLB23_cjs.$}});Object.defineProperty(exports,"matchBreakpoint",{enumerable:true,get:function(){return chunkA22KLB23_cjs.u}});Object.defineProperty(exports,"parallel",{enumerable:true,get:function(){return chunkA22KLB23_cjs.T}});Object.defineProperty(exports,"patternFromJSON",{enumerable:true,get:function(){return chunkA22KLB23_cjs.ca}});Object.defineProperty(exports,"patternToJSON",{enumerable:true,get:function(){return chunkA22KLB23_cjs.ba}});Object.defineProperty(exports,"pickBestResult",{enumerable:true,get:function(){return chunkA22KLB23_cjs.ga}});Object.defineProperty(exports,"race",{enumerable:true,get:function(){return chunkA22KLB23_cjs.Y}});Object.defineProperty(exports,"reflect",{enumerable:true,get:function(){return chunkA22KLB23_cjs.X}});Object.defineProperty(exports,"runAgentRequirement",{enumerable:true,get:function(){return chunkA22KLB23_cjs.ea}});Object.defineProperty(exports,"runDebate",{enumerable:true,get:function(){return chunkA22KLB23_cjs.oa}});Object.defineProperty(exports,"selectAgent",{enumerable:true,get:function(){return chunkA22KLB23_cjs.da}});Object.defineProperty(exports,"sequential",{enumerable:true,get:function(){return chunkA22KLB23_cjs.U}});Object.defineProperty(exports,"spawnOnCondition",{enumerable:true,get:function(){return chunkA22KLB23_cjs.ma}});Object.defineProperty(exports,"spawnPool",{enumerable:true,get:function(){return chunkA22KLB23_cjs.qa}});Object.defineProperty(exports,"supervisor",{enumerable:true,get:function(){return chunkA22KLB23_cjs.V}});Object.defineProperty(exports,"validateCheckpoint",{enumerable:true,get:function(){return chunkA22KLB23_cjs.x}});Object.defineProperty(exports,"withReflection",{enumerable:true,get:function(){return chunkA22KLB23_cjs.L}});//# sourceMappingURL=multi-agent.cjs.map
|
|
2
|
+
//# sourceMappingURL=multi-agent.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"multi-agent.cjs"}
|