openclaw-openagent 1.0.8 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/src/app/remote-agent-tool.js +108 -10
  2. package/dist/src/auth/config.js +65 -10
  3. package/dist/src/channel.js +2 -1
  4. package/dist/src/plugin-ui/assets/bg.png +0 -0
  5. package/dist/src/plugin-ui/assets/icon.png +0 -0
  6. package/dist/src/plugin-ui/assets/openagent-override.js +1753 -774
  7. package/dist/src/plugin-ui/ui-extension-loader/registry-regex.js +53 -5
  8. package/dist/src/proxy/auth-proxy.d.ts +1 -0
  9. package/dist/src/proxy/auth-proxy.js +28 -9
  10. package/dist/src/transport/oasn/oasn-http.d.ts +12 -0
  11. package/dist/src/transport/oasn/oasn-http.js +45 -14
  12. package/dist/src/util/url-resolver.d.ts +6 -0
  13. package/dist/src/util/url-resolver.js +24 -8
  14. package/openclaw.plugin.json +16 -1
  15. package/package.json +3 -3
  16. package/src/app/remote-agent-tool.ts +126 -11
  17. package/src/auth/config.ts +79 -10
  18. package/src/channel.ts +2 -1
  19. package/src/plugin-ui/assets/bg.png +0 -0
  20. package/src/plugin-ui/assets/icon.png +0 -0
  21. package/src/plugin-ui/assets/openagent-override.js +1753 -774
  22. package/src/plugin-ui/build.cjs +80 -4
  23. package/src/plugin-ui/modules/agent-book/panel/agent-book.js +92 -9
  24. package/src/plugin-ui/modules/agent-book/panel/agent-card.js +26 -10
  25. package/src/plugin-ui/modules/agent-book/panel/agent-data.js +1 -1
  26. package/src/plugin-ui/modules/agent-book/panel/inject-ui.js +64 -0
  27. package/src/plugin-ui/modules/agent-book/panel/styles.js +313 -178
  28. package/src/plugin-ui/modules/loader/bootstrap.js +1 -1
  29. package/src/plugin-ui/modules/loader/shared-state.js +54 -0
  30. package/src/plugin-ui/modules/remote-agent/execution-card.js +347 -124
  31. package/src/plugin-ui/modules/remote-agent/media-links.js +151 -0
  32. package/src/plugin-ui/modules/remote-agent/output-card.js +110 -33
  33. package/src/plugin-ui/modules/remote-agent/render-hooks.js +97 -18
  34. package/src/plugin-ui/modules/remote-agent/styles.js +488 -402
  35. package/src/plugin-ui/modules/remote-agent/tool-card-model.js +6 -0
  36. package/src/plugin-ui/ui-extension-loader/registry-regex.ts +50 -5
  37. package/src/proxy/auth-proxy.ts +30 -10
  38. package/src/transport/oasn/oasn-http.ts +60 -14
  39. package/src/util/url-resolver.ts +24 -8
@@ -2,7 +2,7 @@
2
2
  * OpenAgent UI Override — Auto-generated, do not edit directly!
3
3
  *
4
4
  * Source: src/plugin-ui/modules/
5
- * Built: 2026-06-25T12:46:20.004Z
5
+ * Built: 2026-07-01T12:59:59.814Z
6
6
  *
7
7
  * To modify, edit the source modules and run:
8
8
  * npm run build:override
@@ -48,6 +48,9 @@ const CL = {
48
48
  handleDelegateWsEvent: function(msg) {},
49
49
  processCustomCards: function(bubble) {},
50
50
 
51
+ // ── Host 版本(构建时注入,fallback 运行时检测)──
52
+ hostVersion: '__OPENCLAW_HOST_VERSION__',
53
+
51
54
  // ── 配置 ──
52
55
  OPENAGENT_API: 'https://api.openagent.club',
53
56
  AUTH_API: '/plugins/openagent', // Proxied via Gateway registerHttpRoute (see src/proxy/auth-proxy.ts)
@@ -56,6 +59,57 @@ const CL = {
56
59
  CACHE_TTL: 30000,
57
60
  };
58
61
 
62
+ // ── 版本解析与比较(供 execution-card V2 分支使用)──
63
+
64
+ function _clParseHostVersion(v) {
65
+ if (!v) return [0, 0, 0];
66
+ var base = String(v).split('-')[0];
67
+ var parts = base.split('.');
68
+ if (parts.length !== 3) return [0, 0, 0];
69
+ var y = parseInt(parts[0], 10);
70
+ var m = parseInt(parts[1], 10);
71
+ var d = parseInt(parts[2], 10);
72
+ if (isNaN(y) || isNaN(m) || isNaN(d)) return [0, 0, 0];
73
+ return [y, m, d];
74
+ }
75
+
76
+ function _clIsHostVersionGte(minVer) {
77
+ var cur = _clParseHostVersion(CL.hostVersion || '');
78
+ var min = _clParseHostVersion(minVer);
79
+ for (var i = 0; i < 3; i++) {
80
+ if (cur[i] > min[i]) return true;
81
+ if (cur[i] < min[i]) return false;
82
+ }
83
+ return true;
84
+ }
85
+
86
+ // ─ 运行时 fallback:当构建时未注入版本,通过 CSS/DOM 特征检测 ──
87
+ // v5.x (2026.5+) 有 data-theme 属性和 --glass-surface CSS 变量
88
+ // v4.x (2026.3-4.x) 有 data-theme-mode 属性和 --vscode-* CSS 变量
89
+ if (CL.hostVersion === '__OPENCLAW_HOST_VERSION__' || !CL.hostVersion) {
90
+ try {
91
+ if (document.documentElement.hasAttribute('data-theme')) {
92
+ // v5.x (2026.5+) — 有 data-theme 属性
93
+ CL.hostVersion = '2026.6.9';
94
+ } else if (document.documentElement.hasAttribute('data-theme-mode')) {
95
+ // v4.x — 有 data-theme-mode 属性
96
+ CL.hostVersion = '2026.4.0';
97
+ } else {
98
+ var cs = getComputedStyle(document.documentElement);
99
+ if (cs.getPropertyValue('--glass-surface').trim()) {
100
+ CL.hostVersion = '2026.6.9';
101
+ } else if (cs.getPropertyValue('--vscode-editor-background').trim()) {
102
+ CL.hostVersion = '2026.4.0';
103
+ } else {
104
+ CL.hostVersion = '2026.3.0';
105
+ }
106
+ }
107
+ console.log('[cl-version] detected via DOM/CSS features: ' + CL.hostVersion);
108
+ } catch (e) {
109
+ CL.hostVersion = '2026.3.0';
110
+ }
111
+ }
112
+
59
113
  // 暴露到 window 供控制台调试/测试
60
114
  window.__CL = CL;
61
115
 
@@ -1405,7 +1459,7 @@ function avatarUrl(agent) {
1405
1459
  if (agent.avatar.startsWith('http')) return agent.avatar;
1406
1460
  return CL.AUTH_API + '/' + agent.avatar;
1407
1461
  }
1408
- return `https://ui-avatars.com/api/?name=${encodeURIComponent(agent.name)}&background=random&size=64`;
1462
+ return './icon.png';
1409
1463
  }
1410
1464
 
1411
1465
  const ESC_MAP = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' };
@@ -1478,17 +1532,23 @@ function AgentCard(agent, opts = {}) {
1478
1532
  info.appendChild(_text('div', 'agent-card__name', agent.name || ''));
1479
1533
  info.appendChild(_text('div', 'agent-card__bio', agent.bio || '暂无简介'));
1480
1534
  const stats = _el('div', 'agent-card__stats');
1481
- stats.appendChild(_text('span', 'agent-card__stat agent-card__stat--claws', `${formatNumber(agent.claws)}☆`));
1535
+ // 星标 + 数字 紧密组合(Figma gap 1.5px)
1536
+ const statGroup = _el('span', 'agent-card__stat-group');
1537
+ var starIcon = _el('span', 'agent-card__stat-icon');
1538
+ starIcon.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none"><path d="M5.94531 0.525391C6.08953 0.525551 6.20334 0.604267 6.25098 0.701172L7.59668 3.43262L7.71875 3.68066L7.99121 3.7207L11.0859 4.16992V4.1709H11.0869C11.1865 4.18536 11.2656 4.2375 11.3135 4.30371L11.3506 4.37402C11.3752 4.44422 11.3691 4.52183 11.3301 4.58984L11.2803 4.6543L9.01172 6.86914L8.81543 7.06152L8.86133 7.33301L9.3877 10.4043C9.40428 10.501 9.36472 10.6085 9.26172 10.6797C9.20158 10.7197 9.13 10.7412 9.05762 10.7412C9.00017 10.7412 8.94132 10.7275 8.8877 10.7002L6.18945 9.2793L5.94531 9.15039L5.7002 9.2793L3.00684 10.6982C2.95198 10.7266 2.89097 10.7412 2.83203 10.7412C2.77821 10.7412 2.72454 10.7298 2.67578 10.707L2.62891 10.6797C2.52556 10.6083 2.48649 10.5012 2.50293 10.4053V10.4043L3.0293 7.33301L3.0752 7.06152L2.87793 6.86914L0.611328 4.6543L0.610352 4.65332L0.560547 4.58984C0.521516 4.522 0.515166 4.44401 0.540039 4.37305L0.539062 4.37207C0.573747 4.27569 0.671018 4.18999 0.803711 4.1709L0.804688 4.16992L3.89844 3.7207L4.17188 3.68066L4.29395 3.43262L5.63867 0.702148C5.68788 0.603278 5.80274 0.525391 5.94531 0.525391Z" stroke="#666666" stroke-width="1.05"/></svg>';
1539
+ statGroup.appendChild(starIcon);
1540
+ statGroup.appendChild(_text('span', 'agent-card__stat agent-card__stat--claws', formatNumber(agent.claws)));
1541
+ stats.appendChild(statGroup);
1482
1542
  if (agent.owner) {
1483
- stats.appendChild(_text('span', 'agent-card__stat agent-card__stat--owner', ` · owner${agent.owner}`));
1543
+ stats.appendChild(_text('span', 'agent-card__stat agent-card__stat--owner', ` · ${agent.owner}`));
1484
1544
  }
1485
1545
  info.appendChild(stats);
1486
1546
  contentGroup.appendChild(info);
1487
1547
 
1488
1548
  row1.appendChild(contentGroup);
1489
1549
 
1490
- // @Try 按钮
1491
- const defaultLabel = 'Try';
1550
+ // @召唤 按钮
1551
+ const defaultLabel = '@召唤';
1492
1552
  const btn = _text('button', 'agent-card__action', actionLabel || defaultLabel);
1493
1553
  if (onAction) {
1494
1554
  btn.addEventListener('click', (e) => {
@@ -1524,14 +1584,19 @@ function AgentCard(agent, opts = {}) {
1524
1584
  body.appendChild(_text('div', 'agent-card__bio', agent.bio || '暂无简介'));
1525
1585
 
1526
1586
  const stats = _el('div', 'agent-card__stats');
1527
- stats.appendChild(_text('span', 'agent-card__stat agent-card__stat--claws', `${formatNumber(agent.claws)}☆`));
1587
+ const statGroup = _el('span', 'agent-card__stat-group');
1588
+ var starIcon = _el('span', 'agent-card__stat-icon');
1589
+ starIcon.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none"><path d="M5.94531 0.525391C6.08953 0.525551 6.20334 0.604267 6.25098 0.701172L7.59668 3.43262L7.71875 3.68066L7.99121 3.7207L11.0859 4.16992V4.1709H11.0869C11.1865 4.18536 11.2656 4.2375 11.3135 4.30371L11.3506 4.37402C11.3752 4.44422 11.3691 4.52183 11.3301 4.58984L11.2803 4.6543L9.01172 6.86914L8.81543 7.06152L8.86133 7.33301L9.3877 10.4043C9.40428 10.501 9.36472 10.6085 9.26172 10.6797C9.20158 10.7197 9.13 10.7412 9.05762 10.7412C9.00017 10.7412 8.94132 10.7275 8.8877 10.7002L6.18945 9.2793L5.94531 9.15039L5.7002 9.2793L3.00684 10.6982C2.95198 10.7266 2.89097 10.7412 2.83203 10.7412C2.77821 10.7412 2.72454 10.7298 2.67578 10.707L2.62891 10.6797C2.52556 10.6083 2.48649 10.5012 2.50293 10.4053V10.4043L3.0293 7.33301L3.0752 7.06152L2.87793 6.86914L0.611328 4.6543L0.610352 4.65332L0.560547 4.58984C0.521516 4.522 0.515166 4.44401 0.540039 4.37305L0.539062 4.37207C0.573747 4.27569 0.671018 4.18999 0.803711 4.1709L0.804688 4.16992L3.89844 3.7207L4.17188 3.68066L4.29395 3.43262L5.63867 0.702148C5.68788 0.603278 5.80274 0.525391 5.94531 0.525391Z" stroke="#666666" stroke-width="1.05"/></svg>';
1590
+ statGroup.appendChild(starIcon);
1591
+ statGroup.appendChild(_text('span', 'agent-card__stat agent-card__stat--claws', formatNumber(agent.claws)));
1592
+ stats.appendChild(statGroup);
1528
1593
  if (agent.owner) {
1529
- stats.appendChild(_text('span', 'agent-card__stat agent-card__stat--owner', ` · owner${agent.owner}`));
1594
+ stats.appendChild(_text('span', 'agent-card__stat agent-card__stat--owner', ` · ${agent.owner}`));
1530
1595
  }
1531
1596
  body.appendChild(stats);
1532
1597
  card.appendChild(body);
1533
1598
 
1534
- const btn = _text('button', 'agent-card__action', actionLabel || 'Try');
1599
+ const btn = _text('button', 'agent-card__action', actionLabel || '@召唤');
1535
1600
  if (onAction) {
1536
1601
  btn.addEventListener('click', (e) => {
1537
1602
  e.stopPropagation();
@@ -1568,14 +1633,19 @@ function AgentCard(agent, opts = {}) {
1568
1633
  body.appendChild(_text('div', 'agent-card__bio', agent.bio || '暂无简介'));
1569
1634
 
1570
1635
  const stats = _el('div', 'agent-card__stats');
1571
- stats.appendChild(_text('span', 'agent-card__stat agent-card__stat--claws', `${formatNumber(agent.claws)}☆`));
1636
+ const statGroup = _el('span', 'agent-card__stat-group');
1637
+ var starIcon = _el('span', 'agent-card__stat-icon');
1638
+ starIcon.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none"><path d="M5.94531 0.525391C6.08953 0.525551 6.20334 0.604267 6.25098 0.701172L7.59668 3.43262L7.71875 3.68066L7.99121 3.7207L11.0859 4.16992V4.1709H11.0869C11.1865 4.18536 11.2656 4.2375 11.3135 4.30371L11.3506 4.37402C11.3752 4.44422 11.3691 4.52183 11.3301 4.58984L11.2803 4.6543L9.01172 6.86914L8.81543 7.06152L8.86133 7.33301L9.3877 10.4043C9.40428 10.501 9.36472 10.6085 9.26172 10.6797C9.20158 10.7197 9.13 10.7412 9.05762 10.7412C9.00017 10.7412 8.94132 10.7275 8.8877 10.7002L6.18945 9.2793L5.94531 9.15039L5.7002 9.2793L3.00684 10.6982C2.95198 10.7266 2.89097 10.7412 2.83203 10.7412C2.77821 10.7412 2.72454 10.7298 2.67578 10.707L2.62891 10.6797C2.52556 10.6083 2.48649 10.5012 2.50293 10.4053V10.4043L3.0293 7.33301L3.0752 7.06152L2.87793 6.86914L0.611328 4.6543L0.610352 4.65332L0.560547 4.58984C0.521516 4.522 0.515166 4.44401 0.540039 4.37305L0.539062 4.37207C0.573747 4.27569 0.671018 4.18999 0.803711 4.1709L0.804688 4.16992L3.89844 3.7207L4.17188 3.68066L4.29395 3.43262L5.63867 0.702148C5.68788 0.603278 5.80274 0.525391 5.94531 0.525391Z" stroke="#666666" stroke-width="1.05"/></svg>';
1639
+ statGroup.appendChild(starIcon);
1640
+ statGroup.appendChild(_text('span', 'agent-card__stat agent-card__stat--claws', formatNumber(agent.claws)));
1641
+ stats.appendChild(statGroup);
1572
1642
  if (agent.owner) {
1573
- stats.appendChild(_text('span', 'agent-card__stat agent-card__stat--owner', ` · owner${agent.owner}`));
1643
+ stats.appendChild(_text('span', 'agent-card__stat agent-card__stat--owner', ` · ${agent.owner}`));
1574
1644
  }
1575
1645
  body.appendChild(stats);
1576
1646
  card.appendChild(body);
1577
1647
 
1578
- const btn = _text('button', 'agent-card__action', actionLabel || '@ Chat');
1648
+ const btn = _text('button', 'agent-card__action', actionLabel || '@召唤');
1579
1649
  if (onAction) {
1580
1650
  btn.addEventListener('click', (e) => { e.stopPropagation(); onAction(agent); });
1581
1651
  card.addEventListener('click', (e) => { e.stopPropagation(); onAction(agent); });
@@ -1700,80 +1770,39 @@ function injectStyles() {
1700
1770
  border-color: #3b82f6;
1701
1771
  }
1702
1772
 
1703
- /* ── @ Agent Book 按钮(Figma 1:1117 物理级复刻Mesh Gradient) ── */
1773
+ /* ── @ Agent Book 按钮(Figma 129:955 Frame 72552 紫色渐变) ── */
1704
1774
  .openagent-at-btn {
1705
1775
  position: relative;
1706
- overflow: hidden; /* Figma clipsContent: true */
1776
+ overflow: hidden;
1707
1777
  display: inline-flex;
1708
1778
  align-items: center;
1709
1779
  justify-content: center;
1710
1780
  gap: 4px;
1711
- height: 26px;
1712
- padding: 0 16px;
1713
- border-radius: 100px;
1781
+ height: 27px;
1782
+ padding: 0 12px;
1783
+ border-radius: 150px;
1714
1784
  border: none;
1715
- background: #6ECCFF; /* Figma Frame 72552 底色 */
1716
- box-shadow: inset 0 0 8.5px 0 #96ECFF; /* Figma INNER_SHADOW */
1785
+ background: linear-gradient(90deg, #5c4aff 0%, #8274ff 100%);
1717
1786
  color: #fff;
1718
- font-size: 13px;
1719
- font-weight: 600;
1787
+ font-size: 12px;
1788
+ font-weight: 500;
1720
1789
  cursor: pointer;
1721
1790
  transition: all 0.2s ease;
1722
- line-height: 26px;
1791
+ line-height: 27px;
1723
1792
  margin-left: 6px;
1724
1793
  white-space: nowrap;
1725
1794
  flex-shrink: 0;
1726
1795
  letter-spacing: 0.2px;
1727
- /* 建立层叠上下文,让伪元素在底层 */
1728
- z-index: 1;
1729
- isolation: isolate;
1730
- }
1731
-
1732
- /* Figma 外层 Ellipse 12873:蓝色椭圆,偏左 */
1733
- .openagent-at-btn::before {
1734
- content: '';
1735
- position: absolute;
1736
- left: -13%;
1737
- top: -98%;
1738
- width: 50%;
1739
- height: 304%;
1740
- background: #7A94FF;
1741
- filter: blur(23px); /* Figma LAYER_BLUR: 23.2px */
1742
- transform: rotate(174deg);
1743
- z-index: -1;
1744
- pointer-events: none;
1745
- }
1746
-
1747
- /* Figma 外层 Ellipse 12872:黄绿色椭圆,偏右 */
1748
- .openagent-at-btn::after {
1749
- content: '';
1750
- position: absolute;
1751
- left: 70%;
1752
- top: -49%;
1753
- width: 54%;
1754
- height: 145%;
1755
- background: #A1FF2E;
1756
- filter: blur(30.5px); /* Figma LAYER_BLUR: 30.5px */
1757
- transform: rotate(27deg);
1758
- z-index: -1;
1759
- pointer-events: none;
1760
- }
1761
-
1762
- /* 确保文字始终在最高层 */
1763
- .openagent-at-btn .at-sym,
1764
- .openagent-at-btn span {
1765
- position: relative;
1766
- z-index: 2;
1796
+ font-family: "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
1767
1797
  }
1768
1798
 
1769
1799
  .openagent-at-btn:hover {
1770
- filter: brightness(1.08);
1771
1800
  transform: translateY(-1px);
1772
- box-shadow: inset 0 0 8.5px 0 #96ECFF, 0 2px 8px rgba(110, 204, 255, 0.4);
1801
+ box-shadow: inset 0 0 6px 1px rgba(255, 255, 255, 0.65);
1773
1802
  }
1774
1803
  .openagent-at-btn .at-sym {
1775
- font-size: 14px;
1776
- font-weight: 700;
1804
+ font-size: 11.6px;
1805
+ font-weight: 500;
1777
1806
  color: #fff;
1778
1807
  }
1779
1808
 
@@ -1796,8 +1825,8 @@ function injectStyles() {
1796
1825
  position: fixed;
1797
1826
  max-height: none;
1798
1827
  background: var(--oa-panel-bg, #fff);
1799
- border: 1.2px solid var(--oa-border, rgba(47, 47, 51, 0.12));
1800
- border-radius: 18px;
1828
+ border: 0.5px solid #dbdbdb;
1829
+ border-radius: 16px;
1801
1830
  box-shadow: 0 -4px 24px var(--oa-shadow-color, rgba(0,0,0,0.08)), 0 2px 8px var(--oa-shadow-color, rgba(0,0,0,0.04));
1802
1831
  z-index: 99999;
1803
1832
  overflow: hidden;
@@ -1842,9 +1871,8 @@ function injectStyles() {
1842
1871
  flex-shrink: 0;
1843
1872
  }
1844
1873
  .openagent-panel-close {
1845
- background: var(--oa-card-bg, rgba(249, 249, 249, 1));
1874
+ background: transparent;
1846
1875
  border: none;
1847
- color: rgba(47, 47, 51, 0.6);
1848
1876
  cursor: pointer;
1849
1877
  width: 21px;
1850
1878
  height: 21px;
@@ -1860,7 +1888,6 @@ function injectStyles() {
1860
1888
  }
1861
1889
  .openagent-panel-close:hover {
1862
1890
  background: #eee;
1863
- color: rgba(47, 47, 51, 1);
1864
1891
  }
1865
1892
 
1866
1893
  /* ── 分隔线(Figma: 0.2px, opacity 0.16) ── */
@@ -1871,6 +1898,174 @@ function injectStyles() {
1871
1898
  margin: 0;
1872
1899
  }
1873
1900
 
1901
+ /* ── 提示栏(Figma 141:3293,页面加载即显示) ── */
1902
+ .openagent-hint-bar {
1903
+ display: flex;
1904
+ align-items: center;
1905
+ justify-content: space-between;
1906
+ padding: 12px 12px;
1907
+ margin-bottom: 12px;
1908
+ background: #fff;
1909
+ border: 1.2px solid rgba(47, 47, 51, 0.1);
1910
+ border-radius: var(--radius-lg, 18px);
1911
+ gap: 12px;
1912
+ width: 100%;
1913
+ box-sizing: border-box;
1914
+ margin:0 auto;
1915
+ margin-bottom: 12px;
1916
+ }
1917
+ .openagent-hint-bar__content {
1918
+ display: flex;
1919
+ align-items: center;
1920
+ gap: 9px;
1921
+ flex: 1;
1922
+ min-width: 0;
1923
+ }
1924
+ .openagent-hint-bar__icon {
1925
+ display: flex;
1926
+ align-items: center;
1927
+ justify-content: center;
1928
+ width: 27px;
1929
+ height: 27px;
1930
+ border-radius: 6px;
1931
+ background: linear-gradient(135deg, rgba(130,116,255,0.1) 0%, rgba(56,144,255,0.1) 100%);
1932
+ flex-shrink: 0;
1933
+ }
1934
+ .openagent-hint-bar__text {
1935
+ font-family: "PingFang SC", sans-serif;
1936
+ font-size: 15px;
1937
+ font-weight: 400;
1938
+ color: rgba(51, 51, 51, 0.8);
1939
+ white-space: nowrap;
1940
+ overflow: hidden;
1941
+ text-overflow: ellipsis;
1942
+ }
1943
+ .openagent-hint-bar__close {
1944
+ display: flex;
1945
+ align-items: center;
1946
+ justify-content: center;
1947
+ width: 21px;
1948
+ height: 21px;
1949
+ padding: 0;
1950
+ border: none;
1951
+ background: transparent;
1952
+ cursor: pointer;
1953
+ flex-shrink: 0;
1954
+ border-radius: 4px;
1955
+ transition: all 0.1s;
1956
+ }
1957
+ .openagent-hint-bar__close:hover {
1958
+ background: #eee;
1959
+ }
1960
+
1961
+ /* 暗色主题 */
1962
+ [data-theme-mode="dark"] .openagent-hint-bar,
1963
+ [data-theme="dark"] .openagent-hint-bar {
1964
+ background: #1c1c1c;
1965
+ border-color: rgba(255,255,255,0.1);
1966
+ }
1967
+ [data-theme-mode="dark"] .openagent-hint-bar__text,
1968
+ [data-theme="dark"] .openagent-hint-bar__text {
1969
+ color: rgba(224, 224, 224, 0.8);
1970
+ }
1971
+ [data-theme-mode="dark"] .openagent-hint-bar__close,
1972
+ [data-theme="dark"] .openagent-hint-bar__close {
1973
+ }
1974
+ [data-theme-mode="dark"] .openagent-hint-bar__close:hover,
1975
+ [data-theme="dark"] .openagent-hint-bar__close:hover {
1976
+ background: #333;
1977
+ }
1978
+
1979
+ /* ── 空状态独立浮层(Figma 144:3444) ── */
1980
+ .openagent-empty-toast {
1981
+ display: flex;
1982
+ align-items: center;
1983
+ gap: 9px;
1984
+ padding: 18px;
1985
+ background: #fff;
1986
+ border: 1.2px solid rgba(47, 47, 51, 0.1);
1987
+ border-radius: 18px;
1988
+ box-sizing: border-box;
1989
+ animation: openagent-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
1990
+ box-shadow: 0 -4px 24px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
1991
+ }
1992
+ [data-theme-mode="dark"] .openagent-empty-toast,
1993
+ [data-theme="dark"] .openagent-empty-toast {
1994
+ background: #1c1c1c; border-color: rgba(255,255,255,0.1);
1995
+ box-shadow: 0 -4px 24px rgba(0,0,0,0.3);
1996
+ }
1997
+ [data-theme-mode="dark"] .openagent-empty-toast .openagent-empty-state__text,
1998
+ [data-theme="dark"] .openagent-empty-toast .openagent-empty-state__text {
1999
+ color: rgba(224, 224, 224, 0.8);
2000
+ }
2001
+ [data-theme-mode="dark"] .openagent-empty-toast .openagent-empty-state__close,
2002
+ [data-theme="dark"] .openagent-empty-toast .openagent-empty-state__close {
2003
+ }
2004
+
2005
+ /* ── 空状态(Figma 144:3444)— 无匹配结果 ── */
2006
+ .openagent-empty-state {
2007
+ padding: 18px;
2008
+ background: #fff;
2009
+ border: 1.2px solid rgba(47, 47, 51, 0.1);
2010
+ border-radius: 18px;
2011
+ }
2012
+ .openagent-empty-state__row {
2013
+ display: flex;
2014
+ align-items: flex-start;
2015
+ justify-content: space-between;
2016
+ gap: 9px;
2017
+ }
2018
+ .openagent-empty-state__icon {
2019
+ display: flex;
2020
+ align-items: center;
2021
+ justify-content: center;
2022
+ width: 27px;
2023
+ height: 27px;
2024
+ border-radius: 6px;
2025
+ background: linear-gradient(135deg, rgba(92,74,255,0.1) 0%, rgba(130,116,255,0.1) 100%);
2026
+ flex-shrink: 0;
2027
+ }
2028
+ .openagent-empty-state__text {
2029
+ flex: 1;
2030
+ font-family: "PingFang SC", sans-serif;
2031
+ font-size: 15px;
2032
+ font-weight: 400;
2033
+ color: rgba(51, 51, 51, 0.8);
2034
+ line-height: 1.5;
2035
+ }
2036
+ .openagent-empty-state__close {
2037
+ display: flex;
2038
+ align-items: center;
2039
+ justify-content: center;
2040
+ width: 21px;
2041
+ height: 21px;
2042
+ padding: 0;
2043
+ border: none;
2044
+ background: transparent;
2045
+ cursor: pointer;
2046
+ flex-shrink: 0;
2047
+ border-radius: 4px;
2048
+ }
2049
+ .openagent-empty-state__close:hover {
2050
+ background: #eee;
2051
+ }
2052
+ [data-theme-mode="dark"] .openagent-empty-state,
2053
+ [data-theme="dark"] .openagent-empty-state {
2054
+ background: #1c1c1c;
2055
+ border-color: rgba(255,255,255,0.1);
2056
+ }
2057
+ [data-theme-mode="dark"] .openagent-empty-state__text,
2058
+ [data-theme="dark"] .openagent-empty-state__text {
2059
+ color: rgba(224, 224, 224, 0.8);
2060
+ }
2061
+ [data-theme-mode="dark"] .openagent-empty-state__close,
2062
+ [data-theme="dark"] .openagent-empty-state__close {
2063
+ }
2064
+ [data-theme-mode="dark"] .openagent-empty-state__close:hover,
2065
+ [data-theme="dark"] .openagent-empty-state__close:hover {
2066
+ background: #333;
2067
+ }
2068
+
1874
2069
  /* ── Agent 列表(section stack) ── */
1875
2070
  .openagent-agent-list {
1876
2071
  overflow-y: auto;
@@ -1926,9 +2121,9 @@ function injectStyles() {
1926
2121
 
1927
2122
  /* ── 分组标题 ── */
1928
2123
  .openagent-section-heading {
1929
- font-size: 14px;
2124
+ font-size: 16px;
1930
2125
  font-weight: 400;
1931
- line-height: 14px;
2126
+ line-height: 16px;
1932
2127
  color: rgba(47, 47, 51, 0.80);
1933
2128
  padding: 0 12px 0 12px;
1934
2129
  letter-spacing: 0;
@@ -1999,6 +2194,23 @@ function injectStyles() {
1999
2194
  gap: 0;
2000
2195
  flex-wrap: wrap;
2001
2196
  }
2197
+ /* 星标+数字 紧密组合(Figma gap 1.5px) */
2198
+ .agent-card__stat-group {
2199
+ display: flex;
2200
+ align-items: center;
2201
+ gap: 1.5px;
2202
+ }
2203
+ .agent-card__stat-icon {
2204
+ display: inline-flex;
2205
+ align-items: center;
2206
+ justify-content: center;
2207
+ width: 12px;
2208
+ height: 12px;
2209
+ font-size: 14px;
2210
+ line-height: 1;
2211
+ color: #666;
2212
+ flex-shrink: 0;
2213
+ }
2002
2214
  .agent-card__stat {
2003
2215
  font-family: "PingFang SC", sans-serif;
2004
2216
  font-size: 13.5px;
@@ -2024,96 +2236,80 @@ function injectStyles() {
2024
2236
  white-space: nowrap;
2025
2237
  }
2026
2238
 
2027
- /* ── mode: mention(Figma Agent item avart 实例) ── */
2239
+ /* ── mode: mention(Figma Agent 卡片 142:3392) ── */
2028
2240
  .agent-card--mention {
2029
2241
  flex-direction: row;
2030
- align-items: stretch;
2031
- gap: 0;
2032
- padding: 0;
2033
- border-radius: 8px;
2034
- border: none;
2035
- background: transparent;
2036
- min-height: 88px;
2242
+ align-items: center;
2243
+ gap: 10px;
2244
+ padding: 15px;
2245
+ border-radius: 20px;
2246
+ border: 0.5px solid #dbdbdb;
2247
+ background: #fff;
2248
+ min-height: 0;
2037
2249
  min-width: 0;
2250
+ box-sizing: border-box;
2038
2251
  }
2039
2252
  .agent-card--mention:hover {
2040
2253
  background: rgba(0, 0, 0, 0.02);
2041
2254
  }
2042
- /* 键盘导航高亮(§1.5)— 对标 TIM index.vue:32 'selected' class */
2043
- .agent-card--mention.openagent-card-selected {
2044
- background: rgba(99, 102, 241, 0.06);
2045
- outline: 2px solid rgba(99, 102, 241, 0.3);
2046
- outline-offset: -2px;
2047
- }
2048
- [data-theme-mode="dark"] .agent-card--mention.openagent-card-selected {
2049
- background: rgba(99, 102, 241, 0.12);
2050
- outline-color: rgba(99, 102, 241, 0.4);
2051
- }
2052
-
2053
- /* avart 外壳: Figma px 12, centered */
2255
+ /* avart 外壳简化 不再需要 */
2054
2256
  .agent-card--mention .agent-card__avart {
2055
- display: flex;
2056
- flex-direction: column;
2057
- justify-content: center;
2058
- gap: 0;
2059
- padding: 0 10px;
2060
- flex: 1;
2257
+ display: contents;
2258
+ padding: 0;
2259
+ flex: none;
2061
2260
  min-width: 0;
2062
- box-sizing: border-box;
2063
2261
  }
2064
2262
 
2065
- /* 第一行: row, gap:24 (内容组 + @Try) */
2263
+ /* 第一行: 内容区 + 按钮 */
2066
2264
  .agent-card--mention .agent-card__row1 {
2067
- display: flex;
2068
- flex-direction: row;
2069
- align-items: center;
2070
- gap: 16px;
2071
- width: 100%;
2265
+ display: contents;
2266
+ gap: 0;
2267
+ width: auto;
2072
2268
  min-width: 0;
2073
2269
  }
2074
2270
 
2075
- /* 内容组: row, gap:18 (头像 + 信息列) */
2271
+ /* 内容组: 头像 + 信息列 */
2076
2272
  .agent-card--mention .agent-card__content-group {
2077
2273
  display: flex;
2078
2274
  flex-direction: row;
2079
- align-items: flex-start;
2080
- gap: 12px;
2275
+ align-items: center;
2276
+ gap: 10px;
2081
2277
  flex: 1;
2082
2278
  min-width: 0;
2083
2279
  }
2084
2280
 
2085
- /* 头像 */
2281
+ /* 头像: 50×50 */
2086
2282
  .agent-card--mention .agent-card__avatar {
2087
- width: 48px;
2088
- height: 48px;
2283
+ width: 50px;
2284
+ height: 50px;
2089
2285
  border-radius: 50%;
2090
2286
  border: none;
2091
2287
  flex-shrink: 0;
2092
2288
  margin-top: 0;
2093
2289
  }
2094
2290
 
2095
- /* 信息列: name / bio / stats */
2291
+ /* 信息列 */
2096
2292
  .agent-card--mention .agent-card__info {
2097
2293
  display: flex;
2098
2294
  flex-direction: column;
2099
- gap: 4px;
2100
- padding: 3px 0;
2295
+ gap: 6px;
2296
+ padding: 0;
2101
2297
  flex: 1;
2102
2298
  min-width: 0;
2103
2299
  }
2104
2300
 
2105
2301
  .agent-card--mention .agent-card__name {
2106
- font-size: 12px;
2302
+ font-size: 15px;
2107
2303
  font-weight: 600;
2108
- line-height: 14px;
2109
- color: rgba(47, 47, 51, 1);
2304
+ line-height: 1;
2305
+ color: #333;
2306
+ width:200px;
2110
2307
  }
2111
2308
  .agent-card--mention .agent-card__bio {
2112
- font-size: 10px;
2309
+ font-size: 14px;
2113
2310
  font-weight: 400;
2114
- line-height: 14px;
2115
- color: rgba(47, 47, 51, 0.40);
2116
- text-align: justify;
2311
+ line-height: 1.5;
2312
+ color: rgba(47, 47, 51, 0.80);
2117
2313
  overflow: hidden;
2118
2314
  text-overflow: ellipsis;
2119
2315
  display: -webkit-box;
@@ -2122,37 +2318,31 @@ function injectStyles() {
2122
2318
  margin-top: 0;
2123
2319
  }
2124
2320
 
2125
- /* @Try 按钮 */
2321
+ /* @召唤 按钮 */
2126
2322
  .agent-card--mention .agent-card__action {
2127
- width: 64px;
2128
- height: 30px;
2129
- padding: 0 14px;
2130
- border-radius: 10px;
2131
- background: #EFF0F2;
2132
- border: 1.286px solid rgba(47, 47, 51, 0.04);
2133
- color: rgba(47, 47, 51, 1);
2323
+ height: 36px;
2324
+ padding: 0 18px;
2325
+ border-radius: 23px;
2326
+ background: transparent;
2327
+ border: 0.5px solid #dbdbdb;
2328
+ color: #333;
2134
2329
  font-family: "PingFang SC", sans-serif;
2135
- font-size: 12px;
2330
+ font-size: 16px;
2136
2331
  font-weight: 500;
2137
- line-height: 12px;
2332
+ line-height: 15.43px;
2138
2333
  text-transform: capitalize;
2139
2334
  flex-shrink: 0;
2140
2335
  display: inline-flex;
2141
2336
  align-items: center;
2142
2337
  justify-content: center;
2338
+ width: auto;
2143
2339
  }
2144
- .agent-card--mention .agent-card__action::before { content: '@'; font-weight: 600; }
2340
+ .agent-card--mention .agent-card__action::before { content: none; }
2145
2341
  .agent-card--mention .agent-card__action:hover {
2146
- background: #e2e3e5;
2342
+ background: rgba(0, 0, 0, 0.04);
2147
2343
  }
2148
2344
 
2149
- /* Legacy row2 kept for older generated DOM, but current mention card keeps stats in info. */
2150
- .agent-card--mention .agent-card__row2 {
2151
- display: none;
2152
- flex-direction: row;
2153
- align-items: center;
2154
- padding-left: 60px;
2155
- }
2345
+ /* 统计行 */
2156
2346
  .agent-card--mention .agent-card__stats {
2157
2347
  display: flex;
2158
2348
  align-items: center;
@@ -2160,16 +2350,21 @@ function injectStyles() {
2160
2350
  margin-top: 0;
2161
2351
  }
2162
2352
  .agent-card--mention .agent-card__stat--claws {
2163
- color: rgba(240, 152, 0, 1);
2164
- font-size: 10px;
2165
- line-height: 12px;
2166
- letter-spacing: 1px;
2353
+ color: #666;
2354
+ font-size: 14px;
2355
+ line-height: 1;
2356
+ letter-spacing: 1.5px;
2167
2357
  }
2168
2358
  .agent-card--mention .agent-card__stat--owner {
2169
- color: rgba(47, 47, 51, 1);
2170
- font-size: 10px;
2171
- line-height: 12px;
2172
- letter-spacing: 1px;
2359
+ color: #666;
2360
+ font-size: 14px;
2361
+ line-height: 1;
2362
+ letter-spacing: 1.5px;
2363
+ }
2364
+
2365
+ /* row2 (legacy compat) */
2366
+ .agent-card--mention .agent-card__row2 {
2367
+ display: none;
2173
2368
  }
2174
2369
 
2175
2370
  /* ── mode: search(有输入搜索结果,沿用旧式单列行) ── */
@@ -2179,18 +2374,14 @@ function injectStyles() {
2179
2374
  width: 100%;
2180
2375
  min-height: 64px;
2181
2376
  padding: 10px 12px;
2182
- border-radius: 10px;
2377
+ border-radius: 20px;
2183
2378
  background: transparent;
2379
+ border: 0.5px solid transparent;
2184
2380
  box-sizing: border-box;
2185
2381
  }
2186
2382
  .agent-card--search:hover {
2187
2383
  background: rgba(0, 0, 0, 0.02);
2188
2384
  }
2189
- .agent-card--search.openagent-card-selected {
2190
- background: rgba(99, 102, 241, 0.06);
2191
- outline: 2px solid rgba(99, 102, 241, 0.3);
2192
- outline-offset: -2px;
2193
- }
2194
2385
  .agent-card--search .agent-card__avatar {
2195
2386
  width: 40px;
2196
2387
  height: 40px;
@@ -2204,48 +2395,50 @@ function injectStyles() {
2204
2395
  min-width: 0;
2205
2396
  }
2206
2397
  .agent-card--search .agent-card__name {
2207
- font-size: 13px;
2398
+ font-size: 15px;
2208
2399
  line-height: 16px;
2209
2400
  font-weight: 600;
2210
- color: rgba(47, 47, 51, 1);
2401
+ color: #333;
2211
2402
  }
2212
2403
  .agent-card--search .agent-card__bio {
2213
- font-size: 11px;
2214
- line-height: 15px;
2215
- color: rgba(47, 47, 51, 0.45);
2404
+ font-size: 14px;
2405
+ line-height: 1.5;
2406
+ color: rgba(47, 47, 51, 0.80);
2216
2407
  -webkit-line-clamp: 1;
2217
2408
  }
2218
2409
  .agent-card--search .agent-card__stats {
2219
2410
  margin-top: 0;
2220
2411
  }
2221
2412
  .agent-card--search .agent-card__stat--claws {
2222
- font-size: 11px;
2223
- line-height: 13px;
2224
- color: rgba(240, 152, 0, 1);
2413
+ font-size: 14px;
2414
+ line-height: 1;
2415
+ color: #666;
2416
+ letter-spacing: 1.5px;
2225
2417
  }
2226
2418
  .agent-card--search .agent-card__stat--owner {
2227
- font-size: 11px;
2228
- line-height: 13px;
2229
- color: rgba(47, 47, 51, 0.65);
2419
+ font-size: 14px;
2420
+ line-height: 1;
2421
+ color: #666;
2422
+ letter-spacing: 1.5px;
2230
2423
  }
2231
2424
  .agent-card--search .agent-card__action {
2232
- width: 60px;
2233
- height: 28px;
2234
- padding: 0 12px;
2235
- border-radius: 10px;
2236
- background: #EFF0F2;
2237
- border: 1px solid rgba(47, 47, 51, 0.04);
2238
- color: rgba(47, 47, 51, 1);
2425
+ height: 36px;
2426
+ padding: 0 18px;
2427
+ border-radius: 23px;
2428
+ background: transparent;
2429
+ border: 0.5px solid #dbdbdb;
2430
+ color: #333;
2239
2431
  font-family: "PingFang SC", sans-serif;
2240
- font-size: 12px;
2241
- line-height: 12px;
2432
+ font-size: 16px;
2433
+ font-weight: 500;
2434
+ line-height: 15.43px;
2242
2435
  display: inline-flex;
2243
2436
  align-items: center;
2244
2437
  justify-content: center;
2245
2438
  }
2246
- .agent-card--search .agent-card__action::before { content: '@'; font-weight: 600; }
2439
+ .agent-card--search .agent-card__action::before { content: none; }
2247
2440
  .agent-card--search .agent-card__action:hover {
2248
- background: #e2e3e5;
2441
+ background: rgba(0, 0, 0, 0.04);
2249
2442
  }
2250
2443
 
2251
2444
  @media (max-width: 980px) {
@@ -2313,9 +2506,9 @@ function injectStyles() {
2313
2506
  [data-theme-mode="dark"] .openagent-panel-title,
2314
2507
  [data-theme="dark"] .openagent-panel-title { color: rgba(224, 224, 224, 0.8); }
2315
2508
  [data-theme-mode="dark"] .openagent-panel-close,
2316
- [data-theme="dark"] .openagent-panel-close { background: #2a2a2a; color: #888; }
2509
+ [data-theme="dark"] .openagent-panel-close { background: #2a2a2a; }
2317
2510
  [data-theme-mode="dark"] .openagent-panel-close:hover,
2318
- [data-theme="dark"] .openagent-panel-close:hover { background: #333; color: #ccc; }
2511
+ [data-theme="dark"] .openagent-panel-close:hover { background: #333; }
2319
2512
  [data-theme-mode="dark"] .openagent-section-heading,
2320
2513
  [data-theme="dark"] .openagent-section-heading { color: rgba(224, 224, 224, 0.45); }
2321
2514
  [data-theme-mode="dark"] .openagent-parent-heading,
@@ -2331,28 +2524,39 @@ function injectStyles() {
2331
2524
  [data-theme="dark"] .agent-card__stat { color: #64748b; }
2332
2525
 
2333
2526
  [data-theme-mode="dark"] .agent-card--mention,
2334
- [data-theme="dark"] .agent-card--mention { background: transparent; }
2527
+ [data-theme="dark"] .agent-card--mention { background: #1c1c1c; border-color: rgba(255,255,255,0.12); }
2335
2528
  [data-theme-mode="dark"] .agent-card--mention:hover,
2336
2529
  [data-theme="dark"] .agent-card--mention:hover { background: #252525; }
2530
+ [data-theme-mode="dark"] .agent-card--mention .agent-card__name,
2531
+ [data-theme="dark"] .agent-card--mention .agent-card__name { color: #e0e0e0; }
2532
+ [data-theme-mode="dark"] .agent-card--mention .agent-card__bio,
2533
+ [data-theme="dark"] .agent-card--mention .agent-card__bio { color: rgba(224,224,224,0.7); }
2534
+ [data-theme-mode="dark"] .agent-card--mention .agent-card__stat--claws,
2535
+ [data-theme="dark"] .agent-card--mention .agent-card__stat--claws { color: #aaa; }
2536
+ [data-theme-mode="dark"] .agent-card--mention .agent-card__stat--owner,
2537
+ [data-theme="dark"] .agent-card--mention .agent-card__stat--owner { color: #aaa; }
2337
2538
  [data-theme-mode="dark"] .agent-card--mention .agent-card__action,
2338
2539
  [data-theme="dark"] .agent-card--mention .agent-card__action {
2339
- background: #333; border-color: #555; color: #ddd;
2540
+ background: transparent; border-color: rgba(255,255,255,0.2); color: #ddd;
2340
2541
  }
2341
2542
  [data-theme-mode="dark"] .agent-card--mention .agent-card__action:hover,
2342
- [data-theme="dark"] .agent-card--mention .agent-card__action:hover { background: #444; }
2543
+ [data-theme="dark"] .agent-card--mention .agent-card__action:hover { background: rgba(255,255,255,0.06); }
2343
2544
  [data-theme-mode="dark"] .agent-card--search:hover,
2344
2545
  [data-theme="dark"] .agent-card--search:hover { background: #252525; }
2345
- [data-theme-mode="dark"] .agent-card--search.openagent-card-selected,
2346
- [data-theme="dark"] .agent-card--search.openagent-card-selected {
2347
- background: rgba(99, 102, 241, 0.12);
2348
- outline-color: rgba(99, 102, 241, 0.4);
2349
- }
2546
+ [data-theme-mode="dark"] .agent-card--search .agent-card__name,
2547
+ [data-theme="dark"] .agent-card--search .agent-card__name { color: #e0e0e0; }
2548
+ [data-theme-mode="dark"] .agent-card--search .agent-card__bio,
2549
+ [data-theme="dark"] .agent-card--search .agent-card__bio { color: rgba(224, 224, 224, 0.65); }
2550
+ [data-theme-mode="dark"] .agent-card--search .agent-card__stat--claws,
2551
+ [data-theme="dark"] .agent-card--search .agent-card__stat--claws { color: #aaa; }
2552
+ [data-theme-mode="dark"] .agent-card--search .agent-card__stat--owner,
2553
+ [data-theme="dark"] .agent-card--search .agent-card__stat--owner { color: #aaa; }
2350
2554
  [data-theme-mode="dark"] .agent-card--search .agent-card__action,
2351
2555
  [data-theme="dark"] .agent-card--search .agent-card__action {
2352
- background: #333; border-color: #555; color: #ddd;
2556
+ background: transparent; border-color: rgba(255,255,255,0.2); color: #ddd;
2353
2557
  }
2354
2558
  [data-theme-mode="dark"] .agent-card--search .agent-card__action:hover,
2355
- [data-theme="dark"] .agent-card--search .agent-card__action:hover { background: #444; }
2559
+ [data-theme="dark"] .agent-card--search .agent-card__action:hover { background: rgba(255,255,255,0.06); }
2356
2560
 
2357
2561
 
2358
2562
  [data-theme-mode="dark"] .agent-card--inline,
@@ -2370,7 +2574,8 @@ function injectStyles() {
2370
2574
  [data-theme="dark"] .agent-card__loading {
2371
2575
  background: #1e1b3a; border-color: #2d2b55; color: #64748b;
2372
2576
  }
2373
- `;
2577
+
2578
+ `;
2374
2579
  document.head.appendChild(style);
2375
2580
  }
2376
2581
 
@@ -2636,9 +2841,9 @@ panel.innerHTML = `
2636
2841
  <path d="M39 31H42C44.2091 31 46 29.2091 46 27V17C46 14.7909 44.2091 13 42 13H24C21.7909 13 20 14.7909 20 17V27C20 29.2091 21.7909 31 24 31H30.0652C30.236 31 30.3282 31.2004 30.217 31.3302L27.5 34.5" stroke="#12CCF6" stroke-width="3.3" stroke-linecap="round"/>
2637
2842
  <path d="M27 25.5L32.5 21" stroke="#12CCF6" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
2638
2843
  </svg>
2639
- <span class="panel-title-text">Agent Book</span>
2844
+ <span class="panel-title-text">OpenAgent</span>
2640
2845
  </span>
2641
- <button class="openagent-panel-close">✕</button>
2846
+ <button class="openagent-panel-close"><svg xmlns="http://www.w3.org/2000/svg" width="21" height="21" viewBox="0 0 21 21" fill="none"><path d="M5.625 5.625L15.375 15.375" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M15.375 5.625L5.625 15.375" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg></button>
2642
2847
  </div>
2643
2848
  <hr class="openagent-panel-divider" />
2644
2849
  <div class="openagent-agent-list">
@@ -2651,6 +2856,15 @@ panel.querySelector('.openagent-panel-close').addEventListener('click', () => {
2651
2856
  closePanel();
2652
2857
  });
2653
2858
 
2859
+
2860
+ // 提示栏关闭按钮
2861
+ const hintClose = panel.querySelector('.openagent-hint-bar__close');
2862
+ if (hintClose) {
2863
+ hintClose.addEventListener('click', () => {
2864
+ const hintBar = panel.querySelector('.openagent-hint-bar');
2865
+ if (hintBar) hintBar.style.display = 'none';
2866
+ });
2867
+ }
2654
2868
  // 挂到 body(与 backdrop 同级,z-index 自然生效)
2655
2869
  document.body.appendChild(panel);
2656
2870
  return panel;
@@ -2689,6 +2903,12 @@ return textarea.value.replace(/@/g, ' ').replace(/\s+/g, ' ').trim();
2689
2903
  }
2690
2904
 
2691
2905
  function openPanel(textarea) {
2906
+ // 清除上次的空状态弹窗
2907
+ var oldToast = document.querySelector('.openagent-empty-toast');
2908
+ if (oldToast) oldToast.remove();
2909
+ var oldEmpty = document.querySelector('.openagent-empty-state');
2910
+ if (oldEmpty) oldEmpty.remove();
2911
+
2692
2912
  const p = ensurePanel();
2693
2913
  _positionPanel(); // 动态定位到 input 上方
2694
2914
  p.classList.add('visible');
@@ -2872,14 +3092,82 @@ function _appendSearchResults(container, agents, textarea, renderedAgents) {
2872
3092
  container.appendChild(list);
2873
3093
  }
2874
3094
 
3095
+ /**
3096
+ * 空状态组件(Figma 144:3444)— 未匹配到 Agent 时显示
3097
+ */
3098
+ /** 关闭已有空状态浮层 */
3099
+ function _dismissEmptyToast() {
3100
+ var existing = document.querySelector('.openagent-empty-toast');
3101
+ if (existing) existing.remove();
3102
+ }
3103
+
3104
+ /** 独立浮层空状态(不在面板内) */
3105
+ function _showEmptyToast(query) {
3106
+ _dismissEmptyToast();
3107
+ var toast = _el('div', 'openagent-empty-toast');
3108
+
3109
+ var iconWrap = _el('div', 'openagent-empty-state__icon');
3110
+ iconWrap.innerHTML = '<svg width="14" height="14" viewBox="0 0 14 14" fill="none">' +
3111
+ '<path d="M7 1.5C10.0376 1.5 12.5 3.96243 12.5 7C12.5 8.69527 11.7389 10.2145 10.5237 11.2559L13.0303 13.7626C13.3232 14.0555 13.3232 14.5303 13.0303 14.8232C12.7374 15.1161 12.2626 15.1161 11.9697 14.8232L9.38402 12.2376C8.53401 12.7803 7.49507 13.1079 6.37793 13.1079L7 12.5C6.99363 12.5008 6.98726 12.5012 6.98089 12.5012C3.9368 12.5307 1.46927 10.0632 1.49878 7.01908C1.52829 3.97499 3.99398 1.50537 7.03789 1.5H7ZM7 3C4.79086 3 3 4.79086 3 7C3 9.20914 4.79086 11 7 11C9.20914 11 11 9.20914 11 7C11 4.79086 9.20914 3 7 3Z" fill="#8274ff" fill-opacity="0.6"/>' +
3112
+ '</svg>';
3113
+ toast.appendChild(iconWrap);
3114
+
3115
+ toast.appendChild(_text('span', 'openagent-empty-state__text',
3116
+ query ? '暂未匹配到您想要的Agent 我们将持续上新~' : '暂无在线 Agent,请输入关键词搜索'));
3117
+
3118
+ var closeBtn = _el('button', 'openagent-empty-state__close');
3119
+ closeBtn.innerHTML = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none">' +
3120
+ '<path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>' +
3121
+ '</svg>';
3122
+ closeBtn.addEventListener('click', function() { toast.remove(); });
3123
+ toast.appendChild(closeBtn);
3124
+
3125
+ // 定位到输入框上方
3126
+ if (inputWrapperRef) {
3127
+ var rect = inputWrapperRef.getBoundingClientRect();
3128
+ toast.style.position = 'fixed';
3129
+ toast.style.left = Math.max(16, rect.left) + 'px';
3130
+ toast.style.width = Math.min(rect.width, window.innerWidth - 32) + 'px';
3131
+ toast.style.bottom = (window.innerHeight - rect.top + 8) + 'px';
3132
+ toast.style.zIndex = '100000';
3133
+ }
3134
+ document.body.appendChild(toast);
3135
+ }
3136
+
3137
+ function _createEmptyState(query) {
3138
+ var wrapper = _el('div', 'openagent-empty-state');
3139
+ var row = _el('div', 'openagent-empty-state__row');
3140
+
3141
+ var iconWrap = _el('div', 'openagent-empty-state__icon');
3142
+ iconWrap.innerHTML = '<svg width="14" height="14" viewBox="0 0 14 14" fill="none">' +
3143
+ '<path d="M7 1.5C10.0376 1.5 12.5 3.96243 12.5 7C12.5 8.69527 11.7389 10.2145 10.5237 11.2559L13.0303 13.7626C13.3232 14.0555 13.3232 14.5303 13.0303 14.8232C12.7374 15.1161 12.2626 15.1161 11.9697 14.8232L9.38402 12.2376C8.53401 12.7803 7.49507 13.1079 6.37793 13.1079L7 12.5C6.99363 12.5008 6.98726 12.5012 6.98089 12.5012C3.9368 12.5307 1.46927 10.0632 1.49878 7.01908C1.52829 3.97499 3.99398 1.50537 7.03789 1.5H7ZM7 3C4.79086 3 3 4.79086 3 7C3 9.20914 4.79086 11 7 11C9.20914 11 11 9.20914 11 7C11 4.79086 9.20914 3 7 3Z" fill="#8274ff" fill-opacity="0.6"/>' +
3144
+ '</svg>';
3145
+ row.appendChild(iconWrap);
3146
+
3147
+ var text = _text('span', 'openagent-empty-state__text',
3148
+ query ? '暂未匹配到您想要的Agent 我们将持续上新~' : '暂无在线 Agent,请输入关键词搜索');
3149
+ row.appendChild(text);
3150
+
3151
+ var closeBtn = _el('button', 'openagent-empty-state__close');
3152
+ closeBtn.innerHTML = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none">' +
3153
+ '<path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>' +
3154
+ '</svg>';
3155
+ closeBtn.addEventListener('click', function() {
3156
+ wrapper.style.display = 'none';
3157
+ });
3158
+ row.appendChild(closeBtn);
3159
+
3160
+ wrapper.appendChild(row);
3161
+ return wrapper;
3162
+ }
3163
+
2875
3164
  function renderAgentList(container, agents, textarea, query) {
2876
- if (!agents.length) {
2877
- const message = CL.agentBookLastError || '暂无在线 Agent';
2878
- container.innerHTML = '';
2879
- container.appendChild(_text('div', 'openagent-loading', message));
2880
- _currentAgents = [];
2881
- _currentTextarea = textarea;
2882
- return;
3165
+ if (!agents.length) {
3166
+ _currentAgents = [];
3167
+ _currentTextarea = textarea;
3168
+ closePanel();
3169
+ _showEmptyToast(query);
3170
+ return;
2883
3171
  }
2884
3172
 
2885
3173
  console.log('[openagent] renderAgentList:', agents.length, 'agents, textarea:', !!textarea);
@@ -3129,6 +3417,23 @@ function _installSendClickInterceptor() {
3129
3417
  }, true);
3130
3418
  }
3131
3419
 
3420
+ function _installSendKeydownInterceptor() {
3421
+ if (window.__openagentSendKeydownInterceptorInstalled) return;
3422
+ window.__openagentSendKeydownInterceptorInstalled = true;
3423
+ document.addEventListener('keydown', function(e) {
3424
+ if (!CL.pendingMention || CL.remoteSendInFlight) return;
3425
+ if (e.key !== 'Enter' || e.shiftKey || e.isComposing) return;
3426
+
3427
+ const textarea = _getTextarea();
3428
+ if (!textarea || e.target !== textarea) return;
3429
+
3430
+ e.preventDefault();
3431
+ e.stopPropagation();
3432
+ if (typeof e.stopImmediatePropagation === 'function') e.stopImmediatePropagation();
3433
+ _sendPendingMention(textarea);
3434
+ }, true);
3435
+ }
3436
+
3132
3437
  /**
3133
3438
  * 多策略定位 textarea 所在输入区域的工具栏行。
3134
3439
  * v4.x: 工具栏在 textarea.parentElement.children 中
@@ -3177,6 +3482,7 @@ function tryInject() {
3177
3482
 
3178
3483
  if (!textarea) return false;
3179
3484
  _installSendClickInterceptor();
3485
+ _installSendKeydownInterceptor();
3180
3486
  if (document.querySelector('.openagent-at-btn')) return true; // 已注入
3181
3487
 
3182
3488
  // ── 定位插入点:麦克风图标所在的 toolbar 行(多策略)──
@@ -3195,6 +3501,8 @@ function tryInject() {
3195
3501
  const pos = ta.selectionStart;
3196
3502
  // 如果光标前已经是 @,不重复插入
3197
3503
  if (pos > 0 && val[pos - 1] === '@') {
3504
+ // 按钮主动触发 → 清除 dismissed 状态,确保弹窗能打开
3505
+ if (typeof resetMention === 'function') resetMention();
3198
3506
  _handleStateChange(ta);
3199
3507
  return;
3200
3508
  }
@@ -3253,10 +3561,54 @@ function tryInject() {
3253
3561
 
3254
3562
  console.log('[openagent] ✅ Agent Book UI injected (v3 hook-driven)');
3255
3563
 
3564
+ // ── 提示栏(Figma 141:3293):页面加载即显示 ──
3565
+ _injectHintBar(inputContainer || textarea.parentElement);
3566
+
3256
3567
  return true;
3257
3568
  }
3258
3569
 
3259
- // ════════════════════════════════════════════════════════════════
3570
+ /** 注入提示栏到输入区域上方 */
3571
+ function _injectHintBar(anchorEl) {
3572
+ if (!anchorEl || document.querySelector('.openagent-hint-bar')) return;
3573
+
3574
+ const hintBar = document.createElement('div');
3575
+ hintBar.className = 'openagent-hint-bar';
3576
+ hintBar.innerHTML = '' +
3577
+ '<div class="openagent-hint-bar__content">' +
3578
+ '<div class="openagent-hint-bar__icon">' +
3579
+ '<svg xmlns="http://www.w3.org/2000/svg" width="27" height="27" viewBox="0 0 27 27" fill="none">' +
3580
+ '<rect width="27" height="27" rx="6" fill="url(#paint0_linear_141_3277)" fill-opacity="0.1"/>' +
3581
+ '<path d="M13.5 6.75098C16.8137 6.75098 19.5 9.43727 19.5 12.751C19.5 14.3288 18.8894 15.7629 17.8936 16.834L20.7803 19.7207C21.0732 20.0136 21.0732 20.4884 20.7803 20.7812C20.4874 21.0741 20.0126 21.0741 19.7197 20.7812L16.7383 17.7998C15.8038 18.4004 14.6933 18.751 13.5 18.751C10.1863 18.751 7.5 16.0647 7.5 12.751C7.5 9.43727 10.1863 6.75098 13.5 6.75098ZM13.5 8.25098C11.0147 8.25098 9 10.2657 9 12.751C9 15.2363 11.0147 17.251 13.5 17.251C15.9853 17.251 18 15.2363 18 12.751C18 10.2657 15.9853 8.25098 13.5 8.25098Z" fill="url(#paint1_linear_141_3277)"/>' +
3582
+ '<defs>' +
3583
+ '<linearGradient id="paint0_linear_141_3277" x1="0" y1="13.5" x2="27" y2="13.5" gradientUnits="userSpaceOnUse">' +
3584
+ '<stop stop-color="#8274FF"/>' +
3585
+ '<stop offset="1" stop-color="#3890FF"/>' +
3586
+ '</linearGradient>' +
3587
+ '<linearGradient id="paint1_linear_141_3277" x1="7.5" y1="13.8759" x2="20.9999" y2="13.8759" gradientUnits="userSpaceOnUse">' +
3588
+ '<stop stop-color="#8274FF"/>' +
3589
+ '<stop offset="1" stop-color="#3890FF"/>' +
3590
+ '</linearGradient>' +
3591
+ '</defs>' +
3592
+ '</svg>' +
3593
+ '</div>' +
3594
+ '<span class="openagent-hint-bar__text">输入你的需求,调配远端Agent为你解决</span>' +
3595
+ '</div>' +
3596
+ '<button class="openagent-hint-bar__close">' +
3597
+ '<svg xmlns="http://www.w3.org/2000/svg" width="21" height="21" viewBox="0 0 21 21" fill="none">' +
3598
+ '<path d="M5.625 5.625L15.375 15.375" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>' +
3599
+ '<path d="M15.375 5.625L5.625 15.375" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>' +
3600
+ '</svg>' +
3601
+ '</button>';
3602
+
3603
+ hintBar.querySelector('.openagent-hint-bar__close').addEventListener('click', () => {
3604
+ hintBar.style.display = 'none';
3605
+ });
3606
+
3607
+ // 插入到 wrapper 外面、上方
3608
+ anchorEl.parentElement.insertBefore(hintBar, anchorEl);
3609
+ }
3610
+
3611
+ // ════════════════════════════════════════════════════════════════
3260
3612
  // ── window.__clMention — OC 注入钩子的桥接对象 ──
3261
3613
  // ════════════════════════════════════════════════════════════════
3262
3614
  //
@@ -5713,7 +6065,8 @@ function _clScan() {
5713
6065
  // 注意:不使用 .chat-tool-card 类名,避免 scanner.js 误匹配。
5714
6066
 
5715
6067
  (function _clInjectRemoteAgentStyles() {
5716
- if (document.getElementById('cl-remote-agent-styles')) return;
6068
+ var oldStyle = document.getElementById('cl-remote-agent-styles');
6069
+ if (oldStyle) oldStyle.remove();
5717
6070
  var style = document.createElement('style');
5718
6071
  style.id = 'cl-remote-agent-styles';
5719
6072
  style.textContent = [
@@ -5776,7 +6129,20 @@ function _clScan() {
5776
6129
  ' border: 0 !important;',
5777
6130
  ' background: transparent !important;',
5778
6131
  ' box-shadow: none !important;',
5779
- ' padding-top: 0 !important;',
6132
+ ' padding: 10px 0 !important;',
6133
+ ' width: 100%;',
6134
+ ' max-width: 100% !important;',
6135
+ ' overflow: hidden !important;',
6136
+ '}',
6137
+ '.chat-tool-msg-collapse.chat-tool-msg-collapse--manual.is-open:has(.cl-remote-agent-card) {',
6138
+ ' margin-left: 0 !important;',
6139
+ '}',
6140
+ // ── 外层活动组容器 ──
6141
+ '.chat-activity-group__body:has(.cl-remote-agent-card) {',
6142
+ ' border-radius: 14px;',
6143
+ ' border: 1px solid #E5E5EA;',
6144
+ ' background: #F8F9FA;',
6145
+ ' margin: 8px;',
5780
6146
  ' padding-bottom: 0 !important;',
5781
6147
  '}',
5782
6148
  '.chat-bubble:has(.cl-remote-agent-card) > .chat-text,',
@@ -5807,506 +6173,578 @@ function _clScan() {
5807
6173
  '.cl-remote-agent-card {',
5808
6174
  ' max-height: none;',
5809
6175
  ' overflow: visible;',
5810
- ' width: fit-content;',
6176
+ ' width: 100%;',
5811
6177
  ' max-width: 100%;',
5812
- ' border: 1px solid color-mix(in srgb, var(--border, rgba(47,47,51,0.10)) 85%, transparent);',
5813
- ' border-radius: var(--cl-native-shell-radius, 14px);',
5814
- ' padding: var(--cl-native-shell-padding, 8px);',
5815
- ' background: var(--card, #fff);',
6178
+ ' border: 1px solid rgba(0,0,0,0.05);',
6179
+ ' border-radius: 14px;',
6180
+ ' background: #fff;',
5816
6181
  ' display: flex;',
5817
6182
  ' flex-direction: column;',
5818
- ' gap: var(--cl-native-shell-gap, 4px);',
6183
+ ' gap: 10px;',
5819
6184
  ' box-sizing: border-box;',
5820
6185
  '}',
5821
6186
 
5822
6187
  // ── 顶部 OpenAgent 标题条 ──
5823
6188
  '.cl-openagent-header {',
5824
- ' width: fit-content;',
5825
6189
  ' max-width: 100%;',
5826
- ' min-height: var(--cl-native-summary-min-height, 34px);',
5827
6190
  ' display: flex;',
5828
6191
  ' align-items: center;',
5829
- ' gap: var(--cl-native-summary-gap, 6px);',
5830
- ' padding: var(--cl-native-summary-padding, 6px 10px);',
6192
+ ' gap: 6px;',
6193
+ ' height: 34px;',
6194
+ ' padding: 6px 0;',
6195
+ ' border-radius: 10px;',
5831
6196
  ' box-sizing: border-box;',
5832
- ' border: 1px solid color-mix(in srgb, var(--border, rgba(47,47,51,0.10)) 85%, transparent);',
5833
- ' border-radius: var(--cl-native-summary-radius, 10px);',
5834
- ' background: color-mix(in srgb, var(--bg-hover, #F4F5F7) 50%, transparent);',
5835
- ' color: var(--text, #2F2F33);',
6197
+ ' border: none;',
6198
+ ' background: transparent;',
5836
6199
  ' font-family: "PingFang SC", sans-serif;',
5837
- ' font-size: var(--cl-native-summary-font-size, 13px);',
5838
- ' line-height: var(--cl-native-summary-line-height, 1.2);',
5839
6200
  '}',
5840
- '.cl-openagent-header-caret {',
5841
- ' width: 6px;',
5842
- ' color: var(--muted, rgba(47,47,51,0.45));',
5843
- ' font-size: 8px;',
5844
- ' line-height: 1;',
5845
- ' flex: 0 0 auto;',
6201
+ '.cl-openagent-header:hover {',
5846
6202
  '}',
5847
- '.cl-openagent-header-icon {',
5848
- ' position: relative;',
6203
+ '/* Output mode (Figma 373:12082) */',
6204
+ '.cl-openagent-header--output,',
6205
+ '.cl-exec-v2 .cl-openagent-header--output {',
6206
+ ' border-radius: 10px 10px 0 0 !important;',
6207
+ ' border: 1px solid rgba(229, 229, 234, 0.75) !important;',
6208
+ ' background: linear-gradient(90deg, rgba(220, 38, 38, 0.09) 0%, rgba(220, 38, 38, 0) 34%),',
6209
+ ' linear-gradient(90deg, rgb(253, 253, 254) 0%, rgb(253, 253, 254) 100%) !important;',
6210
+ ' box-shadow: 0px 8px 11px rgba(0, 0, 0, 0.12);',
6211
+ ' padding: 8px 6px !important;',
6212
+ '}',
6213
+ '.cl-openagent-header--output .cl-openagent-agent,',
6214
+ '.cl-exec-v2 .cl-openagent-header--output .cl-openagent-agent {',
6215
+ ' display: none;',
6216
+ '}',
6217
+ '.cl-openagent-header--output:hover,',
6218
+ '.cl-exec-v2 .cl-openagent-header--output:hover {',
6219
+ ' border-color: rgba(0,0,0,0.1);',
6220
+ '}',
6221
+ '.cl-openagent-expand-icon {',
6222
+ ' display: flex;',
6223
+ ' align-items: center;',
6224
+ ' justify-content: center;',
5849
6225
  ' width: 15px;',
5850
- ' height: 14px;',
5851
- ' flex: 0 0 15px;',
6226
+ ' height: 15px;',
6227
+ ' flex-shrink: 0;',
6228
+ ' transition: transform 0.2s ease;',
5852
6229
  '}',
5853
- '.cl-openagent-header-icon::before,',
5854
- '.cl-openagent-header-icon::after {',
5855
- ' content: "";',
5856
- ' position: absolute;',
5857
- ' width: 8px;',
5858
- ' height: 8px;',
5859
- ' border: 1.5px solid #10BDEB;',
5860
- ' border-radius: 2px;',
5861
- ' box-sizing: border-box;',
6230
+ '.cl-openagent-expand-icon.cl-openagent-expanded {',
6231
+ ' transform: rotate(180deg);',
5862
6232
  '}',
5863
- '.cl-openagent-header-icon::before { left: 2px; top: 5px; }',
5864
- '.cl-openagent-header-icon::after { left: 5px; top: 2px; }',
5865
- '.cl-openagent-header-title {',
6233
+ '.cl-openagent-badge {',
6234
+ ' width: 14px;',
6235
+ ' height: 14px;',
6236
+ ' border-radius: 14px;',
6237
+ ' background: url(./icon.png) center/cover no-repeat;',
6238
+ ' flex-shrink: 0;',
6239
+ ' overflow: hidden;',
6240
+ '}',
6241
+ '.cl-openagent-text-row {',
5866
6242
  ' display: flex;',
5867
6243
  ' align-items: center;',
5868
- ' gap: 3px;',
6244
+ ' gap: 6px;',
5869
6245
  ' min-width: 0;',
6246
+ ' line-height: 1.32;',
6247
+ '}',
6248
+ '.cl-openagent-label {',
6249
+ ' font-size: 12px;',
6250
+ ' font-weight: 500;',
6251
+ ' color: #333;',
5870
6252
  ' white-space: nowrap;',
5871
6253
  '}',
5872
- '.cl-openagent-header-primary {',
5873
- ' color: var(--text, #2F2F33);',
5874
- ' font-weight: 600;',
5875
- ' overflow: hidden;',
5876
- ' text-overflow: ellipsis;',
6254
+ '.cl-openagent-agent {',
6255
+ ' font-size: 12px;',
6256
+ ' font-weight: 500;',
6257
+ ' color: #333;',
6258
+ ' white-space: nowrap;',
5877
6259
  '}',
5878
- '.cl-openagent-header-secondary {',
5879
- ' color: var(--muted, rgba(47,47,51,0.40));',
6260
+ '.cl-openagent-status {',
6261
+ ' font-size: 11px;',
5880
6262
  ' font-weight: 400;',
6263
+ ' color: #666;',
6264
+ ' white-space: nowrap;',
5881
6265
  '}',
5882
- // ── Figma 内容框 ──
6266
+ // ── Execution detail card (Figma 346:181) ──
5883
6267
  '.cl-thought-chain-content {',
5884
- ' width: 100%;',
5885
- ' min-height: 0;',
5886
- ' box-sizing: border-box;',
5887
- ' border: 1px solid color-mix(in srgb, var(--border, rgba(0,0,0,0.04)) 60%, transparent);',
5888
- ' border-radius: 8px;',
5889
- ' background: var(--card, #fff);',
5890
- ' padding: 8px;',
5891
6268
  ' display: flex;',
5892
6269
  ' flex-direction: column;',
5893
- ' align-items: flex-start;',
5894
- ' gap: 12px;',
5895
- '}',
5896
- // ── 共享展开态宿主清理 ──
5897
- 'details.chat-tools-collapse:has(.cl-thought-chain-content--execution),',
5898
- 'details.chat-tools-collapse:has(.cl-output-result),',
5899
- 'details.chat-tool-msg-collapse:has(.cl-thought-chain-content--execution),',
5900
- 'details.chat-tool-msg-collapse:has(.cl-output-result),',
5901
- '.chat-tools-collapse:has(.cl-thought-chain-content--execution),',
5902
- '.chat-tools-collapse:has(.cl-output-result),',
5903
- '.chat-tool-msg-collapse:has(.cl-thought-chain-content--execution),',
5904
- '.chat-tool-msg-collapse:has(.cl-output-result) {',
5905
- ' max-width: 100% !important;',
5906
- ' display: block !important;',
5907
- ' box-sizing: border-box !important;',
6270
+ ' gap: 16px;',
5908
6271
  '}',
5909
- // ── 共享展开态 card 基础 ──
5910
- '.cl-remote-agent-card:has(.cl-thought-chain-content--execution),',
5911
- '.cl-remote-agent-card:has(.cl-output-result) {',
5912
- ' /* padding/radius/gap 继承 base card,不覆盖 */',
6272
+ '.cl-exec-detail-card {',
6273
+ ' padding: 8px 16px 8px 12px;',
6274
+ ' border-radius: 8px;',
6275
+ ' background: #f8f8f8 url(./bg.png) no-repeat;',
6276
+ ' background-size: 100% 100%;',
6277
+ ' background-position: center;',
6278
+ ' width: 460px;',
6279
+ ' max-width: 100%;',
5913
6280
  ' box-sizing: border-box;',
5914
6281
  '}',
5915
- '.cl-remote-agent-card:has(.cl-thought-chain-content--execution:not(.cl-content-collapsed)) {',
5916
- ' width: 514px !important;',
5917
- ' max-width: 100%;',
6282
+ '.cl-exec-detail-row {',
6283
+ ' display: flex;',
6284
+ ' align-items: center;',
6285
+ ' gap: 16px;',
5918
6286
  '}',
5919
- '.cl-remote-agent-card:has(.cl-thought-chain-content:not(.cl-content-collapsed)) .cl-openagent-header {',
5920
- ' width: 100%;',
6287
+ '.cl-exec-agent-avatar {',
6288
+ ' width: 68px;',
6289
+ ' height: 68px;',
6290
+ ' border-radius: 50%;',
6291
+ ' object-fit: cover;',
6292
+ ' flex-shrink: 0;',
5921
6293
  '}',
5922
- // ── 展开内容宽度:外层 card 保持 fit-content,content 出现时自然撑开 ──
5923
- '.cl-thought-chain-content--execution {',
5924
- ' width: 100%;',
6294
+ '.cl-exec-detail-info {',
6295
+ ' display: flex;',
6296
+ ' flex-direction: column;',
6297
+ ' gap: 6px;',
6298
+ ' flex: 1;',
6299
+ ' min-width: 0;',
5925
6300
  '}',
5926
- '.cl-remote-agent-card:has(.cl-output-result) .cl-thought-chain-content {',
5927
- ' width: min(900px, 100%);',
6301
+ '.cl-exec-name-row {',
6302
+ ' display: flex;',
6303
+ ' align-items: center;',
6304
+ ' justify-content: space-between;',
6305
+ ' gap: 8px;',
6306
+ ' margin-bottom: 6px;',
5928
6307
  '}',
5929
- // ── output 专用 content 样式 ──
5930
- '.cl-remote-agent-card:has(.cl-output-result) .cl-thought-chain-content {',
5931
- ' border: 1.5px solid color-mix(in srgb, var(--border, rgba(0,0,0,0.06)) 60%, transparent);',
5932
- ' border-radius: 12px;',
5933
- ' padding: 12px;',
5934
- ' gap: 12px;',
6308
+ '.cl-exec-agent-name {',
6309
+ ' font-family: "PingFang SC", sans-serif;',
6310
+ ' font-size: 17px;',
6311
+ ' font-weight: 500;',
6312
+ ' color: #000;',
6313
+ ' margin: 0;',
6314
+ ' line-height: 1;',
5935
6315
  '}',
5936
- // ── Figma Agent pill(297:696)──
5937
- '.cl-agent-pill {',
5938
- ' display: inline-flex;',
6316
+ '.cl-exec-star-badge {',
6317
+ ' display: flex;',
5939
6318
  ' align-items: center;',
5940
- ' justify-content: center;',
5941
- ' gap: 9px;',
5942
- ' height: 42px;',
5943
- ' min-height: 42px;',
5944
- ' padding: 0 15px;',
5945
- ' border: 0;',
5946
- ' border-radius: 9px;',
5947
- ' background: #FBFBFB;',
5948
- ' box-shadow: inset 0 0 0 1.2px rgba(47,47,51,0.06);',
5949
- ' width: fit-content;',
5950
- ' box-sizing: border-box;',
6319
+ ' gap: 2px;',
6320
+ ' padding: 2px 10px 2px 8px;',
6321
+ ' border-radius: 30px;',
6322
+ ' background: #ebebeb;',
6323
+ ' flex-shrink: 0;',
6324
+ '}',
6325
+ ,
6326
+ ,
6327
+ ,
6328
+ '.cl-exec-star-count {',
6329
+ ' font-family: "PingFang SC", sans-serif;',
6330
+ ' font-size: 11px;',
6331
+ ' font-weight: 500;',
6332
+ ' color: #555;',
6333
+ ' white-space: nowrap;',
6334
+ '}',
6335
+ '.cl-exec-agent-bio {',
6336
+ ' font-family: "PingFang SC", sans-serif;',
6337
+ ' font-size: 14px;',
6338
+ ' font-weight: 400;',
6339
+ ' color: #555;',
5951
6340
  ' margin: 0;',
6341
+ ' line-height: 1;',
5952
6342
  '}',
5953
- '.cl-agent-pill-avatar {',
5954
- ' width: 24px;',
5955
- ' height: 24px;',
5956
- ' border-radius: 50%;',
5957
- ' object-fit: cover;',
5958
- ' flex: 0 0 24px;',
5959
- ' border: 0.6px solid rgba(47,47,51,0.20);',
5960
- ' box-sizing: border-box;',
6343
+
6344
+ // ── Progress text (Figma 346:253) ──
6345
+ '.cl-thought-chain-content.cl-content-collapsed {',
6346
+ ' display: none;',
5961
6347
  '}',
5962
- '.cl-agent-pill-name {',
5963
- ' display: inline-flex;',
6348
+ ,
6349
+ '.cl-exec-progress-row {',
6350
+ ' display: flex;',
5964
6351
  ' align-items: center;',
6352
+ ' gap: 2px;',
6353
+ '}',
6354
+ '.cl-exec-progress-text {',
5965
6355
  ' font-family: "PingFang SC", sans-serif;',
5966
- ' font-size: 15px;',
5967
- ' color: rgba(47,47,51,0.90);',
6356
+ ' font-size: 14px;',
6357
+ ' font-weight: 400;',
5968
6358
  ' line-height: 1.2;',
5969
- ' letter-spacing: 0;',
6359
+ ' margin: 0;',
5970
6360
  ' white-space: nowrap;',
6361
+ ' background-image: linear-gradient(90deg, #555 0%, #555 36%, #eee 55%, #555 77%, #555 100%);',
6362
+ ' background-size: 200% 100%;',
6363
+ ' -webkit-background-clip: text;',
6364
+ ' background-clip: text;',
6365
+ ' -webkit-text-fill-color: transparent;',
6366
+ ' animation: cl-progress-shimmer 2.5s ease-in-out infinite;',
5971
6367
  '}',
5972
- '.cl-agent-pill-at { font-weight: 600; }',
5973
- '.cl-agent-pill-label { font-weight: 400; }',
5974
- '.cl-thought-chain-pill-slot {',
6368
+ '.cl-exec-progress-arrow {',
5975
6369
  ' display: flex;',
5976
6370
  ' align-items: center;',
5977
- ' width: 100%;',
5978
- '}',
5979
- '.cl-thought-chain-divider {',
5980
- ' display: none;',
6371
+ ' flex-shrink: 0;',
5981
6372
  '}',
5982
- '.cl-thought-chain-content--execution {',
5983
- ' border: 1.5px solid rgba(0,0,0,0.04);',
5984
- ' border-radius: 12px;',
5985
- ' padding: 12px;',
5986
- ' gap: 18px;',
6373
+
6374
+
6375
+ // ── Progress shimmer keyframes ──
6376
+ '@keyframes cl-progress-shimmer {',
6377
+ ' 0% { background-position: 200% 0; }',
6378
+ ' 100% { background-position: -200% 0; }',
5987
6379
  '}',
5988
- '.cl-thought-chain-content--execution .cl-agent-pill {',
5989
- ' gap: 9px;',
5990
- ' height: 42px;',
5991
- ' min-height: 42px;',
5992
- ' padding: 0 15px;',
5993
- ' border: 0;',
5994
- ' border-radius: 9px;',
5995
- ' box-shadow: inset 0 0 0 1.2px rgba(47,47,51,0.06);',
6380
+
6381
+ // ── Output card(Figma 160:6681) ──
6382
+ '.cl-output-card {',
6383
+ ' background: #fff !important;',
6384
+ ' border: 1.2px solid rgba(47,47,51,0.1) !important;',
6385
+ ' border-radius: 24px !important;',
6386
+ ' padding: 10px 15px !important;',
6387
+ ' gap: 10px !important;',
5996
6388
  '}',
5997
- '.cl-thought-chain-content--execution .cl-agent-pill-avatar {',
5998
- ' width: 24px;',
5999
- ' height: 24px;',
6000
- ' flex-basis: 24px;',
6389
+ '.cl-output-card > .cl-thought-chain-content {',
6390
+ ' background: #fff;',
6391
+ ' border: 1px solid #f4f4f4;',
6392
+ ' border-radius: 12px;',
6393
+ ' padding: 20px 30px;',
6394
+ ' overflow: hidden;',
6395
+ ' max-width: 100%;',
6396
+ ' box-sizing: border-box;',
6001
6397
  '}',
6002
- '.cl-thought-chain-content--execution .cl-agent-pill-name {',
6003
- ' font-size: 15px;',
6004
- ' line-height: 1.2;',
6398
+ '.cl-output-card > .cl-thought-chain-content * {',
6399
+ ' max-width: 100%;',
6400
+ ' box-sizing: border-box;',
6005
6401
  '}',
6006
- '.cl-remote-agent-card:has(.cl-output-result) .cl-agent-pill {',
6007
- ' gap: 9px;',
6008
- ' height: 42px;',
6009
- ' min-height: 42px;',
6010
- ' padding: 0 15px;',
6011
- ' border: 0;',
6012
- ' border-radius: 9px;',
6013
- ' box-shadow: inset 0 0 0 1.2px rgba(47,47,51,0.06);',
6402
+ '.cl-output-card > .cl-thought-chain-content pre,',
6403
+ '.cl-output-card > .cl-thought-chain-content code {',
6404
+ ' overflow-x: auto;',
6405
+ ' white-space: pre-wrap;',
6406
+ ' word-break: break-all;',
6014
6407
  '}',
6015
- '.cl-remote-agent-card:has(.cl-output-result) .cl-agent-pill-avatar {',
6016
- ' width: 24px;',
6017
- ' height: 24px;',
6018
- ' flex-basis: 24px;',
6408
+ // V2 output card:统一 border/padding 与 execution card 一致
6409
+ '.cl-exec-v2.cl-output-card {',
6410
+ ' border: 1px solid rgba(0,0,0,0.05) !important;',
6411
+ ' border-radius: 14px !important;',
6412
+ ' padding: 0 !important;',
6019
6413
  '}',
6020
- '.cl-remote-agent-card:has(.cl-output-result) .cl-agent-pill-name {',
6021
- ' font-size: 15px;',
6022
- ' line-height: 1.2;',
6414
+ // V2 output card:去掉 content 区多余的内边距,detail card 自带动间距
6415
+ '.cl-exec-v2.cl-output-card > .cl-thought-chain-content {',
6416
+ ' background: transparent;',
6417
+ ' border: none;',
6418
+ ' border-radius: 0;',
6419
+ ' padding: 0 14px !important;',
6023
6420
  '}',
6024
6421
 
6025
- // ── Figma 思考步骤(297:716)──
6026
- '.cl-thought-chain-steps-section {',
6027
- ' width: 100%;',
6028
- ' display: flex;',
6029
- ' flex-direction: column;',
6030
- ' align-items: flex-start;',
6031
- ' gap: 4px;',
6032
- ' padding: 4px 0;',
6033
- ' box-sizing: border-box;',
6422
+ // ── Collapsed state(Figma 145:3466) ──
6423
+ '.cl-remote-agent-card:has(.cl-content-collapsed) {',
6424
+ ' padding: 0 !important;',
6034
6425
  '}',
6035
- '.cl-tools-collapse-header {',
6426
+ // ── Output card Footer(Figma 131:2091) ──
6427
+ '.cl-output-footer {',
6036
6428
  ' display: flex;',
6037
6429
  ' align-items: center;',
6038
- ' gap: 0;',
6039
- ' padding: 0;',
6040
- ' cursor: default;',
6041
- ' user-select: none;',
6042
- '}',
6043
- '.cl-tools-collapse-header:hover { opacity: 1; }',
6044
- '.cl-tools-collapse-header-icon { display: none; }',
6045
- '.cl-tools-collapse-header-title {',
6046
- ' font-family: "PingFang SC", sans-serif;',
6047
- ' font-size: 10px;',
6048
- ' font-weight: 600;',
6049
- ' line-height: 1.2;',
6050
- ' color: rgba(47,47,51,0.90);',
6051
- '}',
6052
- '.cl-tools-collapse-body {',
6053
- ' position: relative;',
6054
- ' display: flex;',
6055
- ' flex-direction: column;',
6056
6430
  ' gap: 4px;',
6057
- ' width: 100%;',
6058
- ' overflow: hidden;',
6059
- ' padding: 0;',
6060
- ' transition: max-height 0.25s ease, opacity 0.2s ease;',
6061
- '}',
6062
- '.cl-tools-collapse-body::before {',
6063
- ' content: "";',
6064
- ' position: absolute;',
6065
- ' left: 7px;',
6066
- ' top: 14px;',
6067
- ' bottom: 14px;',
6068
- ' width: 1px;',
6069
- ' background: rgba(47,47,51,0.10);',
6431
+ ' font-family: "PingFang SC", sans-serif;',
6432
+ ' font-size: 14px;',
6433
+ ' color: #999;',
6070
6434
  '}',
6071
- '.cl-tools-collapse-body.cl-expanded { max-height: 2000px; opacity: 1; }',
6072
- '.cl-tools-collapse-body.cl-collapsed { max-height: 0; opacity: 0; }',
6073
- '.cl-tools-collapse-step {',
6074
- ' position: relative;',
6075
- ' display: block;',
6076
- ' width: 100%;',
6077
- ' padding: 0;',
6078
- ' z-index: 1;',
6435
+ '.cl-output-footer-text {',
6436
+ ' white-space: nowrap;',
6079
6437
  '}',
6080
- '.cl-tools-collapse-step-row {',
6438
+ '.cl-output-footer-star {',
6081
6439
  ' display: flex;',
6082
6440
  ' align-items: center;',
6083
- ' gap: 8px;',
6084
- ' min-height: 14px;',
6441
+ ' flex-shrink: 0;',
6085
6442
  '}',
6086
- '.cl-tools-collapse-step-icon {',
6087
- ' width: 14px;',
6088
- ' height: 14px;',
6089
- ' flex: 0 0 14px;',
6090
- ' display: flex;',
6091
- ' align-items: center;',
6092
- ' justify-content: center;',
6093
- ' background: #fff;',
6443
+ '.cl-output-footer-count {',
6444
+ ' font-weight: 500;',
6445
+ ' white-space: nowrap;',
6094
6446
  '}',
6095
- '.cl-tools-collapse-step-dot {',
6096
- ' width: 5px;',
6097
- ' height: 5px;',
6098
- ' border-radius: 50%;',
6099
- ' background: #D9D9D9;',
6100
- ' animation: none;',
6447
+
6448
+ /* ── Sidebar 面板(Figma 145:5712) ── */
6449
+ '.chat-sidebar {',
6450
+ ' background: #fff !important;',
6451
+ ' border: 1px solid rgba(0,0,0,0.05) !important;',
6452
+ ' border-radius: 14px !important;',
6453
+ ' padding: 16px 20px !important;',
6454
+ ' box-sizing: border-box !important;',
6455
+ ' display: flex !important;',
6456
+ ' flex-direction: column !important;',
6457
+ ' gap: 16px !important;',
6101
6458
  '}',
6102
- '.cl-tools-collapse-step-dot::before,',
6103
- '.cl-tools-collapse-step-dot::after,',
6104
- '.cl-tools-collapse-step-dot span {',
6105
- ' content: none;',
6106
- ' display: none;',
6459
+ '.chat-sidebar > .sidebar-panel {',
6460
+ ' display: flex !important;',
6461
+ ' flex-direction: column !important;',
6462
+ ' gap: 16px !important;',
6463
+ ' width: 100% !important;',
6464
+ ' background: transparent !important;',
6107
6465
  '}',
6108
- '.cl-tools-collapse-step-check {',
6109
- ' position: relative;',
6110
- ' width: 14px;',
6111
- ' height: 14px;',
6112
- ' border-radius: 50%;',
6113
- ' background: #D9D9D9;',
6466
+ '.chat-sidebar .sidebar-header {',
6467
+ ' display: flex !important;',
6468
+ ' align-items: center !important;',
6469
+ ' justify-content: space-between !important;',
6470
+ ' padding: 6px 0 !important;',
6471
+ ' border-radius: 10px !important;',
6472
+ ' width: 100% !important;',
6473
+ ' border: none !important;',
6474
+ ' background: transparent !important;',
6114
6475
  '}',
6115
- '.cl-tools-collapse-step-check::after {',
6116
- ' content: "";',
6117
- ' position: absolute;',
6118
- ' left: 4px;',
6119
- ' top: 3px;',
6120
- ' width: 4px;',
6121
- ' height: 7px;',
6122
- ' border: solid #fff;',
6123
- ' border-width: 0 1.3px 1.3px 0;',
6124
- ' transform: rotate(45deg);',
6476
+ '.chat-sidebar .sidebar-title {',
6477
+ ' font-family: "PingFang SC", sans-serif !important;',
6478
+ ' font-weight: 500 !important;',
6479
+ ' font-size: 18px !important;',
6480
+ ' color: #333 !important;',
6481
+ ' line-height: 1.32 !important;',
6125
6482
  '}',
6126
- '.cl-tools-collapse-step-title {',
6127
- ' font-family: "PingFang SC", sans-serif;',
6128
- ' font-size: 9.5px;',
6129
- ' font-weight: 400;',
6130
- ' line-height: 1.32;',
6131
- ' color: rgba(47,47,51,0.40);',
6132
- ' white-space: nowrap;',
6133
- ' overflow: hidden;',
6134
- ' text-overflow: ellipsis;',
6483
+ '.chat-sidebar .sidebar-header button {',
6484
+ ' width: 16px !important;',
6485
+ ' height: 16px !important;',
6486
+ ' padding: 0 !important;',
6487
+ ' border: none !important;',
6488
+ ' background: transparent !important;',
6489
+ ' cursor: pointer !important;',
6490
+ ' flex-shrink: 0 !important;',
6135
6491
  '}',
6136
- '.cl-tools-collapse-step-detail {',
6137
- ' margin: 2px 0 0 22px;',
6138
- ' font-family: "PingFang SC", sans-serif;',
6139
- ' font-size: 9px;',
6140
- ' line-height: 1.32;',
6141
- ' color: rgba(47,47,51,0.40);',
6492
+ '.chat-sidebar .sidebar-content {',
6493
+ ' font-family: "PingFang SC", sans-serif !important;',
6494
+ ' font-size: 14px !important;',
6495
+ ' font-weight: 400 !important;',
6496
+ ' line-height: 1.8 !important;',
6497
+ ' color: #333 !important;',
6498
+ ' width: 100% !important;',
6499
+ ' padding: 0 !important;',
6142
6500
  '}',
6143
- '.cl-thought-chain-content--execution .cl-thought-chain-steps-section {',
6144
- ' gap: 6px;',
6145
- ' padding: 6px 0;',
6501
+ '.chat-sidebar .sidebar-markdown {',
6502
+ ' font-family: "PingFang SC", sans-serif !important;',
6503
+ ' font-size: 14px !important;',
6504
+ ' font-weight: 400 !important;',
6505
+ ' line-height: 1.8 !important;',
6506
+ ' color: #333 !important;',
6507
+ ' background: transparent !important;',
6508
+ ' border: none !important;',
6509
+ ' padding: 0 !important;',
6146
6510
  '}',
6147
- '.cl-thought-chain-content--execution .cl-tools-collapse-header-title {',
6148
- ' font-size: 15px;',
6149
- ' line-height: 1.2;',
6511
+ // 隐藏宿主 sidebar 自带的 "Rendered Markdown / View Raw Text" 工具栏
6512
+ '.chat-sidebar .sidebar-markdown-shell__toolbar {',
6513
+ ' display: none !important;',
6150
6514
  '}',
6151
- '.cl-thought-chain-content--execution .cl-tools-collapse-body {',
6152
- ' gap: 6px;',
6515
+ // ═══════════════════════════════════════════════════════════════
6516
+ // V2 执行卡片样式(2026.6.9+ 新版 UI)
6517
+ // 所有 V2 样式在 .cl-exec-v2 下隔离,不影响旧版
6518
+ // ═══════════════════════════════════════════════════════════════
6519
+
6520
+ // ── V2 容器 ──
6521
+ '.cl-exec-v2 {',
6522
+ ' position: relative;',
6153
6523
  '}',
6154
- '.cl-thought-chain-content--execution .cl-tools-collapse-body::before {',
6155
- ' left: 10px;',
6156
- ' top: 21px;',
6157
- ' bottom: 21px;',
6158
- ' width: 1px;',
6159
- ' background: #DBDBDB;',
6160
- ' transform: scaleX(0.3);',
6161
- ' transform-origin: left center;',
6524
+
6525
+ // ── V2 Header(Figma 371:6987 — 红晕渐变背景 + 独立边框)──
6526
+ '.cl-exec-v2 .cl-openagent-header-v2 {',
6527
+ ' background: linear-gradient(90deg, rgba(220, 38, 38, 0.09) 0%, rgba(220, 38, 38, 0) 34%),',
6528
+ ' linear-gradient(90deg, rgb(253, 253, 254) 0%, rgb(253, 253, 254) 100%) !important;',
6529
+ ' border-bottom: 1px solid rgba(229, 229, 234, 0.75) !important;',
6530
+ ' padding: 8px 6px !important;',
6531
+ ' margin: 0 !important;',
6532
+ ' border-radius: 10px 10px 0 0;',
6533
+ ' height: auto !important;',
6534
+ ' min-height: auto !important;',
6535
+ ' box-sizing: border-box;',
6162
6536
  '}',
6163
- '.cl-thought-chain-content--execution .cl-tools-collapse-step-row {',
6164
- ' gap: 12px;',
6165
- ' min-height: 21px;',
6537
+ '.cl-exec-v2 .cl-openagent-header-v2:hover {',
6538
+ ' background: linear-gradient(90deg, rgba(220, 38, 38, 0.12) 0%, rgba(220, 38, 38, 0) 34%),',
6539
+ ' linear-gradient(90deg, rgb(250, 250, 251) 0%, rgb(250, 250, 251) 100%) !important;',
6166
6540
  '}',
6167
- '.cl-thought-chain-content--execution .cl-tools-collapse-step-icon {',
6168
- ' width: 21px;',
6169
- ' height: 21px;',
6170
- ' flex-basis: 21px;',
6541
+
6542
+ // ── V2 圆形灰色头像(替代小徽章)──
6543
+ '.cl-exec-v2 .cl-openagent-avatar-v2 {',
6544
+ ' display: inline-block;',
6545
+ ' width: 24px;',
6546
+ ' height: 24px;',
6547
+ ' border-radius: 50%;',
6548
+ ' background: #d0d0d0;',
6549
+ ' flex-shrink: 0;',
6550
+ ' margin-right: 4px;',
6171
6551
  '}',
6172
- '.cl-thought-chain-content--execution .cl-tools-collapse-step-dot {',
6173
- ' width: 6px;',
6174
- ' height: 6px;',
6175
- ' background: #DCDCDC;',
6552
+
6553
+ // ── V2 隐藏旧版 OASN 小徽章和 @agentName ──
6554
+ '.cl-exec-v2 .cl-openagent-badge,',
6555
+ '.cl-exec-v2 .cl-openagent-agent {',
6556
+ ' display: none !important;',
6176
6557
  '}',
6177
- '.cl-thought-chain-content--execution .cl-tools-collapse-step-check {',
6178
- ' width: 15px;',
6179
- ' height: 15px;',
6180
- ' background: #DCDCDC;',
6558
+ // ── V2 隐藏步骤标题栏(▼ + "思考中..."),保留进度文字行 ──
6559
+ '.cl-exec-v2 .cl-tools-collapse-header-v2 {',
6560
+ ' display: none !important;',
6561
+ '}',
6562
+
6563
+ // ── V2 Detail Card(大头像 + 右置星级 + 网格点背景)──
6564
+ '.cl-exec-v2 .cl-exec-detail-card-v2 {',
6565
+ ' max-width: 488px !important;',
6566
+ ' width: 100% !important;',
6567
+ ' padding: 8px 16px 8px 12px !important;',
6568
+ ' padding-right: 90px !important;',
6569
+ ' border-radius: 12px !important;',
6570
+ ' background: #f7f7f8 !important;',
6571
+ ' margin: 12px 14px 14px 14px !important;',
6572
+ ' margin-left: 0 !important;',
6573
+ ' position: relative;',
6574
+ ' overflow: hidden;',
6575
+ ' box-sizing: border-box;',
6181
6576
  '}',
6182
- '.cl-thought-chain-content--execution .cl-tools-collapse-step-check::after {',
6183
- ' left: 4px;',
6184
- ' top: 2px;',
6185
- ' width: 5px;',
6186
- ' height: 8px;',
6187
- ' border-width: 0 1.4px 1.4px 0;',
6577
+ /* 四角网格点装饰 */
6578
+ '.cl-exec-v2 .cl-exec-detail-card-v2::before,',
6579
+ '.cl-exec-v2 .cl-exec-detail-card-v2::after {',
6580
+ ' content: "";',
6581
+ ' position: absolute;',
6582
+ ' width: 40px;',
6583
+ ' height: 40px;',
6584
+ ' background-image: radial-gradient(circle, #ddd 1px, transparent 1px);',
6585
+ ' background-size: 8px 8px;',
6586
+ ' opacity: 0.5;',
6188
6587
  '}',
6189
- '.cl-thought-chain-content--execution .cl-tools-collapse-step-title {',
6190
- ' font-size: 14px;',
6191
- ' line-height: 1.32;',
6588
+ '.cl-exec-v2 .cl-exec-detail-card-v2::before {',
6589
+ ' top: 8px;',
6590
+ ' left: 8px;',
6192
6591
  '}',
6193
- '.cl-thought-chain-content--execution .cl-tools-collapse-step-detail {',
6194
- ' display: none;',
6592
+ '.cl-exec-v2 .cl-exec-detail-card-v2::after {',
6593
+ ' bottom: 8px;',
6594
+ ' right: 8px;',
6195
6595
  '}',
6196
6596
 
6197
- // ── output 等待渲染完成前,隐藏整张 result card 和宿主 shell ──
6198
- 'details.chat-tools-collapse:has(.cl-output-card--pending),',
6199
- 'details.chat-tool-msg-collapse:has(.cl-output-card--pending),',
6200
- '.chat-tools-collapse:has(.cl-output-card--pending),',
6201
- '.chat-tool-msg-collapse:has(.cl-output-card--pending) {',
6202
- ' display: none !important;',
6597
+ '.cl-exec-v2 .cl-exec-detail-row-v2 {',
6598
+ ' display: flex;',
6599
+ ' align-items: flex-start;',
6600
+ ' gap: 16px;',
6203
6601
  '}',
6204
- '.cl-output-card--pending {',
6205
- ' display: none !important;',
6602
+
6603
+ '.cl-exec-v2 .cl-exec-detail-info-v2 {',
6604
+ ' display: flex;',
6605
+ ' flex-direction: column;',
6606
+ ' gap: 6px;',
6607
+ ' flex: 1;',
6608
+ ' min-width: 0;',
6206
6609
  '}',
6207
6610
 
6208
- // ── 结果展示区 ──
6209
- '.cl-output-result {',
6210
- ' margin-top: 4px;',
6211
- ' font-family: "PingFang SC", sans-serif;',
6212
- ' font-size: 13px;',
6213
- ' line-height: 1.6;',
6214
- ' color: #2F2F33;',
6215
- ' word-break: break-word;',
6611
+ // ── V2 大头像 80×80 ──
6612
+ '.cl-exec-v2 .cl-exec-agent-avatar-v2 {',
6613
+ ' width: 80px !important;',
6614
+ ' height: 80px !important;',
6615
+ ' border-radius: 16px !important;',
6616
+ ' object-fit: cover;',
6617
+ ' flex-shrink: 0;',
6216
6618
  '}',
6217
- '.cl-output-result--pending {',
6218
- ' display: none !important;',
6619
+
6620
+ // ── V2 名称 ~20px/600/黑色 ──
6621
+ '.cl-exec-v2 .cl-exec-agent-name-v2 {',
6622
+ ' font-family: "PingFang SC", sans-serif;',
6623
+ ' font-size: 20px !important;',
6624
+ ' font-weight: 600 !important;',
6625
+ ' color: #000 !important;',
6626
+ ' margin: 0;',
6627
+ ' line-height: 1.3;',
6219
6628
  '}',
6220
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result {',
6221
- ' width: 100%;',
6222
- ' max-height: 600px;',
6223
- ' overflow-y: auto;',
6224
- ' overflow-x: hidden;',
6225
- ' box-sizing: border-box;',
6226
- ' margin-top: 0;',
6227
- ' padding: 6px 30px 24px 18px;',
6228
- ' border: 0;',
6229
- ' border-radius: 0;',
6230
- ' background: transparent;',
6231
- ' font-size: 14.25px;',
6232
- ' line-height: 1.42;',
6233
- ' color: rgba(47,47,51,0.50);',
6234
- ' scrollbar-width: thin;',
6235
- ' scrollbar-color: #ECECEC transparent;',
6629
+
6630
+ // ── V2 描述 ~14px/400/灰色 ──
6631
+ '.cl-exec-v2 .cl-exec-agent-bio-v2 {',
6632
+ ' font-family: "PingFang SC", sans-serif;',
6633
+ ' font-size: 14px !important;',
6634
+ ' font-weight: 400;',
6635
+ ' color: #888 !important;',
6636
+ ' margin: 0;',
6637
+ ' line-height: 1.4;',
6236
6638
  '}',
6237
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result::-webkit-scrollbar {',
6238
- ' width: 4.5px;',
6639
+
6640
+ // ── V2 星级右置到卡片右上角 ──
6641
+ '.cl-exec-v2 .cl-exec-star-badge-v2 {',
6642
+ ' position: absolute;',
6643
+ ' right: 24px;',
6644
+ ' top: 20px;',
6645
+ ' display: flex;',
6646
+ ' align-items: center;',
6647
+ ' gap: 4px;',
6648
+ ' padding: 4px 12px;',
6649
+ ' border-radius: 30px;',
6650
+ ' background: #ebebeb;',
6651
+ ' z-index: 1;',
6239
6652
  '}',
6240
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result::-webkit-scrollbar-track {',
6241
- ' background: transparent;',
6653
+ '.cl-exec-v2 .cl-exec-star-count-v2 {',
6654
+ ' font-family: "PingFang SC", sans-serif;',
6655
+ ' font-size: 13px;',
6656
+ ' font-weight: 500;',
6657
+ ' color: #555;',
6658
+ ' white-space: nowrap;',
6242
6659
  '}',
6243
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result::-webkit-scrollbar-thumb {',
6244
- ' background: #ECECEC;',
6245
- ' border-radius: 150px;',
6660
+
6661
+ // ── V2 Progress Row(Figma 373:9765 — shimmer 渐变文字 + 箭头)──
6662
+ '.cl-exec-v2 .cl-exec-progress-row-v2 {',
6663
+ ' display: flex;',
6664
+ ' align-items: center;',
6665
+ ' gap: 2px;',
6666
+ ' margin-top: 16px;',
6667
+ ' padding: 0 4px;',
6246
6668
  '}',
6247
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result h1,',
6248
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result h2 {',
6249
- ' margin: 18px 0 9px;',
6250
- ' font-size: 20px;',
6251
- ' font-weight: 600;',
6669
+ '.cl-exec-v2 .cl-exec-progress-row-v2 .cl-exec-progress-text {',
6670
+ ' font-family: "PingFang SC", sans-serif;',
6671
+ ' font-size: 14px;',
6672
+ ' font-weight: 400;',
6252
6673
  ' line-height: 1.2;',
6253
- ' color: rgba(47,47,51,0.90);',
6674
+ ' margin: 0;',
6675
+ ' white-space: nowrap;',
6676
+ ' background-image: linear-gradient(90deg, #555 0%, #555 36%, #eee 55%, #555 77%, #555 100%);',
6677
+ ' background-size: 200% 100%;',
6678
+ ' -webkit-background-clip: text;',
6679
+ ' background-clip: text;',
6680
+ ' -webkit-text-fill-color: transparent;',
6681
+ ' animation: cl-progress-shimmer 2.5s ease-in-out infinite;',
6254
6682
  '}',
6255
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result h1:first-child,',
6256
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result h2:first-child {',
6257
- ' margin-top: 6px;',
6683
+ '.cl-exec-v2 .cl-exec-progress-row-v2 .cl-exec-progress-arrow {',
6684
+ ' display: flex;',
6685
+ ' align-items: center;',
6686
+ ' flex-shrink: 0;',
6687
+ ' opacity: 1;',
6258
6688
  '}',
6259
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result h3 {',
6260
- ' margin: 18px 0 9px;',
6261
- ' font-size: 15px;',
6262
- ' font-weight: 600;',
6263
- ' line-height: 1.2;',
6264
- ' color: rgba(47,47,51,0.90);',
6689
+
6690
+ // ── V2 隐藏旧版 name-row(星级原来在名称旁边)──
6691
+ '.cl-exec-v2 .cl-exec-name-row,',
6692
+ '.cl-exec-v2 .cl-exec-star-badge:not(.cl-exec-star-badge-v2) {',
6693
+ ' display: none !important;',
6265
6694
  '}',
6266
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result p,',
6267
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result li {',
6268
- ' font-size: 14.25px;',
6269
- ' line-height: 1.42;',
6270
- ' color: rgba(47,47,51,0.50);',
6695
+
6696
+ // ─ V2 步骤列表样式(覆盖 thought-chain-card.js 默认值)──
6697
+ '.cl-exec-v2 .cl-tools-collapse-body-v2 {',
6698
+ ' padding: 4px 0 8px;',
6271
6699
  '}',
6272
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result strong,',
6273
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result b,',
6274
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result a {',
6275
- ' color: rgba(47,47,51,0.90) !important;',
6276
- ' font-weight: 600;',
6700
+ '.cl-exec-v2 .cl-tools-collapse-step {',
6701
+ ' padding: 5px 0;',
6702
+ ' gap: 10px;',
6277
6703
  '}',
6278
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result ul,',
6279
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result ol {',
6280
- ' padding-left: 20px;',
6281
- ' margin: 6px 0;',
6704
+ '.cl-exec-v2 .cl-tools-collapse-step-title {',
6705
+ ' font-size: 13px;',
6706
+ ' color: #555;',
6282
6707
  '}',
6283
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result hr {',
6284
- ' border: 0;',
6285
- ' border-top: 1px solid rgba(47,47,51,0.12);',
6286
- ' margin: 15px 0;',
6708
+ '.cl-exec-v2 .cl-tools-collapse-step-check {',
6709
+ ' width: 12px;',
6710
+ ' height: 12px;',
6711
+ ' background: #ccc;',
6287
6712
  '}',
6288
- '.cl-output-result p { margin: 4px 0; }',
6289
- '.cl-output-result ul, .cl-output-result ol { padding-left: 20px; margin: 4px 0; }',
6290
- '.cl-output-result code {',
6291
- ' background: rgba(0,0,0,0.05);',
6292
- ' padding: 1px 4px;',
6293
- ' border-radius: 3px;',
6294
- ' font-size: 12px;',
6713
+ '.cl-exec-v2 .cl-tools-collapse-step-dot {',
6714
+ ' width: 14px;',
6715
+ ' height: 14px;',
6295
6716
  '}',
6296
-
6297
- // ── 错误状态 ──
6298
- '.cl-remote-agent-card--error {',
6299
- ' border-color: rgba(220, 38, 38, 0.3);',
6300
- ' background: rgba(254, 242, 242, 0.5);',
6717
+ '.cl-exec-v2 .cl-tools-collapse-step-dot::before,',
6718
+ '.cl-exec-v2 .cl-tools-collapse-step-dot::after,',
6719
+ '.cl-exec-v2 .cl-tools-collapse-step-dot span {',
6720
+ ' width: 3px;',
6721
+ ' height: 3px;',
6722
+ ' background: #bbb;',
6301
6723
  '}',
6302
6724
 
6303
- // ── Header 折叠/展开 ──
6304
- '.cl-openagent-header:hover {',
6305
- ' background: color-mix(in srgb, var(--bg-hover, #ECEDF0) 75%, transparent);',
6306
- ' transition: background 0.15s ease;',
6725
+ // ── V2 Footer(-由xxx完成 + 星级)──
6726
+ '.cl-exec-v2 .cl-output-footer-v2 {',
6727
+ ' display: flex;',
6728
+ ' align-items: center;',
6729
+ ' gap: 4px;',
6730
+ ' font-family: "PingFang SC", sans-serif;',
6731
+ ' font-size: 13px;',
6732
+ ' color: #999;',
6733
+ ' padding: 12px;',
6734
+ ' margin-top: 8px;',
6307
6735
  '}',
6308
- '.cl-content-collapsed {',
6309
- ' display: none !important;',
6736
+ '.cl-exec-v2 .cl-output-footer-v2 .cl-output-footer-text {',
6737
+ ' white-space: nowrap;',
6738
+ '}',
6739
+ '.cl-exec-v2 .cl-output-footer-v2 .cl-output-footer-star {',
6740
+ ' display: flex;',
6741
+ ' align-items: center;',
6742
+ ' flex-shrink: 0;',
6743
+ ' margin-left: 2px;',
6744
+ '}',
6745
+ '.cl-exec-v2 .cl-output-footer-v2 .cl-output-footer-count {',
6746
+ ' font-weight: 500;',
6747
+ ' white-space: nowrap;',
6310
6748
  '}',
6311
6749
  ].join('\n');
6312
6750
  document.head.appendChild(style);
@@ -6937,6 +7375,8 @@ function _clParseToolCardModel(card) {
6937
7375
  var agentId = args.agent_id || args.agentId || null;
6938
7376
  var agentName = args.agent_name || args.agentName || agentId || 'Remote Agent';
6939
7377
  var agentAvatar = args.agent_avatar || args.agentAvatar || args.avatar || args.avatar_url || args.avatarUrl || null;
7378
+ var agentBio = args.agent_bio || args.agentBio || args.description || args.agent_description || args.MOM || '';
7379
+ var agentStars = args.agent_stars || args.agentStars || args.stars || args.claws || '3.2万';
6940
7380
  var taskText = args.task || args.message || args.instruction || '';
6941
7381
 
6942
7382
  // 从 text 解析思考步骤 / 最终文本
@@ -6952,10 +7392,14 @@ function _clParseToolCardModel(card) {
6952
7392
  agentId: agentId,
6953
7393
  agentName: agentName,
6954
7394
  agentAvatar: agentAvatar,
7395
+ agentBio: agentBio,
7396
+ agentStars: agentStars,
6955
7397
  taskText: taskText,
6956
7398
  toolCallId: card.toolCallId || '',
6957
7399
  status: hasOutput ? 'completed' : 'executing',
6958
7400
  rawText: rawText,
7401
+ text: rawText,
7402
+ outputText: rawText,
6959
7403
  chunks: chunks,
6960
7404
  isError: isError,
6961
7405
  inferredKind: inferredKind,
@@ -6986,6 +7430,11 @@ function _clParseToolCardModel(card) {
6986
7430
  // UI 结构使用 shared thought-chain styles,数据来源是 RenderHook model。
6987
7431
 
6988
7432
  function _clRenderExecutionCard(model) {
7433
+ // ── V2 版本判断:≥ 2026.6.9 启用新版 UI ──
7434
+ if (typeof _clIsHostVersionGte === 'function' && _clIsHostVersionGte('2026.6.9')) {
7435
+ return _clRenderExecutionCardV2(model);
7436
+ }
7437
+
6989
7438
  var container = document.createElement('div');
6990
7439
  container.className = 'cl-remote-agent-card cl-thought-chain';
6991
7440
  if (CL && typeof CL.diagMarkCard === 'function') {
@@ -6995,111 +7444,45 @@ function _clRenderExecutionCard(model) {
6995
7444
  container.appendChild(_clCreateOpenAgentHeader(model));
6996
7445
 
6997
7446
  var content = document.createElement('div');
6998
- content.className = 'cl-thought-chain-content cl-thought-chain-content--execution';
7447
+ content.className = 'cl-thought-chain-content cl-thought-chain-content--execution cl-content-collapsed';
6999
7448
  container.appendChild(content);
7000
7449
 
7001
- // ── Agent Pill ──
7002
- console.log('[cl-exec] 🏷️ agentName=' + JSON.stringify(model.agentName) + ' agentId=' + JSON.stringify(model.agentId));
7003
- var pillSlot = document.createElement('div');
7004
- pillSlot.className = 'cl-thought-chain-pill-slot';
7005
- var pill = _clCreateAgentPill(model.agentName, model.agentId, model.agentAvatar);
7006
- pillSlot.appendChild(pill);
7007
- content.appendChild(pillSlot);
7008
-
7009
- // ── 分隔线 ──
7010
- var divider = document.createElement('div');
7011
- divider.className = 'cl-thought-chain-divider';
7012
- content.appendChild(divider);
7013
-
7014
- // ── 思考步骤区 ──
7015
- var stepsSection = document.createElement('div');
7016
- stepsSection.className = 'cl-thought-chain-steps-section';
7017
-
7018
- // 标题栏
7019
- var header = document.createElement('div');
7020
- header.className = 'cl-tools-collapse-header';
7021
-
7022
- var headerIcon = document.createElement('span');
7023
- headerIcon.className = 'cl-tools-collapse-header-icon';
7024
- headerIcon.textContent = '▼';
7025
-
7026
- var headerTitle = document.createElement('span');
7027
- headerTitle.className = 'cl-tools-collapse-header-title';
7028
-
7029
- // 从 chunks 提取步骤
7030
- var steps = [];
7031
- for (var i = 0; i < model.chunks.length; i++) {
7032
- var chunk = model.chunks[i];
7033
- if (chunk.type === 'step') {
7034
- steps.push({ title: chunk.title, detail: chunk.detail || '' });
7035
- }
7036
- }
7037
-
7038
- // 合并预缓冲步骤(WS 先于 Lit 渲染到达时)
7039
- if (model._bufferedSteps && model._bufferedSteps.length > 0) {
7040
- steps = model._bufferedSteps;
7041
- }
7042
- if (typeof _cl_compactThoughtSteps === 'function') {
7043
- steps = _cl_compactThoughtSteps(steps);
7044
- }
7045
-
7046
- headerTitle.textContent = '思考中...';
7047
-
7048
- header.appendChild(headerIcon);
7049
- header.appendChild(headerTitle);
7050
-
7051
- // 步骤列表(可折叠)
7052
- var body = document.createElement('div');
7053
- body.className = 'cl-tools-collapse-body cl-expanded';
7054
-
7055
- for (var si = 0; si < steps.length; si++) {
7056
- var isLatest = (si === steps.length - 1);
7057
- var stepEl = _clCreateStepElement(steps[si], isLatest);
7058
- body.appendChild(stepEl);
7059
- }
7060
-
7061
- // 折叠/展开
7062
- header.style.cursor = 'pointer';
7063
- header.addEventListener('click', function(evt) {
7064
- evt.stopPropagation(); // 防止外层容器拦截
7065
- var isExpanded = body.classList.contains('cl-expanded');
7066
- console.log('[cl-exec] 🖱️ header click: expanded=' + isExpanded + ' bodyChildren=' + body.childElementCount);
7067
- if (isExpanded) {
7068
- body.classList.remove('cl-expanded');
7069
- body.classList.add('cl-collapsed');
7070
- headerIcon.classList.add('cl-collapsed');
7071
- if (typeof _cl_setCardUiState === 'function') {
7072
- _cl_setCardUiState(model, { stepsExpanded: false });
7073
- }
7074
- } else {
7075
- body.classList.remove('cl-collapsed');
7076
- body.classList.add('cl-expanded');
7077
- headerIcon.classList.remove('cl-collapsed');
7078
- if (typeof _cl_setCardUiState === 'function') {
7079
- _cl_setCardUiState(model, { stepsExpanded: true });
7080
- }
7081
- }
7082
- });
7083
-
7084
- stepsSection.appendChild(header);
7085
- stepsSection.appendChild(body);
7086
- content.appendChild(stepsSection);
7450
+ // ── Agent 详情卡片(Figma 346:181) ──
7451
+ try {
7452
+ var detailCard = _clCreateAgentDetailCard(model);
7453
+ content.appendChild(detailCard);
7454
+ } catch(e) {
7455
+ console.warn('[cl-exec] detail card creation failed:', e);
7456
+ }
7457
+
7458
+ // ── 进度文字(Figma 346:253) — 动态读取 response.progress?.safe_status_message ──
7459
+ var progressRow = document.createElement('div');
7460
+ progressRow.className = 'cl-exec-progress-row';
7461
+ var progressText = document.createElement('p');
7462
+ progressText.className = 'cl-exec-progress-text';
7463
+ progressText.textContent = (model.progressMessage || model.rawText || '').trim() || '思考中,正在了解你的需求';
7464
+ progressRow.appendChild(progressText);
7465
+ // 箭头图标
7466
+ var arrowIcon = document.createElement('span');
7467
+ arrowIcon.className = 'cl-exec-progress-arrow';
7468
+ arrowIcon.innerHTML = '<svg width="14" height="14" viewBox="0 0 14 14" fill="none"><path d="M5 4L9 7L5 10" stroke="#555" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/></svg>';
7469
+ progressRow.appendChild(arrowIcon);
7470
+ content.appendChild(progressRow);
7471
+ if (model.status === 'completed') progressRow.style.display = 'none';
7087
7472
 
7088
7473
  // ── 异步更新真实 Agent 身份 ──
7089
7474
  if ((model.agentId || model.agentName) && typeof fetchAgentById === 'function') {
7090
7475
  fetchAgentById(model.agentId, model.agentName).then(function(agent) {
7091
7476
  if (!agent) return;
7092
- var pa = container.querySelector('.cl-agent-pill-avatar');
7093
- var pn = container.querySelector('.cl-agent-pill-name');
7094
- if (pa && typeof avatarUrl === 'function') {
7095
- var resolvedAvatar = avatarUrl(agent);
7096
- console.log('[cl-diag][pill] fetch-update agentId=' + JSON.stringify(model.agentId)
7097
- + ' name=' + JSON.stringify(agent.name || model.agentName)
7098
- + ' src=' + JSON.stringify(resolvedAvatar));
7099
- pa.src = resolvedAvatar;
7100
- pa.style.display = '';
7101
- }
7102
- _clSetAgentPillName(container, agent.name || model.agentName);
7477
+ var avatarEl = container.querySelector('.cl-exec-agent-avatar');
7478
+ var nameEl = container.querySelector('.cl-exec-agent-name');
7479
+ var bioEl = container.querySelector('.cl-exec-agent-bio');
7480
+ // avatar 保持 icon.png,不覆盖
7481
+ if (nameEl) nameEl.textContent = agent.name || model.agentName;
7482
+ if (bioEl && (agent.bio || agent.description)) bioEl.textContent = agent.bio || agent.description;
7483
+ var starsEl = container.querySelector('.cl-exec-star-count');
7484
+ if (starsEl && agent.claws) starsEl.textContent = _cl_formatStarCount(agent.claws);
7485
+ if (starsEl && agent.stars && !agent.claws) starsEl.textContent = _cl_formatStarCount(agent.stars);
7103
7486
  _clSetOpenAgentHeaderAgent(container, agent.name || model.agentName);
7104
7487
  }).catch(function() {});
7105
7488
  }
@@ -7108,40 +7491,103 @@ function _clRenderExecutionCard(model) {
7108
7491
  _cl_applyCardUiState(container, model);
7109
7492
  }
7110
7493
 
7111
- console.log('[cl-exec] execution card built: steps=' + steps.length);
7494
+ console.log('[cl-exec] execution card built');
7112
7495
  return container;
7113
7496
  }
7114
7497
 
7498
+ // ── Agent 详情卡片(Figma 266:11136) ──
7499
+ function _clCreateAgentDetailCard(model) {
7500
+ var card = document.createElement('div');
7501
+ card.className = 'cl-exec-detail-card';
7502
+
7503
+ var row = document.createElement('div');
7504
+ row.className = 'cl-exec-detail-row';
7505
+
7506
+ // 头像 68×68
7507
+ var avatar = document.createElement('img');
7508
+ avatar.className = 'cl-exec-agent-avatar';
7509
+ avatar.alt = model.agentName || '';
7510
+ avatar.src = './icon.png';
7511
+ avatar.onerror = function() { this.style.visibility = 'hidden'; };
7512
+ row.appendChild(avatar);
7513
+
7514
+ // 信息列
7515
+ var info = document.createElement('div');
7516
+ info.className = 'cl-exec-detail-info';
7517
+
7518
+ // 名称行:名称 + 星级徽章
7519
+ var nameRow = document.createElement('div');
7520
+ nameRow.className = 'cl-exec-name-row';
7521
+
7522
+ var nameEl = document.createElement('p');
7523
+ nameEl.className = 'cl-exec-agent-name';
7524
+ nameEl.textContent = model.agentName || 'Remote Agent';
7525
+ nameRow.appendChild(nameEl);
7526
+
7527
+ // 星级徽章
7528
+ var starBadge = document.createElement('div');
7529
+ starBadge.className = 'cl-exec-star-badge';
7530
+ var starSvgOutline = '<svg width="14" height="14" viewBox="0 0 14 14" fill="none"><path d="M7 1.16L8.356 5.33H12.78L9.195 7.94L10.565 12.1L7 9.51L3.435 12.1L4.805 7.94L1.22 5.33H5.644L7 1.16Z" stroke="#999" stroke-width="0.8"/></svg>';
7531
+ starBadge.innerHTML = starSvgOutline +
7532
+ '<span class="cl-exec-star-count">' + (model.agentStars || '3.2万') + '</span>';
7533
+ nameRow.appendChild(starBadge);
7534
+ info.appendChild(nameRow);
7535
+
7536
+ var bioEl = document.createElement('p');
7537
+ bioEl.className = 'cl-exec-agent-bio';
7538
+ bioEl.textContent = model.agentBio || '智能行程规划·定制每日行程·优化路线安排';
7539
+ info.appendChild(bioEl);
7540
+
7541
+ row.appendChild(info);
7542
+ card.appendChild(row);
7543
+
7544
+ return card;
7545
+ }
7546
+
7115
7547
  // ── 共用 DOM 构建函数 ──
7116
7548
 
7117
7549
  function _clCreateOpenAgentHeader(model) {
7118
7550
  var header = document.createElement('div');
7119
7551
  header.className = 'cl-openagent-header';
7552
+ if (model._outputMode) header.classList.add('cl-openagent-header--output');
7120
7553
  header.style.cursor = 'pointer';
7121
7554
 
7122
- var caret = document.createElement('span');
7123
- caret.className = 'cl-openagent-header-caret';
7124
- caret.textContent = '';
7125
- header.appendChild(caret);
7126
-
7127
- var icon = document.createElement('span');
7128
- icon.className = 'cl-openagent-header-icon';
7129
- icon.setAttribute('aria-hidden', 'true');
7130
- header.appendChild(icon);
7131
-
7132
- var title = document.createElement('div');
7133
- title.className = 'cl-openagent-header-title';
7134
-
7135
- var primary = document.createElement('span');
7136
- primary.className = 'cl-openagent-header-primary';
7137
- primary.textContent = 'OpenAgent @' + (model.agentName || 'Remote Agent');
7138
- title.appendChild(primary);
7139
-
7140
- var secondary = document.createElement('span');
7141
- secondary.className = 'cl-openagent-header-secondary';
7142
- title.appendChild(secondary);
7143
-
7144
- header.appendChild(title);
7555
+ // 展开/收起图标
7556
+ var expandIcon = document.createElement('span');
7557
+ expandIcon.className = 'cl-openagent-expand-icon';
7558
+ // 收起态三角(向右)
7559
+ expandIcon.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15" fill="none"><path d="M9.75 6.79978C10.0833 6.99223 10.0833 7.47336 9.75 7.66581L6.75 9.39786C6.41667 9.59031 6 9.34975 6 8.96485L6 5.50075C6 5.11585 6.41667 4.87528 6.75 5.06773L9.75 6.79978Z" fill="#666666"/></svg>';
7560
+ // 展开态三角(向下)
7561
+ var expandedSvg = '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15" fill="none"><path d="M8.43313 8.98291C8.24068 9.31624 7.75955 9.31624 7.5671 8.98291L5.83505 5.98291C5.6426 5.64958 5.88316 5.23291 6.26806 5.23291L9.73216 5.23291C10.1171 5.23291 10.3576 5.64958 10.1652 5.98291L8.43313 8.98291Z" fill="#666666"/></svg>';
7562
+ header.appendChild(expandIcon);
7563
+
7564
+ // OASN 小图标
7565
+ var oasnBadge = document.createElement('span');
7566
+ oasnBadge.className = 'cl-openagent-badge';
7567
+ oasnBadge.style.backgroundImage = "url(./icon.png)";
7568
+ oasnBadge.style.backgroundSize = 'cover';
7569
+ header.appendChild(oasnBadge);
7570
+
7571
+ // 文字行
7572
+ var textRow = document.createElement('span');
7573
+ textRow.className = 'cl-openagent-text-row';
7574
+
7575
+ var labelOpenAgent = document.createElement('span');
7576
+ labelOpenAgent.className = 'cl-openagent-label';
7577
+ labelOpenAgent.textContent = 'OpenAgent';
7578
+ textRow.appendChild(labelOpenAgent);
7579
+
7580
+ var labelAgent = document.createElement('span');
7581
+ labelAgent.className = 'cl-openagent-agent';
7582
+ labelAgent.textContent = '@' + (model.agentName || 'Remote Agent');
7583
+ textRow.appendChild(labelAgent);
7584
+
7585
+ var labelStatus = document.createElement('span');
7586
+ labelStatus.className = 'cl-openagent-status';
7587
+ labelStatus.textContent = (model.status === 'completed') ? '执行已完成' : '正在执行任务';
7588
+ textRow.appendChild(labelStatus);
7589
+
7590
+ header.appendChild(textRow);
7145
7591
 
7146
7592
  // 点击 header 折叠/展开卡片内容
7147
7593
  header.addEventListener('click', function(e) {
@@ -7151,7 +7597,10 @@ function _clCreateOpenAgentHeader(model) {
7151
7597
  var content = card.querySelector('.cl-thought-chain-content');
7152
7598
  if (!content) return;
7153
7599
  var isCollapsed = content.classList.toggle('cl-content-collapsed');
7154
- caret.textContent = isCollapsed ? '▶' : '▼';
7600
+ // 切换图标
7601
+ expandIcon.innerHTML = isCollapsed
7602
+ ? '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15" fill="none"><path d="M9.75 6.79978C10.0833 6.99223 10.0833 7.47336 9.75 7.66581L6.75 9.39786C6.41667 9.59031 6 9.34975 6 8.96485L6 5.50075C6 5.11585 6.41667 4.87528 6.75 5.06773L9.75 6.79978Z" fill="#666666"/></svg>'
7603
+ : '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15" fill="none"><path d="M8.43313 8.98291C8.24068 9.31624 7.75955 9.31624 7.5671 8.98291L5.83505 5.98291C5.6426 5.64958 5.88316 5.23291 6.26806 5.23291L9.73216 5.23291C10.1171 5.23291 10.3576 5.64958 10.1652 5.98291L8.43313 8.98291Z" fill="#666666"/></svg>';
7155
7604
  if (typeof _cl_setCardUiState === 'function') {
7156
7605
  _cl_setCardUiState(model, { contentCollapsed: isCollapsed });
7157
7606
  }
@@ -7161,8 +7610,8 @@ function _clCreateOpenAgentHeader(model) {
7161
7610
  }
7162
7611
 
7163
7612
  function _clSetOpenAgentHeaderAgent(container, agentName) {
7164
- var title = container && container.querySelector('.cl-openagent-header-primary');
7165
- if (title) title.textContent = 'OpenAgent @' + (agentName || 'Remote Agent');
7613
+ var label = container && container.querySelector('.cl-openagent-agent');
7614
+ if (label) label.textContent = '@' + (agentName || 'Remote Agent');
7166
7615
  }
7167
7616
 
7168
7617
  function _clCreateAgentPill(agentName, agentId, agentAvatar) {
@@ -7184,7 +7633,7 @@ function _clCreateAgentPill(agentName, agentId, agentAvatar) {
7184
7633
  console.log('[cl-diag][pill] create agentName=' + JSON.stringify(agentName || '')
7185
7634
  + ' agentId=' + JSON.stringify(agentId || '')
7186
7635
  + ' src=' + JSON.stringify(avatar.getAttribute('src')));
7187
- avatar.onerror = function() { this.style.display = 'none'; };
7636
+ avatar.onerror = function() { this.style.visibility = 'hidden'; };
7188
7637
  pill.appendChild(avatar);
7189
7638
 
7190
7639
  var nameEl = document.createElement('span');
@@ -7243,6 +7692,224 @@ function _clCreateStepElement(step, isLatest) {
7243
7692
  return item;
7244
7693
  }
7245
7694
 
7695
+
7696
+ // ── 动态更新 header 状态文字 ──
7697
+ function _clUpdateAgentStatusText(cardNode, status) {
7698
+ var label = cardNode && cardNode.querySelector('.cl-openagent-status');
7699
+ if (label) label.textContent = (status === 'completed') ? '执行已完成' : '正在执行任务';
7700
+ var progressRow = cardNode && cardNode.querySelector('.cl-exec-progress-row');
7701
+ if (progressRow) progressRow.style.display = (status === 'completed') ? 'none' : '';
7702
+ }
7703
+
7704
+ function _cl_formatStarCount(count) {
7705
+ var n = Number(count);
7706
+ if (!isFinite(n)) return '3.2万';
7707
+ if (n >= 10000) return (n / 10000).toFixed(1).replace(/.0$/, '') + '万';
7708
+ if (n >= 1000) return (n / 1000).toFixed(1).replace(/.0$/, '') + 'k';
7709
+ return String(Math.floor(n));
7710
+ }
7711
+
7712
+ // ═══════════════════════════════════════════════════════════════
7713
+ // V2 执行卡片渲染(2026.6.9+ 新版 UI)
7714
+ // ═══════════════════════════════════════════════════════════════
7715
+
7716
+ function _clRenderExecutionCardV2(model) {
7717
+ var container = document.createElement('div');
7718
+ container.className = 'cl-remote-agent-card cl-thought-chain cl-exec-v2';
7719
+ if (CL && typeof CL.diagMarkCard === 'function') {
7720
+ CL.diagMarkCard(container, 'execution', { tcid: model.toolCallId || '' });
7721
+ }
7722
+
7723
+ container.appendChild(_clCreateOpenAgentHeaderV2(model));
7724
+
7725
+ var content = document.createElement('div');
7726
+ content.className = 'cl-thought-chain-content cl-thought-chain-content--execution cl-content-collapsed';
7727
+ container.appendChild(content);
7728
+
7729
+ // ── Agent 详情卡片 V2 ──
7730
+ try {
7731
+ var detailCard = _clCreateAgentDetailCardV2(model);
7732
+ content.appendChild(detailCard);
7733
+ } catch(e) {
7734
+ console.warn('[cl-exec-v2] detail card creation failed:', e);
7735
+ }
7736
+
7737
+ // ── 进度文字 V2 ──
7738
+ var progressRow = document.createElement('div');
7739
+ progressRow.className = 'cl-exec-progress-row cl-exec-progress-row-v2';
7740
+ var progressText = document.createElement('p');
7741
+ progressText.className = 'cl-exec-progress-text';
7742
+ progressText.textContent = (model.progressMessage || model.rawText || '').trim() || '思考中,正在了解你的需求';
7743
+ progressRow.appendChild(progressText);
7744
+ var arrowIcon = document.createElement('span');
7745
+ arrowIcon.className = 'cl-exec-progress-arrow';
7746
+ arrowIcon.innerHTML = '<svg width="14" height="14" viewBox="0 0 14 14" fill="none"><path d="M5 4L9 7L5 10" stroke="#555" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/></svg>';
7747
+ progressRow.appendChild(arrowIcon);
7748
+ content.appendChild(progressRow);
7749
+ if (model.status === 'completed') progressRow.style.display = 'none';
7750
+
7751
+ // ── 步骤列表容器(供 _cl_updateCardSteps 使用)──
7752
+ var stepsHeader = document.createElement('div');
7753
+ stepsHeader.className = 'cl-tools-collapse-header cl-tools-collapse-header-v2';
7754
+ var stepsHeaderIcon = document.createElement('span');
7755
+ stepsHeaderIcon.className = 'cl-tools-collapse-header-icon';
7756
+ stepsHeaderIcon.textContent = '▼';
7757
+ stepsHeader.appendChild(stepsHeaderIcon);
7758
+ var stepsHeaderTitle = document.createElement('span');
7759
+ stepsHeaderTitle.className = 'cl-tools-collapse-header-title cl-tools-collapse-header-title-v2';
7760
+ stepsHeaderTitle.textContent = '思考中...';
7761
+ stepsHeader.appendChild(stepsHeaderTitle);
7762
+ content.appendChild(stepsHeader);
7763
+
7764
+ var stepsBody = document.createElement('div');
7765
+ stepsBody.className = 'cl-tools-collapse-body cl-tools-collapse-body-v2 cl-expanded';
7766
+ content.appendChild(stepsBody);
7767
+
7768
+ // ─ Footer(Figma: -由xxx完成 + 星级)──
7769
+ var footer = document.createElement('div');
7770
+ footer.className = 'cl-output-footer cl-output-footer-v2';
7771
+ footer.innerHTML = '<span class="cl-output-footer-text">-由' + (model.agentName || 'Remote Agent') + '完成</span>'
7772
+ + '<span class="cl-output-footer-star"><svg width="14" height="14" viewBox="0 0 14 14" fill="none"><path d="M7 1.16L8.356 5.33H12.78L9.195 7.94L10.565 12.1L7 9.51L3.435 12.1L4.805 7.94L1.22 5.33H5.644L7 1.16Z" stroke="#999" stroke-width="0.8"/></svg></span>'
7773
+ + '<span class="cl-output-footer-count">' + (model.agentStars || '3.2万') + '</span>';
7774
+ container.appendChild(footer);
7775
+
7776
+ // ── 异步更新真实 Agent 身份 ──
7777
+ if ((model.agentId || model.agentName) && typeof fetchAgentById === 'function') {
7778
+ fetchAgentById(model.agentId, model.agentName).then(function(agent) {
7779
+ if (!agent) return;
7780
+ var avatarEl = container.querySelector('.cl-exec-agent-avatar-v2');
7781
+ var nameEl = container.querySelector('.cl-exec-agent-name-v2');
7782
+ var bioEl = container.querySelector('.cl-exec-agent-bio-v2');
7783
+ if (nameEl) nameEl.textContent = agent.name || model.agentName;
7784
+ if (bioEl && (agent.bio || agent.description)) bioEl.textContent = agent.bio || agent.description;
7785
+ var starsEl = container.querySelector('.cl-exec-star-count-v2');
7786
+ if (starsEl && agent.claws) starsEl.textContent = _cl_formatStarCount(agent.claws);
7787
+ if (starsEl && agent.stars && !agent.claws) starsEl.textContent = _cl_formatStarCount(agent.stars);
7788
+ }).catch(function() {});
7789
+ }
7790
+
7791
+ if (typeof _cl_applyCardUiState === 'function') {
7792
+ _cl_applyCardUiState(container, model);
7793
+ }
7794
+
7795
+ console.log('[cl-exec-v2] execution card built');
7796
+ return container;
7797
+ }
7798
+
7799
+ // ── V2 Header(粉色背景 + 圆形头像 + 无 @agentName)──
7800
+ function _clCreateOpenAgentHeaderV2(model) {
7801
+ var header = document.createElement('div');
7802
+ header.className = 'cl-openagent-header cl-openagent-header-v2';
7803
+ if (model._outputMode) header.classList.add('cl-openagent-header--output');
7804
+ header.style.cursor = 'pointer';
7805
+
7806
+ // 展开/收起图标
7807
+ var expandIcon = document.createElement('span');
7808
+ expandIcon.className = 'cl-openagent-expand-icon';
7809
+ expandIcon.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15" fill="none"><path d="M9.75 6.79978C10.0833 6.99223 10.0833 7.47336 9.75 7.66581L6.75 9.39786C6.41667 9.59031 6 9.34975 6 8.96485L6 5.50075C6 5.11585 6.41667 4.87528 6.75 5.06773L9.75 6.79978Z" fill="#666666"/></svg>';
7810
+ var expandedSvg = '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15" fill="none"><path d="M8.43313 8.98291C8.24068 9.31624 7.75955 9.31624 7.5671 8.98291L5.83505 5.98291C5.6426 5.64958 5.88316 5.23291 6.26806 5.23291L9.73216 5.23291C10.1171 5.23291 10.3576 5.64958 10.1652 5.98291L8.43313 8.98291Z" fill="#666666"/></svg>';
7811
+ header.appendChild(expandIcon);
7812
+
7813
+ // 圆形灰色头像(替代小徽章)
7814
+ var avatar = document.createElement('span');
7815
+ avatar.className = 'cl-openagent-avatar-v2';
7816
+ header.appendChild(avatar);
7817
+
7818
+ // 文字行:OpenAgent + 状态文字(去掉 @agentName)
7819
+ var textRow = document.createElement('span');
7820
+ textRow.className = 'cl-openagent-text-row';
7821
+
7822
+ var labelOpenAgent = document.createElement('span');
7823
+ labelOpenAgent.className = 'cl-openagent-label';
7824
+ labelOpenAgent.textContent = 'OpenAgent';
7825
+ textRow.appendChild(labelOpenAgent);
7826
+
7827
+ var labelStatus = document.createElement('span');
7828
+ labelStatus.className = 'cl-openagent-status';
7829
+ labelStatus.textContent = (model.status === 'completed') ? '执行已完成' : '正在执行任务';
7830
+ textRow.appendChild(labelStatus);
7831
+
7832
+ header.appendChild(textRow);
7833
+
7834
+ // 点击 header 折叠/展开卡片内容
7835
+ header.addEventListener('click', function(e) {
7836
+ e.stopPropagation();
7837
+ var card = header.closest('.cl-remote-agent-card');
7838
+ if (!card) return;
7839
+ var content = card.querySelector('.cl-thought-chain-content');
7840
+ if (!content) return;
7841
+ var isCollapsed = content.classList.toggle('cl-content-collapsed');
7842
+ expandIcon.innerHTML = isCollapsed
7843
+ ? '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15" fill="none"><path d="M9.75 6.79978C10.0833 6.99223 10.0833 7.47336 9.75 7.66581L6.75 9.39786C6.41667 9.59031 6 9.34975 6 8.96485L6 5.50075C6 5.11585 6.41667 4.87528 6.75 5.06773L9.75 6.79978Z" fill="#666666"/></svg>'
7844
+ : expandedSvg;
7845
+ if (typeof _cl_setCardUiState === 'function') {
7846
+ _cl_setCardUiState(model, { contentCollapsed: isCollapsed });
7847
+ }
7848
+ });
7849
+
7850
+ return header;
7851
+ }
7852
+
7853
+ // ─ V2 Agent 详情卡片(大头像 + 右置星级 + 网格点背景)──
7854
+ function _clCreateAgentDetailCardV2(model) {
7855
+ var card = document.createElement('div');
7856
+ card.className = 'cl-exec-detail-card cl-exec-detail-card-v2';
7857
+
7858
+ var row = document.createElement('div');
7859
+ row.className = 'cl-exec-detail-row cl-exec-detail-row-v2';
7860
+
7861
+ // 大头像 80×80
7862
+ var avatar = document.createElement('img');
7863
+ avatar.className = 'cl-exec-agent-avatar cl-exec-agent-avatar-v2';
7864
+ avatar.alt = model.agentName || '';
7865
+ avatar.src = './icon.png';
7866
+ avatar.onerror = function() { this.style.visibility = 'hidden'; };
7867
+ row.appendChild(avatar);
7868
+
7869
+ // 信息列
7870
+ var info = document.createElement('div');
7871
+ info.className = 'cl-exec-detail-info cl-exec-detail-info-v2';
7872
+
7873
+ // 名称(无星级徽章,星级右置到卡片右上角)
7874
+ var nameEl = document.createElement('p');
7875
+ nameEl.className = 'cl-exec-agent-name cl-exec-agent-name-v2';
7876
+ nameEl.textContent = model.agentName || 'Remote Agent';
7877
+ info.appendChild(nameEl);
7878
+
7879
+ // 描述文字
7880
+ var bioEl = document.createElement('p');
7881
+ bioEl.className = 'cl-exec-agent-bio cl-exec-agent-bio-v2';
7882
+ bioEl.textContent = model.agentBio || '智能行程规划·定制每日行程·优化路线安排';
7883
+ info.appendChild(bioEl);
7884
+
7885
+ row.appendChild(info);
7886
+ card.appendChild(row);
7887
+
7888
+ // 星级徽章右置到卡片右上角
7889
+ var starBadge = document.createElement('div');
7890
+ starBadge.className = 'cl-exec-star-badge cl-exec-star-badge-v2';
7891
+ var starSvgOutline = '<svg width="14" height="14" viewBox="0 0 14 14" fill="none"><path d="M7 1.16L8.356 5.33H12.78L9.195 7.94L10.565 12.1L7 9.51L3.435 12.1L4.805 7.94L1.22 5.33H5.644L7 1.16Z" stroke="#999" stroke-width="0.8"/></svg>';
7892
+ starBadge.innerHTML = starSvgOutline +
7893
+ '<span class="cl-exec-star-count cl-exec-star-count-v2">' + (model.agentStars || '3.2万') + '</span>';
7894
+ card.appendChild(starBadge);
7895
+
7896
+ return card;
7897
+ }
7898
+
7899
+ // ── V2 状态文字更新 ──
7900
+ function _clUpdateAgentStatusTextV2(cardNode, status) {
7901
+ var label = cardNode && cardNode.querySelector('.cl-openagent-status');
7902
+ if (label) label.textContent = (status === 'completed') ? '执行已完成' : '正在执行任务';
7903
+ // 进度文字行:完成后隐藏
7904
+ var progressRow = cardNode && cardNode.querySelector('.cl-exec-progress-row-v2');
7905
+ if (progressRow) progressRow.style.display = (status === 'completed') ? 'none' : '';
7906
+ // 步骤列表:完成后隐藏
7907
+ var stepsBody = cardNode && cardNode.querySelector('.cl-tools-collapse-body-v2');
7908
+ if (stepsBody) stepsBody.style.display = (status === 'completed') ? 'none' : '';
7909
+ var stepsHeader = cardNode && cardNode.querySelector('.cl-tools-collapse-header-v2');
7910
+ if (stepsHeader) stepsHeader.style.display = (status === 'completed') ? 'none' : '';
7911
+ }
7912
+
7246
7913
  // ════════════════════════════════════════════════════════════════
7247
7914
  // MODULE: remote-agent/markdown-renderer.js
7248
7915
  // ════════════════════════════════════════════════════════════════
@@ -7504,6 +8171,162 @@ function _clRenderOutputMarkdown(text) {
7504
8171
  return result;
7505
8172
  }
7506
8173
 
8174
+ // ════════════════════════════════════════════════════════════════
8175
+ // MODULE: remote-agent/media-links.js
8176
+ // ════════════════════════════════════════════════════════════════
8177
+
8178
+ // ── OpenAgent Media Links — toolResult MEDIA: protocol renderer ──
8179
+ //
8180
+ // OpenClaw host parses MEDIA: links in assistant text, but remote-agent
8181
+ // toolResult text is rendered through the plugin card path. Keep this parser
8182
+ // local to the card so OASN artifacts become visible downloads.
8183
+
8184
+ function _clExtractOpenagentMediaLinksFromText(rawText) {
8185
+ var value = String(rawText || '');
8186
+ var links = [];
8187
+ var seen = Object.create(null);
8188
+
8189
+ function addUrl(rawUrl) {
8190
+ var url = _clNormalizeOpenagentMediaUrl(rawUrl);
8191
+ if (!url || seen[url]) return;
8192
+ seen[url] = true;
8193
+
8194
+ var fileName = _clGetOpenagentMediaFileName(url);
8195
+ links.push({
8196
+ url: url,
8197
+ fileName: fileName,
8198
+ extension: _clInferOpenagentMediaExtension(fileName),
8199
+ });
8200
+ }
8201
+
8202
+ var re = /^\s*MEDIA:\s*(\S+)\s*$/gm;
8203
+ var match;
8204
+
8205
+ while ((match = re.exec(value)) !== null) {
8206
+ addUrl(match[1]);
8207
+ }
8208
+
8209
+ var markdownRe = /\[[^\]]+\]\((https?:\/\/[^)\s]+|\/[^)\s]+)\)/g;
8210
+ while ((match = markdownRe.exec(value)) !== null) {
8211
+ addUrl(match[1]);
8212
+ }
8213
+
8214
+ return links;
8215
+ }
8216
+
8217
+ function _clExtractOpenagentMediaLinksFromModel(model) {
8218
+ var allText = [];
8219
+ if (model && model.rawText) allText.push(model.rawText);
8220
+ var chunks = model && Array.isArray(model.chunks) ? model.chunks : [];
8221
+ for (var i = 0; i < chunks.length; i++) {
8222
+ if (chunks[i] && chunks[i].text) allText.push(chunks[i].text);
8223
+ }
8224
+ return _clExtractOpenagentMediaLinksFromText(allText.join('\n'));
8225
+ }
8226
+
8227
+ function _clNormalizeOpenagentMediaUrl(rawUrl) {
8228
+ var value = String(rawUrl || '').trim();
8229
+ if (!value) return '';
8230
+ value = value.replace(/^[`'"]+/, '').replace(/[`'".,;)\]]+$/, '');
8231
+
8232
+ if (value.charAt(0) === '/') return value;
8233
+
8234
+ try {
8235
+ var parsed = new URL(value);
8236
+ if (parsed.protocol === 'http:' || parsed.protocol === 'https:') return value;
8237
+ } catch (e) {}
8238
+
8239
+ return '';
8240
+ }
8241
+
8242
+ function _clGetOpenagentMediaFileName(url) {
8243
+ var pathValue = '';
8244
+ try {
8245
+ var base = (typeof window !== 'undefined' && window.location && window.location.href)
8246
+ ? window.location.href
8247
+ : 'http://127.0.0.1/';
8248
+ pathValue = new URL(url, base).pathname || '';
8249
+ } catch (e) {
8250
+ pathValue = String(url || '').split('?')[0] || '';
8251
+ }
8252
+
8253
+ var parts = pathValue.split('/');
8254
+ var fileName = parts[parts.length - 1] || 'artifact';
8255
+ try {
8256
+ fileName = decodeURIComponent(fileName);
8257
+ } catch (e) {}
8258
+ return fileName || 'artifact';
8259
+ }
8260
+
8261
+ function _clInferOpenagentMediaExtension(fileName) {
8262
+ var match = String(fileName || '').toLowerCase().match(/\.([a-z0-9]{1,12})$/);
8263
+ return match ? match[1] : '';
8264
+ }
8265
+
8266
+ function _clStripOpenagentMediaLines(rawText) {
8267
+ return String(rawText || '')
8268
+ .split(/\r?\n/)
8269
+ .filter(function(line) { return !/^\s*MEDIA:\s*/.test(line); })
8270
+ .join('\n')
8271
+ .trim();
8272
+ }
8273
+
8274
+ function _clCreateOpenagentMediaLinksSection(links) {
8275
+ if (!Array.isArray(links) || links.length === 0) return null;
8276
+
8277
+ var section = document.createElement('div');
8278
+ section.className = 'cl-openagent-media-links';
8279
+
8280
+ for (var i = 0; i < links.length; i++) {
8281
+ var link = links[i] || {};
8282
+ if (!link.url) continue;
8283
+
8284
+ var anchor = document.createElement('a');
8285
+ anchor.className = 'cl-openagent-media-link';
8286
+ anchor.href = link.url;
8287
+ anchor.target = '_blank';
8288
+ anchor.rel = 'noopener noreferrer';
8289
+ anchor.download = link.fileName || '';
8290
+ anchor.title = link.fileName || link.url;
8291
+
8292
+ var icon = document.createElement('span');
8293
+ icon.className = 'cl-openagent-media-link-icon';
8294
+ icon.textContent = _clGetOpenagentMediaIconText(link.extension);
8295
+ anchor.appendChild(icon);
8296
+
8297
+ var text = document.createElement('span');
8298
+ text.className = 'cl-openagent-media-link-text';
8299
+ text.textContent = _clGetOpenagentMediaActionText(link.extension);
8300
+ anchor.appendChild(text);
8301
+
8302
+ var file = document.createElement('span');
8303
+ file.className = 'cl-openagent-media-link-file';
8304
+ file.textContent = link.fileName || 'artifact';
8305
+ anchor.appendChild(file);
8306
+
8307
+ section.appendChild(anchor);
8308
+ }
8309
+
8310
+ return section.childNodes.length > 0 ? section : null;
8311
+ }
8312
+
8313
+ function _clGetOpenagentMediaActionText(extension) {
8314
+ var ext = String(extension || '').toUpperCase();
8315
+ if (!ext) return '下载附件';
8316
+ return '下载 ' + ext;
8317
+ }
8318
+
8319
+ function _clGetOpenagentMediaIconText(extension) {
8320
+ extension = String(extension || '').toLowerCase();
8321
+ if (extension === 'pptx' || extension === 'ppt') return 'P';
8322
+ if (extension === 'docx' || extension === 'doc') return 'D';
8323
+ if (extension === 'xlsx' || extension === 'xls' || extension === 'csv') return 'X';
8324
+ if (extension === 'json') return '{}';
8325
+ if (extension === 'md' || extension === 'txt') return 'T';
8326
+ if (extension === 'zip') return 'Z';
8327
+ return 'F';
8328
+ }
8329
+
7507
8330
  // ════════════════════════════════════════════════════════════════
7508
8331
  // MODULE: remote-agent/output-card.js
7509
8332
  // ════════════════════════════════════════════════════════════════
@@ -7521,24 +8344,43 @@ function _clRenderOutputMarkdown(text) {
7521
8344
  // UI 结构复用 shared thought-chain styles;数据来源是 RenderHook model。
7522
8345
 
7523
8346
  function _clRenderOutputCard(model, onOpenSidebar) {
8347
+ var mediaLinks = typeof _clExtractOpenagentMediaLinksFromModel === 'function'
8348
+ ? _clExtractOpenagentMediaLinksFromModel(model)
8349
+ : [];
8350
+
7524
8351
  // ── 从 chunks 提取最终结果。SSE 思考链只由 call/execution card 展示,避免重复。──
7525
8352
  var resultTexts = [];
7526
8353
  for (var i = 0; i < model.chunks.length; i++) {
7527
8354
  var chunk = model.chunks[i];
7528
8355
  if (chunk.type === 'result') {
7529
- if (_clShouldRenderOutputText(chunk.text)) resultTexts.push(chunk.text);
8356
+ var resultText = typeof _clStripOpenagentMediaLines === 'function'
8357
+ ? _clStripOpenagentMediaLines(chunk.text)
8358
+ : chunk.text;
8359
+ if (_clShouldRenderOutputText(resultText)) resultTexts.push(resultText);
7530
8360
  } else if (chunk.type === 'text') {
7531
8361
  // 远端 Agent 最终回复是普通文本(toolResult(reply.content)),
7532
8362
  // chunk-parser 归为 type='text',也应作为最终结果显示
7533
- if (_clShouldRenderOutputText(chunk.text)) resultTexts.push(chunk.text);
8363
+ var textChunk = typeof _clStripOpenagentMediaLines === 'function'
8364
+ ? _clStripOpenagentMediaLines(chunk.text)
8365
+ : chunk.text;
8366
+ if (_clShouldRenderOutputText(textChunk)) resultTexts.push(textChunk);
7534
8367
  }
7535
8368
  }
7536
8369
 
7537
- if (resultTexts.length === 0) {
8370
+ // ── V2 版本判断 ──
8371
+ var isV2 = typeof _clIsHostVersionGte === 'function' && _clIsHostVersionGte('2026.6.9');
8372
+
8373
+ if (resultTexts.length === 0 && mediaLinks.length === 0) {
7538
8374
  var placeholder = document.createElement('span');
7539
8375
  placeholder.className = 'cl-remote-agent-card cl-remote-agent-output-placeholder';
7540
8376
  placeholder.style.display = 'none';
7541
8377
  placeholder.__clEmptyOutput = true;
8378
+ // 防止 OpenClaw native 代码读 .textContent 报 undefined.trim()
8379
+ var hiddenText = document.createElement('span');
8380
+ hiddenText.className = 'chat-text';
8381
+ hiddenText.style.display = 'none';
8382
+ hiddenText.textContent = '';
8383
+ placeholder.appendChild(hiddenText);
7542
8384
  if (model.toolCallId) {
7543
8385
  placeholder.dataset.clCardTcid = model.toolCallId;
7544
8386
  }
@@ -7547,33 +8389,60 @@ function _clRenderOutputCard(model, onOpenSidebar) {
7547
8389
  }
7548
8390
 
7549
8391
  var container = document.createElement('div');
7550
- container.className = 'cl-remote-agent-card cl-thought-chain cl-output-card cl-output-card--pending';
8392
+ var cardClasses = 'cl-remote-agent-card cl-thought-chain cl-output-card'
8393
+ + (resultTexts.length > 0 ? ' cl-output-card--pending' : '');
8394
+ if (isV2) cardClasses += ' cl-exec-v2';
8395
+ container.className = cardClasses;
7551
8396
  container.dataset.clCardRole = 'output';
8397
+ // 防止 OpenClaw native 代码读 .textContent 报 undefined.trim()
8398
+ var safetyText = document.createElement('div');
8399
+ safetyText.className = 'chat-text';
8400
+ safetyText.style.display = 'none';
8401
+ safetyText.textContent = '';
8402
+ container.appendChild(safetyText);
8403
+ if (model.toolCallId) container.dataset.clCardTcid = model.toolCallId;
8404
+ // 阻止点击冒泡到原生 tool card handler
8405
+ container.addEventListener('click', function(e) { e.stopPropagation(); });
7552
8406
  if (CL && typeof CL.diagMarkCard === 'function') {
7553
8407
  CL.diagMarkCard(container, 'output', { tcid: model.toolCallId || '' });
7554
8408
  }
7555
8409
 
7556
- var shellHeader = _clCreateOpenAgentHeader(model);
7557
- container.appendChild(shellHeader);
7558
- if (typeof _clSetOpenAgentHeaderAgent === 'function') {
7559
- _clSetOpenAgentHeaderAgent(container, model.agentName || model.agentId || 'Remote Agent');
8410
+ model._outputMode = true;
8411
+ model.status = 'completed';
8412
+ if (isV2) {
8413
+ var v2Header = _clCreateOpenAgentHeaderV2(model);
8414
+ v2Header.classList.remove('cl-openagent-header--output');
8415
+ container.appendChild(v2Header);
8416
+ if (typeof _clUpdateAgentStatusTextV2 === 'function') {
8417
+ _clUpdateAgentStatusTextV2(container, 'completed');
8418
+ }
8419
+ } else {
8420
+ var shellHeader = _clCreateOpenAgentHeader(model);
8421
+ container.appendChild(shellHeader);
8422
+ if (typeof _clSetOpenAgentHeaderAgent === 'function') {
8423
+ _clSetOpenAgentHeaderAgent(container, model.agentName || model.agentId || 'Remote Agent');
8424
+ }
7560
8425
  }
7561
8426
 
7562
8427
  var content = document.createElement('div');
7563
8428
  content.className = 'cl-thought-chain-content';
7564
8429
  container.appendChild(content);
7565
8430
 
7566
- // ── Agent Pill ──
7567
- var pillSlot = document.createElement('div');
7568
- pillSlot.className = 'cl-thought-chain-pill-slot';
7569
- var pill = _clCreateAgentPill(model.agentName, model.agentId, model.agentAvatar);
7570
- pillSlot.appendChild(pill);
7571
- content.appendChild(pillSlot);
8431
+ // ── V2 Agent 详情卡片 ──
8432
+ if (isV2) {
8433
+ try {
8434
+ var detailCard = _clCreateAgentDetailCardV2(model);
8435
+ content.appendChild(detailCard);
8436
+ } catch(e) {
8437
+ console.warn('[cl-output-v2] detail card creation failed:', e);
8438
+ }
8439
+ }
7572
8440
 
7573
- // ── 分隔线 ──
7574
- var divider = document.createElement('div');
7575
- divider.className = 'cl-thought-chain-divider';
7576
- content.appendChild(divider);
8441
+ // ── 附件下载链接 ──
8442
+ if (mediaLinks.length > 0 && typeof _clCreateOpenagentMediaLinksSection === 'function') {
8443
+ var mediaSection = _clCreateOpenagentMediaLinksSection(mediaLinks);
8444
+ if (mediaSection) content.appendChild(mediaSection);
8445
+ }
7577
8446
 
7578
8447
  // ── 最终结果展示 ──
7579
8448
  if (resultTexts.length > 0) {
@@ -7612,12 +8481,23 @@ function _clRenderOutputCard(model, onOpenSidebar) {
7612
8481
  }
7613
8482
 
7614
8483
  // ── onOpenSidebar 支持:点击展开到侧边栏 ──
7615
- if (onOpenSidebar && model.rawText) {
8484
+ // 宿主 sidebar 渲染器要求 content 为 { kind: 'markdown', content, rawText } 对象,
8485
+ // kind 必须为 'markdown' 才会进入 markdown 渲染路径,否则显示 "No previewable markdown content."。
8486
+ // travel card 标签(<sh_card>等)sidebar 原生 markdown 解析不认,先 strip 再传。
8487
+ var sidebarRaw = resultText || model.rawText || '';
8488
+ var sidebarText = String(sidebarRaw).replace(/<\/?[a-z]+_card[^>]*>/gi, '');
8489
+ if (typeof _clStripSuppressedTravelTags === 'function') {
8490
+ sidebarText = _clStripSuppressedTravelTags(sidebarText);
8491
+ }
8492
+ if (onOpenSidebar && sidebarText.trim()) {
7616
8493
  container.style.cursor = 'pointer';
7617
8494
  container.addEventListener('click', function(e) {
7618
- // 不拦截折叠/展开点击
7619
8495
  if (e.target.closest('.cl-tools-collapse-header')) return;
7620
- onOpenSidebar(model.rawText);
8496
+ onOpenSidebar({ kind: 'markdown', content: sidebarText, rawText: sidebarText });
8497
+ setTimeout(function() {
8498
+ var titleEl = document.querySelector('.chat-sidebar .sidebar-title');
8499
+ if (titleEl) titleEl.textContent = 'OpenAgent @' + (model.agentName || 'Remote Agent');
8500
+ }, 100);
7621
8501
  });
7622
8502
  }
7623
8503
 
@@ -7625,18 +8505,18 @@ function _clRenderOutputCard(model, onOpenSidebar) {
7625
8505
  if ((model.agentId || model.agentName) && typeof fetchAgentById === 'function') {
7626
8506
  fetchAgentById(model.agentId, model.agentName).then(function(agent) {
7627
8507
  if (!agent) return;
7628
- var pa = container.querySelector('.cl-agent-pill-avatar');
7629
- var pn = container.querySelector('.cl-agent-pill-name');
7630
- if (pa && typeof avatarUrl === 'function') {
7631
- var resolvedAvatar = avatarUrl(agent);
7632
- console.log('[cl-diag][pill] fetch-update agentId=' + JSON.stringify(model.agentId)
7633
- + ' name=' + JSON.stringify(agent.name || model.agentName)
7634
- + ' src=' + JSON.stringify(resolvedAvatar));
7635
- pa.src = resolvedAvatar;
7636
- pa.style.display = '';
8508
+ if (isV2) {
8509
+ var avatarElV2 = container.querySelector('.cl-exec-agent-avatar-v2');
8510
+ var nameElV2 = container.querySelector('.cl-exec-agent-name-v2');
8511
+ var bioElV2 = container.querySelector('.cl-exec-agent-bio-v2');
8512
+ if (nameElV2) nameElV2.textContent = agent.name || model.agentName;
8513
+ if (bioElV2 && (agent.bio || agent.description)) bioElV2.textContent = agent.bio || agent.description;
8514
+ var starsElV2 = container.querySelector('.cl-exec-star-count-v2');
8515
+ if (starsElV2 && agent.claws) starsElV2.textContent = _cl_formatStarCount(agent.claws);
8516
+ if (starsElV2 && agent.stars && !agent.claws) starsElV2.textContent = _cl_formatStarCount(agent.stars);
8517
+ } else {
8518
+ _clSetOpenAgentHeaderAgent(container, agent.name || model.agentName);
7637
8519
  }
7638
- _clSetAgentPillName(container, agent.name || model.agentName);
7639
- _clSetOpenAgentHeaderAgent(container, agent.name || model.agentName);
7640
8520
  }).catch(function() {});
7641
8521
  }
7642
8522
 
@@ -7644,7 +8524,25 @@ function _clRenderOutputCard(model, onOpenSidebar) {
7644
8524
  _cl_applyCardUiState(container, model);
7645
8525
  }
7646
8526
 
7647
- console.log('[cl-output] output card built: results=' + resultTexts.length);
8527
+ // ── Footer ──
8528
+ if (isV2) {
8529
+ var footerV2 = document.createElement('div');
8530
+ footerV2.className = 'cl-output-footer cl-output-footer-v2';
8531
+ footerV2.innerHTML = '<span class="cl-output-footer-text">-由' + (model.agentName || 'Remote Agent') + '完成</span>'
8532
+ + '<span class="cl-output-footer-star"><svg width="14" height="14" viewBox="0 0 14 14" fill="none"><path d="M7 1.16L8.356 5.33H12.78L9.195 7.94L10.565 12.1L7 9.51L3.435 12.1L4.805 7.94L1.22 5.33H5.644L7 1.16Z" stroke="#999" stroke-width="0.8"/></svg></span>'
8533
+ + '<span class="cl-output-footer-count">' + (model.agentStars || '3.2万') + '</span>';
8534
+ container.appendChild(footerV2);
8535
+ } else {
8536
+ // ── Footer(Figma 131:2091) ──
8537
+ var footer = document.createElement('div');
8538
+ footer.className = 'cl-output-footer';
8539
+ footer.innerHTML = '<span class="cl-output-footer-text">-由' + (model.agentName || 'Remote Agent') + '完成</span>'
8540
+ + '<span class="cl-output-footer-star"><svg width="14" height="14" viewBox="0 0 14 14" fill="none"><path d="M7 1.16L8.356 5.33H12.78L9.195 7.94L10.565 12.1L7 9.51L3.435 12.1L4.805 7.94L1.22 5.33H5.644L7 1.16Z" stroke="#999" stroke-width="0.8"/></svg></span>'
8541
+ + '<span class="cl-output-footer-count">' + (model.agentStars || '3.2万') + '</span>';
8542
+ container.appendChild(footer);
8543
+ }
8544
+
8545
+ console.log('[cl-output] ✅ output card built: results=' + resultTexts.length + ' v2=' + isV2);
7648
8546
  return container;
7649
8547
  }
7650
8548
 
@@ -7768,6 +8666,8 @@ function _clScheduleOutputCardProcessing(resultSection, model) {
7768
8666
  setTimeout(run, 0);
7769
8667
  }
7770
8668
 
8669
+ // ── Sidebar Figma 145:5712 内联样式 ──
8670
+
7771
8671
  // ════════════════════════════════════════════════════════════════
7772
8672
  // MODULE: remote-agent/render-hooks.js
7773
8673
  // ════════════════════════════════════════════════════════════════
@@ -7787,8 +8687,14 @@ var __cl_toolStates = new Map();
7787
8687
  // 每个 entry: { steps: [], phase: 'active'|'completed', cardNode: null, args: {} }
7788
8688
 
7789
8689
  var __cl_lastCallModel = null; // 同一 render cycle 里 call card 的 model(供 result card 读取 agent 身份)
7790
- var __cl_outputCardCache = new Map(); // toolCallId → cached output DOM
7791
- var __cl_cardUiStates = new Map(); // execution/output 展开状态,避免 OpenClaw rerender 覆盖用户操作
8690
+ var __cl_outputCardCache = new Map(); // toolCallId → cached output DOM
8691
+ var __cl_executionCardCache = new Map(); // toolCallId cached historical execution DOM
8692
+ var __cl_cardUiStates = new Map(); // execution/output 展开状态,避免 OpenClaw rerender 覆盖用户操作
8693
+ var __cl_progressMessageMap = new Map(); // toolCallId → 动态进度文字(来自 response.progress?.safe_status_message)
8694
+
8695
+ // ── 诊断:渲染频率计数器 ──
8696
+ var __clDiag = { renderCalls: 0, lastDiagTs: 0, version: 'v4-oneshot-20260630' };
8697
+ console.log('[cl-diag] render-hooks loaded, version=' + __clDiag.version);
7792
8698
 
7793
8699
  var CL_REMOTE_AGENT_PROGRESS_MODE_TRAVEL_TITLE = 'travel-title';
7794
8700
  var CL_REMOTE_AGENT_PROGRESS_MODE_GENERIC_STREAM = 'generic-stream';
@@ -8084,6 +8990,16 @@ function _cl_ensureRemoteToolState(toolCallId, data, rawText) {
8084
8990
  // ═══════════════════════════════════════════════════════════════
8085
8991
 
8086
8992
  window.__openagentRenderToolCard = function(card, onOpenSidebar) {
8993
+ // ── 诊断:渲染频率计数器 ──
8994
+ __clDiag.renderCalls++;
8995
+ var diagNow = Date.now();
8996
+ if (diagNow - __clDiag.lastDiagTs > 2000) {
8997
+ var rps = (__clDiag.renderCalls / ((diagNow - __clDiag.lastDiagTs) / 1000)).toFixed(1);
8998
+ console.log('[cl-diag] render rate: ' + rps + ' calls/sec, total=' + __clDiag.renderCalls + ', version=' + __clDiag.version);
8999
+ __clDiag.renderCalls = 0;
9000
+ __clDiag.lastDiagTs = diagNow;
9001
+ }
9002
+
8087
9003
  var n = (card && card.name || '').toLowerCase();
8088
9004
  var cardTcid = card && (card.toolCallId || '');
8089
9005
  var cardKind = typeof _clInferToolCardKind === 'function' ? _clInferToolCardKind(card) : (card && card.kind || '');
@@ -8121,19 +9037,34 @@ window.__openagentRenderToolCard = function(card, onOpenSidebar) {
8121
9037
  }
8122
9038
  if (state.phase === 'active') {
8123
9039
  model.status = 'executing';
9040
+ if (typeof _clUpdateAgentStatusTextV2 === 'function' && state.cardNode && state.cardNode.classList.contains('cl-exec-v2')) {
9041
+ _clUpdateAgentStatusTextV2(state.cardNode, 'executing');
9042
+ } else if (typeof _clUpdateAgentStatusText === 'function') {
9043
+ _clUpdateAgentStatusText(state.cardNode, 'executing');
9044
+ }
8124
9045
  }
8125
9046
  // 有 streaming 状态 — 复用或新建
8126
9047
  if (state.cardNode) {
8127
9048
  // Lit 重复调用会复用同一个 DOM 节点;但 OpenClaw 外层 native
8128
9049
  // <details> 可能被 rerender 成 closed。这里重新打开的是外层原生
8129
- // details,不影响卡片内部的“思考中/思考完成”折叠状态。
9050
+ // details,不影响卡片内部的”思考中/思考完成”折叠状态。
8130
9051
  _cl_applyCardUiState(state.cardNode, { toolCallId: tcid, cardKind: 'call' });
8131
9052
  if (state.phase === 'active') {
8132
9053
  _cl_autoOpenStepsIfUncontrolled(state.cardNode);
8133
9054
  }
8134
- _cl_forceOpenNativeToolDetails(state.cardNode, 'execution-cache', tcid);
8135
- if (typeof _cl_scheduleHostShellMark === 'function') _cl_scheduleHostShellMark(state.cardNode);
8136
- _cl_hideHostRawText(state.cardNode);
9055
+ // ── 更新进度文字:来自 response.progress?.safe_status_message ──
9056
+ var progressEl = state.cardNode.querySelector('.cl-exec-progress-text');
9057
+ if (progressEl && model.rawText) {
9058
+ var msg = (model.rawText || '').trim();
9059
+ if (msg) progressEl.textContent = msg;
9060
+ }
9061
+ // ── 一次性外壳初始化:首次渲染时打开 native details + 隐藏 raw text,之后永久跳过 ──
9062
+ if (!state.cardNode.__clShellReady) {
9063
+ state.cardNode.__clShellReady = true;
9064
+ _cl_forceOpenNativeToolDetails(state.cardNode, 'execution-cache', tcid);
9065
+ if (typeof _cl_scheduleHostShellMark === 'function') _cl_scheduleHostShellMark(state.cardNode);
9066
+ _cl_hideHostRawText(state.cardNode);
9067
+ }
8137
9068
  return state.cardNode;
8138
9069
  }
8139
9070
 
@@ -8171,6 +9102,20 @@ window.__openagentRenderToolCard = function(card, onOpenSidebar) {
8171
9102
 
8172
9103
  // 无状态 → 刷新/历史态。前端 store 如果有同一 toolCallId 的卡片快照,
8173
9104
  // 就用快照参数重建 steps;没有 store 时仍展示完成态外壳。
9105
+
9106
+ // 缓存:历史态 execution card 只创建一次,Lit 重复调用时复用(与 output card 逻辑一致)
9107
+ var cachedExecution = tcid ? __cl_executionCardCache.get(tcid) : null;
9108
+ if (cachedExecution && cachedExecution.isConnected) {
9109
+ _cl_applyCardUiState(cachedExecution, { toolCallId: tcid, cardKind: 'call' });
9110
+ if (!cachedExecution.__clShellReady) {
9111
+ cachedExecution.__clShellReady = true;
9112
+ _cl_forceOpenNativeToolDetails(cachedExecution, 'execution-history-cache', tcid);
9113
+ if (typeof _cl_scheduleHostShellMark === 'function') _cl_scheduleHostShellMark(cachedExecution);
9114
+ _cl_hideHostRawText(cachedExecution);
9115
+ }
9116
+ return cachedExecution;
9117
+ }
9118
+
8174
9119
  var storedCallRecord = tcid && typeof _clRemoteAgentProgressStore !== 'undefined' && _clRemoteAgentProgressStore
8175
9120
  ? _clRemoteAgentProgressStore.get(tcid)
8176
9121
  : null;
@@ -8187,10 +9132,16 @@ window.__openagentRenderToolCard = function(card, onOpenSidebar) {
8187
9132
  model.cardKind = 'call';
8188
9133
  model.status = 'completed';
8189
9134
  var historyNode = _clRenderExecutionCard(model);
9135
+ if (historyNode && historyNode.classList && historyNode.classList.contains('cl-exec-v2')) {
9136
+ if (typeof _clUpdateAgentStatusTextV2 === 'function') _clUpdateAgentStatusTextV2(historyNode, 'completed');
9137
+ } else if (typeof _clUpdateAgentStatusText === 'function') {
9138
+ _clUpdateAgentStatusText(historyNode, 'completed');
9139
+ }
8190
9140
  _cl_finalizeCard(historyNode, model._bufferedSteps || []);
8191
9141
  _cl_forceOpenNativeToolDetails(historyNode, 'execution-history', tcid);
8192
9142
  if (typeof _cl_scheduleHostShellMark === 'function') _cl_scheduleHostShellMark(historyNode);
8193
9143
  _cl_hideHostRawText(historyNode);
9144
+ if (tcid) __cl_executionCardCache.set(tcid, historyNode);
8194
9145
  console.log('[cl-render] 🗂️ built historical call card, tcid=' + tcid.substring(0, 8));
8195
9146
  return historyNode;
8196
9147
  }
@@ -8243,9 +9194,13 @@ window.__openagentRenderToolCard = function(card, onOpenSidebar) {
8243
9194
  var cachedOutput = resTcid ? __cl_outputCardCache.get(resTcid) : null;
8244
9195
  if (cachedOutput && cachedOutput.isConnected) {
8245
9196
  _cl_applyCardUiState(cachedOutput, { toolCallId: resTcid, cardKind: 'result' });
8246
- _cl_forceOpenNativeToolDetails(cachedOutput, 'output-cache', resTcid);
8247
- if (typeof _cl_scheduleHostShellMark === 'function') _cl_scheduleHostShellMark(cachedOutput);
8248
- _cl_hideHostRawText(cachedOutput);
9197
+ // ── 一次性外壳初始化:首次渲染时打开 native details + 隐藏 raw text,之后永久跳过 ──
9198
+ if (!cachedOutput.__clShellReady) {
9199
+ cachedOutput.__clShellReady = true;
9200
+ _cl_forceOpenNativeToolDetails(cachedOutput, 'output-cache', resTcid);
9201
+ if (typeof _cl_scheduleHostShellMark === 'function') _cl_scheduleHostShellMark(cachedOutput);
9202
+ _cl_hideHostRawText(cachedOutput);
9203
+ }
8249
9204
  return cachedOutput;
8250
9205
  }
8251
9206
 
@@ -8328,6 +9283,8 @@ function _cl_replayBufferedSteps(toolCallId, state) {
8328
9283
 
8329
9284
  function _cl_hideHostRawText(cardNode) {
8330
9285
  if (!cardNode) return;
9286
+ // 幂等性守卫:如果父链已经标记为隐藏,跳过重复操作
9287
+ if (cardNode.closest && cardNode.closest('.cl-remote-agent-raw-hidden')) return;
8331
9288
  function hide() {
8332
9289
  var hosts = _cl_collectRawTextHosts(cardNode);
8333
9290
  for (var h = 0; h < hosts.length; h++) {
@@ -8337,10 +9294,7 @@ function _cl_hideHostRawText(cardNode) {
8337
9294
  hide();
8338
9295
  if (typeof requestAnimationFrame === 'function') requestAnimationFrame(hide);
8339
9296
  setTimeout(hide, 0);
8340
- setTimeout(hide, 80);
8341
- setTimeout(hide, 250);
8342
- setTimeout(hide, 800);
8343
- setTimeout(hide, 2000);
9297
+ setTimeout(hide, 200);
8344
9298
  }
8345
9299
 
8346
9300
  function _cl_isRemoteToolNameText(text) {
@@ -8574,8 +9528,6 @@ function _cl_forceOpenNativeToolDetails(node, source, tcid) {
8574
9528
  // openNearest 是幂等的(已 open 不重复操作),不需要防抖。
8575
9529
  openNearest();
8576
9530
  if (typeof requestAnimationFrame === 'function') requestAnimationFrame(openNearest);
8577
- setTimeout(openNearest, 0);
8578
- setTimeout(openNearest, 80);
8579
9531
  setTimeout(openNearest, 300); // 兜底:慢速 Lit render / 异步 wrapper 挂载
8580
9532
  }
8581
9533
 
@@ -8669,6 +9621,12 @@ function _cl_applyStoredRecordToModel(model, record) {
8669
9621
  if (!model.agentAvatar) {
8670
9622
  model.agentAvatar = args.agent_avatar || args.agentAvatar || args.avatar || args.avatar_url || args.avatarUrl || null;
8671
9623
  }
9624
+ if (!model.agentBio) {
9625
+ model.agentBio = args.agent_bio || args.agentBio || '';
9626
+ }
9627
+ if (!model.agentStars) {
9628
+ model.agentStars = args.agent_stars || args.agentStars || '3.2万';
9629
+ }
8672
9630
  var identity = CL && typeof CL.getAgentIdentity === 'function'
8673
9631
  ? CL.getAgentIdentity(model.agentId, model.agentName)
8674
9632
  : null;
@@ -9074,8 +10032,6 @@ function _cl_updateCardSteps(card, steps) {
9074
10032
  var stepEl = _clCreateStepElement(steps[i], i === steps.length - 1);
9075
10033
  body.appendChild(stepEl);
9076
10034
  }
9077
-
9078
- _cl_forceOpenNativeToolDetails(card, 'steps-update', card.dataset && card.dataset.clCardTcid || '');
9079
10035
  }
9080
10036
 
9081
10037
  function _cl_autoOpenStepsIfUncontrolled(card) {
@@ -9083,7 +10039,11 @@ function _cl_autoOpenStepsIfUncontrolled(card) {
9083
10039
  var uiState = _cl_getCardUiState(card);
9084
10040
  if (uiState && uiState.stepsExpanded !== undefined) return;
9085
10041
 
9086
- var body = card.querySelector('.cl-tools-collapse-body');
10042
+ // 缓存 body 引用,避免 5-16Hz Lit rerender 时重复 querySelector
10043
+ if (!card.__clStepsBody) {
10044
+ card.__clStepsBody = card.querySelector('.cl-tools-collapse-body');
10045
+ }
10046
+ var body = card.__clStepsBody;
9087
10047
  if (!body) return;
9088
10048
 
9089
10049
  body.classList.remove('cl-collapsed');
@@ -9138,6 +10098,11 @@ function _cl_countChunkTypes(chunks) {
9138
10098
  }
9139
10099
 
9140
10100
  function _cl_finalizeCard(card, steps) {
10101
+ if (card && card.classList && card.classList.contains('cl-exec-v2')) {
10102
+ if (typeof _clUpdateAgentStatusTextV2 === 'function') _clUpdateAgentStatusTextV2(card, 'completed');
10103
+ } else if (typeof _clUpdateAgentStatusText === 'function') {
10104
+ _clUpdateAgentStatusText(card, 'completed');
10105
+ }
9141
10106
  var header = card.querySelector('.cl-tools-collapse-header-title');
9142
10107
  if (header) {
9143
10108
  header.textContent = '思考完成';
@@ -9148,6 +10113,20 @@ function _cl_finalizeCard(card, steps) {
9148
10113
  dots[i].className = 'cl-tools-collapse-step-check';
9149
10114
  }
9150
10115
 
10116
+ // 执行完成后隐藏第一个 chat-bubble(execution card),仅保留 output card
10117
+ // 仅 V2 启用:V1 的 output card 布局不同,不宜隐藏 execution bubble
10118
+ var isV2Finalize = typeof _clIsHostVersionGte === 'function' && _clIsHostVersionGte('2026.6.9');
10119
+ if (isV2Finalize && card && !card.__clBubbleHidden) {
10120
+ card.__clBubbleHidden = true;
10121
+ var bubble = card.closest && card.closest('.chat-bubble');
10122
+ if (bubble) {
10123
+ // 延迟隐藏,等 output card(第二个 bubble)渲染完毕
10124
+ setTimeout(function() {
10125
+ bubble.style.display = 'none';
10126
+ }, 500);
10127
+ }
10128
+ }
10129
+
9151
10130
  // Finalize 只负责把 execution card 标记为完成态。
9152
10131
  // 不在这里强制折叠 steps:OpenClaw 会周期性 rerender,若 finalize 每次都
9153
10132
  // 写 cl-collapsed,会覆盖用户手动展开后的状态。
@@ -9393,7 +10372,7 @@ var _clObserverTarget = null;
9393
10372
 
9394
10373
  const _clObserver = new MutationObserver(() => {
9395
10374
  if (_clDebounceTimer) clearTimeout(_clDebounceTimer);
9396
- _clDebounceTimer = setTimeout(_debouncedClScan, 50); // Reduced from 500ms to 50ms to fix UI flash
10375
+ _clDebounceTimer = setTimeout(_debouncedClScan, 300); // Debounce to reduce DOM churn feedback loops
9397
10376
  });
9398
10377
 
9399
10378
  function _debouncedClScan() {