@gotza02/smartagent 1.2.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/LICENSE +21 -0
- package/README.md +422 -0
- package/dist/config/index.d.ts +72 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +329 -0
- package/dist/config/index.js.map +1 -0
- package/dist/core/agent-manager.d.ts +116 -0
- package/dist/core/agent-manager.d.ts.map +1 -0
- package/dist/core/agent-manager.js +460 -0
- package/dist/core/agent-manager.js.map +1 -0
- package/dist/core/context-manager.d.ts +107 -0
- package/dist/core/context-manager.d.ts.map +1 -0
- package/dist/core/context-manager.js +467 -0
- package/dist/core/context-manager.js.map +1 -0
- package/dist/core/database.d.ts +82 -0
- package/dist/core/database.d.ts.map +1 -0
- package/dist/core/database.js +751 -0
- package/dist/core/database.js.map +1 -0
- package/dist/core/event-emitter.d.ts +110 -0
- package/dist/core/event-emitter.d.ts.map +1 -0
- package/dist/core/event-emitter.js +240 -0
- package/dist/core/event-emitter.js.map +1 -0
- package/dist/core/metrics.d.ts +108 -0
- package/dist/core/metrics.d.ts.map +1 -0
- package/dist/core/metrics.js +281 -0
- package/dist/core/metrics.js.map +1 -0
- package/dist/core/middleware.d.ts +63 -0
- package/dist/core/middleware.d.ts.map +1 -0
- package/dist/core/middleware.js +194 -0
- package/dist/core/middleware.js.map +1 -0
- package/dist/core/plugin-system.d.ts +86 -0
- package/dist/core/plugin-system.d.ts.map +1 -0
- package/dist/core/plugin-system.js +251 -0
- package/dist/core/plugin-system.js.map +1 -0
- package/dist/core/task-scheduler.d.ts +130 -0
- package/dist/core/task-scheduler.d.ts.map +1 -0
- package/dist/core/task-scheduler.js +401 -0
- package/dist/core/task-scheduler.js.map +1 -0
- package/dist/engines/auto-router.d.ts +76 -0
- package/dist/engines/auto-router.d.ts.map +1 -0
- package/dist/engines/auto-router.js +445 -0
- package/dist/engines/auto-router.js.map +1 -0
- package/dist/engines/parallel-execution.d.ts +104 -0
- package/dist/engines/parallel-execution.d.ts.map +1 -0
- package/dist/engines/parallel-execution.js +591 -0
- package/dist/engines/parallel-execution.js.map +1 -0
- package/dist/engines/sequential-thinking.d.ts +88 -0
- package/dist/engines/sequential-thinking.d.ts.map +1 -0
- package/dist/engines/sequential-thinking.js +406 -0
- package/dist/engines/sequential-thinking.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1101 -0
- package/dist/index.js.map +1 -0
- package/dist/security/validation.d.ts +87 -0
- package/dist/security/validation.d.ts.map +1 -0
- package/dist/security/validation.js +465 -0
- package/dist/security/validation.js.map +1 -0
- package/dist/tools/filesystem.d.ts +90 -0
- package/dist/tools/filesystem.d.ts.map +1 -0
- package/dist/tools/filesystem.js +292 -0
- package/dist/tools/filesystem.js.map +1 -0
- package/dist/tools/terminal.d.ts +99 -0
- package/dist/tools/terminal.d.ts.map +1 -0
- package/dist/tools/terminal.js +363 -0
- package/dist/tools/terminal.js.map +1 -0
- package/dist/types/index.d.ts +306 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +54 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/logger.d.ts +22 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +189 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal Tool Integration
|
|
3
|
+
* Secure command execution with validation and sandboxing
|
|
4
|
+
*/
|
|
5
|
+
import { spawn } from "child_process";
|
|
6
|
+
import { logger, logToolExecution } from "../utils/logger.js";
|
|
7
|
+
import { validateCommand, validatePath } from "../security/validation.js";
|
|
8
|
+
// Sensitive environment variables to strip
|
|
9
|
+
const SENSITIVE_ENV_VARS = [
|
|
10
|
+
"SSH_AUTH_SOCK",
|
|
11
|
+
"AWS_ACCESS_KEY_ID",
|
|
12
|
+
"AWS_SECRET_ACCESS_KEY",
|
|
13
|
+
"AWS_SESSION_TOKEN",
|
|
14
|
+
"GITHUB_TOKEN",
|
|
15
|
+
"GITLAB_TOKEN",
|
|
16
|
+
"NPM_TOKEN",
|
|
17
|
+
"DOCKER_AUTH_CONFIG",
|
|
18
|
+
"KUBECONFIG",
|
|
19
|
+
"GOOGLE_APPLICATION_CREDENTIALS",
|
|
20
|
+
"AZURE_CLIENT_SECRET",
|
|
21
|
+
];
|
|
22
|
+
// Restricted PATH for sandbox
|
|
23
|
+
const SANDBOX_PATH = "/usr/local/bin:/usr/bin:/bin";
|
|
24
|
+
// Sandbox working directory
|
|
25
|
+
const SANDBOX_DIR = "/tmp/swarm-sandbox";
|
|
26
|
+
/**
|
|
27
|
+
* Terminal Tool
|
|
28
|
+
* Secure command execution
|
|
29
|
+
*/
|
|
30
|
+
export class TerminalTool {
|
|
31
|
+
config;
|
|
32
|
+
constructor(config = {}) {
|
|
33
|
+
this.config = {
|
|
34
|
+
cwd: process.cwd(),
|
|
35
|
+
env: { ...process.env },
|
|
36
|
+
timeout: 60000, // 60 seconds
|
|
37
|
+
maxOutputSize: 1024 * 1024, // 1MB
|
|
38
|
+
shell: "/bin/bash",
|
|
39
|
+
securityPolicy: config.securityPolicy || {
|
|
40
|
+
id: "default",
|
|
41
|
+
name: "Default",
|
|
42
|
+
pathValidation: { enabled: true, allowedPaths: [], blockedPaths: [] },
|
|
43
|
+
commandValidation: { enabled: true, whitelist: [], blacklist: [], dangerousPatterns: [] },
|
|
44
|
+
rateLimit: { enabled: false, maxRequestsPerMinute: 0, maxRequestsPerHour: 0 },
|
|
45
|
+
},
|
|
46
|
+
sandboxEnabled: false,
|
|
47
|
+
...config,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Execute a command
|
|
52
|
+
*/
|
|
53
|
+
async execute(execution) {
|
|
54
|
+
const startTime = Date.now();
|
|
55
|
+
// Validate command
|
|
56
|
+
const commandValidation = validateCommand(execution.command, this.config.securityPolicy);
|
|
57
|
+
if (!commandValidation.valid) {
|
|
58
|
+
logToolExecution("terminal", "unknown", "unknown", 0, false, {
|
|
59
|
+
command: execution.command,
|
|
60
|
+
error: commandValidation.error,
|
|
61
|
+
blocked: true,
|
|
62
|
+
});
|
|
63
|
+
return {
|
|
64
|
+
success: false,
|
|
65
|
+
error: commandValidation.error,
|
|
66
|
+
blocked: true,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
const sanitizedCommand = commandValidation.sanitized;
|
|
70
|
+
// Validate cwd if provided
|
|
71
|
+
let cwd = execution.cwd || this.config.cwd;
|
|
72
|
+
if (execution.cwd) {
|
|
73
|
+
const pathValidation = validatePath(execution.cwd, this.config.securityPolicy);
|
|
74
|
+
if (!pathValidation.valid) {
|
|
75
|
+
return {
|
|
76
|
+
success: false,
|
|
77
|
+
error: `Invalid working directory: ${pathValidation.error}`,
|
|
78
|
+
blocked: true,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
cwd = pathValidation.resolvedPath;
|
|
82
|
+
}
|
|
83
|
+
// Prepare environment
|
|
84
|
+
const env = { ...this.config.env, ...execution.env };
|
|
85
|
+
// Set timeout
|
|
86
|
+
const timeout = execution.timeout || this.config.timeout;
|
|
87
|
+
try {
|
|
88
|
+
const result = await this.runCommand(sanitizedCommand, execution.args || [], cwd, env, timeout);
|
|
89
|
+
const duration = Date.now() - startTime;
|
|
90
|
+
logToolExecution("terminal", "unknown", "unknown", duration, result.exitCode === 0, {
|
|
91
|
+
command: sanitizedCommand,
|
|
92
|
+
exitCode: result.exitCode,
|
|
93
|
+
outputSize: result.stdout.length + result.stderr.length,
|
|
94
|
+
});
|
|
95
|
+
return {
|
|
96
|
+
success: result.exitCode === 0,
|
|
97
|
+
result,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
const duration = Date.now() - startTime;
|
|
102
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
103
|
+
logToolExecution("terminal", "unknown", "unknown", duration, false, {
|
|
104
|
+
command: sanitizedCommand,
|
|
105
|
+
error: errorMessage,
|
|
106
|
+
});
|
|
107
|
+
return { success: false, error: errorMessage };
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Prepare sandboxed environment
|
|
112
|
+
*/
|
|
113
|
+
prepareSandboxEnv(originalEnv) {
|
|
114
|
+
// Start with clean environment
|
|
115
|
+
const sandboxedEnv = {};
|
|
116
|
+
// Copy only safe environment variables
|
|
117
|
+
for (const [key, value] of Object.entries(originalEnv)) {
|
|
118
|
+
if (!SENSITIVE_ENV_VARS.includes(key)) {
|
|
119
|
+
sandboxedEnv[key] = value;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// Restrict PATH
|
|
123
|
+
sandboxedEnv.PATH = SANDBOX_PATH;
|
|
124
|
+
// Set sandbox directories
|
|
125
|
+
sandboxedEnv.HOME = SANDBOX_DIR;
|
|
126
|
+
sandboxedEnv.TMPDIR = SANDBOX_DIR;
|
|
127
|
+
sandboxedEnv.TMP = SANDBOX_DIR;
|
|
128
|
+
sandboxedEnv.TEMP = SANDBOX_DIR;
|
|
129
|
+
return sandboxedEnv;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Validate cwd against allowed paths
|
|
133
|
+
*/
|
|
134
|
+
validateCwd(cwd) {
|
|
135
|
+
// Check for path traversal attempts
|
|
136
|
+
const resolved = cwd;
|
|
137
|
+
// Block dangerous paths
|
|
138
|
+
const blockedPaths = ["/", "/bin", "/sbin", "/usr/bin", "/usr/sbin", "/etc", "/var", "/sys", "/proc", "/dev"];
|
|
139
|
+
for (const blocked of blockedPaths) {
|
|
140
|
+
if (resolved === blocked || resolved.startsWith(blocked + "/")) {
|
|
141
|
+
return { valid: false, error: `Access to ${resolved} is not allowed` };
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return { valid: true, resolvedPath: resolved };
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Run command with spawn
|
|
148
|
+
*/
|
|
149
|
+
runCommand(command, args, cwd, env, timeout) {
|
|
150
|
+
return new Promise((resolve, reject) => {
|
|
151
|
+
const startTime = Date.now();
|
|
152
|
+
let stdout = "";
|
|
153
|
+
let stderr = "";
|
|
154
|
+
let killed = false;
|
|
155
|
+
// Validate cwd
|
|
156
|
+
const cwdValidation = this.validateCwd(cwd);
|
|
157
|
+
if (!cwdValidation.valid) {
|
|
158
|
+
reject(new Error(cwdValidation.error));
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
// Prepare environment (sandbox if enabled)
|
|
162
|
+
let finalEnv = env;
|
|
163
|
+
if (this.config.sandboxEnabled) {
|
|
164
|
+
finalEnv = this.prepareSandboxEnv(env);
|
|
165
|
+
logger.debug("Running in sandbox mode", {
|
|
166
|
+
category: "tool",
|
|
167
|
+
command,
|
|
168
|
+
cwd: cwdValidation.resolvedPath,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
// Prepare spawn options
|
|
172
|
+
const spawnOptions = {
|
|
173
|
+
cwd: cwdValidation.resolvedPath,
|
|
174
|
+
env: finalEnv,
|
|
175
|
+
shell: this.config.shell,
|
|
176
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
177
|
+
detached: this.config.sandboxEnabled, // Process group isolation in sandbox mode
|
|
178
|
+
};
|
|
179
|
+
const child = spawn(command, args, spawnOptions);
|
|
180
|
+
// Set timeout
|
|
181
|
+
const timeoutId = setTimeout(() => {
|
|
182
|
+
killed = true;
|
|
183
|
+
// Kill entire process group if detached (sandbox mode)
|
|
184
|
+
if (this.config.sandboxEnabled && child.pid) {
|
|
185
|
+
try {
|
|
186
|
+
process.kill(-child.pid, "SIGTERM");
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
// Fallback to single process kill
|
|
190
|
+
child.kill("SIGTERM");
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
child.kill("SIGTERM");
|
|
195
|
+
}
|
|
196
|
+
// Force kill after 5 seconds
|
|
197
|
+
setTimeout(() => {
|
|
198
|
+
if (!child.killed && child.pid) {
|
|
199
|
+
if (this.config.sandboxEnabled) {
|
|
200
|
+
try {
|
|
201
|
+
process.kill(-child.pid, "SIGKILL");
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
child.kill("SIGKILL");
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
child.kill("SIGKILL");
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}, 5000);
|
|
212
|
+
}, timeout);
|
|
213
|
+
// Collect stdout
|
|
214
|
+
child.stdout?.on("data", (data) => {
|
|
215
|
+
const chunk = data.toString();
|
|
216
|
+
if (stdout.length + chunk.length > this.config.maxOutputSize) {
|
|
217
|
+
stdout += chunk.substring(0, this.config.maxOutputSize - stdout.length);
|
|
218
|
+
stdout += "\n[Output truncated: exceeded max size]";
|
|
219
|
+
if (!killed) {
|
|
220
|
+
killed = true;
|
|
221
|
+
child.kill();
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
stdout += chunk;
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
// Collect stderr
|
|
229
|
+
child.stderr?.on("data", (data) => {
|
|
230
|
+
const chunk = data.toString();
|
|
231
|
+
if (stderr.length + chunk.length > this.config.maxOutputSize) {
|
|
232
|
+
stderr += chunk.substring(0, this.config.maxOutputSize - stderr.length);
|
|
233
|
+
stderr += "\n[Error output truncated]";
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
stderr += chunk;
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
// Handle process completion
|
|
240
|
+
child.on("close", (exitCode) => {
|
|
241
|
+
clearTimeout(timeoutId);
|
|
242
|
+
const executionTime = Date.now() - startTime;
|
|
243
|
+
resolve({
|
|
244
|
+
stdout: stdout.trim(),
|
|
245
|
+
stderr: stderr.trim(),
|
|
246
|
+
exitCode: exitCode ?? -1,
|
|
247
|
+
executionTime,
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
// Handle errors
|
|
251
|
+
child.on("error", (error) => {
|
|
252
|
+
clearTimeout(timeoutId);
|
|
253
|
+
reject(error);
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Execute a simple command (no args)
|
|
259
|
+
*/
|
|
260
|
+
async run(command, options = {}) {
|
|
261
|
+
const result = await this.execute({
|
|
262
|
+
command,
|
|
263
|
+
cwd: options.cwd,
|
|
264
|
+
env: options.env,
|
|
265
|
+
timeout: options.timeout,
|
|
266
|
+
});
|
|
267
|
+
if (result.success && result.result) {
|
|
268
|
+
return {
|
|
269
|
+
success: true,
|
|
270
|
+
output: result.result.stdout || result.result.stderr,
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
return {
|
|
274
|
+
success: false,
|
|
275
|
+
error: result.error || result.result?.stderr || "Unknown error",
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Check if a command exists
|
|
280
|
+
*/
|
|
281
|
+
async commandExists(command) {
|
|
282
|
+
try {
|
|
283
|
+
const result = await this.run(`which ${command}`, { timeout: 5000 });
|
|
284
|
+
return result.success && !!result.output;
|
|
285
|
+
}
|
|
286
|
+
catch {
|
|
287
|
+
return false;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Get system information
|
|
292
|
+
*/
|
|
293
|
+
async getSystemInfo() {
|
|
294
|
+
try {
|
|
295
|
+
return {
|
|
296
|
+
success: true,
|
|
297
|
+
info: {
|
|
298
|
+
platform: process.platform,
|
|
299
|
+
arch: process.arch,
|
|
300
|
+
nodeVersion: process.version,
|
|
301
|
+
shell: this.config.shell,
|
|
302
|
+
cwd: this.config.cwd,
|
|
303
|
+
},
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
catch (error) {
|
|
307
|
+
return {
|
|
308
|
+
success: false,
|
|
309
|
+
error: error instanceof Error ? error.message : String(error),
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Execute piped commands
|
|
315
|
+
*/
|
|
316
|
+
async pipe(commands) {
|
|
317
|
+
if (commands.length === 0) {
|
|
318
|
+
return { success: false, error: "No commands provided" };
|
|
319
|
+
}
|
|
320
|
+
if (commands.length === 1) {
|
|
321
|
+
const cmd = commands[0];
|
|
322
|
+
if (!cmd) {
|
|
323
|
+
return { success: false, error: "Empty command" };
|
|
324
|
+
}
|
|
325
|
+
return this.execute({ command: cmd });
|
|
326
|
+
}
|
|
327
|
+
// Combine commands with pipes
|
|
328
|
+
const pipedCommand = commands.join(" | ");
|
|
329
|
+
return this.execute({ command: pipedCommand });
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Execute script from file
|
|
333
|
+
*/
|
|
334
|
+
async executeScript(scriptPath, args = []) {
|
|
335
|
+
// Validate script path
|
|
336
|
+
const pathValidation = validatePath(scriptPath, this.config.securityPolicy);
|
|
337
|
+
if (!pathValidation.valid || !pathValidation.resolvedPath) {
|
|
338
|
+
return { success: false, error: pathValidation.error || "Invalid path" };
|
|
339
|
+
}
|
|
340
|
+
// Determine interpreter based on extension
|
|
341
|
+
const ext = scriptPath.split(".").pop()?.toLowerCase() || "";
|
|
342
|
+
let interpreter = "";
|
|
343
|
+
switch (ext) {
|
|
344
|
+
case "sh":
|
|
345
|
+
interpreter = "bash";
|
|
346
|
+
break;
|
|
347
|
+
case "py":
|
|
348
|
+
interpreter = "python3";
|
|
349
|
+
break;
|
|
350
|
+
case "js":
|
|
351
|
+
interpreter = "node";
|
|
352
|
+
break;
|
|
353
|
+
case "ts":
|
|
354
|
+
interpreter = "ts-node";
|
|
355
|
+
break;
|
|
356
|
+
default:
|
|
357
|
+
interpreter = "bash";
|
|
358
|
+
}
|
|
359
|
+
const command = `${interpreter} ${pathValidation.resolvedPath}`;
|
|
360
|
+
return this.execute({ command, args });
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
//# sourceMappingURL=terminal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal.js","sourceRoot":"","sources":["../../src/tools/terminal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAG1E,2CAA2C;AAC3C,MAAM,kBAAkB,GAAG;IACzB,eAAe;IACf,mBAAmB;IACnB,uBAAuB;IACvB,mBAAmB;IACnB,cAAc;IACd,cAAc;IACd,WAAW;IACX,oBAAoB;IACpB,YAAY;IACZ,gCAAgC;IAChC,qBAAqB;CACtB,CAAC;AAEF,8BAA8B;AAC9B,MAAM,YAAY,GAAG,8BAA8B,CAAC;AAEpD,4BAA4B;AAC5B,MAAM,WAAW,GAAG,oBAAoB,CAAC;AA2BzC;;;GAGG;AACH,MAAM,OAAO,YAAY;IACf,MAAM,CAAiB;IAE/B,YAAY,SAAkC,EAAE;QAC9C,IAAI,CAAC,MAAM,GAAG;YACZ,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;YAClB,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAA4B;YACjD,OAAO,EAAE,KAAK,EAAE,aAAa;YAC7B,aAAa,EAAE,IAAI,GAAG,IAAI,EAAE,MAAM;YAClC,KAAK,EAAE,WAAW;YAClB,cAAc,EAAE,MAAM,CAAC,cAAc,IAAI;gBACvC,EAAE,EAAE,SAAS;gBACb,IAAI,EAAE,SAAS;gBACf,cAAc,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE;gBACrE,iBAAiB,EAAE,EAAE,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AO,EAAE,IAAI,EAAE,CAAC,CAAC;IACzC,CAAC;CACF"}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Types for Swarm MCP Enterprise
|
|
3
|
+
* Enterprise-Grade Type Definitions
|
|
4
|
+
*/
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
export declare const AgentTypeSchema: z.ZodEnum<["product_manager", "architect", "engineer", "qa", "reviewer"]>;
|
|
7
|
+
export type AgentType = z.infer<typeof AgentTypeSchema>;
|
|
8
|
+
export declare const AgentModeSchema: z.ZodEnum<["plan", "edit", "ralph"]>;
|
|
9
|
+
export type AgentMode = z.infer<typeof AgentModeSchema>;
|
|
10
|
+
export declare const AgentStatusSchema: z.ZodEnum<["idle", "busy", "completed", "error", "terminated"]>;
|
|
11
|
+
export type AgentStatus = z.infer<typeof AgentStatusSchema>;
|
|
12
|
+
export interface Agent {
|
|
13
|
+
id: string;
|
|
14
|
+
type: AgentType;
|
|
15
|
+
name: string;
|
|
16
|
+
mode: AgentMode;
|
|
17
|
+
status: AgentStatus;
|
|
18
|
+
currentTask?: string;
|
|
19
|
+
capabilities: string[];
|
|
20
|
+
metadata: Record<string, unknown>;
|
|
21
|
+
createdAt: string;
|
|
22
|
+
lastActiveAt: string;
|
|
23
|
+
healthCheckAt?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface AgentConfig {
|
|
26
|
+
type: AgentType;
|
|
27
|
+
name?: string;
|
|
28
|
+
mode?: AgentMode;
|
|
29
|
+
capabilities?: string[];
|
|
30
|
+
metadata?: Record<string, unknown>;
|
|
31
|
+
}
|
|
32
|
+
export declare const TaskStatusSchema: z.ZodEnum<["pending", "in_progress", "completed", "failed", "cancelled"]>;
|
|
33
|
+
export type TaskStatus = z.infer<typeof TaskStatusSchema>;
|
|
34
|
+
export interface Task {
|
|
35
|
+
id: string;
|
|
36
|
+
agentId: string;
|
|
37
|
+
type: string;
|
|
38
|
+
description: string;
|
|
39
|
+
context: Record<string, unknown>;
|
|
40
|
+
status: TaskStatus;
|
|
41
|
+
priority: number;
|
|
42
|
+
result?: unknown;
|
|
43
|
+
error?: string;
|
|
44
|
+
createdAt: string;
|
|
45
|
+
startedAt?: string;
|
|
46
|
+
completedAt?: string;
|
|
47
|
+
timeout: number;
|
|
48
|
+
}
|
|
49
|
+
export interface TaskConfig {
|
|
50
|
+
agentId: string;
|
|
51
|
+
type: string;
|
|
52
|
+
description: string;
|
|
53
|
+
context?: Record<string, unknown>;
|
|
54
|
+
priority?: number;
|
|
55
|
+
timeout?: number;
|
|
56
|
+
}
|
|
57
|
+
export declare const ThoughtStatusSchema: z.ZodEnum<["active", "revised", "branched", "merged", "discarded"]>;
|
|
58
|
+
export type ThoughtStatus = z.infer<typeof ThoughtStatusSchema>;
|
|
59
|
+
export interface Thought {
|
|
60
|
+
id: string;
|
|
61
|
+
chainId: string;
|
|
62
|
+
step: number;
|
|
63
|
+
content: string;
|
|
64
|
+
reasoning: string;
|
|
65
|
+
confidence: number;
|
|
66
|
+
status: ThoughtStatus;
|
|
67
|
+
parentThoughtId?: string;
|
|
68
|
+
branchIds: string[];
|
|
69
|
+
metadata: {
|
|
70
|
+
agentId: string;
|
|
71
|
+
taskId: string;
|
|
72
|
+
timestamp: string;
|
|
73
|
+
revisionOf?: string;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export interface ThoughtChain {
|
|
77
|
+
id: string;
|
|
78
|
+
agentId: string;
|
|
79
|
+
taskId: string;
|
|
80
|
+
title: string;
|
|
81
|
+
thoughts: Thought[];
|
|
82
|
+
branches: Map<string, Thought[]>;
|
|
83
|
+
currentStep: number;
|
|
84
|
+
status: "active" | "completed" | "paused";
|
|
85
|
+
createdAt: string;
|
|
86
|
+
updatedAt: string;
|
|
87
|
+
}
|
|
88
|
+
export interface SequentialThinkingConfig {
|
|
89
|
+
enableBranching: boolean;
|
|
90
|
+
enableRevision: boolean;
|
|
91
|
+
maxSteps: number;
|
|
92
|
+
minConfidence: number;
|
|
93
|
+
autoSummarize: boolean;
|
|
94
|
+
}
|
|
95
|
+
export interface IntentClassification {
|
|
96
|
+
intent: string;
|
|
97
|
+
confidence: number;
|
|
98
|
+
category: "create" | "modify" | "analyze" | "review" | "execute";
|
|
99
|
+
complexity: "simple" | "medium" | "complex";
|
|
100
|
+
requiredCapabilities: string[];
|
|
101
|
+
}
|
|
102
|
+
export interface RoutingDecision {
|
|
103
|
+
targetAgent: AgentType;
|
|
104
|
+
confidence: number;
|
|
105
|
+
reasoning: string;
|
|
106
|
+
alternativeAgents: Array<{
|
|
107
|
+
type: AgentType;
|
|
108
|
+
confidence: number;
|
|
109
|
+
}>;
|
|
110
|
+
suggestedMode: AgentMode;
|
|
111
|
+
estimatedComplexity: number;
|
|
112
|
+
}
|
|
113
|
+
export interface AutoRouterConfig {
|
|
114
|
+
minConfidence: number;
|
|
115
|
+
enableFallback: boolean;
|
|
116
|
+
complexityThreshold: {
|
|
117
|
+
simple: number;
|
|
118
|
+
medium: number;
|
|
119
|
+
complex: number;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
export declare const ToolTypeSchema: z.ZodEnum<["filesystem", "terminal", "git", "http", "custom"]>;
|
|
123
|
+
export type ToolType = z.infer<typeof ToolTypeSchema>;
|
|
124
|
+
export interface Tool {
|
|
125
|
+
id: string;
|
|
126
|
+
type: ToolType;
|
|
127
|
+
name: string;
|
|
128
|
+
description: string;
|
|
129
|
+
capabilities: string[];
|
|
130
|
+
requiredMode: AgentMode[];
|
|
131
|
+
config: ToolConfig;
|
|
132
|
+
}
|
|
133
|
+
export interface ToolConfig {
|
|
134
|
+
timeout: number;
|
|
135
|
+
allowedPaths?: string[];
|
|
136
|
+
blockedCommands?: string[];
|
|
137
|
+
allowedCommands?: string[];
|
|
138
|
+
maxOutputSize: number;
|
|
139
|
+
sandboxEnabled: boolean;
|
|
140
|
+
}
|
|
141
|
+
export interface ToolExecution {
|
|
142
|
+
id: string;
|
|
143
|
+
toolId: string;
|
|
144
|
+
agentId: string;
|
|
145
|
+
taskId: string;
|
|
146
|
+
command: string;
|
|
147
|
+
args: unknown[];
|
|
148
|
+
result?: unknown;
|
|
149
|
+
error?: string;
|
|
150
|
+
status: "pending" | "running" | "completed" | "failed" | "blocked";
|
|
151
|
+
startedAt: string;
|
|
152
|
+
completedAt?: string;
|
|
153
|
+
executionTime: number;
|
|
154
|
+
}
|
|
155
|
+
export interface Context {
|
|
156
|
+
id: string;
|
|
157
|
+
agentId: string;
|
|
158
|
+
messages: ContextMessage[];
|
|
159
|
+
artifacts: Artifact[];
|
|
160
|
+
checkpoints: Checkpoint[];
|
|
161
|
+
summary?: string;
|
|
162
|
+
tokenCount: number;
|
|
163
|
+
maxTokens: number;
|
|
164
|
+
createdAt: string;
|
|
165
|
+
updatedAt: string;
|
|
166
|
+
}
|
|
167
|
+
export interface ContextMessage {
|
|
168
|
+
id: string;
|
|
169
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
170
|
+
content: string;
|
|
171
|
+
timestamp: string;
|
|
172
|
+
metadata?: Record<string, unknown>;
|
|
173
|
+
}
|
|
174
|
+
export interface Artifact {
|
|
175
|
+
id: string;
|
|
176
|
+
type: "file" | "code" | "document" | "data";
|
|
177
|
+
name: string;
|
|
178
|
+
content: string;
|
|
179
|
+
metadata: Record<string, unknown>;
|
|
180
|
+
createdAt: string;
|
|
181
|
+
}
|
|
182
|
+
export interface Checkpoint {
|
|
183
|
+
id: string;
|
|
184
|
+
contextId: string;
|
|
185
|
+
sequence: number;
|
|
186
|
+
messages: ContextMessage[];
|
|
187
|
+
artifacts: Artifact[];
|
|
188
|
+
thoughtChainId?: string;
|
|
189
|
+
createdAt: string;
|
|
190
|
+
}
|
|
191
|
+
export interface HandoffContext {
|
|
192
|
+
id: string;
|
|
193
|
+
fromAgentId: string;
|
|
194
|
+
toAgentId: string;
|
|
195
|
+
taskId: string;
|
|
196
|
+
contextSnapshot: {
|
|
197
|
+
messages: ContextMessage[];
|
|
198
|
+
artifacts: Artifact[];
|
|
199
|
+
thoughtChain?: ThoughtChain;
|
|
200
|
+
};
|
|
201
|
+
notes?: string;
|
|
202
|
+
timestamp: string;
|
|
203
|
+
}
|
|
204
|
+
export interface ParallelTask {
|
|
205
|
+
id: string;
|
|
206
|
+
taskId: string;
|
|
207
|
+
agentId: string;
|
|
208
|
+
status: TaskStatus;
|
|
209
|
+
result?: unknown;
|
|
210
|
+
error?: string;
|
|
211
|
+
startedAt?: string;
|
|
212
|
+
completedAt?: string;
|
|
213
|
+
}
|
|
214
|
+
export interface ParallelExecution {
|
|
215
|
+
id: string;
|
|
216
|
+
batchId: string;
|
|
217
|
+
tasks: ParallelTask[];
|
|
218
|
+
maxConcurrency: number;
|
|
219
|
+
status: "pending" | "running" | "completed" | "partial" | "failed";
|
|
220
|
+
results: Map<string, unknown>;
|
|
221
|
+
aggregatedReport?: string;
|
|
222
|
+
createdAt: string;
|
|
223
|
+
completedAt?: string;
|
|
224
|
+
}
|
|
225
|
+
export interface SecurityPolicy {
|
|
226
|
+
id: string;
|
|
227
|
+
name: string;
|
|
228
|
+
pathValidation: {
|
|
229
|
+
enabled: boolean;
|
|
230
|
+
allowedPaths: string[];
|
|
231
|
+
blockedPaths: string[];
|
|
232
|
+
};
|
|
233
|
+
commandValidation: {
|
|
234
|
+
enabled: boolean;
|
|
235
|
+
whitelist: string[];
|
|
236
|
+
blacklist: string[];
|
|
237
|
+
dangerousPatterns: RegExp[];
|
|
238
|
+
};
|
|
239
|
+
rateLimit: {
|
|
240
|
+
enabled: boolean;
|
|
241
|
+
maxRequestsPerMinute: number;
|
|
242
|
+
maxRequestsPerHour: number;
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
export interface AuditLog {
|
|
246
|
+
id: string;
|
|
247
|
+
timestamp: string;
|
|
248
|
+
level: "info" | "warn" | "error" | "security";
|
|
249
|
+
category: string;
|
|
250
|
+
agentId?: string;
|
|
251
|
+
taskId?: string;
|
|
252
|
+
action: string;
|
|
253
|
+
details: Record<string, unknown>;
|
|
254
|
+
ip?: string;
|
|
255
|
+
userAgent?: string;
|
|
256
|
+
}
|
|
257
|
+
export interface AuthConfig {
|
|
258
|
+
enabled: boolean;
|
|
259
|
+
tokens: string[];
|
|
260
|
+
}
|
|
261
|
+
export interface SystemConfig {
|
|
262
|
+
maxAgents: number;
|
|
263
|
+
defaultAgentMode: AgentMode;
|
|
264
|
+
healthCheckInterval: number;
|
|
265
|
+
agentTimeout: number;
|
|
266
|
+
sequentialThinking: SequentialThinkingConfig;
|
|
267
|
+
autoRouting: AutoRouterConfig;
|
|
268
|
+
contextMaxTokens: number;
|
|
269
|
+
contextAutoSummarizeThreshold: number;
|
|
270
|
+
checkpointInterval: number;
|
|
271
|
+
maxParallelTasks: number;
|
|
272
|
+
defaultParallelism: number;
|
|
273
|
+
toolTimeout: number;
|
|
274
|
+
maxToolOutputSize: number;
|
|
275
|
+
securityPolicy: SecurityPolicy;
|
|
276
|
+
auth: AuthConfig;
|
|
277
|
+
logLevel: "debug" | "info" | "warn" | "error";
|
|
278
|
+
logFormat: "json" | "pretty";
|
|
279
|
+
auditLogRetention: number;
|
|
280
|
+
}
|
|
281
|
+
export interface ApiResponse<T> {
|
|
282
|
+
success: boolean;
|
|
283
|
+
data?: T;
|
|
284
|
+
error?: {
|
|
285
|
+
code: string;
|
|
286
|
+
message: string;
|
|
287
|
+
details?: unknown;
|
|
288
|
+
};
|
|
289
|
+
meta?: {
|
|
290
|
+
timestamp: string;
|
|
291
|
+
requestId: string;
|
|
292
|
+
duration: number;
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
export interface PaginatedResponse<T> extends ApiResponse<T> {
|
|
296
|
+
meta?: {
|
|
297
|
+
timestamp: string;
|
|
298
|
+
requestId: string;
|
|
299
|
+
duration: number;
|
|
300
|
+
page: number;
|
|
301
|
+
limit: number;
|
|
302
|
+
total: number;
|
|
303
|
+
totalPages: number;
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
//# sourceMappingURL=index.d.ts.map
|