@elizaos/plugin-shell 2.0.0-beta.1 → 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.
package/README.md CHANGED
@@ -1,363 +1,111 @@
1
1
  # @elizaos/plugin-shell
2
2
 
3
- A comprehensive shell command execution plugin for ElizaOS with PTY support, background execution, session management, and security restrictions.
3
+ Shell command execution plugin for elizaOS. Adds sandboxed shell access, PTY support, background session management, command approval, and shell history to an Eliza agent.
4
4
 
5
- **Key Features:**
5
+ ## What it does
6
6
 
7
- - 🔄 **PTY Support** - Run interactive terminal applications with full pseudo-terminal support
8
- - ⏱️ **Background Execution** - Long-running commands automatically background with session management
9
- - 📋 **Session Management** - Track, poll, and interact with running processes
10
- - 🔒 **Security First** - Directory restrictions, forbidden commands, and timeout protection
11
- - 📝 **Command History** - Per-conversation command tracking
7
+ - Executes shell commands restricted to a configured directory (`SHELL_ALLOWED_DIRECTORY`).
8
+ - Supports interactive terminal applications via PTY (`@lydell/node-pty`, optional).
9
+ - Runs long commands in the background with named sessions; poll, send-keys, paste, and kill them later.
10
+ - Maintains per-conversation command history with stdout/stderr/exit-code capture.
11
+ - Provides the `SHELL_HISTORY` context provider so the agent always knows its cwd and recent commands.
12
+ - Provides `ExecApprovalService` to gate commands through an allowlist and user-approval flow.
12
13
 
13
- **Available in three languages:**
14
-
15
- - 🟦 **TypeScript** - Primary implementation for Node.js (full feature support)
16
- - 🐍 **Python** - Native Python implementation
17
- - 🦀 **Rust** - High-performance Rust implementation
18
-
19
- ## 🚨 TL;DR - Quick Setup
20
-
21
- **Just want your agent to execute commands? Here's the fastest path:**
22
-
23
- 1. **Install the plugin**:
24
-
25
- ```bash
26
- cd your-eliza-project
27
- bun add @elizaos/plugin-shell
28
- ```
29
-
30
- 2. **Create/update your `.env`**:
31
-
32
- ```bash
33
- SHELL_ALLOWED_DIRECTORY=/path/to/safe/directory
34
- ```
35
-
36
- 3. **Add to your character**:
37
-
38
- ```typescript
39
- const character = {
40
- // ... other config
41
- plugins: ["@elizaos/plugin-shell"],
42
- };
43
- ```
44
-
45
- 4. **Run:** `bun start`
46
-
47
- ⚠️ **Security note:** The agent can ONLY execute commands within `SHELL_ALLOWED_DIRECTORY` - choose wisely!
48
-
49
- ## Features
50
-
51
- ### Core Features
52
- - ✅ **Cross-platform support**: Works on Linux, macOS, and Windows
53
- - ✅ **Directory restriction**: Commands are restricted to a specified directory for safety
54
- - ✅ **Command filtering**: Configurable list of forbidden commands
55
- - ✅ **Timeout protection**: Automatic termination of long-running commands
56
- - ✅ **Command history**: Tracks command execution history per conversation
57
- - ✅ **File operation tracking**: Monitors file creation, modification, and deletion
58
- - ✅ **Shell context provider**: Provides command history and working directory to agent context
59
- - ✅ **Output capture**: Returns both stdout and stderr from executed commands
60
- - ✅ **Safety first**: Disabled by default, requires explicit enabling
61
-
62
- ### Advanced Features (TypeScript)
63
- - ✅ **PTY Support**: Run interactive terminal applications (vim, htop, etc.) with `@lydell/node-pty`
64
- - ✅ **Background Execution**: Commands automatically background after configurable yield window
65
- - ✅ **Session Management**: Track running/finished sessions, poll output, send keys
66
- - ✅ **Process Control**: List, poll, log, write, send-keys, submit, paste, kill, clear, remove
67
- - ✅ **Output Truncation**: Configurable max output with intelligent truncation
68
- - ✅ **Platform-specific Shell**: Auto-detects shell (bash, sh, PowerShell on Windows)
69
-
70
- ## Project Structure
71
-
72
- ```
73
- plugin-shell/
74
- ├── typescript/ # TypeScript implementation
75
- │ ├── actions/ # EXECUTE_COMMAND, CLEAR_SHELL_HISTORY
76
- │ ├── providers/ # SHELL_HISTORY provider
77
- │ ├── services/ # ShellService
78
- │ ├── utils/ # Path validation, security checks
79
- │ ├── types/ # Type definitions
80
- │ └── __tests__/ # Unit tests
81
- ├── python/ # Python implementation
82
- │ ├── elizaos_plugin_shell/
83
- │ │ ├── service.py # ShellService
84
- │ │ ├── path_utils.py
85
- │ │ └── types.py
86
- │ └── tests/ # Python tests
87
- ├── rust/ # Rust implementation
88
- │ ├── src/
89
- │ │ ├── lib.rs
90
- │ │ ├── service.rs # ShellService
91
- │ │ ├── path_utils.rs
92
- │ │ └── types.rs
93
- │ └── tests/ # Integration tests
94
- └── package.json # NPM package config
95
- ```
14
+ The agent-facing `SHELL` action that exposes shell execution is in `@elizaos/plugin-coding-tools`, which consumes this plugin's services. Its `action` parameter (list/poll/kill/etc.) drives `ShellService.processAction()`.
96
15
 
97
16
  ## Installation
98
17
 
99
- ### TypeScript (Node.js)
100
-
101
18
  ```bash
102
- # Using bun (recommended)
103
19
  bun add @elizaos/plugin-shell
104
-
105
- # Using npm
106
- npm install @elizaos/plugin-shell
107
20
  ```
108
- ## Configuration
109
21
 
110
- Set the following environment variables:
22
+ ## Configuration
111
23
 
112
24
  ```bash
113
- # Set the allowed directory (commands can only run here)
114
- SHELL_ALLOWED_DIRECTORY=/home/user/safe-workspace
25
+ # Required commands cannot execute outside this directory
26
+ SHELL_ALLOWED_DIRECTORY=/path/to/safe/workspace
27
+
28
+ # Optional
29
+ SHELL_TIMEOUT=30000 # per-command timeout ms (simple executeCommand)
30
+ SHELL_FORBIDDEN_COMMANDS=rm,mv # comma-separated additions to the default blocklist
31
+ SHELL_MAX_OUTPUT_CHARS=200000 # max captured output chars per session
32
+ SHELL_BACKGROUND_MS=10000 # yield window before auto-backgrounding (ms)
33
+ SHELL_ALLOW_BACKGROUND=true # set "false" to disable background execution
34
+ SHELL_JOB_TTL_MS=1800000 # finished session record TTL (ms)
35
+ ```
115
36
 
116
- # OPTIONAL: Set custom timeout in milliseconds (default: 30000)
117
- SHELL_TIMEOUT=60000
37
+ `SHELL_ALLOWED_DIRECTORY` must point to an existing directory. The service throws at start if it is missing.
118
38
 
119
- # OPTIONAL: Add additional forbidden commands (comma-separated)
120
- SHELL_FORBIDDEN_COMMANDS=rm,mv,cp,chmod,chown,shutdown,reboot
39
+ ## Enabling
121
40
 
122
- # OPTIONAL: Maximum output characters to capture (default: 200000)
123
- SHELL_MAX_OUTPUT_CHARS=200000
41
+ Auto-enabled when `config.features.shell` is truthy. Not available on iOS, `ELIZA_BUILD_VARIANT=store` builds, or Android unless `ELIZA_RUNTIME_MODE=local-yolo`.
124
42
 
125
- # OPTIONAL: Milliseconds before backgrounding (default: 10000)
126
- SHELL_BACKGROUND_MS=10000
43
+ To enable explicitly in a character file:
127
44
 
128
- # OPTIONAL: Allow background execution (default: true)
129
- SHELL_ALLOW_BACKGROUND=true
45
+ ```typescript
46
+ import shellPlugin from "@elizaos/plugin-shell";
130
47
 
131
- # OPTIONAL: Session record TTL in milliseconds (default: 1800000 = 30min)
132
- SHELL_JOB_TTL_MS=1800000
48
+ const character = {
49
+ plugins: [shellPlugin],
50
+ };
133
51
  ```
134
52
 
135
- ## Usage Examples
53
+ ## Security
136
54
 
137
- ### TypeScript
55
+ - All commands execute within `SHELL_ALLOWED_DIRECTORY`. Path traversal and absolute paths outside the boundary are rejected.
56
+ - A built-in blocklist prevents the most destructive commands (see `DEFAULT_FORBIDDEN_COMMANDS` in `utils/config.ts`).
57
+ - Additional forbidden commands can be added via `SHELL_FORBIDDEN_COMMANDS`.
58
+ - Commands time out automatically. Output is capped at `SHELL_MAX_OUTPUT_CHARS`.
59
+ - `ExecApprovalService` can gate commands through an allowlist + user approval before execution.
60
+ - Local execution is disabled in cloud mode (`isCloudExecutionMode`).
138
61
 
139
- ```typescript
140
- import { shellPlugin, ShellService } from "@elizaos/plugin-shell";
62
+ ## Process actions
141
63
 
142
- // Use as a plugin
143
- const character = {
144
- plugins: [shellPlugin],
145
- };
64
+ Background sessions support these operations via `ShellService.processAction()`:
65
+
66
+ | Action | Description |
67
+ |---|---|
68
+ | `list` | List all running and finished sessions |
69
+ | `poll` | Drain new output from a running session |
70
+ | `log` | Read session output with offset/limit pagination |
71
+ | `write` | Write raw data to session stdin |
72
+ | `send-keys` | Send terminal key sequences (arrows, ctrl+c, etc.) |
73
+ | `submit` | Send carriage return (Enter) |
74
+ | `paste` | Paste text with bracketed paste mode |
75
+ | `kill` | Kill a running session |
76
+ | `clear` | Remove a finished session record |
77
+ | `remove` | Kill (if running) and remove a session |
78
+
79
+ ## Usage from code
146
80
 
147
- // Or use the service directly
148
- const service = new ShellService(runtime);
149
- const result = await service.executeCommand("ls -la", "conversation-123");
81
+ ```typescript
82
+ import { ShellService } from "@elizaos/plugin-shell";
83
+
84
+ // Simple synchronous execution
85
+ const shellService = runtime.getService<ShellService>("shell");
86
+ const result = await shellService.executeCommand("ls -la", conversationId);
150
87
 
151
- // Advanced: Use exec with PTY and background support
152
- const execResult = await service.exec("npm install", {
153
- pty: true, // Run with pseudo-terminal
154
- background: false, // Or yieldMs: 5000 to auto-background after 5s
155
- timeout: 300, // 5 minute timeout
88
+ // Advanced: PTY + background
89
+ const execResult = await shellService.exec("bun install", {
90
+ pty: true,
91
+ yieldMs: 5000, // background after 5 s if still running
92
+ timeout: 300, // 5-minute hard timeout (seconds)
156
93
  workdir: "/project",
157
94
  });
158
95
 
159
96
  if (execResult.status === "running") {
160
- console.log(`Background session: ${execResult.sessionId}`);
161
-
162
- // Poll for updates
163
- const pollResult = await service.processAction({
97
+ // Poll later
98
+ const poll = await shellService.processAction({
164
99
  action: "poll",
165
100
  sessionId: execResult.sessionId,
166
101
  });
167
- console.log(pollResult.message);
168
102
  }
169
-
170
- // Get the service from an Eliza agent runtime
171
- const shellService = runtime.getService<ShellService>("shell");
172
103
  ```
173
- ## 📋 Available Actions
174
-
175
- ### EXECUTE_COMMAND
176
-
177
- Executes ANY shell command within the allowed directory, including file operations.
178
-
179
- **Examples:**
180
-
181
- - `run ls -la` - List files with details
182
- - `execute npm test` - Run tests
183
- - `create a file called hello.txt` - Creates a new file
184
- - `check git status` - Show git repository status
185
-
186
- ### MANAGE_PROCESS
187
-
188
- Manage running and finished shell sessions. Supports the following operations:
189
104
 
190
- | Action | Description |
191
- |-------------|------------------------------------------------|
192
- | `list` | List all running and finished sessions |
193
- | `poll` | Get new output from a running session |
194
- | `log` | Get session output with offset/limit |
195
- | `write` | Write data to session stdin |
196
- | `send-keys` | Send terminal key sequences (arrows, ctrl, etc)|
197
- | `submit` | Send carriage return (Enter) |
198
- | `paste` | Paste text with bracketed paste mode |
199
- | `kill` | Kill a running session |
200
- | `clear` | Clear a finished session record |
201
- | `remove` | Kill (if running) and remove session |
202
-
203
- **Examples:**
204
-
205
- - `list all running processes`
206
- - `check session calm-harbor`
207
- - `kill the process swift-reef`
208
- - `send enter to session brisk-cove`
209
-
210
- ### CLEAR_SHELL_HISTORY
211
-
212
- Clears the command history for the current conversation.
213
-
214
- **Examples:**
215
-
216
- - `clear my shell history`
217
- - `reset the terminal history`
218
-
219
- ## 🧠 Shell History Provider
220
-
221
- The plugin includes a `SHELL_HISTORY` provider that makes the following information available to the agent:
222
-
223
- - **Recent Commands**: Last 10 executed commands with their outputs
224
- - **Current Working Directory**: The current directory within the allowed path
225
- - **Allowed Directory**: The configured safe directory boundary
226
- - **File Operations**: Recent file creation, modification, and deletion operations
227
-
228
- ## 🔒 Security Considerations
229
-
230
- ### Directory Restriction
231
-
232
- All commands execute within `SHELL_ALLOWED_DIRECTORY`:
233
-
234
- - Attempts to navigate outside are blocked
235
- - Absolute paths outside the boundary are rejected
236
- - `cd ..` stops at the allowed directory root
237
-
238
- ### Forbidden Commands
239
-
240
- By default, these potentially dangerous commands are blocked:
241
-
242
- - **Destructive**: `rm -rf /`, `rmdir`
243
- - **Permission changes**: `chmod 777`, `chown`, `chgrp`
244
- - **System operations**: `shutdown`, `reboot`, `halt`, `poweroff`
245
- - **Process control**: `kill -9`, `killall`, `pkill`
246
- - **User management**: `sudo rm -rf`, `su`, `passwd`, `useradd`, `userdel`
247
- - **Disk operations**: `format`, `fdisk`, `mkfs`, `dd if=/dev/zero`, `shred`
248
-
249
- ### Additional Safety Features
250
-
251
- - **No Shell Expansion**: Commands execute without dangerous shell interpretation
252
- - **Timeout Protection**: Commands auto-terminate after timeout
253
- - **Command History**: All executed commands are logged for audit
254
- - **Path Traversal Protection**: Blocks `../` and similar patterns
255
-
256
- ## 🧪 Development & Testing
257
-
258
- ### TypeScript
105
+ ## Development
259
106
 
260
107
  ```bash
261
- cd typescript
262
- bun run build.ts # Build
263
- npx vitest # Run tests
108
+ bun run --cwd plugins/plugin-shell build # build dist/
109
+ bun run --cwd plugins/plugin-shell test # vitest
110
+ bun run --cwd plugins/plugin-shell dev # hot-reload build
264
111
  ```
265
- ### All Languages
266
-
267
- ```bash
268
- # From plugin root
269
- bun run build # Build TypeScript
270
- bun run build:python # Build Python
271
- bun run build:rust # Build Rust
272
- bun run test # Test TypeScript
273
- bun run test:python # Test Python
274
- bun run test:rust # Test Rust
275
- ```
276
-
277
- ## 📖 API Reference
278
-
279
- ### CommandResult
280
-
281
- | Field | Type | Description |
282
- | ------------ | ------------------- | ----------------------------------------- |
283
- | `success` | boolean | Whether the command executed successfully |
284
- | `stdout` | string | Standard output from the command |
285
- | `stderr` | string | Standard error output |
286
- | `exitCode` | number \| null | Exit code of the command |
287
- | `error` | string \| undefined | Error message if command failed |
288
- | `executedIn` | string | Directory where command was executed |
289
-
290
- ### FileOperation
291
-
292
- | Field | Type | Description |
293
- | ----------------- | ------------------- | ------------------------------------------------------------------ |
294
- | `type` | FileOperationType | Type of operation (create, write, read, delete, mkdir, move, copy) |
295
- | `target` | string | Target file/directory path |
296
- | `secondaryTarget` | string \| undefined | Secondary target for move/copy |
297
-
298
- ### ShellConfig
299
-
300
- | Field | Type | Default | Description |
301
- | ----------------------- | -------- | -------- | ------------------------------------ |
302
- | `enabled` | boolean | false | Whether shell is enabled |
303
- | `allowedDirectory` | string | cwd | Directory to restrict commands to |
304
- | `timeout` | number | 30000 | Timeout in milliseconds |
305
- | `forbiddenCommands` | string[] | [...] | List of forbidden commands |
306
- | `maxOutputChars` | number | 200000 | Max output characters to capture |
307
- | `pendingMaxOutputChars` | number | 200000 | Max pending output per stream |
308
- | `defaultBackgroundMs` | number | 10000 | Default background yield window |
309
- | `allowBackground` | boolean | true | Allow background execution |
310
-
311
- ### ProcessSession
312
-
313
- | Field | Type | Description |
314
- | --------------------- | ----------------------- | ------------------------------------- |
315
- | `id` | string | Unique session identifier (slug) |
316
- | `command` | string | The executed command |
317
- | `pid` | number \| undefined | Process ID |
318
- | `startedAt` | number | Start timestamp |
319
- | `cwd` | string \| undefined | Working directory |
320
- | `aggregated` | string | Accumulated output |
321
- | `tail` | string | Last 2000 chars of output |
322
- | `exited` | boolean | Whether process has exited |
323
- | `exitCode` | number \| null | Exit code (if exited) |
324
- | `exitSignal` | string \| number \| null| Exit signal (if killed) |
325
- | `truncated` | boolean | Whether output was truncated |
326
- | `backgrounded` | boolean | Whether running in background |
327
-
328
- ### ExecResult
329
-
330
- ```typescript
331
- type ExecResult =
332
- | { status: "running"; sessionId: string; pid?: number; startedAt: number; cwd?: string; tail?: string }
333
- | { status: "completed" | "failed"; exitCode: number | null; durationMs: number; aggregated: string; cwd?: string; timedOut?: boolean; reason?: string }
334
- ```
335
-
336
- ### ExecuteOptions
337
-
338
- | Field | Type | Description |
339
- | --------------- | --------------------------- | ------------------------------------- |
340
- | `workdir` | string | Working directory |
341
- | `env` | Record<string, string> | Additional environment variables |
342
- | `yieldMs` | number | Yield to background after this time |
343
- | `background` | boolean | Run immediately in background |
344
- | `timeout` | number | Timeout in seconds |
345
- | `pty` | boolean | Use pseudo-terminal |
346
- | `conversationId`| string | Conversation ID for history tracking |
347
- | `scopeKey` | string | Scope key for session isolation |
348
- | `sessionKey` | string | Session key for notifications |
349
- | `notifyOnExit` | boolean | Notify on background exit |
350
- | `onUpdate` | (session) => void | Callback for output updates |
351
-
352
- ## 🤝 Contributing
353
-
354
- Contributions are welcome! Please ensure:
355
-
356
- 1. All three language implementations stay in feature parity
357
- 2. Tests pass for all languages
358
- 3. Follow the code style of each language
359
- 4. Update documentation as needed
360
-
361
- ## 📝 License
362
-
363
- MIT - See [LICENSE](./LICENSE) for details.
package/auto-enable.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  import type { PluginAutoEnableContext } from "@elizaos/core";
8
8
 
9
9
  function isFeatureEnabled(config: PluginAutoEnableContext["config"], key: string): boolean {
10
- const f = (config?.features as Record<string, unknown> | undefined)?.[key];
10
+ const f = (config.features as Record<string, unknown> | undefined)?.[key];
11
11
  if (f === true) return true;
12
12
  if (f && typeof f === "object" && f !== null) {
13
13
  return (f as Record<string, unknown>).enabled !== false;
@@ -15,7 +15,23 @@ function isFeatureEnabled(config: PluginAutoEnableContext["config"], key: string
15
15
  return false;
16
16
  }
17
17
 
18
+ function terminalSupportedByEnv(ctx: PluginAutoEnableContext): boolean {
19
+ const env = ctx.env;
20
+ const variant = (env.ELIZA_BUILD_VARIANT ?? "").trim().toLowerCase();
21
+ if (variant === "store") return false;
22
+
23
+ const platform = env.ELIZA_PLATFORM?.trim().toLowerCase();
24
+ const mobile =
25
+ platform === "android" || platform === "ios" || Boolean(env.ANDROID_ROOT || env.ANDROID_DATA);
26
+ if (!mobile) return true;
27
+
28
+ const mode = (env.ELIZA_RUNTIME_MODE ?? env.RUNTIME_MODE ?? env.LOCAL_RUNTIME_MODE ?? "")
29
+ .trim()
30
+ .toLowerCase();
31
+ return platform === "android" && mode === "local-yolo";
32
+ }
33
+
18
34
  /** Enable when `config.features.shell` is truthy / not explicitly disabled. */
19
35
  export function shouldEnable(ctx: PluginAutoEnableContext): boolean {
20
- return isFeatureEnabled(ctx.config, "shell");
36
+ return isFeatureEnabled(ctx.config, "shell") && terminalSupportedByEnv(ctx);
21
37
  }
@@ -1 +1 @@
1
- {"version":3,"file":"allowlist.d.ts","sourceRoot":"","sources":["../../approvals/allowlist.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,KAAK,EACV,iBAAiB,EACjB,kBAAkB,EAElB,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,OAAO,EACP,YAAY,EACb,MAAM,SAAS,CAAC;AAgCjB;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED;;GAEG;AACH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CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,qBAAqB,CAoDxB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,kBAAkB,EAAE,EAC7B,UAAU,EAAE,iBAAiB,GAAG,IAAI,GACnC,kBAAkB,GAAG,IAAI,CAoB3B;AAqFD;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,iBAAiB,EAC5B,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,KAAK,EAAE,kBAAkB,EACzB,OAAO,EAAE,MAAM,EACf,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CA+BT;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,iBAAiB,EAC5B,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,EAAE,MAAM,GACd,OAAO,CAwCT;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,GAAG,YAAY,CAO1E;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAGtD"}
@@ -1 +1 @@
1
- {"version":3,"file":"auto-enable.d.ts","sourceRoot":"","sources":["../auto-enable.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAW7D,+EAA+E;AAC/E,wBAAgB,YAAY,CAAC,GAAG,EAAE,uBAAuB,GAAG,OAAO,CAElE"}
1
+ {"version":3,"file":"auto-enable.d.ts","sourceRoot":"","sources":["../auto-enable.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AA2B7D,+EAA+E;AAC/E,wBAAgB,YAAY,CAAC,GAAG,EAAE,uBAAuB,GAAG,OAAO,CAElE"}
@@ -19,21 +19,11 @@ export type ProviderDoc = {
19
19
  };
20
20
  export declare const coreActionsSpec: {
21
21
  readonly version: "1.0.0";
22
- readonly actions: readonly [{
23
- readonly name: "CLEAR_SHELL_HISTORY";
24
- readonly description: "Clears the recorded history of shell commands for the current conversation";
25
- readonly similes: readonly ["RESET_SHELL", "CLEAR_TERMINAL", "CLEAR_HISTORY", "RESET_HISTORY"];
26
- readonly parameters: readonly [];
27
- }];
22
+ readonly actions: readonly [];
28
23
  };
29
24
  export declare const allActionsSpec: {
30
25
  readonly version: "1.0.0";
31
- readonly actions: readonly [{
32
- readonly name: "CLEAR_SHELL_HISTORY";
33
- readonly description: "Clears the recorded history of shell commands for the current conversation";
34
- readonly similes: readonly ["RESET_SHELL", "CLEAR_TERMINAL", "CLEAR_HISTORY", "RESET_HISTORY"];
35
- readonly parameters: readonly [];
36
- }];
26
+ readonly actions: readonly [];
37
27
  };
38
28
  export declare const coreProvidersSpec: {
39
29
  readonly version: "1.0.0";
@@ -1 +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,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,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,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC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;AACX,eAAO,MAAM,gBAAgB;;;;;;;CAUnB,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"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import type { Plugin } from "@elizaos/core";
2
2
  export declare const shellPlugin: Plugin;
3
3
  export default shellPlugin;
4
- export { clearHistory } from "./actions/clearHistory";
5
4
  export { addAllowlistEntry, analyzeShellCommand, type CommandCheckResult, type CommandResolution, DEFAULT_SAFE_BINS, EXEC_APPROVAL_DEFAULTS, type ExecAllowlistAnalysis, type ExecAllowlistEntry, type ExecAllowlistEvaluation, type ExecApprovalDecision, type ExecApprovalRequest, type ExecApprovalResult, ExecApprovalService, type ExecApprovalsAgent, type ExecApprovalsDefaults, type ExecApprovalsFile, type ExecApprovalsResolved, type ExecApprovalsSnapshot, type ExecAsk, type ExecCommandAnalysis, type ExecCommandSegment, type ExecHost, type ExecSecurity, ensureApprovals, evaluateExecAllowlist, evaluateShellAllowlist, getApprovalFilePath, getApprovalSocketPath, isSafeBinUsage, loadApprovals, matchAllowlist, maxAsk, minSecurity, normalizeApprovals, normalizeSafeBins, readApprovalsSnapshot, recordAllowlistUse, requiresExecApproval, resolveApprovals, resolveApprovalsFromFile, resolveCommandFromArgv, resolveCommandResolution, resolveSafeBins, saveApprovals, } from "./approvals";
6
5
  export { shellHistoryProvider } from "./providers/shellHistoryProvider";
7
6
  export { addSession, appendOutput, clearFinished, createSessionSlug, deleteSession, drainSession, getFinishedSession, getSession, listFinishedSessions, listRunningSessions, markBackgrounded, markExited, resetProcessRegistryForTests, setJobTtlMs, tail, trimWithCap, } from "./services/processRegistry";
@@ -10,4 +9,5 @@ export type { CommandHistoryEntry, CommandResult, ExecResult, ExecuteOptions, Fi
10
9
  export { DEFAULT_FORBIDDEN_COMMANDS, extractBaseCommand, isForbiddenCommand, isSafeCommand, loadShellConfig, validatePath, } from "./utils";
11
10
  export { BRACKETED_PASTE_END, BRACKETED_PASTE_START, buildCursorPositionResponse, encodeKeySequence, encodePaste, type KeyEncodingRequest, type KeyEncodingResult, stripDsrRequests, } from "./utils/ptyKeys";
12
11
  export { chunkString, clampNumber, coerceEnv, deriveSessionName, formatDuration, formatSpawnError, getShellConfig, killProcessTree, killSession, pad, readEnvInt, resolveWorkdir, type SpawnFallback, type SpawnWithFallbackResult, sanitizeBinaryOutput, sliceLogLines, sliceUtf16Safe, spawnWithFallback, truncateMiddle, } from "./utils/shellUtils";
12
+ export { detectTerminalCapabilities, formatTerminalCapabilities, isAndroidRuntime, missingTerminalToolForCommand, missingToolMessage, resolveExecutable, resolveTerminalShell, type ShellResolution, TERMINAL_TOOL_NAMES, type TerminalToolName, type ToolCapability, } from "./utils/terminalCapabilities";
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAM5C,eAAO,MAAM,WAAW,EAAE,MAgBzB,CAAC;AAEF,eAAe,WAAW,CAAC;AAG3B,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGtD,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,iBAAiB,EACjB,sBAAsB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,mBAAmB,EACnB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB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AAK,iBAAiB,EACtB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,WAAW,EACX,WAAW,EACX,SAAS,EACT,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,WAAW,EACX,GAAG,EACH,UAAU,EACV,cAAc,EACd,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAC5B,oBAAoB,EACpB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,cAAc,GACf,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAkB5C,eAAO,MAAM,WAAW,EAAE,MAuBzB,CAAC;AAEF,eAAe,WAAW,CAAC;AAG3B,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,iBAAiB,EACjB,sBAAsB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,mBAAmB,EACnB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,OAAO,EACZ,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,aAAa,EACb,cAAc,EACd,MAAM,EACN,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,wBAAwB,EACxB,sBAAsB,EACtB,wBAAwB,EACxB,eA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