Terminal Tool
Execute shell commands on the host system. Commands are run via sh -c.
Parameters
| Key | Type | Default | Description |
|---|---|---|---|
command | string | โ | The shell command to execute (required for action="run") |
action | string | "run" | One of: run, check, kill, trust_all |
pid | integer | โ | Process ID required for check/kill |
Approval Logic
A command is auto-approved only if both conditions are met:
- The command starts with a prefix in
terminal.allowed_prefixes - The command does not contain any shell operators
Shell Operators (always require approval)
text
; | && || $() ` (backticks)Default Allowed Prefixes
text
ls, cat, head, tail, echo, date, whoami, pwd, find, wc,
grep, tree, file, stat, uname, df, du, ps, which, env, printenvOutput
Returns stdout first, then stderr (if any). Output is truncated to terminal.max_output_chars (default 4000 characters).
Background Commands (New)
If a command exceeds the initial timeout, it moves to the background and returns a PID.
action="check"+pidshows partial/final outputaction="kill"+pidstops a running background command- Recent completed output is retained briefly so follow-up checks still work
Hard Safety Blocks (New)
Certain destructive patterns are now blocked before approval flow, including broad/sensitive rm -rf and find ... -delete targets.
Configuration
config.toml
[terminal]
allowed_prefixes = ["ls", "cat", "head", "tail", "echo", "date"]
initial_timeout_secs = 30
max_output_chars = 4000
permission_mode = "default"Allow Always (Persistent)
When the user clicks "Allow Always" in Telegram:
- The first word of the command is extracted as the prefix
- The prefix is added to the in-memory allowed list
- The prefix is persisted to SQLite (
terminal_allowed_prefixestable) - On restart, persisted prefixes are merged with config prefixes
This means "Allow Always" approvals survive daemon restarts without modifying config.toml.
Untrusted Sessions
Sessions from triggers (email, etc.) are flagged as untrusted. All commands in untrusted sessions require approval regardless of the whitelist.