Commit Graph

1435 Commits

Author SHA1 Message Date
nesquena-hermes 4fa051ea14 fix(security/#3234 + #3219): unify case-folded path checks, fix workspace over-block, protect raw <pre> (Codex review #6)
1. routes.py: hoist a single case-folded path helper (_norm/_within_ci/_equal_ci)
   used for ALL deny + carve-out comparisons (consistent macOS/Windows safety).
2. routes.py: split the deny into (a) dir-based denies that ALWAYS fire (even
   inside the active workspace — so a workspace overlapping a state dir cannot
   expose sessions/memories), and (b) filename denies relaxed only by the
   carve-out. Fix the over-block: a workspace that is a proper DESCENDANT of a
   Hermes root (e.g. STATE_DIR/workspace) is a legit project workspace and keeps
   the carve-out; only a root-itself / ancestor / $HOME / profiles / state-subdir
   workspace disables it.
3. ui.js: move the bare file:// media-stash pass after the raw-<pre> stash too,
   so file:// inside a raw <pre> block stays literal (not just fenced/inline code).
2026-05-31 03:24:35 +00:00
nesquena-hermes 5758d4a827 fix(security/#3234 + #3219): case-fold deny checks + make bare file:// rewrite code-fence-aware (Codex review #5)
1. api/routes.py: case-fold /api/media deny filename + dir containment checks
   (os.path.normcase + casefold) so STATE.DB / Sessions/ cannot bypass the
   state/secret deny on case-insensitive filesystems (macOS/Windows).
2. static/ui.js: move the bare file:// media-stash pass to run AFTER fenced-block
   and inline-code stashing, so a file:// inside a code block / backtick span
   stays literal text instead of becoming an auto-loaded <img>. The MEDIA: stash
   keeps its first-position precedent.
Adds behavioral renderer tests (real renderMd via node) for fenced + inline code
file:// staying literal, bare file:// becoming media, and anchors keeping the
link path. Closes the last Codex review items for #3234.
2026-05-31 03:17:10 +00:00
AJV20 aae3b418f0 fix: render file artifact links as media 2026-05-31 02:24:55 +00:00
nesquena-hermes 5134d896ba absorb #3201: set _streamFinalized immediately in SSE done handler (closes #3195)
Keeps the messages.js fix from @mysoul12138 (set _streamFinalized=true right
after the early-return guard, before the fade window, so a stream_end arriving
mid-fade can't call _restoreSettledSession and overwrite live messages with a
stale server snapshot). Drops the contributor's dead empty `else {}` block in
ui.js (no behavior). Adds a regression test pinning the immediate-finalize order.

Co-authored-by: mysoul12138 <mysoul12138@users.noreply.github.com>
2026-05-31 00:07:39 +00:00
nesquena-hermes d6d74b5354 polish(#3203): preserve localized 'Forked from' base in fork tooltip
Opus advisor SHOULD-FIX: the tooltip rework dropped t('forked_from') in favor
of a hardcoded English string, a real i18n regression (the catalog key exists
in all locales). Restore the localized base while keeping the clearer
'<base>: <parent>' format. Adds a regression test.

The new lineage/child explanatory suffixes (additive English) and the
read-only title hint are deferred to a small follow-up — they need new locale
keys and the read-only state is still surfaced by the existing meta chip.

Co-authored-by: ai-ag2026 <ai-ag2026@users.noreply.github.com>
2026-05-30 21:51:17 +00:00
nesquena-hermes cceeca89d0 polish(#3203): keep localized attention tooltip precedence over generic state tooltip
The merged hunk set state.title=_sessionStateTooltip(...) unconditionally,
two lines after assigning the localized attention.title (pending approval/
clarify, from #3190). That clobbered the attention tooltip and, for a
needs-attention session not currently streaming, blanked it to '' since
_sessionStateTooltip returns '' when neither streaming nor unread.

Make the attention title win, and apply the state tooltip only when non-empty.
Adds a regression test pinning the precedence.

Co-authored-by: ai-ag2026 <ai-ag2026@users.noreply.github.com>
2026-05-30 21:46:01 +00:00
nesquena-hermes 5cd2aef0d5 Merge #3203: clarify sidebar session tooltips
# Conflicts:
#	CHANGELOG.md
2026-05-30 21:43:03 +00:00
nesquena-hermes 4ef544cfa4 Merge branch 'pr-3190' into release/stage-batch58
# Conflicts:
#	CHANGELOG.md
2026-05-30 19:56:01 +00:00
Hermes Agent 01c1239fc9 refactor(sessions): simplify attention indicator to a color-coded dot
Per maintainer UX direction: drop the text badge pill ("APPROVAL" /
"N QUESTIONS") in favor of color-coding the existing right-side status dot
plus the colored left rail. Red dot (--error) for pending approvals, amber
dot (--warning) for pending clarifies; theme-driven, visible even when the
session is not streaming/unread. Approval dot gently pulses (disabled under
prefers-reduced-motion). Quieter and consistent with the existing pin/unread
dot family — the row no longer needs to truncate its title to fit a pill.

Updated test_session_attention_badges to assert the dot classes
(is-attention-approval/clarify) instead of the removed badge element/styles.

Co-authored-by: ai-ag2026 <261867348+ai-ag2026@users.noreply.github.com>
2026-05-30 19:54:51 +00:00
ai-ag2026 00e6d953c2 feat: add distinct attention request sound
Adds a distinct two-tone attention sound (880->660Hz) for approval and
clarify prompts so they are not confused with the existing completion sound,
plus sidebar attention badges + colored rails driven by `attention` metadata
on /api/sessions. Includes lock-safety note: the in-lock
publish_session_list_changed() calls in clarify.py are safe because publish()
only takes the leaf _SESSION_EVENTS_LOCK and never re-acquires clarify._lock
(verified by Opus advisor review).

Co-authored-by: ai-ag2026 <261867348+ai-ag2026@users.noreply.github.com>
2026-05-30 19:40:40 +00:00
ai-ag2026 d2aa066862 feat: surface session attention badges 2026-05-30 19:18:13 +00:00
ai-ag2026 8e44dc8609 feat: resolve session links in conversation filter 2026-05-30 19:13:49 +00:00
ai-ag2026 ce4026660e test: harden session link sanitization 2026-05-30 19:13:11 +00:00
ai-ag2026 d3ee17793a feat: add internal conversation links 2026-05-30 19:13:11 +00:00
ai-ag2026 c26e25414e fix: clarify sidebar session tooltips 2026-05-30 20:56:59 +02:00
nesquena-hermes 025dd738b9 Merge branch 'pr-3178' into release/stage-batch55
# Conflicts:
#	CHANGELOG.md
2026-05-30 18:25:55 +00:00
nesquena-hermes 91f33a50cd Merge branch 'pr-3192' into release/stage-batch55
# Conflicts:
#	CHANGELOG.md
2026-05-30 18:24:30 +00:00
nesquena-hermes db952ac561 Merge branch 'pr-3187' into release/stage-batch55
# Conflicts:
#	CHANGELOG.md
2026-05-30 18:24:29 +00:00
ai-ag2026 9458df6f4d fix: dedupe sidebar completion session ids 2026-05-30 18:19:34 +02:00
ai-ag2026 b891e4fe77 fix: avoid double rebasing legacy tool cards 2026-05-30 16:10:52 +02:00
ai-ag2026 d57854807a fix: keep tool cards anchored during history paging 2026-05-30 14:57:00 +02:00
ai-ag2026 97dde9a48e fix: restore legacy tool card visuals 2026-05-30 10:31:35 +02:00
mysoul12138 1a991041f1 fix: use getModelLabel() in _formatSessionModelWithGateway fallback
When gateway_routing is absent, _formatGatewayModelLabel returns '' and
the fallback path returns raw s.model — which may contain an @provider:
prefix (e.g. @token-plan-cn.xiaomimimo.com:mimo-v2.5-pro).

getModelLabel() already handles stripping @provider: prefixes (ui.js:2855)
but was never called in this fallback path. Route through it so the
session list always displays a clean model name.

Closes #3172
2026-05-30 15:13:03 +08:00
Hermes Agent a7c871d45e feat: add Neon cyberpunk skin
Cyberpunk-inspired dark-first skin with neon purple (#B347FF) accent
and cyan (#00DDFF) highlights. Full palette for both light and dark
modes with component-level overrides (glow effects, purple scrollbars,
tool cards, tree viewer, session badges, MCP status indicators).

- static/style.css: 37 CSS rules (light + dark palette + components)
- static/boot.js: Neon entry in _SKINS array
- static/index.html: neon:1 in skin allowlist

Follows the existing skin pattern (modeled after Nous).
2026-05-30 04:24:15 +00:00
AJV20 d34d11821b fix: label tool output cards persistently 2026-05-30 04:24:15 +00:00
AJV20 5cb82f9da4 fix: make SSE replay cursors run-aware 2026-05-30 04:09:20 +00:00
nesquena-hermes e5b31caee1 fix(#3162): const→let in _ensureMessagesLoaded (brick-class mobile TypeError) + ESLint runtime-error guard
The #3018 carry-forward reassigns msgs but it was declared const, throwing a
TypeError that surfaced as 'Failed to load conversation messages' on every mobile
message (v0.51.161-166). Change to let.

Adds a static JS runtime-error lint guard (eslint.runtime-guard.config.mjs +
tests/test_static_js_runtime_lint.py) using no-const-assign/no-import-assign — the
exact class node --check and source-presence tests miss. Dev-only dependency; app
stays pure Python + vanilla JS.
2026-05-30 03:24:41 +00:00
nesquena-hermes 6791b1d5d8 Merge PR #2252 (swipe actions for touch devices + session list FLIP) onto master — stripped out-of-scope version-badge/_dirty_suffix changes 2026-05-30 02:33:18 +00:00
AJV20 b53bc1a2ea fix: harden webui passive performance paths 2026-05-30 01:39:54 +00:00
george-andraws 28498aa988 fix: scope conversation filter clear search CSS 2026-05-30 00:52:29 +00:00
george-andraws 317d828cff Add clear button to conversation filter 2026-05-30 00:52:29 +00:00
nesquena-hermes 7edd43549d stage-batch43: extend #3018 carry-forward to _finishDone completion path (Opus review — most-frequent reproducer) 2026-05-30 00:39:54 +00:00
nesquena-hermes 9059b8f5c3 Merge PR #3116 (stale unread + compression timer + tool-card dedup) into stage-batch43 2026-05-30 00:21:04 +00:00
nesquena-hermes 86d5d63593 Merge PR #3131 (preserve per-turn ephemeral fields) into stage-batch43 2026-05-30 00:20:58 +00:00
mysoul12138 5b3771012a Fix tool card duplication: skip detail when snippet equals preview
When tc.snippet === tc.preview (common for no-progress tools where
both are set to the same result_snippet), the detail block would show
identical content as the header. Skip the detail block in this case.

This also handles the reload-path where derived entries get snippet
populated but no preview, so displaySnippet falls back to the snippet
content for the header — same deduplication applies.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-30 00:20:49 +00:00
mysoul12138 0002cda23d fix: stale unread dot, compression timer leak, tool card duplication (#3020, #2973)
#3020: Sync viewed-count in the polling path for actively-viewed sessions
so navigating away doesn't show a stale unread dot. Defensive clear of
completion-unread marker in _setSessionViewedCount.

#2973: Clear elapsed-timer attributes and interval when a live compression
card transitions from running to done, preventing the orphan timer from
overwriting the completed card state. Guarded by active-session check.

Tool card duplication: Route tool_complete result to tc.snippet (detail)
instead of tc.preview (header) to prevent identical content appearing in
both the card header and expanded detail section.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-30 00:20:49 +00:00
Sanjays2402 01c27806d4 Fix #3018: preserve per-turn ephemeral fields across session refreshes
`_turnUsage` (and `_turnDuration`, `_turnTps`, `_gatewayRouting`,
`_statusCard`) are computed client-side in `_finishDone()` and attached
to the last assistant message in `S.messages`. Three code paths replace
`S.messages` wholesale with fresh API data that lacks these fields:

  1. `_restoreSettledSession()` after a late `stream_end` or SSE error.
  2. The late-restore branch after `done` (messages.js ~L2247).
  3. `loadSession()` for active-session external refresh / focus-change.

When any of these fire after `done`, the badge/duration/gateway-pill
flashes for ~1s and disappears, never returning until the next message
or page reload.

Add `_carryForwardEphemeralTurnFields(prev, next)` that matches messages
by `(role, timestamp, content prefix)` — the same identity the renderer
already uses — and copies forward the ephemeral fields when the server
payload is missing them. Wire it into all three replace sites. The fix
is conservative: it only fills slots that are `null` on the new message,
so an authoritative server-side value (if/when the API ever surfaces
per-turn usage) wins automatically.

Picked Option A from the bug report (preserve on the client side) over
Option B (synthesize from `S.lastUsage`) because `lastUsage` is a
session-level aggregate; reconstructing per-turn breakdowns from it is
lossy. Option C (set `_streamFinalized` earlier) would suppress legit
late-arriving server data on transient errors.
2026-05-30 00:11:50 +00:00
Sanjays2402 24b175045f Fix #3114: keep jump-to-question button on intermediate assistant messages
In multi-step turns (assistant -> tool_call -> assistant -> tool_call ->
final assistant), only the turn-final assistant bubble was rendering the
'jump to question' navigation button because the gate keyed on
isTurnFinalAssistant. Intermediate assistant bubbles that *do* have a
resolvable question raw-index lost the affordance entirely.

Switch the gate to 'show whenever questionRawIdxByAssistantRawIdx has a
target for this rawIdx', which is the actual precondition for the button
being meaningful. Turn-finality was a proxy for 'has a question target'
that under-covered multi-step turns.

No template/CSS change needed; _questionJumpButtonHtml already handles
the rawIdx-or-undefined contract.
2026-05-30 00:09:13 +00:00
nesquena-hermes 111e7a11b1 Merge PR #3118 into stage-batch41
# Conflicts:
#	CHANGELOG.md
#	static/boot.js
2026-05-29 22:14:16 +00:00
nesquena-hermes de90ca3abe Merge PR #3117 into stage-batch41 2026-05-29 22:13:08 +00:00
nesquena-hermes ff78a422ca Merge PR #3139 into stage-batch40 2026-05-29 22:01:06 +00:00
nesquena-hermes d072039237 Merge PR #3130 into stage-batch40 2026-05-29 21:59:24 +00:00
Philippe Le Rohellec e6aa9271c2 fix(models): preserve provider-qualified model selections in the picker
- Stop provider-qualified or slash-qualified model inputs from fuzzy-matching a
  sibling catalog entry when the exact requested model is missing from the
  curated picker list.
- Preserve the raw typed selection so uncatalogued provider-routed models
  fall through to a temporary custom option instead of silently snapping to a
  nearby curated model.
- Add generalized regression coverage for provider-qualified uncatalogued
  picker selections.
2026-05-29 10:24:44 -07:00
Sanjays2402 e09c6aa6bd Fix #3076: don't force mobile send-on-Enter when a real keyboard is attached
A touch-primary device (`matchMedia('(pointer:coarse)')` is true) can
still have a physical keyboard available — Android tablet + Bluetooth
keyboard, detachable Surface, iPad + Magic Keyboard. The existing
`_mobileDefault` gate flipped Enter to newline on every such device the
moment the visual-viewport heuristic *thought* the soft keyboard was
open, which it often did when the on-screen IME hadn't actually come up
because the user is typing on the hardware keys. Result: Shift+Enter and
Ctrl+Enter never sent and the user could not submit at all.

Add `_hasFinePointerCoexisting()` (`(any-pointer:fine)`) and short-
circuit the mobile-default path when ANY fine pointer is present. That
flag is true whenever a real mouse/trackpad/stylus is paired, which is
the strongest browser signal we have for 'there is a hardware input rig
in the picture too'. Pure-touch phones/tablets are unaffected.
2026-05-29 03:26:12 -07:00
Sanjays2402 7c3d85d6c5 Fix #3107: throttle active-session external-refresh poll from 5s to 30s
The active-session 'is it externally updated?' fallback poll fires every
5 s. On long sessions this causes visible scroll churn (the rendered
message list is rebuilt and the scrollTop is restored on a 5-second
cadence) and a measurable network/CPU floor even when the user is just
reading.

This poll is a *fallback* for the case where the SSE session-events
stream is unavailable; SSE already invalidates the active session in
real time. Pushing it to 30 s keeps the safety net for SSE-broken
environments without it acting as a primary refresh path.

Regression introduced in 467ef33a.
2026-05-29 03:25:49 -07:00
Dennis Soong f5dc9477ff fix: submit composer on numpad enter 2026-05-29 13:00:15 +08:00
mysoul12138 b476126cb9 fix(ui): match tool result snippet limit to backend (200 -> 4000 chars)
_cliToolResultSnippet truncated to 200 chars while the backend's
_tool_result_snippet uses 4000. This caused tool card details to be
more aggressively truncated after session reload than during live
streaming.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-29 12:34:10 +08:00
nesquena-hermes 1a6409764a Merge PR #3093
# Conflicts:
#	CHANGELOG.md
2026-05-28 19:49:34 +00:00
nesquena-hermes f7b4c6b0f4 Merge PR #3087
# Conflicts:
#	CHANGELOG.md
2026-05-28 19:38:10 +00:00
theseussss b554fd8078 fix(reasoning): 推理强度补齐 max 档,与 hermes_constants 对齐
WebUI 镜像的 VALID_REASONING_EFFORTS 此前止于 xhigh,漏了底层
hermes_constants 已有的 max 档。补齐后端常量、前端命令/下拉/帮助文本,
并同步快照测试。支持 max thinking 的 provider(如 Anthropic)现可在
composer 下拉和 /reasoning 命令中选到 Max。
2026-05-29 03:05:02 +08:00