TerminalShellIntegrationState
Bounded, protocol-neutral terminal projection of shell commands and prompts.
This model intentionally lives outside terminal core. Core owns bytes already committed to the terminal grid; shell commands and prompts are host metadata about prompt and command lifecycle. Records are anchored to stable core line identities, not absolute row numbers, so scrollback movement and resize reflow do not detach decorations from the content they describe.
Storage is data-oriented: each command field is a primitive column, records are append-only until bounded eviction, and paint paths consume only projected primitive arrays. One selected shell integration owns publication to this model; it may interpret terminal protocols or adapt a host's existing shell model. Readers never need to know which integration produced the records.
All methods are thread-safe. The producer must serialize its publications, including synchronous listener delivery, to preserve lifecycle event order. Concurrent producers retain storage safety but have no notification ordering guarantee. Observers and revision collectors run outside the storage lock.
Parameters
maximum retained command records before oldest-record eviction.
maximum retained UTF-16 command-text length per record; longer extracted text is stored as unknown.
Unix epoch-millisecond source sampled for command metadata, including abandonment. Hosts may supply their metadata clock domain; these wall-clock timestamps do not measure elapsed duration.
Properties
Functions
Observes future explicit command completions without replay or conflation.
Observes future changed directory URIs synchronously, without replay.
Returns the preferred navigation anchor line for recordId.
Returns an immutable metadata snapshot for recordId.
Returns the retained command record that owns lineId.
Returns the retained command text for recordId.
Returns the working-directory URI snapshotted when recordId began.
Copies retained shell command records into caller-owned primitive arrays.
Copies projected shell decorations for a visible viewport.
Returns the latest recorded directory URI, or null before one is recorded.
Returns true while shell integration reports a command between command-start and command-finished events.
Returns the newest retained command record id, skipping prompt-only records.
Returns the next retained command record after recordId.
Returns the nearest retained command record after lineId.
Returns the previous retained command record before recordId.
Returns the nearest retained command record before lineId.
Corrects the active prompt's visual start to lineId.
Records command completion.
Records command execution start.
Returns the current number of retained shell command records.
Records the latest host-validated current-working-directory URI.
Records the end of the active shell prompt.
Records the start of a shell prompt.