14 Commits

Author SHA1 Message Date
nvaldez 46d3890efc chore: hook scripts lint-clean (0.9.2)
Leftover working-tree edits from the 48e9242 session, committed
unchanged: BLE001 noqa with fail-soft comments, I001 import
order, explicit check=False on the estimator subprocess.run,
{e!s}. Behavior identical; both Vibe hook scripts now pass ruff
clean. PATCH bump to 0.9.2, plugin.yaml pin kept in lockstep.
130 tests pass.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-11 19:09:11 +01:00
nvaldez 6301962a54 feat: installer pricing keep/refresh (0.9.1)
install() silently kept any pricing.json already beside the plugin,
so reships shipped new code with old tables - that keep is exactly
how the Hermes plugin lost the credit-pool (mistral-api) tables
between 0.5.0 and 0.9.0, and the 0.9.0 fix needed a manual file
deletion. The installer now prints a hint when the kept table
differs from the bundled one, and --refresh-pricing ships the
bundled table instead (top-level flag next to --integrate hermes,
plus an installer flag for standalone runs; default unchanged -
owner rate edits in the installed copy still win). SPEC, SKILL,
and the installer docstring updated. PATCH to 0.9.1 (new-flag-
as-patch precedent: --rm-integrate, 0.4.6 -> 0.4.7). 130 tests
pass.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-11 19:03:37 +01:00
nvaldez 831589f3f1 feat: Hermes plugin credit-pool label (mistral-api); mistral-small-latest rates
The 94e7534 credit-pool display missed the Hermes plugin: its label
stayed on the billing route (mistral:model), so the daemon cost line
never showed the mistral-api pool the CLI/GUI display. The plugin now
applies the same priority as the CLI/GUI display key (_pool_label):
a billing_url_pools rule substring-matching sessions.billing_base_url
(api.mistral.ai -> mistral-api) wins, else harness_credit_pools
["hermes"], else the billing route, else the raw pricing key. Route
reading split into _session_route; _pricing takes the loaded table so
the label and the rates share one source (_load_pricing_data).

pricing.json gains mistral-small-latest (Mistral Small 4 rates):
current Hermes sessions on it were estimated at the global default
rates with the price-unavailable warning. plugin.yaml now pins the
package version (0.9.0, minor: new plugin display behavior).

128 tests pass; label verified live against state.db
(mistral-api:mistral-small-latest).

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-11 18:21:52 +01:00
nvaldez 48e9242f8f feat: token line gains +N per-turn increments; whole-number token format
display.format_token_count now rounds half-up to whole numbers with
tier rollover (999999 -> "1M", never "1000k"; 275860 -> "276k").
display.format_token_line renders '-- I:<s>+<t> O:<s>+<t> C:<s>+<t>':
the +N suffixes come from new last_turn token fields in the report
(CLI --json raw counts + token_display last_turn_* keys; Hermes
plugin passes its in-memory turn bucket), render +0 on zero
increments, and fail soft when absent - every display path (CLI,
--display-lines, GUI, Vibe hooks, Hermes plugin) changes together
per the display-parity rule. Docs and tests updated; 125 pass.
MINOR bump to 0.8.0.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-10 21:06:52 +01:00
nvaldez 1339e6e2fc chore: record display-parity commit hash in ai-usage-cost.md
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-10 20:50:44 +01:00
nvaldez 198238651d feat: canonical display module - one format for CLI, GUI, hooks, Hermes plugin
New agent_cost_estimator/display.py is the single source of the
cost line, model-price note, and session token line format.
- CLI main() builds one report object feeding --json and the default
  output; new --display-lines flag is the pinned contract the Vibe
  hooks relay (identical to the default output, test-pinned)
- Both Vibe hook scripts thinned to verbatim relays: --display-lines
  output wrapped in system_message; local formatters removed
- Hermes plugin renders through a verbatim display.py copy shipped
  by install.py (byte-parity pinned by tests) and now prints the
  token line too - token-display spec section 11 open item closed
- utils/formatting.py re-exports format_token_count (GUI unchanged)
- SPEC.md 5.7/5.9 + module map, hooks README, plugin.yaml 0.5.0
- MINOR bump to 0.7.0; 128 tests pass

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-10 20:50:27 +01:00
nvaldez 447468962b fix: Tk monthly-summary row background; SPEC.md 5.9 Token Display; README token example
Tk GUI tints the monthly_summary tag (#f0f0f0 light / #303030 dark),
matching the PyQt path and the wiki token-display spec sections 4.2/4.5.
SPEC.md gains section 5.9 Token Display; README shows the two-line
default output. Review of spec-vs-implementation; PATCH bump to 0.6.2.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-10 20:16:43 +01:00
nvaldez 94fe7d05e9 fix: GUI current-turn picks the last turn with calls; document pricing display in SPEC
The GUI priced its "current turn" column from usage.turns[-1] at all
four call sites, which can be a turn whose calls were pruned from the
journal window (calls == 0), showing $0.00 while the last real turn
cost more. New gui.last_active_turn() selects the most recent turn
with calls, matching the CLI's selection.

SPEC.md catches up with the pricing display architecture: section 3.2
documents the optional harness_credit_pools and billing_url_pools
tables, provider_alias/model_alias, and the display-key semantics
(pool > provider_alias > section name; lookup always on the raw
matched key). The -d, --json, hook, and GUI column examples show the
credit-pool display form and the new credit_pool / model_key_raw
JSON fields.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-10 20:08:34 +01:00
nvaldez 94e7534a79 feat: credit-pool display (mistral-api vs mistral-vibe)
Different credit pools can share one pricing table, so the display key
now reports the pool a session actually bills. Two optional pricing
fields drive it:
- harness_credit_pools ({"vibe": "mistral-vibe", "hermes": "mistral-api"})
  for harnesses whose logs do not record the billing API (Vibe session
  logs carry only the model name)
- billing_url_pools ({"api.mistral.ai": "mistral-api"}) for harnesses
  that do: Hermes logs session_model_usage.billing_base_url, and a URL
  match wins over the harness mapping

SessionMeta gains base_url; the Hermes adapter exposes the logged
billing base URL (tolerates older schemas without the column). The pool
overrides the provider part of the display key (mistral-api:mistral-
large-4 for a Hermes session on the pay-as-you-go API, mistral-vibe:
zai-glm-5-3 for a Vibe session), appears as a "credit pool" line in -d
and credit_pool in --json, and the GUI refresh resolver maps
pool-prefixed strings back to the model's real rates. Rates always
come from the matched pricing entry.

Verified live against both harnesses: mistral-vibe:zai-glm-5-3
(Vibe) and mistral-api:mistral-large-4 (Hermes on api.mistral.ai).

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-10 20:02:11 +01:00
nvaldez 5d9b321216 feat: optional provider_alias/model_alias display keys in pricing.json
The cost tracker now displays "who bills the model" instead of the
raw harness prefix. Optional pricing fields:
- provider-level "provider_alias" (zai section set to "mistral":
  Z.ai GLM models are hosted through Mistral's marketplace)
- model-level "model_alias" (overrides the model part the same way)

They change only the display, never the lookup: pricing.get_model_prices
still matches zai:zai-glm-5-3. New pricing.display_key_for() builds the
display key; pricing.resolve_display_key() inverts it so the GUI's
refresh lookup (which receives display strings) still finds the real
rates instead of falling back. CLI default line, -d model line, and
--json use the display form ("mistral:zai-glm-5-3"); --json also
reports the raw pricing key as pricing.model_key_raw. AGENTS.md's
price-update procedure documents both fields.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-10 19:51:23 +01:00
nvaldez e1bb36954b docs: label zai pricing section as Mistral hosted
The zai provider section prices Z.ai GLM models that are billed
through Mistral's marketplace (zai-glm-5-3 in harness logs, same
Mistral API key - no separate Z.ai account). The section keeps
the harness's model prefix as its name, and its new note says
who actually hosts/bills the models. Per-model notes now say
"Mistral hosted" where that is the route priced, and AGENTS.md's
price-update steps cover naming a provider section after the
harness log prefix while documenting the real billing route.
No rate values changed.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-10 19:40:51 +01:00
nvaldez 18503a58f3 fix: correct GUI auto-refresh pricing lookup and update posted prices
Auto-refresh passed the provider-qualified display string (e.g.
"zai:zai-glm-5-3") straight into the pricing lookup, which never
matched and silently fell back to the default provider's rates.
New get_model_rates_for_display() in gui.py splits the provider
prefix before the lookup; both refresh paths use it.

pricing.json re-verified against the official pricing pages
(2026-11-10): Mistral Large 4 promotional rates $0.70/$0.07/$2.10
(regular kept in the note), GLM 5.3 cached input confirmed at
$0.14 via Mistral's marketplace with the source corrected (Z.ai
direct lists $0.26), all entry dates refreshed.

AGENTS.md now documents the price-update procedure for the future
(sources, cached-input caveats, promotional rates, field hygiene,
verification, version bump).

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-10 19:36:32 +01:00
nvaldez 9cc95dc793 feat: add Hermes Agent support (harness adapter, plugin, installer)
- harnesses/hermes.py: Hermes adapter reading state.db
  (session_model_usage cumulative counters) for authoritative
  session totals plus the plugin's JSONL ledger for per-turn
  breakdowns; Hermes's disjoint CanonicalUsage buckets are folded
  into the tool's inclusive (Vibe-style) contract
- integration/hermes/plugin: Hermes plugin (plugin.yaml +
  register(ctx)) wiring pre_llm_call (turn labels),
  post_api_request + post_auxiliary_call (per-call ledger,
  queue + drainer, no hook-path I/O), post_llm_call
  (cost line after every interactive CLI turn; silent for
  subagents/cron/one-shot)
- integration/hermes/install.py: standalone idempotent installer
  (validates the home, copies the plugin + pricing.json, runs
  hermes plugins enable); also wired as
  agent-cost-estimator --integrate hermes / --rm-integrate hermes
- pricing: plugin-local pricing.json first (stdlib-only reader),
  then the package table, then default rates
- tests: 22 new (52 total) covering adapter, plugin, installer
- docs: SPEC.md 1.1.0 (sections 5.2.1, 7.3), SKILL.md, wiki entity

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-10-25 16:57:40 +01:00
user e6fd268db6 Add AGENTS.md and ai-usage-cost.md for cost tracking
- AGENTS.md: Instructions for AI agents working on this project
- .vibe/ai-usage-cost.md: Template for tracking AI usage costs per commit
- Includes workflow, architecture principles, and cost tracking requirements

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-10-24 03:00:21 +02:00