Skip to content

feat(agents): store and compile versioned html visuals - #716

Merged
nixuuu merged 1 commit into
devfrom
feat/agents-html-storage
Nov 14, 2026
Merged

nixuuu merged 1 commit into
devfrom
feat/agents-html-storage

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Adds render_html beside render_visual, storing HTML as an immutable, owner-scoped visual version. The existing item, GetVisual, expected_version, citation and export pipeline remains the source of truth. Old clients reject kit version 2; workers and gateways negotiate thread_html_v1 additively.

The shared compiler rebuilds untrusted HTML, attempts to remove embedded documents, navigation attributes, inline handlers and external/module scripts, and prefixes each classic script with lockdown before hashing it. Removal is best-effort: parser differences and reparsing can restore markup (mXSS); CSP is the execution/resource boundary. Foreign MathML/SVG style elements are additionally discarded. Script CSP is hash-only; there is no unsafe-eval or unsafe-hashes. The trusted shell also restricts child navigation. Web/mobile residual network risk is explicitly accepted: matching-SRI external scripts and DNS hints can still send data. Desktop adds a separate network-denied browser process in #718.

Validation: install, generation, typecheck, lint and formatting passed. The focused compiler/inbox/migration/gateway/harness run passed 58 tests. Tests cover pre-parse/UTF-8 limits, CSP hashes, stripped permissive metas, script-only sandbox, cyclic/invalid/flooded messages, owner scoping, version conflicts and format preservation. Migration is now 0144_thread_html (file, index and schema expectation), following dev's 0143 from #725. The CLIProxyAPI stack moves to 0145; this stack merges first. Protocol remains additive.

Security review fixes: the CSP meta, style and bootstrap scripts are inserted as parse5 tree nodes. Regression tests cover <html data-x="<head>">, a leading <!-- <head> -->, and </body> text in attributes/comments: exactly one CSP meta is first in the real head and every executable script has an authorized hash. Gateway publishing applies the same depth100/script64 limits as clients; rejected documents leave no stored version. The shell relay forwards only JSON.parse(text).message; an 8 MiB ArrayBuffer regression proves the original clone is not forwarded. Shared iframe permissions explicitly deny PiP and clipboard features.

The focused security/gateway/three-harness run passed 38/38; channel identity tests passed 3/3. Per-platform probe evidence is recorded on #718, including the DNS positive control and protected result. The independent security re-check recommended merge. Copy audit: no new UI copy in this layer; tool instructions state inline-only code, addEventListener, size/script/depth limits, theme variables and no secrets.

Previous-head full check:tmp was green in CI run 43605016001, head cc18c0b7d86ae78ddd7d1cdff1af221107910367.

Pre-merge update: rebased onto origin/dev including #723, #725 and #730, preserving the new visual kit/gallery compiler and provider migration. The shell's own hash-authorized script now starts with the shared network lockdown, including when copied into a fresh realm. Only the trusted mobile shell retains its own message bridge; opaque agent realms have none and also remove ReactNativeWebView. Regression tests exercise web/native relay, locked RTC/fetch properties, the shell hash prefix and MathML/SVG reparsing with script-src-attr none. Final-head checks: schema/compiler 51/51, visuals/three-harness integration 16/16, both with empty temp directories; gen:check, full typecheck, lint and format:check passed. Immediately before the final push, origin/dev was re-fetched at d2af937 and its highest migration confirmed as 0143. New-head full CI is pending. All four PRs are ready, as requested; no merge performed.

@nixuuu
nixuuu force-pushed the feat/agents-html-storage branch from 6edb29c to ced90c8 Compare November 14, 2026 12:57
@nixuuu
nixuuu added this pull request to stack #720 November 14, 2026 12:58
@nixuuu
nixuuu force-pushed the feat/agents-html-storage branch 4 times, most recently from 3144924 to 3193fe4 Compare November 14, 2026 14:53
@nixuuu
nixuuu marked this pull request as ready for review November 14, 2026 14:55
@nixuuu
nixuuu force-pushed the feat/agents-html-storage branch 2 times, most recently from cb790c7 to 9b6eb9a Compare November 14, 2026 15:15
@nixuuu
nixuuu force-pushed the feat/agents-html-storage branch from 9b6eb9a to a63f423 Compare November 14, 2026 15:32
@nixuuu
nixuuu merged commit 01492e3 into dev Nov 14, 2026
12 checks passed
@nixuuu
nixuuu deleted the feat/agents-html-storage branch November 14, 2026 16:01
nixuuu added a commit that referenced this pull request Nov 14, 2026
Offers `render_html` through the shared tool catalog on Claude Agent
SDK, Codex app-server and Grok ACP. The worker announces
`thread_html_v1`; an older gateway gets an actionable update response
instead of an unknown-tool call.

Validation: fake adapters for all three harnesses publish HTML through
WorkerLink into PostgreSQL. Existing component-tool coverage is
retained. The focused compiler/inbox/migration/gateway/harness run
passed 58 tests; install, generation, typecheck, lint and formatting
passed.

Security/gateway/three-harness run passed 38/38, including fake adapters
publishing through WorkerLink. Platform probes are recorded on #718.
Gateway depth100/script64 errors reach the tool before storage. The
independent security re-check recommended merge. Copy audit:
model-facing description prefers components for standard
charts/cards/tables, requires addEventListener rather than inline
handlers/eval, inline libraries/assets, no network or secrets, bounded
documents and Canopy theme variables. No UI copy changes in this layer.

Previous-head full check:tmp was green in [CI run
43605016001](https://github.com/itsoltech/canopy/actions/runs/43605016001),
head `cc18c0b7d86ae78ddd7d1cdff1af221107910367`.

Pre-merge update: rebased onto origin/dev including #723, #725 and #730,
with render_html migration 0144 after the provider migration 0143. The
shared compiler/shell P3 fixes and regression evidence are described in
#716 and #718. Final-head schema/compiler tests: 51/51;
gateway/three-harness visuals integration: 16/16; both temp checks
clean. Generation, typecheck, lint and formatting passed. New-head full
CI is pending. All four PRs are ready; no merge performed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant