@elizaos/plugin-shell 2.0.3-beta.2 → 2.0.3-beta.3

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 (56) hide show
  1. package/dist/approvals/allowlist.d.ts +76 -0
  2. package/dist/approvals/allowlist.d.ts.map +1 -0
  3. package/dist/approvals/analysis.d.ts +76 -0
  4. package/dist/approvals/analysis.d.ts.map +1 -0
  5. package/dist/approvals/index.d.ts +12 -0
  6. package/dist/approvals/index.d.ts.map +1 -0
  7. package/dist/approvals/service.d.ts +121 -0
  8. package/dist/approvals/service.d.ts.map +1 -0
  9. package/dist/approvals/types.d.ts +219 -0
  10. package/dist/approvals/types.d.ts.map +1 -0
  11. package/dist/auto-enable.d.ts +4 -0
  12. package/dist/auto-enable.d.ts.map +1 -0
  13. package/dist/generated/specs/spec-helpers.d.ts +36 -0
  14. package/dist/generated/specs/spec-helpers.d.ts.map +1 -0
  15. package/dist/generated/specs/specs.d.ts +48 -0
  16. package/dist/generated/specs/specs.d.ts.map +1 -0
  17. package/dist/index.browser.d.ts +4 -0
  18. package/dist/index.browser.d.ts.map +1 -0
  19. package/dist/index.d.ts +13 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +4284 -0
  22. package/dist/index.js.map +24 -0
  23. package/dist/prompts.d.ts +11 -0
  24. package/dist/prompts.d.ts.map +1 -0
  25. package/dist/providers/index.d.ts +2 -0
  26. package/dist/providers/index.d.ts.map +1 -0
  27. package/dist/providers/shellHistoryProvider.d.ts +4 -0
  28. package/dist/providers/shellHistoryProvider.d.ts.map +1 -0
  29. package/dist/services/index.d.ts +3 -0
  30. package/dist/services/index.d.ts.map +1 -0
  31. package/dist/services/processRegistry.d.ts +25 -0
  32. package/dist/services/processRegistry.d.ts.map +1 -0
  33. package/dist/services/shellService.d.ts +95 -0
  34. package/dist/services/shellService.d.ts.map +1 -0
  35. package/dist/types/index.d.ts +144 -0
  36. package/dist/types/index.d.ts.map +1 -0
  37. package/dist/utils/config.d.ts +4 -0
  38. package/dist/utils/config.d.ts.map +1 -0
  39. package/dist/utils/index.d.ts +7 -0
  40. package/dist/utils/index.d.ts.map +1 -0
  41. package/dist/utils/pathUtils.d.ts +5 -0
  42. package/dist/utils/pathUtils.d.ts.map +1 -0
  43. package/dist/utils/processQueue.d.ts +136 -0
  44. package/dist/utils/processQueue.d.ts.map +1 -0
  45. package/dist/utils/ptyKeys.d.ts +23 -0
  46. package/dist/utils/ptyKeys.d.ts.map +1 -0
  47. package/dist/utils/shellArgv.d.ts +37 -0
  48. package/dist/utils/shellArgv.d.ts.map +1 -0
  49. package/dist/utils/shellUtils.d.ts +103 -0
  50. package/dist/utils/shellUtils.d.ts.map +1 -0
  51. package/dist/utils/terminalCapabilities.d.ts +30 -0
  52. package/dist/utils/terminalCapabilities.d.ts.map +1 -0
  53. package/dist/vitest.config.d.ts +3 -0
  54. package/dist/vitest.config.d.ts.map +1 -0
  55. package/package.json +5 -4
  56. package/registry-entry.json +94 -0
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Shell Utilities - Platform-specific shell configuration and helpers
3
+ * Ported from otto shell-utils.ts and bash-tools.shared.ts
4
+ */
5
+ import type { ChildProcess, ChildProcessWithoutNullStreams, SpawnOptions } from "node:child_process";
6
+ import { spawn } from "node:child_process";
7
+ /**
8
+ * Get shell configuration for the current platform
9
+ */
10
+ export declare function getShellConfig(): {
11
+ shell: string;
12
+ args: string[];
13
+ };
14
+ /**
15
+ * Sanitize binary output by removing control characters
16
+ */
17
+ export declare function sanitizeBinaryOutput(text: string): string;
18
+ /**
19
+ * Kill a process tree (cross-platform)
20
+ */
21
+ export declare function killProcessTree(pid: number): void;
22
+ /**
23
+ * Kill a session's process
24
+ */
25
+ export declare function killSession(session: {
26
+ pid?: number;
27
+ child?: ChildProcessWithoutNullStreams;
28
+ }): void;
29
+ /**
30
+ * Coerce environment object to Record<string, string>
31
+ */
32
+ export declare function coerceEnv(env?: NodeJS.ProcessEnv | Record<string, string>): Record<string, string>;
33
+ /**
34
+ * Resolve working directory with fallback
35
+ */
36
+ export declare function resolveWorkdir(workdir: string, warnings: string[]): string;
37
+ /**
38
+ * Clamp a number to a range with a default value
39
+ */
40
+ export declare function clampNumber(value: number | undefined, defaultValue: number, min: number, max: number): number;
41
+ /**
42
+ * Read an environment variable as an integer
43
+ */
44
+ export declare function readEnvInt(key: string): number | undefined;
45
+ /**
46
+ * Chunk a string into smaller pieces
47
+ */
48
+ export declare function chunkString(input: string, limit?: number): string[];
49
+ /**
50
+ * Safely slice a string respecting UTF-16 surrogate pairs
51
+ */
52
+ export declare function sliceUtf16Safe(str: string, start: number, end?: number): string;
53
+ /**
54
+ * Truncate string in the middle with ellipsis
55
+ */
56
+ export declare function truncateMiddle(str: string, max: number): string;
57
+ /**
58
+ * Slice log lines with optional offset and limit
59
+ */
60
+ export declare function sliceLogLines(text: string, offset?: number, limit?: number): {
61
+ slice: string;
62
+ totalLines: number;
63
+ totalChars: number;
64
+ };
65
+ /**
66
+ * Derive a session name from a command
67
+ */
68
+ export declare function deriveSessionName(command: string): string | undefined;
69
+ /**
70
+ * Format duration in human-readable format
71
+ */
72
+ export declare function formatDuration(ms: number): string;
73
+ /**
74
+ * Pad a string to a minimum width
75
+ */
76
+ export declare function pad(str: string, width: number): string;
77
+ export type SpawnFallback = {
78
+ label: string;
79
+ options: SpawnOptions;
80
+ };
81
+ export type SpawnWithFallbackResult = {
82
+ child: ChildProcess;
83
+ usedFallback: boolean;
84
+ fallbackLabel?: string;
85
+ };
86
+ type SpawnWithFallbackParams = {
87
+ argv: string[];
88
+ options: SpawnOptions;
89
+ fallbacks?: SpawnFallback[];
90
+ spawnImpl?: typeof spawn;
91
+ retryCodes?: string[];
92
+ onFallback?: (err: unknown, fallback: SpawnFallback) => void;
93
+ };
94
+ /**
95
+ * Format a spawn error for display
96
+ */
97
+ export declare function formatSpawnError(err: unknown): string;
98
+ /**
99
+ * Spawn a process with fallback options on certain error codes
100
+ */
101
+ export declare function spawnWithFallback(params: SpawnWithFallbackParams): Promise<SpawnWithFallbackResult>;
102
+ export {};
103
+ //# sourceMappingURL=shellUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shellUtils.d.ts","sourceRoot":"","sources":["../../utils/shellUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,8BAA8B,EAC9B,YAAY,EACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AA4B3C;;GAEG;AACH,wBAAgB,cAAc,IAAI;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CA0BlE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAqBzD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAsBjD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE;IACnC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,8BAA8B,CAAC;CACxC,GAAG,IAAI,CAKP;AAED;;GAEG;AACH,wBAAgB,SAAS,CACvB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/C,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAWxB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAa1E;AAWD;;GAEG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GACV,MAAM,CAKR;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GA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CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAC;CAC9D,CAAC;AAIF;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAoBrD;AAmDD;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,uBAAuB,CAAC,CAkClC"}
@@ -0,0 +1,30 @@
1
+ export declare const TERMINAL_TOOL_NAMES: readonly ["sh", "git", "rg", "bun", "acpx", "codex", "claude", "opencode"];
2
+ export type TerminalToolName = (typeof TERMINAL_TOOL_NAMES)[number];
3
+ export interface ToolCapability {
4
+ name: TerminalToolName;
5
+ path?: string;
6
+ available: boolean;
7
+ }
8
+ export interface ShellResolution {
9
+ shell: string;
10
+ args: string[];
11
+ available: boolean;
12
+ source: "env:CODING_TOOLS_SHELL" | "env:SHELL" | "candidate" | "fallback";
13
+ warning?: string;
14
+ }
15
+ export type TerminalUnsupportedReason = "store_build" | "vanilla_mobile" | "not_local_yolo" | "missing_shell";
16
+ export interface TerminalSupport {
17
+ supported: boolean;
18
+ reason?: TerminalUnsupportedReason;
19
+ message?: string;
20
+ }
21
+ export declare function isAndroidRuntime(): boolean;
22
+ export declare function isAospTerminalRuntime(): boolean;
23
+ export declare function resolveExecutable(nameOrPath: string): string | undefined;
24
+ export declare function resolveTerminalShell(): ShellResolution;
25
+ export declare function detectTerminalCapabilities(): ToolCapability[];
26
+ export declare function formatTerminalCapabilities(capabilities?: ToolCapability[]): string;
27
+ export declare function missingToolMessage(tool: TerminalToolName): string;
28
+ export declare function missingTerminalToolForCommand(command: string): TerminalToolName | undefined;
29
+ export declare function detectTerminalSupport(): TerminalSupport;
30
+ //# sourceMappingURL=terminalCapabilities.d.ts.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AAM,GAAG,gBAAgB,GAAG,SAAS,CAa3F;AAED,wBAAgB,qBAAqB,IAAI,eAAe,CAyCvD"}
@@ -0,0 +1,3 @@
1
+ declare const _default: import("vite").UserConfig;
2
+ export default _default;
3
+ //# sourceMappingURL=vitest.config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest.config.d.ts","sourceRoot":"","sources":["../vitest.config.ts"],"names":[],"mappings":";AAGA,wBAaG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elizaos/plugin-shell",
3
- "version": "2.0.3-beta.2",
3
+ "version": "2.0.3-beta.3",
4
4
  "description": "Shell history and observability plugin for ElizaOS",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -28,6 +28,7 @@
28
28
  }
29
29
  },
30
30
  "files": [
31
+ "registry-entry.json",
31
32
  "dist",
32
33
  "auto-enable.ts"
33
34
  ],
@@ -50,8 +51,8 @@
50
51
  "author": "elizaOS",
51
52
  "license": "MIT",
52
53
  "dependencies": {
53
- "@elizaos/core": "2.0.3-beta.2",
54
- "@elizaos/shared": "2.0.3-beta.2",
54
+ "@elizaos/core": "2.0.3-beta.3",
55
+ "@elizaos/shared": "2.0.3-beta.3",
55
56
  "cross-spawn": "^7.0.6",
56
57
  "zod": "^4.4.3"
57
58
  },
@@ -148,5 +149,5 @@
148
149
  "node": "Default export (Node.js)"
149
150
  }
150
151
  },
151
- "gitHead": "82fe0f44215954c2417328203f5bd6510985c1fc"
152
+ "gitHead": "f54b0f4eaed317d59fa7dbcdce20f4cdb0734420"
152
153
  }
@@ -0,0 +1,94 @@
1
+ {
2
+ "id": "shell",
3
+ "name": "Shell",
4
+ "description": "A shell plugin for ElizaOS. USE AT YOUR OWN RISK. THIS GIVES AI FULL ACCESS TO THE HOST MACHINE",
5
+ "npmName": "@elizaos/plugin-shell",
6
+ "version": "2.0.0-beta.0",
7
+ "source": "bundled",
8
+ "tags": ["shell", "terminal", "command", "history"],
9
+ "config": {
10
+ "SHELL_ALLOWED_DIRECTORY": {
11
+ "type": "file-path",
12
+ "required": true,
13
+ "sensitive": false,
14
+ "label": "Allowed Directory",
15
+ "help": "The directory that shell commands are restricted to. Commands cannot execute outside this directory.",
16
+ "advanced": false
17
+ },
18
+ "SHELL_TIMEOUT": {
19
+ "type": "number",
20
+ "required": false,
21
+ "sensitive": false,
22
+ "default": "30000",
23
+ "label": "Timeout",
24
+ "help": "Maximum command execution timeout in milliseconds",
25
+ "advanced": false,
26
+ "min": 0,
27
+ "unit": "ms"
28
+ },
29
+ "SHELL_FORBIDDEN_COMMANDS": {
30
+ "type": "string",
31
+ "required": false,
32
+ "sensitive": false,
33
+ "label": "Forbidden Commands",
34
+ "help": "Comma-separated list of additional forbidden commands",
35
+ "advanced": false
36
+ },
37
+ "SHELL_MAX_OUTPUT_CHARS": {
38
+ "type": "number",
39
+ "required": false,
40
+ "sensitive": false,
41
+ "default": "200000",
42
+ "label": "Max Output Chars",
43
+ "help": "Maximum output characters to capture from commands",
44
+ "advanced": false
45
+ },
46
+ "SHELL_BACKGROUND_MS": {
47
+ "type": "number",
48
+ "required": false,
49
+ "sensitive": false,
50
+ "default": "10000",
51
+ "label": "Background Ms",
52
+ "help": "Default milliseconds to wait before backgrounding commands",
53
+ "advanced": false,
54
+ "min": 0,
55
+ "unit": "ms"
56
+ },
57
+ "SHELL_ALLOW_BACKGROUND": {
58
+ "type": "boolean",
59
+ "required": false,
60
+ "sensitive": false,
61
+ "default": "True",
62
+ "label": "Allow Background",
63
+ "help": "Whether to allow background command execution",
64
+ "advanced": false
65
+ },
66
+ "SHELL_JOB_TTL_MS": {
67
+ "type": "number",
68
+ "required": false,
69
+ "sensitive": false,
70
+ "default": "1800000",
71
+ "label": "Job Ttl Ms",
72
+ "help": "Time-to-live for finished session records in milliseconds",
73
+ "advanced": false,
74
+ "min": 0,
75
+ "unit": "ms"
76
+ }
77
+ },
78
+ "render": {
79
+ "visible": true,
80
+ "pinTo": [],
81
+ "style": "card",
82
+ "icon": "Shell",
83
+ "group": "devtools",
84
+ "groupOrder": 5,
85
+ "actions": ["enable", "configure"]
86
+ },
87
+ "resources": {
88
+ "homepage": "https://github.com/elizaos/eliza#readme",
89
+ "repository": "https://github.com/elizaos/eliza"
90
+ },
91
+ "dependsOn": [],
92
+ "kind": "plugin",
93
+ "subtype": "devtools"
94
+ }