@open-multi-agent/core 1.4.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/LICENSE +21 -0
- package/README.md +373 -0
- package/dist/agent/agent.d.ts +153 -0
- package/dist/agent/agent.d.ts.map +1 -0
- package/dist/agent/agent.js +559 -0
- package/dist/agent/agent.js.map +1 -0
- package/dist/agent/loop-detector.d.ts +39 -0
- package/dist/agent/loop-detector.d.ts.map +1 -0
- package/dist/agent/loop-detector.js +122 -0
- package/dist/agent/loop-detector.js.map +1 -0
- package/dist/agent/pool.d.ts +158 -0
- package/dist/agent/pool.d.ts.map +1 -0
- package/dist/agent/pool.js +320 -0
- package/dist/agent/pool.js.map +1 -0
- package/dist/agent/runner.d.ts +242 -0
- package/dist/agent/runner.d.ts.map +1 -0
- package/dist/agent/runner.js +943 -0
- package/dist/agent/runner.js.map +1 -0
- package/dist/agent/structured-output.d.ts +33 -0
- package/dist/agent/structured-output.d.ts.map +1 -0
- package/dist/agent/structured-output.js +116 -0
- package/dist/agent/structured-output.js.map +1 -0
- package/dist/cli/oma.d.ts +30 -0
- package/dist/cli/oma.d.ts.map +1 -0
- package/dist/cli/oma.js +433 -0
- package/dist/cli/oma.js.map +1 -0
- package/dist/dashboard/layout-tasks.d.ts +23 -0
- package/dist/dashboard/layout-tasks.d.ts.map +1 -0
- package/dist/dashboard/layout-tasks.js +79 -0
- package/dist/dashboard/layout-tasks.js.map +1 -0
- package/dist/dashboard/render-team-run-dashboard.d.ts +11 -0
- package/dist/dashboard/render-team-run-dashboard.d.ts.map +1 -0
- package/dist/dashboard/render-team-run-dashboard.js +456 -0
- package/dist/dashboard/render-team-run-dashboard.js.map +1 -0
- package/dist/errors.d.ts +14 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +20 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +79 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +92 -0
- package/dist/index.js.map +1 -0
- package/dist/llm/adapter.d.ts +54 -0
- package/dist/llm/adapter.d.ts.map +1 -0
- package/dist/llm/adapter.js +101 -0
- package/dist/llm/adapter.js.map +1 -0
- package/dist/llm/anthropic.d.ts +57 -0
- package/dist/llm/anthropic.d.ts.map +1 -0
- package/dist/llm/anthropic.js +432 -0
- package/dist/llm/anthropic.js.map +1 -0
- package/dist/llm/azure-openai.d.ts +74 -0
- package/dist/llm/azure-openai.d.ts.map +1 -0
- package/dist/llm/azure-openai.js +267 -0
- package/dist/llm/azure-openai.js.map +1 -0
- package/dist/llm/bedrock.d.ts +41 -0
- package/dist/llm/bedrock.d.ts.map +1 -0
- package/dist/llm/bedrock.js +345 -0
- package/dist/llm/bedrock.js.map +1 -0
- package/dist/llm/copilot.d.ts +92 -0
- package/dist/llm/copilot.d.ts.map +1 -0
- package/dist/llm/copilot.js +433 -0
- package/dist/llm/copilot.js.map +1 -0
- package/dist/llm/deepseek.d.ts +21 -0
- package/dist/llm/deepseek.d.ts.map +1 -0
- package/dist/llm/deepseek.js +24 -0
- package/dist/llm/deepseek.js.map +1 -0
- package/dist/llm/gemini.d.ts +65 -0
- package/dist/llm/gemini.d.ts.map +1 -0
- package/dist/llm/gemini.js +427 -0
- package/dist/llm/gemini.js.map +1 -0
- package/dist/llm/grok.d.ts +21 -0
- package/dist/llm/grok.d.ts.map +1 -0
- package/dist/llm/grok.js +24 -0
- package/dist/llm/grok.js.map +1 -0
- package/dist/llm/minimax.d.ts +21 -0
- package/dist/llm/minimax.d.ts.map +1 -0
- package/dist/llm/minimax.js +24 -0
- package/dist/llm/minimax.js.map +1 -0
- package/dist/llm/openai-common.d.ts +65 -0
- package/dist/llm/openai-common.d.ts.map +1 -0
- package/dist/llm/openai-common.js +286 -0
- package/dist/llm/openai-common.js.map +1 -0
- package/dist/llm/openai.d.ts +63 -0
- package/dist/llm/openai.d.ts.map +1 -0
- package/dist/llm/openai.js +256 -0
- package/dist/llm/openai.js.map +1 -0
- package/dist/llm/qiniu.d.ts +21 -0
- package/dist/llm/qiniu.d.ts.map +1 -0
- package/dist/llm/qiniu.js +24 -0
- package/dist/llm/qiniu.js.map +1 -0
- package/dist/mcp.d.ts +3 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +2 -0
- package/dist/mcp.js.map +1 -0
- package/dist/memory/shared.d.ts +162 -0
- package/dist/memory/shared.d.ts.map +1 -0
- package/dist/memory/shared.js +294 -0
- package/dist/memory/shared.js.map +1 -0
- package/dist/memory/store.d.ts +72 -0
- package/dist/memory/store.d.ts.map +1 -0
- package/dist/memory/store.js +121 -0
- package/dist/memory/store.js.map +1 -0
- package/dist/orchestrator/orchestrator.d.ts +245 -0
- package/dist/orchestrator/orchestrator.d.ts.map +1 -0
- package/dist/orchestrator/orchestrator.js +1400 -0
- package/dist/orchestrator/orchestrator.js.map +1 -0
- package/dist/orchestrator/scheduler.d.ts +112 -0
- package/dist/orchestrator/scheduler.d.ts.map +1 -0
- package/dist/orchestrator/scheduler.js +256 -0
- package/dist/orchestrator/scheduler.js.map +1 -0
- package/dist/task/queue.d.ts +191 -0
- package/dist/task/queue.d.ts.map +1 -0
- package/dist/task/queue.js +408 -0
- package/dist/task/queue.js.map +1 -0
- package/dist/task/task.d.ts +90 -0
- package/dist/task/task.d.ts.map +1 -0
- package/dist/task/task.js +206 -0
- package/dist/task/task.js.map +1 -0
- package/dist/team/messaging.d.ts +106 -0
- package/dist/team/messaging.d.ts.map +1 -0
- package/dist/team/messaging.js +183 -0
- package/dist/team/messaging.js.map +1 -0
- package/dist/team/team.d.ts +141 -0
- package/dist/team/team.d.ts.map +1 -0
- package/dist/team/team.js +293 -0
- package/dist/team/team.js.map +1 -0
- package/dist/tool/built-in/bash.d.ts +12 -0
- package/dist/tool/built-in/bash.d.ts.map +1 -0
- package/dist/tool/built-in/bash.js +133 -0
- package/dist/tool/built-in/bash.js.map +1 -0
- package/dist/tool/built-in/delegate.d.ts +29 -0
- package/dist/tool/built-in/delegate.d.ts.map +1 -0
- package/dist/tool/built-in/delegate.js +92 -0
- package/dist/tool/built-in/delegate.js.map +1 -0
- package/dist/tool/built-in/file-edit.d.ts +14 -0
- package/dist/tool/built-in/file-edit.d.ts.map +1 -0
- package/dist/tool/built-in/file-edit.js +130 -0
- package/dist/tool/built-in/file-edit.js.map +1 -0
- package/dist/tool/built-in/file-read.d.ts +12 -0
- package/dist/tool/built-in/file-read.d.ts.map +1 -0
- package/dist/tool/built-in/file-read.js +82 -0
- package/dist/tool/built-in/file-read.js.map +1 -0
- package/dist/tool/built-in/file-write.d.ts +11 -0
- package/dist/tool/built-in/file-write.d.ts.map +1 -0
- package/dist/tool/built-in/file-write.js +70 -0
- package/dist/tool/built-in/file-write.js.map +1 -0
- package/dist/tool/built-in/fs-walk.d.ts +23 -0
- package/dist/tool/built-in/fs-walk.d.ts.map +1 -0
- package/dist/tool/built-in/fs-walk.js +78 -0
- package/dist/tool/built-in/fs-walk.js.map +1 -0
- package/dist/tool/built-in/glob.d.ts +12 -0
- package/dist/tool/built-in/glob.d.ts.map +1 -0
- package/dist/tool/built-in/glob.js +82 -0
- package/dist/tool/built-in/glob.js.map +1 -0
- package/dist/tool/built-in/grep.d.ts +15 -0
- package/dist/tool/built-in/grep.d.ts.map +1 -0
- package/dist/tool/built-in/grep.js +218 -0
- package/dist/tool/built-in/grep.js.map +1 -0
- package/dist/tool/built-in/index.d.ts +48 -0
- package/dist/tool/built-in/index.d.ts.map +1 -0
- package/dist/tool/built-in/index.js +56 -0
- package/dist/tool/built-in/index.js.map +1 -0
- package/dist/tool/executor.d.ts +100 -0
- package/dist/tool/executor.d.ts.map +1 -0
- package/dist/tool/executor.js +184 -0
- package/dist/tool/executor.js.map +1 -0
- package/dist/tool/framework.d.ts +167 -0
- package/dist/tool/framework.d.ts.map +1 -0
- package/dist/tool/framework.js +402 -0
- package/dist/tool/framework.js.map +1 -0
- package/dist/tool/mcp.d.ts +31 -0
- package/dist/tool/mcp.d.ts.map +1 -0
- package/dist/tool/mcp.js +175 -0
- package/dist/tool/mcp.js.map +1 -0
- package/dist/tool/text-tool-extractor.d.ts +32 -0
- package/dist/tool/text-tool-extractor.d.ts.map +1 -0
- package/dist/tool/text-tool-extractor.js +195 -0
- package/dist/tool/text-tool-extractor.js.map +1 -0
- package/dist/types.d.ts +916 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/keywords.d.ts +18 -0
- package/dist/utils/keywords.d.ts.map +1 -0
- package/dist/utils/keywords.js +32 -0
- package/dist/utils/keywords.js.map +1 -0
- package/dist/utils/semaphore.d.ts +49 -0
- package/dist/utils/semaphore.d.ts.map +1 -0
- package/dist/utils/semaphore.js +89 -0
- package/dist/utils/semaphore.js.map +1 -0
- package/dist/utils/tokens.d.ts +7 -0
- package/dist/utils/tokens.d.ts.map +1 -0
- package/dist/utils/tokens.js +30 -0
- package/dist/utils/tokens.js.map +1 -0
- package/dist/utils/trace.d.ts +12 -0
- package/dist/utils/trace.d.ts.map +1 -0
- package/dist/utils/trace.js +30 -0
- package/dist/utils/trace.js.map +1 -0
- package/docs/DECISIONS.md +49 -0
- package/docs/cli.md +265 -0
- package/docs/context-management.md +24 -0
- package/docs/featured-partner.md +28 -0
- package/docs/observability.md +56 -0
- package/docs/providers.md +78 -0
- package/docs/shared-memory.md +27 -0
- package/docs/tool-configuration.md +152 -0
- package/package.json +96 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool definition framework for open-multi-agent.
|
|
3
|
+
*
|
|
4
|
+
* Provides the core primitives for declaring, registering, and converting
|
|
5
|
+
* tools to the JSON Schema format that LLM APIs expect.
|
|
6
|
+
*
|
|
7
|
+
* Types shared with the rest of the framework (`ToolDefinition`, `ToolResult`,
|
|
8
|
+
* `ToolUseContext`) are imported from `../types` to ensure a single source of
|
|
9
|
+
* truth. This file re-exports them for the convenience of downstream callers
|
|
10
|
+
* who only need to import from `tool/framework`.
|
|
11
|
+
*/
|
|
12
|
+
import { type ZodSchema } from 'zod';
|
|
13
|
+
import type { ToolDefinition, ToolResult, ToolUseContext, LLMToolDef } from '../types.js';
|
|
14
|
+
export type { ToolDefinition, ToolResult, ToolUseContext };
|
|
15
|
+
/** Minimal JSON Schema for a single property. */
|
|
16
|
+
export type JSONSchemaProperty = {
|
|
17
|
+
type: 'string';
|
|
18
|
+
description?: string;
|
|
19
|
+
enum?: string[];
|
|
20
|
+
} | {
|
|
21
|
+
type: 'number';
|
|
22
|
+
description?: string;
|
|
23
|
+
} | {
|
|
24
|
+
type: 'integer';
|
|
25
|
+
description?: string;
|
|
26
|
+
} | {
|
|
27
|
+
type: 'boolean';
|
|
28
|
+
description?: string;
|
|
29
|
+
} | {
|
|
30
|
+
type: 'null';
|
|
31
|
+
description?: string;
|
|
32
|
+
} | {
|
|
33
|
+
type: 'array';
|
|
34
|
+
items: JSONSchemaProperty;
|
|
35
|
+
description?: string;
|
|
36
|
+
} | {
|
|
37
|
+
type: 'object';
|
|
38
|
+
properties: Record<string, JSONSchemaProperty>;
|
|
39
|
+
required?: string[];
|
|
40
|
+
description?: string;
|
|
41
|
+
} | {
|
|
42
|
+
anyOf: JSONSchemaProperty[];
|
|
43
|
+
description?: string;
|
|
44
|
+
} | {
|
|
45
|
+
const: unknown;
|
|
46
|
+
description?: string;
|
|
47
|
+
} | Record<string, unknown>;
|
|
48
|
+
/**
|
|
49
|
+
* Define a typed tool. This is the single entry-point for creating tools
|
|
50
|
+
* that can be registered with a {@link ToolRegistry}.
|
|
51
|
+
*
|
|
52
|
+
* The returned object satisfies the {@link ToolDefinition} interface imported
|
|
53
|
+
* from `../types`.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const echoTool = defineTool({
|
|
58
|
+
* name: 'echo',
|
|
59
|
+
* description: 'Echo the input message back to the caller.',
|
|
60
|
+
* inputSchema: z.object({ message: z.string() }),
|
|
61
|
+
* execute: async ({ message }) => ({
|
|
62
|
+
* data: message,
|
|
63
|
+
* isError: false,
|
|
64
|
+
* }),
|
|
65
|
+
* })
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare function defineTool<TInput>(config: {
|
|
69
|
+
name: string;
|
|
70
|
+
description: string;
|
|
71
|
+
inputSchema: ZodSchema<TInput>;
|
|
72
|
+
/**
|
|
73
|
+
* Optional runtime validator for `ToolResult.data`.
|
|
74
|
+
* When omitted, output validation is skipped.
|
|
75
|
+
*
|
|
76
|
+
* `ToolResult.data` is always a `string`, so the schema is fixed to
|
|
77
|
+
* `ZodSchema<string>` — use `z.string().refine(...)` / `z.string().regex(...)`
|
|
78
|
+
* (or similar) to enforce structural constraints on the serialised output.
|
|
79
|
+
*/
|
|
80
|
+
outputSchema?: ZodSchema<string>;
|
|
81
|
+
/**
|
|
82
|
+
* Optional JSON Schema for the LLM (bypasses Zod → JSON Schema conversion).
|
|
83
|
+
*/
|
|
84
|
+
llmInputSchema?: Record<string, unknown>;
|
|
85
|
+
/**
|
|
86
|
+
* Per-tool maximum output length in characters. When set, tool output
|
|
87
|
+
* exceeding this limit is truncated (head + tail with a marker in between).
|
|
88
|
+
* Takes priority over agent-level `maxToolOutputChars`.
|
|
89
|
+
*/
|
|
90
|
+
maxOutputChars?: number;
|
|
91
|
+
execute: (input: TInput, context: ToolUseContext) => Promise<ToolResult>;
|
|
92
|
+
}): ToolDefinition<TInput>;
|
|
93
|
+
/**
|
|
94
|
+
* Registry that holds a set of named tools and can produce the JSON Schema
|
|
95
|
+
* representation expected by LLM APIs (Anthropic, OpenAI, etc.).
|
|
96
|
+
*/
|
|
97
|
+
export declare class ToolRegistry {
|
|
98
|
+
private readonly tools;
|
|
99
|
+
private readonly runtimeToolNames;
|
|
100
|
+
/**
|
|
101
|
+
* Add a tool to the registry. Throws if a tool with the same name has
|
|
102
|
+
* already been registered — prevents silent overwrites.
|
|
103
|
+
*/
|
|
104
|
+
register(tool: ToolDefinition<any>, options?: {
|
|
105
|
+
runtimeAdded?: boolean;
|
|
106
|
+
}): void;
|
|
107
|
+
/** Return a tool by name, or `undefined` if not found. */
|
|
108
|
+
get(name: string): ToolDefinition<any> | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* Return all registered tool definitions as an array.
|
|
111
|
+
*
|
|
112
|
+
* Callers that only need names can do `registry.list().map(t => t.name)`.
|
|
113
|
+
* This matches the agent's `getTools()` pattern.
|
|
114
|
+
*/
|
|
115
|
+
list(): ToolDefinition<any>[];
|
|
116
|
+
/**
|
|
117
|
+
* Return all registered tool definitions as an array.
|
|
118
|
+
* Alias for {@link list} — available for callers that prefer explicit naming.
|
|
119
|
+
*/
|
|
120
|
+
getAll(): ToolDefinition<any>[];
|
|
121
|
+
/** Return true when a tool with the given name is registered. */
|
|
122
|
+
has(name: string): boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Remove a tool by name.
|
|
125
|
+
* No-op if the tool was not registered — matches the agent's expected
|
|
126
|
+
* behaviour where `removeTool` is a graceful operation.
|
|
127
|
+
*/
|
|
128
|
+
unregister(name: string): void;
|
|
129
|
+
/** Alias for {@link unregister} — available for symmetry with `register`. */
|
|
130
|
+
deregister(name: string): void;
|
|
131
|
+
/**
|
|
132
|
+
* Convert all registered tools to the {@link LLMToolDef} format used by LLM
|
|
133
|
+
* adapters. This is the primary method called by the agent runner before
|
|
134
|
+
* each LLM API call.
|
|
135
|
+
*/
|
|
136
|
+
toToolDefs(): LLMToolDef[];
|
|
137
|
+
/**
|
|
138
|
+
* Return only tools that were added dynamically at runtime (e.g. via
|
|
139
|
+
* `agent.addTool()`), in LLM definition format.
|
|
140
|
+
*/
|
|
141
|
+
toRuntimeToolDefs(): LLMToolDef[];
|
|
142
|
+
/**
|
|
143
|
+
* Convert all registered tools to the Anthropic-style `input_schema`
|
|
144
|
+
* format. Prefer {@link toToolDefs} for normal use; this method is exposed
|
|
145
|
+
* for callers that construct their own API payloads.
|
|
146
|
+
*/
|
|
147
|
+
toLLMTools(): Array<{
|
|
148
|
+
name: string;
|
|
149
|
+
description: string;
|
|
150
|
+
/** Anthropic-style tool input JSON Schema (`type` is usually `object`). */
|
|
151
|
+
input_schema: Record<string, unknown>;
|
|
152
|
+
}>;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Convert a Zod schema to a plain JSON Schema object suitable for inclusion
|
|
156
|
+
* in LLM API calls.
|
|
157
|
+
*
|
|
158
|
+
* Supported Zod types:
|
|
159
|
+
* z.string(), z.number(), z.boolean(), z.enum(), z.array(), z.object(),
|
|
160
|
+
* z.optional(), z.union(), z.literal(), z.describe(), z.nullable(),
|
|
161
|
+
* z.default(), z.intersection(), z.discriminatedUnion(), z.record(),
|
|
162
|
+
* z.tuple(), z.any(), z.unknown(), z.never(), z.effects() (transforms)
|
|
163
|
+
*
|
|
164
|
+
* Unsupported types fall back to `{}` (any) which is still valid JSON Schema.
|
|
165
|
+
*/
|
|
166
|
+
export declare function zodToJsonSchema(schema: ZodSchema): Record<string, unknown>;
|
|
167
|
+
//# sourceMappingURL=framework.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework.d.ts","sourceRoot":"","sources":["../../src/tool/framework.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,KAAK,CAAA;AACpC,OAAO,KAAK,EACV,cAAc,EACd,UAAU,EACV,cAAc,EACd,UAAU,EACX,MAAM,aAAa,CAAA;AAGpB,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,CAAA;AAM1D,iDAAiD;AACjD,MAAM,MAAM,kBAAkB,GAC1B;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GACzD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GACxC;IAAE,IAAI,EAA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+
* Provides the core primitives for declaring, registering, and converting
|
|
5
|
+
* tools to the JSON Schema format that LLM APIs expect.
|
|
6
|
+
*
|
|
7
|
+
* Types shared with the rest of the framework (`ToolDefinition`, `ToolResult`,
|
|
8
|
+
* `ToolUseContext`) are imported from `../types` to ensure a single source of
|
|
9
|
+
* truth. This file re-exports them for the convenience of downstream callers
|
|
10
|
+
* who only need to import from `tool/framework`.
|
|
11
|
+
*/
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// defineTool
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
/**
|
|
16
|
+
* Define a typed tool. This is the single entry-point for creating tools
|
|
17
|
+
* that can be registered with a {@link ToolRegistry}.
|
|
18
|
+
*
|
|
19
|
+
* The returned object satisfies the {@link ToolDefinition} interface imported
|
|
20
|
+
* from `../types`.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* const echoTool = defineTool({
|
|
25
|
+
* name: 'echo',
|
|
26
|
+
* description: 'Echo the input message back to the caller.',
|
|
27
|
+
* inputSchema: z.object({ message: z.string() }),
|
|
28
|
+
* execute: async ({ message }) => ({
|
|
29
|
+
* data: message,
|
|
30
|
+
* isError: false,
|
|
31
|
+
* }),
|
|
32
|
+
* })
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export function defineTool(config) {
|
|
36
|
+
return {
|
|
37
|
+
name: config.name,
|
|
38
|
+
description: config.description,
|
|
39
|
+
inputSchema: config.inputSchema,
|
|
40
|
+
...(config.outputSchema !== undefined
|
|
41
|
+
? { outputSchema: config.outputSchema }
|
|
42
|
+
: {}),
|
|
43
|
+
...(config.llmInputSchema !== undefined
|
|
44
|
+
? { llmInputSchema: config.llmInputSchema }
|
|
45
|
+
: {}),
|
|
46
|
+
...(config.maxOutputChars !== undefined
|
|
47
|
+
? { maxOutputChars: config.maxOutputChars }
|
|
48
|
+
: {}),
|
|
49
|
+
execute: config.execute,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
// ToolRegistry
|
|
54
|
+
// ---------------------------------------------------------------------------
|
|
55
|
+
/**
|
|
56
|
+
* Registry that holds a set of named tools and can produce the JSON Schema
|
|
57
|
+
* representation expected by LLM APIs (Anthropic, OpenAI, etc.).
|
|
58
|
+
*/
|
|
59
|
+
export class ToolRegistry {
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
61
|
+
tools = new Map();
|
|
62
|
+
runtimeToolNames = new Set();
|
|
63
|
+
/**
|
|
64
|
+
* Add a tool to the registry. Throws if a tool with the same name has
|
|
65
|
+
* already been registered — prevents silent overwrites.
|
|
66
|
+
*/
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
68
|
+
register(tool, options) {
|
|
69
|
+
if (this.tools.has(tool.name)) {
|
|
70
|
+
throw new Error(`ToolRegistry: a tool named "${tool.name}" is already registered. ` +
|
|
71
|
+
'Use a unique name or deregister the existing one first.');
|
|
72
|
+
}
|
|
73
|
+
this.tools.set(tool.name, tool);
|
|
74
|
+
if (options?.runtimeAdded === true) {
|
|
75
|
+
this.runtimeToolNames.add(tool.name);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/** Return a tool by name, or `undefined` if not found. */
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
80
|
+
get(name) {
|
|
81
|
+
return this.tools.get(name);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Return all registered tool definitions as an array.
|
|
85
|
+
*
|
|
86
|
+
* Callers that only need names can do `registry.list().map(t => t.name)`.
|
|
87
|
+
* This matches the agent's `getTools()` pattern.
|
|
88
|
+
*/
|
|
89
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
90
|
+
list() {
|
|
91
|
+
return Array.from(this.tools.values());
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Return all registered tool definitions as an array.
|
|
95
|
+
* Alias for {@link list} — available for callers that prefer explicit naming.
|
|
96
|
+
*/
|
|
97
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
98
|
+
getAll() {
|
|
99
|
+
return Array.from(this.tools.values());
|
|
100
|
+
}
|
|
101
|
+
/** Return true when a tool with the given name is registered. */
|
|
102
|
+
has(name) {
|
|
103
|
+
return this.tools.has(name);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Remove a tool by name.
|
|
107
|
+
* No-op if the tool was not registered — matches the agent's expected
|
|
108
|
+
* behaviour where `removeTool` is a graceful operation.
|
|
109
|
+
*/
|
|
110
|
+
unregister(name) {
|
|
111
|
+
this.tools.delete(name);
|
|
112
|
+
this.runtimeToolNames.delete(name);
|
|
113
|
+
}
|
|
114
|
+
/** Alias for {@link unregister} — available for symmetry with `register`. */
|
|
115
|
+
deregister(name) {
|
|
116
|
+
this.unregister(name);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Convert all registered tools to the {@link LLMToolDef} format used by LLM
|
|
120
|
+
* adapters. This is the primary method called by the agent runner before
|
|
121
|
+
* each LLM API call.
|
|
122
|
+
*/
|
|
123
|
+
toToolDefs() {
|
|
124
|
+
return Array.from(this.tools.values()).map((tool) => {
|
|
125
|
+
const schema = tool.llmInputSchema ?? zodToJsonSchema(tool.inputSchema);
|
|
126
|
+
return {
|
|
127
|
+
name: tool.name,
|
|
128
|
+
description: tool.description,
|
|
129
|
+
inputSchema: schema,
|
|
130
|
+
};
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Return only tools that were added dynamically at runtime (e.g. via
|
|
135
|
+
* `agent.addTool()`), in LLM definition format.
|
|
136
|
+
*/
|
|
137
|
+
toRuntimeToolDefs() {
|
|
138
|
+
return this.toToolDefs().filter(tool => this.runtimeToolNames.has(tool.name));
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Convert all registered tools to the Anthropic-style `input_schema`
|
|
142
|
+
* format. Prefer {@link toToolDefs} for normal use; this method is exposed
|
|
143
|
+
* for callers that construct their own API payloads.
|
|
144
|
+
*/
|
|
145
|
+
toLLMTools() {
|
|
146
|
+
return Array.from(this.tools.values()).map((tool) => {
|
|
147
|
+
if (tool.llmInputSchema !== undefined) {
|
|
148
|
+
return {
|
|
149
|
+
name: tool.name,
|
|
150
|
+
description: tool.description,
|
|
151
|
+
input_schema: {
|
|
152
|
+
type: 'object',
|
|
153
|
+
...tool.llmInputSchema,
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
const schema = zodToJsonSchema(tool.inputSchema);
|
|
158
|
+
return {
|
|
159
|
+
name: tool.name,
|
|
160
|
+
description: tool.description,
|
|
161
|
+
input_schema: {
|
|
162
|
+
type: 'object',
|
|
163
|
+
properties: schema.properties ?? {},
|
|
164
|
+
...(schema.required !== undefined
|
|
165
|
+
? { required: schema.required }
|
|
166
|
+
: {}),
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
// ---------------------------------------------------------------------------
|
|
173
|
+
// zodToJsonSchema
|
|
174
|
+
// ---------------------------------------------------------------------------
|
|
175
|
+
/**
|
|
176
|
+
* Convert a Zod schema to a plain JSON Schema object suitable for inclusion
|
|
177
|
+
* in LLM API calls.
|
|
178
|
+
*
|
|
179
|
+
* Supported Zod types:
|
|
180
|
+
* z.string(), z.number(), z.boolean(), z.enum(), z.array(), z.object(),
|
|
181
|
+
* z.optional(), z.union(), z.literal(), z.describe(), z.nullable(),
|
|
182
|
+
* z.default(), z.intersection(), z.discriminatedUnion(), z.record(),
|
|
183
|
+
* z.tuple(), z.any(), z.unknown(), z.never(), z.effects() (transforms)
|
|
184
|
+
*
|
|
185
|
+
* Unsupported types fall back to `{}` (any) which is still valid JSON Schema.
|
|
186
|
+
*/
|
|
187
|
+
export function zodToJsonSchema(schema) {
|
|
188
|
+
return convertZodType(schema);
|
|
189
|
+
}
|
|
190
|
+
// Internal recursive converter. We access Zod's internal `_def` structure
|
|
191
|
+
// because Zod v3 does not ship a first-class JSON Schema exporter.
|
|
192
|
+
function convertZodType(schema) {
|
|
193
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
194
|
+
const def = schema._def;
|
|
195
|
+
const description = def.description;
|
|
196
|
+
const withDesc = (result) => description !== undefined ? { ...result, description } : result;
|
|
197
|
+
switch (def.typeName) {
|
|
198
|
+
// -----------------------------------------------------------------------
|
|
199
|
+
// Primitives
|
|
200
|
+
// -----------------------------------------------------------------------
|
|
201
|
+
case ZodTypeName.ZodString:
|
|
202
|
+
return withDesc({ type: 'string' });
|
|
203
|
+
case ZodTypeName.ZodNumber:
|
|
204
|
+
return withDesc({ type: 'number' });
|
|
205
|
+
case ZodTypeName.ZodBigInt:
|
|
206
|
+
return withDesc({ type: 'integer' });
|
|
207
|
+
case ZodTypeName.ZodBoolean:
|
|
208
|
+
return withDesc({ type: 'boolean' });
|
|
209
|
+
case ZodTypeName.ZodNull:
|
|
210
|
+
return withDesc({ type: 'null' });
|
|
211
|
+
case ZodTypeName.ZodUndefined:
|
|
212
|
+
return withDesc({ type: 'null' });
|
|
213
|
+
case ZodTypeName.ZodDate:
|
|
214
|
+
return withDesc({ type: 'string', format: 'date-time' });
|
|
215
|
+
// -----------------------------------------------------------------------
|
|
216
|
+
// Literals
|
|
217
|
+
// -----------------------------------------------------------------------
|
|
218
|
+
case ZodTypeName.ZodLiteral: {
|
|
219
|
+
const literalDef = def;
|
|
220
|
+
return withDesc({ const: literalDef.value });
|
|
221
|
+
}
|
|
222
|
+
// -----------------------------------------------------------------------
|
|
223
|
+
// Enums
|
|
224
|
+
// -----------------------------------------------------------------------
|
|
225
|
+
case ZodTypeName.ZodEnum: {
|
|
226
|
+
const enumDef = def;
|
|
227
|
+
return withDesc({ type: 'string', enum: enumDef.values });
|
|
228
|
+
}
|
|
229
|
+
case ZodTypeName.ZodNativeEnum: {
|
|
230
|
+
const nativeEnumDef = def;
|
|
231
|
+
const values = Object.values(nativeEnumDef.values).filter((v) => typeof v === 'string' || typeof v === 'number');
|
|
232
|
+
return withDesc({ enum: values });
|
|
233
|
+
}
|
|
234
|
+
// -----------------------------------------------------------------------
|
|
235
|
+
// Arrays
|
|
236
|
+
// -----------------------------------------------------------------------
|
|
237
|
+
case ZodTypeName.ZodArray: {
|
|
238
|
+
const arrayDef = def;
|
|
239
|
+
return withDesc({
|
|
240
|
+
type: 'array',
|
|
241
|
+
items: convertZodType(arrayDef.type),
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
case ZodTypeName.ZodTuple: {
|
|
245
|
+
const tupleDef = def;
|
|
246
|
+
return withDesc({
|
|
247
|
+
type: 'array',
|
|
248
|
+
prefixItems: tupleDef.items.map(convertZodType),
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
// -----------------------------------------------------------------------
|
|
252
|
+
// Objects
|
|
253
|
+
// -----------------------------------------------------------------------
|
|
254
|
+
case ZodTypeName.ZodObject: {
|
|
255
|
+
const objectDef = def;
|
|
256
|
+
const properties = {};
|
|
257
|
+
const required = [];
|
|
258
|
+
for (const [key, value] of Object.entries(objectDef.shape())) {
|
|
259
|
+
properties[key] = convertZodType(value);
|
|
260
|
+
const innerDef = value._def;
|
|
261
|
+
const isOptional = innerDef.typeName === ZodTypeName.ZodOptional ||
|
|
262
|
+
innerDef.typeName === ZodTypeName.ZodDefault ||
|
|
263
|
+
innerDef.typeName === ZodTypeName.ZodNullable;
|
|
264
|
+
if (!isOptional) {
|
|
265
|
+
required.push(key);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
const result = { type: 'object', properties };
|
|
269
|
+
if (required.length > 0)
|
|
270
|
+
result.required = required;
|
|
271
|
+
return withDesc(result);
|
|
272
|
+
}
|
|
273
|
+
case ZodTypeName.ZodRecord: {
|
|
274
|
+
const recordDef = def;
|
|
275
|
+
return withDesc({
|
|
276
|
+
type: 'object',
|
|
277
|
+
additionalProperties: convertZodType(recordDef.valueType),
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
// -----------------------------------------------------------------------
|
|
281
|
+
// Optional / Nullable / Default
|
|
282
|
+
// -----------------------------------------------------------------------
|
|
283
|
+
case ZodTypeName.ZodOptional: {
|
|
284
|
+
const optionalDef = def;
|
|
285
|
+
const inner = convertZodType(optionalDef.innerType);
|
|
286
|
+
return description !== undefined ? { ...inner, description } : inner;
|
|
287
|
+
}
|
|
288
|
+
case ZodTypeName.ZodNullable: {
|
|
289
|
+
const nullableDef = def;
|
|
290
|
+
const inner = convertZodType(nullableDef.innerType);
|
|
291
|
+
const type = inner.type;
|
|
292
|
+
if (typeof type === 'string') {
|
|
293
|
+
return withDesc({ ...inner, type: [type, 'null'] });
|
|
294
|
+
}
|
|
295
|
+
return withDesc({ anyOf: [inner, { type: 'null' }] });
|
|
296
|
+
}
|
|
297
|
+
case ZodTypeName.ZodDefault: {
|
|
298
|
+
const defaultDef = def;
|
|
299
|
+
const inner = convertZodType(defaultDef.innerType);
|
|
300
|
+
return withDesc({ ...inner, default: defaultDef.defaultValue() });
|
|
301
|
+
}
|
|
302
|
+
// -----------------------------------------------------------------------
|
|
303
|
+
// Union / Intersection / Discriminated Union
|
|
304
|
+
// -----------------------------------------------------------------------
|
|
305
|
+
case ZodTypeName.ZodUnion: {
|
|
306
|
+
const unionDef = def;
|
|
307
|
+
const options = unionDef.options.map(convertZodType);
|
|
308
|
+
return withDesc({ anyOf: options });
|
|
309
|
+
}
|
|
310
|
+
case ZodTypeName.ZodDiscriminatedUnion: {
|
|
311
|
+
const duDef = def;
|
|
312
|
+
const options = duDef.options.map(convertZodType);
|
|
313
|
+
return withDesc({ anyOf: options });
|
|
314
|
+
}
|
|
315
|
+
case ZodTypeName.ZodIntersection: {
|
|
316
|
+
const intDef = def;
|
|
317
|
+
return withDesc({
|
|
318
|
+
allOf: [convertZodType(intDef.left), convertZodType(intDef.right)],
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
// -----------------------------------------------------------------------
|
|
322
|
+
// Wrappers that forward to their inner type
|
|
323
|
+
// -----------------------------------------------------------------------
|
|
324
|
+
case ZodTypeName.ZodEffects: {
|
|
325
|
+
const effectsDef = def;
|
|
326
|
+
const inner = convertZodType(effectsDef.schema);
|
|
327
|
+
return description !== undefined ? { ...inner, description } : inner;
|
|
328
|
+
}
|
|
329
|
+
case ZodTypeName.ZodBranded: {
|
|
330
|
+
const brandedDef = def;
|
|
331
|
+
return withDesc(convertZodType(brandedDef.type));
|
|
332
|
+
}
|
|
333
|
+
case ZodTypeName.ZodReadonly: {
|
|
334
|
+
const readonlyDef = def;
|
|
335
|
+
return withDesc(convertZodType(readonlyDef.innerType));
|
|
336
|
+
}
|
|
337
|
+
case ZodTypeName.ZodCatch: {
|
|
338
|
+
const catchDef = def;
|
|
339
|
+
return withDesc(convertZodType(catchDef.innerType));
|
|
340
|
+
}
|
|
341
|
+
case ZodTypeName.ZodPipeline: {
|
|
342
|
+
const pipelineDef = def;
|
|
343
|
+
return withDesc(convertZodType(pipelineDef.in));
|
|
344
|
+
}
|
|
345
|
+
// -----------------------------------------------------------------------
|
|
346
|
+
// Any / Unknown – JSON Schema wildcard
|
|
347
|
+
// -----------------------------------------------------------------------
|
|
348
|
+
case ZodTypeName.ZodAny:
|
|
349
|
+
case ZodTypeName.ZodUnknown:
|
|
350
|
+
return withDesc({});
|
|
351
|
+
case ZodTypeName.ZodNever:
|
|
352
|
+
return withDesc({ not: {} });
|
|
353
|
+
case ZodTypeName.ZodVoid:
|
|
354
|
+
return withDesc({ type: 'null' });
|
|
355
|
+
// -----------------------------------------------------------------------
|
|
356
|
+
// Fallback
|
|
357
|
+
// -----------------------------------------------------------------------
|
|
358
|
+
default:
|
|
359
|
+
return withDesc({});
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
// ---------------------------------------------------------------------------
|
|
363
|
+
// Internal Zod type-name enum (mirrors Zod's internal ZodFirstPartyTypeKind)
|
|
364
|
+
// ---------------------------------------------------------------------------
|
|
365
|
+
var ZodTypeName;
|
|
366
|
+
(function (ZodTypeName) {
|
|
367
|
+
ZodTypeName["ZodString"] = "ZodString";
|
|
368
|
+
ZodTypeName["ZodNumber"] = "ZodNumber";
|
|
369
|
+
ZodTypeName["ZodBigInt"] = "ZodBigInt";
|
|
370
|
+
ZodTypeName["ZodBoolean"] = "ZodBoolean";
|
|
371
|
+
ZodTypeName["ZodDate"] = "ZodDate";
|
|
372
|
+
ZodTypeName["ZodUndefined"] = "ZodUndefined";
|
|
373
|
+
ZodTypeName["ZodNull"] = "ZodNull";
|
|
374
|
+
ZodTypeName["ZodAny"] = "ZodAny";
|
|
375
|
+
ZodTypeName["ZodUnknown"] = "ZodUnknown";
|
|
376
|
+
ZodTypeName["ZodNever"] = "ZodNever";
|
|
377
|
+
ZodTypeName["ZodVoid"] = "ZodVoid";
|
|
378
|
+
ZodTypeName["ZodArray"] = "ZodArray";
|
|
379
|
+
ZodTypeName["ZodObject"] = "ZodObject";
|
|
380
|
+
ZodTypeName["ZodUnion"] = "ZodUnion";
|
|
381
|
+
ZodTypeName["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
|
|
382
|
+
ZodTypeName["ZodIntersection"] = "ZodIntersection";
|
|
383
|
+
ZodTypeName["ZodTuple"] = "ZodTuple";
|
|
384
|
+
ZodTypeName["ZodRecord"] = "ZodRecord";
|
|
385
|
+
ZodTypeName["ZodMap"] = "ZodMap";
|
|
386
|
+
ZodTypeName["ZodSet"] = "ZodSet";
|
|
387
|
+
ZodTypeName["ZodFunction"] = "ZodFunction";
|
|
388
|
+
ZodTypeName["ZodLazy"] = "ZodLazy";
|
|
389
|
+
ZodTypeName["ZodLiteral"] = "ZodLiteral";
|
|
390
|
+
ZodTypeName["ZodEnum"] = "ZodEnum";
|
|
391
|
+
ZodTypeName["ZodEffects"] = "ZodEffects";
|
|
392
|
+
ZodTypeName["ZodNativeEnum"] = "ZodNativeEnum";
|
|
393
|
+
ZodTypeName["ZodOptional"] = "ZodOptional";
|
|
394
|
+
ZodTypeName["ZodNullable"] = "ZodNullable";
|
|
395
|
+
ZodTypeName["ZodDefault"] = "ZodDefault";
|
|
396
|
+
ZodTypeName["ZodCatch"] = "ZodCatch";
|
|
397
|
+
ZodTypeName["ZodPromise"] = "ZodPromise";
|
|
398
|
+
ZodTypeName["ZodBranded"] = "ZodBranded";
|
|
399
|
+
ZodTypeName["ZodPipeline"] = "ZodPipeline";
|
|
400
|
+
ZodTypeName["ZodReadonly"] = "ZodReadonly";
|
|
401
|
+
})(ZodTypeName || (ZodTypeName = {}));
|
|
402
|
+
//# sourceMappingURL=framework.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework.js","sourceRoot":"","sources":["../../src/tool/framework.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAoCH,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,UAAU,CAAS,MAwBlC;IACC,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,GAAG,CAAC,MAAM,CAAC,YAAY,KAAK,SAAS;YACnC,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE;YACvC,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,MAAM,CAAC,cAAc,KAAK,SAAS;YACrC,CAAC,CAAC,EAAE,cAAc,EAAE,MAAM,CAAC,cAAc,EAAE;YAC3C,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,MAAM,CAAC,cAAc,KAAK,SAAS;YACrC,CAAC,CAAC,EAAE,cAAc,EAAE,MAAM,CAAC,cAAc,EAAE;YAC3C,CAAC,CAAC,EAAE,CAAC;QACP,OAAO,EAAE,MAAM,CAAC,OAAO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EAAE,CAAC,CAAA;QAE9B,KAAK,WAAW,CAAC,OAAO;YACtB,OAAO,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAA;QAEnC,0EAA0E;QAC1E,WAAW;QACX,0EAA0E;QAC1E;YACE,OAAO,QAAQ,CAAC,EAAE,CAAC,CAAA;IACvB,CAAC;AACH,CAAC;AAED,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAE9E,IAAW,WAmCV;AAnCD,WAAW,WAAW;IACpB,sCAAuB,CAAA;IACvB,sCAAuB,CAAA;IACvB,sCAAuB,CAAA;IACvB,wCAAyB,CAAA;IACzB,kCAAmB,CAAA;IACnB,4CAA6B,CAAA;IAC7B,kCAAmB,CAAA;IACnB,gCAAiB,CAAA;IACjB,wCAAyB,CAAA;IACzB,oCAAqB,CAAA;IACrB,kCAAmB,CAAA;IACnB,oCAAqB,CAAA;IACrB,sCAAuB,CAAA;IACvB,oCAAqB,CAAA;IACrB,8DAA+C,CAAA;IAC/C,kDAAmC,CAAA;IACnC,oCAAqB,CAAA;IACrB,sCAAuB,CAAA;IACvB,gCAAiB,CAAA;IACjB,gCAAiB,CAAA;IACjB,0CAA2B,CAAA;IAC3B,kCAAmB,CAAA;IACnB,wCAAyB,CAAA;IACzB,kCAAmB,CAAA;IACnB,wCAAyB,CAAA;IACzB,8CAA+B,CAAA;IAC/B,0CAA2B,CAAA;IAC3B,0CAA2B,CAAA;IAC3B,wCAAyB,CAAA;IACzB,oCAAqB,CAAA;IACrB,wCAAyB,CAAA;IACzB,wCAAyB,CAAA;IACzB,0CAA2B,CAAA;IAC3B,0CAA2B,CAAA;AAC7B,CAAC,EAnCU,WAAW,KAAX,WAAW,QAmCrB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ToolDefinition } from '../types.js';
|
|
2
|
+
export interface ConnectMCPToolsConfig {
|
|
3
|
+
command: string;
|
|
4
|
+
args?: string[];
|
|
5
|
+
env?: Record<string, string | undefined>;
|
|
6
|
+
cwd?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Optional segment prepended to MCP tool names for the framework tool (and LLM) name.
|
|
9
|
+
* Example: prefix `github` + MCP tool `search_issues` → `github_search_issues`.
|
|
10
|
+
*/
|
|
11
|
+
namePrefix?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Timeout (ms) for MCP connect and each `tools/list` page. Defaults to 60000.
|
|
14
|
+
*/
|
|
15
|
+
requestTimeoutMs?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Client metadata sent to the MCP server.
|
|
18
|
+
*/
|
|
19
|
+
clientName?: string;
|
|
20
|
+
clientVersion?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface ConnectedMCPTools {
|
|
23
|
+
tools: ToolDefinition[];
|
|
24
|
+
disconnect: () => Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Connect to an MCP server over stdio and convert exposed MCP tools into
|
|
28
|
+
* open-multi-agent ToolDefinitions.
|
|
29
|
+
*/
|
|
30
|
+
export declare function connectMCPTools(config: ConnectMCPToolsConfig): Promise<ConnectedMCPTools>;
|
|
31
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/tool/mcp.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAkEjD,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;IACxC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAChC;AAqID;;;GAGG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,iBAAiB,CAAC,CAgE5B"}
|