Skip to main content

Module blocks

Module blocks 

Source
Expand description

Pane-as-block — OSC 133 prompt-mark-driven block extractor.

§What this is

Warp-class “every command + output is a discrete block” semantics, daemon-native. Operators (and AI agents via mado MCP) get to fetch one block instead of grepping a byte stream. Sharper context, sharper answers, sharper UI.

§The OSC 133 contract

Originated in iTerm2 / FinalTerm; adopted by VS Code, ghostty, kitty, wezterm, and most modern terminal emulators. Shells emit these markers via their PS1 (bash), prompt() (zsh powerlevel10k), or starship’s built-in support.

OSC 133 ; A ST     — start of prompt
OSC 133 ; B ST     — end of prompt / start of command-line edit
OSC 133 ; C ST     — end of command-line / start of command output
OSC 133 ; D ; <n>  — end of output, exit code n

A single “block” is therefore a four-state state machine: Idle → Prompt → Command → Output → Idle.

§What we capture

For each completed block:

  • prompt — verbatim characters printed between A and B
  • command — verbatim characters printed between B and C
  • output — verbatim characters printed between C and D
  • exit_code — integer from the D marker (None if missing)
  • started_at_unix_ms / ended_at_unix_ms

§Storage

Per-pane VecDeque<Block> with a configurable cap (default 10_000 blocks ≈ a few days of typical interactive shell). Oldest blocks evict first when the cap is hit — same ring-buffer shape PaneRecording uses.

Structs§

Block
Re-export the wire shape so callers don’t have to choose between tear-core and tear-types — they’re the same type.
BlockExtractor