This commit is contained in:
2026-06-14 15:01:42 +08:00
parent 67d79b58bb
commit 6f39b960d0
15 changed files with 1709 additions and 76 deletions
+583
View File
@@ -0,0 +1,583 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Part 2 Demo - Agentic Web</title>
<style>
:root {
color-scheme: light;
--ink: #17202a;
--muted: #64717f;
--line: #d9e1e8;
--panel: #f7f9fb;
--paper: #ffffff;
--blue: #2357d4;
--green: #0f7d58;
--amber: #aa6a00;
--red: #bb3e37;
--violet: #5d4cc2;
--shadow: 0 18px 60px rgb(45 62 80 / 0.13);
}
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family:
ui-sans-serif,
"PingFang SC",
"Microsoft YaHei",
"Noto Sans SC",
sans-serif;
color: var(--ink);
background:
linear-gradient(90deg, rgb(23 32 42 / 0.05) 1px, transparent 1px),
linear-gradient(rgb(23 32 42 / 0.05) 1px, transparent 1px),
#eef3f7;
background-size: 32px 32px;
}
a {
color: inherit;
text-decoration: none;
}
.shell {
display: grid;
grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
gap: 24px;
min-height: 100vh;
padding: 28px;
}
.rail,
.stage {
border: 1px solid var(--line);
background: rgb(255 255 255 / 0.88);
box-shadow: var(--shadow);
}
.rail {
position: sticky;
top: 28px;
align-self: start;
min-height: calc(100vh - 56px);
padding: 24px;
}
.eyebrow {
margin: 0 0 12px;
color: var(--blue);
font-size: 12px;
font-weight: 800;
letter-spacing: 0.08em;
text-transform: uppercase;
}
h1,
h2,
h3,
p {
margin-top: 0;
}
h1 {
max-width: 11ch;
margin-bottom: 18px;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(42px, 5vw, 74px);
line-height: 0.92;
letter-spacing: 0;
}
.lead {
color: var(--muted);
font-size: 16px;
line-height: 1.75;
}
.quick {
display: grid;
gap: 10px;
margin: 26px 0;
}
.quick button {
width: 100%;
border: 1px solid var(--line);
background: var(--paper);
color: var(--ink);
cursor: pointer;
display: grid;
grid-template-columns: 26px 1fr;
align-items: center;
gap: 10px;
min-height: 44px;
padding: 10px 12px;
text-align: left;
font: inherit;
}
.quick button:hover,
.quick button.active {
border-color: var(--blue);
background: #eef4ff;
}
.num {
display: grid;
place-items: center;
width: 26px;
height: 26px;
background: var(--ink);
color: white;
font-size: 12px;
font-weight: 800;
}
.note {
border-left: 4px solid var(--amber);
padding: 12px 14px;
background: #fff7e8;
color: #6f4b12;
font-size: 13px;
line-height: 1.65;
}
.stage {
padding: 28px;
}
.hero {
display: grid;
grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
gap: 22px;
align-items: stretch;
margin-bottom: 24px;
}
.statement {
min-height: 280px;
padding: 28px;
color: white;
background:
linear-gradient(135deg, rgb(23 32 42 / 0.94), rgb(35 87 212 / 0.82)),
radial-gradient(circle at 15% 20%, rgb(255 255 255 / 0.18), transparent 28%);
}
.statement h2 {
max-width: 720px;
margin-bottom: 18px;
font-size: clamp(28px, 4vw, 54px);
line-height: 1.02;
}
.statement p {
max-width: 760px;
color: rgb(255 255 255 / 0.78);
font-size: 17px;
line-height: 1.75;
}
.metric-grid {
display: grid;
gap: 12px;
}
.metric {
border: 1px solid var(--line);
background: var(--panel);
padding: 18px;
}
.metric strong {
display: block;
margin-bottom: 4px;
font-size: 28px;
}
.metric span {
color: var(--muted);
font-size: 13px;
}
.section {
margin-top: 24px;
}
.section h2 {
margin-bottom: 12px;
font-size: 26px;
}
.cards {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 14px;
}
.path-card,
.resource-card {
border: 1px solid var(--line);
background: var(--paper);
padding: 18px;
}
.path-card {
min-height: 250px;
}
.tag {
display: inline-flex;
align-items: center;
min-height: 24px;
margin-bottom: 14px;
padding: 3px 9px;
color: white;
font-size: 12px;
font-weight: 800;
}
.tag.red {
background: var(--red);
}
.tag.green {
background: var(--green);
}
.tag.blue {
background: var(--blue);
}
.tag.violet {
background: var(--violet);
}
.path-card h3,
.resource-card h3 {
margin-bottom: 8px;
font-size: 20px;
}
.path-card p,
.resource-card p {
color: var(--muted);
line-height: 1.65;
}
.path-card ul {
margin: 14px 0 0;
padding-left: 18px;
color: var(--muted);
line-height: 1.7;
}
.table {
width: 100%;
border-collapse: collapse;
overflow: hidden;
background: var(--paper);
}
.table th,
.table td {
border: 1px solid var(--line);
padding: 14px;
text-align: left;
vertical-align: top;
}
.table th {
background: var(--ink);
color: white;
font-size: 13px;
}
.table td {
color: var(--muted);
line-height: 1.55;
}
.resources {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 14px;
}
.resource-card {
position: relative;
min-height: 165px;
transition:
transform 160ms ease,
box-shadow 160ms ease;
}
.resource-card:hover {
box-shadow: 0 12px 32px rgb(35 87 212 / 0.13);
transform: translateY(-2px);
}
.resource-card .url {
color: var(--blue);
font-size: 13px;
overflow-wrap: anywhere;
}
.fallback {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 14px;
}
.fallback > div {
border: 1px solid var(--line);
padding: 18px;
background: var(--panel);
}
.fallback h3 {
margin-bottom: 8px;
}
.fallback p {
color: var(--muted);
line-height: 1.65;
}
@media (max-width: 980px) {
.shell,
.hero,
.fallback {
grid-template-columns: 1fr;
}
.rail {
position: static;
min-height: auto;
}
.cards,
.resources {
grid-template-columns: 1fr;
}
}
</style>
</head>
<body>
<main class="shell">
<aside class="rail">
<p class="eyebrow">Part 2 Demo Desk</p>
<h1>Agentic Web</h1>
<p class="lead">
官方 demo 优先,本地页面只负责串联叙事和兜底。现场不依赖实验 flags,也不复刻所有 Chrome API。
</p>
<nav class="quick" aria-label="Demo sections">
<button class="active" data-target="paths"><span class="num">1</span><span>三种操作路径</span></button>
<button data-target="webmcp"><span class="num">2</span><span>WebMCP 可运行 demo</span></button>
<button data-target="resources"><span class="num">3</span><span>官方 demo 资料</span></button>
<button data-target="fallback"><span class="num">4</span><span>现场兜底讲法</span></button>
</nav>
<div class="note">
讲述原则:案例数据只说明趋势,不代表所有项目;实验能力必须标注支持边界和渐进增强。
</div>
</aside>
<section class="stage">
<div class="hero">
<section class="statement">
<p class="eyebrow">Core Message</p>
<h2>从“AI 猜 UI”到“网页暴露工具”。</h2>
<p>
视觉识别和 DOM 识别让 Agent 尝试理解页面表象;WebMCP 的方向是让页面主动提供结构化能力,
让 Agent 调用工具、传入参数、拿到结果。
</p>
</section>
<aside class="metric-grid" aria-label="Demo principles">
<div class="metric">
<strong>官方</strong>
<span>优先展示 Chrome 官方文档、demo 和命令示例</span>
</div>
<div class="metric">
<strong>本地</strong>
<span>WebMCP 提供可运行工程,其他实验能力用官方 demo 快闪</span>
</div>
<div class="metric">
<strong>15 分钟</strong>
<span>建议 demo 段控制在 12-15 分钟</span>
</div>
</aside>
</div>
<section id="paths" class="section">
<h2>同一个后台任务,三种 Agent 操作路径</h2>
<div class="cards">
<article class="path-card">
<span class="tag red">Vision</span>
<h3>看截图</h3>
<p>Agent 通过视觉模型识别菜单、按钮、输入框,再一步步点击。</p>
<ul>
<li>优点:不需要改造页面</li>
<li>风险:慢、贵、UI 变化敏感</li>
<li>适合:临时探索和低风险页面</li>
</ul>
</article>
<article class="path-card">
<span class="tag green">DOM / A11y</span>
<h3>读结构</h3>
<p>Agent 读取 DOM 或可访问性树,通过结构化信息定位交互元素。</p>
<ul>
<li>优点:比截图更结构化</li>
<li>风险:复杂组件和隐藏状态仍会误导</li>
<li>适合:语义清晰的表单页面</li>
</ul>
</article>
<article class="path-card">
<span class="tag blue">WebMCP</span>
<h3>调工具</h3>
<p>页面暴露工具名、描述、参数 schema 和执行逻辑,Agent 直接调用业务能力。</p>
<ul>
<li>优点:语义明确、速度快、过程可控</li>
<li>风险:仍需权限、确认和审计边界</li>
<li>适合:复杂后台和重复流程</li>
</ul>
</article>
</div>
</section>
<section class="section">
<h2>对比讲述表</h2>
<table class="table">
<thead>
<tr>
<th>维度</th>
<th>视觉识别</th>
<th>DOM / A11y</th>
<th>WebMCP</th>
</tr>
</thead>
<tbody>
<tr>
<td>交互方式</td>
<td>观察截图后猜测点击位置</td>
<td>读取结构后定位元素</td>
<td>调用页面声明的语义工具</td>
</tr>
<tr>
<td>稳定性</td>
<td>受视觉布局影响明显</td>
<td>受 DOM 结构和组件状态影响</td>
<td>受工具设计、权限和业务逻辑影响</td>
</tr>
<tr>
<td>现场讲法</td>
<td>“像让 AI 蒙着眼睛找按钮”</td>
<td>“给了地图,但地图可能不完整”</td>
<td>“给了工具入口和参数说明”</td>
</tr>
</tbody>
</table>
</section>
<section id="webmcp" class="section">
<h2>WebMCP 原始工程 demo</h2>
<div class="fallback">
<div>
<h3>运行入口</h3>
<p>
打开 <a href="./webmcp/index.html">/demo/webmcp/index.html</a>,展示声明式表单工具、
指令式 JS 工具、工具 schema 面板和复合任务调用日志。
</p>
</div>
<div>
<h3>讲述重点</h3>
<p>
先让人提交表单,再让工具面板执行同一类任务。观众会看到 Agent 不需要猜 UI,
它看到的是工具名、描述、参数 schema 和执行结果。
</p>
</div>
</div>
</section>
<section id="resources" class="section">
<h2>官方 demo 与资料入口</h2>
<div class="resources">
<a class="resource-card" href="https://developer.chrome.com/docs/ai/webmcp/imperative-api" target="_blank" rel="noreferrer">
<span class="tag blue">WebMCP</span>
<h3>Imperative API</h3>
<p>使用 document.modelContext.registerTool 暴露工具,官方示例包含 pizza layer 和 order status。</p>
<div class="url">developer.chrome.com/docs/ai/webmcp/imperative-api</div>
</a>
<a class="resource-card" href="https://developer.chrome.com/docs/modern-web-guidance" target="_blank" rel="noreferrer">
<span class="tag green">MWG</span>
<h3>Modern Web Guidance</h3>
<p>给 AI 编程工具补充现代 Web 知识、兼容性和最佳实践。</p>
<div class="url">developer.chrome.com/docs/modern-web-guidance</div>
</a>
<a class="resource-card" href="https://developer.chrome.com/docs/devtools/agents/get-started" target="_blank" rel="noreferrer">
<span class="tag violet">DevTools</span>
<h3>Chrome DevTools for agents</h3>
<p>让 coding agent 访问真实浏览器、console、network、performance trace 和 Lighthouse。</p>
<div class="url">developer.chrome.com/docs/devtools/agents/get-started</div>
</a>
<a class="resource-card" href="https://developer.chrome.com/docs/ai/prompt-api" target="_blank" rel="noreferrer">
<span class="tag blue">Prompt API</span>
<h3>Built-in AI</h3>
<p>浏览器内置语言模型能力,适合作为渐进增强展示。</p>
<div class="url">developer.chrome.com/docs/ai/prompt-api</div>
</a>
<a class="resource-card" href="https://developer.chrome.com/blog/html-in-canvas-origin-trial" target="_blank" rel="noreferrer">
<span class="tag red">Canvas</span>
<h3>HTML-in-Canvas</h3>
<p>把真实 DOM 放入 Canvas / WebGL / WebGPU 场景,同时保留浏览器能力。</p>
<div class="url">developer.chrome.com/blog/html-in-canvas-origin-trial</div>
</a>
<a class="resource-card" href="https://view-transitions.chrome.dev/" target="_blank" rel="noreferrer">
<span class="tag green">UX</span>
<h3>View Transitions</h3>
<p>官方交互 demo,用于快闪展示 Web 体验能力升级。</p>
<div class="url">view-transitions.chrome.dev</div>
</a>
</div>
</section>
<section id="fallback" class="section">
<h2>现场兜底讲法</h2>
<div class="fallback">
<div>
<h3>如果官方 demo 打不开</h3>
<p>
继续使用本页的卡片和对比表讲主线:AI 不擅长猜复杂 UI,WebMCP 的价值是结构化暴露工具。
官方链接可作为会后资料。
</p>
</div>
<div>
<h3>如果有人追问落地</h3>
<p>
只回答原则:渐进增强、权限继承、高危确认、审计日志、工具按需暴露。
不在本场扩展到厂商 SDK 选型和企业架构。
</p>
</div>
</div>
</section>
</section>
</main>
<script>
const buttons = Array.from(document.querySelectorAll(".quick button"));
buttons.forEach((button) => {
button.addEventListener("click", () => {
buttons.forEach((item) => item.classList.remove("active"));
button.classList.add("active");
document.getElementById(button.dataset.target)?.scrollIntoView({
behavior: "smooth",
block: "start",
});
});
});
</script>
</body>
</html>