@lov3kaizen/agentsea-core 0.4.0 → 0.5.1
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.mjs
CHANGED
|
@@ -83,7 +83,11 @@ __export(index_exports, {
|
|
|
83
83
|
VoiceType: () => VoiceType,
|
|
84
84
|
Workflow: () => Workflow,
|
|
85
85
|
WorkflowFactory: () => WorkflowFactory,
|
|
86
|
+
calculatorClient: () => calculatorClient,
|
|
87
|
+
calculatorDef: () => calculatorDef,
|
|
88
|
+
calculatorServer: () => calculatorServer,
|
|
86
89
|
calculatorTool: () => calculatorTool,
|
|
90
|
+
clientTool: () => clientTool,
|
|
87
91
|
createACPTools: () => createACPTools,
|
|
88
92
|
createAnthropicProvider: () => createAnthropicProvider,
|
|
89
93
|
createGeminiProvider: () => createGeminiProvider,
|
|
@@ -102,14 +106,19 @@ __export(index_exports, {
|
|
|
102
106
|
globalMetrics: () => globalMetrics,
|
|
103
107
|
globalTracer: () => globalTracer,
|
|
104
108
|
httpRequestTool: () => httpRequestTool,
|
|
109
|
+
hybridTool: () => hybridTool,
|
|
105
110
|
mcpToolToAgenticTool: () => mcpToolToAgenticTool,
|
|
106
111
|
n8nExecuteWorkflowTool: () => n8nExecuteWorkflowTool,
|
|
107
112
|
n8nGetExecutionTool: () => n8nGetExecutionTool,
|
|
108
113
|
n8nGetWorkflowTool: () => n8nGetWorkflowTool,
|
|
109
114
|
n8nListWorkflowsTool: () => n8nListWorkflowsTool,
|
|
110
115
|
n8nTriggerWebhookTool: () => n8nTriggerWebhookTool,
|
|
116
|
+
serverTool: () => serverTool,
|
|
111
117
|
stringTransformTool: () => stringTransformTool,
|
|
112
|
-
textSummaryTool: () => textSummaryTool
|
|
118
|
+
textSummaryTool: () => textSummaryTool,
|
|
119
|
+
toLegacyTool: () => toLegacyTool,
|
|
120
|
+
toLegacyTools: () => toLegacyTools,
|
|
121
|
+
toolDefinition: () => toolDefinition
|
|
113
122
|
});
|
|
114
123
|
|
|
115
124
|
// src/types/index.ts
|
|
@@ -371,6 +380,7 @@ var Agent = class {
|
|
|
371
380
|
// Will be set by execute()
|
|
372
381
|
iterations: this.iterationCount
|
|
373
382
|
},
|
|
383
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
374
384
|
finishReason: llmResponse.stopReason
|
|
375
385
|
};
|
|
376
386
|
if (this.config.outputFormat && this.config.outputFormat !== "text") {
|
|
@@ -767,7 +777,7 @@ var httpRequestTool = {
|
|
|
767
777
|
url: z2.string().url().describe("The URL to make the request to"),
|
|
768
778
|
method: z2.enum(["GET", "POST", "PUT", "DELETE", "PATCH"]).default("GET").describe("HTTP method"),
|
|
769
779
|
headers: z2.record(z2.string()).optional().describe("HTTP headers"),
|
|
770
|
-
body: z2.
|
|
780
|
+
body: z2.unknown().optional().describe("Request body (for POST, PUT, PATCH)"),
|
|
771
781
|
timeout: z2.number().optional().default(1e4).describe("Request timeout in milliseconds")
|
|
772
782
|
}),
|
|
773
783
|
execute: async (params) => {
|
|
@@ -1225,7 +1235,7 @@ var n8nExecuteWorkflowTool = {
|
|
|
1225
1235
|
description: "Execute an n8n workflow by ID or name. Optionally pass input data to the workflow.",
|
|
1226
1236
|
parameters: z6.object({
|
|
1227
1237
|
workflowId: z6.string().describe("The ID of the workflow to execute"),
|
|
1228
|
-
data: z6.
|
|
1238
|
+
data: z6.unknown().optional().describe("Input data to pass to the workflow execution"),
|
|
1229
1239
|
waitForCompletion: z6.boolean().default(true).describe("Wait for workflow execution to complete before returning"),
|
|
1230
1240
|
apiKey: z6.string().optional().describe("n8n API key (or use N8N_API_KEY env var)"),
|
|
1231
1241
|
baseUrl: z6.string().optional().describe("n8n base URL (or use N8N_BASE_URL env var)")
|
|
@@ -1342,7 +1352,7 @@ var n8nTriggerWebhookTool = {
|
|
|
1342
1352
|
parameters: z6.object({
|
|
1343
1353
|
webhookPath: z6.string().describe('The webhook path (e.g., "webhook/my-workflow")'),
|
|
1344
1354
|
method: z6.enum(["GET", "POST", "PUT", "DELETE", "PATCH"]).default("POST").describe("HTTP method for the webhook"),
|
|
1345
|
-
data: z6.
|
|
1355
|
+
data: z6.unknown().optional().describe("Data to send to the webhook"),
|
|
1346
1356
|
headers: z6.record(z6.string()).optional().describe("Additional headers to include"),
|
|
1347
1357
|
baseUrl: z6.string().optional().describe("n8n base URL (or use N8N_BASE_URL env var)")
|
|
1348
1358
|
}),
|
|
@@ -1433,6 +1443,162 @@ async function pollExecutionStatus(executionId, apiKey, baseUrl, maxAttempts = 3
|
|
|
1433
1443
|
);
|
|
1434
1444
|
}
|
|
1435
1445
|
|
|
1446
|
+
// src/tools/built-in/calculator.isomorphic.ts
|
|
1447
|
+
import { z as z8 } from "zod";
|
|
1448
|
+
|
|
1449
|
+
// src/tools/tool-definition.ts
|
|
1450
|
+
import { z as z7 } from "zod";
|
|
1451
|
+
function toolDefinition(options) {
|
|
1452
|
+
const {
|
|
1453
|
+
name,
|
|
1454
|
+
description,
|
|
1455
|
+
inputSchema,
|
|
1456
|
+
outputSchema = z7.unknown(),
|
|
1457
|
+
needsApproval = false,
|
|
1458
|
+
retryConfig
|
|
1459
|
+
} = options;
|
|
1460
|
+
const createServerTool = (execute) => {
|
|
1461
|
+
const wrappedExecute = async (input, context) => {
|
|
1462
|
+
const validatedInput = inputSchema.parse(input);
|
|
1463
|
+
const result = await execute(validatedInput, context);
|
|
1464
|
+
if (outputSchema) {
|
|
1465
|
+
return outputSchema.parse(result);
|
|
1466
|
+
}
|
|
1467
|
+
return result;
|
|
1468
|
+
};
|
|
1469
|
+
return {
|
|
1470
|
+
name,
|
|
1471
|
+
description,
|
|
1472
|
+
inputSchema,
|
|
1473
|
+
outputSchema,
|
|
1474
|
+
needsApproval,
|
|
1475
|
+
retryConfig,
|
|
1476
|
+
environment: "server",
|
|
1477
|
+
execute: wrappedExecute,
|
|
1478
|
+
toTool() {
|
|
1479
|
+
return {
|
|
1480
|
+
name,
|
|
1481
|
+
description,
|
|
1482
|
+
parameters: inputSchema,
|
|
1483
|
+
execute: wrappedExecute,
|
|
1484
|
+
retryConfig
|
|
1485
|
+
};
|
|
1486
|
+
}
|
|
1487
|
+
};
|
|
1488
|
+
};
|
|
1489
|
+
const createClientTool = (execute) => {
|
|
1490
|
+
const wrappedExecute = async (input, context) => {
|
|
1491
|
+
const validatedInput = inputSchema.parse(input);
|
|
1492
|
+
const result = await execute(validatedInput, context);
|
|
1493
|
+
if (outputSchema) {
|
|
1494
|
+
return outputSchema.parse(result);
|
|
1495
|
+
}
|
|
1496
|
+
return result;
|
|
1497
|
+
};
|
|
1498
|
+
return {
|
|
1499
|
+
name,
|
|
1500
|
+
description,
|
|
1501
|
+
inputSchema,
|
|
1502
|
+
outputSchema,
|
|
1503
|
+
needsApproval,
|
|
1504
|
+
retryConfig,
|
|
1505
|
+
environment: "client",
|
|
1506
|
+
execute: wrappedExecute,
|
|
1507
|
+
toTool() {
|
|
1508
|
+
return {
|
|
1509
|
+
name,
|
|
1510
|
+
description,
|
|
1511
|
+
parameters: inputSchema,
|
|
1512
|
+
execute: wrappedExecute,
|
|
1513
|
+
retryConfig
|
|
1514
|
+
};
|
|
1515
|
+
}
|
|
1516
|
+
};
|
|
1517
|
+
};
|
|
1518
|
+
return {
|
|
1519
|
+
name,
|
|
1520
|
+
description,
|
|
1521
|
+
inputSchema,
|
|
1522
|
+
outputSchema,
|
|
1523
|
+
needsApproval,
|
|
1524
|
+
retryConfig,
|
|
1525
|
+
server: createServerTool,
|
|
1526
|
+
client: createClientTool,
|
|
1527
|
+
toTool(execute) {
|
|
1528
|
+
return createServerTool(execute).toTool();
|
|
1529
|
+
}
|
|
1530
|
+
};
|
|
1531
|
+
}
|
|
1532
|
+
function hybridTool(options) {
|
|
1533
|
+
const def = toolDefinition(options);
|
|
1534
|
+
const serverTool2 = def.server(options.server);
|
|
1535
|
+
const clientTool2 = def.client(options.client);
|
|
1536
|
+
return {
|
|
1537
|
+
name: def.name,
|
|
1538
|
+
description: def.description,
|
|
1539
|
+
inputSchema: def.inputSchema,
|
|
1540
|
+
outputSchema: def.outputSchema,
|
|
1541
|
+
needsApproval: def.needsApproval,
|
|
1542
|
+
retryConfig: def.retryConfig,
|
|
1543
|
+
server: serverTool2,
|
|
1544
|
+
client: clientTool2,
|
|
1545
|
+
toTool() {
|
|
1546
|
+
return serverTool2.toTool();
|
|
1547
|
+
}
|
|
1548
|
+
};
|
|
1549
|
+
}
|
|
1550
|
+
function serverTool(options) {
|
|
1551
|
+
return toolDefinition(options).server(options.execute);
|
|
1552
|
+
}
|
|
1553
|
+
function clientTool(options) {
|
|
1554
|
+
return toolDefinition(options).client(options.execute);
|
|
1555
|
+
}
|
|
1556
|
+
function toLegacyTool(tool) {
|
|
1557
|
+
return tool.toTool();
|
|
1558
|
+
}
|
|
1559
|
+
function toLegacyTools(tools) {
|
|
1560
|
+
return tools.map(toLegacyTool);
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1563
|
+
// src/tools/built-in/calculator.isomorphic.ts
|
|
1564
|
+
var calculatorInputSchema = z8.object({
|
|
1565
|
+
operation: z8.enum(["add", "subtract", "multiply", "divide"]).describe("The arithmetic operation to perform"),
|
|
1566
|
+
a: z8.number().describe("First number"),
|
|
1567
|
+
b: z8.number().describe("Second number")
|
|
1568
|
+
});
|
|
1569
|
+
var calculatorOutputSchema = z8.object({
|
|
1570
|
+
result: z8.number().describe("The result of the calculation")
|
|
1571
|
+
});
|
|
1572
|
+
var calculatorDef = toolDefinition({
|
|
1573
|
+
name: "calculator",
|
|
1574
|
+
description: "Perform basic arithmetic operations (add, subtract, multiply, divide)",
|
|
1575
|
+
inputSchema: calculatorInputSchema,
|
|
1576
|
+
outputSchema: calculatorOutputSchema
|
|
1577
|
+
});
|
|
1578
|
+
function calculate(operation, a, b) {
|
|
1579
|
+
switch (operation) {
|
|
1580
|
+
case "add":
|
|
1581
|
+
return { result: a + b };
|
|
1582
|
+
case "subtract":
|
|
1583
|
+
return { result: a - b };
|
|
1584
|
+
case "multiply":
|
|
1585
|
+
return { result: a * b };
|
|
1586
|
+
case "divide":
|
|
1587
|
+
if (b === 0) {
|
|
1588
|
+
throw new Error("Cannot divide by zero");
|
|
1589
|
+
}
|
|
1590
|
+
return { result: a / b };
|
|
1591
|
+
default:
|
|
1592
|
+
throw new Error(`Unknown operation: ${operation}`);
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
var calculatorServer = calculatorDef.server(({ operation, a, b }) => {
|
|
1596
|
+
return Promise.resolve(calculate(operation, a, b));
|
|
1597
|
+
});
|
|
1598
|
+
var calculatorClient = calculatorDef.client(({ operation, a, b }) => {
|
|
1599
|
+
return calculate(operation, a, b);
|
|
1600
|
+
});
|
|
1601
|
+
|
|
1436
1602
|
// src/providers/anthropic.ts
|
|
1437
1603
|
import Anthropic from "@anthropic-ai/sdk";
|
|
1438
1604
|
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
@@ -1459,6 +1625,7 @@ var AnthropicProvider = class {
|
|
|
1459
1625
|
temperature: config.temperature,
|
|
1460
1626
|
system: config.systemPrompt,
|
|
1461
1627
|
messages: anthropicMessages,
|
|
1628
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1462
1629
|
tools,
|
|
1463
1630
|
top_p: config.topP,
|
|
1464
1631
|
stop_sequences: config.stopSequences
|
|
@@ -1490,6 +1657,7 @@ var AnthropicProvider = class {
|
|
|
1490
1657
|
temperature: config.temperature,
|
|
1491
1658
|
system: config.systemPrompt,
|
|
1492
1659
|
messages: anthropicMessages,
|
|
1660
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1493
1661
|
tools,
|
|
1494
1662
|
top_p: config.topP,
|
|
1495
1663
|
stop_sequences: config.stopSequences
|
|
@@ -1553,6 +1721,7 @@ var AnthropicProvider = class {
|
|
|
1553
1721
|
type: "tool_result",
|
|
1554
1722
|
tool_use_id: message.toolCallId || "",
|
|
1555
1723
|
content: message.content
|
|
1724
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1556
1725
|
});
|
|
1557
1726
|
}
|
|
1558
1727
|
}
|
|
@@ -1812,8 +1981,9 @@ var GeminiProvider = class {
|
|
|
1812
1981
|
*/
|
|
1813
1982
|
parseToolCalls(response) {
|
|
1814
1983
|
const toolCalls = [];
|
|
1815
|
-
|
|
1816
|
-
|
|
1984
|
+
const rawResponse = response.rawResponse;
|
|
1985
|
+
if (rawResponse?.functionCalls) {
|
|
1986
|
+
for (const call of rawResponse.functionCalls()) {
|
|
1817
1987
|
toolCalls.push({
|
|
1818
1988
|
id: `call-${Date.now()}-${Math.random()}`,
|
|
1819
1989
|
tool: call.name,
|
|
@@ -2003,7 +2173,7 @@ var OllamaProvider = class {
|
|
|
2003
2173
|
parseToolCalls(response) {
|
|
2004
2174
|
const rawResponse = response.rawResponse;
|
|
2005
2175
|
const toolCalls = [];
|
|
2006
|
-
if (rawResponse
|
|
2176
|
+
if (rawResponse?.message?.tool_calls) {
|
|
2007
2177
|
for (const toolCall of rawResponse.message.tool_calls) {
|
|
2008
2178
|
toolCalls.push({
|
|
2009
2179
|
id: toolCall.id || Math.random().toString(36),
|
|
@@ -2017,6 +2187,7 @@ var OllamaProvider = class {
|
|
|
2017
2187
|
/**
|
|
2018
2188
|
* Convert generic messages to Ollama format
|
|
2019
2189
|
*/
|
|
2190
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2020
2191
|
convertMessages(messages, systemPrompt) {
|
|
2021
2192
|
const converted = [];
|
|
2022
2193
|
if (systemPrompt) {
|
|
@@ -2051,6 +2222,7 @@ var OllamaProvider = class {
|
|
|
2051
2222
|
/**
|
|
2052
2223
|
* Make a request to Ollama API
|
|
2053
2224
|
*/
|
|
2225
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2054
2226
|
async makeRequest(endpoint, payload) {
|
|
2055
2227
|
const controller = new AbortController();
|
|
2056
2228
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
@@ -3916,7 +4088,7 @@ var MCPClient = class extends EventEmitter2 {
|
|
|
3916
4088
|
};
|
|
3917
4089
|
|
|
3918
4090
|
// src/mcp/tool-adapter.ts
|
|
3919
|
-
import { z as
|
|
4091
|
+
import { z as z9 } from "zod";
|
|
3920
4092
|
function mcpToolToAgenticTool(mcpTool, client) {
|
|
3921
4093
|
const zodSchema = jsonSchemaToZod(mcpTool.inputSchema);
|
|
3922
4094
|
return {
|
|
@@ -3924,7 +4096,10 @@ function mcpToolToAgenticTool(mcpTool, client) {
|
|
|
3924
4096
|
description: mcpTool.description,
|
|
3925
4097
|
parameters: zodSchema,
|
|
3926
4098
|
execute: async (params, _context) => {
|
|
3927
|
-
const response = await client.callTool(
|
|
4099
|
+
const response = await client.callTool(
|
|
4100
|
+
mcpTool.name,
|
|
4101
|
+
params
|
|
4102
|
+
);
|
|
3928
4103
|
if (response.isError) {
|
|
3929
4104
|
throw new Error(
|
|
3930
4105
|
`MCP tool error: ${response.content[0]?.text || "Unknown error"}`
|
|
@@ -3948,26 +4123,30 @@ function jsonSchemaToZod(schema) {
|
|
|
3948
4123
|
let zodType;
|
|
3949
4124
|
switch (propSchema.type) {
|
|
3950
4125
|
case "string":
|
|
3951
|
-
zodType =
|
|
3952
|
-
if (propSchema.description) {
|
|
4126
|
+
zodType = z9.string();
|
|
4127
|
+
if (typeof propSchema.description === "string") {
|
|
3953
4128
|
zodType = zodType.describe(propSchema.description);
|
|
3954
4129
|
}
|
|
3955
4130
|
break;
|
|
3956
4131
|
case "number":
|
|
3957
|
-
zodType =
|
|
3958
|
-
if (propSchema.description) {
|
|
4132
|
+
zodType = z9.number();
|
|
4133
|
+
if (typeof propSchema.description === "string") {
|
|
3959
4134
|
zodType = zodType.describe(propSchema.description);
|
|
3960
4135
|
}
|
|
3961
4136
|
break;
|
|
3962
4137
|
case "boolean":
|
|
3963
|
-
zodType =
|
|
3964
|
-
if (propSchema.description) {
|
|
4138
|
+
zodType = z9.boolean();
|
|
4139
|
+
if (typeof propSchema.description === "string") {
|
|
3965
4140
|
zodType = zodType.describe(propSchema.description);
|
|
3966
4141
|
}
|
|
3967
4142
|
break;
|
|
3968
4143
|
case "array":
|
|
3969
|
-
zodType =
|
|
3970
|
-
|
|
4144
|
+
zodType = z9.array(
|
|
4145
|
+
jsonSchemaToZod(
|
|
4146
|
+
propSchema.items || {}
|
|
4147
|
+
)
|
|
4148
|
+
);
|
|
4149
|
+
if (typeof propSchema.description === "string") {
|
|
3971
4150
|
zodType = zodType.describe(propSchema.description);
|
|
3972
4151
|
}
|
|
3973
4152
|
break;
|
|
@@ -3975,16 +4154,17 @@ function jsonSchemaToZod(schema) {
|
|
|
3975
4154
|
zodType = jsonSchemaToZod(propSchema);
|
|
3976
4155
|
break;
|
|
3977
4156
|
default:
|
|
3978
|
-
zodType =
|
|
4157
|
+
zodType = z9.any();
|
|
3979
4158
|
}
|
|
3980
|
-
|
|
4159
|
+
const required = schema.required;
|
|
4160
|
+
if (!required?.includes(key)) {
|
|
3981
4161
|
zodType = zodType.optional();
|
|
3982
4162
|
}
|
|
3983
4163
|
shape[key] = zodType;
|
|
3984
4164
|
}
|
|
3985
|
-
return
|
|
4165
|
+
return z9.object(shape);
|
|
3986
4166
|
}
|
|
3987
|
-
return
|
|
4167
|
+
return z9.any();
|
|
3988
4168
|
}
|
|
3989
4169
|
|
|
3990
4170
|
// src/mcp/registry.ts
|
|
@@ -4381,7 +4561,7 @@ var ACPClient = class {
|
|
|
4381
4561
|
};
|
|
4382
4562
|
|
|
4383
4563
|
// src/acp/tools.ts
|
|
4384
|
-
import { z as
|
|
4564
|
+
import { z as z10 } from "zod";
|
|
4385
4565
|
function createACPTools(client) {
|
|
4386
4566
|
return [
|
|
4387
4567
|
createSearchProductsTool(client),
|
|
@@ -4404,15 +4584,15 @@ function createSearchProductsTool(client) {
|
|
|
4404
4584
|
return {
|
|
4405
4585
|
name: "acp_search_products",
|
|
4406
4586
|
description: "Search for products in the commerce catalog. Supports filtering by query text, category, price range, and sorting.",
|
|
4407
|
-
parameters:
|
|
4408
|
-
query:
|
|
4409
|
-
category:
|
|
4410
|
-
minPrice:
|
|
4411
|
-
maxPrice:
|
|
4412
|
-
limit:
|
|
4413
|
-
offset:
|
|
4414
|
-
sortBy:
|
|
4415
|
-
sortOrder:
|
|
4587
|
+
parameters: z10.object({
|
|
4588
|
+
query: z10.string().optional().describe("Search query text"),
|
|
4589
|
+
category: z10.string().optional().describe("Product category filter"),
|
|
4590
|
+
minPrice: z10.number().optional().describe("Minimum price filter"),
|
|
4591
|
+
maxPrice: z10.number().optional().describe("Maximum price filter"),
|
|
4592
|
+
limit: z10.number().optional().default(10).describe("Maximum number of results"),
|
|
4593
|
+
offset: z10.number().optional().default(0).describe("Pagination offset"),
|
|
4594
|
+
sortBy: z10.enum(["price", "name", "popularity", "newest"]).optional().describe("Sort field"),
|
|
4595
|
+
sortOrder: z10.enum(["asc", "desc"]).optional().default("asc").describe("Sort order")
|
|
4416
4596
|
}),
|
|
4417
4597
|
execute: async (params) => {
|
|
4418
4598
|
const response = await client.searchProducts(params);
|
|
@@ -4431,8 +4611,8 @@ function createGetProductTool(client) {
|
|
|
4431
4611
|
return {
|
|
4432
4612
|
name: "acp_get_product",
|
|
4433
4613
|
description: "Get detailed information about a specific product by its ID.",
|
|
4434
|
-
parameters:
|
|
4435
|
-
productId:
|
|
4614
|
+
parameters: z10.object({
|
|
4615
|
+
productId: z10.string().describe("Product ID")
|
|
4436
4616
|
}),
|
|
4437
4617
|
execute: async (params) => {
|
|
4438
4618
|
const response = await client.getProduct(params.productId);
|
|
@@ -4447,7 +4627,7 @@ function createCreateCartTool(client) {
|
|
|
4447
4627
|
return {
|
|
4448
4628
|
name: "acp_create_cart",
|
|
4449
4629
|
description: "Create a new shopping cart for the customer. Returns the cart ID for subsequent operations.",
|
|
4450
|
-
parameters:
|
|
4630
|
+
parameters: z10.object({}),
|
|
4451
4631
|
execute: async () => {
|
|
4452
4632
|
const response = await client.createCart();
|
|
4453
4633
|
if (response.error) {
|
|
@@ -4461,14 +4641,14 @@ function createAddToCartTool(client) {
|
|
|
4461
4641
|
return {
|
|
4462
4642
|
name: "acp_add_to_cart",
|
|
4463
4643
|
description: "Add a product to the shopping cart with specified quantity.",
|
|
4464
|
-
parameters:
|
|
4465
|
-
cartId:
|
|
4466
|
-
productId:
|
|
4467
|
-
variantId:
|
|
4468
|
-
quantity:
|
|
4469
|
-
price:
|
|
4470
|
-
amount:
|
|
4471
|
-
currency:
|
|
4644
|
+
parameters: z10.object({
|
|
4645
|
+
cartId: z10.string().describe("Cart ID"),
|
|
4646
|
+
productId: z10.string().describe("Product ID to add"),
|
|
4647
|
+
variantId: z10.string().optional().describe("Product variant ID"),
|
|
4648
|
+
quantity: z10.number().min(1).describe("Quantity to add"),
|
|
4649
|
+
price: z10.object({
|
|
4650
|
+
amount: z10.number().describe("Price amount"),
|
|
4651
|
+
currency: z10.string().describe("Currency code (e.g., USD, EUR)")
|
|
4472
4652
|
}).describe("Product price")
|
|
4473
4653
|
}),
|
|
4474
4654
|
execute: async (params) => {
|
|
@@ -4491,10 +4671,10 @@ function createUpdateCartItemTool(client) {
|
|
|
4491
4671
|
return {
|
|
4492
4672
|
name: "acp_update_cart_item",
|
|
4493
4673
|
description: "Update the quantity of an item in the shopping cart.",
|
|
4494
|
-
parameters:
|
|
4495
|
-
cartId:
|
|
4496
|
-
productId:
|
|
4497
|
-
quantity:
|
|
4674
|
+
parameters: z10.object({
|
|
4675
|
+
cartId: z10.string().describe("Cart ID"),
|
|
4676
|
+
productId: z10.string().describe("Product ID to update"),
|
|
4677
|
+
quantity: z10.number().min(0).describe("New quantity (0 to remove)")
|
|
4498
4678
|
}),
|
|
4499
4679
|
execute: async (params) => {
|
|
4500
4680
|
const response = await client.updateCartItem(
|
|
@@ -4515,9 +4695,9 @@ function createRemoveFromCartTool(client) {
|
|
|
4515
4695
|
return {
|
|
4516
4696
|
name: "acp_remove_from_cart",
|
|
4517
4697
|
description: "Remove a product from the shopping cart.",
|
|
4518
|
-
parameters:
|
|
4519
|
-
cartId:
|
|
4520
|
-
productId:
|
|
4698
|
+
parameters: z10.object({
|
|
4699
|
+
cartId: z10.string().describe("Cart ID"),
|
|
4700
|
+
productId: z10.string().describe("Product ID to remove")
|
|
4521
4701
|
}),
|
|
4522
4702
|
execute: async (params) => {
|
|
4523
4703
|
const response = await client.removeFromCart(
|
|
@@ -4537,8 +4717,8 @@ function createGetCartTool(client) {
|
|
|
4537
4717
|
return {
|
|
4538
4718
|
name: "acp_get_cart",
|
|
4539
4719
|
description: "Get the current state of a shopping cart including all items and total amount.",
|
|
4540
|
-
parameters:
|
|
4541
|
-
cartId:
|
|
4720
|
+
parameters: z10.object({
|
|
4721
|
+
cartId: z10.string().describe("Cart ID")
|
|
4542
4722
|
}),
|
|
4543
4723
|
execute: async (params) => {
|
|
4544
4724
|
const response = await client.getCart(params.cartId);
|
|
@@ -4553,12 +4733,12 @@ function createCheckoutTool(client) {
|
|
|
4553
4733
|
return {
|
|
4554
4734
|
name: "acp_create_checkout",
|
|
4555
4735
|
description: "Create a checkout session from a shopping cart to begin the purchase process.",
|
|
4556
|
-
parameters:
|
|
4557
|
-
cartId:
|
|
4558
|
-
customer:
|
|
4559
|
-
email:
|
|
4560
|
-
name:
|
|
4561
|
-
phone:
|
|
4736
|
+
parameters: z10.object({
|
|
4737
|
+
cartId: z10.string().describe("Cart ID"),
|
|
4738
|
+
customer: z10.object({
|
|
4739
|
+
email: z10.string().email().describe("Customer email"),
|
|
4740
|
+
name: z10.string().optional().describe("Customer name"),
|
|
4741
|
+
phone: z10.string().optional().describe("Customer phone number")
|
|
4562
4742
|
}).optional().describe("Customer information")
|
|
4563
4743
|
}),
|
|
4564
4744
|
execute: async (params) => {
|
|
@@ -4579,15 +4759,15 @@ function createUpdateShippingAddressTool(client) {
|
|
|
4579
4759
|
return {
|
|
4580
4760
|
name: "acp_update_shipping_address",
|
|
4581
4761
|
description: "Update the shipping address for a checkout session.",
|
|
4582
|
-
parameters:
|
|
4583
|
-
sessionId:
|
|
4584
|
-
address:
|
|
4585
|
-
line1:
|
|
4586
|
-
line2:
|
|
4587
|
-
city:
|
|
4588
|
-
state:
|
|
4589
|
-
postalCode:
|
|
4590
|
-
country:
|
|
4762
|
+
parameters: z10.object({
|
|
4763
|
+
sessionId: z10.string().describe("Checkout session ID"),
|
|
4764
|
+
address: z10.object({
|
|
4765
|
+
line1: z10.string().describe("Address line 1"),
|
|
4766
|
+
line2: z10.string().optional().describe("Address line 2"),
|
|
4767
|
+
city: z10.string().describe("City"),
|
|
4768
|
+
state: z10.string().optional().describe("State/Province"),
|
|
4769
|
+
postalCode: z10.string().describe("Postal/ZIP code"),
|
|
4770
|
+
country: z10.string().describe("Country code (e.g., US, GB)")
|
|
4591
4771
|
}).describe("Shipping address")
|
|
4592
4772
|
}),
|
|
4593
4773
|
execute: async (params) => {
|
|
@@ -4608,12 +4788,12 @@ function createUpdatePaymentMethodTool(client) {
|
|
|
4608
4788
|
return {
|
|
4609
4789
|
name: "acp_update_payment_method",
|
|
4610
4790
|
description: "Update the payment method for a checkout session.",
|
|
4611
|
-
parameters:
|
|
4612
|
-
sessionId:
|
|
4613
|
-
paymentMethod:
|
|
4614
|
-
type:
|
|
4615
|
-
token:
|
|
4616
|
-
delegatedProvider:
|
|
4791
|
+
parameters: z10.object({
|
|
4792
|
+
sessionId: z10.string().describe("Checkout session ID"),
|
|
4793
|
+
paymentMethod: z10.object({
|
|
4794
|
+
type: z10.enum(["card", "delegated", "wallet", "bank_transfer"]).describe("Payment method type"),
|
|
4795
|
+
token: z10.string().optional().describe("Payment token"),
|
|
4796
|
+
delegatedProvider: z10.string().optional().describe("Delegated payment provider (e.g., stripe, paypal)")
|
|
4617
4797
|
}).describe("Payment method details")
|
|
4618
4798
|
}),
|
|
4619
4799
|
execute: async (params) => {
|
|
@@ -4634,8 +4814,8 @@ function createCompleteCheckoutTool(client) {
|
|
|
4634
4814
|
return {
|
|
4635
4815
|
name: "acp_complete_checkout",
|
|
4636
4816
|
description: "Complete the checkout process and create an order. This finalizes the purchase.",
|
|
4637
|
-
parameters:
|
|
4638
|
-
sessionId:
|
|
4817
|
+
parameters: z10.object({
|
|
4818
|
+
sessionId: z10.string().describe("Checkout session ID")
|
|
4639
4819
|
}),
|
|
4640
4820
|
execute: async (params) => {
|
|
4641
4821
|
const response = await client.completeCheckout(params.sessionId);
|
|
@@ -4652,8 +4832,8 @@ function createGetOrderTool(client) {
|
|
|
4652
4832
|
return {
|
|
4653
4833
|
name: "acp_get_order",
|
|
4654
4834
|
description: "Get detailed information about an order by its ID.",
|
|
4655
|
-
parameters:
|
|
4656
|
-
orderId:
|
|
4835
|
+
parameters: z10.object({
|
|
4836
|
+
orderId: z10.string().describe("Order ID")
|
|
4657
4837
|
}),
|
|
4658
4838
|
execute: async (params) => {
|
|
4659
4839
|
const response = await client.getOrder(params.orderId);
|
|
@@ -4668,8 +4848,8 @@ function createCancelOrderTool(client) {
|
|
|
4668
4848
|
return {
|
|
4669
4849
|
name: "acp_cancel_order",
|
|
4670
4850
|
description: "Cancel an order. Only orders that have not been shipped can be cancelled.",
|
|
4671
|
-
parameters:
|
|
4672
|
-
orderId:
|
|
4851
|
+
parameters: z10.object({
|
|
4852
|
+
orderId: z10.string().describe("Order ID")
|
|
4673
4853
|
}),
|
|
4674
4854
|
execute: async (params) => {
|
|
4675
4855
|
const response = await client.cancelOrder(params.orderId);
|
|
@@ -4684,8 +4864,8 @@ function createGetOrderTrackingTool(client) {
|
|
|
4684
4864
|
return {
|
|
4685
4865
|
name: "acp_get_order_tracking",
|
|
4686
4866
|
description: "Get shipping tracking information for an order.",
|
|
4687
|
-
parameters:
|
|
4688
|
-
orderId:
|
|
4867
|
+
parameters: z10.object({
|
|
4868
|
+
orderId: z10.string().describe("Order ID")
|
|
4689
4869
|
}),
|
|
4690
4870
|
execute: async (params) => {
|
|
4691
4871
|
const response = await client.getOrderTracking(params.orderId);
|
|
@@ -5260,12 +5440,14 @@ var OpenAIWhisperProvider = class {
|
|
|
5260
5440
|
text: verboseResponse.text,
|
|
5261
5441
|
language: verboseResponse.language,
|
|
5262
5442
|
duration: verboseResponse.duration,
|
|
5443
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5263
5444
|
segments: verboseResponse.segments?.map((seg) => ({
|
|
5264
5445
|
id: seg.id,
|
|
5265
5446
|
start: seg.start,
|
|
5266
5447
|
end: seg.end,
|
|
5267
5448
|
text: seg.text
|
|
5268
5449
|
})),
|
|
5450
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5269
5451
|
words: verboseResponse.words?.map((word) => ({
|
|
5270
5452
|
word: word.word,
|
|
5271
5453
|
start: word.start,
|
|
@@ -5539,6 +5721,7 @@ var OpenAITTSProvider = class {
|
|
|
5539
5721
|
try {
|
|
5540
5722
|
const response = await this.client.audio.speech.create({
|
|
5541
5723
|
model: config?.model || "tts-1",
|
|
5724
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5542
5725
|
voice: config?.voice || "alloy",
|
|
5543
5726
|
input: text,
|
|
5544
5727
|
speed: config?.speed || 1,
|
|
@@ -5563,6 +5746,7 @@ var OpenAITTSProvider = class {
|
|
|
5563
5746
|
try {
|
|
5564
5747
|
const response = await this.client.audio.speech.create({
|
|
5565
5748
|
model: config?.model || "tts-1",
|
|
5749
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5566
5750
|
voice: config?.voice || "alloy",
|
|
5567
5751
|
input: text,
|
|
5568
5752
|
speed: config?.speed || 1,
|
|
@@ -6006,13 +6190,13 @@ var TenantManager = class {
|
|
|
6006
6190
|
/**
|
|
6007
6191
|
* Get tenant by ID
|
|
6008
6192
|
*/
|
|
6009
|
-
|
|
6193
|
+
getTenant(tenantId) {
|
|
6010
6194
|
return this.storage.getTenant(tenantId);
|
|
6011
6195
|
}
|
|
6012
6196
|
/**
|
|
6013
6197
|
* Get tenant by slug
|
|
6014
6198
|
*/
|
|
6015
|
-
|
|
6199
|
+
getTenantBySlug(slug) {
|
|
6016
6200
|
return this.storage.getTenantBySlug(slug);
|
|
6017
6201
|
}
|
|
6018
6202
|
/**
|
|
@@ -6359,7 +6543,11 @@ export {
|
|
|
6359
6543
|
VoiceType,
|
|
6360
6544
|
Workflow,
|
|
6361
6545
|
WorkflowFactory,
|
|
6546
|
+
calculatorClient,
|
|
6547
|
+
calculatorDef,
|
|
6548
|
+
calculatorServer,
|
|
6362
6549
|
calculatorTool,
|
|
6550
|
+
clientTool,
|
|
6363
6551
|
createACPTools,
|
|
6364
6552
|
createAnthropicProvider,
|
|
6365
6553
|
createGeminiProvider,
|
|
@@ -6378,12 +6566,17 @@ export {
|
|
|
6378
6566
|
globalMetrics,
|
|
6379
6567
|
globalTracer,
|
|
6380
6568
|
httpRequestTool,
|
|
6569
|
+
hybridTool,
|
|
6381
6570
|
mcpToolToAgenticTool,
|
|
6382
6571
|
n8nExecuteWorkflowTool,
|
|
6383
6572
|
n8nGetExecutionTool,
|
|
6384
6573
|
n8nGetWorkflowTool,
|
|
6385
6574
|
n8nListWorkflowsTool,
|
|
6386
6575
|
n8nTriggerWebhookTool,
|
|
6576
|
+
serverTool,
|
|
6387
6577
|
stringTransformTool,
|
|
6388
|
-
textSummaryTool
|
|
6578
|
+
textSummaryTool,
|
|
6579
|
+
toLegacyTool,
|
|
6580
|
+
toLegacyTools,
|
|
6581
|
+
toolDefinition
|
|
6389
6582
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lov3kaizen/agentsea-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "AgentSea - Unite and orchestrate AI agents. A production-ready ADK for building agentic AI applications with multi-provider support.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"winston": "^3.11.0",
|
|
25
25
|
"ioredis": "^5.3.2",
|
|
26
26
|
"marked": "^12.0.0",
|
|
27
|
-
"@lov3kaizen/agentsea-types": "0.
|
|
27
|
+
"@lov3kaizen/agentsea-types": "0.5.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/node": "^20.11.0",
|