pub enum ScriptCommand {
WriteText {
text: String,
},
Notify {
title: String,
body: String,
},
SetBadge {
text: String,
},
SetVariable {
name: String,
value: String,
},
RunCommand {
command: String,
},
ChangeConfig {
key: String,
value: Value,
},
Log {
level: String,
message: String,
},
SetPanel {
title: String,
content: String,
},
ClearPanel {},
SetOverlay {
id: String,
position: OverlayPosition,
size: OverlaySize,
opacity: f32,
interactive: bool,
content: OverlayScene,
},
ClearOverlay {
id: String,
},
SetWidget {
text: String,
},
}Expand description
A command sent from a script subprocess to the terminal (via stdout).
Tagged with type for easy JSON dispatch.
Variants§
WriteText
Write text to the PTY.
Notify
Show a desktop notification.
SetBadge
Set the tab badge text.
SetVariable
Set a user variable.
RunCommand
Execute a shell command.
ChangeConfig
Change a configuration value.
Log
Log a message.
Fields
SetPanel
Set a markdown panel.
ClearPanel
Clear the markdown panel.
SetOverlay
Upsert a plugin-owned overlay surface (overlay kind only). Idempotent
by id: same id replaces the whole overlay. Phase 1 is display-only —
the host forces interactive off pending the manifest capability.
Fields
position: OverlayPositionPosition: a named anchor or a free rect (fractions of window).
size: OverlaySizeSize as fractions of the window (0.0–1.0).
content: OverlaySceneScene to render (declarative tree).
ClearOverlay
Clear a plugin-owned overlay by id (overlay kind only).
SetWidget
Set the text of a plugin-provided status-bar widget.
Display-only and plugin-sourced: no permission flag exists for it
because a widget’s text is strictly less powerful than SetBadge
(which scripts already send unrestricted). A tab script emitting
this command gets an error line in its output pane — the plugin host
is the only consumer.
Implementations§
Source§impl ScriptCommand
impl ScriptCommand
Sourcepub fn requires_permission(&self) -> bool
pub fn requires_permission(&self) -> bool
Returns true if this command requires explicit permission in the script config.
Commands that return true must have their corresponding allow_* flag set
in ScriptConfig before the dispatcher will execute them.
§Security Classification
| Command | Requires Permission | Risk Level |
|---|---|---|
Log | No | Low (UI output only) |
SetPanel / ClearPanel | No | Low (UI display only) |
Notify | No | Low (desktop notification) |
SetBadge | No | Low (tab badge display) |
SetVariable | No | Low (user variable storage) |
WriteText | Yes | High (PTY injection, command execution) |
RunCommand | Yes | Critical (arbitrary process spawn) |
ChangeConfig | Yes | High (config modification) |
Sourcepub fn permission_flag_name(&self) -> Option<&'static str>
pub fn permission_flag_name(&self) -> Option<&'static str>
Returns the name of the permission flag required to execute this command.
Returns None for commands that don’t require permission.
The returned string corresponds to a field in ScriptConfig:
"allow_run_command"forRunCommand"allow_write_text"forWriteText"allow_change_config"forChangeConfig
Sourcepub fn is_rate_limited(&self) -> bool
pub fn is_rate_limited(&self) -> bool
Returns true if this command can safely be executed without rate limiting.
Commands that may be emitted frequently (like Log) should not be rate-limited
to avoid dropping important debug output. High-impact commands (WriteText,
RunCommand) must be rate-limited to prevent abuse.
Sourcepub fn command_name(&self) -> &'static str
pub fn command_name(&self) -> &'static str
Returns a human-readable name for this command type (for logging/errors).
Trait Implementations§
Source§impl Clone for ScriptCommand
impl Clone for ScriptCommand
Source§impl Debug for ScriptCommand
impl Debug for ScriptCommand
Source§impl<'de> Deserialize<'de> for ScriptCommand
impl<'de> Deserialize<'de> for ScriptCommand
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ScriptCommand
impl PartialEq for ScriptCommand
Source§impl Serialize for ScriptCommand
impl Serialize for ScriptCommand
impl StructuralPartialEq for ScriptCommand
Auto Trait Implementations§
impl Freeze for ScriptCommand
impl RefUnwindSafe for ScriptCommand
impl Send for ScriptCommand
impl Sync for ScriptCommand
impl Unpin for ScriptCommand
impl UnsafeUnpin for ScriptCommand
impl UnwindSafe for ScriptCommand
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.