@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/README.md +374 -37
- package/dist/index.d.mts +20 -4
- package/dist/index.d.ts +20 -4
- package/dist/index.js +750 -163
- package/dist/index.mjs +720 -153
- package/package.json +16 -15
package/dist/index.mjs
CHANGED
|
@@ -22,7 +22,6 @@ __export(index_exports, {
|
|
|
22
22
|
ACPClient: () => ACPClient,
|
|
23
23
|
Agent: () => Agent,
|
|
24
24
|
AnthropicProvider: () => AnthropicProvider,
|
|
25
|
-
AudioFormat: () => AudioFormat,
|
|
26
25
|
BufferMemory: () => BufferMemory,
|
|
27
26
|
Cache: () => Cache,
|
|
28
27
|
ContentFormatter: () => ContentFormatter,
|
|
@@ -52,35 +51,19 @@ __export(index_exports, {
|
|
|
52
51
|
RateLimiter: () => RateLimiter,
|
|
53
52
|
RedisMemory: () => RedisMemory,
|
|
54
53
|
SSETransport: () => SSETransport,
|
|
55
|
-
STTConfig: () => STTConfig,
|
|
56
|
-
STTProvider: () => STTProvider,
|
|
57
|
-
STTResult: () => STTResult,
|
|
58
54
|
SequentialWorkflow: () => SequentialWorkflow,
|
|
59
55
|
SlidingWindowRateLimiter: () => SlidingWindowRateLimiter,
|
|
60
56
|
StdioTransport: () => StdioTransport,
|
|
61
57
|
SummaryMemory: () => SummaryMemory,
|
|
62
58
|
SupervisorWorkflow: () => SupervisorWorkflow,
|
|
63
|
-
TTSConfig: () => TTSConfig,
|
|
64
|
-
TTSProvider: () => TTSProvider,
|
|
65
|
-
TTSResult: () => TTSResult,
|
|
66
|
-
Tenant: () => Tenant,
|
|
67
|
-
TenantApiKey: () => TenantApiKey,
|
|
68
59
|
TenantBufferMemory: () => TenantBufferMemory,
|
|
69
|
-
TenantContext: () => TenantContext,
|
|
70
60
|
TenantManager: () => TenantManager,
|
|
71
|
-
TenantQuota: () => TenantQuota,
|
|
72
|
-
TenantResolver: () => TenantResolver,
|
|
73
|
-
TenantSettings: () => TenantSettings,
|
|
74
61
|
TenantStatus: () => TenantStatus,
|
|
75
|
-
TenantStorage: () => TenantStorage,
|
|
76
62
|
TextGenerationWebUIProvider: () => TextGenerationWebUIProvider,
|
|
77
63
|
ToolRegistry: () => ToolRegistry,
|
|
78
64
|
Tracer: () => Tracer,
|
|
79
65
|
VLLMProvider: () => VLLMProvider,
|
|
80
66
|
VoiceAgent: () => VoiceAgent,
|
|
81
|
-
VoiceAgentConfig: () => VoiceAgentConfig,
|
|
82
|
-
VoiceMessage: () => VoiceMessage,
|
|
83
|
-
VoiceType: () => VoiceType,
|
|
84
67
|
Workflow: () => Workflow,
|
|
85
68
|
WorkflowFactory: () => WorkflowFactory,
|
|
86
69
|
calculatorClient: () => calculatorClient,
|
|
@@ -88,6 +71,7 @@ __export(index_exports, {
|
|
|
88
71
|
calculatorServer: () => calculatorServer,
|
|
89
72
|
calculatorTool: () => calculatorTool,
|
|
90
73
|
clientTool: () => clientTool,
|
|
74
|
+
codeEditTool: () => codeEditTool,
|
|
91
75
|
createACPTools: () => createACPTools,
|
|
92
76
|
createAnthropicProvider: () => createAnthropicProvider,
|
|
93
77
|
createGeminiProvider: () => createGeminiProvider,
|
|
@@ -103,8 +87,16 @@ __export(index_exports, {
|
|
|
103
87
|
fileListTool: () => fileListTool,
|
|
104
88
|
fileReadTool: () => fileReadTool,
|
|
105
89
|
fileWriteTool: () => fileWriteTool,
|
|
90
|
+
gitAddTool: () => gitAddTool,
|
|
91
|
+
gitBranchTool: () => gitBranchTool,
|
|
92
|
+
gitCommitTool: () => gitCommitTool,
|
|
93
|
+
gitDiffTool: () => gitDiffTool,
|
|
94
|
+
gitLogTool: () => gitLogTool,
|
|
95
|
+
gitStatusTool: () => gitStatusTool,
|
|
96
|
+
globTool: () => globTool,
|
|
106
97
|
globalMetrics: () => globalMetrics,
|
|
107
98
|
globalTracer: () => globalTracer,
|
|
99
|
+
grepTool: () => grepTool,
|
|
108
100
|
httpRequestTool: () => httpRequestTool,
|
|
109
101
|
hybridTool: () => hybridTool,
|
|
110
102
|
mcpToolToAgenticTool: () => mcpToolToAgenticTool,
|
|
@@ -114,6 +106,7 @@ __export(index_exports, {
|
|
|
114
106
|
n8nListWorkflowsTool: () => n8nListWorkflowsTool,
|
|
115
107
|
n8nTriggerWebhookTool: () => n8nTriggerWebhookTool,
|
|
116
108
|
serverTool: () => serverTool,
|
|
109
|
+
shellExecuteTool: () => shellExecuteTool,
|
|
117
110
|
stringTransformTool: () => stringTransformTool,
|
|
118
111
|
textSummaryTool: () => textSummaryTool,
|
|
119
112
|
toLegacyTool: () => toLegacyTool,
|
|
@@ -290,6 +283,10 @@ var Agent = class {
|
|
|
290
283
|
this.toolRegistry = toolRegistry;
|
|
291
284
|
this.memory = memory;
|
|
292
285
|
}
|
|
286
|
+
config;
|
|
287
|
+
provider;
|
|
288
|
+
toolRegistry;
|
|
289
|
+
memory;
|
|
293
290
|
iterationCount = 0;
|
|
294
291
|
/**
|
|
295
292
|
* Execute the agent with the given input
|
|
@@ -1443,17 +1440,551 @@ async function pollExecutionStatus(executionId, apiKey, baseUrl, maxAttempts = 3
|
|
|
1443
1440
|
);
|
|
1444
1441
|
}
|
|
1445
1442
|
|
|
1446
|
-
// src/tools/built-in/
|
|
1443
|
+
// src/tools/built-in/shell.tool.ts
|
|
1444
|
+
import { execSync } from "child_process";
|
|
1445
|
+
import { z as z7 } from "zod";
|
|
1446
|
+
var MAX_OUTPUT_BYTES = 100 * 1024;
|
|
1447
|
+
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
1448
|
+
var MAX_TIMEOUT_MS = 12e4;
|
|
1449
|
+
var DANGEROUS_PATTERNS = [
|
|
1450
|
+
/\brm\s+-[^\s]*r[^\s]*f[^\s]*\s+\/\s*$/,
|
|
1451
|
+
// rm -rf /
|
|
1452
|
+
/\brm\s+-[^\s]*f[^\s]*r[^\s]*\s+\/\s*$/,
|
|
1453
|
+
// rm -fr /
|
|
1454
|
+
/\bmkfs\b/,
|
|
1455
|
+
// mkfs (format disk)
|
|
1456
|
+
/:(){ :\|:& };:/,
|
|
1457
|
+
// fork bomb
|
|
1458
|
+
/\bdd\b.*\bof=\/dev\//,
|
|
1459
|
+
// dd to device
|
|
1460
|
+
/\b>\s*\/dev\/sd[a-z]/,
|
|
1461
|
+
// redirect to raw device
|
|
1462
|
+
/\bchmod\s+-R\s+777\s+\//,
|
|
1463
|
+
// chmod -R 777 /
|
|
1464
|
+
/\bchown\s+-R\s+.*\s+\/\s*$/
|
|
1465
|
+
// chown -R ... /
|
|
1466
|
+
];
|
|
1467
|
+
var shellExecuteTool = {
|
|
1468
|
+
name: "shell_execute",
|
|
1469
|
+
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.",
|
|
1470
|
+
parameters: z7.object({
|
|
1471
|
+
command: z7.string().describe("The shell command to execute"),
|
|
1472
|
+
cwd: z7.string().optional().describe(
|
|
1473
|
+
"Working directory for the command (defaults to process.cwd())"
|
|
1474
|
+
),
|
|
1475
|
+
timeout: z7.number().min(1e3).max(MAX_TIMEOUT_MS).default(DEFAULT_TIMEOUT_MS).describe("Timeout in milliseconds (default 30s, max 120s)")
|
|
1476
|
+
}),
|
|
1477
|
+
execute: (params) => {
|
|
1478
|
+
for (const pattern of DANGEROUS_PATTERNS) {
|
|
1479
|
+
if (pattern.test(params.command)) {
|
|
1480
|
+
throw new Error(
|
|
1481
|
+
`Command blocked by safety filter: matches dangerous pattern. If you need to run this command, please do so directly in your terminal.`
|
|
1482
|
+
);
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
const timeout = Math.min(params.timeout, MAX_TIMEOUT_MS);
|
|
1486
|
+
try {
|
|
1487
|
+
const output = execSync(params.command, {
|
|
1488
|
+
cwd: params.cwd || process.cwd(),
|
|
1489
|
+
timeout,
|
|
1490
|
+
encoding: "utf8",
|
|
1491
|
+
maxBuffer: MAX_OUTPUT_BYTES * 2,
|
|
1492
|
+
// allow some headroom
|
|
1493
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
1494
|
+
});
|
|
1495
|
+
const truncated = output.length > MAX_OUTPUT_BYTES;
|
|
1496
|
+
const content = truncated ? output.slice(0, MAX_OUTPUT_BYTES) + "\n... [output truncated at 100KB]" : output;
|
|
1497
|
+
return Promise.resolve({
|
|
1498
|
+
exitCode: 0,
|
|
1499
|
+
stdout: content,
|
|
1500
|
+
stderr: "",
|
|
1501
|
+
truncated
|
|
1502
|
+
});
|
|
1503
|
+
} catch (error) {
|
|
1504
|
+
const execError = error;
|
|
1505
|
+
if (execError.killed || execError.signal) {
|
|
1506
|
+
throw new Error(`Shell execution timed out after ${timeout}ms`);
|
|
1507
|
+
}
|
|
1508
|
+
if (execError.status !== void 0 && execError.status !== null) {
|
|
1509
|
+
const stdout = String(execError.stdout || "");
|
|
1510
|
+
const stderr = String(execError.stderr || "");
|
|
1511
|
+
const truncated = stdout.length > MAX_OUTPUT_BYTES;
|
|
1512
|
+
return Promise.resolve({
|
|
1513
|
+
exitCode: execError.status,
|
|
1514
|
+
stdout: truncated ? stdout.slice(0, MAX_OUTPUT_BYTES) + "\n... [output truncated at 100KB]" : stdout,
|
|
1515
|
+
stderr: stderr.slice(0, MAX_OUTPUT_BYTES),
|
|
1516
|
+
truncated
|
|
1517
|
+
});
|
|
1518
|
+
}
|
|
1519
|
+
throw new Error(
|
|
1520
|
+
`Shell execution failed: ${execError.message || String(error)}`
|
|
1521
|
+
);
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
};
|
|
1525
|
+
|
|
1526
|
+
// src/tools/built-in/code-edit.tool.ts
|
|
1527
|
+
import { promises as fs2 } from "fs";
|
|
1447
1528
|
import { z as z8 } from "zod";
|
|
1529
|
+
var codeEditTool = {
|
|
1530
|
+
name: "code_edit",
|
|
1531
|
+
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.",
|
|
1532
|
+
parameters: z8.object({
|
|
1533
|
+
path: z8.string().describe("Path to the file to edit"),
|
|
1534
|
+
oldString: z8.string().describe(
|
|
1535
|
+
"The exact string to find and replace. Must match file content exactly including whitespace and indentation."
|
|
1536
|
+
),
|
|
1537
|
+
newString: z8.string().describe(
|
|
1538
|
+
"The replacement string. Use empty string to delete the matched text."
|
|
1539
|
+
),
|
|
1540
|
+
expectedReplacements: z8.number().int().min(1).default(1).describe(
|
|
1541
|
+
"Expected number of occurrences to replace. Fails if actual count differs. Defaults to 1."
|
|
1542
|
+
)
|
|
1543
|
+
}),
|
|
1544
|
+
execute: async (params) => {
|
|
1545
|
+
try {
|
|
1546
|
+
const content = await fs2.readFile(params.path, "utf8");
|
|
1547
|
+
if (params.oldString === "") {
|
|
1548
|
+
const newContent2 = params.newString + content;
|
|
1549
|
+
await fs2.writeFile(params.path, newContent2, "utf8");
|
|
1550
|
+
return {
|
|
1551
|
+
success: true,
|
|
1552
|
+
path: params.path,
|
|
1553
|
+
replacements: 1,
|
|
1554
|
+
message: "Content inserted at beginning of file"
|
|
1555
|
+
};
|
|
1556
|
+
}
|
|
1557
|
+
let count = 0;
|
|
1558
|
+
let searchFrom = 0;
|
|
1559
|
+
let idx = content.indexOf(params.oldString, searchFrom);
|
|
1560
|
+
while (idx !== -1) {
|
|
1561
|
+
count++;
|
|
1562
|
+
searchFrom = idx + params.oldString.length;
|
|
1563
|
+
idx = content.indexOf(params.oldString, searchFrom);
|
|
1564
|
+
}
|
|
1565
|
+
if (count === 0) {
|
|
1566
|
+
throw new Error(
|
|
1567
|
+
`String not found in ${params.path}. Make sure the oldString matches exactly, including whitespace and indentation.`
|
|
1568
|
+
);
|
|
1569
|
+
}
|
|
1570
|
+
if (count !== params.expectedReplacements) {
|
|
1571
|
+
throw new Error(
|
|
1572
|
+
`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}.`
|
|
1573
|
+
);
|
|
1574
|
+
}
|
|
1575
|
+
const newContent = content.split(params.oldString).join(params.newString);
|
|
1576
|
+
await fs2.writeFile(params.path, newContent, "utf8");
|
|
1577
|
+
return {
|
|
1578
|
+
success: true,
|
|
1579
|
+
path: params.path,
|
|
1580
|
+
replacements: count,
|
|
1581
|
+
message: `Replaced ${count} occurrence(s)`
|
|
1582
|
+
};
|
|
1583
|
+
} catch (error) {
|
|
1584
|
+
if (error instanceof Error) {
|
|
1585
|
+
throw new Error(`Code edit failed: ${error.message}`);
|
|
1586
|
+
}
|
|
1587
|
+
throw error;
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
};
|
|
1591
|
+
|
|
1592
|
+
// src/tools/built-in/glob.tool.ts
|
|
1593
|
+
import { promises as fs3 } from "fs";
|
|
1594
|
+
import fg from "fast-glob";
|
|
1595
|
+
import { z as z9 } from "zod";
|
|
1596
|
+
var DEFAULT_IGNORE = [
|
|
1597
|
+
"**/node_modules/**",
|
|
1598
|
+
"**/dist/**",
|
|
1599
|
+
"**/.git/**",
|
|
1600
|
+
"**/.next/**",
|
|
1601
|
+
"**/coverage/**",
|
|
1602
|
+
"**/.cache/**",
|
|
1603
|
+
"**/build/**"
|
|
1604
|
+
];
|
|
1605
|
+
var globTool = {
|
|
1606
|
+
name: "glob",
|
|
1607
|
+
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.",
|
|
1608
|
+
parameters: z9.object({
|
|
1609
|
+
pattern: z9.string().describe(
|
|
1610
|
+
'Glob pattern to match (e.g., "**/*.ts", "src/**/*.{ts,tsx}", "*.json")'
|
|
1611
|
+
),
|
|
1612
|
+
cwd: z9.string().optional().describe("Directory to search in (defaults to process.cwd())"),
|
|
1613
|
+
ignore: z9.array(z9.string()).optional().describe("Additional patterns to ignore"),
|
|
1614
|
+
maxResults: z9.number().int().min(1).max(1e4).default(1e3).describe("Maximum number of results to return (default 1000)")
|
|
1615
|
+
}),
|
|
1616
|
+
execute: async (params) => {
|
|
1617
|
+
try {
|
|
1618
|
+
const cwd = params.cwd || process.cwd();
|
|
1619
|
+
const ignorePatterns = [...DEFAULT_IGNORE, ...params.ignore || []];
|
|
1620
|
+
const files = await fg(params.pattern, {
|
|
1621
|
+
cwd,
|
|
1622
|
+
ignore: ignorePatterns,
|
|
1623
|
+
absolute: true,
|
|
1624
|
+
dot: false,
|
|
1625
|
+
onlyFiles: true
|
|
1626
|
+
});
|
|
1627
|
+
const withStats = await Promise.all(
|
|
1628
|
+
files.map(async (filePath) => {
|
|
1629
|
+
try {
|
|
1630
|
+
const stats = await fs3.stat(filePath);
|
|
1631
|
+
return { path: filePath, mtime: stats.mtimeMs };
|
|
1632
|
+
} catch {
|
|
1633
|
+
return { path: filePath, mtime: 0 };
|
|
1634
|
+
}
|
|
1635
|
+
})
|
|
1636
|
+
);
|
|
1637
|
+
withStats.sort((a, b) => b.mtime - a.mtime);
|
|
1638
|
+
const limited = withStats.slice(0, params.maxResults);
|
|
1639
|
+
return {
|
|
1640
|
+
files: limited.map((f) => f.path),
|
|
1641
|
+
count: limited.length,
|
|
1642
|
+
totalMatches: files.length,
|
|
1643
|
+
truncated: files.length > params.maxResults
|
|
1644
|
+
};
|
|
1645
|
+
} catch (error) {
|
|
1646
|
+
if (error instanceof Error) {
|
|
1647
|
+
throw new Error(`Glob failed: ${error.message}`);
|
|
1648
|
+
}
|
|
1649
|
+
throw error;
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
};
|
|
1653
|
+
|
|
1654
|
+
// src/tools/built-in/grep.tool.ts
|
|
1655
|
+
import { promises as fs4 } from "fs";
|
|
1656
|
+
import { join as join2, relative } from "path";
|
|
1657
|
+
import { z as z10 } from "zod";
|
|
1658
|
+
var MAX_FILE_SIZE = 5 * 1024 * 1024;
|
|
1659
|
+
var DEFAULT_IGNORE_DIRS = /* @__PURE__ */ new Set([
|
|
1660
|
+
"node_modules",
|
|
1661
|
+
"dist",
|
|
1662
|
+
".git",
|
|
1663
|
+
".next",
|
|
1664
|
+
"coverage",
|
|
1665
|
+
".cache",
|
|
1666
|
+
"build",
|
|
1667
|
+
"__pycache__",
|
|
1668
|
+
".venv"
|
|
1669
|
+
]);
|
|
1670
|
+
async function walkDir(dir, includePattern) {
|
|
1671
|
+
const results = [];
|
|
1672
|
+
const entries = await fs4.readdir(dir, { withFileTypes: true });
|
|
1673
|
+
for (const entry of entries) {
|
|
1674
|
+
if (DEFAULT_IGNORE_DIRS.has(entry.name)) continue;
|
|
1675
|
+
if (entry.name.startsWith(".") && entry.name !== ".env.example") continue;
|
|
1676
|
+
const fullPath = join2(dir, entry.name);
|
|
1677
|
+
if (entry.isDirectory()) {
|
|
1678
|
+
const subResults = await walkDir(fullPath, includePattern);
|
|
1679
|
+
results.push(...subResults);
|
|
1680
|
+
} else if (entry.isFile()) {
|
|
1681
|
+
if (includePattern && !includePattern.test(entry.name)) continue;
|
|
1682
|
+
results.push(fullPath);
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
return results;
|
|
1686
|
+
}
|
|
1687
|
+
async function searchFile(filePath, regex, contextLines) {
|
|
1688
|
+
const stats = await fs4.stat(filePath);
|
|
1689
|
+
if (stats.size > MAX_FILE_SIZE) return [];
|
|
1690
|
+
const content = await fs4.readFile(filePath, "utf8");
|
|
1691
|
+
const lines = content.split("\n");
|
|
1692
|
+
const matches = [];
|
|
1693
|
+
for (let i = 0; i < lines.length; i++) {
|
|
1694
|
+
regex.lastIndex = 0;
|
|
1695
|
+
if (regex.test(lines[i])) {
|
|
1696
|
+
const match = {
|
|
1697
|
+
file: filePath,
|
|
1698
|
+
line: i + 1,
|
|
1699
|
+
content: lines[i]
|
|
1700
|
+
};
|
|
1701
|
+
if (contextLines > 0) {
|
|
1702
|
+
const beforeStart = Math.max(0, i - contextLines);
|
|
1703
|
+
match.contextBefore = lines.slice(beforeStart, i);
|
|
1704
|
+
const afterEnd = Math.min(lines.length, i + 1 + contextLines);
|
|
1705
|
+
match.contextAfter = lines.slice(i + 1, afterEnd);
|
|
1706
|
+
}
|
|
1707
|
+
matches.push(match);
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
return matches;
|
|
1711
|
+
}
|
|
1712
|
+
var grepTool = {
|
|
1713
|
+
name: "grep",
|
|
1714
|
+
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.",
|
|
1715
|
+
parameters: z10.object({
|
|
1716
|
+
pattern: z10.string().describe("Regex pattern to search for"),
|
|
1717
|
+
path: z10.string().optional().describe("Directory or file to search in (defaults to process.cwd())"),
|
|
1718
|
+
include: z10.string().optional().describe('File name pattern to include (e.g., "*.ts", "*.{js,jsx}")'),
|
|
1719
|
+
caseInsensitive: z10.boolean().default(false).describe("Whether to perform case-insensitive matching"),
|
|
1720
|
+
contextLines: z10.number().int().min(0).max(10).default(0).describe("Number of context lines before and after each match"),
|
|
1721
|
+
maxResults: z10.number().int().min(1).max(1e3).default(100).describe("Maximum number of matches to return")
|
|
1722
|
+
}),
|
|
1723
|
+
execute: async (params) => {
|
|
1724
|
+
try {
|
|
1725
|
+
const searchPath = params.path || process.cwd();
|
|
1726
|
+
const flags = params.caseInsensitive ? "gi" : "g";
|
|
1727
|
+
let includePattern = null;
|
|
1728
|
+
if (params.include) {
|
|
1729
|
+
const escaped = params.include.replace(/\./g, "\\.").replace(/\*/g, ".*").replace(/\{([^}]+)\}/g, (_match, group) => {
|
|
1730
|
+
return `(${group.split(",").join("|")})`;
|
|
1731
|
+
});
|
|
1732
|
+
includePattern = new RegExp(`^${escaped}$`);
|
|
1733
|
+
}
|
|
1734
|
+
const stat = await fs4.stat(searchPath);
|
|
1735
|
+
let files;
|
|
1736
|
+
if (stat.isFile()) {
|
|
1737
|
+
files = [searchPath];
|
|
1738
|
+
} else {
|
|
1739
|
+
files = await walkDir(searchPath, includePattern);
|
|
1740
|
+
}
|
|
1741
|
+
const allMatches = [];
|
|
1742
|
+
for (const file of files) {
|
|
1743
|
+
if (allMatches.length >= params.maxResults) break;
|
|
1744
|
+
try {
|
|
1745
|
+
const matches = await searchFile(
|
|
1746
|
+
file,
|
|
1747
|
+
new RegExp(params.pattern, flags),
|
|
1748
|
+
params.contextLines
|
|
1749
|
+
);
|
|
1750
|
+
for (const match of matches) {
|
|
1751
|
+
if (allMatches.length >= params.maxResults) break;
|
|
1752
|
+
match.file = stat.isFile() ? match.file : relative(searchPath, match.file);
|
|
1753
|
+
allMatches.push(match);
|
|
1754
|
+
}
|
|
1755
|
+
} catch {
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
return {
|
|
1759
|
+
matches: allMatches,
|
|
1760
|
+
count: allMatches.length,
|
|
1761
|
+
filesSearched: files.length,
|
|
1762
|
+
truncated: allMatches.length >= params.maxResults
|
|
1763
|
+
};
|
|
1764
|
+
} catch (error) {
|
|
1765
|
+
if (error instanceof Error) {
|
|
1766
|
+
throw new Error(`Grep failed: ${error.message}`);
|
|
1767
|
+
}
|
|
1768
|
+
throw error;
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
};
|
|
1772
|
+
|
|
1773
|
+
// src/tools/built-in/git.tool.ts
|
|
1774
|
+
import { execSync as execSync2 } from "child_process";
|
|
1775
|
+
import { z as z11 } from "zod";
|
|
1776
|
+
var GIT_TIMEOUT_MS = 3e4;
|
|
1777
|
+
function gitExec(args, cwd) {
|
|
1778
|
+
return execSync2(`git ${args}`, {
|
|
1779
|
+
cwd: cwd || process.cwd(),
|
|
1780
|
+
timeout: GIT_TIMEOUT_MS,
|
|
1781
|
+
encoding: "utf8",
|
|
1782
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
1783
|
+
}).trim();
|
|
1784
|
+
}
|
|
1785
|
+
var gitStatusTool = {
|
|
1786
|
+
name: "git_status",
|
|
1787
|
+
description: "Show the working tree status. Returns staged, unstaged, and untracked files.",
|
|
1788
|
+
parameters: z11.object({
|
|
1789
|
+
cwd: z11.string().optional().describe("Repository directory")
|
|
1790
|
+
}),
|
|
1791
|
+
execute: (params) => {
|
|
1792
|
+
try {
|
|
1793
|
+
const output = gitExec("status --porcelain", params.cwd);
|
|
1794
|
+
const branch = gitExec("branch --show-current", params.cwd);
|
|
1795
|
+
const staged = [];
|
|
1796
|
+
const unstaged = [];
|
|
1797
|
+
const untracked = [];
|
|
1798
|
+
for (const line of output.split("\n")) {
|
|
1799
|
+
if (!line.trim()) continue;
|
|
1800
|
+
const index = line[0];
|
|
1801
|
+
const worktree = line[1];
|
|
1802
|
+
const file = line.slice(3);
|
|
1803
|
+
if (index === "?") {
|
|
1804
|
+
untracked.push(file);
|
|
1805
|
+
} else {
|
|
1806
|
+
if (index !== " " && index !== "?") staged.push(file);
|
|
1807
|
+
if (worktree !== " " && worktree !== "?") unstaged.push(file);
|
|
1808
|
+
}
|
|
1809
|
+
}
|
|
1810
|
+
return Promise.resolve({
|
|
1811
|
+
branch,
|
|
1812
|
+
staged,
|
|
1813
|
+
unstaged,
|
|
1814
|
+
untracked,
|
|
1815
|
+
clean: staged.length === 0 && unstaged.length === 0 && untracked.length === 0,
|
|
1816
|
+
raw: output
|
|
1817
|
+
});
|
|
1818
|
+
} catch (error) {
|
|
1819
|
+
if (error instanceof Error) {
|
|
1820
|
+
throw new Error(`Git status failed: ${error.message}`);
|
|
1821
|
+
}
|
|
1822
|
+
throw error;
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
};
|
|
1826
|
+
var gitDiffTool = {
|
|
1827
|
+
name: "git_diff",
|
|
1828
|
+
description: "Show changes between commits, commit and working tree, etc.",
|
|
1829
|
+
parameters: z11.object({
|
|
1830
|
+
staged: z11.boolean().default(false).describe("Show staged changes (--cached)"),
|
|
1831
|
+
path: z11.string().optional().describe("Limit diff to specific path"),
|
|
1832
|
+
cwd: z11.string().optional().describe("Repository directory")
|
|
1833
|
+
}),
|
|
1834
|
+
execute: (params) => {
|
|
1835
|
+
try {
|
|
1836
|
+
let args = "diff";
|
|
1837
|
+
if (params.staged) args += " --cached";
|
|
1838
|
+
if (params.path) args += ` -- ${params.path}`;
|
|
1839
|
+
const output = gitExec(args, params.cwd);
|
|
1840
|
+
return Promise.resolve({
|
|
1841
|
+
diff: output,
|
|
1842
|
+
hasChanges: output.length > 0
|
|
1843
|
+
});
|
|
1844
|
+
} catch (error) {
|
|
1845
|
+
if (error instanceof Error) {
|
|
1846
|
+
throw new Error(`Git diff failed: ${error.message}`);
|
|
1847
|
+
}
|
|
1848
|
+
throw error;
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1851
|
+
};
|
|
1852
|
+
var gitAddTool = {
|
|
1853
|
+
name: "git_add",
|
|
1854
|
+
description: "Add file contents to the staging area.",
|
|
1855
|
+
parameters: z11.object({
|
|
1856
|
+
paths: z11.array(z11.string()).min(1).describe("Files to add to staging"),
|
|
1857
|
+
cwd: z11.string().optional().describe("Repository directory")
|
|
1858
|
+
}),
|
|
1859
|
+
execute: (params) => {
|
|
1860
|
+
try {
|
|
1861
|
+
const escapedPaths = params.paths.map((p) => `"${p}"`).join(" ");
|
|
1862
|
+
gitExec(`add ${escapedPaths}`, params.cwd);
|
|
1863
|
+
return Promise.resolve({
|
|
1864
|
+
success: true,
|
|
1865
|
+
added: params.paths
|
|
1866
|
+
});
|
|
1867
|
+
} catch (error) {
|
|
1868
|
+
if (error instanceof Error) {
|
|
1869
|
+
throw new Error(`Git add failed: ${error.message}`);
|
|
1870
|
+
}
|
|
1871
|
+
throw error;
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
};
|
|
1875
|
+
var gitCommitTool = {
|
|
1876
|
+
name: "git_commit",
|
|
1877
|
+
description: "Record changes to the repository.",
|
|
1878
|
+
parameters: z11.object({
|
|
1879
|
+
message: z11.string().min(1).describe("Commit message"),
|
|
1880
|
+
cwd: z11.string().optional().describe("Repository directory")
|
|
1881
|
+
}),
|
|
1882
|
+
execute: (params) => {
|
|
1883
|
+
try {
|
|
1884
|
+
const safeMessage = params.message.replace(/'/g, "'\\''");
|
|
1885
|
+
const output = gitExec(`commit -m '${safeMessage}'`, params.cwd);
|
|
1886
|
+
return Promise.resolve({
|
|
1887
|
+
success: true,
|
|
1888
|
+
output
|
|
1889
|
+
});
|
|
1890
|
+
} catch (error) {
|
|
1891
|
+
if (error instanceof Error) {
|
|
1892
|
+
throw new Error(`Git commit failed: ${error.message}`);
|
|
1893
|
+
}
|
|
1894
|
+
throw error;
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
};
|
|
1898
|
+
var gitLogTool = {
|
|
1899
|
+
name: "git_log",
|
|
1900
|
+
description: "Show commit logs.",
|
|
1901
|
+
parameters: z11.object({
|
|
1902
|
+
maxCount: z11.number().int().min(1).max(100).default(10).describe("Maximum number of commits to show"),
|
|
1903
|
+
oneline: z11.boolean().default(true).describe("Show each commit on a single line"),
|
|
1904
|
+
path: z11.string().optional().describe("Limit to commits affecting this path"),
|
|
1905
|
+
cwd: z11.string().optional().describe("Repository directory")
|
|
1906
|
+
}),
|
|
1907
|
+
execute: (params) => {
|
|
1908
|
+
try {
|
|
1909
|
+
let args = `log -${params.maxCount}`;
|
|
1910
|
+
if (params.oneline) {
|
|
1911
|
+
args += " --oneline";
|
|
1912
|
+
} else {
|
|
1913
|
+
args += " --format=%H%n%an%n%ae%n%ai%n%s%n---";
|
|
1914
|
+
}
|
|
1915
|
+
if (params.path) args += ` -- ${params.path}`;
|
|
1916
|
+
const output = gitExec(args, params.cwd);
|
|
1917
|
+
if (params.oneline) {
|
|
1918
|
+
const commits = output.split("\n").filter(Boolean).map((line) => {
|
|
1919
|
+
const spaceIdx = line.indexOf(" ");
|
|
1920
|
+
return {
|
|
1921
|
+
hash: line.slice(0, spaceIdx),
|
|
1922
|
+
message: line.slice(spaceIdx + 1)
|
|
1923
|
+
};
|
|
1924
|
+
});
|
|
1925
|
+
return Promise.resolve({ commits, count: commits.length });
|
|
1926
|
+
}
|
|
1927
|
+
return Promise.resolve({ log: output });
|
|
1928
|
+
} catch (error) {
|
|
1929
|
+
if (error instanceof Error) {
|
|
1930
|
+
throw new Error(`Git log failed: ${error.message}`);
|
|
1931
|
+
}
|
|
1932
|
+
throw error;
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
};
|
|
1936
|
+
var gitBranchTool = {
|
|
1937
|
+
name: "git_branch",
|
|
1938
|
+
description: "List, create, or switch branches.",
|
|
1939
|
+
parameters: z11.object({
|
|
1940
|
+
action: z11.enum(["list", "create", "switch"]).default("list").describe("Action to perform"),
|
|
1941
|
+
name: z11.string().optional().describe("Branch name (required for create/switch)"),
|
|
1942
|
+
cwd: z11.string().optional().describe("Repository directory")
|
|
1943
|
+
}),
|
|
1944
|
+
execute: (params) => {
|
|
1945
|
+
try {
|
|
1946
|
+
switch (params.action) {
|
|
1947
|
+
case "list": {
|
|
1948
|
+
const output = gitExec("branch -a", params.cwd);
|
|
1949
|
+
const current = gitExec("branch --show-current", params.cwd);
|
|
1950
|
+
const branches = output.split("\n").filter(Boolean).map((b) => b.replace(/^\*?\s+/, "").trim());
|
|
1951
|
+
return Promise.resolve({ branches, current });
|
|
1952
|
+
}
|
|
1953
|
+
case "create": {
|
|
1954
|
+
if (!params.name) {
|
|
1955
|
+
throw new Error("Branch name is required for create action");
|
|
1956
|
+
}
|
|
1957
|
+
gitExec(`branch ${params.name}`, params.cwd);
|
|
1958
|
+
return Promise.resolve({ success: true, created: params.name });
|
|
1959
|
+
}
|
|
1960
|
+
case "switch": {
|
|
1961
|
+
if (!params.name) {
|
|
1962
|
+
throw new Error("Branch name is required for switch action");
|
|
1963
|
+
}
|
|
1964
|
+
gitExec(`checkout ${params.name}`, params.cwd);
|
|
1965
|
+
return Promise.resolve({ success: true, switched: params.name });
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
} catch (error) {
|
|
1969
|
+
if (error instanceof Error) {
|
|
1970
|
+
throw new Error(`Git branch failed: ${error.message}`);
|
|
1971
|
+
}
|
|
1972
|
+
throw error;
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
};
|
|
1976
|
+
|
|
1977
|
+
// src/tools/built-in/calculator.isomorphic.ts
|
|
1978
|
+
import { z as z13 } from "zod";
|
|
1448
1979
|
|
|
1449
1980
|
// src/tools/tool-definition.ts
|
|
1450
|
-
import { z as
|
|
1981
|
+
import { z as z12 } from "zod";
|
|
1451
1982
|
function toolDefinition(options) {
|
|
1452
1983
|
const {
|
|
1453
1984
|
name,
|
|
1454
1985
|
description,
|
|
1455
1986
|
inputSchema,
|
|
1456
|
-
outputSchema =
|
|
1987
|
+
outputSchema = z12.unknown(),
|
|
1457
1988
|
needsApproval = false,
|
|
1458
1989
|
retryConfig
|
|
1459
1990
|
} = options;
|
|
@@ -1561,13 +2092,13 @@ function toLegacyTools(tools) {
|
|
|
1561
2092
|
}
|
|
1562
2093
|
|
|
1563
2094
|
// src/tools/built-in/calculator.isomorphic.ts
|
|
1564
|
-
var calculatorInputSchema =
|
|
1565
|
-
operation:
|
|
1566
|
-
a:
|
|
1567
|
-
b:
|
|
2095
|
+
var calculatorInputSchema = z13.object({
|
|
2096
|
+
operation: z13.enum(["add", "subtract", "multiply", "divide"]).describe("The arithmetic operation to perform"),
|
|
2097
|
+
a: z13.number().describe("First number"),
|
|
2098
|
+
b: z13.number().describe("Second number")
|
|
1568
2099
|
});
|
|
1569
|
-
var calculatorOutputSchema =
|
|
1570
|
-
result:
|
|
2100
|
+
var calculatorOutputSchema = z13.object({
|
|
2101
|
+
result: z13.number().describe("The result of the calculation")
|
|
1571
2102
|
});
|
|
1572
2103
|
var calculatorDef = toolDefinition({
|
|
1573
2104
|
name: "calculator",
|
|
@@ -1602,6 +2133,8 @@ var calculatorClient = calculatorDef.client(({ operation, a, b }) => {
|
|
|
1602
2133
|
// src/providers/anthropic.ts
|
|
1603
2134
|
import Anthropic from "@anthropic-ai/sdk";
|
|
1604
2135
|
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
2136
|
+
var SAMPLING_REMOVED = /^claude-(opus-4-[789]|fable-5|mythos-5)/;
|
|
2137
|
+
var ADAPTIVE_THINKING = /^claude-(opus-4-[6789]|sonnet-4-6|fable-5|mythos-5)/;
|
|
1605
2138
|
var AnthropicProvider = class {
|
|
1606
2139
|
client;
|
|
1607
2140
|
constructor(apiKey) {
|
|
@@ -1609,6 +2142,30 @@ var AnthropicProvider = class {
|
|
|
1609
2142
|
apiKey: apiKey || process.env.ANTHROPIC_API_KEY
|
|
1610
2143
|
});
|
|
1611
2144
|
}
|
|
2145
|
+
/**
|
|
2146
|
+
* Build model-aware request parameters. Modern Claude models reject
|
|
2147
|
+
* removed sampling params, and Claude 4+ rejects temperature and
|
|
2148
|
+
* top_p together — temperature wins when both are configured.
|
|
2149
|
+
*/
|
|
2150
|
+
buildRequestParams(config, defaultMaxTokens) {
|
|
2151
|
+
const params = {
|
|
2152
|
+
max_tokens: config.maxTokens || defaultMaxTokens
|
|
2153
|
+
};
|
|
2154
|
+
if (!SAMPLING_REMOVED.test(config.model)) {
|
|
2155
|
+
if (config.temperature !== void 0) {
|
|
2156
|
+
params.temperature = config.temperature;
|
|
2157
|
+
} else if (config.topP !== void 0) {
|
|
2158
|
+
params.top_p = config.topP;
|
|
2159
|
+
}
|
|
2160
|
+
}
|
|
2161
|
+
if (config.thinking && ADAPTIVE_THINKING.test(config.model)) {
|
|
2162
|
+
params.thinking = config.thinking === true ? { type: "adaptive" } : config.thinking;
|
|
2163
|
+
}
|
|
2164
|
+
if (config.effort && ADAPTIVE_THINKING.test(config.model)) {
|
|
2165
|
+
params.output_config = { effort: config.effort };
|
|
2166
|
+
}
|
|
2167
|
+
return params;
|
|
2168
|
+
}
|
|
1612
2169
|
/**
|
|
1613
2170
|
* Generate a response from Claude
|
|
1614
2171
|
*/
|
|
@@ -1621,14 +2178,12 @@ var AnthropicProvider = class {
|
|
|
1621
2178
|
})) : void 0;
|
|
1622
2179
|
const response = await this.client.messages.create({
|
|
1623
2180
|
model: config.model,
|
|
1624
|
-
max_tokens: config.maxTokens || 1024,
|
|
1625
|
-
temperature: config.temperature,
|
|
1626
2181
|
system: config.systemPrompt,
|
|
1627
2182
|
messages: anthropicMessages,
|
|
1628
2183
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1629
2184
|
tools,
|
|
1630
|
-
|
|
1631
|
-
|
|
2185
|
+
stop_sequences: config.stopSequences,
|
|
2186
|
+
...this.buildRequestParams(config, 16e3)
|
|
1632
2187
|
});
|
|
1633
2188
|
const textContent = response.content.filter((block) => block.type === "text").map((block) => block.text).join("\n");
|
|
1634
2189
|
return {
|
|
@@ -1653,14 +2208,12 @@ var AnthropicProvider = class {
|
|
|
1653
2208
|
})) : void 0;
|
|
1654
2209
|
const stream = await this.client.messages.stream({
|
|
1655
2210
|
model: config.model,
|
|
1656
|
-
max_tokens: config.maxTokens || 1024,
|
|
1657
|
-
temperature: config.temperature,
|
|
1658
2211
|
system: config.systemPrompt,
|
|
1659
2212
|
messages: anthropicMessages,
|
|
1660
2213
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1661
2214
|
tools,
|
|
1662
|
-
|
|
1663
|
-
|
|
2215
|
+
stop_sequences: config.stopSequences,
|
|
2216
|
+
...this.buildRequestParams(config, 64e3)
|
|
1664
2217
|
});
|
|
1665
2218
|
for await (const event of stream) {
|
|
1666
2219
|
if (event.type === "content_block_delta") {
|
|
@@ -1842,6 +2395,9 @@ var OpenAIProvider = class {
|
|
|
1842
2395
|
const choice = rawResponse.choices[0];
|
|
1843
2396
|
if (choice?.message.tool_calls) {
|
|
1844
2397
|
for (const toolCall of choice.message.tool_calls) {
|
|
2398
|
+
if (toolCall.type !== "function") {
|
|
2399
|
+
continue;
|
|
2400
|
+
}
|
|
1845
2401
|
toolCalls.push({
|
|
1846
2402
|
id: toolCall.id,
|
|
1847
2403
|
tool: toolCall.function.name,
|
|
@@ -1903,7 +2459,7 @@ var GeminiProvider = class {
|
|
|
1903
2459
|
* Generate a response from the Gemini model
|
|
1904
2460
|
*/
|
|
1905
2461
|
async generateResponse(messages, config) {
|
|
1906
|
-
const model = this.getModel(config.model || "gemini-pro");
|
|
2462
|
+
const model = this.getModel(config.model || "gemini-3.1-pro-preview");
|
|
1907
2463
|
const contents = this.convertMessages(messages);
|
|
1908
2464
|
const generationConfig = {
|
|
1909
2465
|
temperature: config.temperature || 0.7,
|
|
@@ -1937,7 +2493,7 @@ var GeminiProvider = class {
|
|
|
1937
2493
|
* Stream responses from Gemini
|
|
1938
2494
|
*/
|
|
1939
2495
|
async *streamResponse(messages, config) {
|
|
1940
|
-
const model = this.getModel(config.model || "gemini-pro");
|
|
2496
|
+
const model = this.getModel(config.model || "gemini-3.1-pro-preview");
|
|
1941
2497
|
const contents = this.convertMessages(messages);
|
|
1942
2498
|
const generationConfig = {
|
|
1943
2499
|
temperature: config.temperature || 0.7,
|
|
@@ -2420,6 +2976,9 @@ var OpenAICompatibleProvider = class {
|
|
|
2420
2976
|
const choice = rawResponse.choices[0];
|
|
2421
2977
|
if (choice?.message.tool_calls) {
|
|
2422
2978
|
for (const toolCall of choice.message.tool_calls) {
|
|
2979
|
+
if (toolCall.type !== "function") {
|
|
2980
|
+
continue;
|
|
2981
|
+
}
|
|
2423
2982
|
toolCalls.push({
|
|
2424
2983
|
id: toolCall.id,
|
|
2425
2984
|
tool: toolCall.function.name,
|
|
@@ -2525,6 +3084,24 @@ function createProvider(config) {
|
|
|
2525
3084
|
case "gemini":
|
|
2526
3085
|
provider = new GeminiProvider();
|
|
2527
3086
|
break;
|
|
3087
|
+
case "mistral":
|
|
3088
|
+
provider = new OpenAICompatibleProvider({
|
|
3089
|
+
baseUrl: "https://api.mistral.ai/v1",
|
|
3090
|
+
apiKey: process.env.MISTRAL_API_KEY
|
|
3091
|
+
});
|
|
3092
|
+
break;
|
|
3093
|
+
case "deepseek":
|
|
3094
|
+
provider = new OpenAICompatibleProvider({
|
|
3095
|
+
baseUrl: "https://api.deepseek.com/v1",
|
|
3096
|
+
apiKey: process.env.DEEPSEEK_API_KEY
|
|
3097
|
+
});
|
|
3098
|
+
break;
|
|
3099
|
+
case "xai":
|
|
3100
|
+
provider = new OpenAICompatibleProvider({
|
|
3101
|
+
baseUrl: "https://api.x.ai/v1",
|
|
3102
|
+
apiKey: process.env.XAI_API_KEY
|
|
3103
|
+
});
|
|
3104
|
+
break;
|
|
2528
3105
|
case "ollama":
|
|
2529
3106
|
provider = new OllamaProvider();
|
|
2530
3107
|
break;
|
|
@@ -2602,6 +3179,7 @@ var BufferMemory = class {
|
|
|
2602
3179
|
constructor(maxMessages) {
|
|
2603
3180
|
this.maxMessages = maxMessages;
|
|
2604
3181
|
}
|
|
3182
|
+
maxMessages;
|
|
2605
3183
|
store = /* @__PURE__ */ new Map();
|
|
2606
3184
|
/**
|
|
2607
3185
|
* Save messages to memory
|
|
@@ -2722,11 +3300,14 @@ var RedisMemory = class {
|
|
|
2722
3300
|
|
|
2723
3301
|
// src/memory/summary-memory.ts
|
|
2724
3302
|
var SummaryMemory = class {
|
|
2725
|
-
constructor(provider, maxRecentMessages = 10, summaryModel = "claude-
|
|
3303
|
+
constructor(provider, maxRecentMessages = 10, summaryModel = "claude-haiku-4-5") {
|
|
2726
3304
|
this.provider = provider;
|
|
2727
3305
|
this.maxRecentMessages = maxRecentMessages;
|
|
2728
3306
|
this.summaryModel = summaryModel;
|
|
2729
3307
|
}
|
|
3308
|
+
provider;
|
|
3309
|
+
maxRecentMessages;
|
|
3310
|
+
summaryModel;
|
|
2730
3311
|
store = /* @__PURE__ */ new Map();
|
|
2731
3312
|
/**
|
|
2732
3313
|
* Save messages with automatic summarization
|
|
@@ -2816,6 +3397,7 @@ var TenantBufferMemory = class {
|
|
|
2816
3397
|
constructor(maxMessages) {
|
|
2817
3398
|
this.maxMessages = maxMessages;
|
|
2818
3399
|
}
|
|
3400
|
+
maxMessages;
|
|
2819
3401
|
store = /* @__PURE__ */ new Map();
|
|
2820
3402
|
/**
|
|
2821
3403
|
* Save messages to memory with tenant isolation
|
|
@@ -2925,6 +3507,10 @@ var Workflow = class {
|
|
|
2925
3507
|
this.memory = memory;
|
|
2926
3508
|
this.initializeAgents();
|
|
2927
3509
|
}
|
|
3510
|
+
config;
|
|
3511
|
+
provider;
|
|
3512
|
+
toolRegistry;
|
|
3513
|
+
memory;
|
|
2928
3514
|
agents = /* @__PURE__ */ new Map();
|
|
2929
3515
|
/**
|
|
2930
3516
|
* Initialize all agents in the workflow
|
|
@@ -3473,6 +4059,8 @@ var RateLimiter = class {
|
|
|
3473
4059
|
this.tokens = maxTokens;
|
|
3474
4060
|
this.lastRefill = Date.now();
|
|
3475
4061
|
}
|
|
4062
|
+
maxTokens;
|
|
4063
|
+
refillRate;
|
|
3476
4064
|
tokens;
|
|
3477
4065
|
lastRefill;
|
|
3478
4066
|
/**
|
|
@@ -3531,6 +4119,8 @@ var SlidingWindowRateLimiter = class {
|
|
|
3531
4119
|
this.maxRequests = maxRequests;
|
|
3532
4120
|
this.windowMs = windowMs;
|
|
3533
4121
|
}
|
|
4122
|
+
maxRequests;
|
|
4123
|
+
windowMs;
|
|
3534
4124
|
requests = /* @__PURE__ */ new Map();
|
|
3535
4125
|
/**
|
|
3536
4126
|
* Check if request is allowed
|
|
@@ -3575,6 +4165,7 @@ var Cache = class {
|
|
|
3575
4165
|
constructor(defaultTTL) {
|
|
3576
4166
|
this.defaultTTL = defaultTTL;
|
|
3577
4167
|
}
|
|
4168
|
+
defaultTTL;
|
|
3578
4169
|
store = /* @__PURE__ */ new Map();
|
|
3579
4170
|
/**
|
|
3580
4171
|
* Set a value in the cache
|
|
@@ -3677,6 +4268,7 @@ var LRUCache = class {
|
|
|
3677
4268
|
constructor(maxSize) {
|
|
3678
4269
|
this.maxSize = maxSize;
|
|
3679
4270
|
}
|
|
4271
|
+
maxSize;
|
|
3680
4272
|
cache = /* @__PURE__ */ new Map();
|
|
3681
4273
|
/**
|
|
3682
4274
|
* Get a value from the cache
|
|
@@ -3744,6 +4336,9 @@ var StdioTransport = class extends EventEmitter {
|
|
|
3744
4336
|
this.args = args;
|
|
3745
4337
|
this.env = env;
|
|
3746
4338
|
}
|
|
4339
|
+
command;
|
|
4340
|
+
args;
|
|
4341
|
+
env;
|
|
3747
4342
|
process = null;
|
|
3748
4343
|
connected = false;
|
|
3749
4344
|
buffer = "";
|
|
@@ -3815,6 +4410,7 @@ var SSETransport = class extends EventEmitter {
|
|
|
3815
4410
|
super();
|
|
3816
4411
|
this.url = url;
|
|
3817
4412
|
}
|
|
4413
|
+
url;
|
|
3818
4414
|
eventSource = null;
|
|
3819
4415
|
connected = false;
|
|
3820
4416
|
async connect() {
|
|
@@ -3882,6 +4478,7 @@ var MCPClient = class extends EventEmitter2 {
|
|
|
3882
4478
|
super();
|
|
3883
4479
|
this.config = config;
|
|
3884
4480
|
}
|
|
4481
|
+
config;
|
|
3885
4482
|
transport = null;
|
|
3886
4483
|
serverInfo = null;
|
|
3887
4484
|
requestId = 0;
|
|
@@ -4088,7 +4685,7 @@ var MCPClient = class extends EventEmitter2 {
|
|
|
4088
4685
|
};
|
|
4089
4686
|
|
|
4090
4687
|
// src/mcp/tool-adapter.ts
|
|
4091
|
-
import { z as
|
|
4688
|
+
import { z as z14 } from "zod";
|
|
4092
4689
|
function mcpToolToAgenticTool(mcpTool, client) {
|
|
4093
4690
|
const zodSchema = jsonSchemaToZod(mcpTool.inputSchema);
|
|
4094
4691
|
return {
|
|
@@ -4123,25 +4720,25 @@ function jsonSchemaToZod(schema) {
|
|
|
4123
4720
|
let zodType;
|
|
4124
4721
|
switch (propSchema.type) {
|
|
4125
4722
|
case "string":
|
|
4126
|
-
zodType =
|
|
4723
|
+
zodType = z14.string();
|
|
4127
4724
|
if (typeof propSchema.description === "string") {
|
|
4128
4725
|
zodType = zodType.describe(propSchema.description);
|
|
4129
4726
|
}
|
|
4130
4727
|
break;
|
|
4131
4728
|
case "number":
|
|
4132
|
-
zodType =
|
|
4729
|
+
zodType = z14.number();
|
|
4133
4730
|
if (typeof propSchema.description === "string") {
|
|
4134
4731
|
zodType = zodType.describe(propSchema.description);
|
|
4135
4732
|
}
|
|
4136
4733
|
break;
|
|
4137
4734
|
case "boolean":
|
|
4138
|
-
zodType =
|
|
4735
|
+
zodType = z14.boolean();
|
|
4139
4736
|
if (typeof propSchema.description === "string") {
|
|
4140
4737
|
zodType = zodType.describe(propSchema.description);
|
|
4141
4738
|
}
|
|
4142
4739
|
break;
|
|
4143
4740
|
case "array":
|
|
4144
|
-
zodType =
|
|
4741
|
+
zodType = z14.array(
|
|
4145
4742
|
jsonSchemaToZod(
|
|
4146
4743
|
propSchema.items || {}
|
|
4147
4744
|
)
|
|
@@ -4154,7 +4751,7 @@ function jsonSchemaToZod(schema) {
|
|
|
4154
4751
|
zodType = jsonSchemaToZod(propSchema);
|
|
4155
4752
|
break;
|
|
4156
4753
|
default:
|
|
4157
|
-
zodType =
|
|
4754
|
+
zodType = z14.any();
|
|
4158
4755
|
}
|
|
4159
4756
|
const required = schema.required;
|
|
4160
4757
|
if (!required?.includes(key)) {
|
|
@@ -4162,9 +4759,9 @@ function jsonSchemaToZod(schema) {
|
|
|
4162
4759
|
}
|
|
4163
4760
|
shape[key] = zodType;
|
|
4164
4761
|
}
|
|
4165
|
-
return
|
|
4762
|
+
return z14.object(shape);
|
|
4166
4763
|
}
|
|
4167
|
-
return
|
|
4764
|
+
return z14.any();
|
|
4168
4765
|
}
|
|
4169
4766
|
|
|
4170
4767
|
// src/mcp/registry.ts
|
|
@@ -4561,7 +5158,7 @@ var ACPClient = class {
|
|
|
4561
5158
|
};
|
|
4562
5159
|
|
|
4563
5160
|
// src/acp/tools.ts
|
|
4564
|
-
import { z as
|
|
5161
|
+
import { z as z15 } from "zod";
|
|
4565
5162
|
function createACPTools(client) {
|
|
4566
5163
|
return [
|
|
4567
5164
|
createSearchProductsTool(client),
|
|
@@ -4584,15 +5181,15 @@ function createSearchProductsTool(client) {
|
|
|
4584
5181
|
return {
|
|
4585
5182
|
name: "acp_search_products",
|
|
4586
5183
|
description: "Search for products in the commerce catalog. Supports filtering by query text, category, price range, and sorting.",
|
|
4587
|
-
parameters:
|
|
4588
|
-
query:
|
|
4589
|
-
category:
|
|
4590
|
-
minPrice:
|
|
4591
|
-
maxPrice:
|
|
4592
|
-
limit:
|
|
4593
|
-
offset:
|
|
4594
|
-
sortBy:
|
|
4595
|
-
sortOrder:
|
|
5184
|
+
parameters: z15.object({
|
|
5185
|
+
query: z15.string().optional().describe("Search query text"),
|
|
5186
|
+
category: z15.string().optional().describe("Product category filter"),
|
|
5187
|
+
minPrice: z15.number().optional().describe("Minimum price filter"),
|
|
5188
|
+
maxPrice: z15.number().optional().describe("Maximum price filter"),
|
|
5189
|
+
limit: z15.number().optional().default(10).describe("Maximum number of results"),
|
|
5190
|
+
offset: z15.number().optional().default(0).describe("Pagination offset"),
|
|
5191
|
+
sortBy: z15.enum(["price", "name", "popularity", "newest"]).optional().describe("Sort field"),
|
|
5192
|
+
sortOrder: z15.enum(["asc", "desc"]).optional().default("asc").describe("Sort order")
|
|
4596
5193
|
}),
|
|
4597
5194
|
execute: async (params) => {
|
|
4598
5195
|
const response = await client.searchProducts(params);
|
|
@@ -4611,8 +5208,8 @@ function createGetProductTool(client) {
|
|
|
4611
5208
|
return {
|
|
4612
5209
|
name: "acp_get_product",
|
|
4613
5210
|
description: "Get detailed information about a specific product by its ID.",
|
|
4614
|
-
parameters:
|
|
4615
|
-
productId:
|
|
5211
|
+
parameters: z15.object({
|
|
5212
|
+
productId: z15.string().describe("Product ID")
|
|
4616
5213
|
}),
|
|
4617
5214
|
execute: async (params) => {
|
|
4618
5215
|
const response = await client.getProduct(params.productId);
|
|
@@ -4627,7 +5224,7 @@ function createCreateCartTool(client) {
|
|
|
4627
5224
|
return {
|
|
4628
5225
|
name: "acp_create_cart",
|
|
4629
5226
|
description: "Create a new shopping cart for the customer. Returns the cart ID for subsequent operations.",
|
|
4630
|
-
parameters:
|
|
5227
|
+
parameters: z15.object({}),
|
|
4631
5228
|
execute: async () => {
|
|
4632
5229
|
const response = await client.createCart();
|
|
4633
5230
|
if (response.error) {
|
|
@@ -4641,14 +5238,14 @@ function createAddToCartTool(client) {
|
|
|
4641
5238
|
return {
|
|
4642
5239
|
name: "acp_add_to_cart",
|
|
4643
5240
|
description: "Add a product to the shopping cart with specified quantity.",
|
|
4644
|
-
parameters:
|
|
4645
|
-
cartId:
|
|
4646
|
-
productId:
|
|
4647
|
-
variantId:
|
|
4648
|
-
quantity:
|
|
4649
|
-
price:
|
|
4650
|
-
amount:
|
|
4651
|
-
currency:
|
|
5241
|
+
parameters: z15.object({
|
|
5242
|
+
cartId: z15.string().describe("Cart ID"),
|
|
5243
|
+
productId: z15.string().describe("Product ID to add"),
|
|
5244
|
+
variantId: z15.string().optional().describe("Product variant ID"),
|
|
5245
|
+
quantity: z15.number().min(1).describe("Quantity to add"),
|
|
5246
|
+
price: z15.object({
|
|
5247
|
+
amount: z15.number().describe("Price amount"),
|
|
5248
|
+
currency: z15.string().describe("Currency code (e.g., USD, EUR)")
|
|
4652
5249
|
}).describe("Product price")
|
|
4653
5250
|
}),
|
|
4654
5251
|
execute: async (params) => {
|
|
@@ -4671,10 +5268,10 @@ function createUpdateCartItemTool(client) {
|
|
|
4671
5268
|
return {
|
|
4672
5269
|
name: "acp_update_cart_item",
|
|
4673
5270
|
description: "Update the quantity of an item in the shopping cart.",
|
|
4674
|
-
parameters:
|
|
4675
|
-
cartId:
|
|
4676
|
-
productId:
|
|
4677
|
-
quantity:
|
|
5271
|
+
parameters: z15.object({
|
|
5272
|
+
cartId: z15.string().describe("Cart ID"),
|
|
5273
|
+
productId: z15.string().describe("Product ID to update"),
|
|
5274
|
+
quantity: z15.number().min(0).describe("New quantity (0 to remove)")
|
|
4678
5275
|
}),
|
|
4679
5276
|
execute: async (params) => {
|
|
4680
5277
|
const response = await client.updateCartItem(
|
|
@@ -4695,9 +5292,9 @@ function createRemoveFromCartTool(client) {
|
|
|
4695
5292
|
return {
|
|
4696
5293
|
name: "acp_remove_from_cart",
|
|
4697
5294
|
description: "Remove a product from the shopping cart.",
|
|
4698
|
-
parameters:
|
|
4699
|
-
cartId:
|
|
4700
|
-
productId:
|
|
5295
|
+
parameters: z15.object({
|
|
5296
|
+
cartId: z15.string().describe("Cart ID"),
|
|
5297
|
+
productId: z15.string().describe("Product ID to remove")
|
|
4701
5298
|
}),
|
|
4702
5299
|
execute: async (params) => {
|
|
4703
5300
|
const response = await client.removeFromCart(
|
|
@@ -4717,8 +5314,8 @@ function createGetCartTool(client) {
|
|
|
4717
5314
|
return {
|
|
4718
5315
|
name: "acp_get_cart",
|
|
4719
5316
|
description: "Get the current state of a shopping cart including all items and total amount.",
|
|
4720
|
-
parameters:
|
|
4721
|
-
cartId:
|
|
5317
|
+
parameters: z15.object({
|
|
5318
|
+
cartId: z15.string().describe("Cart ID")
|
|
4722
5319
|
}),
|
|
4723
5320
|
execute: async (params) => {
|
|
4724
5321
|
const response = await client.getCart(params.cartId);
|
|
@@ -4733,12 +5330,12 @@ function createCheckoutTool(client) {
|
|
|
4733
5330
|
return {
|
|
4734
5331
|
name: "acp_create_checkout",
|
|
4735
5332
|
description: "Create a checkout session from a shopping cart to begin the purchase process.",
|
|
4736
|
-
parameters:
|
|
4737
|
-
cartId:
|
|
4738
|
-
customer:
|
|
4739
|
-
email:
|
|
4740
|
-
name:
|
|
4741
|
-
phone:
|
|
5333
|
+
parameters: z15.object({
|
|
5334
|
+
cartId: z15.string().describe("Cart ID"),
|
|
5335
|
+
customer: z15.object({
|
|
5336
|
+
email: z15.string().email().describe("Customer email"),
|
|
5337
|
+
name: z15.string().optional().describe("Customer name"),
|
|
5338
|
+
phone: z15.string().optional().describe("Customer phone number")
|
|
4742
5339
|
}).optional().describe("Customer information")
|
|
4743
5340
|
}),
|
|
4744
5341
|
execute: async (params) => {
|
|
@@ -4759,15 +5356,15 @@ function createUpdateShippingAddressTool(client) {
|
|
|
4759
5356
|
return {
|
|
4760
5357
|
name: "acp_update_shipping_address",
|
|
4761
5358
|
description: "Update the shipping address for a checkout session.",
|
|
4762
|
-
parameters:
|
|
4763
|
-
sessionId:
|
|
4764
|
-
address:
|
|
4765
|
-
line1:
|
|
4766
|
-
line2:
|
|
4767
|
-
city:
|
|
4768
|
-
state:
|
|
4769
|
-
postalCode:
|
|
4770
|
-
country:
|
|
5359
|
+
parameters: z15.object({
|
|
5360
|
+
sessionId: z15.string().describe("Checkout session ID"),
|
|
5361
|
+
address: z15.object({
|
|
5362
|
+
line1: z15.string().describe("Address line 1"),
|
|
5363
|
+
line2: z15.string().optional().describe("Address line 2"),
|
|
5364
|
+
city: z15.string().describe("City"),
|
|
5365
|
+
state: z15.string().optional().describe("State/Province"),
|
|
5366
|
+
postalCode: z15.string().describe("Postal/ZIP code"),
|
|
5367
|
+
country: z15.string().describe("Country code (e.g., US, GB)")
|
|
4771
5368
|
}).describe("Shipping address")
|
|
4772
5369
|
}),
|
|
4773
5370
|
execute: async (params) => {
|
|
@@ -4788,12 +5385,12 @@ function createUpdatePaymentMethodTool(client) {
|
|
|
4788
5385
|
return {
|
|
4789
5386
|
name: "acp_update_payment_method",
|
|
4790
5387
|
description: "Update the payment method for a checkout session.",
|
|
4791
|
-
parameters:
|
|
4792
|
-
sessionId:
|
|
4793
|
-
paymentMethod:
|
|
4794
|
-
type:
|
|
4795
|
-
token:
|
|
4796
|
-
delegatedProvider:
|
|
5388
|
+
parameters: z15.object({
|
|
5389
|
+
sessionId: z15.string().describe("Checkout session ID"),
|
|
5390
|
+
paymentMethod: z15.object({
|
|
5391
|
+
type: z15.enum(["card", "delegated", "wallet", "bank_transfer"]).describe("Payment method type"),
|
|
5392
|
+
token: z15.string().optional().describe("Payment token"),
|
|
5393
|
+
delegatedProvider: z15.string().optional().describe("Delegated payment provider (e.g., stripe, paypal)")
|
|
4797
5394
|
}).describe("Payment method details")
|
|
4798
5395
|
}),
|
|
4799
5396
|
execute: async (params) => {
|
|
@@ -4814,8 +5411,8 @@ function createCompleteCheckoutTool(client) {
|
|
|
4814
5411
|
return {
|
|
4815
5412
|
name: "acp_complete_checkout",
|
|
4816
5413
|
description: "Complete the checkout process and create an order. This finalizes the purchase.",
|
|
4817
|
-
parameters:
|
|
4818
|
-
sessionId:
|
|
5414
|
+
parameters: z15.object({
|
|
5415
|
+
sessionId: z15.string().describe("Checkout session ID")
|
|
4819
5416
|
}),
|
|
4820
5417
|
execute: async (params) => {
|
|
4821
5418
|
const response = await client.completeCheckout(params.sessionId);
|
|
@@ -4832,8 +5429,8 @@ function createGetOrderTool(client) {
|
|
|
4832
5429
|
return {
|
|
4833
5430
|
name: "acp_get_order",
|
|
4834
5431
|
description: "Get detailed information about an order by its ID.",
|
|
4835
|
-
parameters:
|
|
4836
|
-
orderId:
|
|
5432
|
+
parameters: z15.object({
|
|
5433
|
+
orderId: z15.string().describe("Order ID")
|
|
4837
5434
|
}),
|
|
4838
5435
|
execute: async (params) => {
|
|
4839
5436
|
const response = await client.getOrder(params.orderId);
|
|
@@ -4848,8 +5445,8 @@ function createCancelOrderTool(client) {
|
|
|
4848
5445
|
return {
|
|
4849
5446
|
name: "acp_cancel_order",
|
|
4850
5447
|
description: "Cancel an order. Only orders that have not been shipped can be cancelled.",
|
|
4851
|
-
parameters:
|
|
4852
|
-
orderId:
|
|
5448
|
+
parameters: z15.object({
|
|
5449
|
+
orderId: z15.string().describe("Order ID")
|
|
4853
5450
|
}),
|
|
4854
5451
|
execute: async (params) => {
|
|
4855
5452
|
const response = await client.cancelOrder(params.orderId);
|
|
@@ -4864,8 +5461,8 @@ function createGetOrderTrackingTool(client) {
|
|
|
4864
5461
|
return {
|
|
4865
5462
|
name: "acp_get_order_tracking",
|
|
4866
5463
|
description: "Get shipping tracking information for an order.",
|
|
4867
|
-
parameters:
|
|
4868
|
-
orderId:
|
|
5464
|
+
parameters: z15.object({
|
|
5465
|
+
orderId: z15.string().describe("Order ID")
|
|
4869
5466
|
}),
|
|
4870
5467
|
execute: async (params) => {
|
|
4871
5468
|
const response = await client.getOrderTracking(params.orderId);
|
|
@@ -5174,23 +5771,9 @@ Respond naturally while ensuring you gather the required information.`;
|
|
|
5174
5771
|
}
|
|
5175
5772
|
};
|
|
5176
5773
|
|
|
5177
|
-
// src/types/voice.ts
|
|
5178
|
-
import {
|
|
5179
|
-
AudioFormat,
|
|
5180
|
-
VoiceType,
|
|
5181
|
-
STTConfig,
|
|
5182
|
-
TTSConfig,
|
|
5183
|
-
STTResult,
|
|
5184
|
-
TTSResult,
|
|
5185
|
-
STTProvider,
|
|
5186
|
-
TTSProvider,
|
|
5187
|
-
VoiceMessage,
|
|
5188
|
-
VoiceAgentConfig
|
|
5189
|
-
} from "@lov3kaizen/agentsea-types";
|
|
5190
|
-
|
|
5191
5774
|
// src/voice/voice-agent.ts
|
|
5192
5775
|
import { writeFileSync } from "fs";
|
|
5193
|
-
import { join as
|
|
5776
|
+
import { join as join3 } from "path";
|
|
5194
5777
|
var VoiceAgent = class {
|
|
5195
5778
|
agent;
|
|
5196
5779
|
sttProvider;
|
|
@@ -5354,10 +5937,10 @@ var VoiceAgent = class {
|
|
|
5354
5937
|
exportConversation(outputDir) {
|
|
5355
5938
|
for (let i = 0; i < this.conversationHistory.length; i++) {
|
|
5356
5939
|
const message = this.conversationHistory[i];
|
|
5357
|
-
const textPath =
|
|
5940
|
+
const textPath = join3(outputDir, `${i}-${message.role}.txt`);
|
|
5358
5941
|
writeFileSync(textPath, message.text);
|
|
5359
5942
|
if (message.audio) {
|
|
5360
|
-
const audioPath =
|
|
5943
|
+
const audioPath = join3(outputDir, `${i}-${message.role}.mp3`);
|
|
5361
5944
|
writeFileSync(audioPath, message.audio);
|
|
5362
5945
|
}
|
|
5363
5946
|
}
|
|
@@ -5578,7 +6161,7 @@ var OpenAIWhisperProvider = class {
|
|
|
5578
6161
|
import { exec } from "child_process";
|
|
5579
6162
|
import { writeFileSync as writeFileSync2, unlinkSync, existsSync } from "fs";
|
|
5580
6163
|
import { tmpdir } from "os";
|
|
5581
|
-
import { join as
|
|
6164
|
+
import { join as join4 } from "path";
|
|
5582
6165
|
import { promisify } from "util";
|
|
5583
6166
|
var execAsync = promisify(exec);
|
|
5584
6167
|
var LocalWhisperProvider = class {
|
|
@@ -5596,7 +6179,7 @@ var LocalWhisperProvider = class {
|
|
|
5596
6179
|
let isTemporary = false;
|
|
5597
6180
|
try {
|
|
5598
6181
|
if (Buffer.isBuffer(audio)) {
|
|
5599
|
-
audioPath =
|
|
6182
|
+
audioPath = join4(tmpdir(), `audio-${Date.now()}.wav`);
|
|
5600
6183
|
writeFileSync2(audioPath, audio);
|
|
5601
6184
|
isTemporary = true;
|
|
5602
6185
|
} else {
|
|
@@ -5963,7 +6546,7 @@ var ElevenLabsTTSProvider = class {
|
|
|
5963
6546
|
import { exec as exec2 } from "child_process";
|
|
5964
6547
|
import { writeFileSync as writeFileSync3, readFileSync, unlinkSync as unlinkSync2, existsSync as existsSync2 } from "fs";
|
|
5965
6548
|
import { tmpdir as tmpdir2 } from "os";
|
|
5966
|
-
import { join as
|
|
6549
|
+
import { join as join5 } from "path";
|
|
5967
6550
|
import { promisify as promisify2 } from "util";
|
|
5968
6551
|
var execAsync2 = promisify2(exec2);
|
|
5969
6552
|
var PiperTTSProvider = class {
|
|
@@ -5980,13 +6563,13 @@ var PiperTTSProvider = class {
|
|
|
5980
6563
|
*/
|
|
5981
6564
|
async synthesize(text, config) {
|
|
5982
6565
|
try {
|
|
5983
|
-
const outputPath =
|
|
6566
|
+
const outputPath = join5(tmpdir2(), `speech-${Date.now()}.wav`);
|
|
5984
6567
|
const model = this.modelPath || config?.model;
|
|
5985
6568
|
if (!model) {
|
|
5986
6569
|
throw new Error("Model path is required for Piper TTS");
|
|
5987
6570
|
}
|
|
5988
6571
|
const modelConfig = this.configPath || model.replace(".onnx", ".json");
|
|
5989
|
-
const textPath =
|
|
6572
|
+
const textPath = join5(tmpdir2(), `text-${Date.now()}.txt`);
|
|
5990
6573
|
writeFileSync3(textPath, text, "utf-8");
|
|
5991
6574
|
const command = `${this.piperPath} --model ${model} --config ${modelConfig} --output_file ${outputPath} < ${textPath}`;
|
|
5992
6575
|
await execAsync2(command, {
|
|
@@ -6145,16 +6728,7 @@ var LemonFoxTTSProvider = class extends OpenAITTSProvider {
|
|
|
6145
6728
|
import { randomBytes, createHash } from "crypto";
|
|
6146
6729
|
|
|
6147
6730
|
// src/types/tenant.ts
|
|
6148
|
-
import {
|
|
6149
|
-
Tenant,
|
|
6150
|
-
TenantStatus,
|
|
6151
|
-
TenantSettings,
|
|
6152
|
-
TenantContext,
|
|
6153
|
-
TenantApiKey,
|
|
6154
|
-
TenantQuota,
|
|
6155
|
-
TenantStorage,
|
|
6156
|
-
TenantResolver
|
|
6157
|
-
} from "@lov3kaizen/agentsea-types";
|
|
6731
|
+
import { TenantStatus } from "@lov3kaizen/agentsea-types";
|
|
6158
6732
|
|
|
6159
6733
|
// src/tenant/tenant-manager.ts
|
|
6160
6734
|
var TenantManager = class {
|
|
@@ -6482,7 +7056,6 @@ export {
|
|
|
6482
7056
|
ACPClient,
|
|
6483
7057
|
Agent,
|
|
6484
7058
|
AnthropicProvider,
|
|
6485
|
-
AudioFormat,
|
|
6486
7059
|
BufferMemory,
|
|
6487
7060
|
Cache,
|
|
6488
7061
|
ContentFormatter,
|
|
@@ -6512,35 +7085,19 @@ export {
|
|
|
6512
7085
|
RateLimiter,
|
|
6513
7086
|
RedisMemory,
|
|
6514
7087
|
SSETransport,
|
|
6515
|
-
STTConfig,
|
|
6516
|
-
STTProvider,
|
|
6517
|
-
STTResult,
|
|
6518
7088
|
SequentialWorkflow,
|
|
6519
7089
|
SlidingWindowRateLimiter,
|
|
6520
7090
|
StdioTransport,
|
|
6521
7091
|
SummaryMemory,
|
|
6522
7092
|
SupervisorWorkflow,
|
|
6523
|
-
TTSConfig,
|
|
6524
|
-
TTSProvider,
|
|
6525
|
-
TTSResult,
|
|
6526
|
-
Tenant,
|
|
6527
|
-
TenantApiKey,
|
|
6528
7093
|
TenantBufferMemory,
|
|
6529
|
-
TenantContext,
|
|
6530
7094
|
TenantManager,
|
|
6531
|
-
TenantQuota,
|
|
6532
|
-
TenantResolver,
|
|
6533
|
-
TenantSettings,
|
|
6534
7095
|
TenantStatus,
|
|
6535
|
-
TenantStorage,
|
|
6536
7096
|
TextGenerationWebUIProvider,
|
|
6537
7097
|
ToolRegistry,
|
|
6538
7098
|
Tracer,
|
|
6539
7099
|
VLLMProvider,
|
|
6540
7100
|
VoiceAgent,
|
|
6541
|
-
VoiceAgentConfig,
|
|
6542
|
-
VoiceMessage,
|
|
6543
|
-
VoiceType,
|
|
6544
7101
|
Workflow,
|
|
6545
7102
|
WorkflowFactory,
|
|
6546
7103
|
calculatorClient,
|
|
@@ -6548,6 +7105,7 @@ export {
|
|
|
6548
7105
|
calculatorServer,
|
|
6549
7106
|
calculatorTool,
|
|
6550
7107
|
clientTool,
|
|
7108
|
+
codeEditTool,
|
|
6551
7109
|
createACPTools,
|
|
6552
7110
|
createAnthropicProvider,
|
|
6553
7111
|
createGeminiProvider,
|
|
@@ -6563,8 +7121,16 @@ export {
|
|
|
6563
7121
|
fileListTool,
|
|
6564
7122
|
fileReadTool,
|
|
6565
7123
|
fileWriteTool,
|
|
7124
|
+
gitAddTool,
|
|
7125
|
+
gitBranchTool,
|
|
7126
|
+
gitCommitTool,
|
|
7127
|
+
gitDiffTool,
|
|
7128
|
+
gitLogTool,
|
|
7129
|
+
gitStatusTool,
|
|
7130
|
+
globTool,
|
|
6566
7131
|
globalMetrics,
|
|
6567
7132
|
globalTracer,
|
|
7133
|
+
grepTool,
|
|
6568
7134
|
httpRequestTool,
|
|
6569
7135
|
hybridTool,
|
|
6570
7136
|
mcpToolToAgenticTool,
|
|
@@ -6574,6 +7140,7 @@ export {
|
|
|
6574
7140
|
n8nListWorkflowsTool,
|
|
6575
7141
|
n8nTriggerWebhookTool,
|
|
6576
7142
|
serverTool,
|
|
7143
|
+
shellExecuteTool,
|
|
6577
7144
|
stringTransformTool,
|
|
6578
7145
|
textSummaryTool,
|
|
6579
7146
|
toLegacyTool,
|