89 Commits

Author SHA1 Message Date
user 5fddabf31a data: pricing refresh 2026-11-18 - add DeepSeek V4.1 Flash 1017 (Mistral-hosted $0.30/$0.007/$1.20 + deepseek-flash alias), all existing Mistral/Z.ai rates re-verified unchanged; Mistral Medium 3.5 off the official pricing page since ~11-17, rates continue per benchlm.ai + optimtoken
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-18 19:12:04 +01:00
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 16df12d0f6 feat: token usage line in Vibe hook display (display-parity with CLI)
The token display spec (implemented for CLI and GUI in 76f2a49) never
scoped the Vibe hook scripts: post_turn.py consumes --json but
discarded input_tokens/cached_input_tokens/output_tokens, so sessions
only showed the cost line.

- format_cost_output now emits a second line, matching the CLI's
  own output: '-- I:X O:Y C:Z' from session totals (per-turn token
  counts are not part of the harness report), with k/M/B/T suffixes
- Format via a stdlib-only copy of format_token_count (the hook
  must not import the package); parity is pinned by tests
- Token line omitted when the report lacks token fields, so the
  cost line never depends on it (fail-soft)
- Applies to both hooks (mistral-vibe-cli, mistral-vibe-code)
- New tests/test_hooks.py: 34 tests covering two-line output,
  fallbacks, and formatter parity; full suite 131 passed

Version rides together with the concurrent 0.5.0 work.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-10 19:58:06 +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 40e116e711 fix: harden Vibe CLI integration and bump to 0.4.7
- Hook command now uses the resolved $VIBE_HOME path instead of a
  hardcoded ~/.vibe (custom Vibe homes work)
- Docstrings state the config location Vibe actually reads
  ($VIBE_HOME/hooks.toml) and that agent.toml is not a Vibe hooks
  mechanism, so future sessions do not rediscover this the hard way
- Removal cleans the config, hook script dir, stale agent profiles,
  and resets default_agent if it pointed at cost-tracker
- Verified on Vibe 3.1.0: remove -> integrate cycle leaves a config
  that fires post_agent with the same payload as 3.0.x; 87 tests pass

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-10 19:30:03 +01:00
nvaldez 85272aac93 fix: write Vibe hooks config to ~/.vibe/hooks.toml (the path Vibe actually reads)
Vibe reads user-level hooks from ~/.vibe/hooks.toml, not
~/.vibe/hooks/hooks.toml. The previous location was silently
ignored, so --integrate mistral-vibe-cli produced a config that
never fired (cost line disappeared after reintegration on
Vibe 3.1.0). Verified on 3.1.0: post_agent hooks fire from the
correct path with the same payload as 3.0.x (session_id +
transcript_path).

Also removes misplaced configs, cleans up stale agent.toml
profiles that trigger 'not a Vibe setting' warnings, and stops
recommending the non-existent agent-based hook approach.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-10 18:46:51 +01:00
nvaldez 76f2a491b8 feat: Add token usage display with monthly summary
Implementation of token display specification:
- Add formatting utility with automatic suffixes (k, M, B, T)
- CLI: Add token line -- I:X O:Y C:Z to default output
- CLI: Add formatted tokens to details and JSON output
- GUI: Add 3 token columns (Input, Output, Cached)
- GUI: Add monthly usage summary row as first row under each harness
- Add comprehensive tests for formatting function
- Update existing tests for new CLI output format

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-10 17:56:48 +01:00
nvaldez f6ce192ece Update token display spec: add monthly usage summary row
- Add section 3.0 for Monthly Usage Summary Row
- Display **This Month Usage** as first row under each harness
- Calculate aggregated token usage for current calendar month
- Include caching strategy (5-minute TTL)
- Add implementation examples for Tkinter and PyQt5

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-10 17:43:55 +01:00
nvaldez 88e5c032ed feat: Add refresh information to status bar
- Show default harness and auto-refresh status on startup
- On refresh, display:
  - Total session count
  - Last refresh time (HH:MM:SS)
  - Cache statistics (hits and misses)
  - 'Full Refresh' vs 'Cache' indicator
- Updates for both Tkinter and Qt versions

Example status: 'Default Harness: vibe | Sessions: 10 | Last Refresh: 14:30:45 | Cache: 8 hits, 2 misses'

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-04 18:15:51 +01:00
nvaldez 93d7833e7c feat: Ensure sessions are always sorted by timestamp on auto-refresh
- Change auto-refresh to rebuild tree with sorted sessions
- Previously, auto-refresh only updated visible items in place
- This caused sessions to not be re-sorted when timestamps changed
- Now auto-refresh calls _refresh_sessions(use_cache=True, visible_only=False)
- This rebuilds the tree with sessions sorted by last_modified (newest first)
- Cache is still used for costs, so unchanged sessions don't get recalculated

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-04 18:12:10 +01:00
nvaldez a268bb8663 fix: Handle HermesSession objects properly in auto-refresh
- For Hermes harness, collect_usage expects a HermesSession object, not a Path
- In _refresh_visible_sessions_only() (Tkinter and Qt):
  - Check if harness_name is 'hermes'
  - If yes, create HermesSession(db_path, session_id) object
  - If no (Vibe, etc), use session_dir as-is (Path)
- This fixes AttributeError: 'PosixPath' object has no attribute 'db_path'

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-04 18:09:03 +01:00
nvaldez fdc4b08c77 fix: Implement smart auto-refresh with timestamp checking
- Add _session_timestamps dict to track last known timestamp for each session
- Rewrite _refresh_visible_sessions_only() for both Tkinter and Qt
- On auto-refresh:
  - Discovers all sessions
  - Compares timestamps with stored values
  - Recalculates costs for sessions with changed timestamps
  - Updates cache for changed sessions
  - Updates UI for all visible sessions (using cache for unchanged)
- This ensures sessions that have changed (even if not visible) get recalculated
- Sessions that moved due to timestamp changes are properly handled
- Old implementation only used cache without checking for changes

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-04 18:04:10 +01:00
nvaldez d77bbf64b4 feat: Enhance File menu with full refresh option and keyboard shortcut
- Rename 'Refresh' to 'Refresh (Full)' to clarify it triggers full refresh
- Add Ctrl+R keyboard shortcut for both Tkinter and Qt
- Add status tip for Qt version
- Full refresh happens when:
  - User clicks File > Refresh (Full)
  - User presses Ctrl+R
  - This invalidates cache and recalculates all session costs

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-04 17:57:26 +01:00
nvaldez 028c2bccc8 fix: Use resolve_session_dir instead of get_session_dir in visible refresh
- Fix AttributeError in _refresh_visible_sessions_only()
- Fix AttributeError in _refresh_visible_sessions_only_qt()
- Use adapter.resolve_session_dir() with proper error handling
- Skip sessions that no longer exist on disk

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-04 17:54:41 +01:00
nvaldez 470449fa9a feat: Implement visible-only refresh for auto-refresh optimization
- Add _refresh_visible_sessions_only() for Tkinter
- Add _refresh_visible_sessions_only_qt() for Qt
- When visible_only=True and use_cache=True, only update currently visible sessions
- This minimizes resource usage during auto-refresh by using cached costs
- Only updates session price and turn price for visible items
- Skips collapsed harnesses and expand rows

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-04 17:49:56 +01:00
nvaldez 3a5374041e feat: Only expand default harness by default in GUI
- Tkinter: Modified _refresh_sessions to only expand harness node matching default_harness
- Qt: Modified _refresh_sessions_qt to only expand harness matching default_harness
- Other harnesses remain collapsed until user clicks to expand

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-04 17:47:38 +01:00
nvaldez c8f58679f7 Fix: Ensure settings.json always contains all default settings when opened from GUI
- Update _edit_settings_file_qt() to load and save all settings before opening
- Matches the behavior of _edit_settings_file() for Tkinter
- This ensures users see all available options (default_harness, auto_refresh_enabled,
  auto_refresh_interval_seconds, theme) when editing settings.json

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-04 17:43:01 +01:00
nvaldez 10aa85657c fix(settings): create settings.json with all default values on first run
- Update Settings.load() to create settings.json if it doesn't exist
- File is created with all default values:
  - default_harness: "vibe"
  - auto_refresh_enabled: true
  - auto_refresh_interval_seconds: 5
  - theme: "light"
- Users can now see and edit all available settings
- Backward compatible: existing settings files are loaded normally
- Validation is applied after loading

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-04 17:38:24 +01:00
nvaldez d80a3da303 feat(gui): optimize auto-refresh to use cache, full refresh recalculates all
- Add use_cache parameter to _refresh_sessions() and _refresh_sessions_qt()
- Auto-refresh: uses cache for unchanged sessions (use_cache=True)
- Manual refresh (File > Refresh): invalidates cache and recalculates all (use_cache=False)
- Add request_full_refresh() and _invalidate_cache() methods
- Add _request_full_refresh_tkinter() and _request_full_refresh_qt() for manual refresh
- Track full refresh state with _full_refresh_requested flag
- Cache is automatically used in SessionDiscovery._get_session_info() when available

Performance improvement:
- Auto-refresh: Only recalculates costs for changed sessions
- Manual refresh: Forces recalculation of all session costs
- Cache invalidation: Clears cache to ensure fresh calculations

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-04 17:37:10 +01:00
nvaldez 62c4e43249 fix(gui): get parent before deleting expand item, add logging to file
- Fix Tkinter callback error: Item not found when getting parent after delete
  - Solution: Get parent BEFORE deleting the expand item
- Add comprehensive logging to file
  - Logs to ~/.config/agent-cost-estimator/gui.log (Linux)
  - Logs to %APPDATA%/agent-cost-estimator/gui.log (Windows)
  - Can be customized with --log-file argument
  - Logs to both console and file
  - Log format: timestamp - module - level - message
  - Added debug startup info (log file path, debug mode)
- Maintain backward compatibility with existing code

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-04 17:34:10 +01:00
nvaldez f354e6973d fix(gui): use _item_data dict for Tkinter item data instead of non-standard iid option
- Fix Tkinter callback error: unknown option "-iid"
- Use _item_data dictionary to map tree item IDs to custom data
- Add documentation to Settings class with all available options
- Fix escape sequence warning in docstring
- Maintain backward compatibility with Qt version

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-04 17:30:42 +01:00
nvaldez c0bddb9b47 fix(gui): use standard Tkinter colors instead of platform-specific SystemButtonFace
- Replace SystemButtonFace with system default (no explicit bg color set)
- SystemButtonFace is Windows-specific and not available on all platforms
- Light theme now uses default Tkinter colors
- Dark theme continues to use custom colors

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-04 17:23:58 +01:00
nvaldez 2c52145780 feat(gui): implement caching, auto-refresh, pagination, and dark theme
- Add CostCache class for caching session costs
  - Cache key: session_id + last_modified + pricing_hash
  - Cache invalidation on pricing or session changes
  - Cache statistics tracking (hits/misses)
  - In-memory cache with 1-hour TTL
- Add Settings for auto-refresh and theme
  - auto_refresh_enabled (default: true)
  - auto_refresh_interval_seconds (default: 5s, range: 1-60s)
  - theme (light/dark/system)
- Implement auto-refresh with configurable interval
  - Tkinter: uses root.after()
  - Qt: uses QTimer
  - Preserves UI state during refresh
- Implement pagination for expand row
  - First click shows 5 more sessions (6-10)
  - Each subsequent click shows next 5
  - Updates label with remaining count
  - Works for both Tkinter and Qt
- Implement dark theme support
  - Tkinter: custom styling with dark colors
  - Qt: custom palette and stylesheet
  - System theme detection (Windows/macOS/Linux)
  - Applies immediately on startup

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-04 17:18:08 +01:00
nvaldez dc29b4186f spec(gui): add caching, auto-refresh, pagination, and dark theme
- Add auto-refresh feature with 5 second default interval
  - Configurable via settings (1-60 seconds)
  - Can be disabled
  - Preserves UI state during refresh
- Add cost calculation caching
  - Cache key: session_id + last_modified + pricing_hash
  - In-memory primary cache
  - Optional disk cache for persistence
  - Cache invalidation on file/pricing changes
- Update expand behavior to paginate (show 5 more at a time)
  - First click shows sessions 6-10
  - Label updates with remaining count
  - Right-click option to show all
- Add dark theme support
  - Configurable via settings.json
  - System theme option to follow OS preference
  - Custom styling for all GUI elements

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-04 17:10:46 +01:00
nvaldez df9824db81 feat(gui): implement SPEC - datetime column, hash as last, top 5 limit with expand
- Reorder columns: Session Name, Model, Session Price, Turn Price, DateTime, Hash
- Add DateTime column showing last modification time in ISO 8601 format
- Move Hash to be the last column (column 6)
- Implement top 5 session limit per harness
- Add '... (show N more)' expand row when more than 5 sessions exist
- Clicking expand row shows all remaining sessions
- Implemented for both Tkinter and Qt frameworks
- Sessions already sorted by datetime newest first

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-04 17:05:53 +01:00
nvaldez be868db3be spec(gui): reorder columns with Hash as last column
- Add explicit Column 1 - Session Name
- Reorder columns: Session Name, Model, Session Price, Current Turn Price, DateTime, Hash
- Hash is now Column 6 and always shown as the last column
- Update Session Display Limit to reference Column 5 (DateTime)
- Clarify sorting is newest first

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-04 17:01:17 +01:00
nvaldez c195e256dd spec(gui): add datetime column and top 5 session limit with expand indicator
- Add Column 4 - DateTime in ISO 8601 format for last modification time
- Specify sessions sorted by DateTime, newest first
- Show only top 5 sessions by default for each harness
- Add '...' row after 5th session when more exist
- Clicking '...' row expands to show all sessions
- Optional label: 'Show more sessions (N hidden)'
- Improves UI by reducing visual clutter

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-04 17:00:22 +01:00
nvaldez 87ed967684 feat(gui): add Edit Settings menu option to open settings.json in default editor
- Add 'Edit Settings' menu item to both Tkinter and Qt versions
- Opens settings.json in system default text editor
- Cross-platform support (Windows, macOS, Linux)
- Falls back to available editors if xdg-open not available
- Added to SPEC under Settings Menu section
- Future enhancement: will be replaced with dedicated settings window

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-04 16:59:21 +01:00
nvaldez afae3f83f1 feat(gui): add 4th column for current turn price and fix Hermes session detection
- Add 4th column to tree view showing current turn price for both Tkinter and Qt
- Fix Hermes session discovery to create proper HermesSession objects
- Update column headers and widths to accommodate new column
- Truncate session hash to 8 characters for display
- Ensure both frameworks (Tkinter/Qt) have matching column configurations

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-04 11:24:07 +01:00
nvaldez 7675436d94 feat: GUI - add Hermes session discovery from SQLite database
Implement _discover_hermes_sessions() to query state.db and find all
Hermes sessions. Sessions are now displayed from both Vibe and Hermes
harnesses in the GUI.

- Query sessions table ordered by last_activity_at DESC
- Create SessionInfo from database fields (id, title, model, timestamps)
- Use Hermes adapter to collect usage from state.db
- Calculate costs using existing pricing module

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-04 11:09:27 +01:00
nvaldez a4caab42ed feat: --integrate hermes is now one command (0.4.6)
The installer now also restarts a RUNNING gateway daemon (SIGUSR1
drain-restart, waits for pid cycle or old-pid exit) so the plugin
module is re-imported; --no-restart opts out. cli.py dispatches
--integrate/--rm-integrate hermes to the installer. 62 tests.
2026-11-04 10:39:34 +01:00
nvaldez 7b933ae9af feat: GUI - add 4 columns with session name and truncated hash
Update GUI tree view to show 4 columns:
1. Session Name (from meta.title)
2. Hash (truncated to 8 chars)
3. Model
4. Session Price

Removed Current Turn Price from display to fit 4-column layout.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-04 10:34:01 +01:00
nvaldez 5f985db696 fix: consolidate VSCodium wrapper with all fixes (text=True, messages check, stdin forwarder)
Consolidates duplicate wrapper generation code paths in cli.py and applies all
critical fixes for VS Codium integration:
- Replace deprecated universal_newlines with text=True
- Check for both 'journal' and 'messages' in filename patterns
- Add forward_stdin() function with stdin forwarder thread
- Properly forward stdin from VSCodium to vibe-acp binary
- Improve error handling with proper exception messages
- Restructure monitor to return observer instead of using globals

This ensures cost-tracker lines appear after every turn in VSCodium.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-04 10:30:27 +01:00
nvaldez 777a804125 Merge branch 'gui-feature' into main
Implements GUI interface (SPEC 5.8) with cross-platform support.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-04 10:18:28 +01:00
nvaldez 93ddaed541 fix: GUI Tkinter - use instance variables for tk and ttk
Fix NameError by storing tk and ttk as instance variables at the
beginning of _run_tkinter method, so they're accessible in all
Tkinter-related methods (_refresh_sessions, _show_harness_dialog,
_show_session_details).

Also removed redundant tkinter imports in helper methods.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-04 10:13:39 +01:00
nvaldez a5f92d4bbb fix: publish Hermes cost line immediately in post_llm_call (0.4.5)
The classic CLI's GatewayAgent._pump returns at message.complete and
_drain_stale discards later frames, so the previous settlement-ordered
publish (wait for the execution stamp to clear) was silently dropped
client-side even though the daemon logged it as published. Publish
immediately instead; the CLI queues it as a notice flushed after
run_conversation, still below the response.
2026-11-03 17:07:55 +01:00
nvaldez dd89d1b699 fix: GUI Qt fallback - store Qt classes as instance variables
Fix NameError when using Qt backend by storing imported Qt classes
as instance variables instead of relying on local imports in _run_qt.

This ensures that methods like _refresh_sessions_qt, _show_harness_dialog_qt,
and _show_about_qt can access Qt classes without re-importing them.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-03 17:03:32 +01:00
nvaldez eb92acb516 feat: implement GUI interface (SPEC 5.8)
Implement cross-platform Python GUI for session cost visualization:

- Add agent_cost_estimator/gui.py with Tkinter and PyQt5 support
- Default harness from %APPDATA%/agent-cost-estimator/settings.json
- Tree view of sessions in chronological order (latest on top)
- Three columns: model, session price, current turn price
- Auto-discovery of sessions from harness home directories
- CLI entry point: agent-cost-estimator-gui
- Update SPEC 5.8 to Partially Implemented with implementation details

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-03 16:53:10 +01:00
nvaldez 2af0ff0ee4 SPEC: add GUI interface feature requirement
Add section 5.8 GUI Interface with:
- Cross-platform Python GUI (Windows and Linux support)
- Default harness from %APPDATA%/agent-cost-estimator/settings.json
- Tree view of sessions in chronological order (latest on top)
- Three columns: model, session price, current turn price
- Status: Not Implemented

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-03 16:42:55 +01:00
nvaldez d9a52e0366 fix: add stdin forwarder to VSCodium wrapper for ACP protocol
The wrapper was blocking VSCodium's ACP (Agent Communication Protocol) communication
by not forwarding stdin from VSCodium to the real vibe-acp binary. This caused the
extension to appear 'stuck in initializing state' because VSCodium couldn't send
initialization messages to vibe-acp.

This change adds a stdin forwarder thread that reads from the wrapper's stdin
(VSCodium's output) and writes it to vibe-acp's stdin, allowing proper ACP
communication while still enabling hook injection.

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