执行轨迹
逐行展示智能体或任务的执行过程,带详情的步骤可展开查看。
本页内容
执行轨迹逐步展示智能体或任务做了什么,包括思考了什么、搜索了什么、读取了什么以及执行了什么。每个步骤占一行,样式低调,标记排成一列,由细线相连。带详情的步骤使用原生 <details>,激活该行即可展开详情,无需脚本。没有详情的步骤显示为普通行。
执行轨迹
<div class="card max-w(440) mx-auto"> <div class="trace"> <details class="trace-step"> <summary class="trace-summary"> <span class="trace-marker"></span>Thought about the migration<span class="trace-meta">8s</span><svg class="icon trace-chevron" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <path d="M6 3.5L10.3586 7.8586A0.2 0.2 0 0 1 10.3586 8.1414L6 12.5" transform="rotate(90 8 8)" /> </svg> </summary> <div class="trace-detail"> The table has two million rows, so the column is added as nullable first and filled in batches. </div> </details> <details class="trace-step" open> <summary class="trace-summary"> <span class="trace-marker"></span>Searched the codebase<span class="trace-meta">12 files</span><svg class="icon trace-chevron" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <path d="M6 3.5L10.3586 7.8586A0.2 0.2 0 0 1 10.3586 8.1414L6 12.5" transform="rotate(90 8 8)" /> </svg> </summary> <div class="trace-detail"> <code class="code">orders.status</code> is read in 12 files, 3 of them in the billing service. </div> </details> <div class="trace-step"> <p class="trace-summary"> <span class="trace-marker"></span>Read schema.prisma<span class="trace-meta">0.4s</span> </p> </div> <div class="trace-step" aria-busy="true"> <p class="trace-summary"><span class="trace-marker"></span>Writing the migration</p> </div> </div></div>import ChevronDownIcon from '@master/icons-react/native/16/soft/chevron-down'<div className="card max-w(440) mx-auto"> <div className="trace"> <details className="trace-step"> <summary className="trace-summary"> <span className="trace-marker"></span>Thought about the migration<span className="trace-meta">8s</span><ChevronDownIcon className="icon trace-chevron" /> </summary> <div className="trace-detail"> The table has two million rows, so the column is added as nullable first and filled in batches. </div> </details> <details className="trace-step" open> <summary className="trace-summary"> <span className="trace-marker"></span>Searched the codebase<span className="trace-meta">12 files</span><ChevronDownIcon className="icon trace-chevron" /> </summary> <div className="trace-detail"> <code className="code">orders.status</code> is read in 12 files, 3 of them in the billing service. </div> </details> <div className="trace-step"> <p className="trace-summary"> <span className="trace-marker"></span>Read schema.prisma<span className="trace-meta">0.4s</span> </p> </div> <div className="trace-step" aria-busy="true"> <p className="trace-summary"><span className="trace-marker"></span>Writing the migration</p> </div> </div></div><script> import ChevronDownIcon from '@master/icons-svelte/native/16/soft/chevron-down'</script><div class="card max-w(440) mx-auto"> <div class="trace"> <details class="trace-step"> <summary class="trace-summary"> <span class="trace-marker"></span>Thought about the migration<span class="trace-meta">8s</span><ChevronDownIcon class="icon trace-chevron" /> </summary> <div class="trace-detail"> The table has two million rows, so the column is added as nullable first and filled in batches. </div> </details> <details class="trace-step" open> <summary class="trace-summary"> <span class="trace-marker"></span>Searched the codebase<span class="trace-meta">12 files</span><ChevronDownIcon class="icon trace-chevron" /> </summary> <div class="trace-detail"> <code class="code">orders.status</code> is read in 12 files, 3 of them in the billing service. </div> </details> <div class="trace-step"> <p class="trace-summary"> <span class="trace-marker"></span>Read schema.prisma<span class="trace-meta">0.4s</span> </p> </div> <div class="trace-step" aria-busy="true"> <p class="trace-summary"><span class="trace-marker"></span>Writing the migration</p> </div> </div></div><script setup>import ChevronDownIcon from '@master/icons-vue/native/16/soft/chevron-down'</script><template> <div class="card max-w(440) mx-auto"> <div class="trace"> <details class="trace-step"> <summary class="trace-summary"> <span class="trace-marker"></span>Thought about the migration<span class="trace-meta">8s</span><ChevronDownIcon class="icon trace-chevron" /> </summary> <div class="trace-detail"> The table has two million rows, so the column is added as nullable first and filled in batches. </div> </details> <details class="trace-step" open> <summary class="trace-summary"> <span class="trace-marker"></span>Searched the codebase<span class="trace-meta">12 files</span><ChevronDownIcon class="icon trace-chevron" /> </summary> <div class="trace-detail"> <code class="code">orders.status</code> is read in 12 files, 3 of them in the billing service. </div> </details> <div class="trace-step"> <p class="trace-summary"> <span class="trace-marker"></span>Read schema.prisma<span class="trace-meta">0.4s</span> </p> </div> <div class="trace-step" aria-busy="true"> <p class="trace-summary"><span class="trace-marker"></span>Writing the migration</p> </div> </div> </div></template>#步骤
每个步骤由 trace-step 包裹 trace-summary。行内包含标记和文字,末尾可加上 trace-meta 显示数字信息,如耗时或找到的结果数量。
步骤有详情时,使用 <details>,把该行写在它的 <summary> 中,再用后面的 trace-detail 放置详情。样式表检测到详情后,会将该行设为展开和收起的控件。请在文字后放置一个 trace-chevron 图标,步骤展开时图标朝下。浏览器支持 ::details-content 的过渡时,详情会逐渐展开到自身高度,否则会立即展开。页内查找命中已折叠步骤中的内容时,会自动展开该步骤,这与任何 <details> 的行为一致。
#标记
空的 trace-marker 显示为小圆点。标记也可以包含图标来表示步骤类型,或在步骤运行时显示带有 spinner-inline 的加载指示器。
标记
<div class="card max-w(440) mx-auto"> <div class="trace"> <div class="trace-step"> <p class="trace-summary"> <span class="trace-marker"> <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <circle cx="7" cy="7" r="4.5" /><path d="M10.182 10.182L14 14" /> </svg> </span>Searched for "rate limit"<span class="trace-meta">4 results</span> </p> </div> <div class="trace-step"> <p class="trace-summary"> <span class="trace-marker"> <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <path d="M4.5 2L9.0858 2A1 1 0 0 1 9.7929 2.2929L12.2071 4.7071A1 1 0 0 1 12.5 5.4142L12.5 13A1 1 0 0 1 11.5 14L4.5 14A1 1 0 0 1 3.5 13L3.5 3A1 1 0 0 1 4.5 2Z" /><path d="M10 2.5V4.4A0.1 0.1 0 0 0 10.1 4.5H12L12.2409 4.7427A0.9993 0.9993 0 0 1 12.5 5.4142V5.5H10.1Q9.6444 5.5 9.3222 5.1778Q9 4.8556 9 4.4V2A1.1002 1.1002 0 0 1 9.3761 2.0431A1.0001 1.0001 0 0 1 9.7929 2.2929L10 2.5Z" fill="currentColor" stroke="none" fill-rule="evenodd" /> </svg> </span>Read limits.ts<span class="trace-meta">214 lines</span> </p> </div> <div class="trace-step"> <p class="trace-summary"> <span class="trace-marker"> <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <rect x="2" y="3" width="12" height="10" rx="1" /><path d="M4.5 6L6.3586 7.8586A0.2 0.2 0 0 1 6.3586 8.1414L4.5 10" /><path d="M9 10L11.5 10" /> </svg> </span>Ran the tests<span class="trace-meta">48 passed</span> </p> </div> <div class="trace-step" aria-busy="true"> <p class="trace-summary"> <span class="trace-marker"> <span class="spinner spinner-inline" aria-hidden="true"></span> </span>Writing the answer </p> </div> </div></div>import SearchIcon from '@master/icons-react/native/16/soft/search'import FileIcon from '@master/icons-react/native/16/soft/file'import TerminalIcon from '@master/icons-react/native/16/soft/terminal'<div className="card max-w(440) mx-auto"> <div className="trace"> <div className="trace-step"> <p className="trace-summary"> <span className="trace-marker"><SearchIcon className="icon" /></span>Searched for "rate limit"<span className="trace-meta">4 results</span> </p> </div> <div className="trace-step"> <p className="trace-summary"> <span className="trace-marker"><FileIcon className="icon" /></span>Read limits.ts<span className="trace-meta">214 lines</span> </p> </div> <div className="trace-step"> <p className="trace-summary"> <span className="trace-marker"><TerminalIcon className="icon" /></span>Ran the tests<span className="trace-meta">48 passed</span> </p> </div> <div className="trace-step" aria-busy="true"> <p className="trace-summary"> <span className="trace-marker"> <span className="spinner spinner-inline" aria-hidden="true"></span> </span>Writing the answer </p> </div> </div></div><script> import SearchIcon from '@master/icons-svelte/native/16/soft/search' import FileIcon from '@master/icons-svelte/native/16/soft/file' import TerminalIcon from '@master/icons-svelte/native/16/soft/terminal'</script><div class="card max-w(440) mx-auto"> <div class="trace"> <div class="trace-step"> <p class="trace-summary"> <span class="trace-marker"><SearchIcon class="icon" /></span>Searched for "rate limit"<span class="trace-meta">4 results</span> </p> </div> <div class="trace-step"> <p class="trace-summary"> <span class="trace-marker"><FileIcon class="icon" /></span>Read limits.ts<span class="trace-meta">214 lines</span> </p> </div> <div class="trace-step"> <p class="trace-summary"> <span class="trace-marker"><TerminalIcon class="icon" /></span>Ran the tests<span class="trace-meta">48 passed</span> </p> </div> <div class="trace-step" aria-busy="true"> <p class="trace-summary"> <span class="trace-marker"> <span class="spinner spinner-inline" aria-hidden="true"></span> </span>Writing the answer </p> </div> </div></div><script setup>import SearchIcon from '@master/icons-vue/native/16/soft/search'import FileIcon from '@master/icons-vue/native/16/soft/file'import TerminalIcon from '@master/icons-vue/native/16/soft/terminal'</script><template> <div class="card max-w(440) mx-auto"> <div class="trace"> <div class="trace-step"> <p class="trace-summary"> <span class="trace-marker"><SearchIcon class="icon" /></span>Searched for "rate limit"<span class="trace-meta">4 results</span> </p> </div> <div class="trace-step"> <p class="trace-summary"> <span class="trace-marker"><FileIcon class="icon" /></span>Read limits.ts<span class="trace-meta">214 lines</span> </p> </div> <div class="trace-step"> <p class="trace-summary"> <span class="trace-marker"><TerminalIcon class="icon" /></span>Ran the tests<span class="trace-meta">48 passed</span> </p> </div> <div class="trace-step" aria-busy="true"> <p class="trace-summary"> <span class="trace-marker"> <span class="spinner spinner-inline" aria-hidden="true"></span> </span>Writing the answer </p> </div> </div> </div></template>#运行中与失败
正在运行的步骤带有 aria-busy="true"。该行文字使用更深的墨色,仅显示为圆点的标记会向外扩散出一圈波纹。用户启用减少动态效果时,这一圈会显示为静止的光环。步骤结束时移除该属性。
失败的步骤使用 trace-failed,其标记和行末的数字信息使用危险状态色。ARIA 没有表示列表项失败的状态,因此这里使用类名。在该行或展开后的详情中用文字说明哪里失败了,让颜色之外也有明确的提示。
失败
<div class="card max-w(440) mx-auto"> <div class="trace"> <div class="trace-step"> <p class="trace-summary"> <span class="trace-marker"></span>Installed dependencies<span class="trace-meta">14s</span> </p> </div> <div class="trace-step"> <p class="trace-summary"> <span class="trace-marker"></span>Compiled 38 routes<span class="trace-meta">48s</span> </p> </div> <details class="trace-step trace-failed" open> <summary class="trace-summary"> <span class="trace-marker"></span>Ran the test suite<span class="trace-meta">2 failed</span><svg class="icon trace-chevron" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <path d="M6 3.5L10.3586 7.8586A0.2 0.2 0 0 1 10.3586 8.1414L6 12.5" transform="rotate(90 8 8)" /> </svg> </summary> <div class="trace-detail"> orders.spec.ts expected the status to be "paid" and received "pending", twice. </div> </details> </div></div>import ChevronDownIcon from '@master/icons-react/native/16/soft/chevron-down'<div className="card max-w(440) mx-auto"> <div className="trace"> <div className="trace-step"> <p className="trace-summary"> <span className="trace-marker"></span>Installed dependencies<span className="trace-meta">14s</span> </p> </div> <div className="trace-step"> <p className="trace-summary"> <span className="trace-marker"></span>Compiled 38 routes<span className="trace-meta">48s</span> </p> </div> <details className="trace-step trace-failed" open> <summary className="trace-summary"> <span className="trace-marker"></span>Ran the test suite<span className="trace-meta">2 failed</span><ChevronDownIcon className="icon trace-chevron" /> </summary> <div className="trace-detail"> orders.spec.ts expected the status to be "paid" and received "pending", twice. </div> </details> </div></div><script> import ChevronDownIcon from '@master/icons-svelte/native/16/soft/chevron-down'</script><div class="card max-w(440) mx-auto"> <div class="trace"> <div class="trace-step"> <p class="trace-summary"> <span class="trace-marker"></span>Installed dependencies<span class="trace-meta">14s</span> </p> </div> <div class="trace-step"> <p class="trace-summary"> <span class="trace-marker"></span>Compiled 38 routes<span class="trace-meta">48s</span> </p> </div> <details class="trace-step trace-failed" open> <summary class="trace-summary"> <span class="trace-marker"></span>Ran the test suite<span class="trace-meta">2 failed</span><ChevronDownIcon class="icon trace-chevron" /> </summary> <div class="trace-detail"> orders.spec.ts expected the status to be "paid" and received "pending", twice. </div> </details> </div></div><script setup>import ChevronDownIcon from '@master/icons-vue/native/16/soft/chevron-down'</script><template> <div class="card max-w(440) mx-auto"> <div class="trace"> <div class="trace-step"> <p class="trace-summary"> <span class="trace-marker"></span>Installed dependencies<span class="trace-meta">14s</span> </p> </div> <div class="trace-step"> <p class="trace-summary"> <span class="trace-marker"></span>Compiled 38 routes<span class="trace-meta">48s</span> </p> </div> <details class="trace-step trace-failed" open> <summary class="trace-summary"> <span class="trace-marker"></span>Ran the test suite<span class="trace-meta">2 failed</span><ChevronDownIcon class="icon trace-chevron" /> </summary> <div class="trace-detail"> orders.spec.ts expected the status to be "paid" and received "pending", twice. </div> </details> </div> </div></template>#单行
只有一个步骤的执行轨迹显示在助手的回答上方,用一行说明做了什么、花了多久,展开后可查看背后的推理。
单个步骤
<div class="trace max-w(440) mx-auto"> <details class="trace-step"> <summary class="trace-summary"> <span class="trace-marker"></span>Thought for 12 seconds<svg class="icon trace-chevron" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <path d="M6 3.5L10.3586 7.8586A0.2 0.2 0 0 1 10.3586 8.1414L6 12.5" transform="rotate(90 8 8)" /> </svg> </summary> <div class="trace-detail"> The question is about the fallback, not the feature, so the answer starts from a browser without anchor positioning. </div> </details></div>import ChevronDownIcon from '@master/icons-react/native/16/soft/chevron-down'<div className="trace max-w(440) mx-auto"> <details className="trace-step"> <summary className="trace-summary"> <span className="trace-marker"></span>Thought for 12 seconds<ChevronDownIcon className="icon trace-chevron" /> </summary> <div className="trace-detail"> The question is about the fallback, not the feature, so the answer starts from a browser without anchor positioning. </div> </details></div><script> import ChevronDownIcon from '@master/icons-svelte/native/16/soft/chevron-down'</script><div class="trace max-w(440) mx-auto"> <details class="trace-step"> <summary class="trace-summary"> <span class="trace-marker"></span>Thought for 12 seconds<ChevronDownIcon class="icon trace-chevron" /> </summary> <div class="trace-detail"> The question is about the fallback, not the feature, so the answer starts from a browser without anchor positioning. </div> </details></div><script setup>import ChevronDownIcon from '@master/icons-vue/native/16/soft/chevron-down'</script><template> <div class="trace max-w(440) mx-auto"> <details class="trace-step"> <summary class="trace-summary"> <span class="trace-marker"></span>Thought for 12 seconds<ChevronDownIcon class="icon trace-chevron" /> </summary> <div class="trace-detail"> The question is about the fallback, not the feature, so the answer starts from a browser without anchor positioning. </div> </details> </div></template>#执行轨迹、时间线或步骤条
执行轨迹展示工作过程。步骤可能正在运行,也可能已经失败,展开后可查看详情。时间线记录事件及其发生时间。步骤条呈现一组固定顺序的步骤,供用户依次完成。
#无障碍
- 可展开的步骤使用
<details>。浏览器为该行提供展开控件的角色、状态和键盘操作。 - 标记由样式表绘制,辅助技术不会播报它。标记中的图标仅用于装饰,请在该行用文字说明步骤内容。
- 如果执行轨迹在显示期间会继续添加步骤,请将它放在带有
aria-live="polite"的区域中,以便每个新步骤在加入时得到播报。运行中的步骤通过aria-busy同时向辅助技术和用户传达运行状态。 - 在触摸屏上,每行高 44px。
#类名
| 类名 | 说明 |
|---|---|
trace | 步骤纵向排列,标记之间用细线连接。 |
trace-step | 用于单个步骤。有详情时用 details 元素,否则用任意块级元素。 |
trace-failed | 步骤失败时,圆点或图标以及行尾的结果文字使用危险墨色与 trace-step 一同使用 |
trace-summary | 每个步骤行整体高 32px,包含标记、文字和行末的一项信息。用于 summary 时,整行可切换展开和收起,文字后显示折角图标。 |
trace-chevron | 有详情的步骤中文字之后的折角图标,步骤展开时朝下 |
trace-marker | 行首标记可用圆点(无内容时)或图标,步骤运行时可用 spinner-inline。 |
trace-meta | 在行末以等宽数字显示耗时、结果数量等信息。 |
trace-detail | 步骤详情位于步骤行下方,起始位置与该行文字对齐。 |
#自定义属性
| 属性 | 默认值 | 说明 |
|---|---|---|
--trace-marker | 1.25rem | 标记列的宽度 |