Skip to content

API Reference parrot.outputs.a2ui.catalog.parrot.htmldocument

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.outputs.a2ui.catalog.parrot.htmldocument

View source

A2UI HtmlDocument catalog component (Module 5, FEAT-527).

An opaque, display-only wrapper around a TRUSTED, already-rendered HTML document (the Jinja render_template/render_data_template lane — spec G5, resolved U4). tool_only=True: only deterministic tool builders (:func:~parrot.outputs.a2ui.builders.build_html_document) may emit this component — an LLM-origin envelope containing it fails :func:~parrot.outputs.a2ui.catalog.validate_envelope (the same gate mechanism as requires_actions, TASK-2862). This is a security boundary: the raw html is never LLM-authorable and never copied into the lowered Basic Catalog tree — static renderers must not echo it; only a renderer that can safely embed it (sandboxed iframe) reads component.model_extra["html"] directly, before lowering (TASK-2865).

Alias BasicNode

Re-exported from parrot.outputs.a2ui.catalog.base.BasicNode.

Alias BasicTree

Re-exported from parrot.outputs.a2ui.catalog.base.BasicTree.

Alias Component

Re-exported from parrot.outputs.a2ui.models.Component.

Attribute HTMLDOCUMENT_INSTRUCTIONS

Attribute HTMLDOCUMENT_SCHEMA

Type: dict[str, Any]

Class HtmlDocumentComponent

The HtmlDocument catalog component (tool-only, display-only).

Method HtmlDocumentComponent.lower

Lower to a title Text + a titled placeholder Text — never the raw HTML.

The placeholder carries metadata.extensions (parrot_role: "html_document", parrot_src_url, parrot_inline_html) so a renderer that can safely embed the document (sandboxed iframe) knows to look at the ORIGINAL, not-yet-lowered component's html/ srcUrl instead of this static degradation.

lower(component: Component, data_model: dict[str, Any]) -> BasicTree

Parameter Type Default Description
component Component
data_model dict[str, Any]

Returns: BasicTree

Function parse_html_document_placeholder_title

Recover the title from a lowered HtmlDocument placeholder Text.

Code-review fix (FEAT-527): this is the shared inverse of the f"[HTML document: {title}]" format string built in :meth:lower above — it used to be duplicated independently in the ssr-html and adaptive_cards renderers (satellite package), which read this Text node's props.get("text") back out when degrading a non-embeddable HtmlDocument.

parse_html_document_placeholder_title(placeholder: str) -> str

Parameter Type Default Description
placeholder str The degraded node's text value (e.g. from props.get("text") or ""). Any string not matching the "[HTML document: ...]" shape is returned unchanged — a renderer should never raise over a cosmetic title fallback.

Returns: str — The original title, or placeholder itself when it doesn't match the expected wrapper shape.

Alias register_component

Re-exported from parrot.outputs.a2ui.catalog.register_component.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally