fix(trace): record HTML spec materials as HTML

Merged
JI
1d ago
+214-4

Some AI coding sessions capture spec or attachment sources that are full HTML pages. Trace stored them under the file name the agent chose, usually .md, with the frontmatter header above the doctype. A reader then showed the HTML source as text, not as a page.

Now a captured text spec source whose body opens with a doctype or an html root element is stored as an .html file that holds only the page. The header values (kind, URI, role, title, description) stay in the material annotations and in the spec entry of the session, as before. Redaction runs on the whole file first, so the stored page is redacted. Markdown that only contains HTML tags, such as a README banner, and image or binary sources are unchanged. The Trace README feature table has a new row for this.

Tested with new table-driven unit tests for the HTML detection and for the staged file name and content of the spec material.

This change was made with AI assistance (Claude Code).

Closes #3707

🤖 Opened by the eng-autopilot skill (Claude Code) for @jiparis