fix(domain,infrastructure,web-server,app-tauri,frontend): TUI native noire — route PTY explicite et replay du scrollback pré-attach sans perte — #360 (QA verte)

This commit is contained in:
2026-09-16 19:08:01 +02:00
parent a833af0fb5
commit 355a482fee
8 changed files with 220 additions and 13 deletions

View File

@ -1749,6 +1749,26 @@ pub trait PtyPort: Send + Sync {
/// [`PtyError`] if the handle is unknown.
fn subscribe_output(&self, handle: &PtyHandle) -> Result<OutputStream, PtyError>;
/// Atomically snapshots the retained output and subscribes to future chunks.
///
/// Presentation adapters use this when they first attach a view after spawn:
/// bytes produced before the channel was ready are returned in the snapshot,
/// while bytes produced afterwards enter the stream exactly once. Concrete
/// adapters should override this operation when snapshot/subscription share
/// a synchronization boundary. The default keeps existing port adapters
/// source-compatible, but cannot close a race between the two operations.
///
/// # Errors
/// [`PtyError`] if the handle is unknown.
fn subscribe_output_with_scrollback(
&self,
handle: &PtyHandle,
) -> Result<(Vec<u8>, OutputStream), PtyError> {
let scrollback = self.scrollback(handle)?;
let stream = self.subscribe_output(handle)?;
Ok((scrollback, stream))
}
/// Returns the recent output retained for the session (a bounded scrollback
/// ring buffer, the most recent bytes). Used to repaint a view that
/// re-attaches to a live PTY so the terminal isn't blank.