pub struct Scratchpad { /* private fields */ }Expand description
Adds bounded durable notes without exposing persistence details to the agent loop.
Implementations§
Source§impl Scratchpad
impl Scratchpad
Sourcepub fn new(store: ScratchpadStore) -> Self
pub fn new(store: ScratchpadStore) -> Self
Creates scratchpad middleware backed by a shared concrete store.
Trait Implementations§
Source§impl Clone for Scratchpad
impl Clone for Scratchpad
Source§fn clone(&self) -> Scratchpad
fn clone(&self) -> Scratchpad
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Middleware for Scratchpad
impl Middleware for Scratchpad
Source§fn register(
&self,
catalog: &mut Catalog,
runtime: &RuntimeContext,
) -> Result<()>
fn register( &self, catalog: &mut Catalog, runtime: &RuntimeContext, ) -> Result<()>
Adds tools to the catalog while the agent is created.
Source§fn prompt_fragment(&self, _runtime: &RuntimeContext) -> Result<Option<String>>
fn prompt_fragment(&self, _runtime: &RuntimeContext) -> Result<Option<String>>
Contributes immutable system instructions once while the agent is created.
Source§fn frontend(&self) -> FrontendContribution
fn frontend(&self) -> FrontendContribution
Declares commands and status data that any frontend may render.
Source§fn render(&self, event: &EventMsg) -> Option<FrontendBlock>
fn render(&self, event: &EventMsg) -> Option<FrontendBlock>
Renders an event owned by this capability for thin frontend shells.
Source§fn initialize<'a>(
&'a self,
context: RuntimeContext,
) -> BoxFuture<'a, Result<()>>
fn initialize<'a>( &'a self, context: RuntimeContext, ) -> BoxFuture<'a, Result<()>>
Restores middleware-owned durable state for this agent tree.
Source§fn command<'a>(
&'a self,
context: MiddlewareCommandContext<'a>,
) -> BoxFuture<'a, Result<MiddlewareCommandOutput>>
fn command<'a>( &'a self, context: MiddlewareCommandContext<'a>, ) -> BoxFuture<'a, Result<MiddlewareCommandOutput>>
Handles a command declared by this middleware’s frontend contribution.
Source§fn decorate_model_request<'a>(
&'a self,
context: &'a mut ModelContext<'_>,
) -> BoxFuture<'a, Result<()>>
fn decorate_model_request<'a>( &'a self, context: &'a mut ModelContext<'_>, ) -> BoxFuture<'a, Result<()>>
Applies request-only context after every durable transform has completed.
Source§fn active_operations(&self) -> &'static [&'static str]
fn active_operations(&self) -> &'static [&'static str]
Declares active-turn operations owned by this middleware.
Source§fn active_submission(
&self,
_context: &mut ActiveSubmissionContext<'_>,
) -> Result<ActiveSubmissionResult>
fn active_submission( &self, _context: &mut ActiveSubmissionContext<'_>, ) -> Result<ActiveSubmissionResult>
Handles one declared active-turn operation.
Source§fn active_command(
&self,
_context: &mut ActiveCommandContext<'_>,
) -> Result<Option<ActiveSubmissionResult>>
fn active_command( &self, _context: &mut ActiveCommandContext<'_>, ) -> Result<Option<ActiveSubmissionResult>>
Handles a capability command synchronously while a turn is active.
Source§fn turn_ended(&self, _context: &mut TurnEndContext<'_>) -> Result<()>
fn turn_ended(&self, _context: &mut TurnEndContext<'_>) -> Result<()>
Observes a turn ending and may clear capability-owned transient UI.
Source§fn before_model<'a>(
&'a self,
_context: &'a mut ModelContext<'_>,
) -> BoxFuture<'a, Result<()>>
fn before_model<'a>( &'a self, _context: &'a mut ModelContext<'_>, ) -> BoxFuture<'a, Result<()>>
Mutates durable context before the next model request is assembled.
Source§fn after_model<'a>(
&'a self,
_context: &'a mut AfterModelContext<'_>,
) -> BoxFuture<'a, Result<()>>
fn after_model<'a>( &'a self, _context: &'a mut AfterModelContext<'_>, ) -> BoxFuture<'a, Result<()>>
Observes one normalized response before it is checkpointed or dispatched. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for Scratchpad
impl !UnwindSafe for Scratchpad
impl Freeze for Scratchpad
impl Send for Scratchpad
impl Sync for Scratchpad
impl Unpin for Scratchpad
impl UnsafeUnpin for Scratchpad
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
Mutably borrows from an owned value. Read more