@lov3kaizen/agentsea-core 0.4.0 → 0.5.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/index.d.mts +151 -35
- package/dist/index.d.ts +151 -35
- package/dist/index.js +276 -83
- package/dist/index.mjs +276 -83
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -95,7 +95,11 @@ __export(index_exports, {
|
|
|
95
95
|
VoiceType: () => import_agentsea_types.VoiceType,
|
|
96
96
|
Workflow: () => Workflow,
|
|
97
97
|
WorkflowFactory: () => WorkflowFactory,
|
|
98
|
+
calculatorClient: () => calculatorClient,
|
|
99
|
+
calculatorDef: () => calculatorDef,
|
|
100
|
+
calculatorServer: () => calculatorServer,
|
|
98
101
|
calculatorTool: () => calculatorTool,
|
|
102
|
+
clientTool: () => clientTool,
|
|
99
103
|
createACPTools: () => createACPTools,
|
|
100
104
|
createAnthropicProvider: () => createAnthropicProvider,
|
|
101
105
|
createGeminiProvider: () => createGeminiProvider,
|
|
@@ -114,14 +118,19 @@ __export(index_exports, {
|
|
|
114
118
|
globalMetrics: () => globalMetrics,
|
|
115
119
|
globalTracer: () => globalTracer,
|
|
116
120
|
httpRequestTool: () => httpRequestTool,
|
|
121
|
+
hybridTool: () => hybridTool,
|
|
117
122
|
mcpToolToAgenticTool: () => mcpToolToAgenticTool,
|
|
118
123
|
n8nExecuteWorkflowTool: () => n8nExecuteWorkflowTool,
|
|
119
124
|
n8nGetExecutionTool: () => n8nGetExecutionTool,
|
|
120
125
|
n8nGetWorkflowTool: () => n8nGetWorkflowTool,
|
|
121
126
|
n8nListWorkflowsTool: () => n8nListWorkflowsTool,
|
|
122
127
|
n8nTriggerWebhookTool: () => n8nTriggerWebhookTool,
|
|
128
|
+
serverTool: () => serverTool,
|
|
123
129
|
stringTransformTool: () => stringTransformTool,
|
|
124
|
-
textSummaryTool: () => textSummaryTool
|
|
130
|
+
textSummaryTool: () => textSummaryTool,
|
|
131
|
+
toLegacyTool: () => toLegacyTool,
|
|
132
|
+
toLegacyTools: () => toLegacyTools,
|
|
133
|
+
toolDefinition: () => toolDefinition
|
|
125
134
|
});
|
|
126
135
|
module.exports = __toCommonJS(index_exports);
|
|
127
136
|
|
|
@@ -383,6 +392,7 @@ var Agent = class {
|
|
|
383
392
|
// Will be set by execute()
|
|
384
393
|
iterations: this.iterationCount
|
|
385
394
|
},
|
|
395
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
386
396
|
finishReason: llmResponse.stopReason
|
|
387
397
|
};
|
|
388
398
|
if (this.config.outputFormat && this.config.outputFormat !== "text") {
|
|
@@ -779,7 +789,7 @@ var httpRequestTool = {
|
|
|
779
789
|
url: import_zod2.z.string().url().describe("The URL to make the request to"),
|
|
780
790
|
method: import_zod2.z.enum(["GET", "POST", "PUT", "DELETE", "PATCH"]).default("GET").describe("HTTP method"),
|
|
781
791
|
headers: import_zod2.z.record(import_zod2.z.string()).optional().describe("HTTP headers"),
|
|
782
|
-
body: import_zod2.z.
|
|
792
|
+
body: import_zod2.z.unknown().optional().describe("Request body (for POST, PUT, PATCH)"),
|
|
783
793
|
timeout: import_zod2.z.number().optional().default(1e4).describe("Request timeout in milliseconds")
|
|
784
794
|
}),
|
|
785
795
|
execute: async (params) => {
|
|
@@ -1237,7 +1247,7 @@ var n8nExecuteWorkflowTool = {
|
|
|
1237
1247
|
description: "Execute an n8n workflow by ID or name. Optionally pass input data to the workflow.",
|
|
1238
1248
|
parameters: import_zod6.z.object({
|
|
1239
1249
|
workflowId: import_zod6.z.string().describe("The ID of the workflow to execute"),
|
|
1240
|
-
data: import_zod6.z.
|
|
1250
|
+
data: import_zod6.z.unknown().optional().describe("Input data to pass to the workflow execution"),
|
|
1241
1251
|
waitForCompletion: import_zod6.z.boolean().default(true).describe("Wait for workflow execution to complete before returning"),
|
|
1242
1252
|
apiKey: import_zod6.z.string().optional().describe("n8n API key (or use N8N_API_KEY env var)"),
|
|
1243
1253
|
baseUrl: import_zod6.z.string().optional().describe("n8n base URL (or use N8N_BASE_URL env var)")
|
|
@@ -1354,7 +1364,7 @@ var n8nTriggerWebhookTool = {
|
|
|
1354
1364
|
parameters: import_zod6.z.object({
|
|
1355
1365
|
webhookPath: import_zod6.z.string().describe('The webhook path (e.g., "webhook/my-workflow")'),
|
|
1356
1366
|
method: import_zod6.z.enum(["GET", "POST", "PUT", "DELETE", "PATCH"]).default("POST").describe("HTTP method for the webhook"),
|
|
1357
|
-
data: import_zod6.z.
|
|
1367
|
+
data: import_zod6.z.unknown().optional().describe("Data to send to the webhook"),
|
|
1358
1368
|
headers: import_zod6.z.record(import_zod6.z.string()).optional().describe("Additional headers to include"),
|
|
1359
1369
|
baseUrl: import_zod6.z.string().optional().describe("n8n base URL (or use N8N_BASE_URL env var)")
|
|
1360
1370
|
}),
|
|
@@ -1445,6 +1455,162 @@ async function pollExecutionStatus(executionId, apiKey, baseUrl, maxAttempts = 3
|
|
|
1445
1455
|
);
|
|
1446
1456
|
}
|
|
1447
1457
|
|
|
1458
|
+
// src/tools/built-in/calculator.isomorphic.ts
|
|
1459
|
+
var import_zod8 = require("zod");
|
|
1460
|
+
|
|
1461
|
+
// src/tools/tool-definition.ts
|
|
1462
|
+
var import_zod7 = require("zod");
|
|
1463
|
+
function toolDefinition(options) {
|
|
1464
|
+
const {
|
|
1465
|
+
name,
|
|
1466
|
+
description,
|
|
1467
|
+
inputSchema,
|
|
1468
|
+
outputSchema = import_zod7.z.unknown(),
|
|
1469
|
+
needsApproval = false,
|
|
1470
|
+
retryConfig
|
|
1471
|
+
} = options;
|
|
1472
|
+
const createServerTool = (execute) => {
|
|
1473
|
+
const wrappedExecute = async (input, context) => {
|
|
1474
|
+
const validatedInput = inputSchema.parse(input);
|
|
1475
|
+
const result = await execute(validatedInput, context);
|
|
1476
|
+
if (outputSchema) {
|
|
1477
|
+
return outputSchema.parse(result);
|
|
1478
|
+
}
|
|
1479
|
+
return result;
|
|
1480
|
+
};
|
|
1481
|
+
return {
|
|
1482
|
+
name,
|
|
1483
|
+
description,
|
|
1484
|
+
inputSchema,
|
|
1485
|
+
outputSchema,
|
|
1486
|
+
needsApproval,
|
|
1487
|
+
retryConfig,
|
|
1488
|
+
environment: "server",
|
|
1489
|
+
execute: wrappedExecute,
|
|
1490
|
+
toTool() {
|
|
1491
|
+
return {
|
|
1492
|
+
name,
|
|
1493
|
+
description,
|
|
1494
|
+
parameters: inputSchema,
|
|
1495
|
+
execute: wrappedExecute,
|
|
1496
|
+
retryConfig
|
|
1497
|
+
};
|
|
1498
|
+
}
|
|
1499
|
+
};
|
|
1500
|
+
};
|
|
1501
|
+
const createClientTool = (execute) => {
|
|
1502
|
+
const wrappedExecute = async (input, context) => {
|
|
1503
|
+
const validatedInput = inputSchema.parse(input);
|
|
1504
|
+
const result = await execute(validatedInput, context);
|
|
1505
|
+
if (outputSchema) {
|
|
1506
|
+
return outputSchema.parse(result);
|
|
1507
|
+
}
|
|
1508
|
+
return result;
|
|
1509
|
+
};
|
|
1510
|
+
return {
|
|
1511
|
+
name,
|
|
1512
|
+
description,
|
|
1513
|
+
inputSchema,
|
|
1514
|
+
outputSchema,
|
|
1515
|
+
needsApproval,
|
|
1516
|
+
retryConfig,
|
|
1517
|
+
environment: "client",
|
|
1518
|
+
execute: wrappedExecute,
|
|
1519
|
+
toTool() {
|
|
1520
|
+
return {
|
|
1521
|
+
name,
|
|
1522
|
+
description,
|
|
1523
|
+
parameters: inputSchema,
|
|
1524
|
+
execute: wrappedExecute,
|
|
1525
|
+
retryConfig
|
|
1526
|
+
};
|
|
1527
|
+
}
|
|
1528
|
+
};
|
|
1529
|
+
};
|
|
1530
|
+
return {
|
|
1531
|
+
name,
|
|
1532
|
+
description,
|
|
1533
|
+
inputSchema,
|
|
1534
|
+
outputSchema,
|
|
1535
|
+
needsApproval,
|
|
1536
|
+
retryConfig,
|
|
1537
|
+
server: createServerTool,
|
|
1538
|
+
client: createClientTool,
|
|
1539
|
+
toTool(execute) {
|
|
1540
|
+
return createServerTool(execute).toTool();
|
|
1541
|
+
}
|
|
1542
|
+
};
|
|
1543
|
+
}
|
|
1544
|
+
function hybridTool(options) {
|
|
1545
|
+
const def = toolDefinition(options);
|
|
1546
|
+
const serverTool2 = def.server(options.server);
|
|
1547
|
+
const clientTool2 = def.client(options.client);
|
|
1548
|
+
return {
|
|
1549
|
+
name: def.name,
|
|
1550
|
+
description: def.description,
|
|
1551
|
+
inputSchema: def.inputSchema,
|
|
1552
|
+
outputSchema: def.outputSchema,
|
|
1553
|
+
needsApproval: def.needsApproval,
|
|
1554
|
+
retryConfig: def.retryConfig,
|
|
1555
|
+
server: serverTool2,
|
|
1556
|
+
client: clientTool2,
|
|
1557
|
+
toTool() {
|
|
1558
|
+
return serverTool2.toTool();
|
|
1559
|
+
}
|
|
1560
|
+
};
|
|
1561
|
+
}
|
|
1562
|
+
function serverTool(options) {
|
|
1563
|
+
return toolDefinition(options).server(options.execute);
|
|
1564
|
+
}
|
|
1565
|
+
function clientTool(options) {
|
|
1566
|
+
return toolDefinition(options).client(options.execute);
|
|
1567
|
+
}
|
|
1568
|
+
function toLegacyTool(tool) {
|
|
1569
|
+
return tool.toTool();
|
|
1570
|
+
}
|
|
1571
|
+
function toLegacyTools(tools) {
|
|
1572
|
+
return tools.map(toLegacyTool);
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
// src/tools/built-in/calculator.isomorphic.ts
|
|
1576
|
+
var calculatorInputSchema = import_zod8.z.object({
|
|
1577
|
+
operation: import_zod8.z.enum(["add", "subtract", "multiply", "divide"]).describe("The arithmetic operation to perform"),
|
|
1578
|
+
a: import_zod8.z.number().describe("First number"),
|
|
1579
|
+
b: import_zod8.z.number().describe("Second number")
|
|
1580
|
+
});
|
|
1581
|
+
var calculatorOutputSchema = import_zod8.z.object({
|
|
1582
|
+
result: import_zod8.z.number().describe("The result of the calculation")
|
|
1583
|
+
});
|
|
1584
|
+
var calculatorDef = toolDefinition({
|
|
1585
|
+
name: "calculator",
|
|
1586
|
+
description: "Perform basic arithmetic operations (add, subtract, multiply, divide)",
|
|
1587
|
+
inputSchema: calculatorInputSchema,
|
|
1588
|
+
outputSchema: calculatorOutputSchema
|
|
1589
|
+
});
|
|
1590
|
+
function calculate(operation, a, b) {
|
|
1591
|
+
switch (operation) {
|
|
1592
|
+
case "add":
|
|
1593
|
+
return { result: a + b };
|
|
1594
|
+
case "subtract":
|
|
1595
|
+
return { result: a - b };
|
|
1596
|
+
case "multiply":
|
|
1597
|
+
return { result: a * b };
|
|
1598
|
+
case "divide":
|
|
1599
|
+
if (b === 0) {
|
|
1600
|
+
throw new Error("Cannot divide by zero");
|
|
1601
|
+
}
|
|
1602
|
+
return { result: a / b };
|
|
1603
|
+
default:
|
|
1604
|
+
throw new Error(`Unknown operation: ${operation}`);
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
var calculatorServer = calculatorDef.server(({ operation, a, b }) => {
|
|
1608
|
+
return Promise.resolve(calculate(operation, a, b));
|
|
1609
|
+
});
|
|
1610
|
+
var calculatorClient = calculatorDef.client(({ operation, a, b }) => {
|
|
1611
|
+
return calculate(operation, a, b);
|
|
1612
|
+
});
|
|
1613
|
+
|
|
1448
1614
|
// src/providers/anthropic.ts
|
|
1449
1615
|
var import_sdk = __toESM(require("@anthropic-ai/sdk"));
|
|
1450
1616
|
var import_zod_to_json_schema = require("zod-to-json-schema");
|
|
@@ -1471,6 +1637,7 @@ var AnthropicProvider = class {
|
|
|
1471
1637
|
temperature: config.temperature,
|
|
1472
1638
|
system: config.systemPrompt,
|
|
1473
1639
|
messages: anthropicMessages,
|
|
1640
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1474
1641
|
tools,
|
|
1475
1642
|
top_p: config.topP,
|
|
1476
1643
|
stop_sequences: config.stopSequences
|
|
@@ -1502,6 +1669,7 @@ var AnthropicProvider = class {
|
|
|
1502
1669
|
temperature: config.temperature,
|
|
1503
1670
|
system: config.systemPrompt,
|
|
1504
1671
|
messages: anthropicMessages,
|
|
1672
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1505
1673
|
tools,
|
|
1506
1674
|
top_p: config.topP,
|
|
1507
1675
|
stop_sequences: config.stopSequences
|
|
@@ -1565,6 +1733,7 @@ var AnthropicProvider = class {
|
|
|
1565
1733
|
type: "tool_result",
|
|
1566
1734
|
tool_use_id: message.toolCallId || "",
|
|
1567
1735
|
content: message.content
|
|
1736
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1568
1737
|
});
|
|
1569
1738
|
}
|
|
1570
1739
|
}
|
|
@@ -1822,8 +1991,9 @@ var GeminiProvider = class {
|
|
|
1822
1991
|
*/
|
|
1823
1992
|
parseToolCalls(response) {
|
|
1824
1993
|
const toolCalls = [];
|
|
1825
|
-
|
|
1826
|
-
|
|
1994
|
+
const rawResponse = response.rawResponse;
|
|
1995
|
+
if (rawResponse?.functionCalls) {
|
|
1996
|
+
for (const call of rawResponse.functionCalls()) {
|
|
1827
1997
|
toolCalls.push({
|
|
1828
1998
|
id: `call-${Date.now()}-${Math.random()}`,
|
|
1829
1999
|
tool: call.name,
|
|
@@ -2013,7 +2183,7 @@ var OllamaProvider = class {
|
|
|
2013
2183
|
parseToolCalls(response) {
|
|
2014
2184
|
const rawResponse = response.rawResponse;
|
|
2015
2185
|
const toolCalls = [];
|
|
2016
|
-
if (rawResponse
|
|
2186
|
+
if (rawResponse?.message?.tool_calls) {
|
|
2017
2187
|
for (const toolCall of rawResponse.message.tool_calls) {
|
|
2018
2188
|
toolCalls.push({
|
|
2019
2189
|
id: toolCall.id || Math.random().toString(36),
|
|
@@ -2027,6 +2197,7 @@ var OllamaProvider = class {
|
|
|
2027
2197
|
/**
|
|
2028
2198
|
* Convert generic messages to Ollama format
|
|
2029
2199
|
*/
|
|
2200
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2030
2201
|
convertMessages(messages, systemPrompt) {
|
|
2031
2202
|
const converted = [];
|
|
2032
2203
|
if (systemPrompt) {
|
|
@@ -2061,6 +2232,7 @@ var OllamaProvider = class {
|
|
|
2061
2232
|
/**
|
|
2062
2233
|
* Make a request to Ollama API
|
|
2063
2234
|
*/
|
|
2235
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2064
2236
|
async makeRequest(endpoint, payload) {
|
|
2065
2237
|
const controller = new AbortController();
|
|
2066
2238
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
@@ -3926,7 +4098,7 @@ var MCPClient = class extends import_events2.EventEmitter {
|
|
|
3926
4098
|
};
|
|
3927
4099
|
|
|
3928
4100
|
// src/mcp/tool-adapter.ts
|
|
3929
|
-
var
|
|
4101
|
+
var import_zod9 = require("zod");
|
|
3930
4102
|
function mcpToolToAgenticTool(mcpTool, client) {
|
|
3931
4103
|
const zodSchema = jsonSchemaToZod(mcpTool.inputSchema);
|
|
3932
4104
|
return {
|
|
@@ -3934,7 +4106,10 @@ function mcpToolToAgenticTool(mcpTool, client) {
|
|
|
3934
4106
|
description: mcpTool.description,
|
|
3935
4107
|
parameters: zodSchema,
|
|
3936
4108
|
execute: async (params, _context) => {
|
|
3937
|
-
const response = await client.callTool(
|
|
4109
|
+
const response = await client.callTool(
|
|
4110
|
+
mcpTool.name,
|
|
4111
|
+
params
|
|
4112
|
+
);
|
|
3938
4113
|
if (response.isError) {
|
|
3939
4114
|
throw new Error(
|
|
3940
4115
|
`MCP tool error: ${response.content[0]?.text || "Unknown error"}`
|
|
@@ -3958,26 +4133,30 @@ function jsonSchemaToZod(schema) {
|
|
|
3958
4133
|
let zodType;
|
|
3959
4134
|
switch (propSchema.type) {
|
|
3960
4135
|
case "string":
|
|
3961
|
-
zodType =
|
|
3962
|
-
if (propSchema.description) {
|
|
4136
|
+
zodType = import_zod9.z.string();
|
|
4137
|
+
if (typeof propSchema.description === "string") {
|
|
3963
4138
|
zodType = zodType.describe(propSchema.description);
|
|
3964
4139
|
}
|
|
3965
4140
|
break;
|
|
3966
4141
|
case "number":
|
|
3967
|
-
zodType =
|
|
3968
|
-
if (propSchema.description) {
|
|
4142
|
+
zodType = import_zod9.z.number();
|
|
4143
|
+
if (typeof propSchema.description === "string") {
|
|
3969
4144
|
zodType = zodType.describe(propSchema.description);
|
|
3970
4145
|
}
|
|
3971
4146
|
break;
|
|
3972
4147
|
case "boolean":
|
|
3973
|
-
zodType =
|
|
3974
|
-
if (propSchema.description) {
|
|
4148
|
+
zodType = import_zod9.z.boolean();
|
|
4149
|
+
if (typeof propSchema.description === "string") {
|
|
3975
4150
|
zodType = zodType.describe(propSchema.description);
|
|
3976
4151
|
}
|
|
3977
4152
|
break;
|
|
3978
4153
|
case "array":
|
|
3979
|
-
zodType =
|
|
3980
|
-
|
|
4154
|
+
zodType = import_zod9.z.array(
|
|
4155
|
+
jsonSchemaToZod(
|
|
4156
|
+
propSchema.items || {}
|
|
4157
|
+
)
|
|
4158
|
+
);
|
|
4159
|
+
if (typeof propSchema.description === "string") {
|
|
3981
4160
|
zodType = zodType.describe(propSchema.description);
|
|
3982
4161
|
}
|
|
3983
4162
|
break;
|
|
@@ -3985,16 +4164,17 @@ function jsonSchemaToZod(schema) {
|
|
|
3985
4164
|
zodType = jsonSchemaToZod(propSchema);
|
|
3986
4165
|
break;
|
|
3987
4166
|
default:
|
|
3988
|
-
zodType =
|
|
4167
|
+
zodType = import_zod9.z.any();
|
|
3989
4168
|
}
|
|
3990
|
-
|
|
4169
|
+
const required = schema.required;
|
|
4170
|
+
if (!required?.includes(key)) {
|
|
3991
4171
|
zodType = zodType.optional();
|
|
3992
4172
|
}
|
|
3993
4173
|
shape[key] = zodType;
|
|
3994
4174
|
}
|
|
3995
|
-
return
|
|
4175
|
+
return import_zod9.z.object(shape);
|
|
3996
4176
|
}
|
|
3997
|
-
return
|
|
4177
|
+
return import_zod9.z.any();
|
|
3998
4178
|
}
|
|
3999
4179
|
|
|
4000
4180
|
// src/mcp/registry.ts
|
|
@@ -4391,7 +4571,7 @@ var ACPClient = class {
|
|
|
4391
4571
|
};
|
|
4392
4572
|
|
|
4393
4573
|
// src/acp/tools.ts
|
|
4394
|
-
var
|
|
4574
|
+
var import_zod10 = require("zod");
|
|
4395
4575
|
function createACPTools(client) {
|
|
4396
4576
|
return [
|
|
4397
4577
|
createSearchProductsTool(client),
|
|
@@ -4414,15 +4594,15 @@ function createSearchProductsTool(client) {
|
|
|
4414
4594
|
return {
|
|
4415
4595
|
name: "acp_search_products",
|
|
4416
4596
|
description: "Search for products in the commerce catalog. Supports filtering by query text, category, price range, and sorting.",
|
|
4417
|
-
parameters:
|
|
4418
|
-
query:
|
|
4419
|
-
category:
|
|
4420
|
-
minPrice:
|
|
4421
|
-
maxPrice:
|
|
4422
|
-
limit:
|
|
4423
|
-
offset:
|
|
4424
|
-
sortBy:
|
|
4425
|
-
sortOrder:
|
|
4597
|
+
parameters: import_zod10.z.object({
|
|
4598
|
+
query: import_zod10.z.string().optional().describe("Search query text"),
|
|
4599
|
+
category: import_zod10.z.string().optional().describe("Product category filter"),
|
|
4600
|
+
minPrice: import_zod10.z.number().optional().describe("Minimum price filter"),
|
|
4601
|
+
maxPrice: import_zod10.z.number().optional().describe("Maximum price filter"),
|
|
4602
|
+
limit: import_zod10.z.number().optional().default(10).describe("Maximum number of results"),
|
|
4603
|
+
offset: import_zod10.z.number().optional().default(0).describe("Pagination offset"),
|
|
4604
|
+
sortBy: import_zod10.z.enum(["price", "name", "popularity", "newest"]).optional().describe("Sort field"),
|
|
4605
|
+
sortOrder: import_zod10.z.enum(["asc", "desc"]).optional().default("asc").describe("Sort order")
|
|
4426
4606
|
}),
|
|
4427
4607
|
execute: async (params) => {
|
|
4428
4608
|
const response = await client.searchProducts(params);
|
|
@@ -4441,8 +4621,8 @@ function createGetProductTool(client) {
|
|
|
4441
4621
|
return {
|
|
4442
4622
|
name: "acp_get_product",
|
|
4443
4623
|
description: "Get detailed information about a specific product by its ID.",
|
|
4444
|
-
parameters:
|
|
4445
|
-
productId:
|
|
4624
|
+
parameters: import_zod10.z.object({
|
|
4625
|
+
productId: import_zod10.z.string().describe("Product ID")
|
|
4446
4626
|
}),
|
|
4447
4627
|
execute: async (params) => {
|
|
4448
4628
|
const response = await client.getProduct(params.productId);
|
|
@@ -4457,7 +4637,7 @@ function createCreateCartTool(client) {
|
|
|
4457
4637
|
return {
|
|
4458
4638
|
name: "acp_create_cart",
|
|
4459
4639
|
description: "Create a new shopping cart for the customer. Returns the cart ID for subsequent operations.",
|
|
4460
|
-
parameters:
|
|
4640
|
+
parameters: import_zod10.z.object({}),
|
|
4461
4641
|
execute: async () => {
|
|
4462
4642
|
const response = await client.createCart();
|
|
4463
4643
|
if (response.error) {
|
|
@@ -4471,14 +4651,14 @@ function createAddToCartTool(client) {
|
|
|
4471
4651
|
return {
|
|
4472
4652
|
name: "acp_add_to_cart",
|
|
4473
4653
|
description: "Add a product to the shopping cart with specified quantity.",
|
|
4474
|
-
parameters:
|
|
4475
|
-
cartId:
|
|
4476
|
-
productId:
|
|
4477
|
-
variantId:
|
|
4478
|
-
quantity:
|
|
4479
|
-
price:
|
|
4480
|
-
amount:
|
|
4481
|
-
currency:
|
|
4654
|
+
parameters: import_zod10.z.object({
|
|
4655
|
+
cartId: import_zod10.z.string().describe("Cart ID"),
|
|
4656
|
+
productId: import_zod10.z.string().describe("Product ID to add"),
|
|
4657
|
+
variantId: import_zod10.z.string().optional().describe("Product variant ID"),
|
|
4658
|
+
quantity: import_zod10.z.number().min(1).describe("Quantity to add"),
|
|
4659
|
+
price: import_zod10.z.object({
|
|
4660
|
+
amount: import_zod10.z.number().describe("Price amount"),
|
|
4661
|
+
currency: import_zod10.z.string().describe("Currency code (e.g., USD, EUR)")
|
|
4482
4662
|
}).describe("Product price")
|
|
4483
4663
|
}),
|
|
4484
4664
|
execute: async (params) => {
|
|
@@ -4501,10 +4681,10 @@ function createUpdateCartItemTool(client) {
|
|
|
4501
4681
|
return {
|
|
4502
4682
|
name: "acp_update_cart_item",
|
|
4503
4683
|
description: "Update the quantity of an item in the shopping cart.",
|
|
4504
|
-
parameters:
|
|
4505
|
-
cartId:
|
|
4506
|
-
productId:
|
|
4507
|
-
quantity:
|
|
4684
|
+
parameters: import_zod10.z.object({
|
|
4685
|
+
cartId: import_zod10.z.string().describe("Cart ID"),
|
|
4686
|
+
productId: import_zod10.z.string().describe("Product ID to update"),
|
|
4687
|
+
quantity: import_zod10.z.number().min(0).describe("New quantity (0 to remove)")
|
|
4508
4688
|
}),
|
|
4509
4689
|
execute: async (params) => {
|
|
4510
4690
|
const response = await client.updateCartItem(
|
|
@@ -4525,9 +4705,9 @@ function createRemoveFromCartTool(client) {
|
|
|
4525
4705
|
return {
|
|
4526
4706
|
name: "acp_remove_from_cart",
|
|
4527
4707
|
description: "Remove a product from the shopping cart.",
|
|
4528
|
-
parameters:
|
|
4529
|
-
cartId:
|
|
4530
|
-
productId:
|
|
4708
|
+
parameters: import_zod10.z.object({
|
|
4709
|
+
cartId: import_zod10.z.string().describe("Cart ID"),
|
|
4710
|
+
productId: import_zod10.z.string().describe("Product ID to remove")
|
|
4531
4711
|
}),
|
|
4532
4712
|
execute: async (params) => {
|
|
4533
4713
|
const response = await client.removeFromCart(
|
|
@@ -4547,8 +4727,8 @@ function createGetCartTool(client) {
|
|
|
4547
4727
|
return {
|
|
4548
4728
|
name: "acp_get_cart",
|
|
4549
4729
|
description: "Get the current state of a shopping cart including all items and total amount.",
|
|
4550
|
-
parameters:
|
|
4551
|
-
cartId:
|
|
4730
|
+
parameters: import_zod10.z.object({
|
|
4731
|
+
cartId: import_zod10.z.string().describe("Cart ID")
|
|
4552
4732
|
}),
|
|
4553
4733
|
execute: async (params) => {
|
|
4554
4734
|
const response = await client.getCart(params.cartId);
|
|
@@ -4563,12 +4743,12 @@ function createCheckoutTool(client) {
|
|
|
4563
4743
|
return {
|
|
4564
4744
|
name: "acp_create_checkout",
|
|
4565
4745
|
description: "Create a checkout session from a shopping cart to begin the purchase process.",
|
|
4566
|
-
parameters:
|
|
4567
|
-
cartId:
|
|
4568
|
-
customer:
|
|
4569
|
-
email:
|
|
4570
|
-
name:
|
|
4571
|
-
phone:
|
|
4746
|
+
parameters: import_zod10.z.object({
|
|
4747
|
+
cartId: import_zod10.z.string().describe("Cart ID"),
|
|
4748
|
+
customer: import_zod10.z.object({
|
|
4749
|
+
email: import_zod10.z.string().email().describe("Customer email"),
|
|
4750
|
+
name: import_zod10.z.string().optional().describe("Customer name"),
|
|
4751
|
+
phone: import_zod10.z.string().optional().describe("Customer phone number")
|
|
4572
4752
|
}).optional().describe("Customer information")
|
|
4573
4753
|
}),
|
|
4574
4754
|
execute: async (params) => {
|
|
@@ -4589,15 +4769,15 @@ function createUpdateShippingAddressTool(client) {
|
|
|
4589
4769
|
return {
|
|
4590
4770
|
name: "acp_update_shipping_address",
|
|
4591
4771
|
description: "Update the shipping address for a checkout session.",
|
|
4592
|
-
parameters:
|
|
4593
|
-
sessionId:
|
|
4594
|
-
address:
|
|
4595
|
-
line1:
|
|
4596
|
-
line2:
|
|
4597
|
-
city:
|
|
4598
|
-
state:
|
|
4599
|
-
postalCode:
|
|
4600
|
-
country:
|
|
4772
|
+
parameters: import_zod10.z.object({
|
|
4773
|
+
sessionId: import_zod10.z.string().describe("Checkout session ID"),
|
|
4774
|
+
address: import_zod10.z.object({
|
|
4775
|
+
line1: import_zod10.z.string().describe("Address line 1"),
|
|
4776
|
+
line2: import_zod10.z.string().optional().describe("Address line 2"),
|
|
4777
|
+
city: import_zod10.z.string().describe("City"),
|
|
4778
|
+
state: import_zod10.z.string().optional().describe("State/Province"),
|
|
4779
|
+
postalCode: import_zod10.z.string().describe("Postal/ZIP code"),
|
|
4780
|
+
country: import_zod10.z.string().describe("Country code (e.g., US, GB)")
|
|
4601
4781
|
}).describe("Shipping address")
|
|
4602
4782
|
}),
|
|
4603
4783
|
execute: async (params) => {
|
|
@@ -4618,12 +4798,12 @@ function createUpdatePaymentMethodTool(client) {
|
|
|
4618
4798
|
return {
|
|
4619
4799
|
name: "acp_update_payment_method",
|
|
4620
4800
|
description: "Update the payment method for a checkout session.",
|
|
4621
|
-
parameters:
|
|
4622
|
-
sessionId:
|
|
4623
|
-
paymentMethod:
|
|
4624
|
-
type:
|
|
4625
|
-
token:
|
|
4626
|
-
delegatedProvider:
|
|
4801
|
+
parameters: import_zod10.z.object({
|
|
4802
|
+
sessionId: import_zod10.z.string().describe("Checkout session ID"),
|
|
4803
|
+
paymentMethod: import_zod10.z.object({
|
|
4804
|
+
type: import_zod10.z.enum(["card", "delegated", "wallet", "bank_transfer"]).describe("Payment method type"),
|
|
4805
|
+
token: import_zod10.z.string().optional().describe("Payment token"),
|
|
4806
|
+
delegatedProvider: import_zod10.z.string().optional().describe("Delegated payment provider (e.g., stripe, paypal)")
|
|
4627
4807
|
}).describe("Payment method details")
|
|
4628
4808
|
}),
|
|
4629
4809
|
execute: async (params) => {
|
|
@@ -4644,8 +4824,8 @@ function createCompleteCheckoutTool(client) {
|
|
|
4644
4824
|
return {
|
|
4645
4825
|
name: "acp_complete_checkout",
|
|
4646
4826
|
description: "Complete the checkout process and create an order. This finalizes the purchase.",
|
|
4647
|
-
parameters:
|
|
4648
|
-
sessionId:
|
|
4827
|
+
parameters: import_zod10.z.object({
|
|
4828
|
+
sessionId: import_zod10.z.string().describe("Checkout session ID")
|
|
4649
4829
|
}),
|
|
4650
4830
|
execute: async (params) => {
|
|
4651
4831
|
const response = await client.completeCheckout(params.sessionId);
|
|
@@ -4662,8 +4842,8 @@ function createGetOrderTool(client) {
|
|
|
4662
4842
|
return {
|
|
4663
4843
|
name: "acp_get_order",
|
|
4664
4844
|
description: "Get detailed information about an order by its ID.",
|
|
4665
|
-
parameters:
|
|
4666
|
-
orderId:
|
|
4845
|
+
parameters: import_zod10.z.object({
|
|
4846
|
+
orderId: import_zod10.z.string().describe("Order ID")
|
|
4667
4847
|
}),
|
|
4668
4848
|
execute: async (params) => {
|
|
4669
4849
|
const response = await client.getOrder(params.orderId);
|
|
@@ -4678,8 +4858,8 @@ function createCancelOrderTool(client) {
|
|
|
4678
4858
|
return {
|
|
4679
4859
|
name: "acp_cancel_order",
|
|
4680
4860
|
description: "Cancel an order. Only orders that have not been shipped can be cancelled.",
|
|
4681
|
-
parameters:
|
|
4682
|
-
orderId:
|
|
4861
|
+
parameters: import_zod10.z.object({
|
|
4862
|
+
orderId: import_zod10.z.string().describe("Order ID")
|
|
4683
4863
|
}),
|
|
4684
4864
|
execute: async (params) => {
|
|
4685
4865
|
const response = await client.cancelOrder(params.orderId);
|
|
@@ -4694,8 +4874,8 @@ function createGetOrderTrackingTool(client) {
|
|
|
4694
4874
|
return {
|
|
4695
4875
|
name: "acp_get_order_tracking",
|
|
4696
4876
|
description: "Get shipping tracking information for an order.",
|
|
4697
|
-
parameters:
|
|
4698
|
-
orderId:
|
|
4877
|
+
parameters: import_zod10.z.object({
|
|
4878
|
+
orderId: import_zod10.z.string().describe("Order ID")
|
|
4699
4879
|
}),
|
|
4700
4880
|
execute: async (params) => {
|
|
4701
4881
|
const response = await client.getOrderTracking(params.orderId);
|
|
@@ -5259,12 +5439,14 @@ var OpenAIWhisperProvider = class {
|
|
|
5259
5439
|
text: verboseResponse.text,
|
|
5260
5440
|
language: verboseResponse.language,
|
|
5261
5441
|
duration: verboseResponse.duration,
|
|
5442
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5262
5443
|
segments: verboseResponse.segments?.map((seg) => ({
|
|
5263
5444
|
id: seg.id,
|
|
5264
5445
|
start: seg.start,
|
|
5265
5446
|
end: seg.end,
|
|
5266
5447
|
text: seg.text
|
|
5267
5448
|
})),
|
|
5449
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5268
5450
|
words: verboseResponse.words?.map((word) => ({
|
|
5269
5451
|
word: word.word,
|
|
5270
5452
|
start: word.start,
|
|
@@ -5538,6 +5720,7 @@ var OpenAITTSProvider = class {
|
|
|
5538
5720
|
try {
|
|
5539
5721
|
const response = await this.client.audio.speech.create({
|
|
5540
5722
|
model: config?.model || "tts-1",
|
|
5723
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5541
5724
|
voice: config?.voice || "alloy",
|
|
5542
5725
|
input: text,
|
|
5543
5726
|
speed: config?.speed || 1,
|
|
@@ -5562,6 +5745,7 @@ var OpenAITTSProvider = class {
|
|
|
5562
5745
|
try {
|
|
5563
5746
|
const response = await this.client.audio.speech.create({
|
|
5564
5747
|
model: config?.model || "tts-1",
|
|
5748
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5565
5749
|
voice: config?.voice || "alloy",
|
|
5566
5750
|
input: text,
|
|
5567
5751
|
speed: config?.speed || 1,
|
|
@@ -5996,13 +6180,13 @@ var TenantManager = class {
|
|
|
5996
6180
|
/**
|
|
5997
6181
|
* Get tenant by ID
|
|
5998
6182
|
*/
|
|
5999
|
-
|
|
6183
|
+
getTenant(tenantId) {
|
|
6000
6184
|
return this.storage.getTenant(tenantId);
|
|
6001
6185
|
}
|
|
6002
6186
|
/**
|
|
6003
6187
|
* Get tenant by slug
|
|
6004
6188
|
*/
|
|
6005
|
-
|
|
6189
|
+
getTenantBySlug(slug) {
|
|
6006
6190
|
return this.storage.getTenantBySlug(slug);
|
|
6007
6191
|
}
|
|
6008
6192
|
/**
|
|
@@ -6350,7 +6534,11 @@ var MemoryTenantStorage = class {
|
|
|
6350
6534
|
VoiceType,
|
|
6351
6535
|
Workflow,
|
|
6352
6536
|
WorkflowFactory,
|
|
6537
|
+
calculatorClient,
|
|
6538
|
+
calculatorDef,
|
|
6539
|
+
calculatorServer,
|
|
6353
6540
|
calculatorTool,
|
|
6541
|
+
clientTool,
|
|
6354
6542
|
createACPTools,
|
|
6355
6543
|
createAnthropicProvider,
|
|
6356
6544
|
createGeminiProvider,
|
|
@@ -6369,12 +6557,17 @@ var MemoryTenantStorage = class {
|
|
|
6369
6557
|
globalMetrics,
|
|
6370
6558
|
globalTracer,
|
|
6371
6559
|
httpRequestTool,
|
|
6560
|
+
hybridTool,
|
|
6372
6561
|
mcpToolToAgenticTool,
|
|
6373
6562
|
n8nExecuteWorkflowTool,
|
|
6374
6563
|
n8nGetExecutionTool,
|
|
6375
6564
|
n8nGetWorkflowTool,
|
|
6376
6565
|
n8nListWorkflowsTool,
|
|
6377
6566
|
n8nTriggerWebhookTool,
|
|
6567
|
+
serverTool,
|
|
6378
6568
|
stringTransformTool,
|
|
6379
|
-
textSummaryTool
|
|
6569
|
+
textSummaryTool,
|
|
6570
|
+
toLegacyTool,
|
|
6571
|
+
toLegacyTools,
|
|
6572
|
+
toolDefinition
|
|
6380
6573
|
});
|