@framers/agentos-ext-cli-executor 1.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.
- package/README.md +221 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +110 -0
- package/dist/index.js.map +1 -0
- package/dist/services/shellService.d.ts +47 -0
- package/dist/services/shellService.d.ts.map +1 -0
- package/dist/services/shellService.js +362 -0
- package/dist/services/shellService.js.map +1 -0
- package/dist/tools/execute.d.ts +44 -0
- package/dist/tools/execute.d.ts.map +1 -0
- package/dist/tools/execute.js +94 -0
- package/dist/tools/execute.js.map +1 -0
- package/dist/tools/fileRead.d.ts +45 -0
- package/dist/tools/fileRead.d.ts.map +1 -0
- package/dist/tools/fileRead.js +82 -0
- package/dist/tools/fileRead.js.map +1 -0
- package/dist/tools/fileWrite.d.ts +45 -0
- package/dist/tools/fileWrite.d.ts.map +1 -0
- package/dist/tools/fileWrite.js +85 -0
- package/dist/tools/fileWrite.js.map +1 -0
- package/dist/tools/listDir.d.ts +46 -0
- package/dist/tools/listDir.d.ts.map +1 -0
- package/dist/tools/listDir.js +89 -0
- package/dist/tools/listDir.js.map +1 -0
- package/dist/types.d.ts +183 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/manifest.json +91 -0
- package/package.json +59 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File Write Tool
|
|
3
|
+
* Write content to files.
|
|
4
|
+
*
|
|
5
|
+
* @module @framers/agentos-ext-cli-executor
|
|
6
|
+
*/
|
|
7
|
+
import type { ITool } from '@framers/agentos';
|
|
8
|
+
import type { ShellService } from '../services/shellService';
|
|
9
|
+
import type { FileWriteResult } from '../types';
|
|
10
|
+
/**
|
|
11
|
+
* Tool for writing files
|
|
12
|
+
*/
|
|
13
|
+
export declare class FileWriteTool implements ITool {
|
|
14
|
+
private shellService;
|
|
15
|
+
readonly id = "fileWrite";
|
|
16
|
+
readonly name = "Write File";
|
|
17
|
+
readonly description = "Write content to a file";
|
|
18
|
+
constructor(shellService: ShellService);
|
|
19
|
+
/**
|
|
20
|
+
* Write file
|
|
21
|
+
*/
|
|
22
|
+
execute(input: {
|
|
23
|
+
path: string;
|
|
24
|
+
content: string;
|
|
25
|
+
encoding?: BufferEncoding;
|
|
26
|
+
append?: boolean;
|
|
27
|
+
createDirs?: boolean;
|
|
28
|
+
}): Promise<{
|
|
29
|
+
success: boolean;
|
|
30
|
+
output?: FileWriteResult;
|
|
31
|
+
error?: string;
|
|
32
|
+
}>;
|
|
33
|
+
/**
|
|
34
|
+
* Validate input
|
|
35
|
+
*/
|
|
36
|
+
validate(input: any): {
|
|
37
|
+
valid: boolean;
|
|
38
|
+
errors: string[];
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Get JSON schema for tool
|
|
42
|
+
*/
|
|
43
|
+
getSchema(): any;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=fileWrite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileWrite.d.ts","sourceRoot":"","sources":["../../src/tools/fileWrite.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD;;GAEG;AACH,qBAAa,aAAc,YAAW,KAAK;IAK7B,OAAO,CAAC,YAAY;IAJhC,SAAgB,EAAE,eAAe;IACjC,SAAgB,IAAI,gBAAgB;IACpC,SAAgB,WAAW,6BAA6B;gBAEpC,YAAY,EAAE,YAAY;IAE9C;;OAEG;IACG,OAAO,CAAC,KAAK,EAAE;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,cAAc,CAAC;QAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,UAAU,CAAC,EAAE,OAAO,CAAC;KACtB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,eAAe,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAc3E;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,GAAG,GAAG;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE;IAgB1D;;OAEG;IACH,SAAS,IAAI,GAAG;CA+BjB"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File Write Tool
|
|
3
|
+
* Write content to files.
|
|
4
|
+
*
|
|
5
|
+
* @module @framers/agentos-ext-cli-executor
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Tool for writing files
|
|
9
|
+
*/
|
|
10
|
+
export class FileWriteTool {
|
|
11
|
+
shellService;
|
|
12
|
+
id = 'fileWrite';
|
|
13
|
+
name = 'Write File';
|
|
14
|
+
description = 'Write content to a file';
|
|
15
|
+
constructor(shellService) {
|
|
16
|
+
this.shellService = shellService;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Write file
|
|
20
|
+
*/
|
|
21
|
+
async execute(input) {
|
|
22
|
+
try {
|
|
23
|
+
const result = await this.shellService.writeFile(input.path, input.content, {
|
|
24
|
+
encoding: input.encoding,
|
|
25
|
+
append: input.append,
|
|
26
|
+
createDirs: input.createDirs,
|
|
27
|
+
});
|
|
28
|
+
return { success: true, output: result };
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
return { success: false, error: error.message };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Validate input
|
|
36
|
+
*/
|
|
37
|
+
validate(input) {
|
|
38
|
+
const errors = [];
|
|
39
|
+
if (!input.path) {
|
|
40
|
+
errors.push('Path is required');
|
|
41
|
+
}
|
|
42
|
+
else if (typeof input.path !== 'string') {
|
|
43
|
+
errors.push('Path must be a string');
|
|
44
|
+
}
|
|
45
|
+
if (input.content === undefined || input.content === null) {
|
|
46
|
+
errors.push('Content is required');
|
|
47
|
+
}
|
|
48
|
+
return { valid: errors.length === 0, errors };
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get JSON schema for tool
|
|
52
|
+
*/
|
|
53
|
+
getSchema() {
|
|
54
|
+
return {
|
|
55
|
+
type: 'object',
|
|
56
|
+
required: ['path', 'content'],
|
|
57
|
+
properties: {
|
|
58
|
+
path: {
|
|
59
|
+
type: 'string',
|
|
60
|
+
description: 'File path to write',
|
|
61
|
+
},
|
|
62
|
+
content: {
|
|
63
|
+
type: 'string',
|
|
64
|
+
description: 'Content to write',
|
|
65
|
+
},
|
|
66
|
+
encoding: {
|
|
67
|
+
type: 'string',
|
|
68
|
+
default: 'utf-8',
|
|
69
|
+
description: 'File encoding',
|
|
70
|
+
},
|
|
71
|
+
append: {
|
|
72
|
+
type: 'boolean',
|
|
73
|
+
default: false,
|
|
74
|
+
description: 'Append to file instead of overwriting',
|
|
75
|
+
},
|
|
76
|
+
createDirs: {
|
|
77
|
+
type: 'boolean',
|
|
78
|
+
default: true,
|
|
79
|
+
description: 'Create parent directories if needed',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=fileWrite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileWrite.js","sourceRoot":"","sources":["../../src/tools/fileWrite.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;GAEG;AACH,MAAM,OAAO,aAAa;IAKJ;IAJJ,EAAE,GAAG,WAAW,CAAC;IACjB,IAAI,GAAG,YAAY,CAAC;IACpB,WAAW,GAAG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YACd,QAAQ,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC;YAC7B,UAAU,EAAE;gBACV,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,oBAAoB;iBAClC;gBACD,OAAO,EAAE;oBACP,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,kBAAkB;iBAChC;gBACD,QAAQ,EAAE;oBACR,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,OAAO;oBAChB,WAAW,EAAE,eAAe;iBAC7B;gBACD,MAAM,EAAE;oBACN,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE,KAAK;oBACd,WAAW,EAAE,uCAAuC;iBACrD;gBACD,UAAU,EAAE;oBACV,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE,IAAI;oBACb,WAAW,EAAE,qCAAqC;iBACnD;aACF;SACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List Directory Tool
|
|
3
|
+
* List directory contents.
|
|
4
|
+
*
|
|
5
|
+
* @module @framers/agentos-ext-cli-executor
|
|
6
|
+
*/
|
|
7
|
+
import type { ITool } from '@framers/agentos';
|
|
8
|
+
import type { ShellService } from '../services/shellService';
|
|
9
|
+
import type { ListDirectoryResult } from '../types';
|
|
10
|
+
/**
|
|
11
|
+
* Tool for listing directories
|
|
12
|
+
*/
|
|
13
|
+
export declare class ListDirectoryTool implements ITool {
|
|
14
|
+
private shellService;
|
|
15
|
+
readonly id = "listDirectory";
|
|
16
|
+
readonly name = "List Directory";
|
|
17
|
+
readonly description = "List files and directories";
|
|
18
|
+
constructor(shellService: ShellService);
|
|
19
|
+
/**
|
|
20
|
+
* List directory
|
|
21
|
+
*/
|
|
22
|
+
execute(input: {
|
|
23
|
+
path: string;
|
|
24
|
+
showHidden?: boolean;
|
|
25
|
+
recursive?: boolean;
|
|
26
|
+
maxDepth?: number;
|
|
27
|
+
pattern?: string;
|
|
28
|
+
includeStats?: boolean;
|
|
29
|
+
}): Promise<{
|
|
30
|
+
success: boolean;
|
|
31
|
+
output?: ListDirectoryResult;
|
|
32
|
+
error?: string;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* Validate input
|
|
36
|
+
*/
|
|
37
|
+
validate(input: any): {
|
|
38
|
+
valid: boolean;
|
|
39
|
+
errors: string[];
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Get JSON schema for tool
|
|
43
|
+
*/
|
|
44
|
+
getSchema(): any;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=listDir.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listDir.d.ts","sourceRoot":"","sources":["../../src/tools/listDir.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD;;GAEG;AACH,qBAAa,iBAAkB,YAAW,KAAK;IAKjC,OAAO,CAAC,YAAY;IAJhC,SAAgB,EAAE,mBAAmB;IACrC,SAAgB,IAAI,oBAAoB;IACxC,SAAgB,WAAW,gCAAgC;gBAEvC,YAAY,EAAE,YAAY;IAE9C;;OAEG;IACG,OAAO,CAAC,KAAK,EAAE;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,YAAY,CAAC,EAAE,OAAO,CAAC;KACxB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,mBAAmB,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAgB/E;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,GAAG,GAAG;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE;IAY1D;;OAEG;IACH,SAAS,IAAI,GAAG;CAoCjB"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List Directory Tool
|
|
3
|
+
* List directory contents.
|
|
4
|
+
*
|
|
5
|
+
* @module @framers/agentos-ext-cli-executor
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Tool for listing directories
|
|
9
|
+
*/
|
|
10
|
+
export class ListDirectoryTool {
|
|
11
|
+
shellService;
|
|
12
|
+
id = 'listDirectory';
|
|
13
|
+
name = 'List Directory';
|
|
14
|
+
description = 'List files and directories';
|
|
15
|
+
constructor(shellService) {
|
|
16
|
+
this.shellService = shellService;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* List directory
|
|
20
|
+
*/
|
|
21
|
+
async execute(input) {
|
|
22
|
+
try {
|
|
23
|
+
const result = await this.shellService.listDirectory(input.path, {
|
|
24
|
+
showHidden: input.showHidden,
|
|
25
|
+
recursive: input.recursive,
|
|
26
|
+
maxDepth: input.maxDepth,
|
|
27
|
+
pattern: input.pattern,
|
|
28
|
+
includeStats: input.includeStats,
|
|
29
|
+
});
|
|
30
|
+
return { success: true, output: result };
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
return { success: false, error: error.message };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Validate input
|
|
38
|
+
*/
|
|
39
|
+
validate(input) {
|
|
40
|
+
const errors = [];
|
|
41
|
+
if (!input.path) {
|
|
42
|
+
errors.push('Path is required');
|
|
43
|
+
}
|
|
44
|
+
else if (typeof input.path !== 'string') {
|
|
45
|
+
errors.push('Path must be a string');
|
|
46
|
+
}
|
|
47
|
+
return { valid: errors.length === 0, errors };
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get JSON schema for tool
|
|
51
|
+
*/
|
|
52
|
+
getSchema() {
|
|
53
|
+
return {
|
|
54
|
+
type: 'object',
|
|
55
|
+
required: ['path'],
|
|
56
|
+
properties: {
|
|
57
|
+
path: {
|
|
58
|
+
type: 'string',
|
|
59
|
+
description: 'Directory path to list',
|
|
60
|
+
},
|
|
61
|
+
showHidden: {
|
|
62
|
+
type: 'boolean',
|
|
63
|
+
default: false,
|
|
64
|
+
description: 'Include hidden files',
|
|
65
|
+
},
|
|
66
|
+
recursive: {
|
|
67
|
+
type: 'boolean',
|
|
68
|
+
default: false,
|
|
69
|
+
description: 'Recursive listing',
|
|
70
|
+
},
|
|
71
|
+
maxDepth: {
|
|
72
|
+
type: 'number',
|
|
73
|
+
default: 10,
|
|
74
|
+
description: 'Maximum depth for recursive listing',
|
|
75
|
+
},
|
|
76
|
+
pattern: {
|
|
77
|
+
type: 'string',
|
|
78
|
+
description: 'Filter pattern (glob)',
|
|
79
|
+
},
|
|
80
|
+
includeStats: {
|
|
81
|
+
type: 'boolean',
|
|
82
|
+
default: false,
|
|
83
|
+
description: 'Include file stats (size, dates)',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=listDir.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listDir.js","sourceRoot":"","sources":["../../src/tools/listDir.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAKR;IAJJ,EAAE,GAAG,eAAe,CAAC;IACrB,IAAI,GAAG,gBAAgB,CAAC;IACxB,WAAW,GAAG,4BAA4B,CAAC;IAE3D,YAAoB,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAAG,CAAC;IAElD;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,KA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ACpC;gBACD,SAAS,EAAE;oBACT,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE,KAAK;oBACd,WAAW,EAAE,mBAAmB;iBACjC;gBACD,QAAQ,EAAE;oBACR,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,EAAE;oBACX,WAAW,EAAE,qCAAqC;iBACnD;gBACD,OAAO,EAAE;oBACP,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,uBAAuB;iBACrC;gBACD,YAAY,EAAE;oBACZ,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE,KAAK;oBACd,WAAW,EAAE,kCAAkC;iBAChD;aACF;SACF,CAAC;IACJ,CAAC;CACF"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Executor Extension Types
|
|
3
|
+
* @module @framers/agentos-ext-cli-executor
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Shell configuration options
|
|
7
|
+
*/
|
|
8
|
+
export interface ShellConfig {
|
|
9
|
+
/** Default shell to use */
|
|
10
|
+
defaultShell?: 'bash' | 'powershell' | 'cmd' | 'zsh' | 'sh' | 'auto';
|
|
11
|
+
/** Default timeout for commands (ms) */
|
|
12
|
+
timeout?: number;
|
|
13
|
+
/** Default working directory */
|
|
14
|
+
workingDirectory?: string;
|
|
15
|
+
/** Whitelist of allowed commands (empty = all allowed) */
|
|
16
|
+
allowedCommands?: string[];
|
|
17
|
+
/** Blacklist of blocked commands */
|
|
18
|
+
blockedCommands?: string[];
|
|
19
|
+
/** Environment variables to inject */
|
|
20
|
+
env?: Record<string, string>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Result of a command execution
|
|
24
|
+
*/
|
|
25
|
+
export interface ExecutionResult {
|
|
26
|
+
/** Command that was executed */
|
|
27
|
+
command: string;
|
|
28
|
+
/** Exit code (0 = success) */
|
|
29
|
+
exitCode: number;
|
|
30
|
+
/** Standard output */
|
|
31
|
+
stdout: string;
|
|
32
|
+
/** Standard error */
|
|
33
|
+
stderr: string;
|
|
34
|
+
/** Execution duration (ms) */
|
|
35
|
+
duration: number;
|
|
36
|
+
/** Whether command was successful */
|
|
37
|
+
success: boolean;
|
|
38
|
+
/** Working directory used */
|
|
39
|
+
cwd: string;
|
|
40
|
+
/** Shell used */
|
|
41
|
+
shell: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Script execution options
|
|
45
|
+
*/
|
|
46
|
+
export interface ScriptOptions {
|
|
47
|
+
/** Script interpreter (python, node, bash, etc.) */
|
|
48
|
+
interpreter?: string;
|
|
49
|
+
/** Script arguments */
|
|
50
|
+
args?: string[];
|
|
51
|
+
/** Working directory */
|
|
52
|
+
cwd?: string;
|
|
53
|
+
/** Environment variables */
|
|
54
|
+
env?: Record<string, string>;
|
|
55
|
+
/** Timeout (ms) */
|
|
56
|
+
timeout?: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Result of a script execution
|
|
60
|
+
*/
|
|
61
|
+
export interface ScriptResult extends ExecutionResult {
|
|
62
|
+
/** Script file path */
|
|
63
|
+
scriptPath: string;
|
|
64
|
+
/** Interpreter used */
|
|
65
|
+
interpreter: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* File read options
|
|
69
|
+
*/
|
|
70
|
+
export interface FileReadOptions {
|
|
71
|
+
/** Encoding (default: utf-8) */
|
|
72
|
+
encoding?: BufferEncoding;
|
|
73
|
+
/** Maximum bytes to read */
|
|
74
|
+
maxBytes?: number;
|
|
75
|
+
/** Start position */
|
|
76
|
+
start?: number;
|
|
77
|
+
/** Number of lines to read (from start or end) */
|
|
78
|
+
lines?: number;
|
|
79
|
+
/** Read from end of file */
|
|
80
|
+
fromEnd?: boolean;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* File read result
|
|
84
|
+
*/
|
|
85
|
+
export interface FileReadResult {
|
|
86
|
+
/** File path */
|
|
87
|
+
path: string;
|
|
88
|
+
/** File content */
|
|
89
|
+
content: string;
|
|
90
|
+
/** File size in bytes */
|
|
91
|
+
size: number;
|
|
92
|
+
/** Whether content was truncated */
|
|
93
|
+
truncated: boolean;
|
|
94
|
+
/** File encoding */
|
|
95
|
+
encoding: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* File write options
|
|
99
|
+
*/
|
|
100
|
+
export interface FileWriteOptions {
|
|
101
|
+
/** Encoding (default: utf-8) */
|
|
102
|
+
encoding?: BufferEncoding;
|
|
103
|
+
/** Append to file instead of overwrite */
|
|
104
|
+
append?: boolean;
|
|
105
|
+
/** Create parent directories if needed */
|
|
106
|
+
createDirs?: boolean;
|
|
107
|
+
/** File mode/permissions (Unix) */
|
|
108
|
+
mode?: number;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* File write result
|
|
112
|
+
*/
|
|
113
|
+
export interface FileWriteResult {
|
|
114
|
+
/** File path */
|
|
115
|
+
path: string;
|
|
116
|
+
/** Bytes written */
|
|
117
|
+
bytesWritten: number;
|
|
118
|
+
/** Whether file was created */
|
|
119
|
+
created: boolean;
|
|
120
|
+
/** Whether content was appended */
|
|
121
|
+
appended: boolean;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Directory entry
|
|
125
|
+
*/
|
|
126
|
+
export interface DirectoryEntry {
|
|
127
|
+
/** Entry name */
|
|
128
|
+
name: string;
|
|
129
|
+
/** Full path */
|
|
130
|
+
path: string;
|
|
131
|
+
/** Entry type */
|
|
132
|
+
type: 'file' | 'directory' | 'symlink' | 'other';
|
|
133
|
+
/** Size in bytes (for files) */
|
|
134
|
+
size?: number;
|
|
135
|
+
/** Last modified time */
|
|
136
|
+
modifiedAt?: string;
|
|
137
|
+
/** Created time */
|
|
138
|
+
createdAt?: string;
|
|
139
|
+
/** File extension (for files) */
|
|
140
|
+
extension?: string;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Directory listing options
|
|
144
|
+
*/
|
|
145
|
+
export interface ListDirectoryOptions {
|
|
146
|
+
/** Include hidden files */
|
|
147
|
+
showHidden?: boolean;
|
|
148
|
+
/** Recursive listing */
|
|
149
|
+
recursive?: boolean;
|
|
150
|
+
/** Maximum depth for recursive listing */
|
|
151
|
+
maxDepth?: number;
|
|
152
|
+
/** Filter pattern (glob) */
|
|
153
|
+
pattern?: string;
|
|
154
|
+
/** Include file stats */
|
|
155
|
+
includeStats?: boolean;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Directory listing result
|
|
159
|
+
*/
|
|
160
|
+
export interface ListDirectoryResult {
|
|
161
|
+
/** Directory path */
|
|
162
|
+
path: string;
|
|
163
|
+
/** Directory entries */
|
|
164
|
+
entries: DirectoryEntry[];
|
|
165
|
+
/** Total count */
|
|
166
|
+
count: number;
|
|
167
|
+
/** Whether listing was recursive */
|
|
168
|
+
recursive: boolean;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Security check result
|
|
172
|
+
*/
|
|
173
|
+
export interface SecurityCheckResult {
|
|
174
|
+
/** Whether command is allowed */
|
|
175
|
+
allowed: boolean;
|
|
176
|
+
/** Reason if blocked */
|
|
177
|
+
reason?: string;
|
|
178
|
+
/** Risk level */
|
|
179
|
+
riskLevel: 'safe' | 'low' | 'medium' | 'high' | 'critical';
|
|
180
|
+
/** Warnings */
|
|
181
|
+
warnings: string[];
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,2BAA2B;IAC3B,YAAY,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,GAAG,MAAM,CAAC;IACrE,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB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C;IACpB,mBAAmB;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,2BAA2B;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,wBAAwB;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4BAA4B;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yBAAyB;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,wBAAwB;IACxB,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,iCAAiC;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,wBAAwB;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iBAAiB;IACjB,SAAS,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;IAC3D,eAAe;IACf,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
package/manifest.json
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://agentos.sh/schemas/extension-manifest-v1.json",
|
|
3
|
+
"id": "com.framers.system.cli-executor",
|
|
4
|
+
"name": "CLI Executor Extension",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"description": "Execute shell commands, run scripts, and manage processes for AgentOS agents",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Frame.dev",
|
|
9
|
+
"email": "support@frame.dev",
|
|
10
|
+
"url": "https://github.com/framersai"
|
|
11
|
+
},
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"keywords": ["cli", "shell", "command", "execute", "terminal", "bash", "powershell", "script"],
|
|
14
|
+
"agentosVersion": "^2.0.0",
|
|
15
|
+
"categories": ["system", "automation", "development"],
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/framersai/agentos-extensions"
|
|
19
|
+
},
|
|
20
|
+
"extensions": [
|
|
21
|
+
{
|
|
22
|
+
"kind": "tool",
|
|
23
|
+
"id": "shellExecute",
|
|
24
|
+
"displayName": "Execute Shell Command",
|
|
25
|
+
"description": "Execute a shell command and return output",
|
|
26
|
+
"entry": "./dist/tools/execute.js"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"kind": "tool",
|
|
30
|
+
"id": "shellScript",
|
|
31
|
+
"displayName": "Run Script",
|
|
32
|
+
"description": "Run a script file (bash, python, node, etc.)",
|
|
33
|
+
"entry": "./dist/tools/script.js"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"kind": "tool",
|
|
37
|
+
"id": "fileRead",
|
|
38
|
+
"displayName": "Read File",
|
|
39
|
+
"description": "Read contents of a file",
|
|
40
|
+
"entry": "./dist/tools/fileRead.js"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"kind": "tool",
|
|
44
|
+
"id": "fileWrite",
|
|
45
|
+
"displayName": "Write File",
|
|
46
|
+
"description": "Write content to a file",
|
|
47
|
+
"entry": "./dist/tools/fileWrite.js"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"kind": "tool",
|
|
51
|
+
"id": "listDirectory",
|
|
52
|
+
"displayName": "List Directory",
|
|
53
|
+
"description": "List files and directories",
|
|
54
|
+
"entry": "./dist/tools/listDir.js"
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"configuration": {
|
|
58
|
+
"properties": {
|
|
59
|
+
"shell.defaultShell": {
|
|
60
|
+
"type": "string",
|
|
61
|
+
"description": "Default shell to use (bash, powershell, cmd, zsh)",
|
|
62
|
+
"default": "auto"
|
|
63
|
+
},
|
|
64
|
+
"shell.timeout": {
|
|
65
|
+
"type": "number",
|
|
66
|
+
"default": 60000,
|
|
67
|
+
"minimum": 1000,
|
|
68
|
+
"maximum": 600000,
|
|
69
|
+
"description": "Default timeout for commands (ms)"
|
|
70
|
+
},
|
|
71
|
+
"shell.workingDirectory": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"description": "Default working directory"
|
|
74
|
+
},
|
|
75
|
+
"shell.allowedCommands": {
|
|
76
|
+
"type": "array",
|
|
77
|
+
"items": { "type": "string" },
|
|
78
|
+
"description": "Whitelist of allowed commands (empty = all allowed)"
|
|
79
|
+
},
|
|
80
|
+
"shell.blockedCommands": {
|
|
81
|
+
"type": "array",
|
|
82
|
+
"items": { "type": "string" },
|
|
83
|
+
"default": ["rm -rf /", "format", "del /s /q", "shutdown", "reboot"],
|
|
84
|
+
"description": "Blacklist of blocked commands"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@framers/agentos-ext-cli-executor",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "CLI executor extension for AgentOS - execute shell commands and manage files",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"manifest.json",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc",
|
|
21
|
+
"test": "vitest run",
|
|
22
|
+
"test:watch": "vitest",
|
|
23
|
+
"clean": "rm -rf dist"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"agentos",
|
|
27
|
+
"extension",
|
|
28
|
+
"cli",
|
|
29
|
+
"shell",
|
|
30
|
+
"command",
|
|
31
|
+
"execute"
|
|
32
|
+
],
|
|
33
|
+
"author": {
|
|
34
|
+
"name": "Framers AI",
|
|
35
|
+
"email": "team@frame.dev",
|
|
36
|
+
"url": "https://frame.dev"
|
|
37
|
+
},
|
|
38
|
+
"contributors": [
|
|
39
|
+
{
|
|
40
|
+
"name": "Johnny Dunn",
|
|
41
|
+
"email": "johnnyfived@protonmail.com",
|
|
42
|
+
"url": "https://github.com/jddunn"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "https://github.com/framersai/agentos-extensions",
|
|
49
|
+
"directory": "registry/curated/system/cli-executor"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"@framers/agentos": "^0.1.0"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@types/node": "^20.0.0",
|
|
56
|
+
"typescript": "^5.4.0",
|
|
57
|
+
"vitest": "^1.6.0"
|
|
58
|
+
}
|
|
59
|
+
}
|