Standardize on the .agents/ directory (shared with project skills): phases/, user_stories/, reports/, screenshots/, validate.sh, and phase-sessions/ + pipeline.log all move to .agents/ (git mv preserves history; runtime artifacts move alongside). Updates every reference in AGENTS.md, README.md, .gitignore, app docstrings, and test story headers. Historical KB content in data/ and the runtime pipeline.log transcript are left untouched.
2.9 KiB
2.9 KiB
Task 04 — Frontend Tool-Line Rendering for the New Names
Phase: 70_harness_aligned_tools · Story: .agents/user_stories/agent-document-tools.md
Objective
Point the tool-line rendering at the new ls/read/grep names while keeping
legacy saved chats (persisted with the old list_documents / read_document /
search_documents names, phase 14 persistence) rendering exactly as before — no
migration.
Work
frontend/assets/app.js—appendToolLine(wrap, name, argument):- New branches:
read+ argument →📄 Reading <code>argument</code>;grep+ argument →🔎 Searching for <code>argument</code>;ls+ argument (scoped) →🔎 Listing documents in <code>argument</code>;lsunscoped →🔎 Listing documents. - Legacy branches stay:
read_document(Reading),search_documents(Searching for), everything else (Listing documents) — persisted turns from before this phase must render unchanged. (Implementation: a name→kind map covering both generations, or explicit if-chains — executor's choice; the pins below define the contract.) - All arguments through
textContentonly (the existing "path/pattern is data, never markup" discipline). - Update the section docstring (phase 37 reference + a phase-70 note: names remapped to the harness surface; legacy names still render).
- New branches:
frontend/assets/shared.js— the shared-chat tool-line helper (currentlyread_document+ argument →📄 Reading <code>…</code>, else🔎 Listing documents): add the new names (read→ Reading,grep→ Searching for with<code>argument,ls→ Listing documents,ls+ argument → Listing documents in<code>…</code>), keep the legacyread_documentbranch, keeptextContent-only population. Update its docstring comment.tests/unit/test_frontend_tool_states.py— update/add pins (the source-string house pattern):app.jscarries branches forread,grep,ls(with/without argument) and still carriesread_document/search_documents(legacy render).shared.jscarries theread/grep/lshandling and the legacyread_documentbranch.- Every argument population goes through
textContent(noinnerHTMLon tool lines). - The old-only copy pins (e.g. exact "Listing documents" string for the default case) stay green.
Testing & Quality
- Unit:
tests/unit/test_frontend_tool_states.pypins above. - Coverage: no
app/code in this task — the >90% gate stays green as part of the full suite run.
Completion Criteria
uv run pytest tests/unit/test_frontend_tool_states.py -v --no-covgreen.- A persisted chat containing old tool names renders Reading/Searching/Listing lines exactly as before (legacy branches pinned).
uv run ruff check . && uv run pyrightclean.