@elizaos/plugin-shell 1.2.0 → 2.0.0-alpha.1
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/dist/actions/clearHistory.d.ts +4 -0
- package/dist/actions/clearHistory.d.ts.map +1 -0
- package/dist/actions/executeCommand.d.ts +6 -0
- package/dist/actions/executeCommand.d.ts.map +1 -0
- package/dist/actions/index.d.ts +3 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/build.d.ts +2 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/generated/prompts/typescript/prompts.d.ts +12 -0
- package/dist/generated/prompts/typescript/prompts.d.ts.map +1 -0
- package/dist/generated/specs/spec-helpers.d.ts +49 -0
- package/dist/generated/specs/spec-helpers.d.ts.map +1 -0
- package/dist/generated/specs/specs.d.ts +83 -0
- package/dist/generated/specs/specs.d.ts.map +1 -0
- package/dist/index.browser.d.ts +4 -0
- package/dist/index.browser.d.ts.map +1 -0
- package/dist/index.d.ts +10 -106
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +779 -911
- package/dist/index.js.map +19 -1
- package/dist/providers/index.d.ts +2 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/shellHistoryProvider.d.ts +4 -0
- package/dist/providers/shellHistoryProvider.d.ts.map +1 -0
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/shellService.d.ts +24 -0
- package/dist/services/shellService.d.ts.map +1 -0
- package/dist/types/index.d.ts +30 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/config.d.ts +4 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/pathUtils.d.ts +5 -0
- package/dist/utils/pathUtils.d.ts.map +1 -0
- package/package.json +73 -19
- package/LICENSE +0 -21
- package/README.md +0 -352
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clearHistory.d.ts","sourceRoot":"","sources":["../../actions/clearHistory.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EASZ,MAAM,eAAe,CAAC;AAMvB,eAAO,MAAM,YAAY,EAAE,MAgE1B,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Action } from "@elizaos/core";
|
|
2
|
+
import { commandExtractionTemplate } from "../generated/prompts/typescript/prompts.js";
|
|
3
|
+
export { commandExtractionTemplate };
|
|
4
|
+
export declare const executeCommand: Action;
|
|
5
|
+
export default executeCommand;
|
|
6
|
+
//# sourceMappingURL=executeCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executeCommand.d.ts","sourceRoot":"","sources":["../../actions/executeCommand.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,MAAM,EAWZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AAGvF,OAAO,EAAE,yBAAyB,EAAE,CAAC;AA6BrC,eAAO,MAAM,cAAc,EAAE,MA6H5B,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/build.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../build.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-generated prompt templates
|
|
3
|
+
* DO NOT EDIT - Generated from ../../../../prompts/*.txt
|
|
4
|
+
*
|
|
5
|
+
* These prompts use Handlebars-style template syntax:
|
|
6
|
+
* - {{variableName}} for simple substitution
|
|
7
|
+
* - {{#each items}}...{{/each}} for iteration
|
|
8
|
+
* - {{#if condition}}...{{/if}} for conditionals
|
|
9
|
+
*/
|
|
10
|
+
export declare const commandExtractionTemplate = "# Extracting shell command from request\n{{recentMessages}}\n\n# Instructions: {{senderName}} wants to execute a shell command. Extract the COMPLETE shell command they want to run.\n\nIMPORTANT: \n1. Always return the FULL executable shell command, not just the content or partial command.\n2. If the user mentions installing something, create the appropriate brew/npm/apt command.\n3. If the user directly provides a command (like \"brew install X\"), use it exactly as provided.\n4. ALWAYS extract a command if the user is asking for ANY kind of system operation.\n\nCommon patterns:\n- \"run ls -la\" -> command: \"ls -la\"\n- \"execute npm test\" -> command: \"npm test\"\n- \"show me the files\" or \"list files\" -> command: \"ls -la\"\n- \"what's in this directory\" -> command: \"ls -la\"\n- \"check git status\" -> command: \"git status\"\n- \"navigate to src folder\" -> command: \"cd src\"\n- \"create a file called test.txt\" -> command: \"touch test.txt\"\n- \"write hello world to a file\" -> command: \"echo 'hello world' > file.txt\"\n- \"create hello.js with javascript code\" -> command: \"echo 'console.log(\\\"Hello, World!\\\");' > hello.js\"\n- \"create hello_world.py and write a python hello world script inside\" -> command: \"echo 'print(\\\"Hello, World!\\\")' > hello_world.py\"\n- \"make a new directory\" -> command: \"mkdir newdir\"\n- \"list files inside your filesystem\" -> command: \"ls -la\"\n- \"install orbstack\" or \"brew install orbstack\" -> command: \"brew install orbstack\"\n- \"install mullvad vpn\" -> command: \"brew install --cask mullvad-vpn\"\n- \"get system info\" -> command: \"system_profiler SPHardwareDataType\"\n- \"check memory usage\" -> command: \"vm_stat\"\n- \"install package\" -> command: \"brew install <package>\"\n\nSpecial cases:\n- \"Run it in your shell\" or \"execute it\" -> Extract the command from previous context\n- \"Install these\" -> Look for package names in previous messages\n- Direct commands should be used exactly as provided\n\nKey rules:\n1. For file creation with content, use: echo 'content' > filename\n2. For listing files, use: ls -la (not just ls)\n3. Always include the echo command when writing to files\n4. Include all flags and arguments\n5. When user says \"run it\", \"execute it\", or similar, they want you to run the command\n\nYour response must be formatted as a JSON block:\n```json\n{\n \"command\": \"<complete shell command to execute>\"\n}\n```";
|
|
11
|
+
export declare const COMMAND_EXTRACTION_TEMPLATE = "# Extracting shell command from request\n{{recentMessages}}\n\n# Instructions: {{senderName}} wants to execute a shell command. Extract the COMPLETE shell command they want to run.\n\nIMPORTANT: \n1. Always return the FULL executable shell command, not just the content or partial command.\n2. If the user mentions installing something, create the appropriate brew/npm/apt command.\n3. If the user directly provides a command (like \"brew install X\"), use it exactly as provided.\n4. ALWAYS extract a command if the user is asking for ANY kind of system operation.\n\nCommon patterns:\n- \"run ls -la\" -> command: \"ls -la\"\n- \"execute npm test\" -> command: \"npm test\"\n- \"show me the files\" or \"list files\" -> command: \"ls -la\"\n- \"what's in this directory\" -> command: \"ls -la\"\n- \"check git status\" -> command: \"git status\"\n- \"navigate to src folder\" -> command: \"cd src\"\n- \"create a file called test.txt\" -> command: \"touch test.txt\"\n- \"write hello world to a file\" -> command: \"echo 'hello world' > file.txt\"\n- \"create hello.js with javascript code\" -> command: \"echo 'console.log(\\\"Hello, World!\\\");' > hello.js\"\n- \"create hello_world.py and write a python hello world script inside\" -> command: \"echo 'print(\\\"Hello, World!\\\")' > hello_world.py\"\n- \"make a new directory\" -> command: \"mkdir newdir\"\n- \"list files inside your filesystem\" -> command: \"ls -la\"\n- \"install orbstack\" or \"brew install orbstack\" -> command: \"brew install orbstack\"\n- \"install mullvad vpn\" -> command: \"brew install --cask mullvad-vpn\"\n- \"get system info\" -> command: \"system_profiler SPHardwareDataType\"\n- \"check memory usage\" -> command: \"vm_stat\"\n- \"install package\" -> command: \"brew install <package>\"\n\nSpecial cases:\n- \"Run it in your shell\" or \"execute it\" -> Extract the command from previous context\n- \"Install these\" -> Look for package names in previous messages\n- Direct commands should be used exactly as provided\n\nKey rules:\n1. For file creation with content, use: echo 'content' > filename\n2. For listing files, use: ls -la (not just ls)\n3. Always include the echo command when writing to files\n4. Include all flags and arguments\n5. When user says \"run it\", \"execute it\", or similar, they want you to run the command\n\nYour response must be formatted as a JSON block:\n```json\n{\n \"command\": \"<complete shell command to execute>\"\n}\n```";
|
|
12
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../../generated/prompts/typescript/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,yBAAyB,25EA+C/B,CAAC;AAER,eAAO,MAAM,2BAA2B,25EAA4B,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper functions to lookup action/provider/evaluator specs by name.
|
|
3
|
+
* These allow language-specific implementations to import their text content
|
|
4
|
+
* (description, similes, examples) from the centralized specs.
|
|
5
|
+
*
|
|
6
|
+
* DO NOT EDIT the spec data - update prompts/actions.json, prompts/providers.json, prompts/evaluators.json and regenerate.
|
|
7
|
+
*/
|
|
8
|
+
import { type ActionDoc, type EvaluatorDoc, type ProviderDoc } from "./specs";
|
|
9
|
+
/**
|
|
10
|
+
* Get an action spec by name from the core specs.
|
|
11
|
+
* @param name - The action name
|
|
12
|
+
* @returns The action spec or undefined if not found
|
|
13
|
+
*/
|
|
14
|
+
export declare function getActionSpec(name: string): ActionDoc | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Get an action spec by name, throwing if not found.
|
|
17
|
+
* @param name - The action name
|
|
18
|
+
* @returns The action spec
|
|
19
|
+
* @throws Error if the action is not found
|
|
20
|
+
*/
|
|
21
|
+
export declare function requireActionSpec(name: string): ActionDoc;
|
|
22
|
+
/**
|
|
23
|
+
* Get a provider spec by name from the core specs.
|
|
24
|
+
* @param name - The provider name
|
|
25
|
+
* @returns The provider spec or undefined if not found
|
|
26
|
+
*/
|
|
27
|
+
export declare function getProviderSpec(name: string): ProviderDoc | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Get a provider spec by name, throwing if not found.
|
|
30
|
+
* @param name - The provider name
|
|
31
|
+
* @returns The provider spec
|
|
32
|
+
* @throws Error if the provider is not found
|
|
33
|
+
*/
|
|
34
|
+
export declare function requireProviderSpec(name: string): ProviderDoc;
|
|
35
|
+
/**
|
|
36
|
+
* Get an evaluator spec by name from the core specs.
|
|
37
|
+
* @param name - The evaluator name
|
|
38
|
+
* @returns The evaluator spec or undefined if not found
|
|
39
|
+
*/
|
|
40
|
+
export declare function getEvaluatorSpec(name: string): EvaluatorDoc | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Get an evaluator spec by name, throwing if not found.
|
|
43
|
+
* @param name - The evaluator name
|
|
44
|
+
* @returns The evaluator spec
|
|
45
|
+
* @throws Error if the evaluator is not found
|
|
46
|
+
*/
|
|
47
|
+
export declare function requireEvaluatorSpec(name: string): EvaluatorDoc;
|
|
48
|
+
export type { ActionDoc, ProviderDoc, EvaluatorDoc };
|
|
49
|
+
//# sourceMappingURL=spec-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec-helpers.d.ts","sourceRoot":"","sources":["../../../generated/specs/spec-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,KAAK,SAAS,EAOd,KAAK,YAAY,EACjB,KAAK,WAAW,EACjB,MAAM,SAAS,CAAC;AAgBjB;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAEjE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAMzD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAErE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAM7D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAEvE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAM/D;AAGD,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-generated canonical action/provider/evaluator docs for plugin-shell.
|
|
3
|
+
* DO NOT EDIT - Generated from prompts/specs/**.
|
|
4
|
+
*/
|
|
5
|
+
export type ActionDoc = {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
similes?: readonly string[];
|
|
9
|
+
parameters?: readonly unknown[];
|
|
10
|
+
examples?: readonly (readonly unknown[])[];
|
|
11
|
+
};
|
|
12
|
+
export type ProviderDoc = {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
position?: number;
|
|
16
|
+
dynamic?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type EvaluatorDoc = {
|
|
19
|
+
name: string;
|
|
20
|
+
description: string;
|
|
21
|
+
similes?: readonly string[];
|
|
22
|
+
alwaysRun?: boolean;
|
|
23
|
+
examples?: readonly unknown[];
|
|
24
|
+
};
|
|
25
|
+
export declare const coreActionsSpec: {
|
|
26
|
+
readonly version: "1.0.0";
|
|
27
|
+
readonly actions: readonly [{
|
|
28
|
+
readonly name: "CLEAR_SHELL_HISTORY";
|
|
29
|
+
readonly description: "Clears the recorded history of shell commands for the current conversation";
|
|
30
|
+
readonly similes: readonly ["RESET_SHELL", "CLEAR_TERMINAL", "CLEAR_HISTORY", "RESET_HISTORY"];
|
|
31
|
+
readonly parameters: readonly [];
|
|
32
|
+
}, {
|
|
33
|
+
readonly name: "EXECUTE_COMMAND";
|
|
34
|
+
readonly description: "Execute shell commands including brew install, npm install, apt-get, system commands, file operations, directory navigation, and scripts.";
|
|
35
|
+
readonly similes: readonly ["RUN_COMMAND", "SHELL_COMMAND", "TERMINAL_COMMAND", "EXEC", "RUN", "EXECUTE", "CREATE_FILE", "WRITE_FILE", "MAKE_FILE", "INSTALL", "BREW_INSTALL", "NPM_INSTALL", "APT_INSTALL"];
|
|
36
|
+
readonly parameters: readonly [];
|
|
37
|
+
}];
|
|
38
|
+
};
|
|
39
|
+
export declare const allActionsSpec: {
|
|
40
|
+
readonly version: "1.0.0";
|
|
41
|
+
readonly actions: readonly [{
|
|
42
|
+
readonly name: "CLEAR_SHELL_HISTORY";
|
|
43
|
+
readonly description: "Clears the recorded history of shell commands for the current conversation";
|
|
44
|
+
readonly similes: readonly ["RESET_SHELL", "CLEAR_TERMINAL", "CLEAR_HISTORY", "RESET_HISTORY"];
|
|
45
|
+
readonly parameters: readonly [];
|
|
46
|
+
}, {
|
|
47
|
+
readonly name: "EXECUTE_COMMAND";
|
|
48
|
+
readonly description: "Execute shell commands including brew install, npm install, apt-get, system commands, file operations, directory navigation, and scripts.";
|
|
49
|
+
readonly similes: readonly ["RUN_COMMAND", "SHELL_COMMAND", "TERMINAL_COMMAND", "EXEC", "RUN", "EXECUTE", "CREATE_FILE", "WRITE_FILE", "MAKE_FILE", "INSTALL", "BREW_INSTALL", "NPM_INSTALL", "APT_INSTALL"];
|
|
50
|
+
readonly parameters: readonly [];
|
|
51
|
+
}];
|
|
52
|
+
};
|
|
53
|
+
export declare const coreProvidersSpec: {
|
|
54
|
+
readonly version: "1.0.0";
|
|
55
|
+
readonly providers: readonly [{
|
|
56
|
+
readonly name: "SHELL_HISTORY";
|
|
57
|
+
readonly description: "Provides recent shell command history, current working directory, and file operations within the restricted environment";
|
|
58
|
+
readonly dynamic: true;
|
|
59
|
+
}];
|
|
60
|
+
};
|
|
61
|
+
export declare const allProvidersSpec: {
|
|
62
|
+
readonly version: "1.0.0";
|
|
63
|
+
readonly providers: readonly [{
|
|
64
|
+
readonly name: "SHELL_HISTORY";
|
|
65
|
+
readonly description: "Provides recent shell command history, current working directory, and file operations within the restricted environment";
|
|
66
|
+
readonly dynamic: true;
|
|
67
|
+
}];
|
|
68
|
+
};
|
|
69
|
+
export declare const coreEvaluatorsSpec: {
|
|
70
|
+
readonly version: "1.0.0";
|
|
71
|
+
readonly evaluators: readonly [];
|
|
72
|
+
};
|
|
73
|
+
export declare const allEvaluatorsSpec: {
|
|
74
|
+
readonly version: "1.0.0";
|
|
75
|
+
readonly evaluators: readonly [];
|
|
76
|
+
};
|
|
77
|
+
export declare const coreActionDocs: readonly ActionDoc[];
|
|
78
|
+
export declare const allActionDocs: readonly ActionDoc[];
|
|
79
|
+
export declare const coreProviderDocs: readonly ProviderDoc[];
|
|
80
|
+
export declare const allProviderDocs: readonly ProviderDoc[];
|
|
81
|
+
export declare const coreEvaluatorDocs: readonly EvaluatorDoc[];
|
|
82
|
+
export declare const allEvaluatorDocs: readonly EvaluatorDoc[];
|
|
83
|
+
//# sourceMappingURL=specs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specs.d.ts","sourceRoot":"","sources":["../../../generated/specs/specs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,UAAU,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IAChC,QAAQ,CAAC,EAAE,SAAS,CAAC,SAAS,OAAO,EAAE,CAAC,EAAE,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;CA+BlB,CAAC;AACX,eAAO,MAAM,cAAc;;;;;;;;;;;;;CA+BjB,CAAC;AACX,eAAO,MAAM,iBAAiB;;;;;;;CAUpB,CAAC;AACX,eAAO,MAAM,gBAAgB;;;;;;;CAUnB,CAAC;AACX,eAAO,MAAM,kBAAkB;;;CAGrB,CAAC;AACX,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAEX,eAAO,MAAM,cAAc,EAAE,SAAS,SAAS,EAA4B,CAAC;AAC5E,eAAO,MAAM,aAAa,EAAE,SAAS,SAAS,EAA2B,CAAC;AAC1E,eAAO,MAAM,gBAAgB,EAAE,SAAS,WAAW,EAAgC,CAAC;AACpF,eAAO,MAAM,eAAe,EAAE,SAAS,WAAW,EAA+B,CAAC;AAClF,eAAO,MAAM,iBAAiB,EAAE,SAAS,YAAY,EAAkC,CAAC;AACxF,eAAO,MAAM,gBAAgB,EAAE,SAAS,YAAY,EAAiC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../index.browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,MAAM,EAAE,MAAM,eAAe,CAAC;AAK3D,eAAO,MAAM,WAAW,EAAE,MAMzB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,106 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
interface CommandHistoryEntry {
|
|
12
|
-
command: string;
|
|
13
|
-
stdout: string;
|
|
14
|
-
stderr: string;
|
|
15
|
-
exitCode: number | null;
|
|
16
|
-
timestamp: number;
|
|
17
|
-
workingDirectory: string;
|
|
18
|
-
fileOperations?: FileOperation[];
|
|
19
|
-
}
|
|
20
|
-
interface FileOperation {
|
|
21
|
-
type: 'create' | 'write' | 'read' | 'delete' | 'mkdir' | 'move' | 'copy';
|
|
22
|
-
target: string;
|
|
23
|
-
secondaryTarget?: string;
|
|
24
|
-
}
|
|
25
|
-
declare class ShellService extends Service {
|
|
26
|
-
static serviceType: string;
|
|
27
|
-
private shellConfig;
|
|
28
|
-
private currentDirectory;
|
|
29
|
-
private commandHistory;
|
|
30
|
-
private maxHistoryPerConversation;
|
|
31
|
-
constructor(runtime: IAgentRuntime);
|
|
32
|
-
static start(runtime: IAgentRuntime): Promise<ShellService>;
|
|
33
|
-
stop(): Promise<void>;
|
|
34
|
-
get capabilityDescription(): string;
|
|
35
|
-
/**
|
|
36
|
-
* Executes a shell command within the allowed directory
|
|
37
|
-
* @param command The command to execute
|
|
38
|
-
* @param conversationId Optional conversation ID for history tracking
|
|
39
|
-
* @returns The command execution result
|
|
40
|
-
*/
|
|
41
|
-
executeCommand(command: string, conversationId?: string): Promise<CommandResult>;
|
|
42
|
-
/**
|
|
43
|
-
* Handles the cd command to change directory within allowed bounds
|
|
44
|
-
* @param command The cd command
|
|
45
|
-
* @returns The command result
|
|
46
|
-
*/
|
|
47
|
-
private handleCdCommand;
|
|
48
|
-
/**
|
|
49
|
-
* Runs a command using cross-spawn
|
|
50
|
-
* @param command The command to run
|
|
51
|
-
* @returns The command result
|
|
52
|
-
*/
|
|
53
|
-
private runCommand;
|
|
54
|
-
/**
|
|
55
|
-
* Adds a command to the history
|
|
56
|
-
*/
|
|
57
|
-
private addToHistory;
|
|
58
|
-
/**
|
|
59
|
-
* Detects file operations from a command
|
|
60
|
-
*/
|
|
61
|
-
private detectFileOperations;
|
|
62
|
-
/**
|
|
63
|
-
* Resolves a path relative to the current working directory
|
|
64
|
-
*/
|
|
65
|
-
private resolvePath;
|
|
66
|
-
/**
|
|
67
|
-
* Gets command history for a conversation
|
|
68
|
-
*/
|
|
69
|
-
getCommandHistory(conversationId: string, limit?: number): CommandHistoryEntry[];
|
|
70
|
-
/**
|
|
71
|
-
* Clears command history for a conversation
|
|
72
|
-
*/
|
|
73
|
-
clearCommandHistory(conversationId: string): void;
|
|
74
|
-
/**
|
|
75
|
-
* Gets the current working directory
|
|
76
|
-
* @param conversationId Optional conversation ID to get conversation-specific directory
|
|
77
|
-
* @returns The current directory path
|
|
78
|
-
*/
|
|
79
|
-
getCurrentDirectory(_conversationId?: string): string;
|
|
80
|
-
/**
|
|
81
|
-
* Gets the allowed directory
|
|
82
|
-
* @returns The allowed directory path
|
|
83
|
-
*/
|
|
84
|
-
getAllowedDirectory(): string;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
declare const executeCommand: Action;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Shell plugin environment configuration
|
|
91
|
-
*/
|
|
92
|
-
interface ShellConfig {
|
|
93
|
-
enabled: boolean;
|
|
94
|
-
allowedDirectory: string;
|
|
95
|
-
timeout: number;
|
|
96
|
-
forbiddenCommands: string[];
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Loads and validates the shell plugin configuration
|
|
100
|
-
* @returns The validated configuration
|
|
101
|
-
*/
|
|
102
|
-
declare function loadShellConfig(): ShellConfig;
|
|
103
|
-
|
|
104
|
-
declare const shellPlugin: Plugin;
|
|
105
|
-
|
|
106
|
-
export { type CommandResult, type ShellConfig, ShellService, shellPlugin as default, executeCommand, loadShellConfig, shellPlugin };
|
|
1
|
+
import type { Plugin } from "@elizaos/core";
|
|
2
|
+
export declare const shellPlugin: Plugin;
|
|
3
|
+
export default shellPlugin;
|
|
4
|
+
export { clearHistory } from "./actions/clearHistory";
|
|
5
|
+
export { executeCommand } from "./actions/executeCommand";
|
|
6
|
+
export { shellHistoryProvider } from "./providers/shellHistoryProvider";
|
|
7
|
+
export { ShellService } from "./services/shellService";
|
|
8
|
+
export type { CommandHistoryEntry, CommandResult, FileOperation, FileOperationType, ShellConfig, } from "./types";
|
|
9
|
+
export { DEFAULT_FORBIDDEN_COMMANDS, extractBaseCommand, isForbiddenCommand, isSafeCommand, loadShellConfig, validatePath, } from "./utils";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAK5C,eAAO,MAAM,WAAW,EAAE,MAMzB,CAAC;AAEF,eAAe,WAAW,CAAC;AAE3B,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,YAAY,EACV,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,WAAW,GACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,YAAY,GACb,MAAM,SAAS,CAAC"}
|