HERMES-GIELIE/static
Nathan Esquenazi 4622b64ca9
fix: tool call cards persist correctly after page reload (#141)
* fix: tool call cards persist correctly after page reload

Root cause: the insertion logic looked for the NEXT assistant row to
insert BEFORE, but when the triggering assistant message contained only
tool_use blocks (no text), it was filtered from the DOM by msgContent()
and no anchor row existed. Cards were silently dropped.

Fix: find the row AT the assistant_msg_idx first (exact match), fall
back to the nearest preceding visible row, then insert AFTER it (not
before the next). This handles both text+tool and tool-only assistant
messages correctly.

Closes #140
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: tool card ordering — role-filter fallback anchor, preserve order for same-anchor groups

Two bugs in the initial PR:
- Fallback 'nearest row' had no role filter, could anchor to a user message
  row causing cards to appear after a user bubble. Fixed: check role==='assistant'
  in the fallback loop.
- Back-to-back tool-card groups sharing a filtered anchor were inserted in
  reverse order because each group re-read anchorRow.nextSibling from the live
  DOM. Fixed: track the last inserted node per anchor via anchorInsertAfter Map,
  so each subsequent group appends after the previous one.

Also restores the 'Collect card elements before they get moved to DOM' comment
explaining why Array.from() is used on frag before DOM insertion.

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 11:02:25 -07:00
..
boot.js feat: make bot name configurable 2026-04-06 05:14:31 +00:00
commands.js docs: v0.34 release — themes CHANGELOG, README, add light to picker 2026-04-04 21:13:01 -07:00
index.html docs: v0.36.3 version bump and test count update (449 tests) (#137) 2026-04-06 08:21:04 -07:00
messages.js feat: make bot name configurable 2026-04-06 05:14:31 +00:00
panels.js feat: make bot name configurable 2026-04-06 05:14:31 +00:00
sessions.js feat: make bot name configurable 2026-04-06 05:14:31 +00:00
style.css feat: self-update checker with one-click update for WebUI + Agent 2026-04-05 09:11:44 -07:00
ui.js fix: tool call cards persist correctly after page reload (#141) 2026-04-06 11:02:25 -07:00
workspace.js feat: workspace git detection with branch/status badge 2026-04-04 14:08:25 -07:00