Lody's ACP compatibility adapter for the official Grok runtime.
The adapter does not contain, build, patch, or publish Grok. It launches the
official runtime supplied through GROK_PATH and translates the small private
wire contract pinned in runtime-manifest.json into standard ACP session
configuration options.
Supported configuration:
- Initial permission mode from
_meta.lody.sessionConfigmaps to Grok's startup_meta.yoloModebeforesession/newor restore reaches the official runtime. Later changes map tox.ai/yolo_mode_changedwith the current LodyclientIdentifier, which is registered during ACP initialization. Grok's native standardsession/request_permissionrequests pass through unchanged. - Reasoning effort maps to
session/set_model, preserving the current model and setting_meta.reasoningEffort. - Model and interaction mode map to the corresponding standard legacy ACP calls. Grok 1.0.13 reliably supports Agent and Plan. It silently ignores Ask, so the adapter does not advertise Ask and maps legacy persisted Ask selections to Plan.
- Per-turn token and trusted cost totals from Grok's prompt metadata or durable
_x.ai/session/updateturn_completedevent map to Core's_lody/session/usage_updateextension. Cache and reasoning totals are converted from Grok's inclusive counters into Lody's disjoint buckets. - The adapter queries
x.ai/session/infoafter session setup and completed prompts, then emits standard ACPusage_updatecontext-window updates. Replay events never re-record historical billing usage. - The adapter queries
x.ai/billingafter session setup and completed prompts, then maps the official credit usage percentage and billing period to Core's_lody/rate_limits/updateextension. Clients can also call_lody/rate_limits/getindependently of a session. For the fresh unified-billing shape where Grok explicitly returns zero cap, usage, and balance but omits the percentage, the adapter mirrors the official/usageUI's weekly0%. Billing failures never fail a session.
Automatic permission mode is exposed as an experimental option. The official
1.0.13 runtime accepts the private auto_mode notification but does not
acknowledge it, so the adapter applies the selection optimistically.
Run with:
GROK_PATH=/path/to/official/grok node src/index.js