hermes-agent/web/src/pages
xxxigm 691ff7c188 fix(compressor): keep last visible assistant reply out of compaction summary + label handoffs in WebUI (#29824)
Two-pronged fix for the WebUI "context compaction block in place of
last assistant response" regression.

Agent layer (the real fix). ``_find_tail_cut_by_tokens`` already had
``_ensure_last_user_message_in_tail`` to keep the most recent user
request out of the compressed middle (#10896), but no symmetric
anchor for the assistant side. When the conversation has an
oversized recent tool result or a long stretch of tool-call/result
pairs *after* the assistant's last visible reply, the token-budget
walk can stop with the previously-visible reply on the wrong side
of ``cut_idx``. The summariser then rolls it into the single
``[CONTEXT COMPACTION — REFERENCE ONLY]`` block persisted as
``role="user"`` or ``role="assistant"``, and from the operator's
perspective the WebUI session viewer
(``web/src/pages/SessionsPage.tsx``) and the TUI chat panel both
suddenly show the opaque "Context compaction" block in the slot
where they were just reading the actual answer:

    User:  "i cant see the output of the last message you sent,
            i did see it previously, however now see 'context
            compaction'"

Added ``_ensure_last_assistant_message_in_tail`` mirror of the
user-side anchor. It looks for the most recent assistant message
with non-empty text content (skipping tool-call-only assistant
"stubs" which the UI renders as small "calling tool X" indicators
rather than a readable bubble) and walks ``cut_idx`` back through
the standard ``_align_boundary_backward`` so we don't split a
tool_call/result group that immediately precedes it. The two
anchors are chained — each only walks ``cut_idx`` backward, so
the tail can only grow.

Falls back to "most recent assistant of any kind" only when no
content-bearing reply exists in the compressible region (fresh
multi-step tool sequence with no prior reply) — in that case the
agent-side fix is effectively a no-op and the existing
user-message anchor carries the load.

WebUI layer (clarity). Added ``isCompactionMessage`` detector that
recognises the ``[CONTEXT COMPACTION — REFERENCE ONLY]`` (current)
and ``[CONTEXT SUMMARY]:`` (legacy) prefixes from
``agent/context_compressor.py``, and a new ``compaction`` entry
in ``MessageBubble``'s ``ROLE_STYLES`` map. Compaction blocks
now render as muted, italicised system-style rows labelled
``Context handoff`` — clearly metadata, not the assistant's
actual reply — so an operator scrolling back through a long
session can't mistake the summary for a real answer.

Keeping the detected prefixes inline (rather than importing them)
because the WebUI bundle has no Python interop. A guardrail comment
points readers at the source-of-truth constants in
``agent/context_compressor.py``.
2026-06-12 15:41:57 -07:00
..
AnalyticsPage.tsx feat(dashboard): nous-blue theme, bulk sessions, schedule picker (#37383) 2026-06-02 12:37:40 -04:00
ChannelsPage.tsx fix: dedupe concurrent gateway restarts + surface restart outcome in onboarding UI 2026-06-10 01:35:12 -07:00
ChatPage.tsx feat(dashboard): unify multi-profile management — one machine dashboard, global profile switcher (#44007) 2026-06-11 03:29:33 -07:00
ConfigPage.tsx fix(dashboard): Config page header shows the switched profile's config.yaml path (#44374) 2026-06-11 09:46:15 -07:00
CronPage.tsx refactor(cron): rebrand Cron Recipes -> Automation Blueprints 2026-06-11 10:49:47 -07:00
DocsPage.tsx fix(web): force light color-scheme on docs iframe 2026-05-07 04:55:47 -07:00
EnvPage.tsx feat(dashboard): enrich profiles dashboard and de-dupe channel env vars (#37872) 2026-06-03 10:37:36 -04:00
FilesPage.tsx Move folder creation into dialog 2026-06-10 09:53:12 -07:00
LogsPage.tsx Merge remote-tracking branch 'origin/main' into refactor/use-ds-primitives 2026-05-28 14:20:49 -04:00
McpPage.tsx feat(dashboard): complete admin panel — MCP catalog, enable/disable toggles, hook creation, system stats (#36736) 2026-06-02 00:16:11 -04:00
ModelsPage.tsx Update implementation to make it cleaner 2026-06-12 11:03:44 -07:00
PairingPage.tsx feat(dashboard): full administration panel — MCP, pairing, webhooks, credentials, memory, gateway, ops (#36704) 2026-06-01 02:58:02 -07:00
PluginsPage.tsx feat(plugins): install from a subdirectory within a repo (#42963) 2026-06-09 13:42:51 -04:00
ProfileBuilderPage.tsx feat(dashboard): full-featured profile builder (model + skills + MCPs) (#39084) 2026-06-10 09:18:32 -07:00
ProfilesPage.tsx fix(dashboard): dedupe useNavigate import/declaration in ProfilesPage 2026-06-10 20:34:53 -07:00
SessionsPage.tsx fix(compressor): keep last visible assistant reply out of compaction summary + label handoffs in WebUI (#29824) 2026-06-12 15:41:57 -07:00
SkillsPage.tsx feat(dashboard): SKILL.md editor on Skills page + attach-skill selector in cron modals (#44231) 2026-06-11 06:10:27 -07:00
SystemPage.tsx fix(dashboard): normalize model assignments + confirm-modal for backup import (#44237) 2026-06-11 05:07:58 -07:00
WebhooksPage.tsx Enable webhooks from dashboard page 2026-06-10 22:55:06 -07:00