par-term-scripting
Scripting and observer system for the par-term terminal emulator.
This crate provides an observer-pattern event forwarding mechanism from the terminal core to script subprocesses, along with per-tab script lifecycle management. Scripts receive terminal events (output, commands, shell lifecycle) over a simple line-delimited protocol.
What This Crate Provides
manager— per-tab script lifecycle management: start, stop, and track running scriptsobserver— observer implementation that forwards terminal events to script processesprocess— script subprocess management: spawn, stdin/stdout I/O, graceful shutdownprotocol— line-delimited event protocol sent to script stdin
How It Works
When a script is started for a tab, a ScriptProcess is spawned. The ScriptObserver
registers with the terminal core and forwards events (terminal output, prompt detection,
command start/end) to the script's stdin as newline-delimited JSON messages. Scripts can
read from their stdin to react to terminal events and write responses to stdout.
Workspace Position
Layer 2 in the dependency graph. Depends on par-term-config for script configuration
types. Used directly by the root par-term crate.
Related Documentation
- Automation — triggers, coprocesses, and scripts
- Config Reference — script configuration options
- Architecture Overview — workspace structure
- Crate Structure — dependency layers