@lov3kaizen/agentsea-core 0.3.1 → 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.js CHANGED
@@ -95,8 +95,17 @@ __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,
104
+ createAnthropicProvider: () => createAnthropicProvider,
105
+ createGeminiProvider: () => createGeminiProvider,
106
+ createOllamaProvider: () => createOllamaProvider,
107
+ createOpenAIProvider: () => createOpenAIProvider,
108
+ createProvider: () => createProvider,
100
109
  defaultLogger: () => defaultLogger,
101
110
  figmaGetCommentsTool: () => figmaGetCommentsTool,
102
111
  figmaGetFileTool: () => figmaGetFileTool,
@@ -109,14 +118,19 @@ __export(index_exports, {
109
118
  globalMetrics: () => globalMetrics,
110
119
  globalTracer: () => globalTracer,
111
120
  httpRequestTool: () => httpRequestTool,
121
+ hybridTool: () => hybridTool,
112
122
  mcpToolToAgenticTool: () => mcpToolToAgenticTool,
113
123
  n8nExecuteWorkflowTool: () => n8nExecuteWorkflowTool,
114
124
  n8nGetExecutionTool: () => n8nGetExecutionTool,
115
125
  n8nGetWorkflowTool: () => n8nGetWorkflowTool,
116
126
  n8nListWorkflowsTool: () => n8nListWorkflowsTool,
117
127
  n8nTriggerWebhookTool: () => n8nTriggerWebhookTool,
128
+ serverTool: () => serverTool,
118
129
  stringTransformTool: () => stringTransformTool,
119
- textSummaryTool: () => textSummaryTool
130
+ textSummaryTool: () => textSummaryTool,
131
+ toLegacyTool: () => toLegacyTool,
132
+ toLegacyTools: () => toLegacyTools,
133
+ toolDefinition: () => toolDefinition
120
134
  });
121
135
  module.exports = __toCommonJS(index_exports);
122
136
 
@@ -378,6 +392,7 @@ var Agent = class {
378
392
  // Will be set by execute()
379
393
  iterations: this.iterationCount
380
394
  },
395
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
381
396
  finishReason: llmResponse.stopReason
382
397
  };
383
398
  if (this.config.outputFormat && this.config.outputFormat !== "text") {
@@ -774,7 +789,7 @@ var httpRequestTool = {
774
789
  url: import_zod2.z.string().url().describe("The URL to make the request to"),
775
790
  method: import_zod2.z.enum(["GET", "POST", "PUT", "DELETE", "PATCH"]).default("GET").describe("HTTP method"),
776
791
  headers: import_zod2.z.record(import_zod2.z.string()).optional().describe("HTTP headers"),
777
- body: import_zod2.z.any().optional().describe("Request body (for POST, PUT, PATCH)"),
792
+ body: import_zod2.z.unknown().optional().describe("Request body (for POST, PUT, PATCH)"),
778
793
  timeout: import_zod2.z.number().optional().default(1e4).describe("Request timeout in milliseconds")
779
794
  }),
780
795
  execute: async (params) => {
@@ -1232,7 +1247,7 @@ var n8nExecuteWorkflowTool = {
1232
1247
  description: "Execute an n8n workflow by ID or name. Optionally pass input data to the workflow.",
1233
1248
  parameters: import_zod6.z.object({
1234
1249
  workflowId: import_zod6.z.string().describe("The ID of the workflow to execute"),
1235
- data: import_zod6.z.any().optional().describe("Input data to pass to the workflow execution"),
1250
+ data: import_zod6.z.unknown().optional().describe("Input data to pass to the workflow execution"),
1236
1251
  waitForCompletion: import_zod6.z.boolean().default(true).describe("Wait for workflow execution to complete before returning"),
1237
1252
  apiKey: import_zod6.z.string().optional().describe("n8n API key (or use N8N_API_KEY env var)"),
1238
1253
  baseUrl: import_zod6.z.string().optional().describe("n8n base URL (or use N8N_BASE_URL env var)")
@@ -1349,7 +1364,7 @@ var n8nTriggerWebhookTool = {
1349
1364
  parameters: import_zod6.z.object({
1350
1365
  webhookPath: import_zod6.z.string().describe('The webhook path (e.g., "webhook/my-workflow")'),
1351
1366
  method: import_zod6.z.enum(["GET", "POST", "PUT", "DELETE", "PATCH"]).default("POST").describe("HTTP method for the webhook"),
1352
- data: import_zod6.z.any().optional().describe("Data to send to the webhook"),
1367
+ data: import_zod6.z.unknown().optional().describe("Data to send to the webhook"),
1353
1368
  headers: import_zod6.z.record(import_zod6.z.string()).optional().describe("Additional headers to include"),
1354
1369
  baseUrl: import_zod6.z.string().optional().describe("n8n base URL (or use N8N_BASE_URL env var)")
1355
1370
  }),
@@ -1440,6 +1455,162 @@ async function pollExecutionStatus(executionId, apiKey, baseUrl, maxAttempts = 3
1440
1455
  );
1441
1456
  }
1442
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
+
1443
1614
  // src/providers/anthropic.ts
1444
1615
  var import_sdk = __toESM(require("@anthropic-ai/sdk"));
1445
1616
  var import_zod_to_json_schema = require("zod-to-json-schema");
@@ -1466,6 +1637,7 @@ var AnthropicProvider = class {
1466
1637
  temperature: config.temperature,
1467
1638
  system: config.systemPrompt,
1468
1639
  messages: anthropicMessages,
1640
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1469
1641
  tools,
1470
1642
  top_p: config.topP,
1471
1643
  stop_sequences: config.stopSequences
@@ -1497,6 +1669,7 @@ var AnthropicProvider = class {
1497
1669
  temperature: config.temperature,
1498
1670
  system: config.systemPrompt,
1499
1671
  messages: anthropicMessages,
1672
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1500
1673
  tools,
1501
1674
  top_p: config.topP,
1502
1675
  stop_sequences: config.stopSequences
@@ -1560,6 +1733,7 @@ var AnthropicProvider = class {
1560
1733
  type: "tool_result",
1561
1734
  tool_use_id: message.toolCallId || "",
1562
1735
  content: message.content
1736
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1563
1737
  });
1564
1738
  }
1565
1739
  }
@@ -1817,8 +1991,9 @@ var GeminiProvider = class {
1817
1991
  */
1818
1992
  parseToolCalls(response) {
1819
1993
  const toolCalls = [];
1820
- if (response.rawResponse?.functionCalls) {
1821
- for (const call of response.rawResponse.functionCalls()) {
1994
+ const rawResponse = response.rawResponse;
1995
+ if (rawResponse?.functionCalls) {
1996
+ for (const call of rawResponse.functionCalls()) {
1822
1997
  toolCalls.push({
1823
1998
  id: `call-${Date.now()}-${Math.random()}`,
1824
1999
  tool: call.name,
@@ -2008,7 +2183,7 @@ var OllamaProvider = class {
2008
2183
  parseToolCalls(response) {
2009
2184
  const rawResponse = response.rawResponse;
2010
2185
  const toolCalls = [];
2011
- if (rawResponse.message?.tool_calls) {
2186
+ if (rawResponse?.message?.tool_calls) {
2012
2187
  for (const toolCall of rawResponse.message.tool_calls) {
2013
2188
  toolCalls.push({
2014
2189
  id: toolCall.id || Math.random().toString(36),
@@ -2022,6 +2197,7 @@ var OllamaProvider = class {
2022
2197
  /**
2023
2198
  * Convert generic messages to Ollama format
2024
2199
  */
2200
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2025
2201
  convertMessages(messages, systemPrompt) {
2026
2202
  const converted = [];
2027
2203
  if (systemPrompt) {
@@ -2056,6 +2232,7 @@ var OllamaProvider = class {
2056
2232
  /**
2057
2233
  * Make a request to Ollama API
2058
2234
  */
2235
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2059
2236
  async makeRequest(endpoint, payload) {
2060
2237
  const controller = new AbortController();
2061
2238
  const timeoutId = setTimeout(() => controller.abort(), this.timeout);
@@ -2345,6 +2522,91 @@ var VLLMProvider = class extends OpenAICompatibleProvider {
2345
2522
  }
2346
2523
  };
2347
2524
 
2525
+ // src/providers/type-safe-provider.ts
2526
+ function createProvider(config) {
2527
+ let provider;
2528
+ switch (config.provider) {
2529
+ case "anthropic":
2530
+ provider = new AnthropicProvider();
2531
+ break;
2532
+ case "openai":
2533
+ provider = new OpenAIProvider();
2534
+ break;
2535
+ case "gemini":
2536
+ provider = new GeminiProvider();
2537
+ break;
2538
+ case "ollama":
2539
+ provider = new OllamaProvider();
2540
+ break;
2541
+ default: {
2542
+ const exhaustiveCheck = config;
2543
+ throw new Error(`Unknown provider: ${exhaustiveCheck.provider}`);
2544
+ }
2545
+ }
2546
+ return {
2547
+ config,
2548
+ provider,
2549
+ getModelInfo() {
2550
+ return (0, types_exports.getModelInfo)(config.model);
2551
+ },
2552
+ supportsCapability(capability) {
2553
+ return (0, types_exports.modelSupportsCapability)(config.model, capability);
2554
+ }
2555
+ };
2556
+ }
2557
+ function createAnthropicProvider(config, options) {
2558
+ const provider = new AnthropicProvider(options?.apiKey);
2559
+ return {
2560
+ config,
2561
+ provider,
2562
+ getModelInfo() {
2563
+ return (0, types_exports.getModelInfo)(config.model);
2564
+ },
2565
+ supportsCapability(capability) {
2566
+ return (0, types_exports.modelSupportsCapability)(config.model, capability);
2567
+ }
2568
+ };
2569
+ }
2570
+ function createOpenAIProvider(config, options) {
2571
+ const provider = new OpenAIProvider(options?.apiKey);
2572
+ return {
2573
+ config,
2574
+ provider,
2575
+ getModelInfo() {
2576
+ return (0, types_exports.getModelInfo)(config.model);
2577
+ },
2578
+ supportsCapability(capability) {
2579
+ return (0, types_exports.modelSupportsCapability)(config.model, capability);
2580
+ }
2581
+ };
2582
+ }
2583
+ function createGeminiProvider(config, options) {
2584
+ const provider = new GeminiProvider(options?.apiKey);
2585
+ return {
2586
+ config,
2587
+ provider,
2588
+ getModelInfo() {
2589
+ return (0, types_exports.getModelInfo)(config.model);
2590
+ },
2591
+ supportsCapability(capability) {
2592
+ return (0, types_exports.modelSupportsCapability)(config.model, capability);
2593
+ }
2594
+ };
2595
+ }
2596
+ function createOllamaProvider(config, options) {
2597
+ const provider = new OllamaProvider(options);
2598
+ return {
2599
+ config,
2600
+ provider,
2601
+ getModelInfo() {
2602
+ return (0, types_exports.getModelInfo)(config.model);
2603
+ },
2604
+ supportsCapability(capability) {
2605
+ return (0, types_exports.modelSupportsCapability)(config.model, capability);
2606
+ }
2607
+ };
2608
+ }
2609
+
2348
2610
  // src/memory/buffer-memory.ts
2349
2611
  var BufferMemory = class {
2350
2612
  constructor(maxMessages) {
@@ -3836,7 +4098,7 @@ var MCPClient = class extends import_events2.EventEmitter {
3836
4098
  };
3837
4099
 
3838
4100
  // src/mcp/tool-adapter.ts
3839
- var import_zod7 = require("zod");
4101
+ var import_zod9 = require("zod");
3840
4102
  function mcpToolToAgenticTool(mcpTool, client) {
3841
4103
  const zodSchema = jsonSchemaToZod(mcpTool.inputSchema);
3842
4104
  return {
@@ -3844,7 +4106,10 @@ function mcpToolToAgenticTool(mcpTool, client) {
3844
4106
  description: mcpTool.description,
3845
4107
  parameters: zodSchema,
3846
4108
  execute: async (params, _context) => {
3847
- const response = await client.callTool(mcpTool.name, params);
4109
+ const response = await client.callTool(
4110
+ mcpTool.name,
4111
+ params
4112
+ );
3848
4113
  if (response.isError) {
3849
4114
  throw new Error(
3850
4115
  `MCP tool error: ${response.content[0]?.text || "Unknown error"}`
@@ -3868,26 +4133,30 @@ function jsonSchemaToZod(schema) {
3868
4133
  let zodType;
3869
4134
  switch (propSchema.type) {
3870
4135
  case "string":
3871
- zodType = import_zod7.z.string();
3872
- if (propSchema.description) {
4136
+ zodType = import_zod9.z.string();
4137
+ if (typeof propSchema.description === "string") {
3873
4138
  zodType = zodType.describe(propSchema.description);
3874
4139
  }
3875
4140
  break;
3876
4141
  case "number":
3877
- zodType = import_zod7.z.number();
3878
- if (propSchema.description) {
4142
+ zodType = import_zod9.z.number();
4143
+ if (typeof propSchema.description === "string") {
3879
4144
  zodType = zodType.describe(propSchema.description);
3880
4145
  }
3881
4146
  break;
3882
4147
  case "boolean":
3883
- zodType = import_zod7.z.boolean();
3884
- if (propSchema.description) {
4148
+ zodType = import_zod9.z.boolean();
4149
+ if (typeof propSchema.description === "string") {
3885
4150
  zodType = zodType.describe(propSchema.description);
3886
4151
  }
3887
4152
  break;
3888
4153
  case "array":
3889
- zodType = import_zod7.z.array(jsonSchemaToZod(propSchema.items || {}));
3890
- if (propSchema.description) {
4154
+ zodType = import_zod9.z.array(
4155
+ jsonSchemaToZod(
4156
+ propSchema.items || {}
4157
+ )
4158
+ );
4159
+ if (typeof propSchema.description === "string") {
3891
4160
  zodType = zodType.describe(propSchema.description);
3892
4161
  }
3893
4162
  break;
@@ -3895,16 +4164,17 @@ function jsonSchemaToZod(schema) {
3895
4164
  zodType = jsonSchemaToZod(propSchema);
3896
4165
  break;
3897
4166
  default:
3898
- zodType = import_zod7.z.any();
4167
+ zodType = import_zod9.z.any();
3899
4168
  }
3900
- if (!schema.required?.includes(key)) {
4169
+ const required = schema.required;
4170
+ if (!required?.includes(key)) {
3901
4171
  zodType = zodType.optional();
3902
4172
  }
3903
4173
  shape[key] = zodType;
3904
4174
  }
3905
- return import_zod7.z.object(shape);
4175
+ return import_zod9.z.object(shape);
3906
4176
  }
3907
- return import_zod7.z.any();
4177
+ return import_zod9.z.any();
3908
4178
  }
3909
4179
 
3910
4180
  // src/mcp/registry.ts
@@ -4301,7 +4571,7 @@ var ACPClient = class {
4301
4571
  };
4302
4572
 
4303
4573
  // src/acp/tools.ts
4304
- var import_zod8 = require("zod");
4574
+ var import_zod10 = require("zod");
4305
4575
  function createACPTools(client) {
4306
4576
  return [
4307
4577
  createSearchProductsTool(client),
@@ -4324,15 +4594,15 @@ function createSearchProductsTool(client) {
4324
4594
  return {
4325
4595
  name: "acp_search_products",
4326
4596
  description: "Search for products in the commerce catalog. Supports filtering by query text, category, price range, and sorting.",
4327
- parameters: import_zod8.z.object({
4328
- query: import_zod8.z.string().optional().describe("Search query text"),
4329
- category: import_zod8.z.string().optional().describe("Product category filter"),
4330
- minPrice: import_zod8.z.number().optional().describe("Minimum price filter"),
4331
- maxPrice: import_zod8.z.number().optional().describe("Maximum price filter"),
4332
- limit: import_zod8.z.number().optional().default(10).describe("Maximum number of results"),
4333
- offset: import_zod8.z.number().optional().default(0).describe("Pagination offset"),
4334
- sortBy: import_zod8.z.enum(["price", "name", "popularity", "newest"]).optional().describe("Sort field"),
4335
- sortOrder: import_zod8.z.enum(["asc", "desc"]).optional().default("asc").describe("Sort order")
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")
4336
4606
  }),
4337
4607
  execute: async (params) => {
4338
4608
  const response = await client.searchProducts(params);
@@ -4351,8 +4621,8 @@ function createGetProductTool(client) {
4351
4621
  return {
4352
4622
  name: "acp_get_product",
4353
4623
  description: "Get detailed information about a specific product by its ID.",
4354
- parameters: import_zod8.z.object({
4355
- productId: import_zod8.z.string().describe("Product ID")
4624
+ parameters: import_zod10.z.object({
4625
+ productId: import_zod10.z.string().describe("Product ID")
4356
4626
  }),
4357
4627
  execute: async (params) => {
4358
4628
  const response = await client.getProduct(params.productId);
@@ -4367,7 +4637,7 @@ function createCreateCartTool(client) {
4367
4637
  return {
4368
4638
  name: "acp_create_cart",
4369
4639
  description: "Create a new shopping cart for the customer. Returns the cart ID for subsequent operations.",
4370
- parameters: import_zod8.z.object({}),
4640
+ parameters: import_zod10.z.object({}),
4371
4641
  execute: async () => {
4372
4642
  const response = await client.createCart();
4373
4643
  if (response.error) {
@@ -4381,14 +4651,14 @@ function createAddToCartTool(client) {
4381
4651
  return {
4382
4652
  name: "acp_add_to_cart",
4383
4653
  description: "Add a product to the shopping cart with specified quantity.",
4384
- parameters: import_zod8.z.object({
4385
- cartId: import_zod8.z.string().describe("Cart ID"),
4386
- productId: import_zod8.z.string().describe("Product ID to add"),
4387
- variantId: import_zod8.z.string().optional().describe("Product variant ID"),
4388
- quantity: import_zod8.z.number().min(1).describe("Quantity to add"),
4389
- price: import_zod8.z.object({
4390
- amount: import_zod8.z.number().describe("Price amount"),
4391
- currency: import_zod8.z.string().describe("Currency code (e.g., USD, EUR)")
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)")
4392
4662
  }).describe("Product price")
4393
4663
  }),
4394
4664
  execute: async (params) => {
@@ -4411,10 +4681,10 @@ function createUpdateCartItemTool(client) {
4411
4681
  return {
4412
4682
  name: "acp_update_cart_item",
4413
4683
  description: "Update the quantity of an item in the shopping cart.",
4414
- parameters: import_zod8.z.object({
4415
- cartId: import_zod8.z.string().describe("Cart ID"),
4416
- productId: import_zod8.z.string().describe("Product ID to update"),
4417
- quantity: import_zod8.z.number().min(0).describe("New quantity (0 to remove)")
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)")
4418
4688
  }),
4419
4689
  execute: async (params) => {
4420
4690
  const response = await client.updateCartItem(
@@ -4435,9 +4705,9 @@ function createRemoveFromCartTool(client) {
4435
4705
  return {
4436
4706
  name: "acp_remove_from_cart",
4437
4707
  description: "Remove a product from the shopping cart.",
4438
- parameters: import_zod8.z.object({
4439
- cartId: import_zod8.z.string().describe("Cart ID"),
4440
- productId: import_zod8.z.string().describe("Product ID to remove")
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")
4441
4711
  }),
4442
4712
  execute: async (params) => {
4443
4713
  const response = await client.removeFromCart(
@@ -4457,8 +4727,8 @@ function createGetCartTool(client) {
4457
4727
  return {
4458
4728
  name: "acp_get_cart",
4459
4729
  description: "Get the current state of a shopping cart including all items and total amount.",
4460
- parameters: import_zod8.z.object({
4461
- cartId: import_zod8.z.string().describe("Cart ID")
4730
+ parameters: import_zod10.z.object({
4731
+ cartId: import_zod10.z.string().describe("Cart ID")
4462
4732
  }),
4463
4733
  execute: async (params) => {
4464
4734
  const response = await client.getCart(params.cartId);
@@ -4473,12 +4743,12 @@ function createCheckoutTool(client) {
4473
4743
  return {
4474
4744
  name: "acp_create_checkout",
4475
4745
  description: "Create a checkout session from a shopping cart to begin the purchase process.",
4476
- parameters: import_zod8.z.object({
4477
- cartId: import_zod8.z.string().describe("Cart ID"),
4478
- customer: import_zod8.z.object({
4479
- email: import_zod8.z.string().email().describe("Customer email"),
4480
- name: import_zod8.z.string().optional().describe("Customer name"),
4481
- phone: import_zod8.z.string().optional().describe("Customer phone number")
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")
4482
4752
  }).optional().describe("Customer information")
4483
4753
  }),
4484
4754
  execute: async (params) => {
@@ -4499,15 +4769,15 @@ function createUpdateShippingAddressTool(client) {
4499
4769
  return {
4500
4770
  name: "acp_update_shipping_address",
4501
4771
  description: "Update the shipping address for a checkout session.",
4502
- parameters: import_zod8.z.object({
4503
- sessionId: import_zod8.z.string().describe("Checkout session ID"),
4504
- address: import_zod8.z.object({
4505
- line1: import_zod8.z.string().describe("Address line 1"),
4506
- line2: import_zod8.z.string().optional().describe("Address line 2"),
4507
- city: import_zod8.z.string().describe("City"),
4508
- state: import_zod8.z.string().optional().describe("State/Province"),
4509
- postalCode: import_zod8.z.string().describe("Postal/ZIP code"),
4510
- country: import_zod8.z.string().describe("Country code (e.g., US, GB)")
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)")
4511
4781
  }).describe("Shipping address")
4512
4782
  }),
4513
4783
  execute: async (params) => {
@@ -4528,12 +4798,12 @@ function createUpdatePaymentMethodTool(client) {
4528
4798
  return {
4529
4799
  name: "acp_update_payment_method",
4530
4800
  description: "Update the payment method for a checkout session.",
4531
- parameters: import_zod8.z.object({
4532
- sessionId: import_zod8.z.string().describe("Checkout session ID"),
4533
- paymentMethod: import_zod8.z.object({
4534
- type: import_zod8.z.enum(["card", "delegated", "wallet", "bank_transfer"]).describe("Payment method type"),
4535
- token: import_zod8.z.string().optional().describe("Payment token"),
4536
- delegatedProvider: import_zod8.z.string().optional().describe("Delegated payment provider (e.g., stripe, paypal)")
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)")
4537
4807
  }).describe("Payment method details")
4538
4808
  }),
4539
4809
  execute: async (params) => {
@@ -4554,8 +4824,8 @@ function createCompleteCheckoutTool(client) {
4554
4824
  return {
4555
4825
  name: "acp_complete_checkout",
4556
4826
  description: "Complete the checkout process and create an order. This finalizes the purchase.",
4557
- parameters: import_zod8.z.object({
4558
- sessionId: import_zod8.z.string().describe("Checkout session ID")
4827
+ parameters: import_zod10.z.object({
4828
+ sessionId: import_zod10.z.string().describe("Checkout session ID")
4559
4829
  }),
4560
4830
  execute: async (params) => {
4561
4831
  const response = await client.completeCheckout(params.sessionId);
@@ -4572,8 +4842,8 @@ function createGetOrderTool(client) {
4572
4842
  return {
4573
4843
  name: "acp_get_order",
4574
4844
  description: "Get detailed information about an order by its ID.",
4575
- parameters: import_zod8.z.object({
4576
- orderId: import_zod8.z.string().describe("Order ID")
4845
+ parameters: import_zod10.z.object({
4846
+ orderId: import_zod10.z.string().describe("Order ID")
4577
4847
  }),
4578
4848
  execute: async (params) => {
4579
4849
  const response = await client.getOrder(params.orderId);
@@ -4588,8 +4858,8 @@ function createCancelOrderTool(client) {
4588
4858
  return {
4589
4859
  name: "acp_cancel_order",
4590
4860
  description: "Cancel an order. Only orders that have not been shipped can be cancelled.",
4591
- parameters: import_zod8.z.object({
4592
- orderId: import_zod8.z.string().describe("Order ID")
4861
+ parameters: import_zod10.z.object({
4862
+ orderId: import_zod10.z.string().describe("Order ID")
4593
4863
  }),
4594
4864
  execute: async (params) => {
4595
4865
  const response = await client.cancelOrder(params.orderId);
@@ -4604,8 +4874,8 @@ function createGetOrderTrackingTool(client) {
4604
4874
  return {
4605
4875
  name: "acp_get_order_tracking",
4606
4876
  description: "Get shipping tracking information for an order.",
4607
- parameters: import_zod8.z.object({
4608
- orderId: import_zod8.z.string().describe("Order ID")
4877
+ parameters: import_zod10.z.object({
4878
+ orderId: import_zod10.z.string().describe("Order ID")
4609
4879
  }),
4610
4880
  execute: async (params) => {
4611
4881
  const response = await client.getOrderTracking(params.orderId);
@@ -5122,7 +5392,7 @@ var VoiceAgent = class {
5122
5392
 
5123
5393
  // src/voice/stt/openai-whisper.ts
5124
5394
  var import_fs3 = require("fs");
5125
- var import_openai3 = __toESM(require("openai"));
5395
+ var import_openai4 = __toESM(require("openai"));
5126
5396
  var OpenAIWhisperProvider = class {
5127
5397
  client;
5128
5398
  /**
@@ -5131,7 +5401,7 @@ var OpenAIWhisperProvider = class {
5131
5401
  */
5132
5402
  constructor(config) {
5133
5403
  const resolvedConfig = typeof config === "string" ? { apiKey: config } : config || {};
5134
- this.client = new import_openai3.default({
5404
+ this.client = new import_openai4.default({
5135
5405
  apiKey: resolvedConfig.apiKey || process.env.OPENAI_API_KEY,
5136
5406
  baseURL: resolvedConfig.baseURL
5137
5407
  });
@@ -5143,7 +5413,7 @@ var OpenAIWhisperProvider = class {
5143
5413
  try {
5144
5414
  let audioFile;
5145
5415
  if (Buffer.isBuffer(audio)) {
5146
- audioFile = await (0, import_openai3.toFile)(audio, "audio.mp3", { type: "audio/mpeg" });
5416
+ audioFile = await (0, import_openai4.toFile)(audio, "audio.mp3", { type: "audio/mpeg" });
5147
5417
  } else if (typeof audio === "string") {
5148
5418
  audioFile = (0, import_fs3.createReadStream)(audio);
5149
5419
  } else {
@@ -5169,12 +5439,14 @@ var OpenAIWhisperProvider = class {
5169
5439
  text: verboseResponse.text,
5170
5440
  language: verboseResponse.language,
5171
5441
  duration: verboseResponse.duration,
5442
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5172
5443
  segments: verboseResponse.segments?.map((seg) => ({
5173
5444
  id: seg.id,
5174
5445
  start: seg.start,
5175
5446
  end: seg.end,
5176
5447
  text: seg.text
5177
5448
  })),
5449
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5178
5450
  words: verboseResponse.words?.map((word) => ({
5179
5451
  word: word.word,
5180
5452
  start: word.start,
@@ -5427,7 +5699,7 @@ var LemonFoxSTTProvider = class extends OpenAIWhisperProvider {
5427
5699
  };
5428
5700
 
5429
5701
  // src/voice/tts/openai-tts.ts
5430
- var import_openai4 = __toESM(require("openai"));
5702
+ var import_openai5 = __toESM(require("openai"));
5431
5703
  var OpenAITTSProvider = class {
5432
5704
  client;
5433
5705
  /**
@@ -5436,7 +5708,7 @@ var OpenAITTSProvider = class {
5436
5708
  */
5437
5709
  constructor(config) {
5438
5710
  const resolvedConfig = typeof config === "string" ? { apiKey: config } : config || {};
5439
- this.client = new import_openai4.default({
5711
+ this.client = new import_openai5.default({
5440
5712
  apiKey: resolvedConfig.apiKey || process.env.OPENAI_API_KEY,
5441
5713
  baseURL: resolvedConfig.baseURL
5442
5714
  });
@@ -5448,6 +5720,7 @@ var OpenAITTSProvider = class {
5448
5720
  try {
5449
5721
  const response = await this.client.audio.speech.create({
5450
5722
  model: config?.model || "tts-1",
5723
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5451
5724
  voice: config?.voice || "alloy",
5452
5725
  input: text,
5453
5726
  speed: config?.speed || 1,
@@ -5472,6 +5745,7 @@ var OpenAITTSProvider = class {
5472
5745
  try {
5473
5746
  const response = await this.client.audio.speech.create({
5474
5747
  model: config?.model || "tts-1",
5748
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5475
5749
  voice: config?.voice || "alloy",
5476
5750
  input: text,
5477
5751
  speed: config?.speed || 1,
@@ -5906,13 +6180,13 @@ var TenantManager = class {
5906
6180
  /**
5907
6181
  * Get tenant by ID
5908
6182
  */
5909
- async getTenant(tenantId) {
6183
+ getTenant(tenantId) {
5910
6184
  return this.storage.getTenant(tenantId);
5911
6185
  }
5912
6186
  /**
5913
6187
  * Get tenant by slug
5914
6188
  */
5915
- async getTenantBySlug(slug) {
6189
+ getTenantBySlug(slug) {
5916
6190
  return this.storage.getTenantBySlug(slug);
5917
6191
  }
5918
6192
  /**
@@ -6260,8 +6534,17 @@ var MemoryTenantStorage = class {
6260
6534
  VoiceType,
6261
6535
  Workflow,
6262
6536
  WorkflowFactory,
6537
+ calculatorClient,
6538
+ calculatorDef,
6539
+ calculatorServer,
6263
6540
  calculatorTool,
6541
+ clientTool,
6264
6542
  createACPTools,
6543
+ createAnthropicProvider,
6544
+ createGeminiProvider,
6545
+ createOllamaProvider,
6546
+ createOpenAIProvider,
6547
+ createProvider,
6265
6548
  defaultLogger,
6266
6549
  figmaGetCommentsTool,
6267
6550
  figmaGetFileTool,
@@ -6274,12 +6557,17 @@ var MemoryTenantStorage = class {
6274
6557
  globalMetrics,
6275
6558
  globalTracer,
6276
6559
  httpRequestTool,
6560
+ hybridTool,
6277
6561
  mcpToolToAgenticTool,
6278
6562
  n8nExecuteWorkflowTool,
6279
6563
  n8nGetExecutionTool,
6280
6564
  n8nGetWorkflowTool,
6281
6565
  n8nListWorkflowsTool,
6282
6566
  n8nTriggerWebhookTool,
6567
+ serverTool,
6283
6568
  stringTransformTool,
6284
- textSummaryTool
6569
+ textSummaryTool,
6570
+ toLegacyTool,
6571
+ toLegacyTools,
6572
+ toolDefinition
6285
6573
  });