Adapt Webpage¶
Adapt Webpage -- mvp.adapt_webpage
Cluster: Code Intelligence | Type: component | MCP Tools: 37
Overview¶
Webpage and component generation block that produces complete, self-contained HTML/CSS/JS pages — landing pages, dashboards, blogs, and e-commerce layouts — along with individual UI components, responsive multi-device previews, CSS animations, visual clones of existing pages, and decorated section variants. All output is pure string HTML; no browser or build tool is required. SEO metadata (description, Open Graph, canonical URL) is embedded in generated pages automatically.
When to use:
- Generating a landing page or dashboard layout from a title, theme, and section list
- Producing individual UI components (buttons, cards, navbars) for assembly into a larger page
- Previewing a layout across multiple breakpoints as part of a design review pipeline
- Cloning the structure or visual appearance of an existing page from its HTML source
- Saving and retrieving page variants through the MCP SQLite store
- Auditing generated or supplied HTML for baseline accessibility and SEO checks
Launch posture:
Treat adapt_webpage as pilot-ready website scaffolding, not a standalone production website builder. It is useful for demo pages, first-draft landing pages, saved page variants, and audit checks that support the launch plan's emphasis on installability, demo readiness, and credible website claims. Generated copy and templates are intentionally generic and should be reviewed before publishing.
Production hardening currently includes escaped title and metadata insertion, guarded custom CSS insertion, sanitized animation and decorative inputs, isolated responsive previews, empty-save failures, resource-bound checks, typed Result outputs for discovery operations, and a constrained backend-native adapter lane (backend_capabilities, backend_op_schema, backend_execute). The active deterministic backend is discoverable and auditable, but it does not implement external URL fetch, browser-DOM cloning, arbitrary JavaScript execution, shell execution, CMS deployment, or full animation-library adapters. CDN/WebGL-dependent requests degrade loudly unless explicitly allowed and supported.
Do not use it as-is for customer-facing pages without copy, visual, and browser QA; as a replacement for the Django website implementation; or as evidence that G6 fully automates production-quality website design without human review.
Example:
from mvp.adapt_webpage import AdaptWebpageBlock, WebpageInput
block = AdaptWebpageBlock(name="webpage")
result = block.infer(WebpageInput(
operation="generate_landing",
title="G6 Platform",
theme="modern",
sections=["hero", "features", "pricing", "footer"],
description="The G6 Hyperdistillation AI platform.",
))
# result.value.html → complete landing page HTML string
Works well with: adapt_ui_design, adapt_django, adapt_diagrams
Public API¶
WebpageInput(BaseModel)¶
| Field | Type | Default |
|---|---|---|
operation | Literal['generate_page', 'generate_landing', 'generate_component', 'compose_sections', 'apply_theme', 'add_animation', 'clone_structure', 'clone_visual', 'preview_responsive', 'generate_css', 'apply_decoration', 'export_html', 'multi_device_preview', 'backend_capabilities', 'backend_op_schema', 'backend_execute', 'ops', 'help'] | 'generate_page' |
title | str | '' |
layout | str | 'landing' |
theme | str | 'modern' |
sections | list[str] | Field(default_factory=list) |
custom_css | str | '' |
animation_type | str | '' |
animation_target | str | '' |
animation_config | dict[str, Any] | Field(default_factory=dict) |
clone_url | str | '' |
clone_html | str | '' |
component_type | str | '' |
breakpoints | list[int] | Field(default_factory=list) |
decoration_type | str | '' |
description | str | '' |
og_image | str | '' |
canonical | str | '' |
backend_id | str | 'deterministic_webpage_backend' |
target_op | str | '' |
params | dict[str, Any] | Field(default_factory=dict) |
allow_network | bool | False |
allow_cdn | bool | False |
allow_webgl | bool | False |
dry_run | bool | False |
request_id | str | '' |
task_id | str | '' |
run_id | str | '' |
WebpageOutput(BaseModel)¶
| Field | Type | Default |
|---|---|---|
operation | str | '' |
html | str | '' |
css | str | '' |
js | str | '' |
preview_html | str | '' |
sections_html | list[str] | Field(default_factory=list) |
metadata | dict[str, Any] | Field(default_factory=dict) |
ok | bool | True |
degraded | bool | False |
degradation_reason | str | '' |
capability_status | dict[str, Any] | Field(default_factory=dict) |
missing_capabilities | list[str] | Field(default_factory=list) |
evidence | dict[str, Any] | Field(default_factory=dict) |
completion_state | Literal['verified', 'qualified-draft', 'blocked-escalated'] | 'qualified-draft' |
warning_card | dict[str, Any] | Field(default_factory=dict) |
request_id | str | '' |
task_id | str | '' |
run_id | str | '' |
AdaptWebpageBlock(AIBlock[WebpageInput, WebpageOutput, dict])¶
Self-contained webpage generator block.
| Field | Type | Default |
|---|---|---|
name | str | 'adapt_webpage' |
resource_bounds | ResourceBounds \| None | None |
Methods:
infer(data: WebpageInput) -> Result[WebpageOutput]¶
MCPWebpageInput(BaseModel)¶
| Field | Type | Default |
|---|---|---|
op | Literal['generate_page', 'generate_component', 'compose_sections', 'preview_html', 'generate_landing', 'clone_structure', 'clone_visual', 'extract_palette', 'extract_layout', 'extract_assets', 'add_css_animation', 'add_gsap_animation', 'add_threejs_scene', 'add_particles', 'add_shader', 'generate_css', 'responsive_adapt', 'apply_theme', 'generate_decoration', 'apply_style', 'save_page', 'get_page', 'list_pages', 'update_page', 'delete_page', 'audit_page', 'list_templates', 'get_template', 'search_templates', 'generate_from_template', 'recommend_animation', 'list_patterns', 'backend_capabilities', 'backend_op_schema', 'backend_execute', 'ops', 'help'] | required |
title | str | '' |
layout | str | 'landing' |
theme | str | 'modern' |
sections | list[str] | Field(default_factory=list) |
custom_css | str | '' |
component_type | str | '' |
animation_target | str | '' |
animation_config | dict[str, Any] | Field(default_factory=dict) |
clone_html | str | '' |
clone_url | str | '' |
breakpoints | list[int] | Field(default_factory=list) |
decoration_type | str | '' |
style_css | str | '' |
name | str | '' |
page_id | str | '' |
html_content | str | '' |
tags_csv | str | '' |
description | str | '' |
og_image | str | '' |
canonical | str | '' |
query | str | '' |
top_k | int | 5 |
limit | int | 50 |
template_slug | str | '' |
archetype | str | '' |
include_html | bool | True |
include_design_notes | bool | True |
design_brief | str | '' |
allow_external_cdn | bool | True |
allow_cdn | bool | False |
allow_webgl | bool | True |
allow_network | bool | False |
reduced_motion | bool | False |
performance_budget | str | '' |
backend_id | str | 'deterministic_webpage_backend' |
target_op | str | '' |
params | dict[str, Any] | Field(default_factory=dict) |
dry_run | bool | False |
request_id | str | '' |
task_id | str | '' |
run_id | str | '' |
MCPWebpageOutput(BaseModel)¶
| Field | Type | Default |
|---|---|---|
op | str | '' |
key | str | '' |
value | Any | None |
found | bool | False |
ok | bool | True |
count | int | 0 |
records | list[MCPWebpageRecord] | Field(default_factory=list) |
html | str | '' |
css | str | '' |
js | str | '' |
preview_html | str | '' |
sections_html | list[str] | Field(default_factory=list) |
summary | str | '' |
message | str | '' |
metadata | dict[str, Any] | Field(default_factory=dict) |
degraded | bool | False |
degradation_reason | str | '' |
capability_status | dict[str, Any] | Field(default_factory=dict) |
missing_capabilities | list[str] | Field(default_factory=list) |
evidence | dict[str, Any] | Field(default_factory=dict) |
completion_state | Literal['verified', 'qualified-draft', 'blocked-escalated'] | 'qualified-draft' |
warning_card | dict[str, Any] | Field(default_factory=dict) |
request_id | str | '' |
task_id | str | '' |
run_id | str | '' |
WebpageStore¶
Sync SQLite store with 5 tables.
Constructor:
| Parameter | Type | Default |
|---|---|---|
db_path | str | ':memory:' |
Methods:
save_page(name: str, html: str, css: str = '', js: str = '', layout: str = 'landing', theme: str = 'modern', description: str = '', tags: list[str] | None = None) -> str¶
get_page(name: str) -> dict[str, Any] | None¶
get_page_by_id(page_id: str) -> dict[str, Any] | None¶
list_pages(limit: int = 50) -> list[dict[str, Any]]¶
update_page(name: str, html: str = '', css: str = '', js: str = '', description: str = '') -> bool¶
delete_page(name: str) -> bool¶
save_template(name: str, html: str, css: str = '', category: str = '', description: str = '') -> str¶
get_template(name: str) -> dict[str, Any] | None¶
list_templates(category: str = '') -> list[dict[str, Any]]¶
save_style(name: str, css: str, theme: str = '', description: str = '') -> str¶
save_animation(name: str, animation_type: str, css: str = '', js: str = '', config: dict[str, Any] | None = None) -> str¶
save_asset(page_id: str, asset_type: str, content: str, filename: str = '') -> str¶
list_assets(page_id: str) -> list[dict[str, Any]]¶
count_all() -> dict[str, int]¶
AdaptWebpageMCPBlock(AIBlock[MCPWebpageInput, MCPWebpageOutput, dict])¶
32-op webpage block with SQLite persistence (30 functional + 2 advisory).
| Field | Type | Default |
|---|---|---|
name | str | 'adapt_webpage_mcp' |
state | dict \| None | None |
db_path | str | ':memory:' |
resource_bounds | ResourceBounds \| None | None |
agentic_planner | 'WebpagePlanner \| None' | None |
Methods:
infer(data: MCPWebpageInput) -> Result[MCPWebpageOutput]¶
MCP Tools¶
| Operation | Source |
|---|---|
generate_page | webpage_mcp |
generate_component | webpage_mcp |
compose_sections | webpage_mcp |
preview_html | webpage_mcp |
generate_landing | webpage_mcp |
clone_structure | webpage_mcp |
clone_visual | webpage_mcp |
extract_palette | webpage_mcp |
extract_layout | webpage_mcp |
extract_assets | webpage_mcp |
add_css_animation | webpage_mcp |
add_gsap_animation | webpage_mcp |
add_threejs_scene | webpage_mcp |
add_particles | webpage_mcp |
add_shader | webpage_mcp |
generate_css | webpage_mcp |
responsive_adapt | webpage_mcp |
apply_theme | webpage_mcp |
generate_decoration | webpage_mcp |
apply_style | webpage_mcp |
save_page | webpage_mcp |
get_page | webpage_mcp |
list_pages | webpage_mcp |
update_page | webpage_mcp |
delete_page | webpage_mcp |
audit_page | webpage_mcp |
list_templates | webpage_mcp |
get_template | webpage_mcp |
search_templates | webpage_mcp |
generate_from_template | webpage_mcp |
recommend_animation | webpage_mcp |
list_patterns | webpage_mcp |
backend_capabilities | webpage_mcp |
backend_op_schema | webpage_mcp |
backend_execute | webpage_mcp |
ops | webpage_mcp |
help | webpage_mcp |
Production Notes¶
save_pagerequires generated state or explicithtml_content; empty pages fail instead of being saved silently.preview_html,responsive_adapt, andmulti_device_previewrender page output in isolatediframe srcdocframes so complete HTML documents are not nested directly into the preview shell.custom_cssandstyle_cssremain powerful user input. The component prevents style/script tag breakout, but published output should still go through normal code review.audit_pagechecks for baselinelang, charset, title, description, skip-navigation, and main-landmark markers. It is a launch/readiness smoke check, not a full accessibility certification.backend_capabilitiesreports the active deterministic backend, available local generation features, disabled capabilities, policy gates, and missing dependencies.clone_urlwithout suppliedclone_htmlis blocked withcompletion_state: blocked-escalated; no network fetch or browser clone is attempted.- Backend-native execution is allowlisted and typed. It is for constrained access to implemented local operations, not arbitrary code execution or a production website builder.