Add section 6.2 to Configuration Files documenting:
- User-configurable pricing files in platform-specific directories
- Windows: %APPDATA%\agent-cost-estimator\price.json and custom-price.json
- Linux/macOS: /agent-cost-estimator/ or ~/.config/agent-cost-estimator/
- price.json initialized from repo version on first run
- custom-price.json created as blank template for user editing
- App reads both files with custom-price.json taking priority for duplicates
- Marked as Not Implemented
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
The VSCodium extension's vibe-acp binary depends on Python 3.12 runtime
libraries in the _internal/ directory (specifically libpython3.12.so.1.0).
The previous patching logic only copied the vibe-acp binary to the backup
directory, but not the _internal/ directory, causing the binary to fail
with 'cannot open shared object file' errors.
This change ensures the _internal/ directory is also backed up, allowing
the patched vibe-acp wrapper to successfully execute the original binary.
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
The universal_newlines parameter is deprecated in Python 3.13, causing
exit code 255 errors in VSCodium extension when the wrapper tries to
start the patched vibe-acp binary.
This change fixes the VSCodium integration to work properly with
Python 3.13+ by using the recommended text=True parameter instead.
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
The simple VIBE_HOME approach doesn't work because:
1. Vibe core in vibe-acp DOES auto-trigger hooks when VIBE_HOME is set
2. But hooks writing to stdout/err break the ACP protocol
Solution: Use a Python wrapper that:
- Sets VIBE_HOME (for hook configuration discovery)
- Monitors journal files for turn completions
- Runs hooks and injects their output into vibe-acp's stdin
- This way, hook output becomes part of the ACP communication
Hook changes:
- Output JSON to stdout (for stdin injection)
- Wrapper captures this and sends to vibe-acp stdin
This ensures costs are displayed in the VSCodium chat UI.
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
The watchdog-based Python wrapper was causing issues. This reverts to the
simple approach from commit 434589e which just sets VIBE_HOME and lets
the Vibe core auto-trigger hooks.
The key fix is in the hook itself (commit 901dbca) which writes to stderr
instead of stdout to avoid breaking the ACP protocol.
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
The Vibe core in vibe-acp (ACP mode) automatically triggers hooks when
VIBE_HOME is set. However, hooks that write to stdout will break the ACP
protocol that vibe-acp uses to communicate with VSCodium.
This fix modifies the VSCodium hook (mistral-vibe-code/post_turn.py) to:
- Write all output to stderr instead of stdout
- VSCodium will still display stderr output in the UI
- This avoids corrupting the ACP communication channel
The simpler approach:
1. Set VIBE_HOME environment variable (via shell wrapper)
2. Let Vibe core auto-trigger hooks
3. Hooks write to stderr (not stdout)
This is simpler and more reliable than the watchdog-based approach.
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
The previous commit (434589e) attempted to simplify the VSCodium integration
by just setting VIBE_HOME, assuming vibe-acp would automatically trigger hooks.
However, this approach doesn't work because:
1. The Vibe core in vibe-acp (ACP mode) does NOT automatically trigger hooks
2. Hooks write to stdout, which breaks the ACP protocol
This commit reverts to the watchdog-based approach from commit 89c615d but
improves it by:
- Using a Python wrapper instead of a shell script
- Monitoring journal files for turn completions
- Running hooks and writing output to vibe-acp's stdin (not stdout)
- Gracefully handling missing watchdog dependency
- Maintaining backward compatibility
The Python wrapper:
- Uses watchdog to monitor ~/.vibe/logs/session/unified/ for journal file changes
- When a journal file is created/modified, it identifies the session
- Runs all configured post_agent hooks for that session
- Writes hook output to vibe-acp's stdin to avoid breaking ACP protocol
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
The Vibe core in vibe-acp automatically loads hooks from $VIBE_HOME/hooks/
when VIBE_HOME is set. This is a much simpler approach than the previous
watchdog-based monitoring.
The wrapper now:
1. Sets VIBE_HOME to ~/.vibe
2. Executes the original vibe-acp binary
The original binary and its _internal directory are backed up to _backup/
to ensure PyInstaller runtime files are preserved.
The Vibe core will then automatically execute post_agent hooks after each
assistant turn, displaying the cost tracker.
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
The VSCodium extension uses vibe-acp which communicates with the Vibe core via
stdin/stdout. The Vibe core in the extension does NOT automatically trigger
hhooks, so we need to monitor journal files and inject hook messages.
This fix:
- Uses subprocess.Popen to keep vibe-acp's stdin pipe open
- Writes hook output directly to vibe-acp's stdin
- Allows the Vibe core to process and display hook messages properly
- Avoids breaking the ACP protocol
The hook output format (system_message JSON) is recognized by the Vibe core,
which displays it as the last line in the chat after each assistant turn.
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
The 0.4.3 detached-thread publish could lose the line with no
trace: any failure inside _publish_notification (owner lookup
import error, session not live, missing event stream, publish
exception) returned quietly and the detached thread exited.
- every daemon-path failure now falls back to print() AND logs a
WARNING/INFO tagged [cost], so a regression is diagnosable
from the daemon's logs (grep '\[cost\]' in
~/.hermes/logs/errors.log) instead of a missing line
- session-not-live now falls back (was: silent skip)
- stream lookup is defensive (no event stream -> print + warn)
- success path logs INFO '[cost] published notification'
- 57/57 tests pass; version 0.4.4 (package + manifest)
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
Ordering: post_llm_call fires in the agent worker thread before
the gateway settles the turn and publishes message.complete, so
an immediate notification.show lands ABOVE the response. The
publish now waits (bounded 60s, detached daemon thread so the
timeout-bounded hook returns instantly) until the session's
execution stamp clears - the settlement clears it strictly
after message.complete - making the cost line the LAST line of
every turn. Same hold pattern as the gateway's background-review
delivery.
Label: the line showed the pricing-table match (zai:zai-glm-5-3)
even when the session bills through a custom provider route.
The label now comes from the billing route: the config.yaml
custom_providers name matching the session's billing_base_url
(hermes_cli.config.load_config first, regex fallback for
standalone), else the stored billing_provider when not
generic, else the pricing key. A session served by the custom
provider 'mistral' now shows mistral:zai-glm-5-3.
Also: restore the zai provider in the bundled pricing.json
(dropped by an uncommitted local edit; plugin-local lookup made
the loss visible as default:default).
- tests: completion-stamp wait, billing-route label, execution
stamp on the notification mock
- version 0.4.3 (package + plugin manifest)
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
CLI chat sessions run inside the long-lived hermes gateway
daemon, whose stdout is a socket - print() from the plugin never
reaches the user's terminal. The CLI client renders
notification.show events from the session's event stream (the
same seam the credits tracker and /login notices use), so:
- _publish_cost_line: resolve the daemon's session authority
(gateway.session_cron.owner_for_home; same-process pid check
makes this a no-op outside the daemon), publish a
notification.show on the live session's event stream
(text/level/kind/key payload, thread-safe publish)
- fall back to print() when no authority (in-process CLI runs)
- tests: daemon publish (mocked authority) + in-process fallback
- version 0.4.2 (package + plugin manifest)
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
Interactive CLI chat in current Hermes builds runs through the
gateway's local adapter, so post_llm_call receives
platform == 'local', not 'cli'. The print gate now accepts both
(ledger records confirmed the plugin loaded and recorded; only
the print was gated off).
- PRINT_PLATFORMS = {'cli', 'local'} in the plugin
- regression test: test_plugin_prints_for_local_platform
- SPEC.md print-gating section updated
- version 0.4.1 (package + plugin manifest)
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
The VSCodium extension uses vibe-acp which communicates with the Vibe core via
stdin/stdout. Hook messages need to be sent to vibe-acp's stdin so the Vibe core
can process and display them properly.
This fix uses subprocess.Popen to keep the stdin pipe open and writes hook
output directly to vibe-acp's stdin, allowing the Vibe core to handle system
messages without breaking the ACP protocol.
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
The VSCodium extension uses JSON-RPC over stdout for ACP communication with
vibe-acp. Printing hook output to stdout corrupts this protocol, causing
the extension to fail during initialization.
This change sends hook output to stderr instead, allowing the Vibe core to
receive clean ACP messages on stdout while the extension can still display
hook messages to the user.
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
- Add support for Mistral Vibe VSCodium extension (mistral-vibe-code)
- Restructure hooks into modular directories (mistral-vibe-cli/, mistral-vibe-code/)
- Enhance model detection with fallback to global config.toml
- Add --rm-integrate command to remove hooks integration
- Add VSCodium extension patching for hooks support
- Add hooks/README.md documentation
- Update SPEC.md with VSCodium configuration details
- Bump version to 0.3.0
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
- Clarify that version MUST be bumped for ANY code change
- Specify semantic versioning guidelines
- Emphasize bumping BEFORE committing
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
- Each model now includes:
- source: Where the pricing data came from
- date: When the pricing was last updated
- Helps track pricing provenance and currency
- All tests still pass
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
- 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>
- Moved Vibe CLI specific hook files (post_turn.py, hooks.toml) to new Section 7
- Created Section 7: Harness-Specific Configurations
- Updated TOC to reflect new structure
- Section 6 now only contains general configuration (pricing.json)
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
- Document architecture, data flow, and module structure
- Define harness adapter interface contract
- Specify pricing table format (provider-based)
- Document hook integration requirements
- List all feature requirements and configuration files
- Include glossary, examples, and file index
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
- Swapped parameter order in effective_rates() to pass alias (active_model) as model_name
- This ensures the actual running model is displayed in hook output
- Updated docstring to clarify the new priority order
- All 30 tests still pass
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
- Changed --integrate from flag to argument that requires a harness name
- Currently supports 'mistral' harness (Vibe CLI)
- Renamed integrate_vibe_hooks() to integrate_hooks() for modularity
- Added validation for supported harnesses
- Added tests for --integrate command validation
- Modular design allows adding more harnesses in the future
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
- Modified get_model_prices() in pricing.py to return is_default flag
- Updated CLI to display warning in all output modes (default, details, JSON)
- Warning format: '**model price not available**' on new line
- Updated all tests to handle 4-tuple return value
- Works with refactored provider-based pricing structure
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
- New command: agent-cost-estimator --integrate
- Installs post_turn.py hook script to ~/.vibe/hooks/
- Creates/updates ~/.vibe/hooks.toml with hook configuration
- Adds agent-cost-estimator to Vibe's bash allowlist in config.toml
- Hook script bundled in agent_cost_estimator/hooks/ package
- Works on all machines (portable installation)
- Added hooks package to pyproject.toml
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
- Remove root-level currency and models (flat structure)
- Keep only providers dictionary with nested currency and models
- Add default provider as fallback
- Add mistral-vibe-cli-latest model to mistral provider
- Simplify pricing.py to remove backward compatibility code
- Update tests to use provider-based structure
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
- Add 'providers' top-level dictionary with provider-specific configurations
- Each provider has its own 'currency' and 'models' dictionary
- Model-level currency can override provider currency
- Maintain backward compatibility with flat structure (currency + models at root)
- Update pricing.py to handle both structures with provider-aware lookup
- Update get_model_prices() to return (rates, key, currency) tuple
- Update CLI to display currency and provider-prefixed model keys
- Update tests to handle new return signature
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
The original package-data configuration used invalid TOML syntax with
empty string and wildcard keys that are not supported by setuptools.
This caused pip install to fail with TOMLDecodeError.
Changed to use include-package-data = true which automatically includes
all non-Python files in the package directories (pricing.json, SKILL.md).
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
- Add --no-env flag to skip virtual environment creation
- Add --local flag to install with --user (user-local installation)
- Update both bash and PowerShell scripts
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
- Python CLI tool to report token usage and estimated USD cost
- Supports Mistral Vibe harness with pluggable adapter interface
- Includes SKILL.md in skill/ directory for LLM consumption via --skill flag
- Full test suite (28 tests)
- Typical Python project structure with .gitignore, .gitattributes, LICENSE, README.md
- Build script for PyPI distribution
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>