feat(matrix-bridge): per-tool lifecycle status icons + Tools (M/N) header#14
Open
replicas-connector[bot] wants to merge 1 commit into
Open
Conversation
…ader
Mirrors the OpenACP UX Jaden shared screenshots of (see
docs/acp-telegram-status-research.md Detailed Deep-Dive § 2 + § 5).
Each tool line now ticks live: 🔄 while running, ✅ on success, ❌ on
error. A "📋 Tools (M/N) ✅" header sits above the rolling log so the
user can see how many tools have completed at a glance.
How it works:
- ContentBlock gains `id` (Anthropic-assigned `toolu_…`) and
`tool_use_id` (the back-pointer carried by tool_result blocks).
- The poller maintains a `toolLineIndex: Record<string, number>` in DO
storage that maps tool_use.id → the row index in `lines` where its
rendered call lives. Persisted in the writes batch; wiped on /watch
fresh-spawn alongside `lines`/`plan` so a new turn starts clean.
- On tool_use projection: line is pushed as `🔄 ${formatToolUseLine}`
and the row index is recorded under the block's id.
- On tool_result projection: the original row's leading `🔄 ` is
mutated in place to `✅ ` (success) or `❌ ` (error). The
toolLineIndex entry is then deleted — one-shot, so a malformed
duplicate result can't keep flipping the row.
- render.ts gains `renderToolsHeader(lines)`: scans for 🔄/✅/❌
prefixes, returns "📋 Tools (M/N)" — with a trailing ✅ when
M === N. Wired into both renderActive and renderTerminal above the
rolling log.
Tests: 5 new for renderToolsHeader covering empty input, mixed
done/running states, all-complete suffix, and ignoring non-tool
lines (narration, outputs, user steers). 48/48 pass.
Telegram bridge gets the same treatment in a follow-up — needs the
focus-window revert first (still on commit 8728c39 per the handoff)
to slot in cleanly. Matrix-only for this PR.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: itsablabla <itsablabla@users.noreply.github.com>
Contributor
|
Capy auto-review is paused for this organization because the monthly auto-review limit has been reached. Increase the limit or turn it off in billing settings to resume automatic reviews. |
Contributor
Author
@devin-ai-integration[bot] This repository is not connected to a Replicas organization. To enable Replicas on this repository:
Note: Each repository can only be connected to one Replicas organization. |
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Mirrors the OpenACP UX Jaden screenshotted in the Slack thread — each tool line ticks live, the header shows a running M/N counter. References the research doc Detailed Deep-Dive §2 (ToolCard internals) and §5 (renderToolCard layout).
Before / After
Before:
After:
…then when
git statusfinishes:Implementation
Pairing tool_use → tool_result
ContentBlockgainsid(the Anthropic-assignedtoolu_…) andtool_use_id(the back-pointer Anthropic carries ontool_resultblocks). The poller keeps atoolLineIndex: Record<string, number>in DO storage mappingtool_use.id → row index in lines. Persisted in the writes batch; wiped on/watchfresh-spawn so a new turn doesn't inherit stale mappings.Status prefix mutation
tool_useprojection: push line as🔄 ${formatToolUseLine}and record the row index underblock.id.tool_resultprojection: look up the row byblock.tool_use_id, mutate the leading🔄→✅(success) or❌(error). Thendelete toolLineIndex[block.tool_use_id]— one-shot, so a malformed duplicate result can't keep flipping the row.Tools (M/N) header
render.tsgainsrenderToolsHeader(lines: string[]): string. Stateless — scans for🔄/✅/❌prefixes, counts done and total. Returns📋 Tools (M/N)with a trailing✅whenM === N && N > 0(matches OpenACP'sallCompleteheader). Wired into bothrenderActiveandrenderTerminalabove the rolling log.Test plan
bun run typecheckcleanbun test src/render.test.ts— 48/48 pass (5 new forrenderToolsHeader: empty input, mixed done/running, all-complete suffix, ignoring non-tool lines)bee12be7🔄 …, tick to✅ …(or❌ …) as it finishes, and the header counter to climb in real timels /nonexistent); expect that row's prefix to become❌Not in this PR (deferred)
8728c39perdocs/agent-handoff.md; that needs to be reverted first so the new prefixes and header slot in cleanly.Workspace · Slack Thread