Repository navigation
feat: effort level display in model bracket - #471
Merged
jarrodwatts merged 1 commit intoApr 20, 2026
Merged
Conversation
Displays the current reasoning effort level inside the model bracket (e.g., [Opus 4.6 ●max]) when `display.showEffortLevel` is enabled. Data source priority: 1. stdin.effort field (future-proof — ready for when Claude Code exposes effort in statusline JSON, per issues #39399, #50060) 2. Parent process CLI args (detects --effort flag at session start) Supports all known levels with progressive fill symbols: ○ low | ◔ medium | ◑ high | ◕ xhigh | ● max Unknown future levels display as plain text (no symbol), ensuring forward compatibility as Claude Code adds/removes effort levels. Also fixes: version selector in setup.md bash templates now filters non-semver directories (e.g., .bak, -old) via grep before sort, matching the existing PowerShell behavior. Closes jarrodwatts#201, relates to anthropics/claude-code#39399
jarrodwatts
approved these changes
Apr 20, 2026
jarrodwatts
left a comment
Owner
There was a problem hiding this comment.
The opt-in model-bracket placement fits the HUD better than the environment line variants, the data source prefers real session state over stale defaults, and the rebased branch passed the full test suite on current main. Merging.
This was referenced Apr 20, 2026
prezis
added a commit
to prezis/claude-hud
that referenced
this pull request
Apr 30, 2026
This fork adds a 4th resolution step to claude-hud's effort detection so the badge works for users on Claude Code < 2.1.115 (no stdin.effort) and for users who set effortLevel persistently in settings.json instead of via --effort CLI flag. Resolution priority (highest -> lowest): 1. stdin.effort string (PR jarrodwatts#471 path, upstream) 2. stdin.effort.level object (PR jarrodwatts#491, upstream, CC 2.1.115+) 3. --effort CLI flag from parent process (upstream) 4. settings.json effortLevel (NEW, this fork) -- reads from ${cwd}/.claude/settings.local.json, then settings.json, then ${CLAUDE_CONFIG_DIR:-~/.claude}/settings.json. Most-specific wins. Behavior change: display.showEffortLevel default flipped false -> true (this fork's whole purpose is to make effort visible by default). Source changes (already in eb58786 via auto-commit hook): src/effort.ts adds readSettingsEffort + cwd param; src/index.ts threads stdin.cwd; src/config.ts flips default; tests/effort.test.js +8 tests for the fallback (project-local > project > user precedence, malformed JSON, non-string values, stdin still wins). This commit: README banner explaining fork differences + CHANGELOG entry. Tests: 519/520 pass (1 pre-existing skip). Upstream-able: source changes are surgical and additive; PR candidate.
hseunghwan
added a commit
to hseunghwan/claude-hud
that referenced
this pull request
Jun 20, 2026
stdin reports ultracode as plain `xhigh`, so the distinction is recovered from the transcript: the ultra_effort_enter / ultra_effort_exit attachment markers combined with the immediate /effort command output, last signal wins. The exit attachment can lag a turn, so the /effort output is what clears a stale label the instant effort drops back to plain xhigh. The /effort signal matches only a complete <local-command-stdout>...</local-command-stdout> block anchored at the start of a user record, so prose that merely quotes or echoes the phrase (in user or assistant text) cannot flip the state. Also drops the ps-based parent-process --effort fallback (jarrodwatts#471); effort now comes solely from Claude Code stdin, removing a subprocess spawn on every statusline refresh. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01K9mvZZfMk6WyKiTxnV4GAG
hseunghwan
added a commit
to hseunghwan/claude-hud
that referenced
this pull request
Jun 20, 2026
stdin reports ultracode as plain xhigh, so the distinction is recovered from the transcript: the ultra_effort_enter / ultra_effort_exit attachment markers combined with the immediate /effort command output, last signal wins. The exit attachment can lag a turn, so the /effort output is what clears a stale label the instant effort drops back to plain xhigh. The /effort signal matches only a complete <local-command-stdout>...</local-command-stdout> block anchored at the start of a user record, so prose that merely quotes or echoes the phrase (in user or assistant text) cannot flip the state. Also drops the ps-based parent-process --effort fallback (jarrodwatts#471); effort now comes solely from Claude Code stdin, removing a subprocess spawn on every statusline refresh.
hseunghwan
added a commit
to hseunghwan/claude-hud
that referenced
this pull request
Jun 20, 2026
stdin reports ultracode as a normal level (xhigh), so the distinction is recovered from the transcript: the ultra_effort_enter / ultra_effort_exit attachment markers combined with the immediate /effort command output, last signal wins. The exit attachment can lag a turn, so the /effort output is what clears a stale label the instant effort drops back. When the marker is active the reported level is wrapped as ultracode(<level>), taken as-is rather than assumed to be xhigh. The /effort signal matches a <local-command-stdout> block anchored at the start of a user record, so prose that merely quotes the phrase cannot flip the state. Also drops the ps-based parent-process --effort fallback (jarrodwatts#471); effort now comes solely from Claude Code stdin, removing a subprocess spawn on every statusline refresh. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01K9mvZZfMk6WyKiTxnV4GAG
hseunghwan
added a commit
to hseunghwan/claude-hud
that referenced
this pull request
Jun 20, 2026
stdin reports ultracode as a normal level (xhigh), so the distinction is recovered from the transcript: the ultra_effort_enter / ultra_effort_exit attachment markers combined with the immediate /effort command output, last signal wins. The exit attachment can lag a turn, so the /effort output is what clears a stale label the instant effort drops back. When the marker is active the reported level is wrapped as ultracode(<level>), taken as-is rather than assumed to be xhigh. The /effort signal matches a <local-command-stdout> block anchored at the start of a user record, so prose that merely quotes the phrase cannot flip the state. Also drops the ps-based parent-process --effort fallback (jarrodwatts#471); effort now comes solely from Claude Code stdin, removing a subprocess spawn on every statusline refresh.
hseunghwan
added a commit
to hseunghwan/claude-hud
that referenced
this pull request
Jun 20, 2026
Claude Code reports ultracode as a normal level (xhigh) in stdin, so the statusline recovers it from the transcript: the ultra_effort_enter / ultra_effort_exit attachment markers and the immediate /effort command output, latest signal wins. When active, the reported level is wrapped as ultracode(<level>), taken as-is rather than assumed to be xhigh. Also drop the ps-based parent-process --effort fallback (jarrodwatts#471); the effort label now comes solely from Claude Code stdin, removing a subprocess spawn on every statusline refresh. Co-authored-by: Claude <[email protected]>
4 tasks done
jarrodwatts
pushed a commit
to hseunghwan/claude-hud
that referenced
this pull request
Jul 13, 2026
Claude Code reports ultracode as a normal level (xhigh) in stdin, so the statusline recovers it from the transcript: the ultra_effort_enter / ultra_effort_exit attachment markers and the immediate /effort command output, latest signal wins. When active, the reported level is wrapped as ultracode(<level>), taken as-is rather than assumed to be xhigh. Also drop the ps-based parent-process --effort fallback (jarrodwatts#471); the effort label now comes solely from Claude Code stdin, removing a subprocess spawn on every statusline refresh. Co-authored-by: Claude <[email protected]>
jarrodwatts
pushed a commit
that referenced
this pull request
Jul 13, 2026
Claude Code reports ultracode as a normal level (xhigh) in stdin, so the statusline recovers it from the transcript: the ultra_effort_enter / ultra_effort_exit attachment markers and the immediate /effort command output, latest signal wins. When active, the reported level is wrapped as ultracode(<level>), taken as-is rather than assumed to be xhigh. Also drop the ps-based parent-process --effort fallback (#471); the effort label now comes solely from Claude Code stdin, removing a subprocess spawn on every statusline refresh. Co-authored-by: Claude <[email protected]>
4 tasks done
UnpxreTW
added a commit
to UnpxreTW/claude-hud
that referenced
this pull request
Jul 13, 2026
* feat: add advisor model display (display.showAdvisor) Surfaces the model configured via Claude Code's `/advisor` command so it sits inline on the project line: [Opus 4.7 (1M context)] │ AthenaKB git:(main*) │ Advisor: Opus 4.7 Context ██░░░░░░░░ 19% ## How it works Claude Code stamps an `advisorModel` field onto every assistant record in the session transcript when `/advisor` is configured. The transcript parser already walks every line for tool / agent / todo state, so this just captures the latest non-empty `advisorModel` into the existing `TranscriptData` shape with no extra IO. `renderProjectLine` then appends the prettified label (e.g. `claude-opus-4-7` → `Opus 4.7`) as another part on the same row, respecting the existing ` │ ` separator and ANSI handling. A `display.showAdvisor` boolean (default false) gates the whole block; `display.advisorOverride` lets users force a custom label if needed. ## What's included - `TranscriptData.advisorModel` field + parser capture - TRANSCRIPT_CACHE_VERSION bumped 5 → 6 to invalidate caches that predate the new field - `display.showAdvisor` / `display.advisorOverride` config + validation - `renderProjectLine` integration + `prettifyAdvisorId` helper that handles both canonical IDs and short aliases - i18n labels for en (`Advisor`) and zh-Hans (`顾问`) - `configure.md` Element Mapping + Turn Off/On flow entries - 15 new tests covering ID prettification, render gating, transcript capture (latest-wins, empty-string-ignored, missing-field fallback), and config validation ## Notes - `dist/` is intentionally untouched per CONTRIBUTING.md - One pre-existing failure remains in `countConfigs cache: miss on nested rules additions` — it fails identically on main without any of my changes * feat: add customLinePosition config to control custom line placement (jarrodwatts#575) Adds display.customLinePosition so users can place customLine before the model badge while preserving the existing default placement. * build: compile dist/ [auto] * fix: stabilize context fallback and todo rendering (jarrodwatts#579) Fixes context fallback for streaming zero frames and guards todo rendering when content is missing.\n\nCloses jarrodwatts#576.\nCloses jarrodwatts#577. * build: compile dist/ [auto] * fix(advisor): security hardening pass on advisor display Addresses review feedback from jarrodwatts#573: - Sanitize both `ctx.transcript.advisorModel` and `display.advisorOverride` through the existing `sanitizeDisplayText` helper before rendering so ANSI ESC, OSC, C0/C1 control, and bidi sequences cannot reach the terminal. Defence-in-depth: re-sanitize the prettified result too. - Cap advisor display at 64 chars at the render layer (MAX_ADVISOR_DISPLAY_LEN), regardless of source. - In the transcript parser, capture `advisorModel` only from records whose `type === 'assistant'` (matching the documented schema) and hard-cap the captured value at 64 chars (ADVISOR_MODEL_MAX_LEN) so a malformed log cannot persist an oversized value through the JSON cache. Bumps TRANSCRIPT_CACHE_VERSION 6 → 7. The cache deserializer also re-applies the cap as belt-and-braces against legacy entries. - Add 9 new tests covering: CSI/OSC stripping (ANSI ESC + BEL + DEL bytes), bidi mark stripping (RLO/PDF), oversize transcript truncation, oversize override truncation (display-layer), sanitize-collapses-to- empty fallback, non-assistant record rejection (user / custom-title / system), inline placement in expanded layout (renderProjectLine), and inline placement in compact layout (renderSessionLine). - Document `display.showAdvisor` and `display.advisorOverride` in README.md and README.zh.md configuration tables. `npm test`: 637 / 639 pass + 1 skip + 1 pre-existing unrelated failure (`countConfigs cache: miss on nested rules additions`, fails identically on `main`). * feat: add optional autoCompactWindow context denominator * feat: use autoCompactWindow as token-display denominator too * release: prep v0.1.0 * docs: clarify plugin release versioning * fix: validate autoCompactWindow as an integer * build: compile dist/ [auto] * build: compile dist/ [auto] * build(deps-dev): bump @types/node from 25.9.1 to 25.9.2 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 25.9.1 to 25.9.2. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-version: 25.9.2 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * feat: add showSkills / showMcp HUD display elements * feat(usage): render balance_label alongside stdin rate_limits Previously, external-snapshot balance_label was shown only when stdin rate_limits were absent (mutually exclusive). Rate-limit windows (5h/7d) and a prepaid/metered dollar balance are complementary data, so both should be visible when available. Changes: - index.ts: when stdin provides rate_limits, also read the external snapshot for a balance_label (only when externalUsagePath is set) and merge it onto usageData - session-line.ts: render balance_label as an additive segment after the windows block rather than as an exclusive leading branch; standalone balance (no window data) preserves existing behaviour - tests/render.test.js: add test for combined windows + balance display Backward-compatible: users without externalUsagePath configured see no behaviour change (no extra file read, no extra segment). * fix: render external balance with usage windows * fix: harden skills and mcp activity rendering * build: compile dist/ [auto] * fix: stabilize setup and bash tool targets * build: compile dist/ [auto] * release: 0.1.1 * fix(i18n): translate "token" as 词元 instead of 令牌 in Simplified Chinese 令牌 is the established Chinese rendering of "token" in the authentication/security sense only (access token → 访问令牌). For the NLP/LLM sense — the unit of text shown by the HUD's token counters — the standard term is 词元, officially designated as the Chinese name for the AI-domain term "token" by the China National Committee for Terms in Sciences and Technologies on 2026-03-25. dist/ is intentionally untouched; it is auto-compiled by the build-dist workflow. * docs: refresh CLAUDE.md architecture overview to match current source The File Structure section predated many modules that now exist in src/ (skills-mcp-line, advisor, cost, external-usage, speed-tracker, i18n, width handling, and the newer render/lines entries), and the opt-in lines list was missing the Skills/MCP activity lines and advisor label. Update both so agents reading CLAUDE.md get an accurate map of the codebase. Docs only, no behavior change. Co-Authored-By: Claude Fable 5 <[email protected]> * feat: add fallback speed estimation via transcript file growth When the model provider does not return output_tokens (e.g. non-standard proxies), the HUD shows no token/s speed at all. This adds a fallback that estimates speed from transcript file size growth (~4 bytes/token heuristic) when output_tokens is unavailable. The primary output_tokens path remains unchanged - the fallback only activates when the provider skips the field. * test: harden transcript speed fallback * build: compile dist/ [auto] * feat: show session compaction count behind opt-in showCompactions setting * feat: add CLAUDE_HUD_DISABLE env var kill-switch to disable the HUD * docs: sync configure.md with current config schema The guided /configure command doc had drifted from src/config.ts. Several display elements were added to the schema (and rendered by the HUD) without being surfaced in the configure flow, so users had no guided way to toggle them and the Element Mapping table was incomplete. Missing elements now documented and added to the Turn On / Turn Off lists: - showEffortLevel (reasoning level: low/medium/high/xhigh/max) - showOutputStyle (current output style name) - showCost (session cost) - showSkills, showMcp (activity elements added in the skills/mcp commit) - showMemoryUsage - showPromptCache (+ promptCacheTtlSeconds) - showClaudeCodeVersion - showAddedDirs (+ addedDirsLayout) - showResetLabel Also: - Element Mapping table now lists every show* boolean in the schema, including showModel / showContextBar (previously mislabeled "not configurable" — they are configurable booleans that default to true). - Removed the internal contradiction where usageValue was listed both as an un-edited "advanced" setting and in the Element Mapping table. - Expanded the advanced-settings note to cover the keys the guided flow preserves but does not edit (elementOrder, mergeGroups, modelFormat, autoCompactWindow, sevenDayThreshold, advisorOverride, externalUsage*, etc). - Updated the Full preset definition to enable the newly documented elements. No behavior change to the renderer; this is a documentation/UX sync so the guided configure flow matches what the HUD can actually display. * build(deps-dev): bump @types/node from 25.9.2 to 25.9.3 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 25.9.2 to 25.9.3. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-version: 25.9.3 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * docs: sync Chinese compactions config docs * docs: cover remaining configure display options * build: compile dist/ [auto] * release: 0.2.0 * fix: merge seven-day usage from external snapshot Merge missing seven-day usage from a configured external snapshot when stdin only supplies the five-hour window. Adds regression coverage for the partial-stdin fallback path. Verified locally with npm ci, npm run build, and node --test tests/index.test.js tests/external-usage.test.js. * fix(security): require opt-in for extra command Require CLAUDE_HUD_ALLOW_EXTRA_CMD before executing --extra-cmd, tighten cache file permissions, and document the local command trust boundary. Maintainer follow-up removed generated dist artifacts from the PR and added extra opt-in parsing coverage. Verified locally with npm ci, npm test, and node --test tests/extra-cmd.test.js. Fixes jarrodwatts#618. * fix(cost): correct Opus 4.5 pricing Update Opus 4.5+ local cost estimates to the official standard Anthropic rate of $5/M input and $25/M output while keeping older Opus 4.0/4.1 estimates on $15/M input and $75/M output. Adds focused coverage for Opus 4.5/4.6, Bedrock-style model IDs, and the older fallback. Verified locally with npm ci, npm run build, and node --test tests/core.test.js tests/render.test.js. GitHub CI passed on Node 18 and 20. Fixes jarrodwatts#622. Supersedes jarrodwatts#624. * build: compile dist/ [auto] * release: 0.2.1 Bump package, lockfile, plugin metadata, and marketplace metadata to 0.2.1. Document the jarrodwatts#617, jarrodwatts#619, and jarrodwatts#625 fixes in CHANGELOG.md. Verified locally with npm ci, npm run build, npm test, npm run test:coverage, version metadata checks, and dist/index.js presence. GitHub CI passed on Node 18 and 20. * refactor: extract duplicated code into shared utilities (jarrodwatts#634) - formatTokens: 3 identical copies → src/utils/format.ts - formatContextValue: 2 identical copies → src/utils/format.ts - hyperlink/getFileHref/safeHyperlink: 2 copies each → src/utils/hyperlinks.ts - ANSI/control/bidi sanitization: 4 implementations → src/utils/sanitize.ts - truncateDesc/truncateContent: 2 copies → src/utils/truncate.ts - DEBUG flag inline checks: replaced with createDebug() from debug.ts 11 files updated to import from 4 new shared utility modules. No behavioral changes; all existing tests pass. Co-authored-by: Jarrod Watts <[email protected]> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * build: compile dist/ [auto] * fix: harden cache file permissions and imports for security (jarrodwatts#632) - speed-tracker: write cache files with 0o600 and directories with 0o700, matching the permission model used by all other cache writers (transcript, context-cache, config-cache, version). Previously used default umask, leaving token counts and timestamps world-readable on shared systems. - transcript.ts, config-reader.ts: use node: protocol prefix for built-in module imports (fs, path, os, readline). Bare specifiers can be hijacked by a same-named package in node_modules; the node: prefix guarantees the Node.js built-in. - external-usage: require externalUsagePath to be an absolute path before reading, consistent with the write-path validation in resolveSnapshotWritePath(). Relative paths are now silently ignored. Co-authored-by: Jarrod Watts <[email protected]> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * build: compile dist/ [auto] * Improve error handling: add debug logging to silent catch blocks (jarrodwatts#633) Replace empty catch {} blocks with catch (err) and debug() logging across 11 source files. This makes errors visible when DEBUG=claude-hud:* is set, while preserving the non-fatal fallback behavior required by a statusline plugin that runs every ~300ms. Files improved: - stdin.ts: stream setup, JSON parse, and stream error handlers - git.ts: branch, status, diff, ahead/behind, and remote URL commands - transcript.ts: file stat, cache read/write, line parse, stream errors - config.ts: config file load failure - config-reader.ts: path comparison, sentinel stat, cache read/write - context-cache.ts: cache read/write, sweep operations - speed-tracker.ts: cache read/write, file size tracking, legacy cleanup - version.ts: binary stat, cache read/write, exec, executable check - external-usage.ts: snapshot comparison, directory check, write, read - memory.ts: /proc/meminfo, vm_stat, and memory calculation - effort.ts: parent process effort detection All catch blocks now capture the error variable and pass it to the existing createDebug() utility with contextual messages including file paths and operation descriptions. Co-authored-by: Jarrod Watts <[email protected]> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * build: compile dist/ [auto] * Add unit tests for modules with lowest coverage (jarrodwatts#635) Add comprehensive tests targeting the 6 modules with the least test coverage: - cost.ts: 87.64% → 100% statements, 75.6% → 100% branch - identity.ts: 87.96% → 96.29% statements, 40.74% → 76.31% branch - session-tokens.ts: 85.71% → 100% statements, 76.92% → 100% branch - usage.ts: 85.95% → 97.94% statements, 82.29% → 88.88% branch - memory.ts: 77.41% → 79.03% statements, 73.33% → 85.71% branch - version.ts: 72.78% → 74.68% statements, 66.66% → 80.3% branch Overall coverage improved from 93.56% → 94.6% statements, 84.54% → 86.23% branch. Co-authored-by: Jarrod Watts <[email protected]> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(cost): clarify Bedrock test intent and add real-session coverage (jarrodwatts#636) Add a comment explaining that the existing bedrockOpus46 test exercises regex normalization (display_name only), not real Bedrock pricing behavior. Add a complementary test confirming that real Bedrock sessions (with model.id containing 'anthropic.claude-') correctly skip cost estimation via the isBedrockModelId early return. Co-authored-by: Jarrod Watts <[email protected]> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * feat: optionally show provider label before model Add opt-in provider label placement for custom proxy workflows while preserving the existing default model badge order. Compact and expanded layouts now share the same badge formatter. Closes jarrodwatts#620 * build: compile dist/ [auto] * test: lock down usage and speed cache hardening Document the absolute read-path requirement for external usage snapshots and add focused tests for relative read rejection plus private speed-cache directory and file modes. * release: 0.3.0 Bump plugin, package, lockfile, and marketplace metadata to 0.3.0 and document the provider label plus cache-hardening changes. * test: handle non-ASCII entrypoint paths (jarrodwatts#655) * refactor(i18n): let locales own layout via a tiny interpolate() helper (jarrodwatts#647) * feat: add opt-in showRoutedCost for Bedrock/Vertex cost (jarrodwatts#648) Closes jarrodwatts#621 * build(deps-dev): bump @types/node from 25.9.3 to 26.1.1 (jarrodwatts#657) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 25.9.3 to 26.1.1. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-version: 26.1.1 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build: compile dist/ [auto] * fix: correct effort suffix placement and guard check inconsistencies (jarrodwatts#650) * fix: correct effort suffix placement and guard check inconsistencies the effort level tag (like "max") was showing up after the provider name instead of after the model — so you'd see "Opus | Bedrock max" when it should be "Opus max | Bedrock". small thing but it looked wrong. also fixed a few spots where opt-in features (showDuration, showConfigCounts) were using !== false checks instead of === true, which could show them unexpectedly if the config object was partially constructed. cleaned up duplicate debug namespaces too — two modules were both using 'context' and two were using 'config', which made debug output confusing. * test: cover effort and opt-in render guards --------- Co-authored-by: Jarrod Watts <[email protected]> * feat(display): show auth method and logged-in account on the first line (jarrodwatts#652) * feat(display): show auth method and logged-in account on the first line Adds an opt-in segment at the end of the first HUD line showing the subscription plan of the current login (e.g. "Claude Max 20x") and the logged-in account, derived from the oauthAccount block that Claude Code persists in {CLAUDE_CONFIG_DIR}.json. New display options (all default off): - display.showAuth: plan label, e.g. "Claude Max 20x" / "API Key" - display.showAuthUser: email local part (fallback: displayName) - display.authUserLength: truncation length, 0 = full (default 8) * fix(auth): strip whole ANSI sequences via shared sanitizeDisplayText helper Replaces the local codepoint-class regex with the existing sanitizeDisplayText() util so CSI/OSC sequences are removed entirely instead of leaving parameter bytes behind (evil\x1b[31m@… -> evil@…), matching how other externally-sourced display text is sanitized. * fix(auth): prefer active API key over stale OAuth profile --------- Co-authored-by: BBleae <[email protected]> Co-authored-by: Jarrod Watts <[email protected]> * fix: Fix duplicate counting issue in assistant message usage statistics (jarrodwatts#646) * fix: Fix duplicate counting issue in assistant message usage statistics * Harden transcript usage deduplication --------- Co-authored-by: yuanliu <[email protected]> Co-authored-by: Claude HUD Maintainer <[email protected]> * build(deps-dev): bump typescript from 6.0.3 to 7.0.2 (jarrodwatts#656) Bumps [typescript](https://github.com/microsoft/TypeScript) from 6.0.3 to 7.0.2. - [Release notes](https://github.com/microsoft/TypeScript/releases) - [Commits](https://github.com/microsoft/TypeScript/commits) --- updated-dependencies: - dependency-name: typescript dependency-version: 7.0.2 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build: compile dist/ [auto] * Fix symlinked rules and compact cache tokens (jarrodwatts#659) Co-authored-by: Codex Maintainer <[email protected]> * build: compile dist/ [auto] * feat(effort): show ultracode sessions as ultracode(xhigh) (jarrodwatts#640) Claude Code reports ultracode as a normal level (xhigh) in stdin, so the statusline recovers it from the transcript: the ultra_effort_enter / ultra_effort_exit attachment markers and the immediate /effort command output, latest signal wins. When active, the reported level is wrapped as ultracode(<level>), taken as-is rather than assumed to be xhigh. Also drop the ps-based parent-process --effort fallback (jarrodwatts#471); the effort label now comes solely from Claude Code stdin, removing a subprocess spawn on every statusline refresh. Co-authored-by: Claude <[email protected]> * build: compile dist/ [auto] * feat(i18n): add Traditional Chinese (zh-Hant / zh-TW) locale (jarrodwatts#645) - Add src/i18n/zh-Hant.ts with full Traditional Chinese translations - Update Language type to include 'zh-Hant' and 'zh-TW' - Register zh-Hant locale and zh-TW alias in i18n index - Update validateLanguage() in config.ts to accept zh-Hant and zh-TW - Fix session-time.ts: replace getLanguage() === 'zh' with isCjkLanguage() so zh-Hant also gets correct no-space formatting (e.g. '5m前' not '5m 前') - Add test coverage for zh-Hant and zh-TW in i18n.test.js Co-authored-by: YutenC <[email protected]> * build: compile dist/ [auto] * feat: add display.modelSource for proxy users (auto/stdin/transcript) (jarrodwatts#643) * feat: add display.modelSource for proxy users (auto/stdin/transcript) Users behind API proxies (cc-switch, LiteLLM, OpenRouter passthrough) see the wrong model name because Claude Code reports the configured model, not the one the proxy actually served. This PR adds a `display.modelSource` config option: - `auto` (default): uses stdin model for Claude models, transcript model for non-Claude. Zero impact on existing users. - `stdin`: always use Claude Code's reported model (current behavior). - `transcript`: always use the model from the API response's `message.model` field. Best for proxy users who want the real model. Implementation: - TranscriptData.lastAssistantModel: captures the actual model from each assistant message's `message.model` field - stdin.resolveModelName(): resolves model based on modelSource config - project.ts + session-line.ts: use resolveModelName instead of getModelName - Cache serialization updated to persist lastAssistantModel Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Harden transcript model display --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]> Co-authored-by: Claude HUD Maintainer <[email protected]> * build: compile dist/ [auto] * release: 0.4.0 (jarrodwatts#660) Co-authored-by: Codex Release <[email protected]> --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: yjtdkj <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jarrod Watts <[email protected]> Co-authored-by: Matt Van Horn <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kang Seong Jae <[email protected]> Co-authored-by: Claude <[email protected]> Co-authored-by: diaojz <[email protected]> Co-authored-by: ViewWay <[email protected]> Co-authored-by: John Costa <[email protected]> Co-authored-by: tgoldblatt <[email protected]> Co-authored-by: CDD-Jarvis <[email protected]> Co-authored-by: jorgelaranjo <[email protected]> Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Jarrod Watts <[email protected]> Co-authored-by: Longado <[email protected]> Co-authored-by: kywoo26 <[email protected]> Co-authored-by: Semianchuk Vitalii <[email protected]> Co-authored-by: Jarrod Watts <[email protected]> Co-authored-by: 晴猫 <[email protected]> Co-authored-by: BBleae <[email protected]> Co-authored-by: yuanliu <[email protected]> Co-authored-by: yuanliu <[email protected]> Co-authored-by: Claude HUD Maintainer <[email protected]> Co-authored-by: Codex Maintainer <[email protected]> Co-authored-by: hyunsh <[email protected]> Co-authored-by: YutenC <[email protected]> Co-authored-by: YutenC <[email protected]> Co-authored-by: CctoctoFX <[email protected]> Co-authored-by: Codex Release <[email protected]>
UnpxreTW
added a commit
to UnpxreTW/claude-hud
that referenced
this pull request
Jul 15, 2026
* feat: add advisor model display (display.showAdvisor) Surfaces the model configured via Claude Code's `/advisor` command so it sits inline on the project line: [Opus 4.7 (1M context)] │ AthenaKB git:(main*) │ Advisor: Opus 4.7 Context ██░░░░░░░░ 19% ## How it works Claude Code stamps an `advisorModel` field onto every assistant record in the session transcript when `/advisor` is configured. The transcript parser already walks every line for tool / agent / todo state, so this just captures the latest non-empty `advisorModel` into the existing `TranscriptData` shape with no extra IO. `renderProjectLine` then appends the prettified label (e.g. `claude-opus-4-7` → `Opus 4.7`) as another part on the same row, respecting the existing ` │ ` separator and ANSI handling. A `display.showAdvisor` boolean (default false) gates the whole block; `display.advisorOverride` lets users force a custom label if needed. ## What's included - `TranscriptData.advisorModel` field + parser capture - TRANSCRIPT_CACHE_VERSION bumped 5 → 6 to invalidate caches that predate the new field - `display.showAdvisor` / `display.advisorOverride` config + validation - `renderProjectLine` integration + `prettifyAdvisorId` helper that handles both canonical IDs and short aliases - i18n labels for en (`Advisor`) and zh-Hans (`顾问`) - `configure.md` Element Mapping + Turn Off/On flow entries - 15 new tests covering ID prettification, render gating, transcript capture (latest-wins, empty-string-ignored, missing-field fallback), and config validation ## Notes - `dist/` is intentionally untouched per CONTRIBUTING.md - One pre-existing failure remains in `countConfigs cache: miss on nested rules additions` — it fails identically on main without any of my changes * feat: add customLinePosition config to control custom line placement (jarrodwatts#575) Adds display.customLinePosition so users can place customLine before the model badge while preserving the existing default placement. * build: compile dist/ [auto] * fix: stabilize context fallback and todo rendering (jarrodwatts#579) Fixes context fallback for streaming zero frames and guards todo rendering when content is missing.\n\nCloses jarrodwatts#576.\nCloses jarrodwatts#577. * build: compile dist/ [auto] * fix(advisor): security hardening pass on advisor display Addresses review feedback from jarrodwatts#573: - Sanitize both `ctx.transcript.advisorModel` and `display.advisorOverride` through the existing `sanitizeDisplayText` helper before rendering so ANSI ESC, OSC, C0/C1 control, and bidi sequences cannot reach the terminal. Defence-in-depth: re-sanitize the prettified result too. - Cap advisor display at 64 chars at the render layer (MAX_ADVISOR_DISPLAY_LEN), regardless of source. - In the transcript parser, capture `advisorModel` only from records whose `type === 'assistant'` (matching the documented schema) and hard-cap the captured value at 64 chars (ADVISOR_MODEL_MAX_LEN) so a malformed log cannot persist an oversized value through the JSON cache. Bumps TRANSCRIPT_CACHE_VERSION 6 → 7. The cache deserializer also re-applies the cap as belt-and-braces against legacy entries. - Add 9 new tests covering: CSI/OSC stripping (ANSI ESC + BEL + DEL bytes), bidi mark stripping (RLO/PDF), oversize transcript truncation, oversize override truncation (display-layer), sanitize-collapses-to- empty fallback, non-assistant record rejection (user / custom-title / system), inline placement in expanded layout (renderProjectLine), and inline placement in compact layout (renderSessionLine). - Document `display.showAdvisor` and `display.advisorOverride` in README.md and README.zh.md configuration tables. `npm test`: 637 / 639 pass + 1 skip + 1 pre-existing unrelated failure (`countConfigs cache: miss on nested rules additions`, fails identically on `main`). * feat: add optional autoCompactWindow context denominator * feat: use autoCompactWindow as token-display denominator too * release: prep v0.1.0 * docs: clarify plugin release versioning * fix: validate autoCompactWindow as an integer * build: compile dist/ [auto] * build: compile dist/ [auto] * build(deps-dev): bump @types/node from 25.9.1 to 25.9.2 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 25.9.1 to 25.9.2. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-version: 25.9.2 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * feat: add showSkills / showMcp HUD display elements * feat(usage): render balance_label alongside stdin rate_limits Previously, external-snapshot balance_label was shown only when stdin rate_limits were absent (mutually exclusive). Rate-limit windows (5h/7d) and a prepaid/metered dollar balance are complementary data, so both should be visible when available. Changes: - index.ts: when stdin provides rate_limits, also read the external snapshot for a balance_label (only when externalUsagePath is set) and merge it onto usageData - session-line.ts: render balance_label as an additive segment after the windows block rather than as an exclusive leading branch; standalone balance (no window data) preserves existing behaviour - tests/render.test.js: add test for combined windows + balance display Backward-compatible: users without externalUsagePath configured see no behaviour change (no extra file read, no extra segment). * fix: render external balance with usage windows * fix: harden skills and mcp activity rendering * build: compile dist/ [auto] * fix: stabilize setup and bash tool targets * build: compile dist/ [auto] * release: 0.1.1 * fix(i18n): translate "token" as 词元 instead of 令牌 in Simplified Chinese 令牌 is the established Chinese rendering of "token" in the authentication/security sense only (access token → 访问令牌). For the NLP/LLM sense — the unit of text shown by the HUD's token counters — the standard term is 词元, officially designated as the Chinese name for the AI-domain term "token" by the China National Committee for Terms in Sciences and Technologies on 2026-03-25. dist/ is intentionally untouched; it is auto-compiled by the build-dist workflow. * docs: refresh CLAUDE.md architecture overview to match current source The File Structure section predated many modules that now exist in src/ (skills-mcp-line, advisor, cost, external-usage, speed-tracker, i18n, width handling, and the newer render/lines entries), and the opt-in lines list was missing the Skills/MCP activity lines and advisor label. Update both so agents reading CLAUDE.md get an accurate map of the codebase. Docs only, no behavior change. Co-Authored-By: Claude Fable 5 <[email protected]> * feat: add fallback speed estimation via transcript file growth When the model provider does not return output_tokens (e.g. non-standard proxies), the HUD shows no token/s speed at all. This adds a fallback that estimates speed from transcript file size growth (~4 bytes/token heuristic) when output_tokens is unavailable. The primary output_tokens path remains unchanged - the fallback only activates when the provider skips the field. * test: harden transcript speed fallback * build: compile dist/ [auto] * feat: show session compaction count behind opt-in showCompactions setting * feat: add CLAUDE_HUD_DISABLE env var kill-switch to disable the HUD * docs: sync configure.md with current config schema The guided /configure command doc had drifted from src/config.ts. Several display elements were added to the schema (and rendered by the HUD) without being surfaced in the configure flow, so users had no guided way to toggle them and the Element Mapping table was incomplete. Missing elements now documented and added to the Turn On / Turn Off lists: - showEffortLevel (reasoning level: low/medium/high/xhigh/max) - showOutputStyle (current output style name) - showCost (session cost) - showSkills, showMcp (activity elements added in the skills/mcp commit) - showMemoryUsage - showPromptCache (+ promptCacheTtlSeconds) - showClaudeCodeVersion - showAddedDirs (+ addedDirsLayout) - showResetLabel Also: - Element Mapping table now lists every show* boolean in the schema, including showModel / showContextBar (previously mislabeled "not configurable" — they are configurable booleans that default to true). - Removed the internal contradiction where usageValue was listed both as an un-edited "advanced" setting and in the Element Mapping table. - Expanded the advanced-settings note to cover the keys the guided flow preserves but does not edit (elementOrder, mergeGroups, modelFormat, autoCompactWindow, sevenDayThreshold, advisorOverride, externalUsage*, etc). - Updated the Full preset definition to enable the newly documented elements. No behavior change to the renderer; this is a documentation/UX sync so the guided configure flow matches what the HUD can actually display. * build(deps-dev): bump @types/node from 25.9.2 to 25.9.3 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 25.9.2 to 25.9.3. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-version: 25.9.3 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * docs: sync Chinese compactions config docs * docs: cover remaining configure display options * build: compile dist/ [auto] * release: 0.2.0 * fix: merge seven-day usage from external snapshot Merge missing seven-day usage from a configured external snapshot when stdin only supplies the five-hour window. Adds regression coverage for the partial-stdin fallback path. Verified locally with npm ci, npm run build, and node --test tests/index.test.js tests/external-usage.test.js. * fix(security): require opt-in for extra command Require CLAUDE_HUD_ALLOW_EXTRA_CMD before executing --extra-cmd, tighten cache file permissions, and document the local command trust boundary. Maintainer follow-up removed generated dist artifacts from the PR and added extra opt-in parsing coverage. Verified locally with npm ci, npm test, and node --test tests/extra-cmd.test.js. Fixes jarrodwatts#618. * fix(cost): correct Opus 4.5 pricing Update Opus 4.5+ local cost estimates to the official standard Anthropic rate of $5/M input and $25/M output while keeping older Opus 4.0/4.1 estimates on $15/M input and $75/M output. Adds focused coverage for Opus 4.5/4.6, Bedrock-style model IDs, and the older fallback. Verified locally with npm ci, npm run build, and node --test tests/core.test.js tests/render.test.js. GitHub CI passed on Node 18 and 20. Fixes jarrodwatts#622. Supersedes jarrodwatts#624. * build: compile dist/ [auto] * release: 0.2.1 Bump package, lockfile, plugin metadata, and marketplace metadata to 0.2.1. Document the jarrodwatts#617, jarrodwatts#619, and jarrodwatts#625 fixes in CHANGELOG.md. Verified locally with npm ci, npm run build, npm test, npm run test:coverage, version metadata checks, and dist/index.js presence. GitHub CI passed on Node 18 and 20. * refactor: extract duplicated code into shared utilities (jarrodwatts#634) - formatTokens: 3 identical copies → src/utils/format.ts - formatContextValue: 2 identical copies → src/utils/format.ts - hyperlink/getFileHref/safeHyperlink: 2 copies each → src/utils/hyperlinks.ts - ANSI/control/bidi sanitization: 4 implementations → src/utils/sanitize.ts - truncateDesc/truncateContent: 2 copies → src/utils/truncate.ts - DEBUG flag inline checks: replaced with createDebug() from debug.ts 11 files updated to import from 4 new shared utility modules. No behavioral changes; all existing tests pass. Co-authored-by: Jarrod Watts <[email protected]> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * build: compile dist/ [auto] * fix: harden cache file permissions and imports for security (jarrodwatts#632) - speed-tracker: write cache files with 0o600 and directories with 0o700, matching the permission model used by all other cache writers (transcript, context-cache, config-cache, version). Previously used default umask, leaving token counts and timestamps world-readable on shared systems. - transcript.ts, config-reader.ts: use node: protocol prefix for built-in module imports (fs, path, os, readline). Bare specifiers can be hijacked by a same-named package in node_modules; the node: prefix guarantees the Node.js built-in. - external-usage: require externalUsagePath to be an absolute path before reading, consistent with the write-path validation in resolveSnapshotWritePath(). Relative paths are now silently ignored. Co-authored-by: Jarrod Watts <[email protected]> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * build: compile dist/ [auto] * Improve error handling: add debug logging to silent catch blocks (jarrodwatts#633) Replace empty catch {} blocks with catch (err) and debug() logging across 11 source files. This makes errors visible when DEBUG=claude-hud:* is set, while preserving the non-fatal fallback behavior required by a statusline plugin that runs every ~300ms. Files improved: - stdin.ts: stream setup, JSON parse, and stream error handlers - git.ts: branch, status, diff, ahead/behind, and remote URL commands - transcript.ts: file stat, cache read/write, line parse, stream errors - config.ts: config file load failure - config-reader.ts: path comparison, sentinel stat, cache read/write - context-cache.ts: cache read/write, sweep operations - speed-tracker.ts: cache read/write, file size tracking, legacy cleanup - version.ts: binary stat, cache read/write, exec, executable check - external-usage.ts: snapshot comparison, directory check, write, read - memory.ts: /proc/meminfo, vm_stat, and memory calculation - effort.ts: parent process effort detection All catch blocks now capture the error variable and pass it to the existing createDebug() utility with contextual messages including file paths and operation descriptions. Co-authored-by: Jarrod Watts <[email protected]> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * build: compile dist/ [auto] * Add unit tests for modules with lowest coverage (jarrodwatts#635) Add comprehensive tests targeting the 6 modules with the least test coverage: - cost.ts: 87.64% → 100% statements, 75.6% → 100% branch - identity.ts: 87.96% → 96.29% statements, 40.74% → 76.31% branch - session-tokens.ts: 85.71% → 100% statements, 76.92% → 100% branch - usage.ts: 85.95% → 97.94% statements, 82.29% → 88.88% branch - memory.ts: 77.41% → 79.03% statements, 73.33% → 85.71% branch - version.ts: 72.78% → 74.68% statements, 66.66% → 80.3% branch Overall coverage improved from 93.56% → 94.6% statements, 84.54% → 86.23% branch. Co-authored-by: Jarrod Watts <[email protected]> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(cost): clarify Bedrock test intent and add real-session coverage (jarrodwatts#636) Add a comment explaining that the existing bedrockOpus46 test exercises regex normalization (display_name only), not real Bedrock pricing behavior. Add a complementary test confirming that real Bedrock sessions (with model.id containing 'anthropic.claude-') correctly skip cost estimation via the isBedrockModelId early return. Co-authored-by: Jarrod Watts <[email protected]> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * feat: optionally show provider label before model Add opt-in provider label placement for custom proxy workflows while preserving the existing default model badge order. Compact and expanded layouts now share the same badge formatter. Closes jarrodwatts#620 * build: compile dist/ [auto] * test: lock down usage and speed cache hardening Document the absolute read-path requirement for external usage snapshots and add focused tests for relative read rejection plus private speed-cache directory and file modes. * release: 0.3.0 Bump plugin, package, lockfile, and marketplace metadata to 0.3.0 and document the provider label plus cache-hardening changes. * test: handle non-ASCII entrypoint paths (jarrodwatts#655) * refactor(i18n): let locales own layout via a tiny interpolate() helper (jarrodwatts#647) * feat: add opt-in showRoutedCost for Bedrock/Vertex cost (jarrodwatts#648) Closes jarrodwatts#621 * build(deps-dev): bump @types/node from 25.9.3 to 26.1.1 (jarrodwatts#657) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 25.9.3 to 26.1.1. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-version: 26.1.1 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build: compile dist/ [auto] * fix: correct effort suffix placement and guard check inconsistencies (jarrodwatts#650) * fix: correct effort suffix placement and guard check inconsistencies the effort level tag (like "max") was showing up after the provider name instead of after the model — so you'd see "Opus | Bedrock max" when it should be "Opus max | Bedrock". small thing but it looked wrong. also fixed a few spots where opt-in features (showDuration, showConfigCounts) were using !== false checks instead of === true, which could show them unexpectedly if the config object was partially constructed. cleaned up duplicate debug namespaces too — two modules were both using 'context' and two were using 'config', which made debug output confusing. * test: cover effort and opt-in render guards --------- Co-authored-by: Jarrod Watts <[email protected]> * feat(display): show auth method and logged-in account on the first line (jarrodwatts#652) * feat(display): show auth method and logged-in account on the first line Adds an opt-in segment at the end of the first HUD line showing the subscription plan of the current login (e.g. "Claude Max 20x") and the logged-in account, derived from the oauthAccount block that Claude Code persists in {CLAUDE_CONFIG_DIR}.json. New display options (all default off): - display.showAuth: plan label, e.g. "Claude Max 20x" / "API Key" - display.showAuthUser: email local part (fallback: displayName) - display.authUserLength: truncation length, 0 = full (default 8) * fix(auth): strip whole ANSI sequences via shared sanitizeDisplayText helper Replaces the local codepoint-class regex with the existing sanitizeDisplayText() util so CSI/OSC sequences are removed entirely instead of leaving parameter bytes behind (evil\x1b[31m@… -> evil@…), matching how other externally-sourced display text is sanitized. * fix(auth): prefer active API key over stale OAuth profile --------- Co-authored-by: BBleae <[email protected]> Co-authored-by: Jarrod Watts <[email protected]> * fix: Fix duplicate counting issue in assistant message usage statistics (jarrodwatts#646) * fix: Fix duplicate counting issue in assistant message usage statistics * Harden transcript usage deduplication --------- Co-authored-by: yuanliu <[email protected]> Co-authored-by: Claude HUD Maintainer <[email protected]> * build(deps-dev): bump typescript from 6.0.3 to 7.0.2 (jarrodwatts#656) Bumps [typescript](https://github.com/microsoft/TypeScript) from 6.0.3 to 7.0.2. - [Release notes](https://github.com/microsoft/TypeScript/releases) - [Commits](https://github.com/microsoft/TypeScript/commits) --- updated-dependencies: - dependency-name: typescript dependency-version: 7.0.2 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build: compile dist/ [auto] * Fix symlinked rules and compact cache tokens (jarrodwatts#659) Co-authored-by: Codex Maintainer <[email protected]> * build: compile dist/ [auto] * feat(effort): show ultracode sessions as ultracode(xhigh) (jarrodwatts#640) Claude Code reports ultracode as a normal level (xhigh) in stdin, so the statusline recovers it from the transcript: the ultra_effort_enter / ultra_effort_exit attachment markers and the immediate /effort command output, latest signal wins. When active, the reported level is wrapped as ultracode(<level>), taken as-is rather than assumed to be xhigh. Also drop the ps-based parent-process --effort fallback (jarrodwatts#471); the effort label now comes solely from Claude Code stdin, removing a subprocess spawn on every statusline refresh. Co-authored-by: Claude <[email protected]> * build: compile dist/ [auto] * feat(i18n): add Traditional Chinese (zh-Hant / zh-TW) locale (jarrodwatts#645) - Add src/i18n/zh-Hant.ts with full Traditional Chinese translations - Update Language type to include 'zh-Hant' and 'zh-TW' - Register zh-Hant locale and zh-TW alias in i18n index - Update validateLanguage() in config.ts to accept zh-Hant and zh-TW - Fix session-time.ts: replace getLanguage() === 'zh' with isCjkLanguage() so zh-Hant also gets correct no-space formatting (e.g. '5m前' not '5m 前') - Add test coverage for zh-Hant and zh-TW in i18n.test.js Co-authored-by: YutenC <[email protected]> * build: compile dist/ [auto] * feat: add display.modelSource for proxy users (auto/stdin/transcript) (jarrodwatts#643) * feat: add display.modelSource for proxy users (auto/stdin/transcript) Users behind API proxies (cc-switch, LiteLLM, OpenRouter passthrough) see the wrong model name because Claude Code reports the configured model, not the one the proxy actually served. This PR adds a `display.modelSource` config option: - `auto` (default): uses stdin model for Claude models, transcript model for non-Claude. Zero impact on existing users. - `stdin`: always use Claude Code's reported model (current behavior). - `transcript`: always use the model from the API response's `message.model` field. Best for proxy users who want the real model. Implementation: - TranscriptData.lastAssistantModel: captures the actual model from each assistant message's `message.model` field - stdin.resolveModelName(): resolves model based on modelSource config - project.ts + session-line.ts: use resolveModelName instead of getModelName - Cache serialization updated to persist lastAssistantModel Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Harden transcript model display --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]> Co-authored-by: Claude HUD Maintainer <[email protected]> * build: compile dist/ [auto] * release: 0.4.0 (jarrodwatts#660) Co-authored-by: Codex Release <[email protected]> * fix weekly usage threshold default (jarrodwatts#662) * build: compile dist/ [auto] * release: 0.4.1 (jarrodwatts#663) * fix: harden git refs and extra command labels (jarrodwatts#664) Show detached tags and commits, preserve slash-separated branch links, and accept sanitized plain-text output for explicitly enabled extra commands. Sanitize compact Git refs and add focused regression coverage. * build: compile dist/ [auto] * release: 0.4.2 (jarrodwatts#665) Publish the hardened Git ref and opt-in plain-output fixes from jarrodwatts#664 with aligned plugin, marketplace, package, lockfile, and changelog versions. --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: yjtdkj <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jarrod Watts <[email protected]> Co-authored-by: Matt Van Horn <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kang Seong Jae <[email protected]> Co-authored-by: Claude <[email protected]> Co-authored-by: diaojz <[email protected]> Co-authored-by: ViewWay <[email protected]> Co-authored-by: John Costa <[email protected]> Co-authored-by: tgoldblatt <[email protected]> Co-authored-by: CDD-Jarvis <[email protected]> Co-authored-by: jorgelaranjo <[email protected]> Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Jarrod Watts <[email protected]> Co-authored-by: Longado <[email protected]> Co-authored-by: kywoo26 <[email protected]> Co-authored-by: Semianchuk Vitalii <[email protected]> Co-authored-by: Jarrod Watts <[email protected]> Co-authored-by: 晴猫 <[email protected]> Co-authored-by: BBleae <[email protected]> Co-authored-by: yuanliu <[email protected]> Co-authored-by: yuanliu <[email protected]> Co-authored-by: Claude HUD Maintainer <[email protected]> Co-authored-by: Codex Maintainer <[email protected]> Co-authored-by: hyunsh <[email protected]> Co-authored-by: YutenC <[email protected]> Co-authored-by: YutenC <[email protected]> Co-authored-by: CctoctoFX <[email protected]> Co-authored-by: Codex Release <[email protected]> Co-authored-by: hanboy587 <[email protected]>
UnpxreTW
added a commit
to UnpxreTW/claude-hud
that referenced
this pull request
Jul 16, 2026
* feat: add advisor model display (display.showAdvisor) Surfaces the model configured via Claude Code's `/advisor` command so it sits inline on the project line: [Opus 4.7 (1M context)] │ AthenaKB git:(main*) │ Advisor: Opus 4.7 Context ██░░░░░░░░ 19% ## How it works Claude Code stamps an `advisorModel` field onto every assistant record in the session transcript when `/advisor` is configured. The transcript parser already walks every line for tool / agent / todo state, so this just captures the latest non-empty `advisorModel` into the existing `TranscriptData` shape with no extra IO. `renderProjectLine` then appends the prettified label (e.g. `claude-opus-4-7` → `Opus 4.7`) as another part on the same row, respecting the existing ` │ ` separator and ANSI handling. A `display.showAdvisor` boolean (default false) gates the whole block; `display.advisorOverride` lets users force a custom label if needed. ## What's included - `TranscriptData.advisorModel` field + parser capture - TRANSCRIPT_CACHE_VERSION bumped 5 → 6 to invalidate caches that predate the new field - `display.showAdvisor` / `display.advisorOverride` config + validation - `renderProjectLine` integration + `prettifyAdvisorId` helper that handles both canonical IDs and short aliases - i18n labels for en (`Advisor`) and zh-Hans (`顾问`) - `configure.md` Element Mapping + Turn Off/On flow entries - 15 new tests covering ID prettification, render gating, transcript capture (latest-wins, empty-string-ignored, missing-field fallback), and config validation ## Notes - `dist/` is intentionally untouched per CONTRIBUTING.md - One pre-existing failure remains in `countConfigs cache: miss on nested rules additions` — it fails identically on main without any of my changes * feat: add customLinePosition config to control custom line placement (jarrodwatts#575) Adds display.customLinePosition so users can place customLine before the model badge while preserving the existing default placement. * build: compile dist/ [auto] * fix: stabilize context fallback and todo rendering (jarrodwatts#579) Fixes context fallback for streaming zero frames and guards todo rendering when content is missing.\n\nCloses jarrodwatts#576.\nCloses jarrodwatts#577. * build: compile dist/ [auto] * fix(advisor): security hardening pass on advisor display Addresses review feedback from jarrodwatts#573: - Sanitize both `ctx.transcript.advisorModel` and `display.advisorOverride` through the existing `sanitizeDisplayText` helper before rendering so ANSI ESC, OSC, C0/C1 control, and bidi sequences cannot reach the terminal. Defence-in-depth: re-sanitize the prettified result too. - Cap advisor display at 64 chars at the render layer (MAX_ADVISOR_DISPLAY_LEN), regardless of source. - In the transcript parser, capture `advisorModel` only from records whose `type === 'assistant'` (matching the documented schema) and hard-cap the captured value at 64 chars (ADVISOR_MODEL_MAX_LEN) so a malformed log cannot persist an oversized value through the JSON cache. Bumps TRANSCRIPT_CACHE_VERSION 6 → 7. The cache deserializer also re-applies the cap as belt-and-braces against legacy entries. - Add 9 new tests covering: CSI/OSC stripping (ANSI ESC + BEL + DEL bytes), bidi mark stripping (RLO/PDF), oversize transcript truncation, oversize override truncation (display-layer), sanitize-collapses-to- empty fallback, non-assistant record rejection (user / custom-title / system), inline placement in expanded layout (renderProjectLine), and inline placement in compact layout (renderSessionLine). - Document `display.showAdvisor` and `display.advisorOverride` in README.md and README.zh.md configuration tables. `npm test`: 637 / 639 pass + 1 skip + 1 pre-existing unrelated failure (`countConfigs cache: miss on nested rules additions`, fails identically on `main`). * feat: add optional autoCompactWindow context denominator * feat: use autoCompactWindow as token-display denominator too * release: prep v0.1.0 * docs: clarify plugin release versioning * fix: validate autoCompactWindow as an integer * build: compile dist/ [auto] * build: compile dist/ [auto] * build(deps-dev): bump @types/node from 25.9.1 to 25.9.2 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 25.9.1 to 25.9.2. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-version: 25.9.2 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * feat: add showSkills / showMcp HUD display elements * feat(usage): render balance_label alongside stdin rate_limits Previously, external-snapshot balance_label was shown only when stdin rate_limits were absent (mutually exclusive). Rate-limit windows (5h/7d) and a prepaid/metered dollar balance are complementary data, so both should be visible when available. Changes: - index.ts: when stdin provides rate_limits, also read the external snapshot for a balance_label (only when externalUsagePath is set) and merge it onto usageData - session-line.ts: render balance_label as an additive segment after the windows block rather than as an exclusive leading branch; standalone balance (no window data) preserves existing behaviour - tests/render.test.js: add test for combined windows + balance display Backward-compatible: users without externalUsagePath configured see no behaviour change (no extra file read, no extra segment). * fix: render external balance with usage windows * fix: harden skills and mcp activity rendering * build: compile dist/ [auto] * fix: stabilize setup and bash tool targets * build: compile dist/ [auto] * release: 0.1.1 * fix(i18n): translate "token" as 词元 instead of 令牌 in Simplified Chinese 令牌 is the established Chinese rendering of "token" in the authentication/security sense only (access token → 访问令牌). For the NLP/LLM sense — the unit of text shown by the HUD's token counters — the standard term is 词元, officially designated as the Chinese name for the AI-domain term "token" by the China National Committee for Terms in Sciences and Technologies on 2026-03-25. dist/ is intentionally untouched; it is auto-compiled by the build-dist workflow. * docs: refresh CLAUDE.md architecture overview to match current source The File Structure section predated many modules that now exist in src/ (skills-mcp-line, advisor, cost, external-usage, speed-tracker, i18n, width handling, and the newer render/lines entries), and the opt-in lines list was missing the Skills/MCP activity lines and advisor label. Update both so agents reading CLAUDE.md get an accurate map of the codebase. Docs only, no behavior change. Co-Authored-By: Claude Fable 5 <[email protected]> * feat: add fallback speed estimation via transcript file growth When the model provider does not return output_tokens (e.g. non-standard proxies), the HUD shows no token/s speed at all. This adds a fallback that estimates speed from transcript file size growth (~4 bytes/token heuristic) when output_tokens is unavailable. The primary output_tokens path remains unchanged - the fallback only activates when the provider skips the field. * test: harden transcript speed fallback * build: compile dist/ [auto] * feat: show session compaction count behind opt-in showCompactions setting * feat: add CLAUDE_HUD_DISABLE env var kill-switch to disable the HUD * docs: sync configure.md with current config schema The guided /configure command doc had drifted from src/config.ts. Several display elements were added to the schema (and rendered by the HUD) without being surfaced in the configure flow, so users had no guided way to toggle them and the Element Mapping table was incomplete. Missing elements now documented and added to the Turn On / Turn Off lists: - showEffortLevel (reasoning level: low/medium/high/xhigh/max) - showOutputStyle (current output style name) - showCost (session cost) - showSkills, showMcp (activity elements added in the skills/mcp commit) - showMemoryUsage - showPromptCache (+ promptCacheTtlSeconds) - showClaudeCodeVersion - showAddedDirs (+ addedDirsLayout) - showResetLabel Also: - Element Mapping table now lists every show* boolean in the schema, including showModel / showContextBar (previously mislabeled "not configurable" — they are configurable booleans that default to true). - Removed the internal contradiction where usageValue was listed both as an un-edited "advanced" setting and in the Element Mapping table. - Expanded the advanced-settings note to cover the keys the guided flow preserves but does not edit (elementOrder, mergeGroups, modelFormat, autoCompactWindow, sevenDayThreshold, advisorOverride, externalUsage*, etc). - Updated the Full preset definition to enable the newly documented elements. No behavior change to the renderer; this is a documentation/UX sync so the guided configure flow matches what the HUD can actually display. * build(deps-dev): bump @types/node from 25.9.2 to 25.9.3 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 25.9.2 to 25.9.3. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-version: 25.9.3 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * docs: sync Chinese compactions config docs * docs: cover remaining configure display options * build: compile dist/ [auto] * release: 0.2.0 * fix: merge seven-day usage from external snapshot Merge missing seven-day usage from a configured external snapshot when stdin only supplies the five-hour window. Adds regression coverage for the partial-stdin fallback path. Verified locally with npm ci, npm run build, and node --test tests/index.test.js tests/external-usage.test.js. * fix(security): require opt-in for extra command Require CLAUDE_HUD_ALLOW_EXTRA_CMD before executing --extra-cmd, tighten cache file permissions, and document the local command trust boundary. Maintainer follow-up removed generated dist artifacts from the PR and added extra opt-in parsing coverage. Verified locally with npm ci, npm test, and node --test tests/extra-cmd.test.js. Fixes jarrodwatts#618. * fix(cost): correct Opus 4.5 pricing Update Opus 4.5+ local cost estimates to the official standard Anthropic rate of $5/M input and $25/M output while keeping older Opus 4.0/4.1 estimates on $15/M input and $75/M output. Adds focused coverage for Opus 4.5/4.6, Bedrock-style model IDs, and the older fallback. Verified locally with npm ci, npm run build, and node --test tests/core.test.js tests/render.test.js. GitHub CI passed on Node 18 and 20. Fixes jarrodwatts#622. Supersedes jarrodwatts#624. * build: compile dist/ [auto] * release: 0.2.1 Bump package, lockfile, plugin metadata, and marketplace metadata to 0.2.1. Document the jarrodwatts#617, jarrodwatts#619, and jarrodwatts#625 fixes in CHANGELOG.md. Verified locally with npm ci, npm run build, npm test, npm run test:coverage, version metadata checks, and dist/index.js presence. GitHub CI passed on Node 18 and 20. * refactor: extract duplicated code into shared utilities (jarrodwatts#634) - formatTokens: 3 identical copies → src/utils/format.ts - formatContextValue: 2 identical copies → src/utils/format.ts - hyperlink/getFileHref/safeHyperlink: 2 copies each → src/utils/hyperlinks.ts - ANSI/control/bidi sanitization: 4 implementations → src/utils/sanitize.ts - truncateDesc/truncateContent: 2 copies → src/utils/truncate.ts - DEBUG flag inline checks: replaced with createDebug() from debug.ts 11 files updated to import from 4 new shared utility modules. No behavioral changes; all existing tests pass. Co-authored-by: Jarrod Watts <[email protected]> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * build: compile dist/ [auto] * fix: harden cache file permissions and imports for security (jarrodwatts#632) - speed-tracker: write cache files with 0o600 and directories with 0o700, matching the permission model used by all other cache writers (transcript, context-cache, config-cache, version). Previously used default umask, leaving token counts and timestamps world-readable on shared systems. - transcript.ts, config-reader.ts: use node: protocol prefix for built-in module imports (fs, path, os, readline). Bare specifiers can be hijacked by a same-named package in node_modules; the node: prefix guarantees the Node.js built-in. - external-usage: require externalUsagePath to be an absolute path before reading, consistent with the write-path validation in resolveSnapshotWritePath(). Relative paths are now silently ignored. Co-authored-by: Jarrod Watts <[email protected]> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * build: compile dist/ [auto] * Improve error handling: add debug logging to silent catch blocks (jarrodwatts#633) Replace empty catch {} blocks with catch (err) and debug() logging across 11 source files. This makes errors visible when DEBUG=claude-hud:* is set, while preserving the non-fatal fallback behavior required by a statusline plugin that runs every ~300ms. Files improved: - stdin.ts: stream setup, JSON parse, and stream error handlers - git.ts: branch, status, diff, ahead/behind, and remote URL commands - transcript.ts: file stat, cache read/write, line parse, stream errors - config.ts: config file load failure - config-reader.ts: path comparison, sentinel stat, cache read/write - context-cache.ts: cache read/write, sweep operations - speed-tracker.ts: cache read/write, file size tracking, legacy cleanup - version.ts: binary stat, cache read/write, exec, executable check - external-usage.ts: snapshot comparison, directory check, write, read - memory.ts: /proc/meminfo, vm_stat, and memory calculation - effort.ts: parent process effort detection All catch blocks now capture the error variable and pass it to the existing createDebug() utility with contextual messages including file paths and operation descriptions. Co-authored-by: Jarrod Watts <[email protected]> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * build: compile dist/ [auto] * Add unit tests for modules with lowest coverage (jarrodwatts#635) Add comprehensive tests targeting the 6 modules with the least test coverage: - cost.ts: 87.64% → 100% statements, 75.6% → 100% branch - identity.ts: 87.96% → 96.29% statements, 40.74% → 76.31% branch - session-tokens.ts: 85.71% → 100% statements, 76.92% → 100% branch - usage.ts: 85.95% → 97.94% statements, 82.29% → 88.88% branch - memory.ts: 77.41% → 79.03% statements, 73.33% → 85.71% branch - version.ts: 72.78% → 74.68% statements, 66.66% → 80.3% branch Overall coverage improved from 93.56% → 94.6% statements, 84.54% → 86.23% branch. Co-authored-by: Jarrod Watts <[email protected]> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(cost): clarify Bedrock test intent and add real-session coverage (jarrodwatts#636) Add a comment explaining that the existing bedrockOpus46 test exercises regex normalization (display_name only), not real Bedrock pricing behavior. Add a complementary test confirming that real Bedrock sessions (with model.id containing 'anthropic.claude-') correctly skip cost estimation via the isBedrockModelId early return. Co-authored-by: Jarrod Watts <[email protected]> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * feat: optionally show provider label before model Add opt-in provider label placement for custom proxy workflows while preserving the existing default model badge order. Compact and expanded layouts now share the same badge formatter. Closes jarrodwatts#620 * build: compile dist/ [auto] * test: lock down usage and speed cache hardening Document the absolute read-path requirement for external usage snapshots and add focused tests for relative read rejection plus private speed-cache directory and file modes. * release: 0.3.0 Bump plugin, package, lockfile, and marketplace metadata to 0.3.0 and document the provider label plus cache-hardening changes. * test: handle non-ASCII entrypoint paths (jarrodwatts#655) * refactor(i18n): let locales own layout via a tiny interpolate() helper (jarrodwatts#647) * feat: add opt-in showRoutedCost for Bedrock/Vertex cost (jarrodwatts#648) Closes jarrodwatts#621 * build(deps-dev): bump @types/node from 25.9.3 to 26.1.1 (jarrodwatts#657) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 25.9.3 to 26.1.1. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-version: 26.1.1 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build: compile dist/ [auto] * fix: correct effort suffix placement and guard check inconsistencies (jarrodwatts#650) * fix: correct effort suffix placement and guard check inconsistencies the effort level tag (like "max") was showing up after the provider name instead of after the model — so you'd see "Opus | Bedrock max" when it should be "Opus max | Bedrock". small thing but it looked wrong. also fixed a few spots where opt-in features (showDuration, showConfigCounts) were using !== false checks instead of === true, which could show them unexpectedly if the config object was partially constructed. cleaned up duplicate debug namespaces too — two modules were both using 'context' and two were using 'config', which made debug output confusing. * test: cover effort and opt-in render guards --------- Co-authored-by: Jarrod Watts <[email protected]> * feat(display): show auth method and logged-in account on the first line (jarrodwatts#652) * feat(display): show auth method and logged-in account on the first line Adds an opt-in segment at the end of the first HUD line showing the subscription plan of the current login (e.g. "Claude Max 20x") and the logged-in account, derived from the oauthAccount block that Claude Code persists in {CLAUDE_CONFIG_DIR}.json. New display options (all default off): - display.showAuth: plan label, e.g. "Claude Max 20x" / "API Key" - display.showAuthUser: email local part (fallback: displayName) - display.authUserLength: truncation length, 0 = full (default 8) * fix(auth): strip whole ANSI sequences via shared sanitizeDisplayText helper Replaces the local codepoint-class regex with the existing sanitizeDisplayText() util so CSI/OSC sequences are removed entirely instead of leaving parameter bytes behind (evil\x1b[31m@… -> evil@…), matching how other externally-sourced display text is sanitized. * fix(auth): prefer active API key over stale OAuth profile --------- Co-authored-by: BBleae <[email protected]> Co-authored-by: Jarrod Watts <[email protected]> * fix: Fix duplicate counting issue in assistant message usage statistics (jarrodwatts#646) * fix: Fix duplicate counting issue in assistant message usage statistics * Harden transcript usage deduplication --------- Co-authored-by: yuanliu <[email protected]> Co-authored-by: Claude HUD Maintainer <[email protected]> * build(deps-dev): bump typescript from 6.0.3 to 7.0.2 (jarrodwatts#656) Bumps [typescript](https://github.com/microsoft/TypeScript) from 6.0.3 to 7.0.2. - [Release notes](https://github.com/microsoft/TypeScript/releases) - [Commits](https://github.com/microsoft/TypeScript/commits) --- updated-dependencies: - dependency-name: typescript dependency-version: 7.0.2 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build: compile dist/ [auto] * Fix symlinked rules and compact cache tokens (jarrodwatts#659) Co-authored-by: Codex Maintainer <[email protected]> * build: compile dist/ [auto] * feat(effort): show ultracode sessions as ultracode(xhigh) (jarrodwatts#640) Claude Code reports ultracode as a normal level (xhigh) in stdin, so the statusline recovers it from the transcript: the ultra_effort_enter / ultra_effort_exit attachment markers and the immediate /effort command output, latest signal wins. When active, the reported level is wrapped as ultracode(<level>), taken as-is rather than assumed to be xhigh. Also drop the ps-based parent-process --effort fallback (jarrodwatts#471); the effort label now comes solely from Claude Code stdin, removing a subprocess spawn on every statusline refresh. Co-authored-by: Claude <[email protected]> * build: compile dist/ [auto] * feat(i18n): add Traditional Chinese (zh-Hant / zh-TW) locale (jarrodwatts#645) - Add src/i18n/zh-Hant.ts with full Traditional Chinese translations - Update Language type to include 'zh-Hant' and 'zh-TW' - Register zh-Hant locale and zh-TW alias in i18n index - Update validateLanguage() in config.ts to accept zh-Hant and zh-TW - Fix session-time.ts: replace getLanguage() === 'zh' with isCjkLanguage() so zh-Hant also gets correct no-space formatting (e.g. '5m前' not '5m 前') - Add test coverage for zh-Hant and zh-TW in i18n.test.js Co-authored-by: YutenC <[email protected]> * build: compile dist/ [auto] * feat: add display.modelSource for proxy users (auto/stdin/transcript) (jarrodwatts#643) * feat: add display.modelSource for proxy users (auto/stdin/transcript) Users behind API proxies (cc-switch, LiteLLM, OpenRouter passthrough) see the wrong model name because Claude Code reports the configured model, not the one the proxy actually served. This PR adds a `display.modelSource` config option: - `auto` (default): uses stdin model for Claude models, transcript model for non-Claude. Zero impact on existing users. - `stdin`: always use Claude Code's reported model (current behavior). - `transcript`: always use the model from the API response's `message.model` field. Best for proxy users who want the real model. Implementation: - TranscriptData.lastAssistantModel: captures the actual model from each assistant message's `message.model` field - stdin.resolveModelName(): resolves model based on modelSource config - project.ts + session-line.ts: use resolveModelName instead of getModelName - Cache serialization updated to persist lastAssistantModel Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Harden transcript model display --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]> Co-authored-by: Claude HUD Maintainer <[email protected]> * build: compile dist/ [auto] * release: 0.4.0 (jarrodwatts#660) Co-authored-by: Codex Release <[email protected]> * fix weekly usage threshold default (jarrodwatts#662) * build: compile dist/ [auto] * release: 0.4.1 (jarrodwatts#663) * fix: harden git refs and extra command labels (jarrodwatts#664) Show detached tags and commits, preserve slash-separated branch links, and accept sanitized plain-text output for explicitly enabled extra commands. Sanitize compact Git refs and add focused regression coverage. * build: compile dist/ [auto] * release: 0.4.2 (jarrodwatts#665) Publish the hardened Git ref and opt-in plain-output fixes from jarrodwatts#664 with aligned plugin, marketplace, package, lockfile, and changelog versions. * feat: render model-scoped weekly usage windows (jarrodwatts#669) Parse and render bounded model-scoped weekly usage data from Claude Code stdin. Harden untrusted labels and values, cover expanded and compact layouts, and prevent scoped-only data from overwriting shared external snapshots. * build: compile dist/ [auto] * build: prevent stale compiled artifacts (jarrodwatts#670) Clean dist before TypeScript compilation and enforce source-to-artifact parity so deleted modules cannot remain directly package-addressable. * build: compile dist/ [auto] * release: 0.5.0 (jarrodwatts#671) Ship model-scoped usage windows and prevent removed compiled modules from remaining in release packages. --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: yjtdkj <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jarrod Watts <[email protected]> Co-authored-by: Matt Van Horn <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kang Seong Jae <[email protected]> Co-authored-by: Claude <[email protected]> Co-authored-by: diaojz <[email protected]> Co-authored-by: ViewWay <[email protected]> Co-authored-by: John Costa <[email protected]> Co-authored-by: tgoldblatt <[email protected]> Co-authored-by: CDD-Jarvis <[email protected]> Co-authored-by: jorgelaranjo <[email protected]> Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Jarrod Watts <[email protected]> Co-authored-by: Longado <[email protected]> Co-authored-by: kywoo26 <[email protected]> Co-authored-by: Semianchuk Vitalii <[email protected]> Co-authored-by: Jarrod Watts <[email protected]> Co-authored-by: 晴猫 <[email protected]> Co-authored-by: BBleae <[email protected]> Co-authored-by: yuanliu <[email protected]> Co-authored-by: yuanliu <[email protected]> Co-authored-by: Claude HUD Maintainer <[email protected]> Co-authored-by: Codex Maintainer <[email protected]> Co-authored-by: hyunsh <[email protected]> Co-authored-by: YutenC <[email protected]> Co-authored-by: YutenC <[email protected]> Co-authored-by: CctoctoFX <[email protected]> Co-authored-by: Codex Release <[email protected]> Co-authored-by: hanboy587 <[email protected]> Co-authored-by: Aster <[email protected]>
UnpxreTW
added a commit
to UnpxreTW/claude-hud
that referenced
this pull request
Jul 21, 2026
* feat: add advisor model display (display.showAdvisor) Surfaces the model configured via Claude Code's `/advisor` command so it sits inline on the project line: [Opus 4.7 (1M context)] │ AthenaKB git:(main*) │ Advisor: Opus 4.7 Context ██░░░░░░░░ 19% ## How it works Claude Code stamps an `advisorModel` field onto every assistant record in the session transcript when `/advisor` is configured. The transcript parser already walks every line for tool / agent / todo state, so this just captures the latest non-empty `advisorModel` into the existing `TranscriptData` shape with no extra IO. `renderProjectLine` then appends the prettified label (e.g. `claude-opus-4-7` → `Opus 4.7`) as another part on the same row, respecting the existing ` │ ` separator and ANSI handling. A `display.showAdvisor` boolean (default false) gates the whole block; `display.advisorOverride` lets users force a custom label if needed. ## What's included - `TranscriptData.advisorModel` field + parser capture - TRANSCRIPT_CACHE_VERSION bumped 5 → 6 to invalidate caches that predate the new field - `display.showAdvisor` / `display.advisorOverride` config + validation - `renderProjectLine` integration + `prettifyAdvisorId` helper that handles both canonical IDs and short aliases - i18n labels for en (`Advisor`) and zh-Hans (`顾问`) - `configure.md` Element Mapping + Turn Off/On flow entries - 15 new tests covering ID prettification, render gating, transcript capture (latest-wins, empty-string-ignored, missing-field fallback), and config validation ## Notes - `dist/` is intentionally untouched per CONTRIBUTING.md - One pre-existing failure remains in `countConfigs cache: miss on nested rules additions` — it fails identically on main without any of my changes * feat: add customLinePosition config to control custom line placement (jarrodwatts#575) Adds display.customLinePosition so users can place customLine before the model badge while preserving the existing default placement. * build: compile dist/ [auto] * fix: stabilize context fallback and todo rendering (jarrodwatts#579) Fixes context fallback for streaming zero frames and guards todo rendering when content is missing.\n\nCloses jarrodwatts#576.\nCloses jarrodwatts#577. * build: compile dist/ [auto] * fix(advisor): security hardening pass on advisor display Addresses review feedback from jarrodwatts#573: - Sanitize both `ctx.transcript.advisorModel` and `display.advisorOverride` through the existing `sanitizeDisplayText` helper before rendering so ANSI ESC, OSC, C0/C1 control, and bidi sequences cannot reach the terminal. Defence-in-depth: re-sanitize the prettified result too. - Cap advisor display at 64 chars at the render layer (MAX_ADVISOR_DISPLAY_LEN), regardless of source. - In the transcript parser, capture `advisorModel` only from records whose `type === 'assistant'` (matching the documented schema) and hard-cap the captured value at 64 chars (ADVISOR_MODEL_MAX_LEN) so a malformed log cannot persist an oversized value through the JSON cache. Bumps TRANSCRIPT_CACHE_VERSION 6 → 7. The cache deserializer also re-applies the cap as belt-and-braces against legacy entries. - Add 9 new tests covering: CSI/OSC stripping (ANSI ESC + BEL + DEL bytes), bidi mark stripping (RLO/PDF), oversize transcript truncation, oversize override truncation (display-layer), sanitize-collapses-to- empty fallback, non-assistant record rejection (user / custom-title / system), inline placement in expanded layout (renderProjectLine), and inline placement in compact layout (renderSessionLine). - Document `display.showAdvisor` and `display.advisorOverride` in README.md and README.zh.md configuration tables. `npm test`: 637 / 639 pass + 1 skip + 1 pre-existing unrelated failure (`countConfigs cache: miss on nested rules additions`, fails identically on `main`). * feat: add optional autoCompactWindow context denominator * feat: use autoCompactWindow as token-display denominator too * release: prep v0.1.0 * docs: clarify plugin release versioning * fix: validate autoCompactWindow as an integer * build: compile dist/ [auto] * build: compile dist/ [auto] * build(deps-dev): bump @types/node from 25.9.1 to 25.9.2 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 25.9.1 to 25.9.2. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-version: 25.9.2 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * feat: add showSkills / showMcp HUD display elements * feat(usage): render balance_label alongside stdin rate_limits Previously, external-snapshot balance_label was shown only when stdin rate_limits were absent (mutually exclusive). Rate-limit windows (5h/7d) and a prepaid/metered dollar balance are complementary data, so both should be visible when available. Changes: - index.ts: when stdin provides rate_limits, also read the external snapshot for a balance_label (only when externalUsagePath is set) and merge it onto usageData - session-line.ts: render balance_label as an additive segment after the windows block rather than as an exclusive leading branch; standalone balance (no window data) preserves existing behaviour - tests/render.test.js: add test for combined windows + balance display Backward-compatible: users without externalUsagePath configured see no behaviour change (no extra file read, no extra segment). * fix: render external balance with usage windows * fix: harden skills and mcp activity rendering * build: compile dist/ [auto] * fix: stabilize setup and bash tool targets * build: compile dist/ [auto] * release: 0.1.1 * fix(i18n): translate "token" as 词元 instead of 令牌 in Simplified Chinese 令牌 is the established Chinese rendering of "token" in the authentication/security sense only (access token → 访问令牌). For the NLP/LLM sense — the unit of text shown by the HUD's token counters — the standard term is 词元, officially designated as the Chinese name for the AI-domain term "token" by the China National Committee for Terms in Sciences and Technologies on 2026-03-25. dist/ is intentionally untouched; it is auto-compiled by the build-dist workflow. * docs: refresh CLAUDE.md architecture overview to match current source The File Structure section predated many modules that now exist in src/ (skills-mcp-line, advisor, cost, external-usage, speed-tracker, i18n, width handling, and the newer render/lines entries), and the opt-in lines list was missing the Skills/MCP activity lines and advisor label. Update both so agents reading CLAUDE.md get an accurate map of the codebase. Docs only, no behavior change. Co-Authored-By: Claude Fable 5 <[email protected]> * feat: add fallback speed estimation via transcript file growth When the model provider does not return output_tokens (e.g. non-standard proxies), the HUD shows no token/s speed at all. This adds a fallback that estimates speed from transcript file size growth (~4 bytes/token heuristic) when output_tokens is unavailable. The primary output_tokens path remains unchanged - the fallback only activates when the provider skips the field. * test: harden transcript speed fallback * build: compile dist/ [auto] * feat: show session compaction count behind opt-in showCompactions setting * feat: add CLAUDE_HUD_DISABLE env var kill-switch to disable the HUD * docs: sync configure.md with current config schema The guided /configure command doc had drifted from src/config.ts. Several display elements were added to the schema (and rendered by the HUD) without being surfaced in the configure flow, so users had no guided way to toggle them and the Element Mapping table was incomplete. Missing elements now documented and added to the Turn On / Turn Off lists: - showEffortLevel (reasoning level: low/medium/high/xhigh/max) - showOutputStyle (current output style name) - showCost (session cost) - showSkills, showMcp (activity elements added in the skills/mcp commit) - showMemoryUsage - showPromptCache (+ promptCacheTtlSeconds) - showClaudeCodeVersion - showAddedDirs (+ addedDirsLayout) - showResetLabel Also: - Element Mapping table now lists every show* boolean in the schema, including showModel / showContextBar (previously mislabeled "not configurable" — they are configurable booleans that default to true). - Removed the internal contradiction where usageValue was listed both as an un-edited "advanced" setting and in the Element Mapping table. - Expanded the advanced-settings note to cover the keys the guided flow preserves but does not edit (elementOrder, mergeGroups, modelFormat, autoCompactWindow, sevenDayThreshold, advisorOverride, ex
Summary
[Opus 4.6 ●max]display.showEffortLevel: true(off by default)stdin.effortfirst (future-proof for when Claude Code adds it — see Include reasoning effort level in statusline JSON data anthropics/claude-code#39399, #50060, #50577, #45805), falls back to parent process CLI args (--effortflag)○low ·◔medium ·◑high ·◕xhigh ·●maxBug Fix (setup.md)
The bash version selector in
commands/setup.mddoesn't filter non-semver directories, unlike the PowerShell version which hasWhere-Object { $_.Name -match '^\d+(\.\d+)+$' }. This causes the HUD to silently use the wrong directory if backup/temp directories exist (e.g.,0.0.10.bak).Fix: Added
grep -E '^[0-9]+\.[0-9]+\.[0-9]+\t'beforesortin all bash templates.Design Decisions
ps -o args=detects--effortCLI flag at session startConfiguration
{ "display": { "showEffortLevel": true } }Visual Examples
Test Plan
npm run buildsucceeds[Model ●max][Model ●max]showEffortLevel: truein config)Closes #201
Relates to anthropics/claude-code#39399, #50060, #50577, #45805