You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
claude-code-chat-browser: Frontend tool registry - link to backend dispatch table via generated manifest (#105)
* feat: link frontend tool registry to generated tool_types.json manifest
Generate static/tool_types.json from KNOWN_TOOL_TYPES and load it at SPA
boot to cross-check TOOL_USE_RENDERERS with console.warn on drift. Improve
unknown tool/result fallbacks to show raw type names and JSON payloads.
Extend test_tool_dispatch_sync.py with manifest freshness and coverage
assertions. Await manifest init before first route render; document the
flow in CONTRIBUTING.md, Makefile, and docs/architecture.md.
* fix: non-blocking manifest init, fetch timeout, stricter manifest parse
* fix(test): ensure fake timers cleanup in manifest timeout test
Wrap the initToolTypesManifest timeout test in try/finally so
vi.useRealTimers() runs even when assertions fail. Also ruff-format
test_tool_dispatch_sync.py manifest validation helper (CI gate).
* fix(frontend): drop unused tool_types_state scaffolding
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -149,8 +149,9 @@ Claude Code assistant `tool_use` blocks carry a `name` string (e.g. `"Read"`, `"
149
149
2.**`models/tool_results.py`** — add the name to `ToolNameLiteral` and, when the tool has a distinct result payload, add the TypedDict, type guard (`is_*_tool_result`), and union member on `ToolResultUnion`.
150
150
3.**`utils/md_exporter.py`** — add an `elif name == "…"` branch in `_render_tool_use` (sync test parses these branches).
151
151
4.**`static/js/render/registry.js`** — add a `TOOL_USE_RENDERERS` entry (and a `tool_use/*.js` renderer module).
152
-
5.**Optional result UI** — if the backend emits a new `result_type`, add `TOOL_RESULT_RENDERERS` and a `tool_result/*.js` module.
153
-
6. Run `pytest tests/test_tool_dispatch_sync.py -v` — failure names the site missing the new type.
-`render/registry.js` — **tool dispatch registry** for session UI: `TOOL_USE_RENDERERS` and `TOOL_RESULT_RENDERERS` map tool name / `result_type` → render function (one module per type under `render/tool_use/` and `render/tool_result/`). Parallels backend `utils/tool_dispatch.py` (backend uses ordered predicates; frontend uses direct key lookup + fallback).
109
+
-`static/tool_types.json` — generated manifest of backend tool-use names (`python scripts/gen_tool_types_manifest.py` from `KNOWN_TOOL_TYPES`). Fetched non-blocking at boot by `render/tool_types_manifest.js` (`void initToolTypesManifest()` in `app.js`), which cross-checks `TOOL_USE_RENDERERS` and logs `console.warn` on drift.
109
110
-`shared/markdown.js` — markdown + **DOMPurify** sanitization (do not render raw LLM HTML)
110
111
-`shared/state.js`, `shared/utils.js`, `shared/theme.js` — shared UI state and helpers
0 commit comments