pub struct Application { /* private fields */ }Implementations§
Source§impl Application
impl Application
Sourcepub fn request_harness_models(
&self,
harness: HarnessId,
folder: Option<PathBuf>,
) -> ModelListRequest
pub fn request_harness_models( &self, harness: HarnessId, folder: Option<PathBuf>, ) -> ModelListRequest
Starts listing the models harness offers, read from its own CLI on another thread, so a
slow harness never holds up commands or terminals. Poll the request for the result.
Source§impl Application
impl Application
Sourcepub fn save_file(
&self,
request: &FileSaveRequest,
) -> Result<FileSaveOutcome, ApplicationError>
pub fn save_file( &self, request: &FileSaveRequest, ) -> Result<FileSaveOutcome, ApplicationError>
Saves a bounded text edit, returning a conflict without writing when the disk version differs. Contents never enter the event journal. Call on a worker, as this performs disk I/O.
§Errors
Returns an error for a stale folder, invalid/unsupported paths, oversized text, or failed I/O.
Sourcepub fn poll_files(
&self,
folder: &Path,
directories: &[PathBuf],
file: Option<&Path>,
revision: Option<u64>,
) -> Result<Option<FileSnapshot>, ApplicationError>
pub fn poll_files( &self, folder: &Path, directories: &[PathBuf], file: Option<&Path>, revision: Option<u64>, ) -> Result<Option<FileSnapshot>, ApplicationError>
Watches only the visible directories and selected file on a dedicated worker. Returns no snapshot until the first scan completes or while the revision is unchanged. File contents stay out of the event journal, which would retain old versions. Poll at 500 ms intervals.
§Errors
Returns an error for a stale folder, invalid paths, or poisoned state locks.
Source§impl Application
impl Application
Sourcepub fn workflow_types(&self) -> Result<Vec<WorkflowType>, ApplicationError>
pub fn workflow_types(&self) -> Result<Vec<WorkflowType>, ApplicationError>
Lists built-in and stored custom types for launch forms.
§Errors
Returns an error when the catalog cannot be read.
Source§impl Application
impl Application
Sourcepub fn next_terminal_chunk(
&self,
) -> Result<Option<TerminalChunk>, ApplicationError>
pub fn next_terminal_chunk( &self, ) -> Result<Option<TerminalChunk>, ApplicationError>
Removes the next terminal chunk from the binary output queue.
§Errors
Returns an error if the queue cannot be accessed.
Sourcepub fn read_terminal_transcript(
&self,
terminal_id: TerminalId,
offset: u64,
limit: usize,
) -> Result<TranscriptRead, ApplicationError>
pub fn read_terminal_transcript( &self, terminal_id: TerminalId, offset: u64, limit: usize, ) -> Result<TranscriptRead, ApplicationError>
Reads at most limit raw bytes beginning exactly at offset, after committing output
already accepted for recording. limit must be between 1 and 64 KiB. An offset at the
recorded end returns an empty page; pruned history returns an explicit expired result.
This performs storage work on the recording worker and waits for its reply. Call it off the UI thread. It acquires no application-state or terminal-input locks.
§Errors
Returns an error for an invalid limit, an unknown terminal, an offset beyond the recorded end, or unavailable/corrupt storage. Terminal IDs remain readable after terminal closure.
Sourcepub fn request_terminal_transcript(
&self,
terminal_id: TerminalId,
offset: u64,
limit: usize,
) -> Result<Option<TranscriptRequest>, ApplicationError>
pub fn request_terminal_transcript( &self, terminal_id: TerminalId, offset: u64, limit: usize, ) -> Result<Option<TranscriptRequest>, ApplicationError>
Begins a transcript read without waiting for recording or storage. None means the bounded
request queue is full; callers may retry while continuing to service live terminals.
§Errors
Returns an invalid limit, cancellation, or a recording failure.
Sourcepub fn write_terminal_input(
&self,
terminal_id: TerminalId,
bytes: &[u8],
) -> Result<(), ApplicationError>
pub fn write_terminal_input( &self, terminal_id: TerminalId, bytes: &[u8], ) -> Result<(), ApplicationError>
Writes binary user input to a live terminal.
§Errors
Returns an error if the terminal is not running or the PTY writer fails.
Sourcepub fn write_terminal_response(
&self,
terminal_id: TerminalId,
bytes: &[u8],
) -> Result<(), ApplicationError>
pub fn write_terminal_response( &self, terminal_id: TerminalId, bytes: &[u8], ) -> Result<(), ApplicationError>
Writes a terminal-generated protocol reply without treating it as a user draft.
§Errors
Returns an error if the terminal is not running or the PTY writer fails.
Sourcepub fn resize_terminal(
&self,
terminal_id: TerminalId,
size: TerminalSize,
) -> Result<(), ApplicationError>
pub fn resize_terminal( &self, terminal_id: TerminalId, size: TerminalSize, ) -> Result<(), ApplicationError>
Changes the kernel PTY size for a live terminal.
§Errors
Returns an error if the size is invalid, the terminal is not running, or resizing fails.
Source§impl Application
impl Application
Sourcepub fn trace_storage_status(
&self,
span: Option<TraceSpanId>,
) -> Result<TraceStorageStatus, ApplicationError>
pub fn trace_storage_status( &self, span: Option<TraceSpanId>, ) -> Result<TraceStorageStatus, ApplicationError>
Reads cached trace storage statistics and schedules background maintenance.
§Errors
Returns storage or application-lock failures.
Sourcepub fn pin_trace_details(
&self,
span: TraceSpanId,
pinned: bool,
) -> Result<(), ApplicationError>
pub fn pin_trace_details( &self, span: TraceSpanId, pinned: bool, ) -> Result<(), ApplicationError>
Protects a step’s full retained details from automatic cleanup.
§Errors
Returns storage or application-lock failures.
Sourcepub fn clear_trace_details(&self) -> Result<(), ApplicationError>
pub fn clear_trace_details(&self) -> Result<(), ApplicationError>
Clears unpinned, completed full details in the background. Native files are untouched.
§Errors
Returns storage or application-lock failures.
Sourcepub fn trace_detail(
&self,
activity: TraceActivityId,
output: bool,
offset: u64,
limit: usize,
) -> Result<TraceDetailPage, ApplicationError>
pub fn trace_detail( &self, activity: TraceActivityId, output: bool, offset: u64, limit: usize, ) -> Result<TraceDetailPage, ApplicationError>
Reads full recorded activity input or output in bounded UTF-8 pages.
§Errors
Returns an error for missing activity, invalid page size, or unavailable payload storage.
Sourcepub fn trace_activities(
&self,
span_id: TraceSpanId,
after: Option<TraceActivityId>,
limit: usize,
) -> Result<TraceActivitiesPage, ApplicationError>
pub fn trace_activities( &self, span_id: TraceSpanId, after: Option<TraceActivityId>, limit: usize, ) -> Result<TraceActivitiesPage, ApplicationError>
Reads native tool and subagent activity in stable ID order. Refresh from the beginning when the workflow revision changes, because a finish updates an existing activity.
§Errors
Returns an error if the span is missing, the page limit is invalid, or storage fails.
Sourcepub fn workflow_trace(
&self,
workflow_id: WorkflowId,
before: Option<TraceSpanId>,
limit: usize,
) -> Result<WorkflowTracePage, ApplicationError>
pub fn workflow_trace( &self, workflow_id: WorkflowId, before: Option<TraceSpanId>, limit: usize, ) -> Result<WorkflowTracePage, ApplicationError>
Reads a bounded page of the workflow’s durable trace, including closed workflow history.
§Errors
Returns an error if the workflow is missing, the page limit is invalid, or storage fails.
Sourcepub fn trace_events(
&self,
span_id: TraceSpanId,
after: Option<TraceEventId>,
limit: usize,
) -> Result<TraceEventsPage, ApplicationError>
pub fn trace_events( &self, span_id: TraceSpanId, after: Option<TraceEventId>, limit: usize, ) -> Result<TraceEventsPage, ApplicationError>
Reads a bounded page of events for a span, in durable event ID order.
§Errors
Returns an error if the span is missing, the page limit is invalid, or storage fails.
Source§impl Application
impl Application
Sourcepub fn new_window(data_directory: &Path) -> Result<Self, ApplicationError>
pub fn new_window(data_directory: &Path) -> Result<Self, ApplicationError>
Creates an independent window runtime sharing durable history with the other windows. Only the first runtime recovers interrupted work and restores a previously open folder.
§Errors
Returns an error if storage, recovery, or runtime initialization fails.
Sourcepub fn restorable_folders(&self) -> Result<Vec<PathBuf>, ApplicationError>
pub fn restorable_folders(&self) -> Result<Vec<PathBuf>, ApplicationError>
Returns every folder that should reopen after app shutdown, including unavailable folders.
§Errors
Returns an error if the database or runtime state cannot be read.
Source§impl Application
impl Application
Sourcepub fn new(data_directory: &Path) -> Result<Self, ApplicationError>
pub fn new(data_directory: &Path) -> Result<Self, ApplicationError>
Creates the application with production queue limits and the user’s config file, keeping
its database in data_directory, and reopens the folder that was open when Twine last quit.
§Errors
Returns an error if the database cannot be opened or migrated, transcript storage cannot be opened or is owned by another core, or the initial ready event cannot be recorded.
Sourcepub fn with_config(
data_directory: &Path,
config: Config,
) -> Result<Self, ApplicationError>
pub fn with_config( data_directory: &Path, config: Config, ) -> Result<Self, ApplicationError>
Creates the application like Application::new, but with already validated
configuration instead of the user’s config file.
§Errors
Returns an error if the database cannot be opened or migrated, transcript storage cannot be opened or is owned by another core, or the initial ready event cannot be recorded.
Sourcepub fn handle_command(
&self,
request_id: RequestId,
command: Command,
) -> Result<CommandReceipt, ApplicationError>
pub fn handle_command( &self, request_id: RequestId, command: Command, ) -> Result<CommandReceipt, ApplicationError>
Handles a command and returns its immediate acceptance result.
§Errors
Returns an error if application state cannot be accessed or the resulting event cannot be recorded.
Sourcepub fn snapshot(&self) -> Result<Snapshot, ApplicationError>
pub fn snapshot(&self) -> Result<Snapshot, ApplicationError>
Returns an atomic snapshot of application state and the latest event sequence.
§Errors
Returns an error if application state cannot be accessed.
Sourcepub fn events_after(
&self,
sequence: u64,
limit: usize,
) -> Result<Vec<Event>, ApplicationError>
pub fn events_after( &self, sequence: u64, limit: usize, ) -> Result<Vec<Event>, ApplicationError>
Returns at most limit events whose sequence is strictly greater than sequence.
§Errors
Returns an error if the cursor has expired, the limit is invalid, or application state cannot be accessed.
Trait Implementations§
Source§impl Drop for Application
impl Drop for Application
Auto Trait Implementations§
impl !Freeze for Application
impl !RefUnwindSafe for Application
impl !UnwindSafe for Application
impl Send for Application
impl Sync for Application
impl Unpin for Application
impl UnsafeUnpin for Application
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.