Skip to main content

CommandSessionExportContext

Trait CommandSessionExportContext 

Source
pub trait CommandSessionExportContext {
    // Required methods
    fn conversation_projection(&self) -> ConversationExportProjection;
    fn turn_handoff_projection(&self) -> TurnHandoffProjection;
    fn clipboard_requires_terminal_paste(&self) -> bool;
    fn write_recovery_copy(&self, markdown: &str) -> Option<PathBuf>;
    fn write_clipboard(&self, markdown: &str) -> Result<(), String>;
    fn resolve_export_path(&self, raw: &str) -> Result<PathBuf, String>;
    fn write_export_file(
        &self,
        path: &Path,
        contents: &[u8],
        force: bool,
    ) -> Result<(), String>;
}
Expand description

Session-export authority for the /export slice (FEAT-025 D1-D9).

Operation-granular synchronous delegates over the exact minimum host work the command consumes. The portable handler parses the request first, renders the selected scope second, and then uses these delegates in baseline order: clipboard exports call terminal-paste detection, recovery write, and clipboard delivery exactly once each with the same Markdown; file exports resolve the destination before writing it. A recovery-write None never prevents the clipboard attempt, and a turn-only export never requests the conversation projection (D6/D7).

Required Methods§

Source

fn conversation_projection(&self) -> ConversationExportProjection

Conversation export projection: metadata, authoritative-or-fallback transcript, and restore-point state. Read-only; opens only an existing snapshot repository and never creates one (D8).

Source

fn turn_handoff_projection(&self) -> TurnHandoffProjection

Turn-handoff projection: unmodified shared renderer Markdown plus the workspace path value (D2).

Source

fn clipboard_requires_terminal_paste(&self) -> bool

Whether clipboard delivery goes through the terminal-client (SSH/OSC 52 via tmux) path (D6).

Source

fn write_recovery_copy(&self, markdown: &str) -> Option<PathBuf>

Write the shared last-copy.md recovery file. None reproduces the baseline silent failure; recovery writing never falls through to an error (D5/D6).

Source

fn write_clipboard(&self, markdown: &str) -> Result<(), String>

Attempt clipboard delivery. Err carries the raw host clipboard error text; the handler composes the exact failure wording (D6).

Source

fn resolve_export_path(&self, raw: &str) -> Result<PathBuf, String>

Resolve a file destination exactly as the baseline does (trim, empty check, .. rejection, workspace canonicalization and rebasing, filename requirement). Errors are returned unwrapped (D7).

Source

fn write_export_file( &self, path: &Path, contents: &[u8], force: bool, ) -> Result<(), String>

Write the rendered export to a resolved destination with the baseline protection checks. Errors are returned unwrapped; the handler wraps them in Failed to export {label} to {path}: {err} (D7).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§