Skip to content

Add Grok Build as a local runtime adapter - #43

Open
ascendedent wants to merge 2 commits into
splunk:mainfrom
ascendedent:grok-runtime
Open

Add Grok Build as a local runtime adapter#43
ascendedent wants to merge 2 commits into
splunk:mainfrom
ascendedent:grok-runtime

Conversation

@ascendedent

Copy link
Copy Markdown

Grok Build already keeps session evidence under ~/.grok/sessions, but Token Meter did not discover it. This adds a read-only Grok runtime so those sessions show up with the other local agents.

What changed

  • Discover owned session directories under GROK_HOME (default ~/.grok).
  • Tokens and cache counts come from usage.json when Grok has persisted them. Cost is the Grok-recorded local estimate, not a Token Meter price table.
  • Tool names, outcomes, and turn timing come from events.jsonl.
  • Sessions without usage.json stay listed, with tokens and cost unavailable instead of a fake zero.
  • Titles are generic. chat_history.jsonl, generated titles, and message content are not imported.
  • Grok sessions cannot be deleted from Token Meter.
  • Spend, budgets, and the runtime catalog pick Grok up through the existing registry.

Local secret files (auth.json, credentials, chrome-profile/, copied ~/.grok trees) are gitignored so they cannot be committed from a checkout.

Discover ~/.grok/sessions, read usage.json for tokens and Grok-recorded
cost, and take tools/timing from events.jsonl. Sessions stay listed when
usage is missing. Chat history, generated titles, and prompts are never
projected. Grok sessions are read-only in Token Meter.
@bhavsarpratik

Copy link
Copy Markdown
Member

Thanks for adding Grok Build support and for keeping prompt and chat content out of the public projection.

We reviewed the current head (3edca5d) and are holding the merge for now. The next revision should:

  • use Grok Build’s documented 1e10 cost ticks per USD instead of 1e9;
  • treat zero, costIsPartial, and usageIsIncomplete cost evidence as unavailable rather than free or complete; and
  • add fixtures and regression tests for the official scale and incomplete-cost cases.

Once the head is updated, we’ll rerun the provider-parsing, pricing, privacy, and runtime checks and get back to you soon.

— Pratik's agent

Convert costUsdTicks at 1e10 ticks per USD. Zero ticks, costIsPartial,
and usageIsIncomplete stay unavailable instead of a measured free session.
@ascendedent

Copy link
Copy Markdown
Author

Thanks for the cost-scale catch. Head is now 169c5af.

  • costUsdTicks converts at Grok Build’s documented 1e10 ticks per USD (was 1e9).
  • Zero ticks, costIsPartial, and usageIsIncomplete keep cost unavailable instead of a measured free or complete session. Token counts stay measured when present.
  • Tests cover the official scale (1e10 ticks → $1.00) and the zero / partial / incomplete cases.

Prompt and chat content remain out of the public projection. Ready for the provider-parsing and pricing checks on this head.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants