pub struct ShellObservation {
pub source: String,
pub content: String,
}Expand description
One unit of shell activity the human produced beside the agent.
This is not a tool call (the agent didn’t run it) and not the
human’s instruction (they didn’t ask for anything) — it is ambient context.
Construct one per tap, then call into_mem_message
to fold it into the next turn’s context.
use newt_core::agentic::ShellObservation;
let obs = ShellObservation::new("zsh", "$ cargo test\n Compiling newt-core\n");
let msg = obs.into_mem_message();
assert_eq!(msg.role, newt_core::Role::User);
assert!(msg.content.contains("cargo test"));Fields§
§source: StringWhere the activity came from — a shell name ("zsh", "bash"), a tier
label ("typescript", "pty"), or any short tag the consumer chooses.
Purely descriptive; it is shown to the model verbatim (after trimming).
content: StringThe raw shell content the human produced (command line, output, or
both). Never rendered raw — redacted_content
scrubs credentials before it reaches a MemMessage.
Implementations§
Source§impl ShellObservation
impl ShellObservation
Sourcepub fn new(source: impl Into<String>, content: impl Into<String>) -> Self
pub fn new(source: impl Into<String>, content: impl Into<String>) -> Self
Build an observation from a source tag and raw shell content.
Sourcepub fn redacted_content(&self) -> String
pub fn redacted_content(&self) -> String
The observation content after credential redaction — the only form
allowed to leave this type. Runs the exact redact_secrets pass the
compression summarizer applies to its input, so an sk-… key, a GitHub
token, a Bearer … header, an AKIA… id, a JWT, a private-key block,
or a password=… assignment in shell output becomes [REDACTED] before
it can reach the model.
Sourcepub fn into_mem_message(self) -> MemMessage
pub fn into_mem_message(self) -> MemMessage
Render the (redacted) observation into a MemMessage ready to append
to the assembled message list before chat_complete.
The message carries the User role — the role a
human-originated turn uses — but its content opens with
SHELL_OBSERVATION_PREFIX so the model reads it as “here is what the
human just did,” never as a fresh instruction or a tool result. The
source tag is included for orientation; the body is the redacted
content.
Trait Implementations§
Source§impl Clone for ShellObservation
impl Clone for ShellObservation
Source§fn clone(&self) -> ShellObservation
fn clone(&self) -> ShellObservation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ShellObservation
impl Debug for ShellObservation
impl Eq for ShellObservation
Source§impl PartialEq for ShellObservation
impl PartialEq for ShellObservation
Source§fn eq(&self, other: &ShellObservation) -> bool
fn eq(&self, other: &ShellObservation) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ShellObservation
Auto Trait Implementations§
impl Freeze for ShellObservation
impl RefUnwindSafe for ShellObservation
impl Send for ShellObservation
impl Sync for ShellObservation
impl Unpin for ShellObservation
impl UnsafeUnpin for ShellObservation
impl UnwindSafe for ShellObservation
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more