Summary
Grok supports a headless CLI mode via --output-format streaming-json (https://docs.x.ai/build/overview), producing NDJSON events similar to Claude's stream-json format. Once relay validates spawnCli({ transport: 'headless' }) against Grok's protocol, Pear can drop PTY for Grok too.
Current state
Claude, Codex, and OpenCode already route through spawnCli({ transport: 'headless' }) (relay 8.3.0). Grok is explicitly excluded pending relay confirmation:
// Grok supports --output-format streaming-json but relay compatibility
// with its specific protocol hasn't been confirmed — stays on PTY for now.
const useHeadless = !shellSession && ['claude', 'codex', 'opencode'].includes(spawnCliLabel(nextInput.cli))
See: src/main/broker.ts → spawnAgentOnce
What needs to happen
- Confirm with relay that
spawnCli({ transport: 'headless' }) works for grok --output-format streaming-json
- Confirm whether a Grok-specific harness config is needed (analogous to
HeadlessAppServerHarnessConfig for OpenCode) or if the generic headless transport handles it
- Add
'grok' to the headless CLI list — one-line change
Related
Summary
Grok supports a headless CLI mode via
--output-format streaming-json(https://docs.x.ai/build/overview), producing NDJSON events similar to Claude's stream-json format. Once relay validatesspawnCli({ transport: 'headless' })against Grok's protocol, Pear can drop PTY for Grok too.Current state
Claude, Codex, and OpenCode already route through
spawnCli({ transport: 'headless' })(relay 8.3.0). Grok is explicitly excluded pending relay confirmation:See:
src/main/broker.ts→spawnAgentOnceWhat needs to happen
spawnCli({ transport: 'headless' })works forgrok --output-format streaming-jsonHeadlessAppServerHarnessConfigfor OpenCode) or if the generic headless transport handles it'grok'to the headless CLI list — one-line changeRelated