Skip to content

feat: enable headless spawn for Grok once relay confirms streaming-json support #141

@khaliqgant

Description

@khaliqgant

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.tsspawnAgentOnce

What needs to happen

  1. Confirm with relay that spawnCli({ transport: 'headless' }) works for grok --output-format streaming-json
  2. Confirm whether a Grok-specific harness config is needed (analogous to HeadlessAppServerHarnessConfig for OpenCode) or if the generic headless transport handles it
  3. Add 'grok' to the headless CLI list — one-line change

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions