@lov3kaizen/agentsea-core 0.5.2 → 0.6.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
@@ -100,6 +100,7 @@ __export(index_exports, {
100
100
  calculatorServer: () => calculatorServer,
101
101
  calculatorTool: () => calculatorTool,
102
102
  clientTool: () => clientTool,
103
+ codeEditTool: () => codeEditTool,
103
104
  createACPTools: () => createACPTools,
104
105
  createAnthropicProvider: () => createAnthropicProvider,
105
106
  createGeminiProvider: () => createGeminiProvider,
@@ -115,8 +116,16 @@ __export(index_exports, {
115
116
  fileListTool: () => fileListTool,
116
117
  fileReadTool: () => fileReadTool,
117
118
  fileWriteTool: () => fileWriteTool,
119
+ gitAddTool: () => gitAddTool,
120
+ gitBranchTool: () => gitBranchTool,
121
+ gitCommitTool: () => gitCommitTool,
122
+ gitDiffTool: () => gitDiffTool,
123
+ gitLogTool: () => gitLogTool,
124
+ gitStatusTool: () => gitStatusTool,
125
+ globTool: () => globTool,
118
126
  globalMetrics: () => globalMetrics,
119
127
  globalTracer: () => globalTracer,
128
+ grepTool: () => grepTool,
120
129
  httpRequestTool: () => httpRequestTool,
121
130
  hybridTool: () => hybridTool,
122
131
  mcpToolToAgenticTool: () => mcpToolToAgenticTool,
@@ -126,6 +135,7 @@ __export(index_exports, {
126
135
  n8nListWorkflowsTool: () => n8nListWorkflowsTool,
127
136
  n8nTriggerWebhookTool: () => n8nTriggerWebhookTool,
128
137
  serverTool: () => serverTool,
138
+ shellExecuteTool: () => shellExecuteTool,
129
139
  stringTransformTool: () => stringTransformTool,
130
140
  textSummaryTool: () => textSummaryTool,
131
141
  toLegacyTool: () => toLegacyTool,
@@ -1455,17 +1465,551 @@ async function pollExecutionStatus(executionId, apiKey, baseUrl, maxAttempts = 3
1455
1465
  );
1456
1466
  }
1457
1467
 
1458
- // src/tools/built-in/calculator.isomorphic.ts
1468
+ // src/tools/built-in/shell.tool.ts
1469
+ var import_child_process = require("child_process");
1470
+ var import_zod7 = require("zod");
1471
+ var MAX_OUTPUT_BYTES = 100 * 1024;
1472
+ var DEFAULT_TIMEOUT_MS = 3e4;
1473
+ var MAX_TIMEOUT_MS = 12e4;
1474
+ var DANGEROUS_PATTERNS = [
1475
+ /\brm\s+-[^\s]*r[^\s]*f[^\s]*\s+\/\s*$/,
1476
+ // rm -rf /
1477
+ /\brm\s+-[^\s]*f[^\s]*r[^\s]*\s+\/\s*$/,
1478
+ // rm -fr /
1479
+ /\bmkfs\b/,
1480
+ // mkfs (format disk)
1481
+ /:(){ :\|:& };:/,
1482
+ // fork bomb
1483
+ /\bdd\b.*\bof=\/dev\//,
1484
+ // dd to device
1485
+ /\b>\s*\/dev\/sd[a-z]/,
1486
+ // redirect to raw device
1487
+ /\bchmod\s+-R\s+777\s+\//,
1488
+ // chmod -R 777 /
1489
+ /\bchown\s+-R\s+.*\s+\/\s*$/
1490
+ // chown -R ... /
1491
+ ];
1492
+ var shellExecuteTool = {
1493
+ name: "shell_execute",
1494
+ 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.",
1495
+ parameters: import_zod7.z.object({
1496
+ command: import_zod7.z.string().describe("The shell command to execute"),
1497
+ cwd: import_zod7.z.string().optional().describe(
1498
+ "Working directory for the command (defaults to process.cwd())"
1499
+ ),
1500
+ timeout: import_zod7.z.number().min(1e3).max(MAX_TIMEOUT_MS).default(DEFAULT_TIMEOUT_MS).describe("Timeout in milliseconds (default 30s, max 120s)")
1501
+ }),
1502
+ execute: (params) => {
1503
+ for (const pattern of DANGEROUS_PATTERNS) {
1504
+ if (pattern.test(params.command)) {
1505
+ throw new Error(
1506
+ `Command blocked by safety filter: matches dangerous pattern. If you need to run this command, please do so directly in your terminal.`
1507
+ );
1508
+ }
1509
+ }
1510
+ const timeout = Math.min(params.timeout, MAX_TIMEOUT_MS);
1511
+ try {
1512
+ const output = (0, import_child_process.execSync)(params.command, {
1513
+ cwd: params.cwd || process.cwd(),
1514
+ timeout,
1515
+ encoding: "utf8",
1516
+ maxBuffer: MAX_OUTPUT_BYTES * 2,
1517
+ // allow some headroom
1518
+ stdio: ["pipe", "pipe", "pipe"]
1519
+ });
1520
+ const truncated = output.length > MAX_OUTPUT_BYTES;
1521
+ const content = truncated ? output.slice(0, MAX_OUTPUT_BYTES) + "\n... [output truncated at 100KB]" : output;
1522
+ return Promise.resolve({
1523
+ exitCode: 0,
1524
+ stdout: content,
1525
+ stderr: "",
1526
+ truncated
1527
+ });
1528
+ } catch (error) {
1529
+ const execError = error;
1530
+ if (execError.killed || execError.signal) {
1531
+ throw new Error(`Shell execution timed out after ${timeout}ms`);
1532
+ }
1533
+ if (execError.status !== void 0 && execError.status !== null) {
1534
+ const stdout = String(execError.stdout || "");
1535
+ const stderr = String(execError.stderr || "");
1536
+ const truncated = stdout.length > MAX_OUTPUT_BYTES;
1537
+ return Promise.resolve({
1538
+ exitCode: execError.status,
1539
+ stdout: truncated ? stdout.slice(0, MAX_OUTPUT_BYTES) + "\n... [output truncated at 100KB]" : stdout,
1540
+ stderr: stderr.slice(0, MAX_OUTPUT_BYTES),
1541
+ truncated
1542
+ });
1543
+ }
1544
+ throw new Error(
1545
+ `Shell execution failed: ${execError.message || String(error)}`
1546
+ );
1547
+ }
1548
+ }
1549
+ };
1550
+
1551
+ // src/tools/built-in/code-edit.tool.ts
1552
+ var import_fs2 = require("fs");
1459
1553
  var import_zod8 = require("zod");
1554
+ var codeEditTool = {
1555
+ name: "code_edit",
1556
+ 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.",
1557
+ parameters: import_zod8.z.object({
1558
+ path: import_zod8.z.string().describe("Path to the file to edit"),
1559
+ oldString: import_zod8.z.string().describe(
1560
+ "The exact string to find and replace. Must match file content exactly including whitespace and indentation."
1561
+ ),
1562
+ newString: import_zod8.z.string().describe(
1563
+ "The replacement string. Use empty string to delete the matched text."
1564
+ ),
1565
+ expectedReplacements: import_zod8.z.number().int().min(1).default(1).describe(
1566
+ "Expected number of occurrences to replace. Fails if actual count differs. Defaults to 1."
1567
+ )
1568
+ }),
1569
+ execute: async (params) => {
1570
+ try {
1571
+ const content = await import_fs2.promises.readFile(params.path, "utf8");
1572
+ if (params.oldString === "") {
1573
+ const newContent2 = params.newString + content;
1574
+ await import_fs2.promises.writeFile(params.path, newContent2, "utf8");
1575
+ return {
1576
+ success: true,
1577
+ path: params.path,
1578
+ replacements: 1,
1579
+ message: "Content inserted at beginning of file"
1580
+ };
1581
+ }
1582
+ let count = 0;
1583
+ let searchFrom = 0;
1584
+ let idx = content.indexOf(params.oldString, searchFrom);
1585
+ while (idx !== -1) {
1586
+ count++;
1587
+ searchFrom = idx + params.oldString.length;
1588
+ idx = content.indexOf(params.oldString, searchFrom);
1589
+ }
1590
+ if (count === 0) {
1591
+ throw new Error(
1592
+ `String not found in ${params.path}. Make sure the oldString matches exactly, including whitespace and indentation.`
1593
+ );
1594
+ }
1595
+ if (count !== params.expectedReplacements) {
1596
+ throw new Error(
1597
+ `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}.`
1598
+ );
1599
+ }
1600
+ const newContent = content.split(params.oldString).join(params.newString);
1601
+ await import_fs2.promises.writeFile(params.path, newContent, "utf8");
1602
+ return {
1603
+ success: true,
1604
+ path: params.path,
1605
+ replacements: count,
1606
+ message: `Replaced ${count} occurrence(s)`
1607
+ };
1608
+ } catch (error) {
1609
+ if (error instanceof Error) {
1610
+ throw new Error(`Code edit failed: ${error.message}`);
1611
+ }
1612
+ throw error;
1613
+ }
1614
+ }
1615
+ };
1616
+
1617
+ // src/tools/built-in/glob.tool.ts
1618
+ var import_fs3 = require("fs");
1619
+ var import_fast_glob = __toESM(require("fast-glob"));
1620
+ var import_zod9 = require("zod");
1621
+ var DEFAULT_IGNORE = [
1622
+ "**/node_modules/**",
1623
+ "**/dist/**",
1624
+ "**/.git/**",
1625
+ "**/.next/**",
1626
+ "**/coverage/**",
1627
+ "**/.cache/**",
1628
+ "**/build/**"
1629
+ ];
1630
+ var globTool = {
1631
+ name: "glob",
1632
+ 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.",
1633
+ parameters: import_zod9.z.object({
1634
+ pattern: import_zod9.z.string().describe(
1635
+ 'Glob pattern to match (e.g., "**/*.ts", "src/**/*.{ts,tsx}", "*.json")'
1636
+ ),
1637
+ cwd: import_zod9.z.string().optional().describe("Directory to search in (defaults to process.cwd())"),
1638
+ ignore: import_zod9.z.array(import_zod9.z.string()).optional().describe("Additional patterns to ignore"),
1639
+ maxResults: import_zod9.z.number().int().min(1).max(1e4).default(1e3).describe("Maximum number of results to return (default 1000)")
1640
+ }),
1641
+ execute: async (params) => {
1642
+ try {
1643
+ const cwd = params.cwd || process.cwd();
1644
+ const ignorePatterns = [...DEFAULT_IGNORE, ...params.ignore || []];
1645
+ const files = await (0, import_fast_glob.default)(params.pattern, {
1646
+ cwd,
1647
+ ignore: ignorePatterns,
1648
+ absolute: true,
1649
+ dot: false,
1650
+ onlyFiles: true
1651
+ });
1652
+ const withStats = await Promise.all(
1653
+ files.map(async (filePath) => {
1654
+ try {
1655
+ const stats = await import_fs3.promises.stat(filePath);
1656
+ return { path: filePath, mtime: stats.mtimeMs };
1657
+ } catch {
1658
+ return { path: filePath, mtime: 0 };
1659
+ }
1660
+ })
1661
+ );
1662
+ withStats.sort((a, b) => b.mtime - a.mtime);
1663
+ const limited = withStats.slice(0, params.maxResults);
1664
+ return {
1665
+ files: limited.map((f) => f.path),
1666
+ count: limited.length,
1667
+ totalMatches: files.length,
1668
+ truncated: files.length > params.maxResults
1669
+ };
1670
+ } catch (error) {
1671
+ if (error instanceof Error) {
1672
+ throw new Error(`Glob failed: ${error.message}`);
1673
+ }
1674
+ throw error;
1675
+ }
1676
+ }
1677
+ };
1678
+
1679
+ // src/tools/built-in/grep.tool.ts
1680
+ var import_fs4 = require("fs");
1681
+ var import_path2 = require("path");
1682
+ var import_zod10 = require("zod");
1683
+ var MAX_FILE_SIZE = 5 * 1024 * 1024;
1684
+ var DEFAULT_IGNORE_DIRS = /* @__PURE__ */ new Set([
1685
+ "node_modules",
1686
+ "dist",
1687
+ ".git",
1688
+ ".next",
1689
+ "coverage",
1690
+ ".cache",
1691
+ "build",
1692
+ "__pycache__",
1693
+ ".venv"
1694
+ ]);
1695
+ async function walkDir(dir, includePattern) {
1696
+ const results = [];
1697
+ const entries = await import_fs4.promises.readdir(dir, { withFileTypes: true });
1698
+ for (const entry of entries) {
1699
+ if (DEFAULT_IGNORE_DIRS.has(entry.name)) continue;
1700
+ if (entry.name.startsWith(".") && entry.name !== ".env.example") continue;
1701
+ const fullPath = (0, import_path2.join)(dir, entry.name);
1702
+ if (entry.isDirectory()) {
1703
+ const subResults = await walkDir(fullPath, includePattern);
1704
+ results.push(...subResults);
1705
+ } else if (entry.isFile()) {
1706
+ if (includePattern && !includePattern.test(entry.name)) continue;
1707
+ results.push(fullPath);
1708
+ }
1709
+ }
1710
+ return results;
1711
+ }
1712
+ async function searchFile(filePath, regex, contextLines) {
1713
+ const stats = await import_fs4.promises.stat(filePath);
1714
+ if (stats.size > MAX_FILE_SIZE) return [];
1715
+ const content = await import_fs4.promises.readFile(filePath, "utf8");
1716
+ const lines = content.split("\n");
1717
+ const matches = [];
1718
+ for (let i = 0; i < lines.length; i++) {
1719
+ regex.lastIndex = 0;
1720
+ if (regex.test(lines[i])) {
1721
+ const match = {
1722
+ file: filePath,
1723
+ line: i + 1,
1724
+ content: lines[i]
1725
+ };
1726
+ if (contextLines > 0) {
1727
+ const beforeStart = Math.max(0, i - contextLines);
1728
+ match.contextBefore = lines.slice(beforeStart, i);
1729
+ const afterEnd = Math.min(lines.length, i + 1 + contextLines);
1730
+ match.contextAfter = lines.slice(i + 1, afterEnd);
1731
+ }
1732
+ matches.push(match);
1733
+ }
1734
+ }
1735
+ return matches;
1736
+ }
1737
+ var grepTool = {
1738
+ name: "grep",
1739
+ 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.",
1740
+ parameters: import_zod10.z.object({
1741
+ pattern: import_zod10.z.string().describe("Regex pattern to search for"),
1742
+ path: import_zod10.z.string().optional().describe("Directory or file to search in (defaults to process.cwd())"),
1743
+ include: import_zod10.z.string().optional().describe('File name pattern to include (e.g., "*.ts", "*.{js,jsx}")'),
1744
+ caseInsensitive: import_zod10.z.boolean().default(false).describe("Whether to perform case-insensitive matching"),
1745
+ contextLines: import_zod10.z.number().int().min(0).max(10).default(0).describe("Number of context lines before and after each match"),
1746
+ maxResults: import_zod10.z.number().int().min(1).max(1e3).default(100).describe("Maximum number of matches to return")
1747
+ }),
1748
+ execute: async (params) => {
1749
+ try {
1750
+ const searchPath = params.path || process.cwd();
1751
+ const flags = params.caseInsensitive ? "gi" : "g";
1752
+ let includePattern = null;
1753
+ if (params.include) {
1754
+ const escaped = params.include.replace(/\./g, "\\.").replace(/\*/g, ".*").replace(/\{([^}]+)\}/g, (_match, group) => {
1755
+ return `(${group.split(",").join("|")})`;
1756
+ });
1757
+ includePattern = new RegExp(`^${escaped}$`);
1758
+ }
1759
+ const stat = await import_fs4.promises.stat(searchPath);
1760
+ let files;
1761
+ if (stat.isFile()) {
1762
+ files = [searchPath];
1763
+ } else {
1764
+ files = await walkDir(searchPath, includePattern);
1765
+ }
1766
+ const allMatches = [];
1767
+ for (const file of files) {
1768
+ if (allMatches.length >= params.maxResults) break;
1769
+ try {
1770
+ const matches = await searchFile(
1771
+ file,
1772
+ new RegExp(params.pattern, flags),
1773
+ params.contextLines
1774
+ );
1775
+ for (const match of matches) {
1776
+ if (allMatches.length >= params.maxResults) break;
1777
+ match.file = stat.isFile() ? match.file : (0, import_path2.relative)(searchPath, match.file);
1778
+ allMatches.push(match);
1779
+ }
1780
+ } catch {
1781
+ }
1782
+ }
1783
+ return {
1784
+ matches: allMatches,
1785
+ count: allMatches.length,
1786
+ filesSearched: files.length,
1787
+ truncated: allMatches.length >= params.maxResults
1788
+ };
1789
+ } catch (error) {
1790
+ if (error instanceof Error) {
1791
+ throw new Error(`Grep failed: ${error.message}`);
1792
+ }
1793
+ throw error;
1794
+ }
1795
+ }
1796
+ };
1797
+
1798
+ // src/tools/built-in/git.tool.ts
1799
+ var import_child_process2 = require("child_process");
1800
+ var import_zod11 = require("zod");
1801
+ var GIT_TIMEOUT_MS = 15e3;
1802
+ function gitExec(args, cwd) {
1803
+ return (0, import_child_process2.execSync)(`git ${args}`, {
1804
+ cwd: cwd || process.cwd(),
1805
+ timeout: GIT_TIMEOUT_MS,
1806
+ encoding: "utf8",
1807
+ stdio: ["pipe", "pipe", "pipe"]
1808
+ }).trim();
1809
+ }
1810
+ var gitStatusTool = {
1811
+ name: "git_status",
1812
+ description: "Show the working tree status. Returns staged, unstaged, and untracked files.",
1813
+ parameters: import_zod11.z.object({
1814
+ cwd: import_zod11.z.string().optional().describe("Repository directory")
1815
+ }),
1816
+ execute: (params) => {
1817
+ try {
1818
+ const output = gitExec("status --porcelain", params.cwd);
1819
+ const branch = gitExec("branch --show-current", params.cwd);
1820
+ const staged = [];
1821
+ const unstaged = [];
1822
+ const untracked = [];
1823
+ for (const line of output.split("\n")) {
1824
+ if (!line.trim()) continue;
1825
+ const index = line[0];
1826
+ const worktree = line[1];
1827
+ const file = line.slice(3);
1828
+ if (index === "?") {
1829
+ untracked.push(file);
1830
+ } else {
1831
+ if (index !== " " && index !== "?") staged.push(file);
1832
+ if (worktree !== " " && worktree !== "?") unstaged.push(file);
1833
+ }
1834
+ }
1835
+ return Promise.resolve({
1836
+ branch,
1837
+ staged,
1838
+ unstaged,
1839
+ untracked,
1840
+ clean: staged.length === 0 && unstaged.length === 0 && untracked.length === 0,
1841
+ raw: output
1842
+ });
1843
+ } catch (error) {
1844
+ if (error instanceof Error) {
1845
+ throw new Error(`Git status failed: ${error.message}`);
1846
+ }
1847
+ throw error;
1848
+ }
1849
+ }
1850
+ };
1851
+ var gitDiffTool = {
1852
+ name: "git_diff",
1853
+ description: "Show changes between commits, commit and working tree, etc.",
1854
+ parameters: import_zod11.z.object({
1855
+ staged: import_zod11.z.boolean().default(false).describe("Show staged changes (--cached)"),
1856
+ path: import_zod11.z.string().optional().describe("Limit diff to specific path"),
1857
+ cwd: import_zod11.z.string().optional().describe("Repository directory")
1858
+ }),
1859
+ execute: (params) => {
1860
+ try {
1861
+ let args = "diff";
1862
+ if (params.staged) args += " --cached";
1863
+ if (params.path) args += ` -- ${params.path}`;
1864
+ const output = gitExec(args, params.cwd);
1865
+ return Promise.resolve({
1866
+ diff: output,
1867
+ hasChanges: output.length > 0
1868
+ });
1869
+ } catch (error) {
1870
+ if (error instanceof Error) {
1871
+ throw new Error(`Git diff failed: ${error.message}`);
1872
+ }
1873
+ throw error;
1874
+ }
1875
+ }
1876
+ };
1877
+ var gitAddTool = {
1878
+ name: "git_add",
1879
+ description: "Add file contents to the staging area.",
1880
+ parameters: import_zod11.z.object({
1881
+ paths: import_zod11.z.array(import_zod11.z.string()).min(1).describe("Files to add to staging"),
1882
+ cwd: import_zod11.z.string().optional().describe("Repository directory")
1883
+ }),
1884
+ execute: (params) => {
1885
+ try {
1886
+ const escapedPaths = params.paths.map((p) => `"${p}"`).join(" ");
1887
+ gitExec(`add ${escapedPaths}`, params.cwd);
1888
+ return Promise.resolve({
1889
+ success: true,
1890
+ added: params.paths
1891
+ });
1892
+ } catch (error) {
1893
+ if (error instanceof Error) {
1894
+ throw new Error(`Git add failed: ${error.message}`);
1895
+ }
1896
+ throw error;
1897
+ }
1898
+ }
1899
+ };
1900
+ var gitCommitTool = {
1901
+ name: "git_commit",
1902
+ description: "Record changes to the repository.",
1903
+ parameters: import_zod11.z.object({
1904
+ message: import_zod11.z.string().min(1).describe("Commit message"),
1905
+ cwd: import_zod11.z.string().optional().describe("Repository directory")
1906
+ }),
1907
+ execute: (params) => {
1908
+ try {
1909
+ const safeMessage = params.message.replace(/'/g, "'\\''");
1910
+ const output = gitExec(`commit -m '${safeMessage}'`, params.cwd);
1911
+ return Promise.resolve({
1912
+ success: true,
1913
+ output
1914
+ });
1915
+ } catch (error) {
1916
+ if (error instanceof Error) {
1917
+ throw new Error(`Git commit failed: ${error.message}`);
1918
+ }
1919
+ throw error;
1920
+ }
1921
+ }
1922
+ };
1923
+ var gitLogTool = {
1924
+ name: "git_log",
1925
+ description: "Show commit logs.",
1926
+ parameters: import_zod11.z.object({
1927
+ maxCount: import_zod11.z.number().int().min(1).max(100).default(10).describe("Maximum number of commits to show"),
1928
+ oneline: import_zod11.z.boolean().default(true).describe("Show each commit on a single line"),
1929
+ path: import_zod11.z.string().optional().describe("Limit to commits affecting this path"),
1930
+ cwd: import_zod11.z.string().optional().describe("Repository directory")
1931
+ }),
1932
+ execute: (params) => {
1933
+ try {
1934
+ let args = `log -${params.maxCount}`;
1935
+ if (params.oneline) {
1936
+ args += " --oneline";
1937
+ } else {
1938
+ args += " --format=%H%n%an%n%ae%n%ai%n%s%n---";
1939
+ }
1940
+ if (params.path) args += ` -- ${params.path}`;
1941
+ const output = gitExec(args, params.cwd);
1942
+ if (params.oneline) {
1943
+ const commits = output.split("\n").filter(Boolean).map((line) => {
1944
+ const spaceIdx = line.indexOf(" ");
1945
+ return {
1946
+ hash: line.slice(0, spaceIdx),
1947
+ message: line.slice(spaceIdx + 1)
1948
+ };
1949
+ });
1950
+ return Promise.resolve({ commits, count: commits.length });
1951
+ }
1952
+ return Promise.resolve({ log: output });
1953
+ } catch (error) {
1954
+ if (error instanceof Error) {
1955
+ throw new Error(`Git log failed: ${error.message}`);
1956
+ }
1957
+ throw error;
1958
+ }
1959
+ }
1960
+ };
1961
+ var gitBranchTool = {
1962
+ name: "git_branch",
1963
+ description: "List, create, or switch branches.",
1964
+ parameters: import_zod11.z.object({
1965
+ action: import_zod11.z.enum(["list", "create", "switch"]).default("list").describe("Action to perform"),
1966
+ name: import_zod11.z.string().optional().describe("Branch name (required for create/switch)"),
1967
+ cwd: import_zod11.z.string().optional().describe("Repository directory")
1968
+ }),
1969
+ execute: (params) => {
1970
+ try {
1971
+ switch (params.action) {
1972
+ case "list": {
1973
+ const output = gitExec("branch -a", params.cwd);
1974
+ const current = gitExec("branch --show-current", params.cwd);
1975
+ const branches = output.split("\n").filter(Boolean).map((b) => b.replace(/^\*?\s+/, "").trim());
1976
+ return Promise.resolve({ branches, current });
1977
+ }
1978
+ case "create": {
1979
+ if (!params.name) {
1980
+ throw new Error("Branch name is required for create action");
1981
+ }
1982
+ gitExec(`branch ${params.name}`, params.cwd);
1983
+ return Promise.resolve({ success: true, created: params.name });
1984
+ }
1985
+ case "switch": {
1986
+ if (!params.name) {
1987
+ throw new Error("Branch name is required for switch action");
1988
+ }
1989
+ gitExec(`checkout ${params.name}`, params.cwd);
1990
+ return Promise.resolve({ success: true, switched: params.name });
1991
+ }
1992
+ }
1993
+ } catch (error) {
1994
+ if (error instanceof Error) {
1995
+ throw new Error(`Git branch failed: ${error.message}`);
1996
+ }
1997
+ throw error;
1998
+ }
1999
+ }
2000
+ };
2001
+
2002
+ // src/tools/built-in/calculator.isomorphic.ts
2003
+ var import_zod13 = require("zod");
1460
2004
 
1461
2005
  // src/tools/tool-definition.ts
1462
- var import_zod7 = require("zod");
2006
+ var import_zod12 = require("zod");
1463
2007
  function toolDefinition(options) {
1464
2008
  const {
1465
2009
  name,
1466
2010
  description,
1467
2011
  inputSchema,
1468
- outputSchema = import_zod7.z.unknown(),
2012
+ outputSchema = import_zod12.z.unknown(),
1469
2013
  needsApproval = false,
1470
2014
  retryConfig
1471
2015
  } = options;
@@ -1573,13 +2117,13 @@ function toLegacyTools(tools) {
1573
2117
  }
1574
2118
 
1575
2119
  // 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")
2120
+ var calculatorInputSchema = import_zod13.z.object({
2121
+ operation: import_zod13.z.enum(["add", "subtract", "multiply", "divide"]).describe("The arithmetic operation to perform"),
2122
+ a: import_zod13.z.number().describe("First number"),
2123
+ b: import_zod13.z.number().describe("Second number")
1580
2124
  });
1581
- var calculatorOutputSchema = import_zod8.z.object({
1582
- result: import_zod8.z.number().describe("The result of the calculation")
2125
+ var calculatorOutputSchema = import_zod13.z.object({
2126
+ result: import_zod13.z.number().describe("The result of the calculation")
1583
2127
  });
1584
2128
  var calculatorDef = toolDefinition({
1585
2129
  name: "calculator",
@@ -2535,6 +3079,24 @@ function createProvider(config) {
2535
3079
  case "gemini":
2536
3080
  provider = new GeminiProvider();
2537
3081
  break;
3082
+ case "mistral":
3083
+ provider = new OpenAICompatibleProvider({
3084
+ baseUrl: "https://api.mistral.ai/v1",
3085
+ apiKey: process.env.MISTRAL_API_KEY
3086
+ });
3087
+ break;
3088
+ case "deepseek":
3089
+ provider = new OpenAICompatibleProvider({
3090
+ baseUrl: "https://api.deepseek.com/v1",
3091
+ apiKey: process.env.DEEPSEEK_API_KEY
3092
+ });
3093
+ break;
3094
+ case "xai":
3095
+ provider = new OpenAICompatibleProvider({
3096
+ baseUrl: "https://api.x.ai/v1",
3097
+ apiKey: process.env.XAI_API_KEY
3098
+ });
3099
+ break;
2538
3100
  case "ollama":
2539
3101
  provider = new OllamaProvider();
2540
3102
  break;
@@ -3745,7 +4307,7 @@ var LRUCache = class {
3745
4307
  var import_events2 = require("events");
3746
4308
 
3747
4309
  // src/mcp/transport.ts
3748
- var import_child_process = require("child_process");
4310
+ var import_child_process3 = require("child_process");
3749
4311
  var import_events = require("events");
3750
4312
  var StdioTransport = class extends import_events.EventEmitter {
3751
4313
  constructor(command, args = [], env) {
@@ -3760,7 +4322,7 @@ var StdioTransport = class extends import_events.EventEmitter {
3760
4322
  async connect() {
3761
4323
  return new Promise((resolve, reject) => {
3762
4324
  try {
3763
- this.process = (0, import_child_process.spawn)(this.command, this.args, {
4325
+ this.process = (0, import_child_process3.spawn)(this.command, this.args, {
3764
4326
  env: { ...process.env, ...this.env },
3765
4327
  stdio: ["pipe", "pipe", "pipe"]
3766
4328
  });
@@ -4098,7 +4660,7 @@ var MCPClient = class extends import_events2.EventEmitter {
4098
4660
  };
4099
4661
 
4100
4662
  // src/mcp/tool-adapter.ts
4101
- var import_zod9 = require("zod");
4663
+ var import_zod14 = require("zod");
4102
4664
  function mcpToolToAgenticTool(mcpTool, client) {
4103
4665
  const zodSchema = jsonSchemaToZod(mcpTool.inputSchema);
4104
4666
  return {
@@ -4133,25 +4695,25 @@ function jsonSchemaToZod(schema) {
4133
4695
  let zodType;
4134
4696
  switch (propSchema.type) {
4135
4697
  case "string":
4136
- zodType = import_zod9.z.string();
4698
+ zodType = import_zod14.z.string();
4137
4699
  if (typeof propSchema.description === "string") {
4138
4700
  zodType = zodType.describe(propSchema.description);
4139
4701
  }
4140
4702
  break;
4141
4703
  case "number":
4142
- zodType = import_zod9.z.number();
4704
+ zodType = import_zod14.z.number();
4143
4705
  if (typeof propSchema.description === "string") {
4144
4706
  zodType = zodType.describe(propSchema.description);
4145
4707
  }
4146
4708
  break;
4147
4709
  case "boolean":
4148
- zodType = import_zod9.z.boolean();
4710
+ zodType = import_zod14.z.boolean();
4149
4711
  if (typeof propSchema.description === "string") {
4150
4712
  zodType = zodType.describe(propSchema.description);
4151
4713
  }
4152
4714
  break;
4153
4715
  case "array":
4154
- zodType = import_zod9.z.array(
4716
+ zodType = import_zod14.z.array(
4155
4717
  jsonSchemaToZod(
4156
4718
  propSchema.items || {}
4157
4719
  )
@@ -4164,7 +4726,7 @@ function jsonSchemaToZod(schema) {
4164
4726
  zodType = jsonSchemaToZod(propSchema);
4165
4727
  break;
4166
4728
  default:
4167
- zodType = import_zod9.z.any();
4729
+ zodType = import_zod14.z.any();
4168
4730
  }
4169
4731
  const required = schema.required;
4170
4732
  if (!required?.includes(key)) {
@@ -4172,9 +4734,9 @@ function jsonSchemaToZod(schema) {
4172
4734
  }
4173
4735
  shape[key] = zodType;
4174
4736
  }
4175
- return import_zod9.z.object(shape);
4737
+ return import_zod14.z.object(shape);
4176
4738
  }
4177
- return import_zod9.z.any();
4739
+ return import_zod14.z.any();
4178
4740
  }
4179
4741
 
4180
4742
  // src/mcp/registry.ts
@@ -4571,7 +5133,7 @@ var ACPClient = class {
4571
5133
  };
4572
5134
 
4573
5135
  // src/acp/tools.ts
4574
- var import_zod10 = require("zod");
5136
+ var import_zod15 = require("zod");
4575
5137
  function createACPTools(client) {
4576
5138
  return [
4577
5139
  createSearchProductsTool(client),
@@ -4594,15 +5156,15 @@ function createSearchProductsTool(client) {
4594
5156
  return {
4595
5157
  name: "acp_search_products",
4596
5158
  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")
5159
+ parameters: import_zod15.z.object({
5160
+ query: import_zod15.z.string().optional().describe("Search query text"),
5161
+ category: import_zod15.z.string().optional().describe("Product category filter"),
5162
+ minPrice: import_zod15.z.number().optional().describe("Minimum price filter"),
5163
+ maxPrice: import_zod15.z.number().optional().describe("Maximum price filter"),
5164
+ limit: import_zod15.z.number().optional().default(10).describe("Maximum number of results"),
5165
+ offset: import_zod15.z.number().optional().default(0).describe("Pagination offset"),
5166
+ sortBy: import_zod15.z.enum(["price", "name", "popularity", "newest"]).optional().describe("Sort field"),
5167
+ sortOrder: import_zod15.z.enum(["asc", "desc"]).optional().default("asc").describe("Sort order")
4606
5168
  }),
4607
5169
  execute: async (params) => {
4608
5170
  const response = await client.searchProducts(params);
@@ -4621,8 +5183,8 @@ function createGetProductTool(client) {
4621
5183
  return {
4622
5184
  name: "acp_get_product",
4623
5185
  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")
5186
+ parameters: import_zod15.z.object({
5187
+ productId: import_zod15.z.string().describe("Product ID")
4626
5188
  }),
4627
5189
  execute: async (params) => {
4628
5190
  const response = await client.getProduct(params.productId);
@@ -4637,7 +5199,7 @@ function createCreateCartTool(client) {
4637
5199
  return {
4638
5200
  name: "acp_create_cart",
4639
5201
  description: "Create a new shopping cart for the customer. Returns the cart ID for subsequent operations.",
4640
- parameters: import_zod10.z.object({}),
5202
+ parameters: import_zod15.z.object({}),
4641
5203
  execute: async () => {
4642
5204
  const response = await client.createCart();
4643
5205
  if (response.error) {
@@ -4651,14 +5213,14 @@ function createAddToCartTool(client) {
4651
5213
  return {
4652
5214
  name: "acp_add_to_cart",
4653
5215
  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)")
5216
+ parameters: import_zod15.z.object({
5217
+ cartId: import_zod15.z.string().describe("Cart ID"),
5218
+ productId: import_zod15.z.string().describe("Product ID to add"),
5219
+ variantId: import_zod15.z.string().optional().describe("Product variant ID"),
5220
+ quantity: import_zod15.z.number().min(1).describe("Quantity to add"),
5221
+ price: import_zod15.z.object({
5222
+ amount: import_zod15.z.number().describe("Price amount"),
5223
+ currency: import_zod15.z.string().describe("Currency code (e.g., USD, EUR)")
4662
5224
  }).describe("Product price")
4663
5225
  }),
4664
5226
  execute: async (params) => {
@@ -4681,10 +5243,10 @@ function createUpdateCartItemTool(client) {
4681
5243
  return {
4682
5244
  name: "acp_update_cart_item",
4683
5245
  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)")
5246
+ parameters: import_zod15.z.object({
5247
+ cartId: import_zod15.z.string().describe("Cart ID"),
5248
+ productId: import_zod15.z.string().describe("Product ID to update"),
5249
+ quantity: import_zod15.z.number().min(0).describe("New quantity (0 to remove)")
4688
5250
  }),
4689
5251
  execute: async (params) => {
4690
5252
  const response = await client.updateCartItem(
@@ -4705,9 +5267,9 @@ function createRemoveFromCartTool(client) {
4705
5267
  return {
4706
5268
  name: "acp_remove_from_cart",
4707
5269
  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")
5270
+ parameters: import_zod15.z.object({
5271
+ cartId: import_zod15.z.string().describe("Cart ID"),
5272
+ productId: import_zod15.z.string().describe("Product ID to remove")
4711
5273
  }),
4712
5274
  execute: async (params) => {
4713
5275
  const response = await client.removeFromCart(
@@ -4727,8 +5289,8 @@ function createGetCartTool(client) {
4727
5289
  return {
4728
5290
  name: "acp_get_cart",
4729
5291
  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")
5292
+ parameters: import_zod15.z.object({
5293
+ cartId: import_zod15.z.string().describe("Cart ID")
4732
5294
  }),
4733
5295
  execute: async (params) => {
4734
5296
  const response = await client.getCart(params.cartId);
@@ -4743,12 +5305,12 @@ function createCheckoutTool(client) {
4743
5305
  return {
4744
5306
  name: "acp_create_checkout",
4745
5307
  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")
5308
+ parameters: import_zod15.z.object({
5309
+ cartId: import_zod15.z.string().describe("Cart ID"),
5310
+ customer: import_zod15.z.object({
5311
+ email: import_zod15.z.string().email().describe("Customer email"),
5312
+ name: import_zod15.z.string().optional().describe("Customer name"),
5313
+ phone: import_zod15.z.string().optional().describe("Customer phone number")
4752
5314
  }).optional().describe("Customer information")
4753
5315
  }),
4754
5316
  execute: async (params) => {
@@ -4769,15 +5331,15 @@ function createUpdateShippingAddressTool(client) {
4769
5331
  return {
4770
5332
  name: "acp_update_shipping_address",
4771
5333
  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)")
5334
+ parameters: import_zod15.z.object({
5335
+ sessionId: import_zod15.z.string().describe("Checkout session ID"),
5336
+ address: import_zod15.z.object({
5337
+ line1: import_zod15.z.string().describe("Address line 1"),
5338
+ line2: import_zod15.z.string().optional().describe("Address line 2"),
5339
+ city: import_zod15.z.string().describe("City"),
5340
+ state: import_zod15.z.string().optional().describe("State/Province"),
5341
+ postalCode: import_zod15.z.string().describe("Postal/ZIP code"),
5342
+ country: import_zod15.z.string().describe("Country code (e.g., US, GB)")
4781
5343
  }).describe("Shipping address")
4782
5344
  }),
4783
5345
  execute: async (params) => {
@@ -4798,12 +5360,12 @@ function createUpdatePaymentMethodTool(client) {
4798
5360
  return {
4799
5361
  name: "acp_update_payment_method",
4800
5362
  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)")
5363
+ parameters: import_zod15.z.object({
5364
+ sessionId: import_zod15.z.string().describe("Checkout session ID"),
5365
+ paymentMethod: import_zod15.z.object({
5366
+ type: import_zod15.z.enum(["card", "delegated", "wallet", "bank_transfer"]).describe("Payment method type"),
5367
+ token: import_zod15.z.string().optional().describe("Payment token"),
5368
+ delegatedProvider: import_zod15.z.string().optional().describe("Delegated payment provider (e.g., stripe, paypal)")
4807
5369
  }).describe("Payment method details")
4808
5370
  }),
4809
5371
  execute: async (params) => {
@@ -4824,8 +5386,8 @@ function createCompleteCheckoutTool(client) {
4824
5386
  return {
4825
5387
  name: "acp_complete_checkout",
4826
5388
  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")
5389
+ parameters: import_zod15.z.object({
5390
+ sessionId: import_zod15.z.string().describe("Checkout session ID")
4829
5391
  }),
4830
5392
  execute: async (params) => {
4831
5393
  const response = await client.completeCheckout(params.sessionId);
@@ -4842,8 +5404,8 @@ function createGetOrderTool(client) {
4842
5404
  return {
4843
5405
  name: "acp_get_order",
4844
5406
  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")
5407
+ parameters: import_zod15.z.object({
5408
+ orderId: import_zod15.z.string().describe("Order ID")
4847
5409
  }),
4848
5410
  execute: async (params) => {
4849
5411
  const response = await client.getOrder(params.orderId);
@@ -4858,8 +5420,8 @@ function createCancelOrderTool(client) {
4858
5420
  return {
4859
5421
  name: "acp_cancel_order",
4860
5422
  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")
5423
+ parameters: import_zod15.z.object({
5424
+ orderId: import_zod15.z.string().describe("Order ID")
4863
5425
  }),
4864
5426
  execute: async (params) => {
4865
5427
  const response = await client.cancelOrder(params.orderId);
@@ -4874,8 +5436,8 @@ function createGetOrderTrackingTool(client) {
4874
5436
  return {
4875
5437
  name: "acp_get_order_tracking",
4876
5438
  description: "Get shipping tracking information for an order.",
4877
- parameters: import_zod10.z.object({
4878
- orderId: import_zod10.z.string().describe("Order ID")
5439
+ parameters: import_zod15.z.object({
5440
+ orderId: import_zod15.z.string().describe("Order ID")
4879
5441
  }),
4880
5442
  execute: async (params) => {
4881
5443
  const response = await client.getOrderTracking(params.orderId);
@@ -5188,8 +5750,8 @@ Respond naturally while ensuring you gather the required information.`;
5188
5750
  var import_agentsea_types = require("@lov3kaizen/agentsea-types");
5189
5751
 
5190
5752
  // src/voice/voice-agent.ts
5191
- var import_fs2 = require("fs");
5192
- var import_path2 = require("path");
5753
+ var import_fs5 = require("fs");
5754
+ var import_path3 = require("path");
5193
5755
  var VoiceAgent = class {
5194
5756
  agent;
5195
5757
  sttProvider;
@@ -5345,7 +5907,7 @@ var VoiceAgent = class {
5345
5907
  * Save audio to file
5346
5908
  */
5347
5909
  saveAudio(audio, outputPath) {
5348
- (0, import_fs2.writeFileSync)(outputPath, audio);
5910
+ (0, import_fs5.writeFileSync)(outputPath, audio);
5349
5911
  }
5350
5912
  /**
5351
5913
  * Export conversation history with audio
@@ -5353,11 +5915,11 @@ var VoiceAgent = class {
5353
5915
  exportConversation(outputDir) {
5354
5916
  for (let i = 0; i < this.conversationHistory.length; i++) {
5355
5917
  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);
5918
+ const textPath = (0, import_path3.join)(outputDir, `${i}-${message.role}.txt`);
5919
+ (0, import_fs5.writeFileSync)(textPath, message.text);
5358
5920
  if (message.audio) {
5359
- const audioPath = (0, import_path2.join)(outputDir, `${i}-${message.role}.mp3`);
5360
- (0, import_fs2.writeFileSync)(audioPath, message.audio);
5921
+ const audioPath = (0, import_path3.join)(outputDir, `${i}-${message.role}.mp3`);
5922
+ (0, import_fs5.writeFileSync)(audioPath, message.audio);
5361
5923
  }
5362
5924
  }
5363
5925
  }
@@ -5391,7 +5953,7 @@ var VoiceAgent = class {
5391
5953
  };
5392
5954
 
5393
5955
  // src/voice/stt/openai-whisper.ts
5394
- var import_fs3 = require("fs");
5956
+ var import_fs6 = require("fs");
5395
5957
  var import_openai4 = __toESM(require("openai"));
5396
5958
  var OpenAIWhisperProvider = class {
5397
5959
  client;
@@ -5415,7 +5977,7 @@ var OpenAIWhisperProvider = class {
5415
5977
  if (Buffer.isBuffer(audio)) {
5416
5978
  audioFile = await (0, import_openai4.toFile)(audio, "audio.mp3", { type: "audio/mpeg" });
5417
5979
  } else if (typeof audio === "string") {
5418
- audioFile = (0, import_fs3.createReadStream)(audio);
5980
+ audioFile = (0, import_fs6.createReadStream)(audio);
5419
5981
  } else {
5420
5982
  throw new Error(
5421
5983
  "Invalid audio input. Expected Buffer or file path string."
@@ -5574,12 +6136,12 @@ var OpenAIWhisperProvider = class {
5574
6136
  };
5575
6137
 
5576
6138
  // src/voice/stt/local-whisper.ts
5577
- var import_child_process2 = require("child_process");
5578
- var import_fs4 = require("fs");
6139
+ var import_child_process4 = require("child_process");
6140
+ var import_fs7 = require("fs");
5579
6141
  var import_os = require("os");
5580
- var import_path3 = require("path");
6142
+ var import_path4 = require("path");
5581
6143
  var import_util = require("util");
5582
- var execAsync = (0, import_util.promisify)(import_child_process2.exec);
6144
+ var execAsync = (0, import_util.promisify)(import_child_process4.exec);
5583
6145
  var LocalWhisperProvider = class {
5584
6146
  whisperPath;
5585
6147
  modelPath;
@@ -5595,13 +6157,13 @@ var LocalWhisperProvider = class {
5595
6157
  let isTemporary = false;
5596
6158
  try {
5597
6159
  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);
6160
+ audioPath = (0, import_path4.join)((0, import_os.tmpdir)(), `audio-${Date.now()}.wav`);
6161
+ (0, import_fs7.writeFileSync)(audioPath, audio);
5600
6162
  isTemporary = true;
5601
6163
  } else {
5602
6164
  audioPath = audio;
5603
6165
  }
5604
- if (!(0, import_fs4.existsSync)(audioPath)) {
6166
+ if (!(0, import_fs7.existsSync)(audioPath)) {
5605
6167
  throw new Error(`Audio file not found: ${audioPath}`);
5606
6168
  }
5607
6169
  const model = config?.model || "base";
@@ -5621,10 +6183,10 @@ var LocalWhisperProvider = class {
5621
6183
  let text;
5622
6184
  if (outputFormat === "txt") {
5623
6185
  const outputFile = audioPath.replace(/\.[^.]+$/, ".txt");
5624
- if ((0, import_fs4.existsSync)(outputFile)) {
6186
+ if ((0, import_fs7.existsSync)(outputFile)) {
5625
6187
  const { readFileSync: readFileSync2 } = await import("fs");
5626
6188
  text = readFileSync2(outputFile, "utf-8").trim();
5627
- (0, import_fs4.unlinkSync)(outputFile);
6189
+ (0, import_fs7.unlinkSync)(outputFile);
5628
6190
  } else {
5629
6191
  text = stdout.trim();
5630
6192
  }
@@ -5640,8 +6202,8 @@ var LocalWhisperProvider = class {
5640
6202
  `Local Whisper transcription failed: ${error instanceof Error ? error.message : String(error)}`
5641
6203
  );
5642
6204
  } finally {
5643
- if (isTemporary && (0, import_fs4.existsSync)(audioPath)) {
5644
- (0, import_fs4.unlinkSync)(audioPath);
6205
+ if (isTemporary && (0, import_fs7.existsSync)(audioPath)) {
6206
+ (0, import_fs7.unlinkSync)(audioPath);
5645
6207
  }
5646
6208
  }
5647
6209
  }
@@ -5959,12 +6521,12 @@ var ElevenLabsTTSProvider = class {
5959
6521
  };
5960
6522
 
5961
6523
  // src/voice/tts/piper-tts.ts
5962
- var import_child_process3 = require("child_process");
5963
- var import_fs5 = require("fs");
6524
+ var import_child_process5 = require("child_process");
6525
+ var import_fs8 = require("fs");
5964
6526
  var import_os2 = require("os");
5965
- var import_path4 = require("path");
6527
+ var import_path5 = require("path");
5966
6528
  var import_util2 = require("util");
5967
- var execAsync2 = (0, import_util2.promisify)(import_child_process3.exec);
6529
+ var execAsync2 = (0, import_util2.promisify)(import_child_process5.exec);
5968
6530
  var PiperTTSProvider = class {
5969
6531
  piperPath;
5970
6532
  modelPath;
@@ -5979,25 +6541,25 @@ var PiperTTSProvider = class {
5979
6541
  */
5980
6542
  async synthesize(text, config) {
5981
6543
  try {
5982
- const outputPath = (0, import_path4.join)((0, import_os2.tmpdir)(), `speech-${Date.now()}.wav`);
6544
+ const outputPath = (0, import_path5.join)((0, import_os2.tmpdir)(), `speech-${Date.now()}.wav`);
5983
6545
  const model = this.modelPath || config?.model;
5984
6546
  if (!model) {
5985
6547
  throw new Error("Model path is required for Piper TTS");
5986
6548
  }
5987
6549
  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");
6550
+ const textPath = (0, import_path5.join)((0, import_os2.tmpdir)(), `text-${Date.now()}.txt`);
6551
+ (0, import_fs8.writeFileSync)(textPath, text, "utf-8");
5990
6552
  const command = `${this.piperPath} --model ${model} --config ${modelConfig} --output_file ${outputPath} < ${textPath}`;
5991
6553
  await execAsync2(command, {
5992
6554
  maxBuffer: 50 * 1024 * 1024
5993
6555
  // 50MB buffer
5994
6556
  });
5995
- if (!(0, import_fs5.existsSync)(outputPath)) {
6557
+ if (!(0, import_fs8.existsSync)(outputPath)) {
5996
6558
  throw new Error("Piper failed to generate audio file");
5997
6559
  }
5998
- const audio = (0, import_fs5.readFileSync)(outputPath);
5999
- (0, import_fs5.unlinkSync)(outputPath);
6000
- (0, import_fs5.unlinkSync)(textPath);
6560
+ const audio = (0, import_fs8.readFileSync)(outputPath);
6561
+ (0, import_fs8.unlinkSync)(outputPath);
6562
+ (0, import_fs8.unlinkSync)(textPath);
6001
6563
  return {
6002
6564
  audio,
6003
6565
  format: "wav",
@@ -6539,6 +7101,7 @@ var MemoryTenantStorage = class {
6539
7101
  calculatorServer,
6540
7102
  calculatorTool,
6541
7103
  clientTool,
7104
+ codeEditTool,
6542
7105
  createACPTools,
6543
7106
  createAnthropicProvider,
6544
7107
  createGeminiProvider,
@@ -6554,8 +7117,16 @@ var MemoryTenantStorage = class {
6554
7117
  fileListTool,
6555
7118
  fileReadTool,
6556
7119
  fileWriteTool,
7120
+ gitAddTool,
7121
+ gitBranchTool,
7122
+ gitCommitTool,
7123
+ gitDiffTool,
7124
+ gitLogTool,
7125
+ gitStatusTool,
7126
+ globTool,
6557
7127
  globalMetrics,
6558
7128
  globalTracer,
7129
+ grepTool,
6559
7130
  httpRequestTool,
6560
7131
  hybridTool,
6561
7132
  mcpToolToAgenticTool,
@@ -6565,6 +7136,7 @@ var MemoryTenantStorage = class {
6565
7136
  n8nListWorkflowsTool,
6566
7137
  n8nTriggerWebhookTool,
6567
7138
  serverTool,
7139
+ shellExecuteTool,
6568
7140
  stringTransformTool,
6569
7141
  textSummaryTool,
6570
7142
  toLegacyTool,