PI Protocol Reference
This page is the wire-level reference for glib <-> PI transport.
Transport
Section titled “Transport”- Channel: stdin/stdout
- Framing: newline-delimited JSON (
JSONL) - Encoding: UTF-8 JSON objects, one object per line
Command schema
Section titled “Command schema”{ "type": "prompt", "session_id": "repo:cloudboy-jh/glib", "text": "Summarize this staged diff"}Common command types:
promptabortsteernew_sessionget_stateset_model
Event schema
Section titled “Event schema”{ "type": "text_delta", "session_id": "repo:cloudboy-jh/glib", "delta": "Here is what changed..."}Common event types:
agent_starttext_deltatool_execution_starttool_execution_updatetool_execution_endagent_endauto_compaction_startauto_compaction_endauto_retry_startauto_retry_endextension_ui_request
Extension UI flow
Section titled “Extension UI flow”- PI emits
extension_ui_requestevent. - glib renders requested UI surface.
- glib returns user choice as command payload.
Error handling
Section titled “Error handling”- Invalid JSON line is treated as protocol failure.
- Broken pipe or process exit marks PI session crashed.
- glib surfaces crash state in footer and allows restart/new session.