musonda 1.0.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/IMPLEMENTATION.md +432 -0
- package/README.md +119 -0
- package/dist/agent/harness.d.ts +25 -0
- package/dist/agent/harness.js +215 -0
- package/dist/agent/harness.js.map +1 -0
- package/dist/agent/openaiResponsesClient.d.ts +35 -0
- package/dist/agent/openaiResponsesClient.js +250 -0
- package/dist/agent/openaiResponsesClient.js.map +1 -0
- package/dist/agent/systemPrompt.d.ts +9 -0
- package/dist/agent/systemPrompt.js +100 -0
- package/dist/agent/systemPrompt.js.map +1 -0
- package/dist/agent/types.d.ts +53 -0
- package/dist/agent/types.js +2 -0
- package/dist/agent/types.js.map +1 -0
- package/dist/cli/commands/chat.d.ts +6 -0
- package/dist/cli/commands/chat.js +8 -0
- package/dist/cli/commands/chat.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +4 -0
- package/dist/cli/commands/doctor.js +336 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/gateway.d.ts +20 -0
- package/dist/cli/commands/gateway.js +135 -0
- package/dist/cli/commands/gateway.js.map +1 -0
- package/dist/cli/commands/help.d.ts +4 -0
- package/dist/cli/commands/help.js +159 -0
- package/dist/cli/commands/help.js.map +1 -0
- package/dist/cli/commands/plugins.d.ts +18 -0
- package/dist/cli/commands/plugins.js +250 -0
- package/dist/cli/commands/plugins.js.map +1 -0
- package/dist/cli/commands/service.d.ts +16 -0
- package/dist/cli/commands/service.js +136 -0
- package/dist/cli/commands/service.js.map +1 -0
- package/dist/cli/commands/setup.d.ts +4 -0
- package/dist/cli/commands/setup.js +8 -0
- package/dist/cli/commands/setup.js.map +1 -0
- package/dist/cli/commands/status.d.ts +4 -0
- package/dist/cli/commands/status.js +73 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/update.d.ts +22 -0
- package/dist/cli/commands/update.js +226 -0
- package/dist/cli/commands/update.js.map +1 -0
- package/dist/cli/daemon.d.ts +33 -0
- package/dist/cli/daemon.js +208 -0
- package/dist/cli/daemon.js.map +1 -0
- package/dist/cli/interactiveMenu.d.ts +5 -0
- package/dist/cli/interactiveMenu.js +225 -0
- package/dist/cli/interactiveMenu.js.map +1 -0
- package/dist/cli/musondaCli.d.ts +30 -0
- package/dist/cli/musondaCli.js +269 -0
- package/dist/cli/musondaCli.js.map +1 -0
- package/dist/cli/ui.d.ts +49 -0
- package/dist/cli/ui.js +90 -0
- package/dist/cli/ui.js.map +1 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.js +315 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/loader.d.ts +12 -0
- package/dist/config/loader.js +217 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/paths.d.ts +11 -0
- package/dist/config/paths.js +18 -0
- package/dist/config/paths.js.map +1 -0
- package/dist/config/types.d.ts +246 -0
- package/dist/config/types.js +155 -0
- package/dist/config/types.js.map +1 -0
- package/dist/gateway/channels/cli.d.ts +37 -0
- package/dist/gateway/channels/cli.js +298 -0
- package/dist/gateway/channels/cli.js.map +1 -0
- package/dist/gateway/channels/discord.d.ts +18 -0
- package/dist/gateway/channels/discord.js +419 -0
- package/dist/gateway/channels/discord.js.map +1 -0
- package/dist/gateway/channels/slack.d.ts +26 -0
- package/dist/gateway/channels/slack.js +470 -0
- package/dist/gateway/channels/slack.js.map +1 -0
- package/dist/gateway/channels/webhook.d.ts +18 -0
- package/dist/gateway/channels/webhook.js +49 -0
- package/dist/gateway/channels/webhook.js.map +1 -0
- package/dist/gateway/http.d.ts +33 -0
- package/dist/gateway/http.js +605 -0
- package/dist/gateway/http.js.map +1 -0
- package/dist/gateway/server.d.ts +38 -0
- package/dist/gateway/server.js +233 -0
- package/dist/gateway/server.js.map +1 -0
- package/dist/gateway/types.d.ts +28 -0
- package/dist/gateway/types.js +2 -0
- package/dist/gateway/types.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/memory/memoryManager.d.ts +22 -0
- package/dist/memory/memoryManager.js +200 -0
- package/dist/memory/memoryManager.js.map +1 -0
- package/dist/memory/storage.d.ts +24 -0
- package/dist/memory/storage.js +187 -0
- package/dist/memory/storage.js.map +1 -0
- package/dist/memory/types.d.ts +43 -0
- package/dist/memory/types.js +2 -0
- package/dist/memory/types.js.map +1 -0
- package/dist/plugins/manifest.d.ts +23 -0
- package/dist/plugins/manifest.js +185 -0
- package/dist/plugins/manifest.js.map +1 -0
- package/dist/plugins/mcp/mcpBridge.d.ts +31 -0
- package/dist/plugins/mcp/mcpBridge.js +115 -0
- package/dist/plugins/mcp/mcpBridge.js.map +1 -0
- package/dist/plugins/mcp/mcpClient.d.ts +43 -0
- package/dist/plugins/mcp/mcpClient.js +309 -0
- package/dist/plugins/mcp/mcpClient.js.map +1 -0
- package/dist/plugins/mcp/mcpConfig.d.ts +34 -0
- package/dist/plugins/mcp/mcpConfig.js +326 -0
- package/dist/plugins/mcp/mcpConfig.js.map +1 -0
- package/dist/plugins/mcp/types.d.ts +48 -0
- package/dist/plugins/mcp/types.js +2 -0
- package/dist/plugins/mcp/types.js.map +1 -0
- package/dist/plugins/pluginManager.d.ts +164 -0
- package/dist/plugins/pluginManager.js +1016 -0
- package/dist/plugins/pluginManager.js.map +1 -0
- package/dist/plugins/skills/frontmatterParser.d.ts +28 -0
- package/dist/plugins/skills/frontmatterParser.js +189 -0
- package/dist/plugins/skills/frontmatterParser.js.map +1 -0
- package/dist/plugins/skills/skillDiscovery.d.ts +15 -0
- package/dist/plugins/skills/skillDiscovery.js +148 -0
- package/dist/plugins/skills/skillDiscovery.js.map +1 -0
- package/dist/plugins/skills/skillTools.d.ts +8 -0
- package/dist/plugins/skills/skillTools.js +195 -0
- package/dist/plugins/skills/skillTools.js.map +1 -0
- package/dist/plugins/skills/types.d.ts +25 -0
- package/dist/plugins/skills/types.js +2 -0
- package/dist/plugins/skills/types.js.map +1 -0
- package/dist/plugins/types.d.ts +30 -0
- package/dist/plugins/types.js +2 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/scheduler/scheduler.d.ts +25 -0
- package/dist/scheduler/scheduler.js +239 -0
- package/dist/scheduler/scheduler.js.map +1 -0
- package/dist/scheduler/types.d.ts +39 -0
- package/dist/scheduler/types.js +2 -0
- package/dist/scheduler/types.js.map +1 -0
- package/dist/security/childProcessEnv.d.ts +5 -0
- package/dist/security/childProcessEnv.js +42 -0
- package/dist/security/childProcessEnv.js.map +1 -0
- package/dist/security/fileSandbox.d.ts +153 -0
- package/dist/security/fileSandbox.js +779 -0
- package/dist/security/fileSandbox.js.map +1 -0
- package/dist/service/index.d.ts +30 -0
- package/dist/service/index.js +41 -0
- package/dist/service/index.js.map +1 -0
- package/dist/service/systemd.d.ts +36 -0
- package/dist/service/systemd.js +409 -0
- package/dist/service/systemd.js.map +1 -0
- package/dist/service/types.d.ts +118 -0
- package/dist/service/types.js +6 -0
- package/dist/service/types.js.map +1 -0
- package/dist/tools/builtin/calcTools.d.ts +2 -0
- package/dist/tools/builtin/calcTools.js +51 -0
- package/dist/tools/builtin/calcTools.js.map +1 -0
- package/dist/tools/builtin/fileTools.d.ts +11 -0
- package/dist/tools/builtin/fileTools.js +352 -0
- package/dist/tools/builtin/fileTools.js.map +1 -0
- package/dist/tools/builtin/memoryTools.d.ts +4 -0
- package/dist/tools/builtin/memoryTools.js +123 -0
- package/dist/tools/builtin/memoryTools.js.map +1 -0
- package/dist/tools/builtin/noteTools.d.ts +4 -0
- package/dist/tools/builtin/noteTools.js +91 -0
- package/dist/tools/builtin/noteTools.js.map +1 -0
- package/dist/tools/builtin/pluginTools.d.ts +29 -0
- package/dist/tools/builtin/pluginTools.js +406 -0
- package/dist/tools/builtin/pluginTools.js.map +1 -0
- package/dist/tools/builtin/scheduleTools.d.ts +4 -0
- package/dist/tools/builtin/scheduleTools.js +156 -0
- package/dist/tools/builtin/scheduleTools.js.map +1 -0
- package/dist/tools/builtin/timeTools.d.ts +2 -0
- package/dist/tools/builtin/timeTools.js +41 -0
- package/dist/tools/builtin/timeTools.js.map +1 -0
- package/dist/tools/builtin/webTools.d.ts +12 -0
- package/dist/tools/builtin/webTools.js +325 -0
- package/dist/tools/builtin/webTools.js.map +1 -0
- package/dist/tools/registry.d.ts +15 -0
- package/dist/tools/registry.js +111 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/types.d.ts +41 -0
- package/dist/tools/types.js +2 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/utils/logger.d.ts +29 -0
- package/dist/utils/logger.js +124 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/wizard/onboarding.d.ts +3 -0
- package/dist/wizard/onboarding.js +408 -0
- package/dist/wizard/onboarding.js.map +1 -0
- package/package.json +69 -0
- package/plugins/example-calc/mcp.json +11 -0
- package/plugins/example-calc/plugin.json +12 -0
- package/plugins/example-calc/server.mjs +92 -0
- package/plugins/example-calc/skills/math-assistant/SKILL.md +15 -0
- package/plugins/plugin-builder/plugin.json +12 -0
- package/plugins/plugin-builder/skills/create-plugin/SKILL.md +149 -0
- package/plugins/plugin-builder/skills/manage-plugins/SKILL.md +157 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Musonda Service Management Subsystem - Type Definitions
|
|
3
|
+
* Supports Linux systemd .service unit generation, installation, and lifecycle management.
|
|
4
|
+
*/
|
|
5
|
+
export type SystemdServiceType = 'user' | 'system' | 'file';
|
|
6
|
+
export interface SystemdServiceOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Base name for the service unit (default: 'musonda').
|
|
9
|
+
* The generated file will be `${serviceName}.service`.
|
|
10
|
+
*/
|
|
11
|
+
serviceName?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Description shown in systemctl status and journalctl.
|
|
14
|
+
*/
|
|
15
|
+
description?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Root working directory for the service process.
|
|
18
|
+
* Defaults to process.cwd().
|
|
19
|
+
*/
|
|
20
|
+
workingDirectory?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Absolute path to the node runtime executable.
|
|
23
|
+
* Defaults to process.execPath.
|
|
24
|
+
*/
|
|
25
|
+
nodePath?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Entrypoint file path (e.g., dist/index.js or src/index.ts).
|
|
28
|
+
* Defaults to dist/index.js if it exists, otherwise src/index.ts.
|
|
29
|
+
*/
|
|
30
|
+
entrypoint?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Gateway port override (e.g., 4141).
|
|
33
|
+
*/
|
|
34
|
+
port?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Gateway host override (e.g., '127.0.0.1').
|
|
37
|
+
*/
|
|
38
|
+
host?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Target service scope:
|
|
41
|
+
* - 'user': ~/.config/systemd/user/<serviceName>.service (runs as non-root user)
|
|
42
|
+
* - 'system': /etc/systemd/system/<serviceName>.service (requires root/sudo)
|
|
43
|
+
* - 'file': exported to working directory or custom output path
|
|
44
|
+
*/
|
|
45
|
+
serviceType?: SystemdServiceType;
|
|
46
|
+
/**
|
|
47
|
+
* Custom output file path when serviceType is 'file' or custom target.
|
|
48
|
+
*/
|
|
49
|
+
outputPath?: string;
|
|
50
|
+
/**
|
|
51
|
+
* System user to run the service as (only applicable for 'system' scope).
|
|
52
|
+
*/
|
|
53
|
+
user?: string;
|
|
54
|
+
/**
|
|
55
|
+
* System group to run the service as (only applicable for 'system' scope).
|
|
56
|
+
*/
|
|
57
|
+
group?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Seconds to wait before systemd restarts an exited or crashed service.
|
|
60
|
+
* Default: 10.
|
|
61
|
+
*/
|
|
62
|
+
restartSec?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Custom environment key-value pairs to write as Environment="KEY=VAL" directives.
|
|
65
|
+
*/
|
|
66
|
+
env?: Record<string, string>;
|
|
67
|
+
/**
|
|
68
|
+
* Path to custom environment file or true to automatically link ${workingDirectory}/.env.
|
|
69
|
+
* Default: true (points to EnvironmentFile=-<workingDirectory>/.env).
|
|
70
|
+
*/
|
|
71
|
+
includeEnvFile?: boolean | string;
|
|
72
|
+
/**
|
|
73
|
+
* Extra CLI flags to pass to ExecStart.
|
|
74
|
+
*/
|
|
75
|
+
extraArgs?: string[];
|
|
76
|
+
}
|
|
77
|
+
export interface ServiceCommandReference {
|
|
78
|
+
status: string;
|
|
79
|
+
logs: string;
|
|
80
|
+
start: string;
|
|
81
|
+
stop: string;
|
|
82
|
+
restart: string;
|
|
83
|
+
enable: string;
|
|
84
|
+
disable: string;
|
|
85
|
+
}
|
|
86
|
+
export interface ServiceInstallResult {
|
|
87
|
+
success: boolean;
|
|
88
|
+
servicePath: string;
|
|
89
|
+
serviceName: string;
|
|
90
|
+
serviceType: SystemdServiceType;
|
|
91
|
+
content: string;
|
|
92
|
+
enabled?: boolean;
|
|
93
|
+
started?: boolean;
|
|
94
|
+
commands: ServiceCommandReference;
|
|
95
|
+
warning?: string;
|
|
96
|
+
error?: string;
|
|
97
|
+
}
|
|
98
|
+
export interface ServiceStatusResult {
|
|
99
|
+
installed: boolean;
|
|
100
|
+
serviceName: string;
|
|
101
|
+
serviceType: SystemdServiceType;
|
|
102
|
+
servicePath?: string;
|
|
103
|
+
active?: boolean;
|
|
104
|
+
enabled?: boolean;
|
|
105
|
+
statusText?: string;
|
|
106
|
+
detail?: string;
|
|
107
|
+
commands: ServiceCommandReference;
|
|
108
|
+
}
|
|
109
|
+
export interface ServiceUninstallResult {
|
|
110
|
+
success: boolean;
|
|
111
|
+
serviceName: string;
|
|
112
|
+
serviceType: SystemdServiceType;
|
|
113
|
+
servicePath: string;
|
|
114
|
+
wasRunning?: boolean;
|
|
115
|
+
wasEnabled?: boolean;
|
|
116
|
+
message: string;
|
|
117
|
+
error?: string;
|
|
118
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/service/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export const calculateTool = {
|
|
2
|
+
name: 'calculate',
|
|
3
|
+
description: 'Evaluate a mathematical expression safely (supports arithmetic, powers, trigonometric, logarithmic, square roots, etc.).',
|
|
4
|
+
parameters: {
|
|
5
|
+
type: 'object',
|
|
6
|
+
properties: {
|
|
7
|
+
expression: {
|
|
8
|
+
type: 'string',
|
|
9
|
+
description: 'The mathematical expression to evaluate, e.g. "(12 * 45) + sqrt(144) - 2^3".',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
required: ['expression'],
|
|
13
|
+
},
|
|
14
|
+
execute: async (args) => {
|
|
15
|
+
const raw = args.expression.trim();
|
|
16
|
+
// Sanitize expression
|
|
17
|
+
const sanitized = raw
|
|
18
|
+
.replace(/\^/g, '**')
|
|
19
|
+
.replace(/sqrt\(/g, 'Math.sqrt(')
|
|
20
|
+
.replace(/abs\(/g, 'Math.abs(')
|
|
21
|
+
.replace(/sin\(/g, 'Math.sin(')
|
|
22
|
+
.replace(/cos\(/g, 'Math.cos(')
|
|
23
|
+
.replace(/tan\(/g, 'Math.tan(')
|
|
24
|
+
.replace(/log\(/g, 'Math.log(')
|
|
25
|
+
.replace(/log10\(/g, 'Math.log10(')
|
|
26
|
+
.replace(/PI/g, 'Math.PI')
|
|
27
|
+
.replace(/E/g, 'Math.E');
|
|
28
|
+
// Security check: only allow digits, math operators, parens, and Math functions
|
|
29
|
+
const validMathRegex = /^[\d\s+\-*/%.(),Math.sqrtabscosintelg10PIE**]+$/;
|
|
30
|
+
if (!validMathRegex.test(sanitized)) {
|
|
31
|
+
return {
|
|
32
|
+
error: 'Invalid mathematical expression. Only standard arithmetic and math functions are allowed.',
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
const fn = new Function(`"use strict"; return (${sanitized});`);
|
|
37
|
+
const result = fn();
|
|
38
|
+
return {
|
|
39
|
+
expression: raw,
|
|
40
|
+
result: typeof result === 'number' ? Number(result.toFixed(8)) : result,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
return {
|
|
45
|
+
expression: raw,
|
|
46
|
+
error: `Calculation error: ${err.message}`,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=calcTools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calcTools.js","sourceRoot":"","sources":["../../../src/tools/builtin/calcTools.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAmB;IAC3C,IAAI,EAAE,WAAW;IACjB,WAAW,EACT,0HAA0H;IAC5H,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,8EAA8E;aAC5F;SACF;QACD,QAAQ,EAAE,CAAC,YAAY,CAAC;KACzB;IACD,OAAO,EAAE,KAAK,EAAE,IAA4B,EAAE,EAAE;QAC9C,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QAEnC,sBAAsB;QACtB,MAAM,SAAS,GAAG,GAAG;aAClB,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC;aACpB,OAAO,CAAC,SAAS,EAAE,YAAY,CAAC;aAChC,OAAO,CAAC,QAAQ,EAAE,WAAW,CAAC;aAC9B,OAAO,CAAC,QAAQ,EAAE,WAAW,CAAC;aAC9B,OAAO,CAAC,QAAQ,EAAE,WAAW,CAAC;aAC9B,OAAO,CAAC,QAAQ,EAAE,WAAW,CAAC;aAC9B,OAAO,CAAC,QAAQ,EAAE,WAAW,CAAC;aAC9B,OAAO,CAAC,UAAU,EAAE,aAAa,CAAC;aAClC,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC;aACzB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAE3B,gFAAgF;QAChF,MAAM,cAAc,GAAG,iDAAiD,CAAC;QACzE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YACpC,OAAO;gBACL,KAAK,EAAE,2FAA2F;aACnG,CAAC;QACJ,CAAC;QAED,IAAI,CAAC;YACH,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC,yBAAyB,SAAS,IAAI,CAAC,CAAC;YAChE,MAAM,MAAM,GAAG,EAAE,EAAE,CAAC;YACpB,OAAO;gBACL,UAAU,EAAE,GAAG;gBACf,MAAM,EAAE,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM;aACxE,CAAC;QACJ,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,OAAO;gBACL,UAAU,EAAE,GAAG;gBACf,KAAK,EAAE,sBAAsB,GAAG,CAAC,OAAO,EAAE;aAC3C,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ToolDefinition } from '../types.js';
|
|
2
|
+
export declare const fileReadTool: ToolDefinition;
|
|
3
|
+
export declare const fileWriteTool: ToolDefinition;
|
|
4
|
+
export declare const fileEditTool: ToolDefinition;
|
|
5
|
+
export declare const fileAppendTool: ToolDefinition;
|
|
6
|
+
export declare const fileListTool: ToolDefinition;
|
|
7
|
+
export declare const fileDeleteTool: ToolDefinition;
|
|
8
|
+
export declare const fileInfoTool: ToolDefinition;
|
|
9
|
+
export declare const directoryCreateTool: ToolDefinition;
|
|
10
|
+
export declare const fileSearchTool: ToolDefinition;
|
|
11
|
+
export declare const fileGrepTool: ToolDefinition;
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { FileSandbox, SandboxSecurityError } from '../../security/fileSandbox.js';
|
|
2
|
+
function getSandbox(context) {
|
|
3
|
+
return new FileSandbox(context.config.fileSandbox);
|
|
4
|
+
}
|
|
5
|
+
function handleSandboxError(err) {
|
|
6
|
+
if (err instanceof SandboxSecurityError) {
|
|
7
|
+
return {
|
|
8
|
+
error: `Security Guardrail: ${err.message}`,
|
|
9
|
+
code: err.code,
|
|
10
|
+
details: err.details,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
error: err.message || 'File operation failed.',
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export const fileReadTool = {
|
|
18
|
+
name: 'file_read',
|
|
19
|
+
description: 'Read text or base64 contents of a file located within the user-permitted workspace/sandbox. Supports optional line range pagination (startLine, endLine) for reading specific sections.',
|
|
20
|
+
parameters: {
|
|
21
|
+
type: 'object',
|
|
22
|
+
properties: {
|
|
23
|
+
path: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
description: 'The path of the file to read (relative to sandbox root or absolute within allowed roots).',
|
|
26
|
+
},
|
|
27
|
+
encoding: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
enum: ['utf-8', 'base64'],
|
|
30
|
+
description: 'Encoding to read the file in. Defaults to utf-8.',
|
|
31
|
+
},
|
|
32
|
+
startLine: {
|
|
33
|
+
type: 'number',
|
|
34
|
+
description: 'Optional 1-indexed line number to begin reading from.',
|
|
35
|
+
},
|
|
36
|
+
endLine: {
|
|
37
|
+
type: 'number',
|
|
38
|
+
description: 'Optional 1-indexed line number to end reading at (inclusive).',
|
|
39
|
+
},
|
|
40
|
+
maxBytes: {
|
|
41
|
+
type: 'number',
|
|
42
|
+
description: 'Optional maximum bytes to read.',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
required: ['path'],
|
|
46
|
+
},
|
|
47
|
+
execute: async (args, context) => {
|
|
48
|
+
try {
|
|
49
|
+
const sandbox = getSandbox(context);
|
|
50
|
+
return sandbox.readFile(args.path, {
|
|
51
|
+
encoding: args.encoding,
|
|
52
|
+
startLine: args.startLine,
|
|
53
|
+
endLine: args.endLine,
|
|
54
|
+
maxBytes: args.maxBytes,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
return handleSandboxError(err);
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
export const fileWriteTool = {
|
|
63
|
+
name: 'file_write',
|
|
64
|
+
description: 'Write or overwrite a file with given text content within the allowed sandbox. Parent directories are created automatically if they do not exist.',
|
|
65
|
+
parameters: {
|
|
66
|
+
type: 'object',
|
|
67
|
+
properties: {
|
|
68
|
+
path: {
|
|
69
|
+
type: 'string',
|
|
70
|
+
description: 'The path of the file to write to.',
|
|
71
|
+
},
|
|
72
|
+
content: {
|
|
73
|
+
type: 'string',
|
|
74
|
+
description: 'The file content to write.',
|
|
75
|
+
},
|
|
76
|
+
encoding: {
|
|
77
|
+
type: 'string',
|
|
78
|
+
enum: ['utf-8', 'base64'],
|
|
79
|
+
description: 'Content encoding (defaults to utf-8).',
|
|
80
|
+
},
|
|
81
|
+
overwrite: {
|
|
82
|
+
type: 'boolean',
|
|
83
|
+
description: 'Whether to overwrite an existing file. Defaults to true.',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
required: ['path', 'content'],
|
|
87
|
+
},
|
|
88
|
+
execute: async (args, context) => {
|
|
89
|
+
try {
|
|
90
|
+
const sandbox = getSandbox(context);
|
|
91
|
+
return sandbox.writeFile(args.path, args.content, {
|
|
92
|
+
encoding: args.encoding,
|
|
93
|
+
overwrite: args.overwrite !== undefined ? args.overwrite : true,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
catch (err) {
|
|
97
|
+
return handleSandboxError(err);
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
export const fileEditTool = {
|
|
102
|
+
name: 'file_edit',
|
|
103
|
+
description: 'Replace a specific target text block or snippet inside an existing file within the allowed sandbox. Fails safely if the target snippet is ambiguous or not found.',
|
|
104
|
+
parameters: {
|
|
105
|
+
type: 'object',
|
|
106
|
+
properties: {
|
|
107
|
+
path: {
|
|
108
|
+
type: 'string',
|
|
109
|
+
description: 'Path of the file to edit.',
|
|
110
|
+
},
|
|
111
|
+
target: {
|
|
112
|
+
type: 'string',
|
|
113
|
+
description: 'The exact string or code chunk to replace.',
|
|
114
|
+
},
|
|
115
|
+
replacement: {
|
|
116
|
+
type: 'string',
|
|
117
|
+
description: 'The replacement string or code chunk.',
|
|
118
|
+
},
|
|
119
|
+
allowMultiple: {
|
|
120
|
+
type: 'boolean',
|
|
121
|
+
description: 'If true, replaces all occurrences. If false, fails if target appears multiple times.',
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
required: ['path', 'target', 'replacement'],
|
|
125
|
+
},
|
|
126
|
+
execute: async (args, context) => {
|
|
127
|
+
try {
|
|
128
|
+
const sandbox = getSandbox(context);
|
|
129
|
+
return sandbox.editFile(args.path, args.target, args.replacement, args.allowMultiple);
|
|
130
|
+
}
|
|
131
|
+
catch (err) {
|
|
132
|
+
return handleSandboxError(err);
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
export const fileAppendTool = {
|
|
137
|
+
name: 'file_append',
|
|
138
|
+
description: 'Append text to the end of a file within the allowed sandbox.',
|
|
139
|
+
parameters: {
|
|
140
|
+
type: 'object',
|
|
141
|
+
properties: {
|
|
142
|
+
path: {
|
|
143
|
+
type: 'string',
|
|
144
|
+
description: 'Path of the file to append to.',
|
|
145
|
+
},
|
|
146
|
+
content: {
|
|
147
|
+
type: 'string',
|
|
148
|
+
description: 'The text content to append.',
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
required: ['path', 'content'],
|
|
152
|
+
},
|
|
153
|
+
execute: async (args, context) => {
|
|
154
|
+
try {
|
|
155
|
+
const sandbox = getSandbox(context);
|
|
156
|
+
return sandbox.appendFile(args.path, args.content);
|
|
157
|
+
}
|
|
158
|
+
catch (err) {
|
|
159
|
+
return handleSandboxError(err);
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
export const fileListTool = {
|
|
164
|
+
name: 'file_list',
|
|
165
|
+
description: 'List files and subdirectories in a directory within the allowed sandbox. Sensitive and blocked files (e.g. .env, credentials) are filtered out automatically.',
|
|
166
|
+
parameters: {
|
|
167
|
+
type: 'object',
|
|
168
|
+
properties: {
|
|
169
|
+
path: {
|
|
170
|
+
type: 'string',
|
|
171
|
+
description: 'Path of the directory to list (defaults to "." for sandbox root).',
|
|
172
|
+
},
|
|
173
|
+
recursive: {
|
|
174
|
+
type: 'boolean',
|
|
175
|
+
description: 'Whether to list subdirectories recursively. Defaults to false.',
|
|
176
|
+
},
|
|
177
|
+
maxDepth: {
|
|
178
|
+
type: 'number',
|
|
179
|
+
description: 'Maximum depth when listing recursively. Defaults to 2.',
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
execute: async (args, context) => {
|
|
184
|
+
try {
|
|
185
|
+
const sandbox = getSandbox(context);
|
|
186
|
+
return sandbox.listFiles(args.path || '.', {
|
|
187
|
+
recursive: args.recursive,
|
|
188
|
+
maxDepth: args.maxDepth,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
catch (err) {
|
|
192
|
+
return handleSandboxError(err);
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
export const fileDeleteTool = {
|
|
197
|
+
name: 'file_delete',
|
|
198
|
+
description: 'Delete a file or directory within the permitted sandbox. Deleting the root sandbox directory is prohibited by security policy. Requires explicit confirm: true parameter.',
|
|
199
|
+
parameters: {
|
|
200
|
+
type: 'object',
|
|
201
|
+
properties: {
|
|
202
|
+
path: {
|
|
203
|
+
type: 'string',
|
|
204
|
+
description: 'Path of the file or directory to delete.',
|
|
205
|
+
},
|
|
206
|
+
recursive: {
|
|
207
|
+
type: 'boolean',
|
|
208
|
+
description: 'Set to true to delete non-empty directories.',
|
|
209
|
+
},
|
|
210
|
+
confirm: {
|
|
211
|
+
type: 'boolean',
|
|
212
|
+
description: 'Explicit safety confirmation required for irreversible file or directory deletion. Must be true to proceed.',
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
required: ['path'],
|
|
216
|
+
},
|
|
217
|
+
execute: async (args, context) => {
|
|
218
|
+
try {
|
|
219
|
+
const requireConfirmation = context.config.fileSandbox.requireDeleteConfirmation ?? true;
|
|
220
|
+
if (requireConfirmation && args.confirm !== true) {
|
|
221
|
+
return {
|
|
222
|
+
warning: `Destructive action warning: Deleting "${args.path}" is permanent and cannot be undone. To proceed, execute file_delete with confirm: true.`,
|
|
223
|
+
path: args.path,
|
|
224
|
+
recursive: Boolean(args.recursive),
|
|
225
|
+
requiresConfirmation: true,
|
|
226
|
+
deleted: false,
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
const sandbox = getSandbox(context);
|
|
230
|
+
return sandbox.deletePath(args.path, args.recursive);
|
|
231
|
+
}
|
|
232
|
+
catch (err) {
|
|
233
|
+
return handleSandboxError(err);
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
};
|
|
237
|
+
export const fileInfoTool = {
|
|
238
|
+
name: 'file_info',
|
|
239
|
+
description: 'Check metadata and stats for a file or directory (existence, size, timestamps, type, read-only flag) within the allowed sandbox.',
|
|
240
|
+
parameters: {
|
|
241
|
+
type: 'object',
|
|
242
|
+
properties: {
|
|
243
|
+
path: {
|
|
244
|
+
type: 'string',
|
|
245
|
+
description: 'Path of the file or directory.',
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
required: ['path'],
|
|
249
|
+
},
|
|
250
|
+
execute: async (args, context) => {
|
|
251
|
+
try {
|
|
252
|
+
const sandbox = getSandbox(context);
|
|
253
|
+
return sandbox.getFileInfo(args.path);
|
|
254
|
+
}
|
|
255
|
+
catch (err) {
|
|
256
|
+
return handleSandboxError(err);
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
};
|
|
260
|
+
export const directoryCreateTool = {
|
|
261
|
+
name: 'directory_create',
|
|
262
|
+
description: 'Create a new directory within the allowed sandbox.',
|
|
263
|
+
parameters: {
|
|
264
|
+
type: 'object',
|
|
265
|
+
properties: {
|
|
266
|
+
path: {
|
|
267
|
+
type: 'string',
|
|
268
|
+
description: 'Path of the directory to create.',
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
required: ['path'],
|
|
272
|
+
},
|
|
273
|
+
execute: async (args, context) => {
|
|
274
|
+
try {
|
|
275
|
+
const sandbox = getSandbox(context);
|
|
276
|
+
return sandbox.createDirectory(args.path);
|
|
277
|
+
}
|
|
278
|
+
catch (err) {
|
|
279
|
+
return handleSandboxError(err);
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
};
|
|
283
|
+
export const fileSearchTool = {
|
|
284
|
+
name: 'file_search',
|
|
285
|
+
description: 'Search for files by glob pattern or name within the allowed sandbox.',
|
|
286
|
+
parameters: {
|
|
287
|
+
type: 'object',
|
|
288
|
+
properties: {
|
|
289
|
+
pattern: {
|
|
290
|
+
type: 'string',
|
|
291
|
+
description: 'Glob pattern or filename substring to match (e.g. "*.json", "test").',
|
|
292
|
+
},
|
|
293
|
+
path: {
|
|
294
|
+
type: 'string',
|
|
295
|
+
description: 'Directory to search within (defaults to "." for sandbox root).',
|
|
296
|
+
},
|
|
297
|
+
maxResults: {
|
|
298
|
+
type: 'number',
|
|
299
|
+
description: 'Maximum number of results to return (defaults to 50).',
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
required: ['pattern'],
|
|
303
|
+
},
|
|
304
|
+
execute: async (args, context) => {
|
|
305
|
+
try {
|
|
306
|
+
const sandbox = getSandbox(context);
|
|
307
|
+
return sandbox.searchFiles(args.pattern, args.path || '.', args.maxResults);
|
|
308
|
+
}
|
|
309
|
+
catch (err) {
|
|
310
|
+
return handleSandboxError(err);
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
};
|
|
314
|
+
export const fileGrepTool = {
|
|
315
|
+
name: 'file_grep',
|
|
316
|
+
description: 'Search for text content across files inside the permitted sandbox.',
|
|
317
|
+
parameters: {
|
|
318
|
+
type: 'object',
|
|
319
|
+
properties: {
|
|
320
|
+
query: {
|
|
321
|
+
type: 'string',
|
|
322
|
+
description: 'The text snippet to look for inside files.',
|
|
323
|
+
},
|
|
324
|
+
path: {
|
|
325
|
+
type: 'string',
|
|
326
|
+
description: 'Directory or file to search within (defaults to ".").',
|
|
327
|
+
},
|
|
328
|
+
caseInsensitive: {
|
|
329
|
+
type: 'boolean',
|
|
330
|
+
description: 'Whether search is case-insensitive (defaults to true).',
|
|
331
|
+
},
|
|
332
|
+
maxResults: {
|
|
333
|
+
type: 'number',
|
|
334
|
+
description: 'Maximum matches to return (defaults to 50).',
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
required: ['query'],
|
|
338
|
+
},
|
|
339
|
+
execute: async (args, context) => {
|
|
340
|
+
try {
|
|
341
|
+
const sandbox = getSandbox(context);
|
|
342
|
+
return sandbox.grepFiles(args.query, args.path || '.', {
|
|
343
|
+
caseInsensitive: args.caseInsensitive,
|
|
344
|
+
maxResults: args.maxResults,
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
catch (err) {
|
|
348
|
+
return handleSandboxError(err);
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
};
|
|
352
|
+
//# sourceMappingURL=fileTools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileTools.js","sourceRoot":"","sources":["../../../src/tools/builtin/fileTools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAElF,SAAS,UAAU,CAAC,OAAoB;IACtC,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AACrD,CAAC;AAED,SAAS,kBAAkB,CAAC,GAAQ;IAClC,IAAI,GAAG,YAAY,oBAAoB,EAAE,CAAC;QACxC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