@bestdefense/bd-agent 0.1.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.
Files changed (42) hide show
  1. package/README.md +95 -0
  2. package/dist/cli.d.ts +3 -0
  3. package/dist/cli.d.ts.map +1 -0
  4. package/dist/cli.js +75 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/commands/chat.d.ts +4 -0
  7. package/dist/commands/chat.d.ts.map +1 -0
  8. package/dist/commands/chat.js +101 -0
  9. package/dist/commands/chat.js.map +1 -0
  10. package/dist/services/bedrock-client.d.ts +22 -0
  11. package/dist/services/bedrock-client.d.ts.map +1 -0
  12. package/dist/services/bedrock-client.js +65 -0
  13. package/dist/services/bedrock-client.js.map +1 -0
  14. package/dist/services/conversation-manager.d.ts +13 -0
  15. package/dist/services/conversation-manager.d.ts.map +1 -0
  16. package/dist/services/conversation-manager.js +41 -0
  17. package/dist/services/conversation-manager.js.map +1 -0
  18. package/dist/services/tool-executor.d.ts +11 -0
  19. package/dist/services/tool-executor.d.ts.map +1 -0
  20. package/dist/services/tool-executor.js +49 -0
  21. package/dist/services/tool-executor.js.map +1 -0
  22. package/dist/tools/file-system.d.ts +127 -0
  23. package/dist/tools/file-system.d.ts.map +1 -0
  24. package/dist/tools/file-system.js +173 -0
  25. package/dist/tools/file-system.js.map +1 -0
  26. package/dist/tools/git.d.ts +163 -0
  27. package/dist/tools/git.d.ts.map +1 -0
  28. package/dist/tools/git.js +169 -0
  29. package/dist/tools/git.js.map +1 -0
  30. package/dist/tools/shell.d.ts +40 -0
  31. package/dist/tools/shell.d.ts.map +1 -0
  32. package/dist/tools/shell.js +55 -0
  33. package/dist/tools/shell.js.map +1 -0
  34. package/dist/utils/config.d.ts +11 -0
  35. package/dist/utils/config.d.ts.map +1 -0
  36. package/dist/utils/config.js +75 -0
  37. package/dist/utils/config.js.map +1 -0
  38. package/dist/utils/prompts.d.ts +2 -0
  39. package/dist/utils/prompts.d.ts.map +1 -0
  40. package/dist/utils/prompts.js +34 -0
  41. package/dist/utils/prompts.js.map +1 -0
  42. package/package.json +52 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-system.d.ts","sourceRoot":"","sources":["../../src/tools/file-system.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;kCAcY;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CA2BP;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4DAqChB;QAC5D,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAA;KACpB;;;;;;;;;;;;;;;;;;;;;;;;;iCA+BkC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;;IAwBtD,CAAC"}
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.fileSystemTools = void 0;
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ const util_1 = require("util");
40
+ const readFile = (0, util_1.promisify)(fs.readFile);
41
+ const writeFile = (0, util_1.promisify)(fs.writeFile);
42
+ const readdir = (0, util_1.promisify)(fs.readdir);
43
+ const stat = (0, util_1.promisify)(fs.stat);
44
+ exports.fileSystemTools = [
45
+ {
46
+ name: 'read_file',
47
+ description: 'Read the contents of a file',
48
+ input_schema: {
49
+ type: 'object',
50
+ properties: {
51
+ path: {
52
+ type: 'string',
53
+ description: 'The file path to read'
54
+ }
55
+ },
56
+ required: ['path']
57
+ },
58
+ execute: async ({ path: filePath }) => {
59
+ try {
60
+ const absolutePath = path.resolve(filePath);
61
+ const content = await readFile(absolutePath, 'utf-8');
62
+ return { success: true, content };
63
+ }
64
+ catch (error) {
65
+ return { success: false, error: error.message };
66
+ }
67
+ }
68
+ },
69
+ {
70
+ name: 'write_file',
71
+ description: 'Write content to a file',
72
+ input_schema: {
73
+ type: 'object',
74
+ properties: {
75
+ path: {
76
+ type: 'string',
77
+ description: 'The file path to write'
78
+ },
79
+ content: {
80
+ type: 'string',
81
+ description: 'The content to write'
82
+ }
83
+ },
84
+ required: ['path', 'content']
85
+ },
86
+ execute: async ({ path: filePath, content }) => {
87
+ try {
88
+ const absolutePath = path.resolve(filePath);
89
+ const dir = path.dirname(absolutePath);
90
+ if (!fs.existsSync(dir)) {
91
+ fs.mkdirSync(dir, { recursive: true });
92
+ }
93
+ await writeFile(absolutePath, content, 'utf-8');
94
+ return { success: true, message: `File written to ${absolutePath}` };
95
+ }
96
+ catch (error) {
97
+ return { success: false, error: error.message };
98
+ }
99
+ }
100
+ },
101
+ {
102
+ name: 'edit_file',
103
+ description: 'Edit a file by replacing content',
104
+ input_schema: {
105
+ type: 'object',
106
+ properties: {
107
+ path: {
108
+ type: 'string',
109
+ description: 'The file path to edit'
110
+ },
111
+ old_content: {
112
+ type: 'string',
113
+ description: 'The content to replace'
114
+ },
115
+ new_content: {
116
+ type: 'string',
117
+ description: 'The new content'
118
+ }
119
+ },
120
+ required: ['path', 'old_content', 'new_content']
121
+ },
122
+ execute: async ({ path: filePath, old_content, new_content }) => {
123
+ try {
124
+ const absolutePath = path.resolve(filePath);
125
+ const content = await readFile(absolutePath, 'utf-8');
126
+ if (!content.includes(old_content)) {
127
+ return { success: false, error: 'Old content not found in file' };
128
+ }
129
+ const updatedContent = content.replace(old_content, new_content);
130
+ await writeFile(absolutePath, updatedContent, 'utf-8');
131
+ return { success: true, message: 'File edited successfully' };
132
+ }
133
+ catch (error) {
134
+ return { success: false, error: error.message };
135
+ }
136
+ }
137
+ },
138
+ {
139
+ name: 'list_directory',
140
+ description: 'List files and directories in a path',
141
+ input_schema: {
142
+ type: 'object',
143
+ properties: {
144
+ path: {
145
+ type: 'string',
146
+ description: 'The directory path to list'
147
+ }
148
+ },
149
+ required: ['path']
150
+ },
151
+ execute: async ({ path: dirPath }) => {
152
+ try {
153
+ const absolutePath = path.resolve(dirPath || '.');
154
+ const items = await readdir(absolutePath);
155
+ const details = await Promise.all(items.map(async (item) => {
156
+ const itemPath = path.join(absolutePath, item);
157
+ const stats = await stat(itemPath);
158
+ return {
159
+ name: item,
160
+ type: stats.isDirectory() ? 'directory' : 'file',
161
+ size: stats.size,
162
+ modified: stats.mtime
163
+ };
164
+ }));
165
+ return { success: true, items: details };
166
+ }
167
+ catch (error) {
168
+ return { success: false, error: error.message };
169
+ }
170
+ }
171
+ }
172
+ ];
173
+ //# sourceMappingURL=file-system.js.map
@@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,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAoB,EAAE,EAAE;YACrD,IAAI,CAAC;gBACH,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,GAAG,CAAC,CAAC;gBAClD,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC;gBAE1C,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;oBACvB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;oBAC/C,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC;oBACnC,OAAO;wBACL,IAAI,EAAE,IAAI;wBACV,IAAI,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM;wBAChD,IAAI,EAAE,KAAK,CAAC,IAAI;wBAChB,QAAQ,EAAE,KAAK,CAAC,KAAK;qBACtB,CAAC;gBACJ,CAAC,CAAC,CACH,CAAC;gBAEF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;YAC3C,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;YAClD,CAAC;QACH,CAAC;KACF;CACF,CAAC"}
@@ -0,0 +1,163 @@
1
+ export declare const gitTools: ({
2
+ name: string;
3
+ description: string;
4
+ input_schema: {
5
+ type: string;
6
+ properties: {
7
+ path: {
8
+ type: string;
9
+ description: string;
10
+ };
11
+ staged?: undefined;
12
+ files?: undefined;
13
+ message?: undefined;
14
+ limit?: undefined;
15
+ };
16
+ required?: undefined;
17
+ };
18
+ execute: ({ path }: {
19
+ path?: string;
20
+ }) => Promise<{
21
+ success: boolean;
22
+ changes: string | string[];
23
+ count: number;
24
+ error?: undefined;
25
+ } | {
26
+ success: boolean;
27
+ error: any;
28
+ changes?: undefined;
29
+ count?: undefined;
30
+ }>;
31
+ } | {
32
+ name: string;
33
+ description: string;
34
+ input_schema: {
35
+ type: string;
36
+ properties: {
37
+ staged: {
38
+ type: string;
39
+ description: string;
40
+ };
41
+ path: {
42
+ type: string;
43
+ description: string;
44
+ };
45
+ files?: undefined;
46
+ message?: undefined;
47
+ limit?: undefined;
48
+ };
49
+ required?: undefined;
50
+ };
51
+ execute: ({ staged, path }: {
52
+ staged?: boolean;
53
+ path?: string;
54
+ }) => Promise<{
55
+ success: boolean;
56
+ diff: string;
57
+ error?: undefined;
58
+ } | {
59
+ success: boolean;
60
+ error: any;
61
+ diff?: undefined;
62
+ }>;
63
+ } | {
64
+ name: string;
65
+ description: string;
66
+ input_schema: {
67
+ type: string;
68
+ properties: {
69
+ files: {
70
+ type: string;
71
+ items: {
72
+ type: string;
73
+ };
74
+ description: string;
75
+ };
76
+ path: {
77
+ type: string;
78
+ description: string;
79
+ };
80
+ staged?: undefined;
81
+ message?: undefined;
82
+ limit?: undefined;
83
+ };
84
+ required: string[];
85
+ };
86
+ execute: ({ files, path }: {
87
+ files: string[];
88
+ path?: string;
89
+ }) => Promise<{
90
+ success: boolean;
91
+ message: string;
92
+ error?: undefined;
93
+ } | {
94
+ success: boolean;
95
+ error: any;
96
+ message?: undefined;
97
+ }>;
98
+ } | {
99
+ name: string;
100
+ description: string;
101
+ input_schema: {
102
+ type: string;
103
+ properties: {
104
+ message: {
105
+ type: string;
106
+ description: string;
107
+ };
108
+ path: {
109
+ type: string;
110
+ description: string;
111
+ };
112
+ staged?: undefined;
113
+ files?: undefined;
114
+ limit?: undefined;
115
+ };
116
+ required: string[];
117
+ };
118
+ execute: ({ message, path }: {
119
+ message: string;
120
+ path?: string;
121
+ }) => Promise<{
122
+ success: boolean;
123
+ output: string;
124
+ error?: undefined;
125
+ } | {
126
+ success: boolean;
127
+ error: any;
128
+ output?: undefined;
129
+ }>;
130
+ } | {
131
+ name: string;
132
+ description: string;
133
+ input_schema: {
134
+ type: string;
135
+ properties: {
136
+ limit: {
137
+ type: string;
138
+ description: string;
139
+ };
140
+ path: {
141
+ type: string;
142
+ description: string;
143
+ };
144
+ staged?: undefined;
145
+ files?: undefined;
146
+ message?: undefined;
147
+ };
148
+ required?: undefined;
149
+ };
150
+ execute: ({ limit, path }: {
151
+ limit?: number;
152
+ path?: string;
153
+ }) => Promise<{
154
+ success: boolean;
155
+ commits: string[];
156
+ error?: undefined;
157
+ } | {
158
+ success: boolean;
159
+ error: any;
160
+ commits?: undefined;
161
+ }>;
162
+ })[];
163
+ //# sourceMappingURL=git.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/tools/git.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;wBAaS;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAoCT;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BAqCpC;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAiChC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BAkC/B;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;;;;;IAmB1E,CAAC"}
@@ -0,0 +1,169 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.gitTools = void 0;
4
+ const child_process_1 = require("child_process");
5
+ const util_1 = require("util");
6
+ const execAsync = (0, util_1.promisify)(child_process_1.exec);
7
+ exports.gitTools = [
8
+ {
9
+ name: 'git_status',
10
+ description: 'Get the current git status',
11
+ input_schema: {
12
+ type: 'object',
13
+ properties: {
14
+ path: {
15
+ type: 'string',
16
+ description: 'The repository path (optional, defaults to current directory)'
17
+ }
18
+ }
19
+ },
20
+ execute: async ({ path }) => {
21
+ try {
22
+ const cwd = path || process.cwd();
23
+ const { stdout, stderr } = await execAsync('git status --porcelain', { cwd });
24
+ if (stderr) {
25
+ return { success: false, error: stderr };
26
+ }
27
+ const changes = stdout.split('\n').filter(line => line.trim());
28
+ return {
29
+ success: true,
30
+ changes: changes.length > 0 ? changes : 'No changes detected',
31
+ count: changes.length
32
+ };
33
+ }
34
+ catch (error) {
35
+ return { success: false, error: error.message };
36
+ }
37
+ }
38
+ },
39
+ {
40
+ name: 'git_diff',
41
+ description: 'Show git diff for staged or unstaged changes',
42
+ input_schema: {
43
+ type: 'object',
44
+ properties: {
45
+ staged: {
46
+ type: 'boolean',
47
+ description: 'Show staged changes (default: false)'
48
+ },
49
+ path: {
50
+ type: 'string',
51
+ description: 'The repository path (optional)'
52
+ }
53
+ }
54
+ },
55
+ execute: async ({ staged, path }) => {
56
+ try {
57
+ const cwd = path || process.cwd();
58
+ const command = staged ? 'git diff --cached' : 'git diff';
59
+ const { stdout, stderr } = await execAsync(command, { cwd });
60
+ if (stderr) {
61
+ return { success: false, error: stderr };
62
+ }
63
+ return {
64
+ success: true,
65
+ diff: stdout || 'No differences found'
66
+ };
67
+ }
68
+ catch (error) {
69
+ return { success: false, error: error.message };
70
+ }
71
+ }
72
+ },
73
+ {
74
+ name: 'git_add',
75
+ description: 'Stage files for commit',
76
+ input_schema: {
77
+ type: 'object',
78
+ properties: {
79
+ files: {
80
+ type: 'array',
81
+ items: { type: 'string' },
82
+ description: 'Files to stage (use ["."] for all files)'
83
+ },
84
+ path: {
85
+ type: 'string',
86
+ description: 'The repository path (optional)'
87
+ }
88
+ },
89
+ required: ['files']
90
+ },
91
+ execute: async ({ files, path }) => {
92
+ try {
93
+ const cwd = path || process.cwd();
94
+ const filesStr = files.join(' ');
95
+ const { stdout, stderr } = await execAsync(`git add ${filesStr}`, { cwd });
96
+ if (stderr) {
97
+ return { success: false, error: stderr };
98
+ }
99
+ return { success: true, message: `Files staged: ${filesStr}` };
100
+ }
101
+ catch (error) {
102
+ return { success: false, error: error.message };
103
+ }
104
+ }
105
+ },
106
+ {
107
+ name: 'git_commit',
108
+ description: 'Create a git commit',
109
+ input_schema: {
110
+ type: 'object',
111
+ properties: {
112
+ message: {
113
+ type: 'string',
114
+ description: 'Commit message'
115
+ },
116
+ path: {
117
+ type: 'string',
118
+ description: 'The repository path (optional)'
119
+ }
120
+ },
121
+ required: ['message']
122
+ },
123
+ execute: async ({ message, path }) => {
124
+ try {
125
+ const cwd = path || process.cwd();
126
+ const { stdout, stderr } = await execAsync(`git commit -m "${message}"`, { cwd });
127
+ if (stderr && !stderr.includes('files changed')) {
128
+ return { success: false, error: stderr };
129
+ }
130
+ return { success: true, output: stdout };
131
+ }
132
+ catch (error) {
133
+ return { success: false, error: error.message };
134
+ }
135
+ }
136
+ },
137
+ {
138
+ name: 'git_log',
139
+ description: 'Show recent git commits',
140
+ input_schema: {
141
+ type: 'object',
142
+ properties: {
143
+ limit: {
144
+ type: 'number',
145
+ description: 'Number of commits to show (default: 10)'
146
+ },
147
+ path: {
148
+ type: 'string',
149
+ description: 'The repository path (optional)'
150
+ }
151
+ }
152
+ },
153
+ execute: async ({ limit = 10, path }) => {
154
+ try {
155
+ const cwd = path || process.cwd();
156
+ const { stdout, stderr } = await execAsync(`git log --oneline -n ${limit}`, { cwd });
157
+ if (stderr) {
158
+ return { success: false, error: stderr };
159
+ }
160
+ const commits = stdout.split('\n').filter(line => line.trim());
161
+ return { success: true, commits };
162
+ }
163
+ catch (error) {
164
+ return { success: false, error: error.message };
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AC/B,EAAE,GAAG,EAAE,CACR,CAAC;gBAEF,IAAI,MAAM,EAAE,CAAC;oBACX,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;gBAC3C,CAAC;gBAED,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;gBAC/D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;YACpC,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;YAClD,CAAC;QACH,CAAC;KACF;CACF,CAAC"}
@@ -0,0 +1,40 @@
1
+ export declare const shellTools: {
2
+ name: string;
3
+ description: string;
4
+ input_schema: {
5
+ type: string;
6
+ properties: {
7
+ command: {
8
+ type: string;
9
+ description: string;
10
+ };
11
+ cwd: {
12
+ type: string;
13
+ description: string;
14
+ };
15
+ timeout: {
16
+ type: string;
17
+ description: string;
18
+ };
19
+ };
20
+ required: string[];
21
+ };
22
+ execute: ({ command, cwd, timeout }: {
23
+ command: string;
24
+ cwd?: string;
25
+ timeout?: number;
26
+ }) => Promise<{
27
+ success: boolean;
28
+ stdout: string;
29
+ stderr: string;
30
+ command: string;
31
+ error?: undefined;
32
+ } | {
33
+ success: boolean;
34
+ error: any;
35
+ stdout: any;
36
+ stderr: any;
37
+ command: string;
38
+ }>;
39
+ }[];
40
+ //# sourceMappingURL=shell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/tools/shell.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;yCAsBgC;QACjD,OAAO,EAAE,MAAM,CAAC;QAChB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;;;;;;;;;;;;;GA0BJ,CAAC"}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shellTools = void 0;
4
+ const child_process_1 = require("child_process");
5
+ const util_1 = require("util");
6
+ const execAsync = (0, util_1.promisify)(child_process_1.exec);
7
+ exports.shellTools = [
8
+ {
9
+ name: 'run_command',
10
+ description: 'Execute a shell command',
11
+ input_schema: {
12
+ type: 'object',
13
+ properties: {
14
+ command: {
15
+ type: 'string',
16
+ description: 'The command to execute'
17
+ },
18
+ cwd: {
19
+ type: 'string',
20
+ description: 'Working directory for the command (optional)'
21
+ },
22
+ timeout: {
23
+ type: 'number',
24
+ description: 'Command timeout in milliseconds (default: 30000)'
25
+ }
26
+ },
27
+ required: ['command']
28
+ },
29
+ execute: async ({ command, cwd, timeout = 30000 }) => {
30
+ try {
31
+ const options = {
32
+ cwd: cwd || process.cwd(),
33
+ timeout
34
+ };
35
+ const { stdout, stderr } = await execAsync(command, options);
36
+ return {
37
+ success: true,
38
+ stdout: stdout || '',
39
+ stderr: stderr || '',
40
+ command
41
+ };
42
+ }
43
+ catch (error) {
44
+ return {
45
+ success: false,
46
+ error: error.message,
47
+ stdout: error.stdout || '',
48
+ stderr: error.stderr || '',
49
+ command
50
+ };
51
+ }
52
+ }
53
+ }
54
+ ];
55
+ //# sourceMappingURL=shell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/tools/shell.ts"],"names":[],"mappings":";;;AAAA,iDAAqC;AACrC,+BAAiC;AAEjC,MAAM,SAAS,GAAG,IAAA,gBAAS,EAAC,oBAAI,CAAC,CAAC;AAErB,QAAA,UAAU,GAAG;IACxB;QACE,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE,yBAAyB;QACtC,YAAY,EAAE;YACZ,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,wBAAwB;iBACtC;gBACD,GAAG,EAAE;oBACH,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,8CAA8C;iBAC5D;gBACD,OAAO,EAAE;oBACP,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,kDAAkD;iBAChE;aACF;YACD,QAAQ,EAAE,CAAC,SAAS,CAAC;SACtB;QACD,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,GAAG,KAAK,EAI9C,EAAE,EAAE;YACH,IAAI,CAAC;gBACH,MAAM,OAAO,GAAG;oBACd,GAAG,EAAE,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE;oBACzB,OAAO;iBACR,CAAC;gBAEF,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;gBAE7D,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,MAAM,EAAE,MAAM,IAAI,EAAE;oBACpB,MAAM,EAAE,MAAM,IAAI,EAAE;oBACpB,OAAO;iBACR,CAAC;YACJ,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,KAAK,CAAC,OAAO;oBACpB,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,EAAE;oBAC1B,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,EAAE;oBAC1B,OAAO;iBACR,CAAC;YACJ,CAAC;QACH,CAAC;KACF;CACF,CAAC"}
@@ -0,0 +1,11 @@
1
+ export declare const config: {
2
+ AWS_ACCESS_KEY_ID: string | undefined;
3
+ AWS_SECRET_ACCESS_KEY: string | undefined;
4
+ AWS_SESSION_TOKEN: string | undefined;
5
+ AWS_REGION: string;
6
+ BEDROCK_MODEL_ID: string;
7
+ AWS_BEARER_TOKEN_BEDROCK: string | undefined;
8
+ };
9
+ export declare function validateConfig(): boolean;
10
+ export declare function saveConfig(updates: Partial<typeof config>): void;
11
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,MAAM;;;;;;;CAOlB,CAAC;AAEF,wBAAgB,cAAc,IAAI,OAAO,CAMxC;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,MAAM,CAAC,GAAG,IAAI,CAYhE"}