Skip to content

PI Protocol Reference

This page is the wire-level reference for glib <-> PI transport.

  • Channel: stdin/stdout
  • Framing: newline-delimited JSON (JSONL)
  • Encoding: UTF-8 JSON objects, one object per line
{
"type": "prompt",
"session_id": "repo:cloudboy-jh/glib",
"text": "Summarize this staged diff"
}

Common command types:

  • prompt
  • abort
  • steer
  • new_session
  • get_state
  • set_model
{
"type": "text_delta",
"session_id": "repo:cloudboy-jh/glib",
"delta": "Here is what changed..."
}

Common event types:

  • agent_start
  • text_delta
  • tool_execution_start
  • tool_execution_update
  • tool_execution_end
  • agent_end
  • auto_compaction_start
  • auto_compaction_end
  • auto_retry_start
  • auto_retry_end
  • extension_ui_request
  1. PI emits extension_ui_request event.
  2. glib renders requested UI surface.
  3. glib returns user choice as command payload.
  • 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.