Struct ShellProfile
pub struct ShellProfile {
pub name: String,
pub dialect: ShellDialect,
}Expand description
What the system prompt tells the model about the runtime’s shell: the interpreter’s name and the language it speaks.
Both halves come from the adapter that builds the command, so the name the model reads and the dialect the guidance is written for cannot disagree with each other or with what actually executes. The prompt layer renders this; it never re-derives the dialect by parsing the name.
Fields§
§name: StringInterpreter name as the operator configured it (bash, zsh, pwsh,
cmd), stripped of any directory prefix and .exe suffix.
dialect: ShellDialectLanguage that interpreter speaks. Never ShellDialect::None — a
shell-less runtime has no profile at all.
Implementations§
Source§impl ShellProfile
impl ShellProfile
Sourcepub fn from_dialect(dialect: ShellDialect) -> Option<Self>
pub fn from_dialect(dialect: ShellDialect) -> Option<Self>
Build the profile for an adapter whose interpreter is fixed by its
dialect, naming it canonically. Returns None for
ShellDialect::None so shell-less runtimes report no shell rather
than naming one they cannot spawn.
Adapters with a configurable interpreter should construct the profile directly instead, so the operator’s chosen name survives.
Sourcepub fn prompt_section(&self) -> String
pub fn prompt_section(&self) -> String
Render the ## Shell prompt section: the interpreter’s name plus the
command forms that dialect actually accepts.
Naming the shell alone leaves the model to recall the dialect’s syntax
from priors, which is where the same session emits Get-ChildItem on
one turn and dir /a on the next. The verbs listed are the ones a
first turn reaches for (list, read, find, search), chosen because a
mismatch there fails on syntax rather than on policy, and reads as an
ordinary command error the model retries in the same wrong dialect.
Each line states the form to use rather than enumerating the wrong
ones: naming a command is what steers, and the “not X, not Y” tails
cost tokens on every request to repeat what the correct form already
implies. POSIX gets a name and no list at all, since ls/cat/grep
are already what the model reaches for and the POSIX shells agree on
them. Deletion guidance lives in Self::safe_deletion_guidance,
which the Safety section renders whether or not this one does.
Sourcepub fn safe_deletion_guidance(&self) -> &'static str
pub fn safe_deletion_guidance(&self) -> &'static str
Return the Safety section’s deletion advice for this dialect.
trash is a POSIX-only convenience, so repeating “prefer trash over
rm” to a PowerShell or cmd.exe session names a command that is not
there and leaves the actually-destructive one unaddressed. Each dialect
gets the closest equivalent: PowerShell can preview with -WhatIf,
cmd.exe has no recoverable form and gets a confirm-first warning.
Trait Implementations§
Source§impl Clone for ShellProfile
impl Clone for ShellProfile
Source§fn clone(&self) -> ShellProfile
fn clone(&self) -> ShellProfile
1.0.0 (const: unstable) · §fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more