@ycodium-ai/agent-grok 0.2.6295 → 0.2.6459

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +10 -4
  2. package/dist/index.js +830 -448
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -56,10 +56,16 @@ Facts:
56
56
  `host.fetch`. An instance that sets `GROK_MODELS_BASE_URL` reports `customEndpoint` without
57
57
  reading credentials; a signed-out instance with only `XAI_API_KEY` reports `unsupportedLogin`
58
58
  (xAI's balance API needs a separate management key). Credentials are never refreshed or written.
59
- - Tokens: no `readTokenUsage`. The turn's usage comes from the `session/prompt` reply's
60
- `_meta.usage` and is booked on `turn.completed.payload.tokenUsage` (the host writes
61
- `turn.usage`). The reply arrives a few milliseconds after `prompt_complete`, so
62
- `turn.completed` waits up to 300 ms for it and carries no usage when it never comes.
59
+ - Tokens: no `readTokenUsage`. Each host-turn `session/prompt`'s usage comes from the reply's
60
+ `_meta.usage` (with `_x.ai/session_notification` `turn_completed.usage` as a fallback;
61
+ manual `/compact` prompts are excluded) and is emitted before `turn.completed` as
62
+ `thread.token-usage.updated` carrying `request: { id, totals }` so the host writes
63
+ `turn.usage`. Unkeyed replies/notifications are attributed only when exactly one prompt key
64
+ in the turn is unanswered; otherwise `request` is omitted and a `lastUsedTokens` snapshot
65
+ marks the turn unattributed. The reply arrives a few milliseconds after `prompt_complete`,
66
+ so `turn.completed` waits up to 300 ms for it, reuses the session's latest real context
67
+ occupancy for notification-only usage, and emits no request usage when none arrives or no
68
+ context occupancy is known for the session.
63
69
 
64
70
  Develop with `vp run --filter @ycodium-ai/agent-grok typecheck`, `build`, and `test`.
65
71