feat: add Hermes Agent local session support#394
feat: add Hermes Agent local session support#394pinion05 wants to merge 3 commits intojunhoyeo:mainfrom
Conversation
|
Someone is attempting to deploy a commit to the Inevitable Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
2 issues found across 22 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="crates/tokscale-cli/src/main.rs">
<violation number="1" location="crates/tokscale-cli/src/main.rs:1128">
P3: Hermes is now included in client filters, but `capitalize_client` doesn’t have a `"hermes"` arm, so CLI tables will render the client as lowercase `hermes` instead of a branded label (e.g., "Hermes"/"Hermes Agent" as used elsewhere). Add a Hermes mapping to keep display names consistent.</violation>
</file>
<file name="crates/tokscale-core/src/sessions/hermes.rs">
<violation number="1" location="crates/tokscale-core/src/sessions/hermes.rs:154">
P2: Hermes dedup key uses only session_id, which can undercount per-model sessions; include model+provider in the key.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| actual_cost.or(estimated_cost).unwrap_or(0.0).max(0.0), | ||
| ); | ||
| msg.message_count = message_count.max(0); | ||
| msg.dedup_key = Some(session_id); |
There was a problem hiding this comment.
P2: Hermes dedup key uses only session_id, which can undercount per-model sessions; include model+provider in the key.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At crates/tokscale-core/src/sessions/hermes.rs, line 154:
<comment>Hermes dedup key uses only session_id, which can undercount per-model sessions; include model+provider in the key.</comment>
<file context>
@@ -0,0 +1,159 @@
+ actual_cost.or(estimated_cost).unwrap_or(0.0).max(0.0),
+ );
+ msg.message_count = message_count.max(0);
+ msg.dedup_key = Some(session_id);
+ msg
+ },
</file context>
|
Follow-up on the latest bot review:\n\n- I fixed the valid CLI display-name issue that cubic found. Hermes now renders as "Hermes Agent" in the CLI table path as well (commit ).\n- I am intentionally leaving the Hermes unchanged for now. This parser imports one per unique Hermes row from a single SQLite source, and uses as the dedup key. I do not currently have schema or real-data evidence that the same Hermes row id is reused across multiple model/provider variants, so changing the key to include model/provider would be speculative and could weaken the row-identity semantics. If there is a concrete collision/repro case later, I can revisit that separately. |
|
Superseding my previous malformed comment (shell quoting ate the inline code markers):
|
|
@cubic-dev-ai please re-run the review on the latest commit. |
@pinion05 I have started the AI code review. It will take a few minutes to complete. |
Summary
$HERMES_HOME/state.db/~/.hermes/state.dbImplementation details
sessionsSQLite tablemessage_countfrom Hermes session metadata while importing aggregated token totalsactual_cost_usd, fall back toestimated_cost_usd, and infer provider from the model whenbilling_provideris missing or unknownValidation
cargo test -p tokscale-core hermes -qcargo test -p tokscale-cli -qbunx vitest run packages/frontend/__tests__/api/submit.test.tsbunx tsc --noEmit(verified on the main working tree at/home/pinion/tokscale)cargo run -p tokscale-cli -- models --hermes --light --no-spinnercargo run -p tokscale-cli -- graph --hermes --output /tmp/tokscale-hermes-graph.jsonNotes
upstream/mainwith only the meaningful Hermes commits retained, so the diff stays the same while the review history is cleaner.Closes #391
Summary by cubic
Add Hermes Agent local session support by reading the SQLite
sessionstable at$HERMES_HOME/state.db(fallback~/.hermes/state.db). Also fixes CLI labels to consistently show “Hermes Agent”. Addresses #391.New Features
message_count, token totals, dedup byid, and cost selection (preferactual_cost_usd, fallback toestimated_cost_usd; infer provider from model when needed). Skip empty sessions and warn on row decode errors.HERMES_HOMEor default path; exclude Hermes from extra dir scanning; apply pricing when cost is zero intokscale-core.--hermesacross commands, include in default clients, set TUI hotkey toe, add color, display name, and logo intokscale-cli.hermessource ID, logo, color, and display name; include in submission validation and types; add submit API test. Update README with paths and usage.Bug Fixes
Written for commit 7f1f5e5. Summary will update on new commits.