feat(brain): Live-Tool-Events im Gedanken-Stream

Proxy-Patch hookt Claude-CLI `assistant`-Events: bei jedem tool_use-
Block (Bash, Read, Edit, Grep, ...) wird per HTTP-POST an die Bridge
gemeldet. Bridge spiegelt das als `agent_activity tool=<name>` an die
RVS-Clients. App- und Diagnostic-Gedanken-Stream zeigen damit live mit
was ARIA gerade macht — vorher kam pro Brain-Call nur EIN „💭 denkt"
am Anfang und EIN „✓ fertig" am Ende.

Drei neue Bausteine:
- proxy-patches/routes.js: kompletter Replacement der npm-Version mit
  `_attachToolHook(subprocess)` — feuert pro tool_use-Block ein HTTP-
  POST an http://aria-bridge:8090/internal/agent-activity (URL via
  ARIA_TOOL_HOOK_URL Env-Variable ueberschreibbar). Fire-and-forget,
  fail-open — Brain-Call bricht NICHT ab wenn Bridge mal nicht da ist.
- docker-compose.yml: vierter cp-Schritt im proxy-Service kopiert
  routes.js ueber die npm-Version (analog zu openai-to-cli + cli-to-
  openai).
- bridge/aria_bridge.py: neuer `/internal/agent-activity`-Endpoint im
  bestehenden _serve_internal_http. Plus _emit_activity hat jetzt
  force=True-Param damit wiederholte gleiche Tool-Aufrufe (3x Bash in
  Folge) als drei Eintraege im Stream sichtbar bleiben.

App + Diagnostic: pushThought-Dedup laesst tool-Events durch (3x Bash
hintereinander gibt 3 Eintraege im Gedanken-Stream).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-15 11:07:39 +02:00
parent 8ca899aaf5
commit bf3dc635d9
5 changed files with 345 additions and 7 deletions
+4 -2
View File
@@ -2252,9 +2252,11 @@
}
function pushThought(activity, tool) {
// Dedup gegen direkt aufeinanderfolgende identische Events
// Dedup gegen direkt aufeinanderfolgende identische Events. Tool-
// Events NIE dedupen — drei Bash-Calls in Folge sollen drei Eintraege
// ergeben, nicht einen.
const key = `${activity}|${tool || ''}`;
if (key === lastThoughtKey) return;
if (activity !== 'tool' && key === lastThoughtKey) return;
lastThoughtKey = key;
thoughtStream.push({ ts: Date.now(), activity, tool: tool || '' });
if (thoughtStream.length > MAX_THOUGHTS) thoughtStream = thoughtStream.slice(-MAX_THOUGHTS);