@lov3kaizen/agentsea-core 0.5.2 → 0.8.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
@@ -34,7 +34,6 @@ __export(index_exports, {
34
34
  ACPClient: () => ACPClient,
35
35
  Agent: () => Agent,
36
36
  AnthropicProvider: () => AnthropicProvider,
37
- AudioFormat: () => import_agentsea_types.AudioFormat,
38
37
  BufferMemory: () => BufferMemory,
39
38
  Cache: () => Cache,
40
39
  ContentFormatter: () => ContentFormatter,
@@ -64,35 +63,19 @@ __export(index_exports, {
64
63
  RateLimiter: () => RateLimiter,
65
64
  RedisMemory: () => RedisMemory,
66
65
  SSETransport: () => SSETransport,
67
- STTConfig: () => import_agentsea_types.STTConfig,
68
- STTProvider: () => import_agentsea_types.STTProvider,
69
- STTResult: () => import_agentsea_types.STTResult,
70
66
  SequentialWorkflow: () => SequentialWorkflow,
71
67
  SlidingWindowRateLimiter: () => SlidingWindowRateLimiter,
72
68
  StdioTransport: () => StdioTransport,
73
69
  SummaryMemory: () => SummaryMemory,
74
70
  SupervisorWorkflow: () => SupervisorWorkflow,
75
- TTSConfig: () => import_agentsea_types.TTSConfig,
76
- TTSProvider: () => import_agentsea_types.TTSProvider,
77
- TTSResult: () => import_agentsea_types.TTSResult,
78
- Tenant: () => import_agentsea_types2.Tenant,
79
- TenantApiKey: () => import_agentsea_types2.TenantApiKey,
80
71
  TenantBufferMemory: () => TenantBufferMemory,
81
- TenantContext: () => import_agentsea_types2.TenantContext,
82
72
  TenantManager: () => TenantManager,
83
- TenantQuota: () => import_agentsea_types2.TenantQuota,
84
- TenantResolver: () => import_agentsea_types2.TenantResolver,
85
- TenantSettings: () => import_agentsea_types2.TenantSettings,
86
- TenantStatus: () => import_agentsea_types2.TenantStatus,
87
- TenantStorage: () => import_agentsea_types2.TenantStorage,
73
+ TenantStatus: () => import_agentsea_types.TenantStatus,
88
74
  TextGenerationWebUIProvider: () => TextGenerationWebUIProvider,
89
75
  ToolRegistry: () => ToolRegistry,
90
76
  Tracer: () => Tracer,
91
77
  VLLMProvider: () => VLLMProvider,
92
78
  VoiceAgent: () => VoiceAgent,
93
- VoiceAgentConfig: () => import_agentsea_types.VoiceAgentConfig,
94
- VoiceMessage: () => import_agentsea_types.VoiceMessage,
95
- VoiceType: () => import_agentsea_types.VoiceType,
96
79
  Workflow: () => Workflow,
97
80
  WorkflowFactory: () => WorkflowFactory,
98
81
  calculatorClient: () => calculatorClient,
@@ -100,6 +83,7 @@ __export(index_exports, {
100
83
  calculatorServer: () => calculatorServer,
101
84
  calculatorTool: () => calculatorTool,
102
85
  clientTool: () => clientTool,
86
+ codeEditTool: () => codeEditTool,
103
87
  createACPTools: () => createACPTools,
104
88
  createAnthropicProvider: () => createAnthropicProvider,
105
89
  createGeminiProvider: () => createGeminiProvider,
@@ -115,8 +99,16 @@ __export(index_exports, {
115
99
  fileListTool: () => fileListTool,
116
100
  fileReadTool: () => fileReadTool,
117
101
  fileWriteTool: () => fileWriteTool,
102
+ gitAddTool: () => gitAddTool,
103
+ gitBranchTool: () => gitBranchTool,
104
+ gitCommitTool: () => gitCommitTool,
105
+ gitDiffTool: () => gitDiffTool,
106
+ gitLogTool: () => gitLogTool,
107
+ gitStatusTool: () => gitStatusTool,
108
+ globTool: () => globTool,
118
109
  globalMetrics: () => globalMetrics,
119
110
  globalTracer: () => globalTracer,
111
+ grepTool: () => grepTool,
120
112
  httpRequestTool: () => httpRequestTool,
121
113
  hybridTool: () => hybridTool,
122
114
  mcpToolToAgenticTool: () => mcpToolToAgenticTool,
@@ -126,6 +118,7 @@ __export(index_exports, {
126
118
  n8nListWorkflowsTool: () => n8nListWorkflowsTool,
127
119
  n8nTriggerWebhookTool: () => n8nTriggerWebhookTool,
128
120
  serverTool: () => serverTool,
121
+ shellExecuteTool: () => shellExecuteTool,
129
122
  stringTransformTool: () => stringTransformTool,
130
123
  textSummaryTool: () => textSummaryTool,
131
124
  toLegacyTool: () => toLegacyTool,
@@ -302,6 +295,10 @@ var Agent = class {
302
295
  this.toolRegistry = toolRegistry;
303
296
  this.memory = memory;
304
297
  }
298
+ config;
299
+ provider;
300
+ toolRegistry;
301
+ memory;
305
302
  iterationCount = 0;
306
303
  /**
307
304
  * Execute the agent with the given input
@@ -1455,17 +1452,551 @@ async function pollExecutionStatus(executionId, apiKey, baseUrl, maxAttempts = 3
1455
1452
  );
1456
1453
  }
1457
1454
 
1458
- // src/tools/built-in/calculator.isomorphic.ts
1455
+ // src/tools/built-in/shell.tool.ts
1456
+ var import_child_process = require("child_process");
1457
+ var import_zod7 = require("zod");
1458
+ var MAX_OUTPUT_BYTES = 100 * 1024;
1459
+ var DEFAULT_TIMEOUT_MS = 3e4;
1460
+ var MAX_TIMEOUT_MS = 12e4;
1461
+ var DANGEROUS_PATTERNS = [
1462
+ /\brm\s+-[^\s]*r[^\s]*f[^\s]*\s+\/\s*$/,
1463
+ // rm -rf /
1464
+ /\brm\s+-[^\s]*f[^\s]*r[^\s]*\s+\/\s*$/,
1465
+ // rm -fr /
1466
+ /\bmkfs\b/,
1467
+ // mkfs (format disk)
1468
+ /:(){ :\|:& };:/,
1469
+ // fork bomb
1470
+ /\bdd\b.*\bof=\/dev\//,
1471
+ // dd to device
1472
+ /\b>\s*\/dev\/sd[a-z]/,
1473
+ // redirect to raw device
1474
+ /\bchmod\s+-R\s+777\s+\//,
1475
+ // chmod -R 777 /
1476
+ /\bchown\s+-R\s+.*\s+\/\s*$/
1477
+ // chown -R ... /
1478
+ ];
1479
+ var shellExecuteTool = {
1480
+ name: "shell_execute",
1481
+ description: "Execute a shell command and return stdout/stderr. Commands are checked against a safety blocklist. Non-zero exit codes return results (not errors) since tools like grep exit 1 on no matches.",
1482
+ parameters: import_zod7.z.object({
1483
+ command: import_zod7.z.string().describe("The shell command to execute"),
1484
+ cwd: import_zod7.z.string().optional().describe(
1485
+ "Working directory for the command (defaults to process.cwd())"
1486
+ ),
1487
+ timeout: import_zod7.z.number().min(1e3).max(MAX_TIMEOUT_MS).default(DEFAULT_TIMEOUT_MS).describe("Timeout in milliseconds (default 30s, max 120s)")
1488
+ }),
1489
+ execute: (params) => {
1490
+ for (const pattern of DANGEROUS_PATTERNS) {
1491
+ if (pattern.test(params.command)) {
1492
+ throw new Error(
1493
+ `Command blocked by safety filter: matches dangerous pattern. If you need to run this command, please do so directly in your terminal.`
1494
+ );
1495
+ }
1496
+ }
1497
+ const timeout = Math.min(params.timeout, MAX_TIMEOUT_MS);
1498
+ try {
1499
+ const output = (0, import_child_process.execSync)(params.command, {
1500
+ cwd: params.cwd || process.cwd(),
1501
+ timeout,
1502
+ encoding: "utf8",
1503
+ maxBuffer: MAX_OUTPUT_BYTES * 2,
1504
+ // allow some headroom
1505
+ stdio: ["pipe", "pipe", "pipe"]
1506
+ });
1507
+ const truncated = output.length > MAX_OUTPUT_BYTES;
1508
+ const content = truncated ? output.slice(0, MAX_OUTPUT_BYTES) + "\n... [output truncated at 100KB]" : output;
1509
+ return Promise.resolve({
1510
+ exitCode: 0,
1511
+ stdout: content,
1512
+ stderr: "",
1513
+ truncated
1514
+ });
1515
+ } catch (error) {
1516
+ const execError = error;
1517
+ if (execError.killed || execError.signal) {
1518
+ throw new Error(`Shell execution timed out after ${timeout}ms`);
1519
+ }
1520
+ if (execError.status !== void 0 && execError.status !== null) {
1521
+ const stdout = String(execError.stdout || "");
1522
+ const stderr = String(execError.stderr || "");
1523
+ const truncated = stdout.length > MAX_OUTPUT_BYTES;
1524
+ return Promise.resolve({
1525
+ exitCode: execError.status,
1526
+ stdout: truncated ? stdout.slice(0, MAX_OUTPUT_BYTES) + "\n... [output truncated at 100KB]" : stdout,
1527
+ stderr: stderr.slice(0, MAX_OUTPUT_BYTES),
1528
+ truncated
1529
+ });
1530
+ }
1531
+ throw new Error(
1532
+ `Shell execution failed: ${execError.message || String(error)}`
1533
+ );
1534
+ }
1535
+ }
1536
+ };
1537
+
1538
+ // src/tools/built-in/code-edit.tool.ts
1539
+ var import_fs2 = require("fs");
1459
1540
  var import_zod8 = require("zod");
1541
+ var codeEditTool = {
1542
+ name: "code_edit",
1543
+ description: "Edit a file by replacing an exact string match with new content. Uses literal string matching (not regex). Set oldString to empty and newString to content to insert at the beginning of the file. Set newString to empty to delete the matched text.",
1544
+ parameters: import_zod8.z.object({
1545
+ path: import_zod8.z.string().describe("Path to the file to edit"),
1546
+ oldString: import_zod8.z.string().describe(
1547
+ "The exact string to find and replace. Must match file content exactly including whitespace and indentation."
1548
+ ),
1549
+ newString: import_zod8.z.string().describe(
1550
+ "The replacement string. Use empty string to delete the matched text."
1551
+ ),
1552
+ expectedReplacements: import_zod8.z.number().int().min(1).default(1).describe(
1553
+ "Expected number of occurrences to replace. Fails if actual count differs. Defaults to 1."
1554
+ )
1555
+ }),
1556
+ execute: async (params) => {
1557
+ try {
1558
+ const content = await import_fs2.promises.readFile(params.path, "utf8");
1559
+ if (params.oldString === "") {
1560
+ const newContent2 = params.newString + content;
1561
+ await import_fs2.promises.writeFile(params.path, newContent2, "utf8");
1562
+ return {
1563
+ success: true,
1564
+ path: params.path,
1565
+ replacements: 1,
1566
+ message: "Content inserted at beginning of file"
1567
+ };
1568
+ }
1569
+ let count = 0;
1570
+ let searchFrom = 0;
1571
+ let idx = content.indexOf(params.oldString, searchFrom);
1572
+ while (idx !== -1) {
1573
+ count++;
1574
+ searchFrom = idx + params.oldString.length;
1575
+ idx = content.indexOf(params.oldString, searchFrom);
1576
+ }
1577
+ if (count === 0) {
1578
+ throw new Error(
1579
+ `String not found in ${params.path}. Make sure the oldString matches exactly, including whitespace and indentation.`
1580
+ );
1581
+ }
1582
+ if (count !== params.expectedReplacements) {
1583
+ throw new Error(
1584
+ `Expected ${params.expectedReplacements} occurrence(s) of the string, but found ${count} in ${params.path}. Provide more context in oldString to make the match unique, or set expectedReplacements to ${count}.`
1585
+ );
1586
+ }
1587
+ const newContent = content.split(params.oldString).join(params.newString);
1588
+ await import_fs2.promises.writeFile(params.path, newContent, "utf8");
1589
+ return {
1590
+ success: true,
1591
+ path: params.path,
1592
+ replacements: count,
1593
+ message: `Replaced ${count} occurrence(s)`
1594
+ };
1595
+ } catch (error) {
1596
+ if (error instanceof Error) {
1597
+ throw new Error(`Code edit failed: ${error.message}`);
1598
+ }
1599
+ throw error;
1600
+ }
1601
+ }
1602
+ };
1603
+
1604
+ // src/tools/built-in/glob.tool.ts
1605
+ var import_fs3 = require("fs");
1606
+ var import_fast_glob = __toESM(require("fast-glob"));
1607
+ var import_zod9 = require("zod");
1608
+ var DEFAULT_IGNORE = [
1609
+ "**/node_modules/**",
1610
+ "**/dist/**",
1611
+ "**/.git/**",
1612
+ "**/.next/**",
1613
+ "**/coverage/**",
1614
+ "**/.cache/**",
1615
+ "**/build/**"
1616
+ ];
1617
+ var globTool = {
1618
+ name: "glob",
1619
+ description: "Find files matching a glob pattern. Returns file paths sorted by modification time (newest first). Ignores node_modules, dist, .git, .next, coverage, .cache, and build directories by default.",
1620
+ parameters: import_zod9.z.object({
1621
+ pattern: import_zod9.z.string().describe(
1622
+ 'Glob pattern to match (e.g., "**/*.ts", "src/**/*.{ts,tsx}", "*.json")'
1623
+ ),
1624
+ cwd: import_zod9.z.string().optional().describe("Directory to search in (defaults to process.cwd())"),
1625
+ ignore: import_zod9.z.array(import_zod9.z.string()).optional().describe("Additional patterns to ignore"),
1626
+ maxResults: import_zod9.z.number().int().min(1).max(1e4).default(1e3).describe("Maximum number of results to return (default 1000)")
1627
+ }),
1628
+ execute: async (params) => {
1629
+ try {
1630
+ const cwd = params.cwd || process.cwd();
1631
+ const ignorePatterns = [...DEFAULT_IGNORE, ...params.ignore || []];
1632
+ const files = await (0, import_fast_glob.default)(params.pattern, {
1633
+ cwd,
1634
+ ignore: ignorePatterns,
1635
+ absolute: true,
1636
+ dot: false,
1637
+ onlyFiles: true
1638
+ });
1639
+ const withStats = await Promise.all(
1640
+ files.map(async (filePath) => {
1641
+ try {
1642
+ const stats = await import_fs3.promises.stat(filePath);
1643
+ return { path: filePath, mtime: stats.mtimeMs };
1644
+ } catch {
1645
+ return { path: filePath, mtime: 0 };
1646
+ }
1647
+ })
1648
+ );
1649
+ withStats.sort((a, b) => b.mtime - a.mtime);
1650
+ const limited = withStats.slice(0, params.maxResults);
1651
+ return {
1652
+ files: limited.map((f) => f.path),
1653
+ count: limited.length,
1654
+ totalMatches: files.length,
1655
+ truncated: files.length > params.maxResults
1656
+ };
1657
+ } catch (error) {
1658
+ if (error instanceof Error) {
1659
+ throw new Error(`Glob failed: ${error.message}`);
1660
+ }
1661
+ throw error;
1662
+ }
1663
+ }
1664
+ };
1665
+
1666
+ // src/tools/built-in/grep.tool.ts
1667
+ var import_fs4 = require("fs");
1668
+ var import_path2 = require("path");
1669
+ var import_zod10 = require("zod");
1670
+ var MAX_FILE_SIZE = 5 * 1024 * 1024;
1671
+ var DEFAULT_IGNORE_DIRS = /* @__PURE__ */ new Set([
1672
+ "node_modules",
1673
+ "dist",
1674
+ ".git",
1675
+ ".next",
1676
+ "coverage",
1677
+ ".cache",
1678
+ "build",
1679
+ "__pycache__",
1680
+ ".venv"
1681
+ ]);
1682
+ async function walkDir(dir, includePattern) {
1683
+ const results = [];
1684
+ const entries = await import_fs4.promises.readdir(dir, { withFileTypes: true });
1685
+ for (const entry of entries) {
1686
+ if (DEFAULT_IGNORE_DIRS.has(entry.name)) continue;
1687
+ if (entry.name.startsWith(".") && entry.name !== ".env.example") continue;
1688
+ const fullPath = (0, import_path2.join)(dir, entry.name);
1689
+ if (entry.isDirectory()) {
1690
+ const subResults = await walkDir(fullPath, includePattern);
1691
+ results.push(...subResults);
1692
+ } else if (entry.isFile()) {
1693
+ if (includePattern && !includePattern.test(entry.name)) continue;
1694
+ results.push(fullPath);
1695
+ }
1696
+ }
1697
+ return results;
1698
+ }
1699
+ async function searchFile(filePath, regex, contextLines) {
1700
+ const stats = await import_fs4.promises.stat(filePath);
1701
+ if (stats.size > MAX_FILE_SIZE) return [];
1702
+ const content = await import_fs4.promises.readFile(filePath, "utf8");
1703
+ const lines = content.split("\n");
1704
+ const matches = [];
1705
+ for (let i = 0; i < lines.length; i++) {
1706
+ regex.lastIndex = 0;
1707
+ if (regex.test(lines[i])) {
1708
+ const match = {
1709
+ file: filePath,
1710
+ line: i + 1,
1711
+ content: lines[i]
1712
+ };
1713
+ if (contextLines > 0) {
1714
+ const beforeStart = Math.max(0, i - contextLines);
1715
+ match.contextBefore = lines.slice(beforeStart, i);
1716
+ const afterEnd = Math.min(lines.length, i + 1 + contextLines);
1717
+ match.contextAfter = lines.slice(i + 1, afterEnd);
1718
+ }
1719
+ matches.push(match);
1720
+ }
1721
+ }
1722
+ return matches;
1723
+ }
1724
+ var grepTool = {
1725
+ name: "grep",
1726
+ description: "Search for a regex pattern across files recursively. Skips files larger than 5MB and ignores common non-source directories. Returns matching lines with optional context.",
1727
+ parameters: import_zod10.z.object({
1728
+ pattern: import_zod10.z.string().describe("Regex pattern to search for"),
1729
+ path: import_zod10.z.string().optional().describe("Directory or file to search in (defaults to process.cwd())"),
1730
+ include: import_zod10.z.string().optional().describe('File name pattern to include (e.g., "*.ts", "*.{js,jsx}")'),
1731
+ caseInsensitive: import_zod10.z.boolean().default(false).describe("Whether to perform case-insensitive matching"),
1732
+ contextLines: import_zod10.z.number().int().min(0).max(10).default(0).describe("Number of context lines before and after each match"),
1733
+ maxResults: import_zod10.z.number().int().min(1).max(1e3).default(100).describe("Maximum number of matches to return")
1734
+ }),
1735
+ execute: async (params) => {
1736
+ try {
1737
+ const searchPath = params.path || process.cwd();
1738
+ const flags = params.caseInsensitive ? "gi" : "g";
1739
+ let includePattern = null;
1740
+ if (params.include) {
1741
+ const escaped = params.include.replace(/\./g, "\\.").replace(/\*/g, ".*").replace(/\{([^}]+)\}/g, (_match, group) => {
1742
+ return `(${group.split(",").join("|")})`;
1743
+ });
1744
+ includePattern = new RegExp(`^${escaped}$`);
1745
+ }
1746
+ const stat = await import_fs4.promises.stat(searchPath);
1747
+ let files;
1748
+ if (stat.isFile()) {
1749
+ files = [searchPath];
1750
+ } else {
1751
+ files = await walkDir(searchPath, includePattern);
1752
+ }
1753
+ const allMatches = [];
1754
+ for (const file of files) {
1755
+ if (allMatches.length >= params.maxResults) break;
1756
+ try {
1757
+ const matches = await searchFile(
1758
+ file,
1759
+ new RegExp(params.pattern, flags),
1760
+ params.contextLines
1761
+ );
1762
+ for (const match of matches) {
1763
+ if (allMatches.length >= params.maxResults) break;
1764
+ match.file = stat.isFile() ? match.file : (0, import_path2.relative)(searchPath, match.file);
1765
+ allMatches.push(match);
1766
+ }
1767
+ } catch {
1768
+ }
1769
+ }
1770
+ return {
1771
+ matches: allMatches,
1772
+ count: allMatches.length,
1773
+ filesSearched: files.length,
1774
+ truncated: allMatches.length >= params.maxResults
1775
+ };
1776
+ } catch (error) {
1777
+ if (error instanceof Error) {
1778
+ throw new Error(`Grep failed: ${error.message}`);
1779
+ }
1780
+ throw error;
1781
+ }
1782
+ }
1783
+ };
1784
+
1785
+ // src/tools/built-in/git.tool.ts
1786
+ var import_child_process2 = require("child_process");
1787
+ var import_zod11 = require("zod");
1788
+ var GIT_TIMEOUT_MS = 3e4;
1789
+ function gitExec(args, cwd) {
1790
+ return (0, import_child_process2.execSync)(`git ${args}`, {
1791
+ cwd: cwd || process.cwd(),
1792
+ timeout: GIT_TIMEOUT_MS,
1793
+ encoding: "utf8",
1794
+ stdio: ["pipe", "pipe", "pipe"]
1795
+ }).trim();
1796
+ }
1797
+ var gitStatusTool = {
1798
+ name: "git_status",
1799
+ description: "Show the working tree status. Returns staged, unstaged, and untracked files.",
1800
+ parameters: import_zod11.z.object({
1801
+ cwd: import_zod11.z.string().optional().describe("Repository directory")
1802
+ }),
1803
+ execute: (params) => {
1804
+ try {
1805
+ const output = gitExec("status --porcelain", params.cwd);
1806
+ const branch = gitExec("branch --show-current", params.cwd);
1807
+ const staged = [];
1808
+ const unstaged = [];
1809
+ const untracked = [];
1810
+ for (const line of output.split("\n")) {
1811
+ if (!line.trim()) continue;
1812
+ const index = line[0];
1813
+ const worktree = line[1];
1814
+ const file = line.slice(3);
1815
+ if (index === "?") {
1816
+ untracked.push(file);
1817
+ } else {
1818
+ if (index !== " " && index !== "?") staged.push(file);
1819
+ if (worktree !== " " && worktree !== "?") unstaged.push(file);
1820
+ }
1821
+ }
1822
+ return Promise.resolve({
1823
+ branch,
1824
+ staged,
1825
+ unstaged,
1826
+ untracked,
1827
+ clean: staged.length === 0 && unstaged.length === 0 && untracked.length === 0,
1828
+ raw: output
1829
+ });
1830
+ } catch (error) {
1831
+ if (error instanceof Error) {
1832
+ throw new Error(`Git status failed: ${error.message}`);
1833
+ }
1834
+ throw error;
1835
+ }
1836
+ }
1837
+ };
1838
+ var gitDiffTool = {
1839
+ name: "git_diff",
1840
+ description: "Show changes between commits, commit and working tree, etc.",
1841
+ parameters: import_zod11.z.object({
1842
+ staged: import_zod11.z.boolean().default(false).describe("Show staged changes (--cached)"),
1843
+ path: import_zod11.z.string().optional().describe("Limit diff to specific path"),
1844
+ cwd: import_zod11.z.string().optional().describe("Repository directory")
1845
+ }),
1846
+ execute: (params) => {
1847
+ try {
1848
+ let args = "diff";
1849
+ if (params.staged) args += " --cached";
1850
+ if (params.path) args += ` -- ${params.path}`;
1851
+ const output = gitExec(args, params.cwd);
1852
+ return Promise.resolve({
1853
+ diff: output,
1854
+ hasChanges: output.length > 0
1855
+ });
1856
+ } catch (error) {
1857
+ if (error instanceof Error) {
1858
+ throw new Error(`Git diff failed: ${error.message}`);
1859
+ }
1860
+ throw error;
1861
+ }
1862
+ }
1863
+ };
1864
+ var gitAddTool = {
1865
+ name: "git_add",
1866
+ description: "Add file contents to the staging area.",
1867
+ parameters: import_zod11.z.object({
1868
+ paths: import_zod11.z.array(import_zod11.z.string()).min(1).describe("Files to add to staging"),
1869
+ cwd: import_zod11.z.string().optional().describe("Repository directory")
1870
+ }),
1871
+ execute: (params) => {
1872
+ try {
1873
+ const escapedPaths = params.paths.map((p) => `"${p}"`).join(" ");
1874
+ gitExec(`add ${escapedPaths}`, params.cwd);
1875
+ return Promise.resolve({
1876
+ success: true,
1877
+ added: params.paths
1878
+ });
1879
+ } catch (error) {
1880
+ if (error instanceof Error) {
1881
+ throw new Error(`Git add failed: ${error.message}`);
1882
+ }
1883
+ throw error;
1884
+ }
1885
+ }
1886
+ };
1887
+ var gitCommitTool = {
1888
+ name: "git_commit",
1889
+ description: "Record changes to the repository.",
1890
+ parameters: import_zod11.z.object({
1891
+ message: import_zod11.z.string().min(1).describe("Commit message"),
1892
+ cwd: import_zod11.z.string().optional().describe("Repository directory")
1893
+ }),
1894
+ execute: (params) => {
1895
+ try {
1896
+ const safeMessage = params.message.replace(/'/g, "'\\''");
1897
+ const output = gitExec(`commit -m '${safeMessage}'`, params.cwd);
1898
+ return Promise.resolve({
1899
+ success: true,
1900
+ output
1901
+ });
1902
+ } catch (error) {
1903
+ if (error instanceof Error) {
1904
+ throw new Error(`Git commit failed: ${error.message}`);
1905
+ }
1906
+ throw error;
1907
+ }
1908
+ }
1909
+ };
1910
+ var gitLogTool = {
1911
+ name: "git_log",
1912
+ description: "Show commit logs.",
1913
+ parameters: import_zod11.z.object({
1914
+ maxCount: import_zod11.z.number().int().min(1).max(100).default(10).describe("Maximum number of commits to show"),
1915
+ oneline: import_zod11.z.boolean().default(true).describe("Show each commit on a single line"),
1916
+ path: import_zod11.z.string().optional().describe("Limit to commits affecting this path"),
1917
+ cwd: import_zod11.z.string().optional().describe("Repository directory")
1918
+ }),
1919
+ execute: (params) => {
1920
+ try {
1921
+ let args = `log -${params.maxCount}`;
1922
+ if (params.oneline) {
1923
+ args += " --oneline";
1924
+ } else {
1925
+ args += " --format=%H%n%an%n%ae%n%ai%n%s%n---";
1926
+ }
1927
+ if (params.path) args += ` -- ${params.path}`;
1928
+ const output = gitExec(args, params.cwd);
1929
+ if (params.oneline) {
1930
+ const commits = output.split("\n").filter(Boolean).map((line) => {
1931
+ const spaceIdx = line.indexOf(" ");
1932
+ return {
1933
+ hash: line.slice(0, spaceIdx),
1934
+ message: line.slice(spaceIdx + 1)
1935
+ };
1936
+ });
1937
+ return Promise.resolve({ commits, count: commits.length });
1938
+ }
1939
+ return Promise.resolve({ log: output });
1940
+ } catch (error) {
1941
+ if (error instanceof Error) {
1942
+ throw new Error(`Git log failed: ${error.message}`);
1943
+ }
1944
+ throw error;
1945
+ }
1946
+ }
1947
+ };
1948
+ var gitBranchTool = {
1949
+ name: "git_branch",
1950
+ description: "List, create, or switch branches.",
1951
+ parameters: import_zod11.z.object({
1952
+ action: import_zod11.z.enum(["list", "create", "switch"]).default("list").describe("Action to perform"),
1953
+ name: import_zod11.z.string().optional().describe("Branch name (required for create/switch)"),
1954
+ cwd: import_zod11.z.string().optional().describe("Repository directory")
1955
+ }),
1956
+ execute: (params) => {
1957
+ try {
1958
+ switch (params.action) {
1959
+ case "list": {
1960
+ const output = gitExec("branch -a", params.cwd);
1961
+ const current = gitExec("branch --show-current", params.cwd);
1962
+ const branches = output.split("\n").filter(Boolean).map((b) => b.replace(/^\*?\s+/, "").trim());
1963
+ return Promise.resolve({ branches, current });
1964
+ }
1965
+ case "create": {
1966
+ if (!params.name) {
1967
+ throw new Error("Branch name is required for create action");
1968
+ }
1969
+ gitExec(`branch ${params.name}`, params.cwd);
1970
+ return Promise.resolve({ success: true, created: params.name });
1971
+ }
1972
+ case "switch": {
1973
+ if (!params.name) {
1974
+ throw new Error("Branch name is required for switch action");
1975
+ }
1976
+ gitExec(`checkout ${params.name}`, params.cwd);
1977
+ return Promise.resolve({ success: true, switched: params.name });
1978
+ }
1979
+ }
1980
+ } catch (error) {
1981
+ if (error instanceof Error) {
1982
+ throw new Error(`Git branch failed: ${error.message}`);
1983
+ }
1984
+ throw error;
1985
+ }
1986
+ }
1987
+ };
1988
+
1989
+ // src/tools/built-in/calculator.isomorphic.ts
1990
+ var import_zod13 = require("zod");
1460
1991
 
1461
1992
  // src/tools/tool-definition.ts
1462
- var import_zod7 = require("zod");
1993
+ var import_zod12 = require("zod");
1463
1994
  function toolDefinition(options) {
1464
1995
  const {
1465
1996
  name,
1466
1997
  description,
1467
1998
  inputSchema,
1468
- outputSchema = import_zod7.z.unknown(),
1999
+ outputSchema = import_zod12.z.unknown(),
1469
2000
  needsApproval = false,
1470
2001
  retryConfig
1471
2002
  } = options;
@@ -1573,13 +2104,13 @@ function toLegacyTools(tools) {
1573
2104
  }
1574
2105
 
1575
2106
  // 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")
2107
+ var calculatorInputSchema = import_zod13.z.object({
2108
+ operation: import_zod13.z.enum(["add", "subtract", "multiply", "divide"]).describe("The arithmetic operation to perform"),
2109
+ a: import_zod13.z.number().describe("First number"),
2110
+ b: import_zod13.z.number().describe("Second number")
1580
2111
  });
1581
- var calculatorOutputSchema = import_zod8.z.object({
1582
- result: import_zod8.z.number().describe("The result of the calculation")
2112
+ var calculatorOutputSchema = import_zod13.z.object({
2113
+ result: import_zod13.z.number().describe("The result of the calculation")
1583
2114
  });
1584
2115
  var calculatorDef = toolDefinition({
1585
2116
  name: "calculator",
@@ -1614,6 +2145,8 @@ var calculatorClient = calculatorDef.client(({ operation, a, b }) => {
1614
2145
  // src/providers/anthropic.ts
1615
2146
  var import_sdk = __toESM(require("@anthropic-ai/sdk"));
1616
2147
  var import_zod_to_json_schema = require("zod-to-json-schema");
2148
+ var SAMPLING_REMOVED = /^claude-(opus-4-[789]|fable-5|mythos-5)/;
2149
+ var ADAPTIVE_THINKING = /^claude-(opus-4-[6789]|sonnet-4-6|fable-5|mythos-5)/;
1617
2150
  var AnthropicProvider = class {
1618
2151
  client;
1619
2152
  constructor(apiKey) {
@@ -1621,6 +2154,30 @@ var AnthropicProvider = class {
1621
2154
  apiKey: apiKey || process.env.ANTHROPIC_API_KEY
1622
2155
  });
1623
2156
  }
2157
+ /**
2158
+ * Build model-aware request parameters. Modern Claude models reject
2159
+ * removed sampling params, and Claude 4+ rejects temperature and
2160
+ * top_p together — temperature wins when both are configured.
2161
+ */
2162
+ buildRequestParams(config, defaultMaxTokens) {
2163
+ const params = {
2164
+ max_tokens: config.maxTokens || defaultMaxTokens
2165
+ };
2166
+ if (!SAMPLING_REMOVED.test(config.model)) {
2167
+ if (config.temperature !== void 0) {
2168
+ params.temperature = config.temperature;
2169
+ } else if (config.topP !== void 0) {
2170
+ params.top_p = config.topP;
2171
+ }
2172
+ }
2173
+ if (config.thinking && ADAPTIVE_THINKING.test(config.model)) {
2174
+ params.thinking = config.thinking === true ? { type: "adaptive" } : config.thinking;
2175
+ }
2176
+ if (config.effort && ADAPTIVE_THINKING.test(config.model)) {
2177
+ params.output_config = { effort: config.effort };
2178
+ }
2179
+ return params;
2180
+ }
1624
2181
  /**
1625
2182
  * Generate a response from Claude
1626
2183
  */
@@ -1633,14 +2190,12 @@ var AnthropicProvider = class {
1633
2190
  })) : void 0;
1634
2191
  const response = await this.client.messages.create({
1635
2192
  model: config.model,
1636
- max_tokens: config.maxTokens || 1024,
1637
- temperature: config.temperature,
1638
2193
  system: config.systemPrompt,
1639
2194
  messages: anthropicMessages,
1640
2195
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1641
2196
  tools,
1642
- top_p: config.topP,
1643
- stop_sequences: config.stopSequences
2197
+ stop_sequences: config.stopSequences,
2198
+ ...this.buildRequestParams(config, 16e3)
1644
2199
  });
1645
2200
  const textContent = response.content.filter((block) => block.type === "text").map((block) => block.text).join("\n");
1646
2201
  return {
@@ -1665,14 +2220,12 @@ var AnthropicProvider = class {
1665
2220
  })) : void 0;
1666
2221
  const stream = await this.client.messages.stream({
1667
2222
  model: config.model,
1668
- max_tokens: config.maxTokens || 1024,
1669
- temperature: config.temperature,
1670
2223
  system: config.systemPrompt,
1671
2224
  messages: anthropicMessages,
1672
2225
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1673
2226
  tools,
1674
- top_p: config.topP,
1675
- stop_sequences: config.stopSequences
2227
+ stop_sequences: config.stopSequences,
2228
+ ...this.buildRequestParams(config, 64e3)
1676
2229
  });
1677
2230
  for await (const event of stream) {
1678
2231
  if (event.type === "content_block_delta") {
@@ -1854,6 +2407,9 @@ var OpenAIProvider = class {
1854
2407
  const choice = rawResponse.choices[0];
1855
2408
  if (choice?.message.tool_calls) {
1856
2409
  for (const toolCall of choice.message.tool_calls) {
2410
+ if (toolCall.type !== "function") {
2411
+ continue;
2412
+ }
1857
2413
  toolCalls.push({
1858
2414
  id: toolCall.id,
1859
2415
  tool: toolCall.function.name,
@@ -1913,7 +2469,7 @@ var GeminiProvider = class {
1913
2469
  * Generate a response from the Gemini model
1914
2470
  */
1915
2471
  async generateResponse(messages, config) {
1916
- const model = this.getModel(config.model || "gemini-pro");
2472
+ const model = this.getModel(config.model || "gemini-3.1-pro-preview");
1917
2473
  const contents = this.convertMessages(messages);
1918
2474
  const generationConfig = {
1919
2475
  temperature: config.temperature || 0.7,
@@ -1947,7 +2503,7 @@ var GeminiProvider = class {
1947
2503
  * Stream responses from Gemini
1948
2504
  */
1949
2505
  async *streamResponse(messages, config) {
1950
- const model = this.getModel(config.model || "gemini-pro");
2506
+ const model = this.getModel(config.model || "gemini-3.1-pro-preview");
1951
2507
  const contents = this.convertMessages(messages);
1952
2508
  const generationConfig = {
1953
2509
  temperature: config.temperature || 0.7,
@@ -2430,6 +2986,9 @@ var OpenAICompatibleProvider = class {
2430
2986
  const choice = rawResponse.choices[0];
2431
2987
  if (choice?.message.tool_calls) {
2432
2988
  for (const toolCall of choice.message.tool_calls) {
2989
+ if (toolCall.type !== "function") {
2990
+ continue;
2991
+ }
2433
2992
  toolCalls.push({
2434
2993
  id: toolCall.id,
2435
2994
  tool: toolCall.function.name,
@@ -2535,6 +3094,24 @@ function createProvider(config) {
2535
3094
  case "gemini":
2536
3095
  provider = new GeminiProvider();
2537
3096
  break;
3097
+ case "mistral":
3098
+ provider = new OpenAICompatibleProvider({
3099
+ baseUrl: "https://api.mistral.ai/v1",
3100
+ apiKey: process.env.MISTRAL_API_KEY
3101
+ });
3102
+ break;
3103
+ case "deepseek":
3104
+ provider = new OpenAICompatibleProvider({
3105
+ baseUrl: "https://api.deepseek.com/v1",
3106
+ apiKey: process.env.DEEPSEEK_API_KEY
3107
+ });
3108
+ break;
3109
+ case "xai":
3110
+ provider = new OpenAICompatibleProvider({
3111
+ baseUrl: "https://api.x.ai/v1",
3112
+ apiKey: process.env.XAI_API_KEY
3113
+ });
3114
+ break;
2538
3115
  case "ollama":
2539
3116
  provider = new OllamaProvider();
2540
3117
  break;
@@ -2612,6 +3189,7 @@ var BufferMemory = class {
2612
3189
  constructor(maxMessages) {
2613
3190
  this.maxMessages = maxMessages;
2614
3191
  }
3192
+ maxMessages;
2615
3193
  store = /* @__PURE__ */ new Map();
2616
3194
  /**
2617
3195
  * Save messages to memory
@@ -2732,11 +3310,14 @@ var RedisMemory = class {
2732
3310
 
2733
3311
  // src/memory/summary-memory.ts
2734
3312
  var SummaryMemory = class {
2735
- constructor(provider, maxRecentMessages = 10, summaryModel = "claude-3-haiku-20240307") {
3313
+ constructor(provider, maxRecentMessages = 10, summaryModel = "claude-haiku-4-5") {
2736
3314
  this.provider = provider;
2737
3315
  this.maxRecentMessages = maxRecentMessages;
2738
3316
  this.summaryModel = summaryModel;
2739
3317
  }
3318
+ provider;
3319
+ maxRecentMessages;
3320
+ summaryModel;
2740
3321
  store = /* @__PURE__ */ new Map();
2741
3322
  /**
2742
3323
  * Save messages with automatic summarization
@@ -2826,6 +3407,7 @@ var TenantBufferMemory = class {
2826
3407
  constructor(maxMessages) {
2827
3408
  this.maxMessages = maxMessages;
2828
3409
  }
3410
+ maxMessages;
2829
3411
  store = /* @__PURE__ */ new Map();
2830
3412
  /**
2831
3413
  * Save messages to memory with tenant isolation
@@ -2935,6 +3517,10 @@ var Workflow = class {
2935
3517
  this.memory = memory;
2936
3518
  this.initializeAgents();
2937
3519
  }
3520
+ config;
3521
+ provider;
3522
+ toolRegistry;
3523
+ memory;
2938
3524
  agents = /* @__PURE__ */ new Map();
2939
3525
  /**
2940
3526
  * Initialize all agents in the workflow
@@ -3483,6 +4069,8 @@ var RateLimiter = class {
3483
4069
  this.tokens = maxTokens;
3484
4070
  this.lastRefill = Date.now();
3485
4071
  }
4072
+ maxTokens;
4073
+ refillRate;
3486
4074
  tokens;
3487
4075
  lastRefill;
3488
4076
  /**
@@ -3541,6 +4129,8 @@ var SlidingWindowRateLimiter = class {
3541
4129
  this.maxRequests = maxRequests;
3542
4130
  this.windowMs = windowMs;
3543
4131
  }
4132
+ maxRequests;
4133
+ windowMs;
3544
4134
  requests = /* @__PURE__ */ new Map();
3545
4135
  /**
3546
4136
  * Check if request is allowed
@@ -3585,6 +4175,7 @@ var Cache = class {
3585
4175
  constructor(defaultTTL) {
3586
4176
  this.defaultTTL = defaultTTL;
3587
4177
  }
4178
+ defaultTTL;
3588
4179
  store = /* @__PURE__ */ new Map();
3589
4180
  /**
3590
4181
  * Set a value in the cache
@@ -3687,6 +4278,7 @@ var LRUCache = class {
3687
4278
  constructor(maxSize) {
3688
4279
  this.maxSize = maxSize;
3689
4280
  }
4281
+ maxSize;
3690
4282
  cache = /* @__PURE__ */ new Map();
3691
4283
  /**
3692
4284
  * Get a value from the cache
@@ -3745,7 +4337,7 @@ var LRUCache = class {
3745
4337
  var import_events2 = require("events");
3746
4338
 
3747
4339
  // src/mcp/transport.ts
3748
- var import_child_process = require("child_process");
4340
+ var import_child_process3 = require("child_process");
3749
4341
  var import_events = require("events");
3750
4342
  var StdioTransport = class extends import_events.EventEmitter {
3751
4343
  constructor(command, args = [], env) {
@@ -3754,13 +4346,16 @@ var StdioTransport = class extends import_events.EventEmitter {
3754
4346
  this.args = args;
3755
4347
  this.env = env;
3756
4348
  }
4349
+ command;
4350
+ args;
4351
+ env;
3757
4352
  process = null;
3758
4353
  connected = false;
3759
4354
  buffer = "";
3760
4355
  async connect() {
3761
4356
  return new Promise((resolve, reject) => {
3762
4357
  try {
3763
- this.process = (0, import_child_process.spawn)(this.command, this.args, {
4358
+ this.process = (0, import_child_process3.spawn)(this.command, this.args, {
3764
4359
  env: { ...process.env, ...this.env },
3765
4360
  stdio: ["pipe", "pipe", "pipe"]
3766
4361
  });
@@ -3825,6 +4420,7 @@ var SSETransport = class extends import_events.EventEmitter {
3825
4420
  super();
3826
4421
  this.url = url;
3827
4422
  }
4423
+ url;
3828
4424
  eventSource = null;
3829
4425
  connected = false;
3830
4426
  async connect() {
@@ -3892,6 +4488,7 @@ var MCPClient = class extends import_events2.EventEmitter {
3892
4488
  super();
3893
4489
  this.config = config;
3894
4490
  }
4491
+ config;
3895
4492
  transport = null;
3896
4493
  serverInfo = null;
3897
4494
  requestId = 0;
@@ -4098,7 +4695,7 @@ var MCPClient = class extends import_events2.EventEmitter {
4098
4695
  };
4099
4696
 
4100
4697
  // src/mcp/tool-adapter.ts
4101
- var import_zod9 = require("zod");
4698
+ var import_zod14 = require("zod");
4102
4699
  function mcpToolToAgenticTool(mcpTool, client) {
4103
4700
  const zodSchema = jsonSchemaToZod(mcpTool.inputSchema);
4104
4701
  return {
@@ -4133,25 +4730,25 @@ function jsonSchemaToZod(schema) {
4133
4730
  let zodType;
4134
4731
  switch (propSchema.type) {
4135
4732
  case "string":
4136
- zodType = import_zod9.z.string();
4733
+ zodType = import_zod14.z.string();
4137
4734
  if (typeof propSchema.description === "string") {
4138
4735
  zodType = zodType.describe(propSchema.description);
4139
4736
  }
4140
4737
  break;
4141
4738
  case "number":
4142
- zodType = import_zod9.z.number();
4739
+ zodType = import_zod14.z.number();
4143
4740
  if (typeof propSchema.description === "string") {
4144
4741
  zodType = zodType.describe(propSchema.description);
4145
4742
  }
4146
4743
  break;
4147
4744
  case "boolean":
4148
- zodType = import_zod9.z.boolean();
4745
+ zodType = import_zod14.z.boolean();
4149
4746
  if (typeof propSchema.description === "string") {
4150
4747
  zodType = zodType.describe(propSchema.description);
4151
4748
  }
4152
4749
  break;
4153
4750
  case "array":
4154
- zodType = import_zod9.z.array(
4751
+ zodType = import_zod14.z.array(
4155
4752
  jsonSchemaToZod(
4156
4753
  propSchema.items || {}
4157
4754
  )
@@ -4164,7 +4761,7 @@ function jsonSchemaToZod(schema) {
4164
4761
  zodType = jsonSchemaToZod(propSchema);
4165
4762
  break;
4166
4763
  default:
4167
- zodType = import_zod9.z.any();
4764
+ zodType = import_zod14.z.any();
4168
4765
  }
4169
4766
  const required = schema.required;
4170
4767
  if (!required?.includes(key)) {
@@ -4172,9 +4769,9 @@ function jsonSchemaToZod(schema) {
4172
4769
  }
4173
4770
  shape[key] = zodType;
4174
4771
  }
4175
- return import_zod9.z.object(shape);
4772
+ return import_zod14.z.object(shape);
4176
4773
  }
4177
- return import_zod9.z.any();
4774
+ return import_zod14.z.any();
4178
4775
  }
4179
4776
 
4180
4777
  // src/mcp/registry.ts
@@ -4571,7 +5168,7 @@ var ACPClient = class {
4571
5168
  };
4572
5169
 
4573
5170
  // src/acp/tools.ts
4574
- var import_zod10 = require("zod");
5171
+ var import_zod15 = require("zod");
4575
5172
  function createACPTools(client) {
4576
5173
  return [
4577
5174
  createSearchProductsTool(client),
@@ -4594,15 +5191,15 @@ function createSearchProductsTool(client) {
4594
5191
  return {
4595
5192
  name: "acp_search_products",
4596
5193
  description: "Search for products in the commerce catalog. Supports filtering by query text, category, price range, and sorting.",
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")
5194
+ parameters: import_zod15.z.object({
5195
+ query: import_zod15.z.string().optional().describe("Search query text"),
5196
+ category: import_zod15.z.string().optional().describe("Product category filter"),
5197
+ minPrice: import_zod15.z.number().optional().describe("Minimum price filter"),
5198
+ maxPrice: import_zod15.z.number().optional().describe("Maximum price filter"),
5199
+ limit: import_zod15.z.number().optional().default(10).describe("Maximum number of results"),
5200
+ offset: import_zod15.z.number().optional().default(0).describe("Pagination offset"),
5201
+ sortBy: import_zod15.z.enum(["price", "name", "popularity", "newest"]).optional().describe("Sort field"),
5202
+ sortOrder: import_zod15.z.enum(["asc", "desc"]).optional().default("asc").describe("Sort order")
4606
5203
  }),
4607
5204
  execute: async (params) => {
4608
5205
  const response = await client.searchProducts(params);
@@ -4621,8 +5218,8 @@ function createGetProductTool(client) {
4621
5218
  return {
4622
5219
  name: "acp_get_product",
4623
5220
  description: "Get detailed information about a specific product by its ID.",
4624
- parameters: import_zod10.z.object({
4625
- productId: import_zod10.z.string().describe("Product ID")
5221
+ parameters: import_zod15.z.object({
5222
+ productId: import_zod15.z.string().describe("Product ID")
4626
5223
  }),
4627
5224
  execute: async (params) => {
4628
5225
  const response = await client.getProduct(params.productId);
@@ -4637,7 +5234,7 @@ function createCreateCartTool(client) {
4637
5234
  return {
4638
5235
  name: "acp_create_cart",
4639
5236
  description: "Create a new shopping cart for the customer. Returns the cart ID for subsequent operations.",
4640
- parameters: import_zod10.z.object({}),
5237
+ parameters: import_zod15.z.object({}),
4641
5238
  execute: async () => {
4642
5239
  const response = await client.createCart();
4643
5240
  if (response.error) {
@@ -4651,14 +5248,14 @@ function createAddToCartTool(client) {
4651
5248
  return {
4652
5249
  name: "acp_add_to_cart",
4653
5250
  description: "Add a product to the shopping cart with specified quantity.",
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)")
5251
+ parameters: import_zod15.z.object({
5252
+ cartId: import_zod15.z.string().describe("Cart ID"),
5253
+ productId: import_zod15.z.string().describe("Product ID to add"),
5254
+ variantId: import_zod15.z.string().optional().describe("Product variant ID"),
5255
+ quantity: import_zod15.z.number().min(1).describe("Quantity to add"),
5256
+ price: import_zod15.z.object({
5257
+ amount: import_zod15.z.number().describe("Price amount"),
5258
+ currency: import_zod15.z.string().describe("Currency code (e.g., USD, EUR)")
4662
5259
  }).describe("Product price")
4663
5260
  }),
4664
5261
  execute: async (params) => {
@@ -4681,10 +5278,10 @@ function createUpdateCartItemTool(client) {
4681
5278
  return {
4682
5279
  name: "acp_update_cart_item",
4683
5280
  description: "Update the quantity of an item in the shopping cart.",
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)")
5281
+ parameters: import_zod15.z.object({
5282
+ cartId: import_zod15.z.string().describe("Cart ID"),
5283
+ productId: import_zod15.z.string().describe("Product ID to update"),
5284
+ quantity: import_zod15.z.number().min(0).describe("New quantity (0 to remove)")
4688
5285
  }),
4689
5286
  execute: async (params) => {
4690
5287
  const response = await client.updateCartItem(
@@ -4705,9 +5302,9 @@ function createRemoveFromCartTool(client) {
4705
5302
  return {
4706
5303
  name: "acp_remove_from_cart",
4707
5304
  description: "Remove a product from the shopping cart.",
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")
5305
+ parameters: import_zod15.z.object({
5306
+ cartId: import_zod15.z.string().describe("Cart ID"),
5307
+ productId: import_zod15.z.string().describe("Product ID to remove")
4711
5308
  }),
4712
5309
  execute: async (params) => {
4713
5310
  const response = await client.removeFromCart(
@@ -4727,8 +5324,8 @@ function createGetCartTool(client) {
4727
5324
  return {
4728
5325
  name: "acp_get_cart",
4729
5326
  description: "Get the current state of a shopping cart including all items and total amount.",
4730
- parameters: import_zod10.z.object({
4731
- cartId: import_zod10.z.string().describe("Cart ID")
5327
+ parameters: import_zod15.z.object({
5328
+ cartId: import_zod15.z.string().describe("Cart ID")
4732
5329
  }),
4733
5330
  execute: async (params) => {
4734
5331
  const response = await client.getCart(params.cartId);
@@ -4743,12 +5340,12 @@ function createCheckoutTool(client) {
4743
5340
  return {
4744
5341
  name: "acp_create_checkout",
4745
5342
  description: "Create a checkout session from a shopping cart to begin the purchase process.",
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")
5343
+ parameters: import_zod15.z.object({
5344
+ cartId: import_zod15.z.string().describe("Cart ID"),
5345
+ customer: import_zod15.z.object({
5346
+ email: import_zod15.z.string().email().describe("Customer email"),
5347
+ name: import_zod15.z.string().optional().describe("Customer name"),
5348
+ phone: import_zod15.z.string().optional().describe("Customer phone number")
4752
5349
  }).optional().describe("Customer information")
4753
5350
  }),
4754
5351
  execute: async (params) => {
@@ -4769,15 +5366,15 @@ function createUpdateShippingAddressTool(client) {
4769
5366
  return {
4770
5367
  name: "acp_update_shipping_address",
4771
5368
  description: "Update the shipping address for a checkout session.",
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)")
5369
+ parameters: import_zod15.z.object({
5370
+ sessionId: import_zod15.z.string().describe("Checkout session ID"),
5371
+ address: import_zod15.z.object({
5372
+ line1: import_zod15.z.string().describe("Address line 1"),
5373
+ line2: import_zod15.z.string().optional().describe("Address line 2"),
5374
+ city: import_zod15.z.string().describe("City"),
5375
+ state: import_zod15.z.string().optional().describe("State/Province"),
5376
+ postalCode: import_zod15.z.string().describe("Postal/ZIP code"),
5377
+ country: import_zod15.z.string().describe("Country code (e.g., US, GB)")
4781
5378
  }).describe("Shipping address")
4782
5379
  }),
4783
5380
  execute: async (params) => {
@@ -4798,12 +5395,12 @@ function createUpdatePaymentMethodTool(client) {
4798
5395
  return {
4799
5396
  name: "acp_update_payment_method",
4800
5397
  description: "Update the payment method for a checkout session.",
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)")
5398
+ parameters: import_zod15.z.object({
5399
+ sessionId: import_zod15.z.string().describe("Checkout session ID"),
5400
+ paymentMethod: import_zod15.z.object({
5401
+ type: import_zod15.z.enum(["card", "delegated", "wallet", "bank_transfer"]).describe("Payment method type"),
5402
+ token: import_zod15.z.string().optional().describe("Payment token"),
5403
+ delegatedProvider: import_zod15.z.string().optional().describe("Delegated payment provider (e.g., stripe, paypal)")
4807
5404
  }).describe("Payment method details")
4808
5405
  }),
4809
5406
  execute: async (params) => {
@@ -4824,8 +5421,8 @@ function createCompleteCheckoutTool(client) {
4824
5421
  return {
4825
5422
  name: "acp_complete_checkout",
4826
5423
  description: "Complete the checkout process and create an order. This finalizes the purchase.",
4827
- parameters: import_zod10.z.object({
4828
- sessionId: import_zod10.z.string().describe("Checkout session ID")
5424
+ parameters: import_zod15.z.object({
5425
+ sessionId: import_zod15.z.string().describe("Checkout session ID")
4829
5426
  }),
4830
5427
  execute: async (params) => {
4831
5428
  const response = await client.completeCheckout(params.sessionId);
@@ -4842,8 +5439,8 @@ function createGetOrderTool(client) {
4842
5439
  return {
4843
5440
  name: "acp_get_order",
4844
5441
  description: "Get detailed information about an order by its ID.",
4845
- parameters: import_zod10.z.object({
4846
- orderId: import_zod10.z.string().describe("Order ID")
5442
+ parameters: import_zod15.z.object({
5443
+ orderId: import_zod15.z.string().describe("Order ID")
4847
5444
  }),
4848
5445
  execute: async (params) => {
4849
5446
  const response = await client.getOrder(params.orderId);
@@ -4858,8 +5455,8 @@ function createCancelOrderTool(client) {
4858
5455
  return {
4859
5456
  name: "acp_cancel_order",
4860
5457
  description: "Cancel an order. Only orders that have not been shipped can be cancelled.",
4861
- parameters: import_zod10.z.object({
4862
- orderId: import_zod10.z.string().describe("Order ID")
5458
+ parameters: import_zod15.z.object({
5459
+ orderId: import_zod15.z.string().describe("Order ID")
4863
5460
  }),
4864
5461
  execute: async (params) => {
4865
5462
  const response = await client.cancelOrder(params.orderId);
@@ -4874,8 +5471,8 @@ function createGetOrderTrackingTool(client) {
4874
5471
  return {
4875
5472
  name: "acp_get_order_tracking",
4876
5473
  description: "Get shipping tracking information for an order.",
4877
- parameters: import_zod10.z.object({
4878
- orderId: import_zod10.z.string().describe("Order ID")
5474
+ parameters: import_zod15.z.object({
5475
+ orderId: import_zod15.z.string().describe("Order ID")
4879
5476
  }),
4880
5477
  execute: async (params) => {
4881
5478
  const response = await client.getOrderTracking(params.orderId);
@@ -5184,12 +5781,9 @@ Respond naturally while ensuring you gather the required information.`;
5184
5781
  }
5185
5782
  };
5186
5783
 
5187
- // src/types/voice.ts
5188
- var import_agentsea_types = require("@lov3kaizen/agentsea-types");
5189
-
5190
5784
  // src/voice/voice-agent.ts
5191
- var import_fs2 = require("fs");
5192
- var import_path2 = require("path");
5785
+ var import_fs5 = require("fs");
5786
+ var import_path3 = require("path");
5193
5787
  var VoiceAgent = class {
5194
5788
  agent;
5195
5789
  sttProvider;
@@ -5345,7 +5939,7 @@ var VoiceAgent = class {
5345
5939
  * Save audio to file
5346
5940
  */
5347
5941
  saveAudio(audio, outputPath) {
5348
- (0, import_fs2.writeFileSync)(outputPath, audio);
5942
+ (0, import_fs5.writeFileSync)(outputPath, audio);
5349
5943
  }
5350
5944
  /**
5351
5945
  * Export conversation history with audio
@@ -5353,11 +5947,11 @@ var VoiceAgent = class {
5353
5947
  exportConversation(outputDir) {
5354
5948
  for (let i = 0; i < this.conversationHistory.length; i++) {
5355
5949
  const message = this.conversationHistory[i];
5356
- const textPath = (0, import_path2.join)(outputDir, `${i}-${message.role}.txt`);
5357
- (0, import_fs2.writeFileSync)(textPath, message.text);
5950
+ const textPath = (0, import_path3.join)(outputDir, `${i}-${message.role}.txt`);
5951
+ (0, import_fs5.writeFileSync)(textPath, message.text);
5358
5952
  if (message.audio) {
5359
- const audioPath = (0, import_path2.join)(outputDir, `${i}-${message.role}.mp3`);
5360
- (0, import_fs2.writeFileSync)(audioPath, message.audio);
5953
+ const audioPath = (0, import_path3.join)(outputDir, `${i}-${message.role}.mp3`);
5954
+ (0, import_fs5.writeFileSync)(audioPath, message.audio);
5361
5955
  }
5362
5956
  }
5363
5957
  }
@@ -5391,7 +5985,7 @@ var VoiceAgent = class {
5391
5985
  };
5392
5986
 
5393
5987
  // src/voice/stt/openai-whisper.ts
5394
- var import_fs3 = require("fs");
5988
+ var import_fs6 = require("fs");
5395
5989
  var import_openai4 = __toESM(require("openai"));
5396
5990
  var OpenAIWhisperProvider = class {
5397
5991
  client;
@@ -5415,7 +6009,7 @@ var OpenAIWhisperProvider = class {
5415
6009
  if (Buffer.isBuffer(audio)) {
5416
6010
  audioFile = await (0, import_openai4.toFile)(audio, "audio.mp3", { type: "audio/mpeg" });
5417
6011
  } else if (typeof audio === "string") {
5418
- audioFile = (0, import_fs3.createReadStream)(audio);
6012
+ audioFile = (0, import_fs6.createReadStream)(audio);
5419
6013
  } else {
5420
6014
  throw new Error(
5421
6015
  "Invalid audio input. Expected Buffer or file path string."
@@ -5574,12 +6168,12 @@ var OpenAIWhisperProvider = class {
5574
6168
  };
5575
6169
 
5576
6170
  // src/voice/stt/local-whisper.ts
5577
- var import_child_process2 = require("child_process");
5578
- var import_fs4 = require("fs");
6171
+ var import_child_process4 = require("child_process");
6172
+ var import_fs7 = require("fs");
5579
6173
  var import_os = require("os");
5580
- var import_path3 = require("path");
6174
+ var import_path4 = require("path");
5581
6175
  var import_util = require("util");
5582
- var execAsync = (0, import_util.promisify)(import_child_process2.exec);
6176
+ var execAsync = (0, import_util.promisify)(import_child_process4.exec);
5583
6177
  var LocalWhisperProvider = class {
5584
6178
  whisperPath;
5585
6179
  modelPath;
@@ -5595,13 +6189,13 @@ var LocalWhisperProvider = class {
5595
6189
  let isTemporary = false;
5596
6190
  try {
5597
6191
  if (Buffer.isBuffer(audio)) {
5598
- audioPath = (0, import_path3.join)((0, import_os.tmpdir)(), `audio-${Date.now()}.wav`);
5599
- (0, import_fs4.writeFileSync)(audioPath, audio);
6192
+ audioPath = (0, import_path4.join)((0, import_os.tmpdir)(), `audio-${Date.now()}.wav`);
6193
+ (0, import_fs7.writeFileSync)(audioPath, audio);
5600
6194
  isTemporary = true;
5601
6195
  } else {
5602
6196
  audioPath = audio;
5603
6197
  }
5604
- if (!(0, import_fs4.existsSync)(audioPath)) {
6198
+ if (!(0, import_fs7.existsSync)(audioPath)) {
5605
6199
  throw new Error(`Audio file not found: ${audioPath}`);
5606
6200
  }
5607
6201
  const model = config?.model || "base";
@@ -5621,10 +6215,10 @@ var LocalWhisperProvider = class {
5621
6215
  let text;
5622
6216
  if (outputFormat === "txt") {
5623
6217
  const outputFile = audioPath.replace(/\.[^.]+$/, ".txt");
5624
- if ((0, import_fs4.existsSync)(outputFile)) {
6218
+ if ((0, import_fs7.existsSync)(outputFile)) {
5625
6219
  const { readFileSync: readFileSync2 } = await import("fs");
5626
6220
  text = readFileSync2(outputFile, "utf-8").trim();
5627
- (0, import_fs4.unlinkSync)(outputFile);
6221
+ (0, import_fs7.unlinkSync)(outputFile);
5628
6222
  } else {
5629
6223
  text = stdout.trim();
5630
6224
  }
@@ -5640,8 +6234,8 @@ var LocalWhisperProvider = class {
5640
6234
  `Local Whisper transcription failed: ${error instanceof Error ? error.message : String(error)}`
5641
6235
  );
5642
6236
  } finally {
5643
- if (isTemporary && (0, import_fs4.existsSync)(audioPath)) {
5644
- (0, import_fs4.unlinkSync)(audioPath);
6237
+ if (isTemporary && (0, import_fs7.existsSync)(audioPath)) {
6238
+ (0, import_fs7.unlinkSync)(audioPath);
5645
6239
  }
5646
6240
  }
5647
6241
  }
@@ -5959,12 +6553,12 @@ var ElevenLabsTTSProvider = class {
5959
6553
  };
5960
6554
 
5961
6555
  // src/voice/tts/piper-tts.ts
5962
- var import_child_process3 = require("child_process");
5963
- var import_fs5 = require("fs");
6556
+ var import_child_process5 = require("child_process");
6557
+ var import_fs8 = require("fs");
5964
6558
  var import_os2 = require("os");
5965
- var import_path4 = require("path");
6559
+ var import_path5 = require("path");
5966
6560
  var import_util2 = require("util");
5967
- var execAsync2 = (0, import_util2.promisify)(import_child_process3.exec);
6561
+ var execAsync2 = (0, import_util2.promisify)(import_child_process5.exec);
5968
6562
  var PiperTTSProvider = class {
5969
6563
  piperPath;
5970
6564
  modelPath;
@@ -5979,25 +6573,25 @@ var PiperTTSProvider = class {
5979
6573
  */
5980
6574
  async synthesize(text, config) {
5981
6575
  try {
5982
- const outputPath = (0, import_path4.join)((0, import_os2.tmpdir)(), `speech-${Date.now()}.wav`);
6576
+ const outputPath = (0, import_path5.join)((0, import_os2.tmpdir)(), `speech-${Date.now()}.wav`);
5983
6577
  const model = this.modelPath || config?.model;
5984
6578
  if (!model) {
5985
6579
  throw new Error("Model path is required for Piper TTS");
5986
6580
  }
5987
6581
  const modelConfig = this.configPath || model.replace(".onnx", ".json");
5988
- const textPath = (0, import_path4.join)((0, import_os2.tmpdir)(), `text-${Date.now()}.txt`);
5989
- (0, import_fs5.writeFileSync)(textPath, text, "utf-8");
6582
+ const textPath = (0, import_path5.join)((0, import_os2.tmpdir)(), `text-${Date.now()}.txt`);
6583
+ (0, import_fs8.writeFileSync)(textPath, text, "utf-8");
5990
6584
  const command = `${this.piperPath} --model ${model} --config ${modelConfig} --output_file ${outputPath} < ${textPath}`;
5991
6585
  await execAsync2(command, {
5992
6586
  maxBuffer: 50 * 1024 * 1024
5993
6587
  // 50MB buffer
5994
6588
  });
5995
- if (!(0, import_fs5.existsSync)(outputPath)) {
6589
+ if (!(0, import_fs8.existsSync)(outputPath)) {
5996
6590
  throw new Error("Piper failed to generate audio file");
5997
6591
  }
5998
- const audio = (0, import_fs5.readFileSync)(outputPath);
5999
- (0, import_fs5.unlinkSync)(outputPath);
6000
- (0, import_fs5.unlinkSync)(textPath);
6592
+ const audio = (0, import_fs8.readFileSync)(outputPath);
6593
+ (0, import_fs8.unlinkSync)(outputPath);
6594
+ (0, import_fs8.unlinkSync)(textPath);
6001
6595
  return {
6002
6596
  audio,
6003
6597
  format: "wav",
@@ -6144,7 +6738,7 @@ var LemonFoxTTSProvider = class extends OpenAITTSProvider {
6144
6738
  var import_crypto2 = require("crypto");
6145
6739
 
6146
6740
  // src/types/tenant.ts
6147
- var import_agentsea_types2 = require("@lov3kaizen/agentsea-types");
6741
+ var import_agentsea_types = require("@lov3kaizen/agentsea-types");
6148
6742
 
6149
6743
  // src/tenant/tenant-manager.ts
6150
6744
  var TenantManager = class {
@@ -6173,7 +6767,7 @@ var TenantManager = class {
6173
6767
  slug: data.slug,
6174
6768
  metadata: data.metadata,
6175
6769
  settings: { ...this.defaultSettings, ...data.settings },
6176
- status: import_agentsea_types2.TenantStatus.ACTIVE
6770
+ status: import_agentsea_types.TenantStatus.ACTIVE
6177
6771
  });
6178
6772
  return tenant;
6179
6773
  }
@@ -6203,13 +6797,13 @@ var TenantManager = class {
6203
6797
  * Suspend tenant
6204
6798
  */
6205
6799
  async suspendTenant(tenantId) {
6206
- return this.updateTenant(tenantId, { status: import_agentsea_types2.TenantStatus.SUSPENDED });
6800
+ return this.updateTenant(tenantId, { status: import_agentsea_types.TenantStatus.SUSPENDED });
6207
6801
  }
6208
6802
  /**
6209
6803
  * Activate tenant
6210
6804
  */
6211
6805
  async activateTenant(tenantId) {
6212
- return this.updateTenant(tenantId, { status: import_agentsea_types2.TenantStatus.ACTIVE });
6806
+ return this.updateTenant(tenantId, { status: import_agentsea_types.TenantStatus.ACTIVE });
6213
6807
  }
6214
6808
  /**
6215
6809
  * Delete tenant and all associated data
@@ -6259,7 +6853,7 @@ var TenantManager = class {
6259
6853
  return null;
6260
6854
  }
6261
6855
  const tenant = await this.storage.getTenant(apiKey.tenantId);
6262
- if (!tenant || tenant.status !== import_agentsea_types2.TenantStatus.ACTIVE) {
6856
+ if (!tenant || tenant.status !== import_agentsea_types.TenantStatus.ACTIVE) {
6263
6857
  return null;
6264
6858
  }
6265
6859
  return tenant;
@@ -6473,7 +7067,6 @@ var MemoryTenantStorage = class {
6473
7067
  ACPClient,
6474
7068
  Agent,
6475
7069
  AnthropicProvider,
6476
- AudioFormat,
6477
7070
  BufferMemory,
6478
7071
  Cache,
6479
7072
  ContentFormatter,
@@ -6503,35 +7096,19 @@ var MemoryTenantStorage = class {
6503
7096
  RateLimiter,
6504
7097
  RedisMemory,
6505
7098
  SSETransport,
6506
- STTConfig,
6507
- STTProvider,
6508
- STTResult,
6509
7099
  SequentialWorkflow,
6510
7100
  SlidingWindowRateLimiter,
6511
7101
  StdioTransport,
6512
7102
  SummaryMemory,
6513
7103
  SupervisorWorkflow,
6514
- TTSConfig,
6515
- TTSProvider,
6516
- TTSResult,
6517
- Tenant,
6518
- TenantApiKey,
6519
7104
  TenantBufferMemory,
6520
- TenantContext,
6521
7105
  TenantManager,
6522
- TenantQuota,
6523
- TenantResolver,
6524
- TenantSettings,
6525
7106
  TenantStatus,
6526
- TenantStorage,
6527
7107
  TextGenerationWebUIProvider,
6528
7108
  ToolRegistry,
6529
7109
  Tracer,
6530
7110
  VLLMProvider,
6531
7111
  VoiceAgent,
6532
- VoiceAgentConfig,
6533
- VoiceMessage,
6534
- VoiceType,
6535
7112
  Workflow,
6536
7113
  WorkflowFactory,
6537
7114
  calculatorClient,
@@ -6539,6 +7116,7 @@ var MemoryTenantStorage = class {
6539
7116
  calculatorServer,
6540
7117
  calculatorTool,
6541
7118
  clientTool,
7119
+ codeEditTool,
6542
7120
  createACPTools,
6543
7121
  createAnthropicProvider,
6544
7122
  createGeminiProvider,
@@ -6554,8 +7132,16 @@ var MemoryTenantStorage = class {
6554
7132
  fileListTool,
6555
7133
  fileReadTool,
6556
7134
  fileWriteTool,
7135
+ gitAddTool,
7136
+ gitBranchTool,
7137
+ gitCommitTool,
7138
+ gitDiffTool,
7139
+ gitLogTool,
7140
+ gitStatusTool,
7141
+ globTool,
6557
7142
  globalMetrics,
6558
7143
  globalTracer,
7144
+ grepTool,
6559
7145
  httpRequestTool,
6560
7146
  hybridTool,
6561
7147
  mcpToolToAgenticTool,
@@ -6565,6 +7151,7 @@ var MemoryTenantStorage = class {
6565
7151
  n8nListWorkflowsTool,
6566
7152
  n8nTriggerWebhookTool,
6567
7153
  serverTool,
7154
+ shellExecuteTool,
6568
7155
  stringTransformTool,
6569
7156
  textSummaryTool,
6570
7157
  toLegacyTool,