@omnixhq/ucp-client 0.1.3 → 0.2.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 +73 -16
- package/dist/adapters/anthropic.cjs +23 -0
- package/dist/adapters/anthropic.cjs.map +1 -0
- package/dist/adapters/anthropic.d.cts +22 -0
- package/dist/adapters/anthropic.d.cts.map +1 -0
- package/dist/adapters/anthropic.d.ts +22 -0
- package/dist/adapters/anthropic.d.ts.map +1 -0
- package/dist/adapters/anthropic.js +20 -0
- package/dist/adapters/anthropic.js.map +1 -0
- package/dist/adapters/langchain.cjs +18 -0
- package/dist/adapters/langchain.cjs.map +1 -0
- package/dist/adapters/langchain.d.cts +16 -0
- package/dist/adapters/langchain.d.cts.map +1 -0
- package/dist/adapters/langchain.d.ts +16 -0
- package/dist/adapters/langchain.d.ts.map +1 -0
- package/dist/adapters/langchain.js +16 -0
- package/dist/adapters/langchain.js.map +1 -0
- package/dist/adapters/mcp.cjs +23 -0
- package/dist/adapters/mcp.cjs.map +1 -0
- package/dist/adapters/mcp.d.cts +22 -0
- package/dist/adapters/mcp.d.cts.map +1 -0
- package/dist/adapters/mcp.d.ts +22 -0
- package/dist/adapters/mcp.d.ts.map +1 -0
- package/dist/adapters/mcp.js +20 -0
- package/dist/adapters/mcp.js.map +1 -0
- package/dist/adapters/openai.cjs +23 -0
- package/dist/adapters/openai.cjs.map +1 -0
- package/dist/adapters/openai.d.cts +20 -0
- package/dist/adapters/openai.d.cts.map +1 -0
- package/dist/adapters/openai.d.ts +20 -0
- package/dist/adapters/openai.d.ts.map +1 -0
- package/dist/adapters/openai.js +20 -0
- package/dist/adapters/openai.js.map +1 -0
- package/dist/adapters/vercel-ai.cjs +17 -0
- package/dist/adapters/vercel-ai.cjs.map +1 -0
- package/dist/adapters/vercel-ai.d.cts +16 -0
- package/dist/adapters/vercel-ai.d.cts.map +1 -0
- package/dist/adapters/vercel-ai.d.ts +16 -0
- package/dist/adapters/vercel-ai.d.ts.map +1 -0
- package/dist/adapters/vercel-ai.js +15 -0
- package/dist/adapters/vercel-ai.js.map +1 -0
- package/dist/agent-tools-DBOuuSEd.d.ts +483 -0
- package/dist/agent-tools-DBOuuSEd.d.ts.map +1 -0
- package/dist/agent-tools-o2PEyGqh.d.cts +483 -0
- package/dist/agent-tools-o2PEyGqh.d.cts.map +1 -0
- package/dist/index.d.cts +5 -482
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +5 -482
- package/dist/index.d.ts.map +1 -1
- package/package.json +51 -1
package/README.md
CHANGED
|
@@ -138,40 +138,97 @@ console.log(Object.keys(client.paymentHandlers));
|
|
|
138
138
|
// e.g., ['com.google.pay', 'dev.shopify.shop_pay']
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
##
|
|
141
|
+
## Framework adapters
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
Ready-made adapters convert `getAgentTools()` output to each framework's native format — no manual mapping.
|
|
144
|
+
|
|
145
|
+
| Framework | Import | Example |
|
|
146
|
+
| ----------------- | -------------------------------- | ---------------------------------------------------------------------- |
|
|
147
|
+
| **Anthropic SDK** | `@omnixhq/ucp-client` (built-in) | [examples/anthropic-agent-loop.ts](./examples/anthropic-agent-loop.ts) |
|
|
148
|
+
| **OpenAI SDK** | `@omnixhq/ucp-client/openai` | [examples/openai-agent-loop.ts](./examples/openai-agent-loop.ts) |
|
|
149
|
+
| **Vercel AI SDK** | `@omnixhq/ucp-client/vercel-ai` | [examples/vercel-ai-nextjs.ts](./examples/vercel-ai-nextjs.ts) |
|
|
150
|
+
| **LangChain** | `@omnixhq/ucp-client/langchain` | [examples/langchain-agent.ts](./examples/langchain-agent.ts) |
|
|
151
|
+
| **MCP server** | `@omnixhq/ucp-client/mcp` | [examples/mcp-server.ts](./examples/mcp-server.ts) |
|
|
144
152
|
|
|
145
153
|
**OpenAI:**
|
|
146
154
|
|
|
147
155
|
```typescript
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
156
|
+
import { toOpenAITools, executeOpenAIToolCall } from '@omnixhq/ucp-client/openai';
|
|
157
|
+
|
|
158
|
+
const tools = toOpenAITools(client.getAgentTools());
|
|
159
|
+
|
|
160
|
+
// In your agent loop:
|
|
161
|
+
const response = await openai.chat.completions.create({ model: 'gpt-4o', tools, messages });
|
|
162
|
+
|
|
163
|
+
for (const call of response.choices[0].message.tool_calls ?? []) {
|
|
164
|
+
const result = await executeOpenAIToolCall(
|
|
165
|
+
agentTools,
|
|
166
|
+
call.function.name,
|
|
167
|
+
JSON.parse(call.function.arguments),
|
|
168
|
+
);
|
|
169
|
+
}
|
|
152
170
|
```
|
|
153
171
|
|
|
154
172
|
**Vercel AI SDK:**
|
|
155
173
|
|
|
156
174
|
```typescript
|
|
157
|
-
import {
|
|
175
|
+
import { toVercelAITools } from '@omnixhq/ucp-client/vercel-ai';
|
|
176
|
+
import { jsonSchema, streamText } from 'ai';
|
|
158
177
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
178
|
+
const rawTools = toVercelAITools(client.getAgentTools());
|
|
179
|
+
|
|
180
|
+
// Wrap parameters with jsonSchema() for strict Vercel AI SDK typing:
|
|
181
|
+
const tools = Object.fromEntries(
|
|
182
|
+
Object.entries(rawTools).map(([name, t]) => [
|
|
183
|
+
name,
|
|
184
|
+
{ ...t, parameters: jsonSchema(t.parameters) },
|
|
163
185
|
]),
|
|
164
186
|
);
|
|
187
|
+
|
|
188
|
+
const result = await streamText({ model, tools, messages });
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**LangChain:**
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
import { toLangChainTools } from '@omnixhq/ucp-client/langchain';
|
|
195
|
+
import { DynamicStructuredTool } from '@langchain/core/tools';
|
|
196
|
+
import { z } from 'zod';
|
|
197
|
+
|
|
198
|
+
const rawTools = toLangChainTools(client.getAgentTools());
|
|
199
|
+
|
|
200
|
+
const tools = rawTools.map(
|
|
201
|
+
(t) =>
|
|
202
|
+
new DynamicStructuredTool({
|
|
203
|
+
name: t.name,
|
|
204
|
+
description: t.description,
|
|
205
|
+
schema: z.object({}),
|
|
206
|
+
func: t.call,
|
|
207
|
+
}),
|
|
208
|
+
);
|
|
165
209
|
```
|
|
166
210
|
|
|
167
211
|
**MCP server:**
|
|
168
212
|
|
|
169
213
|
```typescript
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
214
|
+
import { toMCPTools, executeMCPToolCall } from '@omnixhq/ucp-client/mcp';
|
|
215
|
+
|
|
216
|
+
const agentTools = client.getAgentTools();
|
|
217
|
+
|
|
218
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
219
|
+
tools: toMCPTools(agentTools),
|
|
220
|
+
}));
|
|
221
|
+
|
|
222
|
+
server.setRequestHandler(CallToolRequestSchema, async (req) => ({
|
|
223
|
+
content: [
|
|
224
|
+
{
|
|
225
|
+
type: 'text',
|
|
226
|
+
text: JSON.stringify(
|
|
227
|
+
await executeMCPToolCall(agentTools, req.params.name, req.params.arguments ?? {}),
|
|
228
|
+
),
|
|
229
|
+
},
|
|
230
|
+
],
|
|
231
|
+
}));
|
|
175
232
|
```
|
|
176
233
|
|
|
177
234
|
## Development
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
//#region src/adapters/anthropic.ts
|
|
4
|
+
function toAnthropicTools(agentTools) {
|
|
5
|
+
return agentTools.map((tool) => ({
|
|
6
|
+
name: tool.name,
|
|
7
|
+
description: tool.description,
|
|
8
|
+
input_schema: {
|
|
9
|
+
...tool.parameters,
|
|
10
|
+
type: "object"
|
|
11
|
+
}
|
|
12
|
+
}));
|
|
13
|
+
}
|
|
14
|
+
async function executeAnthropicToolCall(agentTools, toolName, toolInput) {
|
|
15
|
+
const tool = agentTools.find((t) => t.name === toolName);
|
|
16
|
+
if (!tool) throw new Error(`Tool not found: ${toolName}`);
|
|
17
|
+
return tool.execute(toolInput);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.executeAnthropicToolCall = executeAnthropicToolCall
|
|
22
|
+
exports.toAnthropicTools = toAnthropicTools
|
|
23
|
+
//# sourceMappingURL=anthropic.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anthropic.cjs","names":["agentTools: readonly AgentTool[]","toolName: string","toolInput: Record<string, unknown>"],"sources":["../../src/adapters/anthropic.ts"],"sourcesContent":["import type { AgentTool, JsonSchema } from '../agent-tools.js';\n\nexport type { AgentTool, JsonSchema };\n\nexport interface AnthropicInputSchema {\n readonly type: 'object';\n readonly properties?: Readonly<Record<string, JsonSchema>>;\n readonly required?: readonly string[];\n readonly description?: string;\n}\n\nexport interface AnthropicTool {\n readonly name: string;\n readonly description: string;\n readonly input_schema: AnthropicInputSchema & JsonSchema;\n}\n\nexport function toAnthropicTools(agentTools: readonly AgentTool[]): readonly AnthropicTool[] {\n return agentTools.map((tool) => ({\n name: tool.name,\n description: tool.description,\n input_schema: { ...tool.parameters, type: 'object' as const },\n }));\n}\n\nexport async function executeAnthropicToolCall(\n agentTools: readonly AgentTool[],\n toolName: string,\n toolInput: Record<string, unknown>,\n): Promise<unknown> {\n const tool = agentTools.find((t) => t.name === toolName);\n if (!tool) {\n throw new Error(`Tool not found: ${toolName}`);\n }\n return tool.execute(toolInput);\n}\n"],"mappings":";;;AAiBA,SAAgB,iBAAiBA,YAA4D;AAC3F,QAAO,WAAW,IAAI,CAAC,UAAU;EAC/B,MAAM,KAAK;EACX,aAAa,KAAK;EAClB,cAAc;GAAE,GAAG,KAAK;GAAY,MAAM;EAAmB;CAC9D,GAAE;AACJ;AAED,eAAsB,yBACpBA,YACAC,UACAC,WACkB;CAClB,MAAM,OAAO,WAAW,KAAK,CAAC,MAAM,EAAE,SAAS,SAAS;AACxD,MAAK,KACH,OAAM,IAAI,OAAO,kBAAkB,SAAS;AAE9C,QAAO,KAAK,QAAQ,UAAU;AAC/B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AgentTool, JsonSchema } from "../agent-tools-o2PEyGqh.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/adapters/anthropic.d.ts
|
|
4
|
+
interface AnthropicInputSchema {
|
|
5
|
+
readonly type: 'object';
|
|
6
|
+
readonly properties?: Readonly<Record<string, JsonSchema>>;
|
|
7
|
+
readonly required?: readonly string[];
|
|
8
|
+
readonly description?: string;
|
|
9
|
+
}
|
|
10
|
+
interface AnthropicTool {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly description: string;
|
|
13
|
+
readonly input_schema: AnthropicInputSchema & JsonSchema;
|
|
14
|
+
}
|
|
15
|
+
declare function toAnthropicTools(agentTools: readonly AgentTool[]): readonly AnthropicTool[];
|
|
16
|
+
declare function executeAnthropicToolCall(agentTools: readonly AgentTool[], toolName: string, toolInput: Record<string, unknown>): Promise<unknown>;
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
//# sourceMappingURL=anthropic.d.ts.map
|
|
20
|
+
|
|
21
|
+
export { AgentTool, AnthropicInputSchema, AnthropicTool, JsonSchema, executeAnthropicToolCall, toAnthropicTools };
|
|
22
|
+
//# sourceMappingURL=anthropic.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anthropic.d.cts","names":[],"sources":["../../src/adapters/anthropic.ts"],"sourcesContent":null,"mappings":";;;UAIiB,oBAAA;EAAA,SAAA,IAAA,EAAA,QAAoB;EAAA,SAAA,UAAA,CAAA,EAEb,QAFa,CAEJ,MAFI,CAAA,MAAA,EAEW,UAFX,CAAA,CAAA;EAAA,SAEW,QAAA,CAAA,EAAA,SAAA,MAAA,EAAA;EAAU,SAAzB,WAAA,CAAA,EAAA,MAAA;;AAAD,UAKf,aAAA,CALe;EAKf,SAAA,IAAA,EAAA,MAAa;EAAA,SAAA,WAAA,EAAA,MAAA;EAAA,SAGL,YAAA,EAAA,oBAAA,GAAuB,UAAvB;;AAAiC,iBAG1C,gBAAA,CAH0C,UAAA,EAAA,SAGJ,SAHI,EAAA,CAAA,EAAA,SAGmB,aAHnB,EAAA;AAG1C,iBAQM,wBAAA,CARU,UAAA,EAAA,SAST,SATS,EAAA,EAAA,QAAA,EAAA,MAAA,EAAA,SAAA,EAWnB,MAXmB,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,EAY7B,OAZ6B,CAAA,OAAA,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AgentTool, JsonSchema } from "../agent-tools-DBOuuSEd.js";
|
|
2
|
+
|
|
3
|
+
//#region src/adapters/anthropic.d.ts
|
|
4
|
+
interface AnthropicInputSchema {
|
|
5
|
+
readonly type: 'object';
|
|
6
|
+
readonly properties?: Readonly<Record<string, JsonSchema>>;
|
|
7
|
+
readonly required?: readonly string[];
|
|
8
|
+
readonly description?: string;
|
|
9
|
+
}
|
|
10
|
+
interface AnthropicTool {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly description: string;
|
|
13
|
+
readonly input_schema: AnthropicInputSchema & JsonSchema;
|
|
14
|
+
}
|
|
15
|
+
declare function toAnthropicTools(agentTools: readonly AgentTool[]): readonly AnthropicTool[];
|
|
16
|
+
declare function executeAnthropicToolCall(agentTools: readonly AgentTool[], toolName: string, toolInput: Record<string, unknown>): Promise<unknown>;
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
//# sourceMappingURL=anthropic.d.ts.map
|
|
20
|
+
|
|
21
|
+
export { AgentTool, AnthropicInputSchema, AnthropicTool, JsonSchema, executeAnthropicToolCall, toAnthropicTools };
|
|
22
|
+
//# sourceMappingURL=anthropic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anthropic.d.ts","names":[],"sources":["../../src/adapters/anthropic.ts"],"sourcesContent":null,"mappings":";;;UAIiB,oBAAA;EAAA,SAAA,IAAA,EAAA,QAAoB;EAAA,SAAA,UAAA,CAAA,EAEb,QAFa,CAEJ,MAFI,CAAA,MAAA,EAEW,UAFX,CAAA,CAAA;EAAA,SAEW,QAAA,CAAA,EAAA,SAAA,MAAA,EAAA;EAAU,SAAzB,WAAA,CAAA,EAAA,MAAA;;AAAD,UAKf,aAAA,CALe;EAKf,SAAA,IAAA,EAAA,MAAa;EAAA,SAAA,WAAA,EAAA,MAAA;EAAA,SAGL,YAAA,EAAA,oBAAA,GAAuB,UAAvB;;AAAiC,iBAG1C,gBAAA,CAH0C,UAAA,EAAA,SAGJ,SAHI,EAAA,CAAA,EAAA,SAGmB,aAHnB,EAAA;AAG1C,iBAQM,wBAAA,CARU,UAAA,EAAA,SAST,SATS,EAAA,EAAA,QAAA,EAAA,MAAA,EAAA,SAAA,EAWnB,MAXmB,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,EAY7B,OAZ6B,CAAA,OAAA,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/adapters/anthropic.ts
|
|
2
|
+
function toAnthropicTools(agentTools) {
|
|
3
|
+
return agentTools.map((tool) => ({
|
|
4
|
+
name: tool.name,
|
|
5
|
+
description: tool.description,
|
|
6
|
+
input_schema: {
|
|
7
|
+
...tool.parameters,
|
|
8
|
+
type: "object"
|
|
9
|
+
}
|
|
10
|
+
}));
|
|
11
|
+
}
|
|
12
|
+
async function executeAnthropicToolCall(agentTools, toolName, toolInput) {
|
|
13
|
+
const tool = agentTools.find((t) => t.name === toolName);
|
|
14
|
+
if (!tool) throw new Error(`Tool not found: ${toolName}`);
|
|
15
|
+
return tool.execute(toolInput);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { executeAnthropicToolCall, toAnthropicTools };
|
|
20
|
+
//# sourceMappingURL=anthropic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anthropic.js","names":["agentTools: readonly AgentTool[]","toolName: string","toolInput: Record<string, unknown>"],"sources":["../../src/adapters/anthropic.ts"],"sourcesContent":["import type { AgentTool, JsonSchema } from '../agent-tools.js';\n\nexport type { AgentTool, JsonSchema };\n\nexport interface AnthropicInputSchema {\n readonly type: 'object';\n readonly properties?: Readonly<Record<string, JsonSchema>>;\n readonly required?: readonly string[];\n readonly description?: string;\n}\n\nexport interface AnthropicTool {\n readonly name: string;\n readonly description: string;\n readonly input_schema: AnthropicInputSchema & JsonSchema;\n}\n\nexport function toAnthropicTools(agentTools: readonly AgentTool[]): readonly AnthropicTool[] {\n return agentTools.map((tool) => ({\n name: tool.name,\n description: tool.description,\n input_schema: { ...tool.parameters, type: 'object' as const },\n }));\n}\n\nexport async function executeAnthropicToolCall(\n agentTools: readonly AgentTool[],\n toolName: string,\n toolInput: Record<string, unknown>,\n): Promise<unknown> {\n const tool = agentTools.find((t) => t.name === toolName);\n if (!tool) {\n throw new Error(`Tool not found: ${toolName}`);\n }\n return tool.execute(toolInput);\n}\n"],"mappings":";AAiBA,SAAgB,iBAAiBA,YAA4D;AAC3F,QAAO,WAAW,IAAI,CAAC,UAAU;EAC/B,MAAM,KAAK;EACX,aAAa,KAAK;EAClB,cAAc;GAAE,GAAG,KAAK;GAAY,MAAM;EAAmB;CAC9D,GAAE;AACJ;AAED,eAAsB,yBACpBA,YACAC,UACAC,WACkB;CAClB,MAAM,OAAO,WAAW,KAAK,CAAC,MAAM,EAAE,SAAS,SAAS;AACxD,MAAK,KACH,OAAM,IAAI,OAAO,kBAAkB,SAAS;AAE9C,QAAO,KAAK,QAAQ,UAAU;AAC/B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
//#region src/adapters/langchain.ts
|
|
4
|
+
function toLangChainTools(agentTools) {
|
|
5
|
+
return agentTools.map((tool) => ({
|
|
6
|
+
name: tool.name,
|
|
7
|
+
description: tool.description,
|
|
8
|
+
schema: tool.parameters,
|
|
9
|
+
call: async (input) => {
|
|
10
|
+
const result = await tool.execute(input);
|
|
11
|
+
return JSON.stringify(result);
|
|
12
|
+
}
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.toLangChainTools = toLangChainTools
|
|
18
|
+
//# sourceMappingURL=langchain.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"langchain.cjs","names":["agentTools: readonly AgentTool[]","input: Record<string, unknown>"],"sources":["../../src/adapters/langchain.ts"],"sourcesContent":["import type { AgentTool, JsonSchema } from '../agent-tools.js';\n\nexport type { AgentTool, JsonSchema };\n\nexport interface LangChainTool {\n readonly name: string;\n readonly description: string;\n readonly schema: JsonSchema;\n readonly call: (input: Record<string, unknown>) => Promise<string>;\n}\n\nexport function toLangChainTools(agentTools: readonly AgentTool[]): readonly LangChainTool[] {\n return agentTools.map((tool) => ({\n name: tool.name,\n description: tool.description,\n schema: tool.parameters,\n call: async (input: Record<string, unknown>): Promise<string> => {\n const result = await tool.execute(input);\n return JSON.stringify(result);\n },\n }));\n}\n"],"mappings":";;;AAWA,SAAgB,iBAAiBA,YAA4D;AAC3F,QAAO,WAAW,IAAI,CAAC,UAAU;EAC/B,MAAM,KAAK;EACX,aAAa,KAAK;EAClB,QAAQ,KAAK;EACb,MAAM,OAAOC,UAAoD;GAC/D,MAAM,SAAS,MAAM,KAAK,QAAQ,MAAM;AACxC,UAAO,KAAK,UAAU,OAAO;EAC9B;CACF,GAAE;AACJ"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AgentTool, JsonSchema } from "../agent-tools-o2PEyGqh.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/adapters/langchain.d.ts
|
|
4
|
+
interface LangChainTool {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly description: string;
|
|
7
|
+
readonly schema: JsonSchema;
|
|
8
|
+
readonly call: (input: Record<string, unknown>) => Promise<string>;
|
|
9
|
+
}
|
|
10
|
+
declare function toLangChainTools(agentTools: readonly AgentTool[]): readonly LangChainTool[];
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
//# sourceMappingURL=langchain.d.ts.map
|
|
14
|
+
|
|
15
|
+
export { AgentTool, JsonSchema, LangChainTool, toLangChainTools };
|
|
16
|
+
//# sourceMappingURL=langchain.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"langchain.d.cts","names":[],"sources":["../../src/adapters/langchain.ts"],"sourcesContent":null,"mappings":";;;UAIiB,aAAA;EAAA,SAAA,IAAA,EAAA,MAAa;EAAA,SAAA,WAAA,EAAA,MAAA;EAAA,SAGX,MAAA,EAAA,UAAA;EAAU,SACJ,IAAA,EAAA,CAAA,KAAA,EAAA,MAAA,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,GAA4B,OAA5B,CAAA,MAAA,CAAA;;AAAmC,iBAG5C,gBAAA,CAH4C,UAAA,EAAA,SAGN,SAHM,EAAA,CAAA,EAAA,SAGiB,aAHjB,EAAA;;;AAG5D"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AgentTool, JsonSchema } from "../agent-tools-DBOuuSEd.js";
|
|
2
|
+
|
|
3
|
+
//#region src/adapters/langchain.d.ts
|
|
4
|
+
interface LangChainTool {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly description: string;
|
|
7
|
+
readonly schema: JsonSchema;
|
|
8
|
+
readonly call: (input: Record<string, unknown>) => Promise<string>;
|
|
9
|
+
}
|
|
10
|
+
declare function toLangChainTools(agentTools: readonly AgentTool[]): readonly LangChainTool[];
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
//# sourceMappingURL=langchain.d.ts.map
|
|
14
|
+
|
|
15
|
+
export { AgentTool, JsonSchema, LangChainTool, toLangChainTools };
|
|
16
|
+
//# sourceMappingURL=langchain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"langchain.d.ts","names":[],"sources":["../../src/adapters/langchain.ts"],"sourcesContent":null,"mappings":";;;UAIiB,aAAA;EAAA,SAAA,IAAA,EAAA,MAAa;EAAA,SAAA,WAAA,EAAA,MAAA;EAAA,SAGX,MAAA,EAAA,UAAA;EAAU,SACJ,IAAA,EAAA,CAAA,KAAA,EAAA,MAAA,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,GAA4B,OAA5B,CAAA,MAAA,CAAA;;AAAmC,iBAG5C,gBAAA,CAH4C,UAAA,EAAA,SAGN,SAHM,EAAA,CAAA,EAAA,SAGiB,aAHjB,EAAA;;;AAG5D"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/adapters/langchain.ts
|
|
2
|
+
function toLangChainTools(agentTools) {
|
|
3
|
+
return agentTools.map((tool) => ({
|
|
4
|
+
name: tool.name,
|
|
5
|
+
description: tool.description,
|
|
6
|
+
schema: tool.parameters,
|
|
7
|
+
call: async (input) => {
|
|
8
|
+
const result = await tool.execute(input);
|
|
9
|
+
return JSON.stringify(result);
|
|
10
|
+
}
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { toLangChainTools };
|
|
16
|
+
//# sourceMappingURL=langchain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"langchain.js","names":["agentTools: readonly AgentTool[]","input: Record<string, unknown>"],"sources":["../../src/adapters/langchain.ts"],"sourcesContent":["import type { AgentTool, JsonSchema } from '../agent-tools.js';\n\nexport type { AgentTool, JsonSchema };\n\nexport interface LangChainTool {\n readonly name: string;\n readonly description: string;\n readonly schema: JsonSchema;\n readonly call: (input: Record<string, unknown>) => Promise<string>;\n}\n\nexport function toLangChainTools(agentTools: readonly AgentTool[]): readonly LangChainTool[] {\n return agentTools.map((tool) => ({\n name: tool.name,\n description: tool.description,\n schema: tool.parameters,\n call: async (input: Record<string, unknown>): Promise<string> => {\n const result = await tool.execute(input);\n return JSON.stringify(result);\n },\n }));\n}\n"],"mappings":";AAWA,SAAgB,iBAAiBA,YAA4D;AAC3F,QAAO,WAAW,IAAI,CAAC,UAAU;EAC/B,MAAM,KAAK;EACX,aAAa,KAAK;EAClB,QAAQ,KAAK;EACb,MAAM,OAAOC,UAAoD;GAC/D,MAAM,SAAS,MAAM,KAAK,QAAQ,MAAM;AACxC,UAAO,KAAK,UAAU,OAAO;EAC9B;CACF,GAAE;AACJ"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
//#region src/adapters/mcp.ts
|
|
4
|
+
function toMCPTools(agentTools) {
|
|
5
|
+
return agentTools.map((tool) => ({
|
|
6
|
+
name: tool.name,
|
|
7
|
+
description: tool.description,
|
|
8
|
+
inputSchema: {
|
|
9
|
+
...tool.parameters,
|
|
10
|
+
type: "object"
|
|
11
|
+
}
|
|
12
|
+
}));
|
|
13
|
+
}
|
|
14
|
+
async function executeMCPToolCall(agentTools, toolName, toolInput) {
|
|
15
|
+
const tool = agentTools.find((t) => t.name === toolName);
|
|
16
|
+
if (!tool) throw new Error(`Tool not found: ${toolName}`);
|
|
17
|
+
return tool.execute(toolInput);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.executeMCPToolCall = executeMCPToolCall
|
|
22
|
+
exports.toMCPTools = toMCPTools
|
|
23
|
+
//# sourceMappingURL=mcp.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.cjs","names":["agentTools: readonly AgentTool[]","toolName: string","toolInput: Record<string, unknown>"],"sources":["../../src/adapters/mcp.ts"],"sourcesContent":["import type { AgentTool, JsonSchema } from '../agent-tools.js';\n\nexport type { AgentTool, JsonSchema };\n\nexport interface MCPInputSchema {\n readonly type: 'object';\n readonly properties?: Readonly<Record<string, JsonSchema>>;\n readonly required?: readonly string[];\n readonly description?: string;\n}\n\nexport interface MCPTool {\n readonly name: string;\n readonly description: string;\n readonly inputSchema: MCPInputSchema & JsonSchema;\n}\n\nexport function toMCPTools(agentTools: readonly AgentTool[]): readonly MCPTool[] {\n return agentTools.map((tool) => ({\n name: tool.name,\n description: tool.description,\n inputSchema: { ...tool.parameters, type: 'object' as const },\n }));\n}\n\nexport async function executeMCPToolCall(\n agentTools: readonly AgentTool[],\n toolName: string,\n toolInput: Record<string, unknown>,\n): Promise<unknown> {\n const tool = agentTools.find((t) => t.name === toolName);\n if (!tool) {\n throw new Error(`Tool not found: ${toolName}`);\n }\n return tool.execute(toolInput);\n}\n"],"mappings":";;;AAiBA,SAAgB,WAAWA,YAAsD;AAC/E,QAAO,WAAW,IAAI,CAAC,UAAU;EAC/B,MAAM,KAAK;EACX,aAAa,KAAK;EAClB,aAAa;GAAE,GAAG,KAAK;GAAY,MAAM;EAAmB;CAC7D,GAAE;AACJ;AAED,eAAsB,mBACpBA,YACAC,UACAC,WACkB;CAClB,MAAM,OAAO,WAAW,KAAK,CAAC,MAAM,EAAE,SAAS,SAAS;AACxD,MAAK,KACH,OAAM,IAAI,OAAO,kBAAkB,SAAS;AAE9C,QAAO,KAAK,QAAQ,UAAU;AAC/B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AgentTool, JsonSchema } from "../agent-tools-o2PEyGqh.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/adapters/mcp.d.ts
|
|
4
|
+
interface MCPInputSchema {
|
|
5
|
+
readonly type: 'object';
|
|
6
|
+
readonly properties?: Readonly<Record<string, JsonSchema>>;
|
|
7
|
+
readonly required?: readonly string[];
|
|
8
|
+
readonly description?: string;
|
|
9
|
+
}
|
|
10
|
+
interface MCPTool {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly description: string;
|
|
13
|
+
readonly inputSchema: MCPInputSchema & JsonSchema;
|
|
14
|
+
}
|
|
15
|
+
declare function toMCPTools(agentTools: readonly AgentTool[]): readonly MCPTool[];
|
|
16
|
+
declare function executeMCPToolCall(agentTools: readonly AgentTool[], toolName: string, toolInput: Record<string, unknown>): Promise<unknown>;
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
20
|
+
|
|
21
|
+
export { AgentTool, JsonSchema, MCPInputSchema, MCPTool, executeMCPToolCall, toMCPTools };
|
|
22
|
+
//# sourceMappingURL=mcp.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.cts","names":[],"sources":["../../src/adapters/mcp.ts"],"sourcesContent":null,"mappings":";;;UAIiB,cAAA;EAAA,SAAA,IAAA,EAAA,QAAc;EAAA,SAAA,UAAA,CAAA,EAEP,QAFO,CAEE,MAFF,CAAA,MAAA,EAEiB,UAFjB,CAAA,CAAA;EAAA,SAEiB,QAAA,CAAA,EAAA,SAAA,MAAA,EAAA;EAAU,SAAzB,WAAA,CAAA,EAAA,MAAA;;AAAD,UAKf,OAAA,CALe;EAKf,SAAA,IAAO,EAAA,MAAA;EAAA,SAAA,WAAA,EAAA,MAAA;EAAA,SAGA,WAAA,EAAA,cAAA,GAAiB,UAAjB;;AAA2B,iBAGnC,UAAA,CAHmC,UAAA,EAAA,SAGH,SAHG,EAAA,CAAA,EAAA,SAGoB,OAHpB,EAAA;AAGnC,iBAQM,kBAAA,CARI,UAAA,EAAA,SASH,SATG,EAAA,EAAA,QAAA,EAAA,MAAA,EAAA,SAAA,EAWb,MAXa,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,EAYvB,OAZuB,CAAA,OAAA,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AgentTool, JsonSchema } from "../agent-tools-DBOuuSEd.js";
|
|
2
|
+
|
|
3
|
+
//#region src/adapters/mcp.d.ts
|
|
4
|
+
interface MCPInputSchema {
|
|
5
|
+
readonly type: 'object';
|
|
6
|
+
readonly properties?: Readonly<Record<string, JsonSchema>>;
|
|
7
|
+
readonly required?: readonly string[];
|
|
8
|
+
readonly description?: string;
|
|
9
|
+
}
|
|
10
|
+
interface MCPTool {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly description: string;
|
|
13
|
+
readonly inputSchema: MCPInputSchema & JsonSchema;
|
|
14
|
+
}
|
|
15
|
+
declare function toMCPTools(agentTools: readonly AgentTool[]): readonly MCPTool[];
|
|
16
|
+
declare function executeMCPToolCall(agentTools: readonly AgentTool[], toolName: string, toolInput: Record<string, unknown>): Promise<unknown>;
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
20
|
+
|
|
21
|
+
export { AgentTool, JsonSchema, MCPInputSchema, MCPTool, executeMCPToolCall, toMCPTools };
|
|
22
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","names":[],"sources":["../../src/adapters/mcp.ts"],"sourcesContent":null,"mappings":";;;UAIiB,cAAA;EAAA,SAAA,IAAA,EAAA,QAAc;EAAA,SAAA,UAAA,CAAA,EAEP,QAFO,CAEE,MAFF,CAAA,MAAA,EAEiB,UAFjB,CAAA,CAAA;EAAA,SAEiB,QAAA,CAAA,EAAA,SAAA,MAAA,EAAA;EAAU,SAAzB,WAAA,CAAA,EAAA,MAAA;;AAAD,UAKf,OAAA,CALe;EAKf,SAAA,IAAO,EAAA,MAAA;EAAA,SAAA,WAAA,EAAA,MAAA;EAAA,SAGA,WAAA,EAAA,cAAA,GAAiB,UAAjB;;AAA2B,iBAGnC,UAAA,CAHmC,UAAA,EAAA,SAGH,SAHG,EAAA,CAAA,EAAA,SAGoB,OAHpB,EAAA;AAGnC,iBAQM,kBAAA,CARI,UAAA,EAAA,SASH,SATG,EAAA,EAAA,QAAA,EAAA,MAAA,EAAA,SAAA,EAWb,MAXa,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,EAYvB,OAZuB,CAAA,OAAA,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/adapters/mcp.ts
|
|
2
|
+
function toMCPTools(agentTools) {
|
|
3
|
+
return agentTools.map((tool) => ({
|
|
4
|
+
name: tool.name,
|
|
5
|
+
description: tool.description,
|
|
6
|
+
inputSchema: {
|
|
7
|
+
...tool.parameters,
|
|
8
|
+
type: "object"
|
|
9
|
+
}
|
|
10
|
+
}));
|
|
11
|
+
}
|
|
12
|
+
async function executeMCPToolCall(agentTools, toolName, toolInput) {
|
|
13
|
+
const tool = agentTools.find((t) => t.name === toolName);
|
|
14
|
+
if (!tool) throw new Error(`Tool not found: ${toolName}`);
|
|
15
|
+
return tool.execute(toolInput);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { executeMCPToolCall, toMCPTools };
|
|
20
|
+
//# sourceMappingURL=mcp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.js","names":["agentTools: readonly AgentTool[]","toolName: string","toolInput: Record<string, unknown>"],"sources":["../../src/adapters/mcp.ts"],"sourcesContent":["import type { AgentTool, JsonSchema } from '../agent-tools.js';\n\nexport type { AgentTool, JsonSchema };\n\nexport interface MCPInputSchema {\n readonly type: 'object';\n readonly properties?: Readonly<Record<string, JsonSchema>>;\n readonly required?: readonly string[];\n readonly description?: string;\n}\n\nexport interface MCPTool {\n readonly name: string;\n readonly description: string;\n readonly inputSchema: MCPInputSchema & JsonSchema;\n}\n\nexport function toMCPTools(agentTools: readonly AgentTool[]): readonly MCPTool[] {\n return agentTools.map((tool) => ({\n name: tool.name,\n description: tool.description,\n inputSchema: { ...tool.parameters, type: 'object' as const },\n }));\n}\n\nexport async function executeMCPToolCall(\n agentTools: readonly AgentTool[],\n toolName: string,\n toolInput: Record<string, unknown>,\n): Promise<unknown> {\n const tool = agentTools.find((t) => t.name === toolName);\n if (!tool) {\n throw new Error(`Tool not found: ${toolName}`);\n }\n return tool.execute(toolInput);\n}\n"],"mappings":";AAiBA,SAAgB,WAAWA,YAAsD;AAC/E,QAAO,WAAW,IAAI,CAAC,UAAU;EAC/B,MAAM,KAAK;EACX,aAAa,KAAK;EAClB,aAAa;GAAE,GAAG,KAAK;GAAY,MAAM;EAAmB;CAC7D,GAAE;AACJ;AAED,eAAsB,mBACpBA,YACAC,UACAC,WACkB;CAClB,MAAM,OAAO,WAAW,KAAK,CAAC,MAAM,EAAE,SAAS,SAAS;AACxD,MAAK,KACH,OAAM,IAAI,OAAO,kBAAkB,SAAS;AAE9C,QAAO,KAAK,QAAQ,UAAU;AAC/B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
//#region src/adapters/openai.ts
|
|
4
|
+
function toOpenAITools(agentTools) {
|
|
5
|
+
return agentTools.map((tool) => ({
|
|
6
|
+
type: "function",
|
|
7
|
+
function: {
|
|
8
|
+
name: tool.name,
|
|
9
|
+
description: tool.description,
|
|
10
|
+
parameters: tool.parameters
|
|
11
|
+
}
|
|
12
|
+
}));
|
|
13
|
+
}
|
|
14
|
+
async function executeOpenAIToolCall(agentTools, toolName, toolInput) {
|
|
15
|
+
const tool = agentTools.find((t) => t.name === toolName);
|
|
16
|
+
if (!tool) throw new Error(`Tool not found: ${toolName}`);
|
|
17
|
+
return tool.execute(toolInput);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.executeOpenAIToolCall = executeOpenAIToolCall
|
|
22
|
+
exports.toOpenAITools = toOpenAITools
|
|
23
|
+
//# sourceMappingURL=openai.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai.cjs","names":["agentTools: readonly AgentTool[]","toolName: string","toolInput: Record<string, unknown>"],"sources":["../../src/adapters/openai.ts"],"sourcesContent":["import type { AgentTool, JsonSchema } from '../agent-tools.js';\n\nexport type { AgentTool, JsonSchema };\n\nexport interface OpenAIFunction {\n readonly name: string;\n readonly description: string;\n readonly parameters: JsonSchema;\n}\n\nexport interface OpenAITool {\n readonly type: 'function';\n readonly function: OpenAIFunction;\n}\n\nexport function toOpenAITools(agentTools: readonly AgentTool[]): readonly OpenAITool[] {\n return agentTools.map((tool) => ({\n type: 'function' as const,\n function: {\n name: tool.name,\n description: tool.description,\n parameters: tool.parameters,\n },\n }));\n}\n\nexport async function executeOpenAIToolCall(\n agentTools: readonly AgentTool[],\n toolName: string,\n toolInput: Record<string, unknown>,\n): Promise<unknown> {\n const tool = agentTools.find((t) => t.name === toolName);\n if (!tool) {\n throw new Error(`Tool not found: ${toolName}`);\n }\n return tool.execute(toolInput);\n}\n"],"mappings":";;;AAeA,SAAgB,cAAcA,YAAyD;AACrF,QAAO,WAAW,IAAI,CAAC,UAAU;EAC/B,MAAM;EACN,UAAU;GACR,MAAM,KAAK;GACX,aAAa,KAAK;GAClB,YAAY,KAAK;EAClB;CACF,GAAE;AACJ;AAED,eAAsB,sBACpBA,YACAC,UACAC,WACkB;CAClB,MAAM,OAAO,WAAW,KAAK,CAAC,MAAM,EAAE,SAAS,SAAS;AACxD,MAAK,KACH,OAAM,IAAI,OAAO,kBAAkB,SAAS;AAE9C,QAAO,KAAK,QAAQ,UAAU;AAC/B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AgentTool, JsonSchema } from "../agent-tools-o2PEyGqh.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/adapters/openai.d.ts
|
|
4
|
+
interface OpenAIFunction {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly description: string;
|
|
7
|
+
readonly parameters: JsonSchema;
|
|
8
|
+
}
|
|
9
|
+
interface OpenAITool {
|
|
10
|
+
readonly type: 'function';
|
|
11
|
+
readonly function: OpenAIFunction;
|
|
12
|
+
}
|
|
13
|
+
declare function toOpenAITools(agentTools: readonly AgentTool[]): readonly OpenAITool[];
|
|
14
|
+
declare function executeOpenAIToolCall(agentTools: readonly AgentTool[], toolName: string, toolInput: Record<string, unknown>): Promise<unknown>;
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
//# sourceMappingURL=openai.d.ts.map
|
|
18
|
+
|
|
19
|
+
export { AgentTool, JsonSchema, OpenAIFunction, OpenAITool, executeOpenAIToolCall, toOpenAITools };
|
|
20
|
+
//# sourceMappingURL=openai.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai.d.cts","names":[],"sources":["../../src/adapters/openai.ts"],"sourcesContent":null,"mappings":";;;UAIiB,cAAA;EAAA,SAAA,IAAA,EAAA,MAAc;EAMd,SAAA,WAAU,EAAA,MAEN;EAGL,SAAA,UAAa,EARN,UAQM;;AAAsB,UALlC,UAAA,CAKkC;EAAS,SAAc,IAAA,EAAA,UAAA;EAAU,SAAA,QAAA,EAH/D,cAG+D;AAWpF;AAA2C,iBAX3B,aAAA,CAW2B,UAAA,EAAA,SAXQ,SAWR,EAAA,CAAA,EAAA,SAX+B,UAW/B,EAAA;AACpB,iBADD,qBAAA,CACC,UAAA,EAAA,SAAA,SAAA,EAAA,EAAA,QAAA,EAAA,MAAA,EAAA,SAAA,EAEV,MAFU,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,EAGpB,OAHoB,CAAA,OAAA,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AgentTool, JsonSchema } from "../agent-tools-DBOuuSEd.js";
|
|
2
|
+
|
|
3
|
+
//#region src/adapters/openai.d.ts
|
|
4
|
+
interface OpenAIFunction {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly description: string;
|
|
7
|
+
readonly parameters: JsonSchema;
|
|
8
|
+
}
|
|
9
|
+
interface OpenAITool {
|
|
10
|
+
readonly type: 'function';
|
|
11
|
+
readonly function: OpenAIFunction;
|
|
12
|
+
}
|
|
13
|
+
declare function toOpenAITools(agentTools: readonly AgentTool[]): readonly OpenAITool[];
|
|
14
|
+
declare function executeOpenAIToolCall(agentTools: readonly AgentTool[], toolName: string, toolInput: Record<string, unknown>): Promise<unknown>;
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
//# sourceMappingURL=openai.d.ts.map
|
|
18
|
+
|
|
19
|
+
export { AgentTool, JsonSchema, OpenAIFunction, OpenAITool, executeOpenAIToolCall, toOpenAITools };
|
|
20
|
+
//# sourceMappingURL=openai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai.d.ts","names":[],"sources":["../../src/adapters/openai.ts"],"sourcesContent":null,"mappings":";;;UAIiB,cAAA;EAAA,SAAA,IAAA,EAAA,MAAc;EAMd,SAAA,WAAU,EAAA,MAEN;EAGL,SAAA,UAAa,EARN,UAQM;;AAAsB,UALlC,UAAA,CAKkC;EAAS,SAAc,IAAA,EAAA,UAAA;EAAU,SAAA,QAAA,EAH/D,cAG+D;AAWpF;AAA2C,iBAX3B,aAAA,CAW2B,UAAA,EAAA,SAXQ,SAWR,EAAA,CAAA,EAAA,SAX+B,UAW/B,EAAA;AACpB,iBADD,qBAAA,CACC,UAAA,EAAA,SAAA,SAAA,EAAA,EAAA,QAAA,EAAA,MAAA,EAAA,SAAA,EAEV,MAFU,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,EAGpB,OAHoB,CAAA,OAAA,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/adapters/openai.ts
|
|
2
|
+
function toOpenAITools(agentTools) {
|
|
3
|
+
return agentTools.map((tool) => ({
|
|
4
|
+
type: "function",
|
|
5
|
+
function: {
|
|
6
|
+
name: tool.name,
|
|
7
|
+
description: tool.description,
|
|
8
|
+
parameters: tool.parameters
|
|
9
|
+
}
|
|
10
|
+
}));
|
|
11
|
+
}
|
|
12
|
+
async function executeOpenAIToolCall(agentTools, toolName, toolInput) {
|
|
13
|
+
const tool = agentTools.find((t) => t.name === toolName);
|
|
14
|
+
if (!tool) throw new Error(`Tool not found: ${toolName}`);
|
|
15
|
+
return tool.execute(toolInput);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { executeOpenAIToolCall, toOpenAITools };
|
|
20
|
+
//# sourceMappingURL=openai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai.js","names":["agentTools: readonly AgentTool[]","toolName: string","toolInput: Record<string, unknown>"],"sources":["../../src/adapters/openai.ts"],"sourcesContent":["import type { AgentTool, JsonSchema } from '../agent-tools.js';\n\nexport type { AgentTool, JsonSchema };\n\nexport interface OpenAIFunction {\n readonly name: string;\n readonly description: string;\n readonly parameters: JsonSchema;\n}\n\nexport interface OpenAITool {\n readonly type: 'function';\n readonly function: OpenAIFunction;\n}\n\nexport function toOpenAITools(agentTools: readonly AgentTool[]): readonly OpenAITool[] {\n return agentTools.map((tool) => ({\n type: 'function' as const,\n function: {\n name: tool.name,\n description: tool.description,\n parameters: tool.parameters,\n },\n }));\n}\n\nexport async function executeOpenAIToolCall(\n agentTools: readonly AgentTool[],\n toolName: string,\n toolInput: Record<string, unknown>,\n): Promise<unknown> {\n const tool = agentTools.find((t) => t.name === toolName);\n if (!tool) {\n throw new Error(`Tool not found: ${toolName}`);\n }\n return tool.execute(toolInput);\n}\n"],"mappings":";AAeA,SAAgB,cAAcA,YAAyD;AACrF,QAAO,WAAW,IAAI,CAAC,UAAU;EAC/B,MAAM;EACN,UAAU;GACR,MAAM,KAAK;GACX,aAAa,KAAK;GAClB,YAAY,KAAK;EAClB;CACF,GAAE;AACJ;AAED,eAAsB,sBACpBA,YACAC,UACAC,WACkB;CAClB,MAAM,OAAO,WAAW,KAAK,CAAC,MAAM,EAAE,SAAS,SAAS;AACxD,MAAK,KACH,OAAM,IAAI,OAAO,kBAAkB,SAAS;AAE9C,QAAO,KAAK,QAAQ,UAAU;AAC/B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
//#region src/adapters/vercel-ai.ts
|
|
4
|
+
function toVercelAITools(agentTools) {
|
|
5
|
+
return Object.fromEntries(agentTools.map((tool) => [tool.name, {
|
|
6
|
+
description: tool.description,
|
|
7
|
+
parameters: tool.parameters,
|
|
8
|
+
execute: async (args) => {
|
|
9
|
+
const result = await tool.execute(args);
|
|
10
|
+
return JSON.stringify(result);
|
|
11
|
+
}
|
|
12
|
+
}]));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
exports.toVercelAITools = toVercelAITools
|
|
17
|
+
//# sourceMappingURL=vercel-ai.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercel-ai.cjs","names":["agentTools: readonly AgentTool[]","args: Record<string, unknown>"],"sources":["../../src/adapters/vercel-ai.ts"],"sourcesContent":["import type { AgentTool, JsonSchema } from '../agent-tools.js';\n\nexport type { AgentTool, JsonSchema };\n\nexport interface VercelAIToolDefinition {\n readonly description: string;\n readonly parameters: JsonSchema;\n readonly execute: (args: Record<string, unknown>) => Promise<string>;\n}\n\nexport type VercelAIToolMap = Record<string, VercelAIToolDefinition>;\n\nexport function toVercelAITools(agentTools: readonly AgentTool[]): VercelAIToolMap {\n return Object.fromEntries(\n agentTools.map((tool) => [\n tool.name,\n {\n description: tool.description,\n parameters: tool.parameters,\n execute: async (args: Record<string, unknown>): Promise<string> => {\n const result = await tool.execute(args);\n return JSON.stringify(result);\n },\n },\n ]),\n );\n}\n"],"mappings":";;;AAYA,SAAgB,gBAAgBA,YAAmD;AACjF,QAAO,OAAO,YACZ,WAAW,IAAI,CAAC,SAAS,CACvB,KAAK,MACL;EACE,aAAa,KAAK;EAClB,YAAY,KAAK;EACjB,SAAS,OAAOC,SAAmD;GACjE,MAAM,SAAS,MAAM,KAAK,QAAQ,KAAK;AACvC,UAAO,KAAK,UAAU,OAAO;EAC9B;CACF,CACF,EAAC,CACH;AACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AgentTool, JsonSchema } from "../agent-tools-o2PEyGqh.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/adapters/vercel-ai.d.ts
|
|
4
|
+
interface VercelAIToolDefinition {
|
|
5
|
+
readonly description: string;
|
|
6
|
+
readonly parameters: JsonSchema;
|
|
7
|
+
readonly execute: (args: Record<string, unknown>) => Promise<string>;
|
|
8
|
+
}
|
|
9
|
+
type VercelAIToolMap = Record<string, VercelAIToolDefinition>;
|
|
10
|
+
declare function toVercelAITools(agentTools: readonly AgentTool[]): VercelAIToolMap;
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
//# sourceMappingURL=vercel-ai.d.ts.map
|
|
14
|
+
|
|
15
|
+
export { AgentTool, JsonSchema, VercelAIToolDefinition, VercelAIToolMap, toVercelAITools };
|
|
16
|
+
//# sourceMappingURL=vercel-ai.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercel-ai.d.cts","names":[],"sources":["../../src/adapters/vercel-ai.ts"],"sourcesContent":null,"mappings":";;;UAIiB,sBAAA;EAAA,SAAA,WAAA,EAAA,MAAsB;EAAA,SAAA,UAAA,EAEhB,UAFgB;EAAA,SAEhB,OAAA,EAAA,CAAA,IAAA,EACI,MADJ,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,GACgC,OADhC,CAAA,MAAA,CAAA;;AACgC,KAG3C,eAAA,GAAkB,MAHyB,CAAA,MAAA,EAGV,sBAHU,CAAA;AAAO,iBAK9C,eAAA,CAL8C,UAAA,EAAA,SAKT,SALS,EAAA,CAAA,EAKK,eALL;;;AAG9D"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AgentTool, JsonSchema } from "../agent-tools-DBOuuSEd.js";
|
|
2
|
+
|
|
3
|
+
//#region src/adapters/vercel-ai.d.ts
|
|
4
|
+
interface VercelAIToolDefinition {
|
|
5
|
+
readonly description: string;
|
|
6
|
+
readonly parameters: JsonSchema;
|
|
7
|
+
readonly execute: (args: Record<string, unknown>) => Promise<string>;
|
|
8
|
+
}
|
|
9
|
+
type VercelAIToolMap = Record<string, VercelAIToolDefinition>;
|
|
10
|
+
declare function toVercelAITools(agentTools: readonly AgentTool[]): VercelAIToolMap;
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
//# sourceMappingURL=vercel-ai.d.ts.map
|
|
14
|
+
|
|
15
|
+
export { AgentTool, JsonSchema, VercelAIToolDefinition, VercelAIToolMap, toVercelAITools };
|
|
16
|
+
//# sourceMappingURL=vercel-ai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercel-ai.d.ts","names":[],"sources":["../../src/adapters/vercel-ai.ts"],"sourcesContent":null,"mappings":";;;UAIiB,sBAAA;EAAA,SAAA,WAAA,EAAA,MAAsB;EAAA,SAAA,UAAA,EAEhB,UAFgB;EAAA,SAEhB,OAAA,EAAA,CAAA,IAAA,EACI,MADJ,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,GACgC,OADhC,CAAA,MAAA,CAAA;;AACgC,KAG3C,eAAA,GAAkB,MAHyB,CAAA,MAAA,EAGV,sBAHU,CAAA;AAAO,iBAK9C,eAAA,CAL8C,UAAA,EAAA,SAKT,SALS,EAAA,CAAA,EAKK,eALL;;;AAG9D"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/adapters/vercel-ai.ts
|
|
2
|
+
function toVercelAITools(agentTools) {
|
|
3
|
+
return Object.fromEntries(agentTools.map((tool) => [tool.name, {
|
|
4
|
+
description: tool.description,
|
|
5
|
+
parameters: tool.parameters,
|
|
6
|
+
execute: async (args) => {
|
|
7
|
+
const result = await tool.execute(args);
|
|
8
|
+
return JSON.stringify(result);
|
|
9
|
+
}
|
|
10
|
+
}]));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { toVercelAITools };
|
|
15
|
+
//# sourceMappingURL=vercel-ai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercel-ai.js","names":["agentTools: readonly AgentTool[]","args: Record<string, unknown>"],"sources":["../../src/adapters/vercel-ai.ts"],"sourcesContent":["import type { AgentTool, JsonSchema } from '../agent-tools.js';\n\nexport type { AgentTool, JsonSchema };\n\nexport interface VercelAIToolDefinition {\n readonly description: string;\n readonly parameters: JsonSchema;\n readonly execute: (args: Record<string, unknown>) => Promise<string>;\n}\n\nexport type VercelAIToolMap = Record<string, VercelAIToolDefinition>;\n\nexport function toVercelAITools(agentTools: readonly AgentTool[]): VercelAIToolMap {\n return Object.fromEntries(\n agentTools.map((tool) => [\n tool.name,\n {\n description: tool.description,\n parameters: tool.parameters,\n execute: async (args: Record<string, unknown>): Promise<string> => {\n const result = await tool.execute(args);\n return JSON.stringify(result);\n },\n },\n ]),\n );\n}\n"],"mappings":";AAYA,SAAgB,gBAAgBA,YAAmD;AACjF,QAAO,OAAO,YACZ,WAAW,IAAI,CAAC,SAAS,CACvB,KAAK,MACL;EACE,aAAa,KAAK;EAClB,YAAY,KAAK;EACjB,SAAS,OAAOC,SAAmD;GACjE,MAAM,SAAS,MAAM,KAAK,QAAQ,KAAK;AACvC,UAAO,KAAK,UAAU,OAAO;EAC9B;CACF,CACF,EAAC,CACH;AACF"}
|