openclaw-openagent 1.0.9 → 1.0.12

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 (64) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/src/app/remote-agent-tool.js +110 -14
  3. package/dist/src/app/types.d.ts +2 -2
  4. package/dist/src/plugin-ui/adapters/adapters/oc-2026-04.js +103 -0
  5. package/dist/src/plugin-ui/adapters/adapters/oc-2026-05.js +125 -0
  6. package/dist/src/plugin-ui/adapters/adapters/oc-2026-06.js +125 -0
  7. package/dist/src/plugin-ui/adapters/adapters/oc-unknown.js +48 -0
  8. package/dist/src/plugin-ui/adapters/oc-2026-04.js +103 -0
  9. package/dist/src/plugin-ui/adapters/oc-2026-05.js +125 -0
  10. package/dist/src/plugin-ui/adapters/oc-2026-06.js +125 -0
  11. package/dist/src/plugin-ui/adapters/oc-unknown.js +48 -0
  12. package/dist/src/plugin-ui/assets/bg.png +0 -0
  13. package/dist/src/plugin-ui/assets/icon.png +0 -0
  14. package/dist/src/plugin-ui/assets/openagent-override.js +2480 -1004
  15. package/dist/src/plugin-ui/index.d.ts +1 -1
  16. package/dist/src/plugin-ui/index.js +2 -2
  17. package/dist/src/plugin-ui/ui-extension-loader/index.d.ts +2 -1
  18. package/dist/src/plugin-ui/ui-extension-loader/index.js +5 -5
  19. package/dist/src/plugin-ui/ui-extension-loader/registry-regex.js +128 -13
  20. package/dist/src/plugin-ui/ui-extension-loader/types.d.ts +4 -1
  21. package/dist/src/state/store.d.ts +21 -0
  22. package/dist/src/state/store.js +54 -0
  23. package/dist/src/transport/oasn/oasn-invocation.d.ts +3 -0
  24. package/dist/src/transport/oasn/oasn-invocation.js +28 -12
  25. package/dist/src/transport/oasn/oasn-types.d.ts +8 -4
  26. package/index.ts +1 -1
  27. package/openclaw.plugin.json +1 -1
  28. package/package.json +5 -4
  29. package/src/app/remote-agent-tool.ts +131 -16
  30. package/src/app/types.ts +2 -2
  31. package/src/plugin-ui/adapters/oc-2026-04.js +103 -0
  32. package/src/plugin-ui/adapters/oc-2026-05.js +125 -0
  33. package/src/plugin-ui/adapters/oc-2026-06.js +125 -0
  34. package/src/plugin-ui/adapters/oc-unknown.js +48 -0
  35. package/src/plugin-ui/assets/bg.png +0 -0
  36. package/src/plugin-ui/assets/icon.png +0 -0
  37. package/src/plugin-ui/assets/openagent-override.js +2480 -1004
  38. package/src/plugin-ui/build.cjs +309 -23
  39. package/src/plugin-ui/index.ts +2 -2
  40. package/src/plugin-ui/modules/agent-book/panel/agent-book.js +187 -14
  41. package/src/plugin-ui/modules/agent-book/panel/agent-card.js +26 -10
  42. package/src/plugin-ui/modules/agent-book/panel/agent-data.js +1 -1
  43. package/src/plugin-ui/modules/agent-book/panel/inject-ui.js +149 -1
  44. package/src/plugin-ui/modules/agent-book/panel/styles.js +352 -210
  45. package/src/plugin-ui/modules/agent-book/remote-agent-tool/components-core.js +4 -2
  46. package/src/plugin-ui/modules/agent-book/remote-agent-tool/thought-chain-card.js +4 -1
  47. package/src/plugin-ui/modules/agent-book/scanner.js +17 -5
  48. package/src/plugin-ui/modules/agent-book/travelcard/travel-styles.js +5 -0
  49. package/src/plugin-ui/modules/loader/bootstrap.js +1 -1
  50. package/src/plugin-ui/modules/loader/shared-state.js +278 -0
  51. package/src/plugin-ui/modules/remote-agent/execution-card.js +385 -124
  52. package/src/plugin-ui/modules/remote-agent/native-style-adapter.js +5 -23
  53. package/src/plugin-ui/modules/remote-agent/output-card.js +97 -31
  54. package/src/plugin-ui/modules/remote-agent/render-hooks.js +149 -58
  55. package/src/plugin-ui/modules/remote-agent/styles.js +690 -523
  56. package/src/plugin-ui/modules/remote-agent/tool-card-model.js +77 -3
  57. package/src/plugin-ui/postinstall-deploy.cjs +52 -0
  58. package/src/plugin-ui/ui-extension-loader/index.ts +6 -6
  59. package/src/plugin-ui/ui-extension-loader/registry-regex.ts +131 -14
  60. package/src/plugin-ui/ui-extension-loader/types.ts +5 -1
  61. package/src/state/store.ts +80 -0
  62. package/src/transport/oasn/oasn-invocation.ts +47 -12
  63. package/src/transport/oasn/oasn-types.ts +6 -2
  64. package/src/types/openclaw-plugin-sdk-media-store.d.ts +9 -0
@@ -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-29T06:32:31.586Z
5
+ * Built: 2026-07-06T03:23:32.989Z
6
6
  *
7
7
  * To modify, edit the source modules and run:
8
8
  * npm run build:override
@@ -48,6 +48,12 @@ const CL = {
48
48
  handleDelegateWsEvent: function(msg) {},
49
49
  processCustomCards: function(bubble) {},
50
50
 
51
+ // ── Host 版本(构建时注入,fallback 运行时检测)──
52
+ hostVersion: '__OPENCLAW_HOST_VERSION__',
53
+
54
+ // ── Override 构建标识(构建时注入,用于缓存自检)──
55
+ buildId: "65bf8968e270",
56
+
51
57
  // ── 配置 ──
52
58
  OPENAGENT_API: 'https://api.openagent.club',
53
59
  AUTH_API: '/plugins/openagent', // Proxied via Gateway registerHttpRoute (see src/proxy/auth-proxy.ts)
@@ -56,6 +62,252 @@ const CL = {
56
62
  CACHE_TTL: 30000,
57
63
  };
58
64
 
65
+ function _clFindOverrideScript() {
66
+ try {
67
+ var scripts = document.querySelectorAll('script[src*="openagent-override.js"]');
68
+ return scripts.length ? scripts[scripts.length - 1] : null;
69
+ } catch (e) {
70
+ return null;
71
+ }
72
+ }
73
+
74
+ function _clReadOverrideScriptVersionFromDocument() {
75
+ try {
76
+ var script = _clFindOverrideScript();
77
+ if (!script) return '';
78
+ var src = script.getAttribute('src') || '';
79
+ var url = new URL(src, window.location.href);
80
+ return url.searchParams.get('v') || '';
81
+ } catch (e) {
82
+ return '';
83
+ }
84
+ }
85
+
86
+ function _clResolveControlUiIndexUrl() {
87
+ try {
88
+ var script = _clFindOverrideScript();
89
+ if (script) {
90
+ var scriptUrl = new URL(script.src || script.getAttribute('src'), window.location.href);
91
+ return new URL('./', scriptUrl.href).href;
92
+ }
93
+ } catch (e) {}
94
+ try {
95
+ var url = new URL(window.location.href);
96
+ url.hash = '';
97
+ url.search = '';
98
+ return url.href;
99
+ } catch (e) {
100
+ return '/';
101
+ }
102
+ }
103
+
104
+ function _clExtractOverrideScriptVersionFromHtml(html) {
105
+ var match = String(html || '').match(/openagent-override\.js\?v=([A-Za-z0-9._-]+)/);
106
+ return match ? match[1] : '';
107
+ }
108
+
109
+ function _clInstallOverrideUpdateCheck() {
110
+ if (window.__openagentOverrideUpdateCheckInstalled) return;
111
+ window.__openagentOverrideUpdateCheckInstalled = true;
112
+
113
+ var currentVersion = _clReadOverrideScriptVersionFromDocument() || CL.buildId || '';
114
+ var storageKey = 'openagent.overrideScriptVersion.v1';
115
+ var reloadKey = 'openagent.overrideReloadedVersion.v1';
116
+ try {
117
+ document.documentElement.setAttribute('data-openagent-build-id', CL.buildId || 'unknown');
118
+ if (currentVersion) document.documentElement.setAttribute('data-openagent-script-version', currentVersion);
119
+ } catch (e) {}
120
+
121
+ try {
122
+ if (window.localStorage && currentVersion) {
123
+ window.localStorage.setItem(storageKey, currentVersion);
124
+ }
125
+ } catch (e) {}
126
+
127
+ function reloadForVersion(nextVersion) {
128
+ if (!nextVersion || nextVersion === currentVersion) return;
129
+ try {
130
+ if (window.sessionStorage && window.sessionStorage.getItem(reloadKey) === nextVersion) return;
131
+ if (window.sessionStorage) window.sessionStorage.setItem(reloadKey, nextVersion);
132
+ } catch (e) {}
133
+ console.info('[openagent] override updated, reloading Control UI', currentVersion, '→', nextVersion);
134
+ window.location.reload();
135
+ }
136
+
137
+ async function checkLatestOverrideVersion() {
138
+ if (document.visibilityState && document.visibilityState === 'hidden') return;
139
+ try {
140
+ var res = await fetch(_clResolveControlUiIndexUrl(), { cache: 'no-store' });
141
+ if (!res || !res.ok) return;
142
+ var latestVersion = _clExtractOverrideScriptVersionFromHtml(await res.text());
143
+ reloadForVersion(latestVersion);
144
+ } catch (e) {}
145
+ }
146
+
147
+ setTimeout(checkLatestOverrideVersion, 3000);
148
+ setInterval(checkLatestOverrideVersion, 60000);
149
+ window.addEventListener('focus', checkLatestOverrideVersion);
150
+ document.addEventListener('visibilitychange', function() {
151
+ if (!document.hidden) checkLatestOverrideVersion();
152
+ });
153
+ }
154
+
155
+ _clInstallOverrideUpdateCheck();
156
+
157
+ // ── 版本解析与比较(供 execution-card V2 分支使用)──
158
+
159
+ function _clParseHostVersion(v) {
160
+ if (!v) return [0, 0, 0];
161
+ var base = String(v).split('-')[0];
162
+ var parts = base.split('.');
163
+ if (parts.length !== 3) return [0, 0, 0];
164
+ var y = parseInt(parts[0], 10);
165
+ var m = parseInt(parts[1], 10);
166
+ var d = parseInt(parts[2], 10);
167
+ if (isNaN(y) || isNaN(m) || isNaN(d)) return [0, 0, 0];
168
+ return [y, m, d];
169
+ }
170
+
171
+ function _clIsHostVersionGte(minVer) {
172
+ if (CL.hostVersionSource !== 'exact' && CL.hostVersionSource !== 'script' && CL.hostVersionSource !== 'runtime') {
173
+ _clRefreshHostVersionFromRuntime();
174
+ }
175
+ var cur = _clParseHostVersion(CL.hostVersion || '');
176
+ var min = _clParseHostVersion(minVer);
177
+ for (var i = 0; i < 3; i++) {
178
+ if (cur[i] > min[i]) return true;
179
+ if (cur[i] < min[i]) return false;
180
+ }
181
+ return true;
182
+ }
183
+
184
+ function _clResolveHostProfile(version) {
185
+ var parsed = _clParseHostVersion(version || '');
186
+ if (parsed[0] === 2026 && parsed[1] === 4) return 'oc-2026-04';
187
+ if (parsed[0] === 2026 && parsed[1] === 5) return 'oc-2026-05';
188
+ if (parsed[0] === 2026 && parsed[1] === 6) return 'oc-2026-06';
189
+ return 'oc-unknown';
190
+ }
191
+
192
+ function _clNormalizeHostVersion(value) {
193
+ var match = String(value || '').match(/20\d{2}\.\d{1,2}\.\d{1,2}(?:-[A-Za-z0-9._-]+)?/);
194
+ return match ? match[0] : '';
195
+ }
196
+
197
+ function _clGetByPath(root, path) {
198
+ var cur = root;
199
+ for (var i = 0; i < path.length; i++) {
200
+ if (!cur) return '';
201
+ cur = cur[path[i]];
202
+ }
203
+ return cur;
204
+ }
205
+
206
+ function _clReadHostVersionFromRuntime() {
207
+ try {
208
+ var scripts = document.querySelectorAll('script[data-openagent-host-version]');
209
+ for (var i = scripts.length - 1; i >= 0; i--) {
210
+ var scriptVersion = _clNormalizeHostVersion(scripts[i].getAttribute('data-openagent-host-version'));
211
+ if (scriptVersion) return { version: scriptVersion, source: 'script' };
212
+ }
213
+ } catch (e) {}
214
+
215
+ var globals = [
216
+ window.__OPENCLAW_HOST_VERSION__,
217
+ window.__OPENCLAW_VERSION__,
218
+ window.__openclawVersion,
219
+ window.openclawVersion,
220
+ ];
221
+ for (var g = 0; g < globals.length; g++) {
222
+ var globalVersion = _clNormalizeHostVersion(globals[g]);
223
+ if (globalVersion) return { version: globalVersion, source: 'runtime' };
224
+ }
225
+
226
+ try {
227
+ var metaVersion = _clNormalizeHostVersion(
228
+ document.querySelector('meta[name="openclaw-version"],meta[name="openclaw:version"]')?.getAttribute('content')
229
+ );
230
+ if (metaVersion) return { version: metaVersion, source: 'runtime' };
231
+ } catch (e) {}
232
+
233
+ try {
234
+ var app = document.querySelector('openclaw-app');
235
+ if (app) {
236
+ var paths = [
237
+ ['runtime', 'version'],
238
+ ['hello', 'server', 'version'],
239
+ ['hello', 'version'],
240
+ ['client', 'hello', 'server', 'version'],
241
+ ['client', 'version'],
242
+ ['version'],
243
+ ['appVersion'],
244
+ ];
245
+ for (var p = 0; p < paths.length; p++) {
246
+ var appVersion = _clNormalizeHostVersion(_clGetByPath(app, paths[p]));
247
+ if (appVersion) return { version: appVersion, source: 'runtime' };
248
+ }
249
+ }
250
+ } catch (e) {}
251
+
252
+ return null;
253
+ }
254
+
255
+ function _clApplyHostVersion(version, source) {
256
+ CL.hostVersion = version || '2026.3.0';
257
+ CL.hostVersionSource = source || 'fallback';
258
+ CL.hostProfile = _clResolveHostProfile(CL.hostVersion);
259
+ try {
260
+ document.documentElement.setAttribute('data-openagent-host-version', CL.hostVersion || 'unknown');
261
+ document.documentElement.setAttribute('data-openagent-host-profile', CL.hostProfile);
262
+ document.documentElement.setAttribute('data-openagent-host-version-source', CL.hostVersionSource);
263
+ } catch (e) {}
264
+ }
265
+
266
+ function _clRefreshHostVersionFromRuntime() {
267
+ var detected = _clReadHostVersionFromRuntime();
268
+ if (!detected) return false;
269
+ if (detected.version !== CL.hostVersion || detected.source !== CL.hostVersionSource) {
270
+ _clApplyHostVersion(detected.version, detected.source);
271
+ console.log('[cl-version] detected via ' + detected.source + ': ' + detected.version);
272
+ }
273
+ return true;
274
+ }
275
+
276
+ function _clScheduleHostVersionRefresh() {
277
+ var attempts = 0;
278
+ var timer = setInterval(function() {
279
+ attempts++;
280
+ if (_clRefreshHostVersionFromRuntime() || attempts >= 20) {
281
+ clearInterval(timer);
282
+ }
283
+ }, 500);
284
+ }
285
+
286
+ var _clInitialExactVersion = _clNormalizeHostVersion(CL.hostVersion);
287
+ if (_clInitialExactVersion) {
288
+ _clApplyHostVersion(_clInitialExactVersion, 'exact');
289
+ } else if (!_clRefreshHostVersionFromRuntime()) {
290
+ // ─ 运行时 fallback:只做版本族保守判断,避免把 2026.5 误判为 2026.6.9 ──
291
+ // v5.x (2026.5+) 有 data-theme / --glass-*;v4.x 有 data-theme-mode / --vscode-*。
292
+ try {
293
+ var cs = getComputedStyle(document.documentElement);
294
+ if (document.documentElement.hasAttribute('data-theme-mode')
295
+ || cs.getPropertyValue('--vscode-editor-background').trim()) {
296
+ _clApplyHostVersion('2026.4.0', 'feature-fallback');
297
+ } else if (document.documentElement.hasAttribute('data-theme')
298
+ || cs.getPropertyValue('--glass-surface').trim()
299
+ || cs.getPropertyValue('--kn-bg-primary').trim()) {
300
+ _clApplyHostVersion('2026.5.0', 'feature-fallback');
301
+ } else {
302
+ _clApplyHostVersion('2026.3.0', 'feature-fallback');
303
+ }
304
+ console.log('[cl-version] fallback via DOM/CSS features: ' + CL.hostVersion);
305
+ } catch (e) {
306
+ _clApplyHostVersion('2026.3.0', 'feature-fallback');
307
+ }
308
+ _clScheduleHostVersionRefresh();
309
+ }
310
+
59
311
  // 暴露到 window 供控制台调试/测试
60
312
  window.__CL = CL;
61
313
 
@@ -89,6 +341,28 @@ CL._saveAgentIdentityCache = function() {
89
341
  } catch (err) {}
90
342
  };
91
343
 
344
+ CL.pickAgentIdentityDescription = function(agent) {
345
+ if (!agent || typeof agent !== 'object') return '';
346
+ var keys = [
347
+ 'agent_bio',
348
+ 'agentBio',
349
+ 'bio',
350
+ 'description',
351
+ 'desc',
352
+ 'agent_description',
353
+ 'agentDescription',
354
+ 'MOM',
355
+ 'mom',
356
+ 'introduction',
357
+ 'summary'
358
+ ];
359
+ for (var i = 0; i < keys.length; i++) {
360
+ var value = agent[keys[i]];
361
+ if (typeof value === 'string' && value.trim()) return value.trim();
362
+ }
363
+ return '';
364
+ };
365
+
92
366
  CL.storeAgentIdentity = function(agent, fallbackName) {
93
367
  if (!agent || typeof agent !== 'object') return null;
94
368
  CL._loadAgentIdentityCache();
@@ -97,12 +371,16 @@ CL.storeAgentIdentity = function(agent, fallbackName) {
97
371
  agent.user_id || agent.userId || agent.identifier || agent.tim_user_id || agent.timUserId || '';
98
372
  var name = agent.name || agent.agent_name || agent.agentName || fallbackName || '';
99
373
  var avatar = agent.avatar || agent.avatar_url || agent.avatarUrl || agent.image || agent.logo || agent.photo || '';
374
+ var bio = CL.pickAgentIdentityDescription(agent);
100
375
  var record = {
101
376
  id: id,
102
377
  agent_id: id,
103
378
  tag: agent.tag || id,
104
379
  name: name,
105
380
  avatar: avatar || null,
381
+ bio: bio,
382
+ description: agent.description || bio || '',
383
+ MOM: agent.MOM || agent.mom || '',
106
384
  };
107
385
 
108
386
  var keys = [id, record.tag, name, fallbackName].filter(Boolean);
@@ -576,6 +854,62 @@ if (!window.__clDiagClickProbeInstalled) {
576
854
  }, true);
577
855
  }
578
856
 
857
+ // ════════════════════════════════════════════════════════════════
858
+ // MODULE: host-adapter/selected
859
+ // ════════════════════════════════════════════════════════════════
860
+
861
+ /*__OPENAGENT_HOST_ADAPTER_START__*/
862
+ // HOST ADAPTER: oc-unknown
863
+ // ── Unknown OpenClaw host adapter ──
864
+ // Fail closed: render OpenAgent's own card, but do not apply host-structure
865
+ // takeover selectors when the host version is not one of the supported series.
866
+
867
+ (function _clInstallHostAdapterUnknown() {
868
+ function _false() { return false; }
869
+
870
+ var adapter = {
871
+ id: 'oc-unknown',
872
+ family: 'unknown',
873
+ css: {
874
+ remoteShell: [],
875
+ outputHostMargin: [],
876
+ outputHostMarginReset: [],
877
+ summaryHidden: [],
878
+ hostShellRawText: [],
879
+ rawTextCardHosts: [],
880
+ rawTextPlaceholderHosts: [],
881
+ hostBody: [],
882
+ manualOpenReset: [],
883
+ hostShellReset: [],
884
+ hostShellSummary: [],
885
+ modernCardLayout: false,
886
+ },
887
+ nativeStyle: {
888
+ shellSelectors: [],
889
+ summarySelectors: [],
890
+ indentSelectors: [],
891
+ },
892
+ selectors: {
893
+ textContext: '.chat-text',
894
+ summary: '',
895
+ forceOpenHeader: '',
896
+ rawTextHostClosest: [],
897
+ rawTextHostsWithinShell: '',
898
+ },
899
+ isRemoteNativeToolShellCandidate: _false,
900
+ isNativeToolShell: _false,
901
+ isToolLikeShell: _false,
902
+ isToolBody: _false,
903
+ isMarkableHost: _false,
904
+ };
905
+
906
+ CL.hostAdapter = adapter;
907
+ try {
908
+ document.documentElement.setAttribute('data-openagent-host-adapter', adapter.id);
909
+ } catch (e) {}
910
+ })();
911
+ /*__OPENAGENT_HOST_ADAPTER_END__*/
912
+
579
913
  // ════════════════════════════════════════════════════════════════
580
914
  // MODULE: loader/ws-intercept.js
581
915
  // ════════════════════════════════════════════════════════════════
@@ -1405,7 +1739,7 @@ function avatarUrl(agent) {
1405
1739
  if (agent.avatar.startsWith('http')) return agent.avatar;
1406
1740
  return CL.AUTH_API + '/' + agent.avatar;
1407
1741
  }
1408
- return `https://ui-avatars.com/api/?name=${encodeURIComponent(agent.name)}&background=random&size=64`;
1742
+ return './icon.png';
1409
1743
  }
1410
1744
 
1411
1745
  const ESC_MAP = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' };
@@ -1478,17 +1812,23 @@ function AgentCard(agent, opts = {}) {
1478
1812
  info.appendChild(_text('div', 'agent-card__name', agent.name || ''));
1479
1813
  info.appendChild(_text('div', 'agent-card__bio', agent.bio || '暂无简介'));
1480
1814
  const stats = _el('div', 'agent-card__stats');
1481
- stats.appendChild(_text('span', 'agent-card__stat agent-card__stat--claws', `${formatNumber(agent.claws)}☆`));
1815
+ // 星标 + 数字 紧密组合(Figma gap 1.5px)
1816
+ const statGroup = _el('span', 'agent-card__stat-group');
1817
+ var starIcon = _el('span', 'agent-card__stat-icon');
1818
+ 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>';
1819
+ statGroup.appendChild(starIcon);
1820
+ statGroup.appendChild(_text('span', 'agent-card__stat agent-card__stat--claws', formatNumber(agent.claws)));
1821
+ stats.appendChild(statGroup);
1482
1822
  if (agent.owner) {
1483
- stats.appendChild(_text('span', 'agent-card__stat agent-card__stat--owner', ` · owner${agent.owner}`));
1823
+ stats.appendChild(_text('span', 'agent-card__stat agent-card__stat--owner', ` · ${agent.owner}`));
1484
1824
  }
1485
1825
  info.appendChild(stats);
1486
1826
  contentGroup.appendChild(info);
1487
1827
 
1488
1828
  row1.appendChild(contentGroup);
1489
1829
 
1490
- // @Try 按钮
1491
- const defaultLabel = 'Try';
1830
+ // @召唤 按钮
1831
+ const defaultLabel = '@召唤';
1492
1832
  const btn = _text('button', 'agent-card__action', actionLabel || defaultLabel);
1493
1833
  if (onAction) {
1494
1834
  btn.addEventListener('click', (e) => {
@@ -1524,14 +1864,19 @@ function AgentCard(agent, opts = {}) {
1524
1864
  body.appendChild(_text('div', 'agent-card__bio', agent.bio || '暂无简介'));
1525
1865
 
1526
1866
  const stats = _el('div', 'agent-card__stats');
1527
- stats.appendChild(_text('span', 'agent-card__stat agent-card__stat--claws', `${formatNumber(agent.claws)}☆`));
1867
+ const statGroup = _el('span', 'agent-card__stat-group');
1868
+ var starIcon = _el('span', 'agent-card__stat-icon');
1869
+ 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>';
1870
+ statGroup.appendChild(starIcon);
1871
+ statGroup.appendChild(_text('span', 'agent-card__stat agent-card__stat--claws', formatNumber(agent.claws)));
1872
+ stats.appendChild(statGroup);
1528
1873
  if (agent.owner) {
1529
- stats.appendChild(_text('span', 'agent-card__stat agent-card__stat--owner', ` · owner${agent.owner}`));
1874
+ stats.appendChild(_text('span', 'agent-card__stat agent-card__stat--owner', ` · ${agent.owner}`));
1530
1875
  }
1531
1876
  body.appendChild(stats);
1532
1877
  card.appendChild(body);
1533
1878
 
1534
- const btn = _text('button', 'agent-card__action', actionLabel || 'Try');
1879
+ const btn = _text('button', 'agent-card__action', actionLabel || '@召唤');
1535
1880
  if (onAction) {
1536
1881
  btn.addEventListener('click', (e) => {
1537
1882
  e.stopPropagation();
@@ -1568,14 +1913,19 @@ function AgentCard(agent, opts = {}) {
1568
1913
  body.appendChild(_text('div', 'agent-card__bio', agent.bio || '暂无简介'));
1569
1914
 
1570
1915
  const stats = _el('div', 'agent-card__stats');
1571
- stats.appendChild(_text('span', 'agent-card__stat agent-card__stat--claws', `${formatNumber(agent.claws)}☆`));
1916
+ const statGroup = _el('span', 'agent-card__stat-group');
1917
+ var starIcon = _el('span', 'agent-card__stat-icon');
1918
+ 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>';
1919
+ statGroup.appendChild(starIcon);
1920
+ statGroup.appendChild(_text('span', 'agent-card__stat agent-card__stat--claws', formatNumber(agent.claws)));
1921
+ stats.appendChild(statGroup);
1572
1922
  if (agent.owner) {
1573
- stats.appendChild(_text('span', 'agent-card__stat agent-card__stat--owner', ` · owner${agent.owner}`));
1923
+ stats.appendChild(_text('span', 'agent-card__stat agent-card__stat--owner', ` · ${agent.owner}`));
1574
1924
  }
1575
1925
  body.appendChild(stats);
1576
1926
  card.appendChild(body);
1577
1927
 
1578
- const btn = _text('button', 'agent-card__action', actionLabel || '@ Chat');
1928
+ const btn = _text('button', 'agent-card__action', actionLabel || '@召唤');
1579
1929
  if (onAction) {
1580
1930
  btn.addEventListener('click', (e) => { e.stopPropagation(); onAction(agent); });
1581
1931
  card.addEventListener('click', (e) => { e.stopPropagation(); onAction(agent); });
@@ -1685,10 +2035,13 @@ function AgentCard(agent, opts = {}) {
1685
2035
  // ── 样式注入 ──
1686
2036
 
1687
2037
  function injectStyles() {
1688
- if (document.getElementById('openagent-override-styles')) return;
2038
+ var oldStyle = document.getElementById('openagent-override-styles');
2039
+ if (oldStyle) oldStyle.remove();
1689
2040
 
1690
2041
  const style = document.createElement('style');
1691
2042
  style.id = 'openagent-override-styles';
2043
+ style.setAttribute('data-openagent-style', 'agent-book-panel');
2044
+ style.setAttribute('data-openagent-host-version', CL.hostVersion || 'unknown');
1692
2045
  style.textContent = `
1693
2046
  /* ── 流式回复边框闪烁:覆盖为蓝色 ── */
1694
2047
  @keyframes chatStreamPulse {
@@ -1700,80 +2053,39 @@ function injectStyles() {
1700
2053
  border-color: #3b82f6;
1701
2054
  }
1702
2055
 
1703
- /* ── @ Agent Book 按钮(Figma 1:1117 物理级复刻Mesh Gradient) ── */
2056
+ /* ── @ Agent Book 按钮(Figma 129:955 Frame 72552 紫色渐变) ── */
1704
2057
  .openagent-at-btn {
1705
2058
  position: relative;
1706
- overflow: hidden; /* Figma clipsContent: true */
2059
+ overflow: hidden;
1707
2060
  display: inline-flex;
1708
2061
  align-items: center;
1709
2062
  justify-content: center;
1710
2063
  gap: 4px;
1711
- height: 26px;
1712
- padding: 0 16px;
1713
- border-radius: 100px;
2064
+ height: 27px;
2065
+ padding: 0 12px;
2066
+ border-radius: 150px;
1714
2067
  border: none;
1715
- background: #6ECCFF; /* Figma Frame 72552 底色 */
1716
- box-shadow: inset 0 0 8.5px 0 #96ECFF; /* Figma INNER_SHADOW */
2068
+ background: linear-gradient(90deg, #5c4aff 0%, #8274ff 100%);
1717
2069
  color: #fff;
1718
- font-size: 13px;
1719
- font-weight: 600;
2070
+ font-size: 12px;
2071
+ font-weight: 500;
1720
2072
  cursor: pointer;
1721
2073
  transition: all 0.2s ease;
1722
- line-height: 26px;
2074
+ line-height: 27px;
1723
2075
  margin-left: 6px;
1724
2076
  white-space: nowrap;
1725
2077
  flex-shrink: 0;
1726
2078
  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;
2079
+ font-family: "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
1767
2080
  }
1768
2081
 
1769
2082
  .openagent-at-btn:hover {
1770
- filter: brightness(1.08);
1771
2083
  transform: translateY(-1px);
1772
- box-shadow: inset 0 0 8.5px 0 #96ECFF, 0 2px 8px rgba(110, 204, 255, 0.4);
2084
+ box-shadow: inset 0 0 6px 1px rgba(255, 255, 255, 0.65);
1773
2085
  }
1774
2086
  .openagent-at-btn .at-sym {
1775
- font-size: 14px;
1776
- font-weight: 700;
2087
+ font-size: 11.6px;
2088
+ font-weight: 500;
1777
2089
  color: #fff;
1778
2090
  }
1779
2091
 
@@ -1796,9 +2108,8 @@ function injectStyles() {
1796
2108
  position: fixed;
1797
2109
  max-height: none;
1798
2110
  background: var(--oa-panel-bg, #fff);
1799
- border: 1.2px solid var(--oa-border, rgba(47, 47, 51, 0.12));
1800
- border-radius: 18px;
1801
- 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));
2111
+ border: 0.5px solid #dbdbdb;
2112
+ border-radius: 16px;
1802
2113
  z-index: 99999;
1803
2114
  overflow: hidden;
1804
2115
  display: none;
@@ -1810,6 +2121,7 @@ function injectStyles() {
1810
2121
  }
1811
2122
  .openagent-agent-panel.visible {
1812
2123
  display: flex;
2124
+ padding: 30px;
1813
2125
  animation: openagent-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
1814
2126
  }
1815
2127
  @keyframes openagent-up {
@@ -1823,28 +2135,26 @@ function injectStyles() {
1823
2135
  justify-content: space-between;
1824
2136
  align-items: center;
1825
2137
  min-height: 26px;
1826
- padding: 6px 10px 0 10px;
1827
2138
  border-bottom: none;
1828
2139
  }
1829
2140
  .openagent-panel-title {
1830
2141
  display: flex;
1831
2142
  align-items: center;
1832
2143
  gap: 6px;
1833
- font-size: 16px;
2144
+ font-size: 18px;
1834
2145
  font-weight: 500;
1835
- color: rgba(47, 47, 51, 0.8);
2146
+ color: #333;
1836
2147
  text-transform: uppercase;
1837
2148
  letter-spacing: 0.3px;
1838
2149
  }
1839
2150
  .openagent-panel-title-icon {
1840
- width: 21px;
1841
- height: 21px;
2151
+ width: 24px;
2152
+ height: 24px;
1842
2153
  flex-shrink: 0;
1843
2154
  }
1844
2155
  .openagent-panel-close {
1845
- background: var(--oa-card-bg, rgba(249, 249, 249, 1));
2156
+ background: transparent;
1846
2157
  border: none;
1847
- color: rgba(47, 47, 51, 0.6);
1848
2158
  cursor: pointer;
1849
2159
  width: 21px;
1850
2160
  height: 21px;
@@ -1860,17 +2170,184 @@ function injectStyles() {
1860
2170
  }
1861
2171
  .openagent-panel-close:hover {
1862
2172
  background: #eee;
1863
- color: rgba(47, 47, 51, 1);
1864
2173
  }
1865
2174
 
1866
2175
  /* ── 分隔线(Figma: 0.2px, opacity 0.16) ── */
1867
2176
  .openagent-panel-divider {
1868
2177
  height: 0;
1869
2178
  border: none;
1870
- border-top: 0.2px solid rgba(47, 47, 51, 0.16);
2179
+ border-top: 0.2px solid #EAEAEA;
1871
2180
  margin: 0;
1872
2181
  }
1873
2182
 
2183
+ /* ── 提示栏(Figma 141:3293,页面加载即显示) ── */
2184
+ .openagent-hint-bar {
2185
+ display: flex;
2186
+ align-items: center;
2187
+ justify-content: space-between;
2188
+ padding: 12px 12px;
2189
+ margin-bottom: 12px;
2190
+ background: #fff;
2191
+ border: 1.2px solid rgba(47, 47, 51, 0.1);
2192
+ border-radius: var(--radius-lg, 18px);
2193
+ gap: 12px;
2194
+ width: 100%;
2195
+ box-sizing: border-box;
2196
+ margin:0 auto;
2197
+ margin-bottom: 12px;
2198
+ }
2199
+ .openagent-hint-bar__content {
2200
+ display: flex;
2201
+ align-items: center;
2202
+ gap: 9px;
2203
+ flex: 1;
2204
+ min-width: 0;
2205
+ }
2206
+ .openagent-hint-bar__icon {
2207
+ display: flex;
2208
+ align-items: center;
2209
+ justify-content: center;
2210
+ width: 27px;
2211
+ height: 27px;
2212
+ border-radius: 6px;
2213
+ background: linear-gradient(135deg, rgba(130,116,255,0.1) 0%, rgba(56,144,255,0.1) 100%);
2214
+ flex-shrink: 0;
2215
+ }
2216
+ .openagent-hint-bar__text {
2217
+ font-family: "PingFang SC", sans-serif;
2218
+ font-size: 15px;
2219
+ font-weight: 400;
2220
+ color: rgba(51, 51, 51, 0.8);
2221
+ white-space: nowrap;
2222
+ overflow: hidden;
2223
+ text-overflow: ellipsis;
2224
+ }
2225
+ .openagent-hint-bar__close {
2226
+ display: flex;
2227
+ align-items: center;
2228
+ justify-content: center;
2229
+ width: 21px;
2230
+ height: 21px;
2231
+ padding: 0;
2232
+ border: none;
2233
+ background: transparent;
2234
+ cursor: pointer;
2235
+ flex-shrink: 0;
2236
+ border-radius: 4px;
2237
+ transition: all 0.1s;
2238
+ }
2239
+ .openagent-hint-bar__close:hover {
2240
+ background: #eee;
2241
+ }
2242
+
2243
+ /* 暗色主题 */
2244
+ [data-theme-mode="dark"] .openagent-hint-bar,
2245
+ [data-theme="dark"] .openagent-hint-bar {
2246
+ background: #1c1c1c;
2247
+ border-color: rgba(255,255,255,0.1);
2248
+ }
2249
+ [data-theme-mode="dark"] .openagent-hint-bar__text,
2250
+ [data-theme="dark"] .openagent-hint-bar__text {
2251
+ color: rgba(224, 224, 224, 0.8);
2252
+ }
2253
+ [data-theme-mode="dark"] .openagent-hint-bar__close,
2254
+ [data-theme="dark"] .openagent-hint-bar__close {
2255
+ }
2256
+ [data-theme-mode="dark"] .openagent-hint-bar__close:hover,
2257
+ [data-theme="dark"] .openagent-hint-bar__close:hover {
2258
+ background: #333;
2259
+ }
2260
+
2261
+ /* ── 空状态独立浮层(Figma 144:3444) ── */
2262
+ .openagent-empty-toast {
2263
+ display: flex;
2264
+ align-items: center;
2265
+ gap: 9px;
2266
+ padding: 18px;
2267
+ background: #fff;
2268
+ border: 1.2px solid rgba(47, 47, 51, 0.1);
2269
+ border-radius: 18px;
2270
+ box-sizing: border-box;
2271
+ animation: openagent-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
2272
+ box-shadow: 0 -4px 24px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
2273
+ }
2274
+ [data-theme-mode="dark"] .openagent-empty-toast,
2275
+ [data-theme="dark"] .openagent-empty-toast {
2276
+ background: #1c1c1c; border-color: rgba(255,255,255,0.1);
2277
+ box-shadow: 0 -4px 24px rgba(0,0,0,0.3);
2278
+ }
2279
+ [data-theme-mode="dark"] .openagent-empty-toast .openagent-empty-state__text,
2280
+ [data-theme="dark"] .openagent-empty-toast .openagent-empty-state__text {
2281
+ color: rgba(224, 224, 224, 0.8);
2282
+ }
2283
+ [data-theme-mode="dark"] .openagent-empty-toast .openagent-empty-state__close,
2284
+ [data-theme="dark"] .openagent-empty-toast .openagent-empty-state__close {
2285
+ }
2286
+
2287
+ /* ── 空状态(Figma 144:3444)— 无匹配结果 ── */
2288
+ .openagent-empty-state {
2289
+ padding: 18px;
2290
+ background: #fff;
2291
+ border: 1.2px solid rgba(47, 47, 51, 0.1);
2292
+ border-radius: 18px;
2293
+ }
2294
+ .openagent-empty-state__row {
2295
+ display: flex;
2296
+ align-items: flex-start;
2297
+ justify-content: space-between;
2298
+ gap: 9px;
2299
+ }
2300
+ .openagent-empty-state__icon {
2301
+ display: flex;
2302
+ align-items: center;
2303
+ justify-content: center;
2304
+ width: 27px;
2305
+ height: 27px;
2306
+ border-radius: 6px;
2307
+ background: linear-gradient(135deg, rgba(92,74,255,0.1) 0%, rgba(130,116,255,0.1) 100%);
2308
+ flex-shrink: 0;
2309
+ }
2310
+ .openagent-empty-state__text {
2311
+ flex: 1;
2312
+ font-family: "PingFang SC", sans-serif;
2313
+ font-size: 15px;
2314
+ font-weight: 400;
2315
+ color: rgba(51, 51, 51, 0.8);
2316
+ line-height: 1.5;
2317
+ }
2318
+ .openagent-empty-state__close {
2319
+ display: flex;
2320
+ align-items: center;
2321
+ justify-content: center;
2322
+ width: 21px;
2323
+ height: 21px;
2324
+ padding: 0;
2325
+ border: none;
2326
+ background: transparent;
2327
+ cursor: pointer;
2328
+ flex-shrink: 0;
2329
+ border-radius: 4px;
2330
+ }
2331
+ .openagent-empty-state__close:hover {
2332
+ background: #eee;
2333
+ }
2334
+ [data-theme-mode="dark"] .openagent-empty-state,
2335
+ [data-theme="dark"] .openagent-empty-state {
2336
+ background: #1c1c1c;
2337
+ border-color: rgba(255,255,255,0.1);
2338
+ }
2339
+ [data-theme-mode="dark"] .openagent-empty-state__text,
2340
+ [data-theme="dark"] .openagent-empty-state__text {
2341
+ color: rgba(224, 224, 224, 0.8);
2342
+ }
2343
+ [data-theme-mode="dark"] .openagent-empty-state__close,
2344
+ [data-theme="dark"] .openagent-empty-state__close {
2345
+ }
2346
+ [data-theme-mode="dark"] .openagent-empty-state__close:hover,
2347
+ [data-theme="dark"] .openagent-empty-state__close:hover {
2348
+ background: #333;
2349
+ }
2350
+
1874
2351
  /* ── Agent 列表(section stack) ── */
1875
2352
  .openagent-agent-list {
1876
2353
  overflow-y: auto;
@@ -1878,7 +2355,6 @@ function injectStyles() {
1878
2355
  flex: 1;
1879
2356
  display: flex;
1880
2357
  flex-direction: column;
1881
- gap: 14px;
1882
2358
  min-height: 0;
1883
2359
  max-height: min(56vh, 451px);
1884
2360
  scrollbar-width: thin;
@@ -1901,9 +2377,9 @@ function injectStyles() {
1901
2377
  .openagent-agent-section {
1902
2378
  display: flex;
1903
2379
  flex-direction: column;
1904
- gap: 8px;
1905
2380
  width: 100%;
1906
2381
  min-width: 0;
2382
+ margin-bottom: 30px;
1907
2383
  }
1908
2384
 
1909
2385
  /* ── 父分类标题(两级结构:Research > Market Research) ── */
@@ -1914,33 +2390,22 @@ function injectStyles() {
1914
2390
  width: 100%;
1915
2391
  min-width: 0;
1916
2392
  }
1917
- .openagent-parent-heading {
1918
- font-size: 11px;
1919
- font-weight: 600;
1920
- line-height: 13px;
1921
- color: rgba(47, 47, 51, 0.45);
1922
- padding: 0 12px;
1923
- text-transform: uppercase;
1924
- letter-spacing: 0.8px;
1925
- }
1926
-
1927
2393
  /* ── 分组标题 ── */
1928
2394
  .openagent-section-heading {
1929
- font-size: 14px;
2395
+ font-size: 16px;
1930
2396
  font-weight: 400;
1931
- line-height: 14px;
2397
+ line-height: 16px;
1932
2398
  color: rgba(47, 47, 51, 0.80);
1933
- padding: 0 12px 0 12px;
1934
2399
  letter-spacing: 0;
2400
+ margin-bottom: 20px;
1935
2401
  }
1936
2402
 
1937
2403
  /* ── 分组网格容器 ── */
1938
2404
  .openagent-section-grid {
1939
2405
  display: grid;
1940
- grid-template-columns: repeat(3, minmax(0, 439.5px));
2406
+ grid-template-columns: repeat(3, 1fr);
1941
2407
  justify-content: start;
1942
- gap: 8px 14px;
1943
- padding: 0 12px;
2408
+ gap: 12px;
1944
2409
  width: 100%;
1945
2410
  box-sizing: border-box;
1946
2411
  }
@@ -1973,9 +2438,15 @@ function injectStyles() {
1973
2438
  .agent-card__body { flex: 1; min-width: 0; }
1974
2439
  .agent-card__name-line { display: flex; align-items: baseline; gap: 8px; }
1975
2440
  .agent-card__name {
2441
+ display: block;
2442
+ min-width: 0;
2443
+ max-width: 100%;
1976
2444
  font-family: "PingFang SC", sans-serif;
1977
2445
  font-weight: 600;
1978
2446
  color: rgba(47, 47, 51, 1);
2447
+ white-space: nowrap;
2448
+ overflow: hidden;
2449
+ text-overflow: ellipsis;
1979
2450
  }
1980
2451
  .agent-card__tag { font-size: 12px; color: #6366f1; font-weight: 500; }
1981
2452
  .agent-card__specialty { font-size: 12px; color: #999; font-weight: 400; }
@@ -1999,8 +2470,25 @@ function injectStyles() {
1999
2470
  gap: 0;
2000
2471
  flex-wrap: wrap;
2001
2472
  }
2002
- .agent-card__stat {
2003
- font-family: "PingFang SC", sans-serif;
2473
+ /* 星标+数字 紧密组合(Figma gap 1.5px) */
2474
+ .agent-card__stat-group {
2475
+ display: flex;
2476
+ align-items: center;
2477
+ gap: 1.5px;
2478
+ }
2479
+ .agent-card__stat-icon {
2480
+ display: inline-flex;
2481
+ align-items: center;
2482
+ justify-content: center;
2483
+ width: 12px;
2484
+ height: 12px;
2485
+ font-size: 14px;
2486
+ line-height: 1;
2487
+ color: #666;
2488
+ flex-shrink: 0;
2489
+ }
2490
+ .agent-card__stat {
2491
+ font-family: "PingFang SC", sans-serif;
2004
2492
  font-size: 13.5px;
2005
2493
  font-weight: 400;
2006
2494
  white-space: nowrap;
@@ -2024,96 +2512,99 @@ function injectStyles() {
2024
2512
  white-space: nowrap;
2025
2513
  }
2026
2514
 
2027
- /* ── mode: mention(Figma Agent item avart 实例) ── */
2515
+ /* ── mode: mention(Figma Agent 卡片 142:3392) ── */
2028
2516
  .agent-card--mention {
2029
2517
  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;
2518
+ align-items: center;
2519
+ gap: 10px;
2520
+ padding: 15px;
2521
+ border-radius: 20px;
2522
+ border: 0.5px solid #dbdbdb;
2523
+ background: #fff;
2037
2524
  min-width: 0;
2525
+ box-sizing: border-box;
2038
2526
  }
2039
2527
  .agent-card--mention:hover {
2040
- background: rgba(0, 0, 0, 0.02);
2528
+ border-color: transparent;
2529
+ box-shadow: 0 4px 12px 0 rgba(149, 147, 240, 0.10);
2041
2530
  }
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;
2531
+ .openagent-agent-list .agent-card--mention:hover,
2532
+ .openagent-agent-list .agent-card--search:hover {
2533
+ position: relative;
2534
+ border-color: transparent;
2047
2535
  }
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);
2536
+ .openagent-agent-list .agent-card--mention:hover::after,
2537
+ .openagent-agent-list .agent-card--search:hover::after {
2538
+ content: "";
2539
+ position: absolute;
2540
+ inset: 0;
2541
+ border-radius: inherit;
2542
+ padding: 1px;
2543
+ background: linear-gradient(90deg, rgba(92, 74, 255, 0.5), rgba(130, 116, 255, 0.5));
2544
+ pointer-events: none;
2545
+ box-sizing: border-box;
2546
+ -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
2547
+ -webkit-mask-composite: xor;
2548
+ mask-composite: exclude;
2051
2549
  }
2052
-
2053
- /* avart 外壳: Figma px 12, centered */
2550
+ /* avart 外壳简化 — 不再需要 */
2054
2551
  .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;
2552
+ display: contents;
2553
+ padding: 0;
2554
+ flex: none;
2061
2555
  min-width: 0;
2062
- box-sizing: border-box;
2063
2556
  }
2064
2557
 
2065
- /* 第一行: row, gap:24 (内容组 + @Try) */
2558
+ /* 第一行: 内容区 + 按钮 */
2066
2559
  .agent-card--mention .agent-card__row1 {
2067
- display: flex;
2068
- flex-direction: row;
2069
- align-items: center;
2070
- gap: 16px;
2071
- width: 100%;
2560
+ display: contents;
2561
+ gap: 0;
2562
+ width: auto;
2072
2563
  min-width: 0;
2073
2564
  }
2074
2565
 
2075
- /* 内容组: row, gap:18 (头像 + 信息列) */
2566
+ /* 内容组: 头像 + 信息列 */
2076
2567
  .agent-card--mention .agent-card__content-group {
2077
2568
  display: flex;
2078
2569
  flex-direction: row;
2079
- align-items: flex-start;
2080
- gap: 12px;
2570
+ align-items: center;
2571
+ gap: 10px;
2081
2572
  flex: 1;
2082
2573
  min-width: 0;
2083
2574
  }
2084
2575
 
2085
- /* 头像 */
2576
+ /* 头像: 50×50 */
2086
2577
  .agent-card--mention .agent-card__avatar {
2087
- width: 48px;
2088
- height: 48px;
2578
+ width: 50px;
2579
+ height: 50px;
2089
2580
  border-radius: 50%;
2090
2581
  border: none;
2091
2582
  flex-shrink: 0;
2092
2583
  margin-top: 0;
2093
2584
  }
2094
2585
 
2095
- /* 信息列: name / bio / stats */
2586
+ /* 信息列 */
2096
2587
  .agent-card--mention .agent-card__info {
2097
2588
  display: flex;
2098
2589
  flex-direction: column;
2099
- gap: 4px;
2100
- padding: 3px 0;
2590
+ gap: 6px;
2591
+ padding: 0;
2101
2592
  flex: 1;
2102
2593
  min-width: 0;
2103
2594
  }
2104
2595
 
2105
2596
  .agent-card--mention .agent-card__name {
2106
- font-size: 12px;
2597
+ font-size: 15px;
2107
2598
  font-weight: 600;
2108
- line-height: 14px;
2109
- color: rgba(47, 47, 51, 1);
2599
+ line-height: 1;
2600
+ color: #333;
2601
+ width:200px;
2110
2602
  }
2111
2603
  .agent-card--mention .agent-card__bio {
2112
- font-size: 10px;
2604
+ font-size: 14px;
2113
2605
  font-weight: 400;
2114
- line-height: 14px;
2115
- color: rgba(47, 47, 51, 0.40);
2116
- text-align: justify;
2606
+ line-height: 1.5;
2607
+ color: rgba(47, 47, 51, 0.80);
2117
2608
  overflow: hidden;
2118
2609
  text-overflow: ellipsis;
2119
2610
  display: -webkit-box;
@@ -2122,37 +2613,31 @@ function injectStyles() {
2122
2613
  margin-top: 0;
2123
2614
  }
2124
2615
 
2125
- /* @Try 按钮 */
2616
+ /* @召唤 按钮 */
2126
2617
  .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);
2618
+ height: 36px;
2619
+ padding: 0 18px;
2620
+ border-radius: 23px;
2621
+ background: transparent;
2622
+ border: 0.5px solid #dbdbdb;
2623
+ color: #333;
2134
2624
  font-family: "PingFang SC", sans-serif;
2135
- font-size: 12px;
2625
+ font-size: 16px;
2136
2626
  font-weight: 500;
2137
- line-height: 12px;
2627
+ line-height: 15.43px;
2138
2628
  text-transform: capitalize;
2139
2629
  flex-shrink: 0;
2140
2630
  display: inline-flex;
2141
2631
  align-items: center;
2142
2632
  justify-content: center;
2633
+ width: auto;
2143
2634
  }
2144
- .agent-card--mention .agent-card__action::before { content: '@'; font-weight: 600; }
2635
+ .agent-card--mention .agent-card__action::before { content: none; }
2145
2636
  .agent-card--mention .agent-card__action:hover {
2146
- background: #e2e3e5;
2637
+ background: rgba(0, 0, 0, 0.04);
2147
2638
  }
2148
2639
 
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
- }
2640
+ /* 统计行 */
2156
2641
  .agent-card--mention .agent-card__stats {
2157
2642
  display: flex;
2158
2643
  align-items: center;
@@ -2160,16 +2645,21 @@ function injectStyles() {
2160
2645
  margin-top: 0;
2161
2646
  }
2162
2647
  .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;
2648
+ color: #666;
2649
+ font-size: 14px;
2650
+ line-height: 1;
2651
+ letter-spacing: 1.5px;
2167
2652
  }
2168
2653
  .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;
2654
+ color: #666;
2655
+ font-size: 14px;
2656
+ line-height: 1;
2657
+ letter-spacing: 1.5px;
2658
+ }
2659
+
2660
+ /* row2 (legacy compat) */
2661
+ .agent-card--mention .agent-card__row2 {
2662
+ display: none;
2173
2663
  }
2174
2664
 
2175
2665
  /* ── mode: search(有输入搜索结果,沿用旧式单列行) ── */
@@ -2179,18 +2669,11 @@ function injectStyles() {
2179
2669
  width: 100%;
2180
2670
  min-height: 64px;
2181
2671
  padding: 10px 12px;
2182
- border-radius: 10px;
2672
+ border-radius: 20px;
2183
2673
  background: transparent;
2674
+ border: 0.5px solid transparent;
2184
2675
  box-sizing: border-box;
2185
2676
  }
2186
- .agent-card--search:hover {
2187
- background: rgba(0, 0, 0, 0.02);
2188
- }
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
2677
  .agent-card--search .agent-card__avatar {
2195
2678
  width: 40px;
2196
2679
  height: 40px;
@@ -2204,48 +2687,50 @@ function injectStyles() {
2204
2687
  min-width: 0;
2205
2688
  }
2206
2689
  .agent-card--search .agent-card__name {
2207
- font-size: 13px;
2690
+ font-size: 15px;
2208
2691
  line-height: 16px;
2209
2692
  font-weight: 600;
2210
- color: rgba(47, 47, 51, 1);
2693
+ color: #333;
2211
2694
  }
2212
2695
  .agent-card--search .agent-card__bio {
2213
- font-size: 11px;
2214
- line-height: 15px;
2215
- color: rgba(47, 47, 51, 0.45);
2696
+ font-size: 14px;
2697
+ line-height: 1.5;
2698
+ color: rgba(47, 47, 51, 0.80);
2216
2699
  -webkit-line-clamp: 1;
2217
2700
  }
2218
2701
  .agent-card--search .agent-card__stats {
2219
2702
  margin-top: 0;
2220
2703
  }
2221
2704
  .agent-card--search .agent-card__stat--claws {
2222
- font-size: 11px;
2223
- line-height: 13px;
2224
- color: rgba(240, 152, 0, 1);
2705
+ font-size: 14px;
2706
+ line-height: 1;
2707
+ color: #666;
2708
+ letter-spacing: 1.5px;
2225
2709
  }
2226
2710
  .agent-card--search .agent-card__stat--owner {
2227
- font-size: 11px;
2228
- line-height: 13px;
2229
- color: rgba(47, 47, 51, 0.65);
2711
+ font-size: 14px;
2712
+ line-height: 1;
2713
+ color: #666;
2714
+ letter-spacing: 1.5px;
2230
2715
  }
2231
2716
  .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);
2717
+ height: 36px;
2718
+ padding: 0 18px;
2719
+ border-radius: 23px;
2720
+ background: transparent;
2721
+ border: 0.5px solid #dbdbdb;
2722
+ color: #333;
2239
2723
  font-family: "PingFang SC", sans-serif;
2240
- font-size: 12px;
2241
- line-height: 12px;
2724
+ font-size: 16px;
2725
+ font-weight: 500;
2726
+ line-height: 15.43px;
2242
2727
  display: inline-flex;
2243
2728
  align-items: center;
2244
2729
  justify-content: center;
2245
2730
  }
2246
- .agent-card--search .agent-card__action::before { content: '@'; font-weight: 600; }
2731
+ .agent-card--search .agent-card__action::before { content: none; }
2247
2732
  .agent-card--search .agent-card__action:hover {
2248
- background: #e2e3e5;
2733
+ background: rgba(0, 0, 0, 0.04);
2249
2734
  }
2250
2735
 
2251
2736
  @media (max-width: 980px) {
@@ -2306,20 +2791,17 @@ function injectStyles() {
2306
2791
  [data-theme-mode="dark"] .openagent-agent-panel,
2307
2792
  [data-theme="dark"] .openagent-agent-panel {
2308
2793
  background: #1c1c1c; border-color: rgba(255,255,255,0.12);
2309
- box-shadow: 0 -4px 24px rgba(0,0,0,0.3);
2310
2794
  }
2311
2795
  [data-theme-mode="dark"] .openagent-panel-head,
2312
2796
  [data-theme="dark"] .openagent-panel-head { border-color: #2a2a2a; }
2313
2797
  [data-theme-mode="dark"] .openagent-panel-title,
2314
2798
  [data-theme="dark"] .openagent-panel-title { color: rgba(224, 224, 224, 0.8); }
2315
2799
  [data-theme-mode="dark"] .openagent-panel-close,
2316
- [data-theme="dark"] .openagent-panel-close { background: #2a2a2a; color: #888; }
2800
+ [data-theme="dark"] .openagent-panel-close { background: #2a2a2a; }
2317
2801
  [data-theme-mode="dark"] .openagent-panel-close:hover,
2318
- [data-theme="dark"] .openagent-panel-close:hover { background: #333; color: #ccc; }
2802
+ [data-theme="dark"] .openagent-panel-close:hover { background: #333; }
2319
2803
  [data-theme-mode="dark"] .openagent-section-heading,
2320
2804
  [data-theme="dark"] .openagent-section-heading { color: rgba(224, 224, 224, 0.45); }
2321
- [data-theme-mode="dark"] .openagent-parent-heading,
2322
- [data-theme="dark"] .openagent-parent-heading { color: rgba(224, 224, 224, 0.3); }
2323
2805
  [data-theme-mode="dark"] .openagent-panel-divider,
2324
2806
  [data-theme="dark"] .openagent-panel-divider { border-color: rgba(255,255,255,0.1); }
2325
2807
 
@@ -2331,28 +2813,37 @@ function injectStyles() {
2331
2813
  [data-theme="dark"] .agent-card__stat { color: #64748b; }
2332
2814
 
2333
2815
  [data-theme-mode="dark"] .agent-card--mention,
2334
- [data-theme="dark"] .agent-card--mention { background: transparent; }
2816
+ [data-theme="dark"] .agent-card--mention { background: #1c1c1c; border-color: rgba(255,255,255,0.12); }
2335
2817
  [data-theme-mode="dark"] .agent-card--mention:hover,
2336
- [data-theme="dark"] .agent-card--mention:hover { background: #252525; }
2818
+ [data-theme="dark"] .agent-card--mention:hover { border-color: transparent; }
2819
+ [data-theme-mode="dark"] .agent-card--mention .agent-card__name,
2820
+ [data-theme="dark"] .agent-card--mention .agent-card__name { color: #e0e0e0; }
2821
+ [data-theme-mode="dark"] .agent-card--mention .agent-card__bio,
2822
+ [data-theme="dark"] .agent-card--mention .agent-card__bio { color: rgba(224,224,224,0.7); }
2823
+ [data-theme-mode="dark"] .agent-card--mention .agent-card__stat--claws,
2824
+ [data-theme="dark"] .agent-card--mention .agent-card__stat--claws { color: #aaa; }
2825
+ [data-theme-mode="dark"] .agent-card--mention .agent-card__stat--owner,
2826
+ [data-theme="dark"] .agent-card--mention .agent-card__stat--owner { color: #aaa; }
2337
2827
  [data-theme-mode="dark"] .agent-card--mention .agent-card__action,
2338
2828
  [data-theme="dark"] .agent-card--mention .agent-card__action {
2339
- background: #333; border-color: #555; color: #ddd;
2829
+ background: transparent; border-color: rgba(255,255,255,0.2); color: #ddd;
2340
2830
  }
2341
2831
  [data-theme-mode="dark"] .agent-card--mention .agent-card__action:hover,
2342
- [data-theme="dark"] .agent-card--mention .agent-card__action:hover { background: #444; }
2343
- [data-theme-mode="dark"] .agent-card--search:hover,
2344
- [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
- }
2832
+ [data-theme="dark"] .agent-card--mention .agent-card__action:hover { background: rgba(255,255,255,0.06); }
2833
+ [data-theme-mode="dark"] .agent-card--search .agent-card__name,
2834
+ [data-theme="dark"] .agent-card--search .agent-card__name { color: #e0e0e0; }
2835
+ [data-theme-mode="dark"] .agent-card--search .agent-card__bio,
2836
+ [data-theme="dark"] .agent-card--search .agent-card__bio { color: rgba(224, 224, 224, 0.65); }
2837
+ [data-theme-mode="dark"] .agent-card--search .agent-card__stat--claws,
2838
+ [data-theme="dark"] .agent-card--search .agent-card__stat--claws { color: #aaa; }
2839
+ [data-theme-mode="dark"] .agent-card--search .agent-card__stat--owner,
2840
+ [data-theme="dark"] .agent-card--search .agent-card__stat--owner { color: #aaa; }
2350
2841
  [data-theme-mode="dark"] .agent-card--search .agent-card__action,
2351
2842
  [data-theme="dark"] .agent-card--search .agent-card__action {
2352
- background: #333; border-color: #555; color: #ddd;
2843
+ background: transparent; border-color: rgba(255,255,255,0.2); color: #ddd;
2353
2844
  }
2354
2845
  [data-theme-mode="dark"] .agent-card--search .agent-card__action:hover,
2355
- [data-theme="dark"] .agent-card--search .agent-card__action:hover { background: #444; }
2846
+ [data-theme="dark"] .agent-card--search .agent-card__action:hover { background: rgba(255,255,255,0.06); }
2356
2847
 
2357
2848
 
2358
2849
  [data-theme-mode="dark"] .agent-card--inline,
@@ -2370,7 +2861,8 @@ function injectStyles() {
2370
2861
  [data-theme="dark"] .agent-card__loading {
2371
2862
  background: #1e1b3a; border-color: #2d2b55; color: #64748b;
2372
2863
  }
2373
- `;
2864
+
2865
+ `;
2374
2866
  document.head.appendChild(style);
2375
2867
  }
2376
2868
 
@@ -2597,6 +3089,7 @@ let panel = null;
2597
3089
  let backdrop = null;
2598
3090
 
2599
3091
  let inputWrapperRef = null; // 保存输入框包裹层引用
3092
+ let panelPositionResizeObserver = null;
2600
3093
 
2601
3094
  // ── 键盘导航状态(§1.5)──
2602
3095
  // 对标 TIM index.ts:13 "let selectedIndex: number = 0"
@@ -2631,14 +3124,14 @@ panel.className = 'openagent-agent-panel';
2631
3124
  panel.innerHTML = `
2632
3125
  <div class="openagent-panel-head">
2633
3126
  <span class="openagent-panel-title">
2634
- <svg class="openagent-panel-title-icon" width="28" height="28" viewBox="0 0 56 56" fill="none">
3127
+ <svg class="openagent-panel-title-icon" width="24" height="24" viewBox="0 0 56 56" fill="none">
2635
3128
  <path d="M28 25H32C34.2091 25 36 26.7909 36 29V39C36 41.2091 34.2091 43 32 43H14C11.7909 43 10 41.2091 10 39V29C10 26.7909 11.7909 25 14 25H15" stroke="#12CCF6" stroke-width="3.3" stroke-linecap="round"/>
2636
3129
  <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
3130
  <path d="M27 25.5L32.5 21" stroke="#12CCF6" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
2638
3131
  </svg>
2639
- <span class="panel-title-text">Agent Book</span>
3132
+ <span class="panel-title-text">OpenAgent</span>
2640
3133
  </span>
2641
- <button class="openagent-panel-close">✕</button>
3134
+ <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
3135
  </div>
2643
3136
  <hr class="openagent-panel-divider" />
2644
3137
  <div class="openagent-agent-list">
@@ -2651,6 +3144,15 @@ panel.querySelector('.openagent-panel-close').addEventListener('click', () => {
2651
3144
  closePanel();
2652
3145
  });
2653
3146
 
3147
+
3148
+ // 提示栏关闭按钮
3149
+ const hintClose = panel.querySelector('.openagent-hint-bar__close');
3150
+ if (hintClose) {
3151
+ hintClose.addEventListener('click', () => {
3152
+ const hintBar = panel.querySelector('.openagent-hint-bar');
3153
+ if (hintBar) hintBar.style.display = 'none';
3154
+ });
3155
+ }
2654
3156
  // 挂到 body(与 backdrop 同级,z-index 自然生效)
2655
3157
  document.body.appendChild(panel);
2656
3158
  return panel;
@@ -2665,12 +3167,71 @@ const width = Math.min(rect.width, window.innerWidth - viewportPadding * 2);
2665
3167
  const left = Math.max(viewportPadding, Math.min(rect.left, window.innerWidth - width - viewportPadding));
2666
3168
  panel.style.left = left + 'px';
2667
3169
  panel.style.width = width + 'px';
2668
- panel.style.bottom = (window.innerHeight - rect.top + 8) + 'px';
3170
+ const toolbar = _findPanelToolbar();
3171
+ const isComposerWrapper = inputWrapperRef.classList
3172
+ && inputWrapperRef.classList.contains('agent-chat__composer-combobox');
3173
+ if (isComposerWrapper) {
3174
+ panel.style.bottom = (_readElementHeight(inputWrapperRef) + _readElementHeight(toolbar) + 35) + 'px';
3175
+ } else {
3176
+ panel.style.bottom = (window.innerHeight - rect.top + 8) + 'px';
3177
+ }
2669
3178
  }
2670
3179
 
2671
3180
  /** resize 时实时跟随输入框 */
2672
3181
  function _onResize() { _positionPanel(); }
2673
3182
 
3183
+ function _findPanelToolbar() {
3184
+ if (!inputWrapperRef) return null;
3185
+ var chatInput = inputWrapperRef.closest && inputWrapperRef.closest('.agent-chat__input');
3186
+ if (chatInput) {
3187
+ var toolbar = chatInput.querySelector('.agent-chat__toolbar');
3188
+ if (toolbar) return toolbar;
3189
+ }
3190
+
3191
+ var parentEl = inputWrapperRef.parentElement;
3192
+ if (parentEl) {
3193
+ for (var i = 0; i < parentEl.children.length; i++) {
3194
+ var child = parentEl.children[i];
3195
+ if (child !== inputWrapperRef && child.className && String(child.className).indexOf('agent-chat__toolbar') !== -1) {
3196
+ return child;
3197
+ }
3198
+ }
3199
+ }
3200
+ return null;
3201
+ }
3202
+
3203
+ function _readElementHeight(el) {
3204
+ if (!el) return 0;
3205
+ var rect = el.getBoundingClientRect ? el.getBoundingClientRect() : null;
3206
+ if (rect && rect.height > 0) return rect.height;
3207
+ return typeof el.offsetHeight === 'number' ? el.offsetHeight : 0;
3208
+ }
3209
+
3210
+ function _schedulePanelPosition() {
3211
+ window.requestAnimationFrame
3212
+ ? window.requestAnimationFrame(_positionPanel)
3213
+ : setTimeout(_positionPanel, 0);
3214
+ }
3215
+
3216
+ function _installPanelPositionObservers() {
3217
+ if (panelPositionResizeObserver) {
3218
+ panelPositionResizeObserver.disconnect();
3219
+ panelPositionResizeObserver = null;
3220
+ }
3221
+ if (typeof ResizeObserver !== 'function' || !inputWrapperRef) return;
3222
+
3223
+ panelPositionResizeObserver = new ResizeObserver(_schedulePanelPosition);
3224
+ panelPositionResizeObserver.observe(inputWrapperRef);
3225
+ var toolbar = _findPanelToolbar();
3226
+ if (toolbar) panelPositionResizeObserver.observe(toolbar);
3227
+ }
3228
+
3229
+ function _teardownPanelPositionObservers() {
3230
+ if (!panelPositionResizeObserver) return;
3231
+ panelPositionResizeObserver.disconnect();
3232
+ panelPositionResizeObserver = null;
3233
+ }
3234
+
2674
3235
  // 搜索状态管理
2675
3236
  let currentAbort = null; // AbortController for in-flight search
2676
3237
  let searchDebounceId = null;
@@ -2689,8 +3250,15 @@ return textarea.value.replace(/@/g, ' ').replace(/\s+/g, ' ').trim();
2689
3250
  }
2690
3251
 
2691
3252
  function openPanel(textarea) {
3253
+ // 清除上次的空状态弹窗
3254
+ var oldToast = document.querySelector('.openagent-empty-toast');
3255
+ if (oldToast) oldToast.remove();
3256
+ var oldEmpty = document.querySelector('.openagent-empty-state');
3257
+ if (oldEmpty) oldEmpty.remove();
3258
+
2692
3259
  const p = ensurePanel();
2693
3260
  _positionPanel(); // 动态定位到 input 上方
3261
+ _installPanelPositionObservers();
2694
3262
  p.classList.add('visible');
2695
3263
  backdrop.classList.add('visible');
2696
3264
  window.addEventListener('resize', _onResize);
@@ -2753,6 +3321,7 @@ function closePanel() {
2753
3321
  if (panel) panel.classList.remove('visible');
2754
3322
  if (backdrop) backdrop.classList.remove('visible');
2755
3323
  window.removeEventListener('resize', _onResize);
3324
+ _teardownPanelPositionObservers();
2756
3325
  // 清理搜索状态
2757
3326
  if (currentAbort) { currentAbort.abort(); currentAbort = null; }
2758
3327
  if (searchDebounceId) { clearTimeout(searchDebounceId); searchDebounceId = null; }
@@ -2807,7 +3376,6 @@ function _scrollItemIntoView(index) {
2807
3376
 
2808
3377
  function _appendParentSection(container, parentTitle, children, textarea, renderedAgents) {
2809
3378
  const parentSec = _el('section', 'openagent-parent-section');
2810
- parentSec.appendChild(_text('div', 'openagent-parent-heading', parentTitle));
2811
3379
  children.forEach(function(child) {
2812
3380
  if (child.agents && child.agents.length > 0) {
2813
3381
  _appendAgentSection(parentSec, child.title, child.agents, textarea, renderedAgents);
@@ -2872,14 +3440,91 @@ function _appendSearchResults(container, agents, textarea, renderedAgents) {
2872
3440
  container.appendChild(list);
2873
3441
  }
2874
3442
 
3443
+ /**
3444
+ * 空状态组件(Figma 144:3444)— 未匹配到 Agent 时显示
3445
+ */
3446
+ /** 关闭已有空状态浮层 */
3447
+ function _dismissEmptyToast() {
3448
+ var existing = document.querySelector('.openagent-empty-toast');
3449
+ if (existing) existing.remove();
3450
+ }
3451
+
3452
+ /** 独立浮层空状态(不在面板内) */
3453
+ function _getEmptyMessage(query) {
3454
+ return CL.agentBookLastError ||
3455
+ (query ? '暂未匹配到您想要的Agent 我们将持续上新~' : '暂无在线 Agent,请输入关键词搜索');
3456
+ }
3457
+
3458
+ function _showEmptyToast(query, message) {
3459
+ _dismissEmptyToast();
3460
+ var toast = _el('div', 'openagent-empty-toast');
3461
+
3462
+ var iconWrap = _el('div', 'openagent-empty-state__icon');
3463
+ iconWrap.innerHTML = '<svg width="14" height="14" viewBox="0 0 14 14" fill="none">' +
3464
+ '<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"/>' +
3465
+ '</svg>';
3466
+ toast.appendChild(iconWrap);
3467
+
3468
+ toast.appendChild(_text('span', 'openagent-empty-state__text', message || _getEmptyMessage(query)));
3469
+
3470
+ var closeBtn = _el('button', 'openagent-empty-state__close');
3471
+ closeBtn.innerHTML = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none">' +
3472
+ '<path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>' +
3473
+ '</svg>';
3474
+ closeBtn.addEventListener('click', function() { toast.remove(); });
3475
+ toast.appendChild(closeBtn);
3476
+
3477
+ // 定位到输入框上方
3478
+ if (inputWrapperRef) {
3479
+ var rect = inputWrapperRef.getBoundingClientRect();
3480
+ toast.style.position = 'fixed';
3481
+ toast.style.left = Math.max(16, rect.left) + 'px';
3482
+ toast.style.width = Math.min(rect.width, window.innerWidth - 32) + 'px';
3483
+ toast.style.bottom = (window.innerHeight - rect.top + 8) + 'px';
3484
+ // ── V2 版本兼容:v1 bottom 固定 117px ──
3485
+ var isV2Toast = typeof _clIsHostVersionGte === 'function' && _clIsHostVersionGte('2026.6.9');
3486
+ if (!isV2Toast) {
3487
+ toast.style.bottom = '117px';
3488
+ }
3489
+ toast.style.zIndex = '100000';
3490
+ }
3491
+ document.body.appendChild(toast);
3492
+ }
3493
+
3494
+ function _createEmptyState(query, message) {
3495
+ var wrapper = _el('div', 'openagent-empty-state');
3496
+ var row = _el('div', 'openagent-empty-state__row');
3497
+
3498
+ var iconWrap = _el('div', 'openagent-empty-state__icon');
3499
+ iconWrap.innerHTML = '<svg width="14" height="14" viewBox="0 0 14 14" fill="none">' +
3500
+ '<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"/>' +
3501
+ '</svg>';
3502
+ row.appendChild(iconWrap);
3503
+
3504
+ var text = _text('span', 'openagent-empty-state__text', message || _getEmptyMessage(query));
3505
+ row.appendChild(text);
3506
+
3507
+ var closeBtn = _el('button', 'openagent-empty-state__close');
3508
+ closeBtn.innerHTML = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none">' +
3509
+ '<path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>' +
3510
+ '</svg>';
3511
+ closeBtn.addEventListener('click', function() {
3512
+ wrapper.style.display = 'none';
3513
+ });
3514
+ row.appendChild(closeBtn);
3515
+
3516
+ wrapper.appendChild(row);
3517
+ return wrapper;
3518
+ }
3519
+
2875
3520
  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;
3521
+ if (!agents.length) {
3522
+ var emptyMessage = _getEmptyMessage(query);
3523
+ _currentAgents = [];
3524
+ _currentTextarea = textarea;
3525
+ closePanel();
3526
+ _showEmptyToast(query, emptyMessage);
3527
+ return;
2883
3528
  }
2884
3529
 
2885
3530
  console.log('[openagent] renderAgentList:', agents.length, 'agents, textarea:', !!textarea);
@@ -2915,6 +3560,19 @@ _highlightItem(0);
2915
3560
  * 对齐 openagent-frontend NewChatPanel L92-105:
2916
3561
  * 找到最后一个 @,替换其后内容为 @agentName
2917
3562
  */
3563
+ function _pickMentionAgentDescription(agent) {
3564
+ if (!agent || typeof agent !== 'object') return '';
3565
+ if (CL && typeof CL.pickAgentIdentityDescription === 'function') {
3566
+ return CL.pickAgentIdentityDescription(agent);
3567
+ }
3568
+ const keys = ['agent_bio', 'agentBio', 'bio', 'description', 'desc', 'agent_description', 'agentDescription', 'MOM', 'mom'];
3569
+ for (let i = 0; i < keys.length; i++) {
3570
+ const value = agent[keys[i]];
3571
+ if (typeof value === 'string' && value.trim()) return value.trim();
3572
+ }
3573
+ return '';
3574
+ }
3575
+
2918
3576
  function insertMention(textarea, agentName, agentData) {
2919
3577
  // 重新查找 textarea(Lit 可能重新渲染导致引用失效)
2920
3578
  const liveTextarea = document.querySelector(
@@ -2934,9 +3592,11 @@ liveTextarea.focus();
2934
3592
  const agentId = agentData?.agent_id || agentData?.agentId || agentData?.id || agentData?.tag ||
2935
3593
  agentData?.user_id || agentData?.userId || agentData?.identifier || agentData?.tim_user_id || agentData?.timUserId || '';
2936
3594
  const agentAvatar = agentData?.avatar || agentData?.avatar_url || agentData?.avatarUrl || agentData?.image || agentData?.logo || agentData?.photo || null;
3595
+ const agentBio = _pickMentionAgentDescription(agentData);
2937
3596
  console.log('[cl-diag][mention-select]', {
2938
3597
  agentName,
2939
3598
  resolvedAgentId: agentId || null,
3599
+ hasAgentBio: !!agentBio,
2940
3600
  rawKeys: Object.keys(agentData || {}),
2941
3601
  rawAgent: agentData,
2942
3602
  });
@@ -2945,9 +3605,14 @@ if (!agentId) {
2945
3605
  console.warn('[openagent] mention skipped: missing agent identifier for', agentName, agentData);
2946
3606
  return;
2947
3607
  }
2948
- CL.pendingMention = { agent_id: agentId, name: agentName, avatar: agentAvatar };
3608
+ CL.pendingMention = { agent_id: agentId, name: agentName, avatar: agentAvatar, agent_bio: agentBio };
2949
3609
  if (CL && typeof CL.storeAgentIdentity === 'function') {
2950
- CL.storeAgentIdentity({ agent_id: agentId, name: agentName, avatar: agentAvatar });
3610
+ CL.storeAgentIdentity(Object.assign({}, agentData || {}, {
3611
+ agent_id: agentId,
3612
+ name: agentName,
3613
+ avatar: agentAvatar,
3614
+ agent_bio: agentBio,
3615
+ }));
2951
3616
  }
2952
3617
  console.log('[openagent] mention stored:', CL.pendingMention);
2953
3618
 
@@ -3027,12 +3692,27 @@ function _setTextareaValue(textarea, value) {
3027
3692
  textarea.dispatchEvent(new Event('input', { bubbles: true }));
3028
3693
  }
3029
3694
 
3695
+ function _escapeRemoteAgentMarkerValue(value) {
3696
+ return String(value || '')
3697
+ .replace(/\s+/g, ' ')
3698
+ .trim()
3699
+ .replace(/"/g, "'");
3700
+ }
3701
+
3030
3702
  function _buildRemoteAgentMarker(mention, userText) {
3031
3703
  const hasChinese = /[\u4e00-\u9fff]/.test(userText || '');
3032
3704
  const instruction = hasChinese
3033
3705
  ? '请调用 openagent_call_remote_agent 工具将此请求转发给远端 Agent 处理'
3034
3706
  : 'Please invoke the openagent_call_remote_agent tool to forward this request to the remote agent';
3035
- return `{openagent_call_remote_agent:agent_id="${mention.agent_id}",agent_name="${mention.name}",instruction="${instruction}"}`;
3707
+ const attrs = [
3708
+ `agent_id="${_escapeRemoteAgentMarkerValue(mention.agent_id)}"`,
3709
+ `agent_name="${_escapeRemoteAgentMarkerValue(mention.name)}"`,
3710
+ ];
3711
+ if (mention.agent_bio) {
3712
+ attrs.push(`agent_bio="${_escapeRemoteAgentMarkerValue(mention.agent_bio)}"`);
3713
+ }
3714
+ attrs.push(`instruction="${_escapeRemoteAgentMarkerValue(instruction)}"`);
3715
+ return `{openagent_call_remote_agent:${attrs.join(',')}}`;
3036
3716
  }
3037
3717
 
3038
3718
  function _composeRemoteAgentMessage(textarea, mention) {
@@ -3213,6 +3893,8 @@ function tryInject() {
3213
3893
  const pos = ta.selectionStart;
3214
3894
  // 如果光标前已经是 @,不重复插入
3215
3895
  if (pos > 0 && val[pos - 1] === '@') {
3896
+ // 按钮主动触发 → 清除 dismissed 状态,确保弹窗能打开
3897
+ if (typeof resetMention === 'function') resetMention();
3216
3898
  _handleStateChange(ta);
3217
3899
  return;
3218
3900
  }
@@ -3271,9 +3953,140 @@ function tryInject() {
3271
3953
 
3272
3954
  console.log('[openagent] ✅ Agent Book UI injected (v3 hook-driven)');
3273
3955
 
3956
+ // ── 提示栏(Figma 141:3293):页面加载即显示 ──
3957
+ _injectHintBar(inputContainer || textarea.parentElement, toolbarRow);
3958
+
3274
3959
  return true;
3275
3960
  }
3276
3961
 
3962
+ /** 注入提示栏到输入区域上方 */
3963
+ function _injectHintBar(anchorEl, toolbarEl) {
3964
+ if (!anchorEl || document.querySelector('.openagent-hint-bar')) return;
3965
+
3966
+ const hintBar = document.createElement('div');
3967
+ hintBar.className = 'openagent-hint-bar';
3968
+ hintBar.innerHTML = '' +
3969
+ '<div class="openagent-hint-bar__content">' +
3970
+ '<div class="openagent-hint-bar__icon">' +
3971
+ '<svg xmlns="http://www.w3.org/2000/svg" width="27" height="27" viewBox="0 0 27 27" fill="none">' +
3972
+ '<rect width="27" height="27" rx="6" fill="url(#paint0_linear_141_3277)" fill-opacity="0.1"/>' +
3973
+ '<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)"/>' +
3974
+ '<defs>' +
3975
+ '<linearGradient id="paint0_linear_141_3277" x1="0" y1="13.5" x2="27" y2="13.5" gradientUnits="userSpaceOnUse">' +
3976
+ '<stop stop-color="#8274FF"/>' +
3977
+ '<stop offset="1" stop-color="#3890FF"/>' +
3978
+ '</linearGradient>' +
3979
+ '<linearGradient id="paint1_linear_141_3277" x1="7.5" y1="13.8759" x2="20.9999" y2="13.8759" gradientUnits="userSpaceOnUse">' +
3980
+ '<stop stop-color="#8274FF"/>' +
3981
+ '<stop offset="1" stop-color="#3890FF"/>' +
3982
+ '</linearGradient>' +
3983
+ '</defs>' +
3984
+ '</svg>' +
3985
+ '</div>' +
3986
+ '<span class="openagent-hint-bar__text">输入你的需求,调配远端Agent为你解决</span>' +
3987
+ '</div>' +
3988
+ '<button class="openagent-hint-bar__close">' +
3989
+ '<svg xmlns="http://www.w3.org/2000/svg" width="21" height="21" viewBox="0 0 21 21" fill="none">' +
3990
+ '<path d="M5.625 5.625L15.375 15.375" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>' +
3991
+ '<path d="M15.375 5.625L5.625 15.375" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>' +
3992
+ '</svg>' +
3993
+ '</button>';
3994
+
3995
+ hintBar.querySelector('.openagent-hint-bar__close').addEventListener('click', () => {
3996
+ hintBar.style.display = 'none';
3997
+ });
3998
+
3999
+ // ── V2 版本兼容:≥ 2026.6.9 使用 absolute 定位,bottom 动态跟随输入区高度 ──
4000
+ var isV2 = typeof _clIsHostVersionGte === 'function' && _clIsHostVersionGte('2026.6.9');
4001
+ if (isV2) {
4002
+ hintBar.style.position = 'absolute';
4003
+ }
4004
+
4005
+ // 插入到 wrapper 外面、上方
4006
+ anchorEl.parentElement.insertBefore(hintBar, anchorEl);
4007
+
4008
+ function _findHintBarToolbar() {
4009
+ if (toolbarEl) return toolbarEl;
4010
+ var parentEl = anchorEl.parentElement;
4011
+ if (parentEl) {
4012
+ for (var i = 0; i < parentEl.children.length; i++) {
4013
+ var child = parentEl.children[i];
4014
+ if (child !== anchorEl && child.className && String(child.className).indexOf('agent-chat__toolbar') !== -1) {
4015
+ return child;
4016
+ }
4017
+ }
4018
+ }
4019
+ return anchorEl.closest && anchorEl.closest('.agent-chat__input')
4020
+ ? anchorEl.closest('.agent-chat__input').querySelector('.agent-chat__toolbar')
4021
+ : null;
4022
+ }
4023
+
4024
+ function _readElementHeight(el) {
4025
+ if (!el) return 0;
4026
+ var rect = el.getBoundingClientRect ? el.getBoundingClientRect() : null;
4027
+ if (rect && rect.height > 0) return rect.height;
4028
+ return typeof el.offsetHeight === 'number' ? el.offsetHeight : 0;
4029
+ }
4030
+
4031
+ // 跟随 composer wrapper 的实际尺寸。侧栏拖拽/布局重排不一定触发 window resize。
4032
+ function _syncHintBarLayout() {
4033
+ var rect = anchorEl.getBoundingClientRect();
4034
+ if (rect.width > 0) {
4035
+ hintBar.style.width = rect.width + 'px';
4036
+ var rootStyle = document.documentElement && document.documentElement.style;
4037
+ if (rootStyle) {
4038
+ rootStyle.setProperty('--openagent-input-wrapper-right-offset', Math.max(0, window.innerWidth - rect.right) + 'px');
4039
+ rootStyle.setProperty('--openagent-input-wrapper-right-edge', Math.max(0, rect.right) + 'px');
4040
+ rootStyle.setProperty('--openagent-input-wrapper-width', rect.width + 'px');
4041
+ }
4042
+ _syncSidebarRightEdge(rect);
4043
+ }
4044
+ if (isV2) {
4045
+ var toolbar = _findHintBarToolbar();
4046
+ var bottom = _readElementHeight(anchorEl) + _readElementHeight(toolbar) + 6;
4047
+ hintBar.style.bottom = bottom + 'px';
4048
+ }
4049
+ }
4050
+
4051
+ function _syncSidebarRightEdge(inputRect) {
4052
+ var sidebars = document.querySelectorAll('.chat-sidebar');
4053
+ for (var i = 0; i < sidebars.length; i++) {
4054
+ var sidebar = sidebars[i];
4055
+ var sidebarRect = sidebar.getBoundingClientRect();
4056
+ if (!sidebarRect || sidebarRect.width <= 0) continue;
4057
+ var left = Math.max(0, sidebarRect.left);
4058
+ var targetRight = Math.min(window.innerWidth, Math.max(0, inputRect.right));
4059
+ var targetWidth = Math.floor(targetRight - left);
4060
+ if (targetWidth <= 0) continue;
4061
+ sidebar.style.setProperty('--openagent-sidebar-target-width', targetWidth + 'px');
4062
+ sidebar.style.setProperty('width', targetWidth + 'px', 'important');
4063
+ sidebar.style.setProperty('max-width', targetWidth + 'px', 'important');
4064
+ sidebar.style.setProperty('flex-basis', targetWidth + 'px', 'important');
4065
+ sidebar.style.setProperty('margin-right', '0px', 'important');
4066
+ }
4067
+ }
4068
+
4069
+ function _scheduleHintBarLayoutSync() {
4070
+ window.requestAnimationFrame
4071
+ ? window.requestAnimationFrame(_syncHintBarLayout)
4072
+ : setTimeout(_syncHintBarLayout, 0);
4073
+ }
4074
+
4075
+ _syncHintBarLayout();
4076
+ _scheduleHintBarLayoutSync();
4077
+ window.addEventListener('resize', _scheduleHintBarLayoutSync);
4078
+ if (typeof ResizeObserver === 'function') {
4079
+ var hintBarResizeObserver = new ResizeObserver(_scheduleHintBarLayoutSync);
4080
+ hintBarResizeObserver.observe(anchorEl);
4081
+ var toolbarForResize = _findHintBarToolbar();
4082
+ if (toolbarForResize) hintBarResizeObserver.observe(toolbarForResize);
4083
+ }
4084
+ if (typeof MutationObserver === 'function' && document.body) {
4085
+ var sidebarLayoutObserver = new MutationObserver(_scheduleHintBarLayoutSync);
4086
+ sidebarLayoutObserver.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['class'] });
4087
+ }
4088
+ }
4089
+
3277
4090
  // ════════════════════════════════════════════════════════════════
3278
4091
  // ── window.__clMention — OC 注入钩子的桥接对象 ──
3279
4092
  // ════════════════════════════════════════════════════════════════
@@ -3618,10 +4431,12 @@ registerComponent('agent-card', async (data) => {
3618
4431
  function _clHandleTripDataSignal(payload, contextNode) {
3619
4432
  if (!payload) return;
3620
4433
  console.log('[trip-data] detected signal, payload:', payload.substring(0, 40));
4434
+ const hostTextContextSelector = (typeof CL !== 'undefined' && CL.hostAdapter && CL.hostAdapter.selectors && CL.hostAdapter.selectors.textContext)
4435
+ || '.chat-text';
3621
4436
 
3622
4437
  if (payload === 'file') {
3623
4438
  const chatText = contextNode && contextNode.closest
3624
- ? contextNode.closest('.chat-text, .chat-tool-card__detail, .chat-tools-collapse__body')
4439
+ ? contextNode.closest(hostTextContextSelector)
3625
4440
  : null;
3626
4441
  if (chatText) {
3627
4442
  chatText.dataset.clProcessed = '';
@@ -3638,7 +4453,7 @@ function _clHandleTripDataSignal(payload, contextNode) {
3638
4453
  }
3639
4454
  console.log('[trip-data] ✅ Card data from base64');
3640
4455
  const chatText = contextNode && contextNode.closest
3641
- ? contextNode.closest('.chat-text, .chat-tool-card__detail, .chat-tools-collapse__body')
4456
+ ? contextNode.closest(hostTextContextSelector)
3642
4457
  : null;
3643
4458
  if (chatText) {
3644
4459
  chatText.dataset.clProcessed = '';
@@ -3819,9 +4634,12 @@ if (document.readyState === 'loading') {
3819
4634
  // ── 1. CSS 注入 ──
3820
4635
 
3821
4636
  (function injectThoughtChainStyles() {
3822
- if (document.getElementById('cl-tools-collapse-css')) return;
4637
+ var oldStyle = document.getElementById('cl-tools-collapse-css');
4638
+ if (oldStyle) oldStyle.remove();
3823
4639
  const style = document.createElement('style');
3824
4640
  style.id = 'cl-tools-collapse-css';
4641
+ style.setAttribute('data-openagent-style', 'thought-chain');
4642
+ style.setAttribute('data-openagent-host-version', CL.hostVersion || 'unknown');
3825
4643
  style.textContent = `
3826
4644
  /* ── Agent Pill(通用身份标签) ── */
3827
4645
  .cl-agent-pill {
@@ -4025,7 +4843,12 @@ CL.handleDelegateWsEvent = function (msg) {
4025
4843
  // ════════════════════════════════════════════════════════════════
4026
4844
 
4027
4845
  // ── 1. CSS 注入 ──
4846
+ var _oldTripCSS = document.getElementById('openagent-trip-card-styles');
4847
+ if (_oldTripCSS) _oldTripCSS.remove();
4028
4848
  const _tripCSS = document.createElement('style');
4849
+ _tripCSS.id = 'openagent-trip-card-styles';
4850
+ _tripCSS.setAttribute('data-openagent-style', 'trip-card');
4851
+ _tripCSS.setAttribute('data-openagent-host-version', CL.hostVersion || 'unknown');
4029
4852
  _tripCSS.textContent = `
4030
4853
  /* ── 行程文字:普通文字灰色,特殊标注(粗体/链接/标题)黑色 ── */
4031
4854
  .trip-styled li, .trip-styled p { color: #888 !important; }
@@ -5449,20 +6272,32 @@ function _processCustomCards(bubble) {
5449
6272
 
5450
6273
  // CL.clScanCount lives on CL.clScanCount
5451
6274
 
6275
+ function _clIsInsideNativeToolHost(node) {
6276
+ var adapter = CL && CL.hostAdapter;
6277
+ var cur = node;
6278
+ var hops = 0;
6279
+ while (cur && cur !== document.body && hops < 12) {
6280
+ if (adapter && adapter.isToolLikeShell && adapter.isToolLikeShell(cur)) return true;
6281
+ cur = cur.parentElement;
6282
+ hops++;
6283
+ }
6284
+ return !!(node && node.closest && node.closest('details'));
6285
+ }
6286
+
5452
6287
  function _clScan() {
5453
6288
  CL.clScanCount++;
5454
6289
 
5455
6290
  // ── 0.5 清理标记 → 显示为 @agentName ──
5456
- // 新格式: {openagent_call_remote_agent:agent_id="...",agent_name="...",instruction="..."}
6291
+ // 新格式: {openagent_call_remote_agent:agent_id="...",agent_name="...",agent_bio="...",instruction="..."}
5457
6292
  // 旧格式: {openagent:agent_id="...",agent_name="..."}
5458
6293
  // 两种都要匹配清理;这里只处理普通聊天气泡,不处理 ToolCard。
5459
6294
  var CL_MENTION_STYLE = '';
5460
6295
  document.querySelectorAll('.chat-bubble').forEach(function(el) {
5461
6296
  if (el.dataset.clMarkerCleaned) return;
5462
- if (el.closest('.chat-tool-card, .chat-tools-collapse, details')) return;
6297
+ if (_clIsInsideNativeToolHost(el)) return;
5463
6298
 
5464
6299
  var text = el.textContent || '';
5465
- var rawRegex = /\{openagent(?:_call_remote_agent)?:agent_id="([^"]*)",agent_name="([^"]*)"(?:,instruction="[^"]*")?\}\s*/g;
6300
+ var rawRegex = /\{openagent(?:_call_remote_agent)?:agent_id="([^"]*)",agent_name="([^"]*)"(?:,[^{}]*)?\}\s*/g;
5466
6301
  if (!rawRegex.test(text)) return;
5467
6302
 
5468
6303
  if (el.querySelector('.cl-remote-agent-card')) {
@@ -5470,7 +6305,7 @@ function _clScan() {
5470
6305
  return; // 包含活 DOM,跳过 innerHTML 重写
5471
6306
  }
5472
6307
 
5473
- var htmlRegex = /\{openagent(?:_call_remote_agent)?:agent_id=(?:&quot;|")([^&"]*)(?:&quot;|"),agent_name=(?:&quot;|")([^&"]*)(?:&quot;|")(?:,instruction=(?:&quot;|")[^&"]*(?:&quot;|"))?\}\s*/g;
6308
+ var htmlRegex = /\{openagent(?:_call_remote_agent)?:agent_id=(?:&quot;|")([^&"]*)(?:&quot;|"),agent_name=(?:&quot;|")([^&"]*)(?:&quot;|")(?:,[^{}]*)?\}\s*/g;
5474
6309
  if (CL && typeof CL.diagHtmlRewrite === 'function') {
5475
6310
  CL.diagHtmlRewrite('scanner.marker.before', el, { scan: CL.clScanCount });
5476
6311
  }
@@ -5505,7 +6340,7 @@ function _clScan() {
5505
6340
  if (mentionedAgents.length > 0) {
5506
6341
  document.querySelectorAll('.chat-bubble').forEach(function(el) {
5507
6342
  if (el.dataset.clAgentStyled) return;
5508
- if (el.closest('.chat-tool-card, .chat-tools-collapse, details')) return;
6343
+ if (_clIsInsideNativeToolHost(el)) return;
5509
6344
 
5510
6345
  var text = el.textContent || '';
5511
6346
  var html = el.innerHTML;
@@ -5576,30 +6411,12 @@ function _clScan() {
5576
6411
 
5577
6412
  (function _clInitNativeStyleAdapter() {
5578
6413
  var _clNativeStyleSampled = false;
6414
+ var hostAdapter = CL.hostAdapter || {};
6415
+ var nativeStyle = hostAdapter.nativeStyle || {};
5579
6416
 
5580
- var SHELL_SELECTORS = [
5581
- '.chat-tool-card:not(:has(.cl-remote-agent-card))',
5582
- '.chat-tool-msg-collapse:not(:has(.cl-remote-agent-card))',
5583
- '.chat-tools-collapse:not(:has(.cl-remote-agent-card))',
5584
- // v5.x+ variants
5585
- '.tool-card:not(:has(.cl-remote-agent-card))',
5586
- '.chat-tool-card__wrapper:not(:has(.cl-remote-agent-card))'
5587
- ];
5588
-
5589
- var SUMMARY_SELECTORS = [
5590
- '.chat-tool-card__header',
5591
- '.chat-tool-card__title',
5592
- '.chat-tool-msg-summary:not(.cl-remote-agent-host-shell *)',
5593
- '.chat-tools-summary:not(.cl-remote-agent-host-shell *)',
5594
- // v5.x+ variants
5595
- '.tool-card__header',
5596
- '.tool-card__title'
5597
- ];
5598
-
5599
- var INDENT_SELECTORS = [
5600
- '.chat-group.tool:not(:has(.cl-remote-agent-card))',
5601
- '.chat-bubble:not(:has(.cl-remote-agent-card))'
5602
- ];
6417
+ var SHELL_SELECTORS = nativeStyle.shellSelectors || [];
6418
+ var SUMMARY_SELECTORS = nativeStyle.summarySelectors || [];
6419
+ var INDENT_SELECTORS = nativeStyle.indentSelectors || [];
5603
6420
 
5604
6421
  // Fallback 默认值(和当前 styles.js 折叠态写死值保持一致,避免跳变)
5605
6422
  var FALLBACKS = {
@@ -5731,70 +6548,108 @@ function _clScan() {
5731
6548
  // 注意:不使用 .chat-tool-card 类名,避免 scanner.js 误匹配。
5732
6549
 
5733
6550
  (function _clInjectRemoteAgentStyles() {
5734
- if (document.getElementById('cl-remote-agent-styles')) return;
6551
+ var oldStyle = document.getElementById('cl-remote-agent-styles');
6552
+ if (oldStyle) oldStyle.remove();
5735
6553
  var style = document.createElement('style');
5736
6554
  style.id = 'cl-remote-agent-styles';
6555
+ style.setAttribute('data-openagent-style', 'remote-agent');
6556
+ style.setAttribute('data-openagent-host-version', CL.hostVersion || 'unknown');
6557
+ style.setAttribute('data-openagent-host-adapter', (CL.hostAdapter && CL.hostAdapter.id) || 'oc-unknown');
6558
+ var hostCss = (CL.hostAdapter && CL.hostAdapter.css) || {};
6559
+ function _clSelectorList(selectors) {
6560
+ if (!selectors) return '';
6561
+ if (Array.isArray(selectors)) return selectors.filter(Boolean).join(',\n');
6562
+ return String(selectors || '');
6563
+ }
6564
+ function _clRule(selectors, declarations) {
6565
+ var selectorText = _clSelectorList(selectors);
6566
+ if (!selectorText) return '';
6567
+ return selectorText + ' {\n' + declarations.join('\n') + '\n}';
6568
+ }
5737
6569
  style.textContent = [
5738
- // ── RenderHook 远端 Agent 卡片接管 native tool header ──
5739
- 'details.chat-tools-collapse:has(.cl-remote-agent-card),',
5740
- 'details.chat-tool-msg-collapse:has(.cl-remote-agent-card),',
5741
- '.chat-tools-collapse:has(.cl-remote-agent-card),',
5742
- '.chat-tool-msg-collapse:has(.cl-remote-agent-card) {',
5743
- ' width: 100% !important;',
5744
- ' max-width: none !important;',
5745
- ' box-sizing: border-box !important;',
5746
- ' border: 0 !important;',
5747
- ' background: transparent !important;',
5748
- ' box-shadow: none !important;',
5749
- '}',
5750
- '/* Align output host shells with execution shells. 3.28 renders output as',
5751
- ' chat-tools-collapse + .cl-output-card; some versions use chat-tool-msg-collapse.',
5752
- ' Move the host shell, not the inner OpenAgent card. */',
5753
- 'details.chat-tools-collapse:has(.cl-output-card),',
5754
- '.chat-tools-collapse:has(.cl-output-card),',
5755
- 'details.chat-tool-msg-collapse:has(.cl-remote-agent-card),',
5756
- '.chat-tool-msg-collapse:has(.cl-remote-agent-card) {',
5757
- ' margin-left: 12px !important;',
5758
- '}',
5759
- 'details.chat-tools-collapse:has(.cl-remote-agent-card) > summary.chat-tools-summary,',
5760
- 'details.chat-tool-msg-collapse:has(.cl-remote-agent-card) > summary.chat-tool-msg-summary,',
5761
- '.chat-tools-collapse:has(.cl-remote-agent-card) > .chat-tools-summary,',
5762
- '.chat-tool-msg-collapse:has(.cl-remote-agent-card) > .chat-tool-msg-summary {',
5763
- ' display: none !important;',
5764
- '}',
5765
- '.chat-tools-collapse__body.cl-remote-agent-host-shell > .chat-text,',
5766
- '.chat-tool-msg-body.cl-remote-agent-host-shell > .chat-text {',
6570
+ // ── 隐藏宿主上下文用量提示 ──
6571
+ '.context-notice.context-notice--usage,',
6572
+ '.context-notice .context-notice--usage {',
5767
6573
  ' display: none !important;',
5768
6574
  '}',
6575
+
6576
+ // ── RenderHook 远端 Agent 卡片接管 native tool header ──
6577
+ _clRule(hostCss.remoteShell, [
6578
+ ' width: 100% !important;',
6579
+ ' max-width: 100% !important;',
6580
+ ' min-width: 0 !important;',
6581
+ ' box-sizing: border-box !important;',
6582
+ ' border: 0 !important;',
6583
+ ' background: transparent !important;',
6584
+ ' box-shadow: none !important;',
6585
+ ]),
6586
+ '/* Align output host shells with execution shells. Keep v4 msg-collapse',
6587
+ ' separate from newer tools-collapse so modern spacing never leaks into',
6588
+ ' the 2026.4 DOM. Move the host shell, not the inner OpenAgent card. */',
6589
+ _clRule(hostCss.outputHostMargin, [
6590
+ ' margin-left: 12px !important;',
6591
+ ]),
6592
+ _clRule(hostCss.outputHostMarginReset, [
6593
+ ' margin-left: 0 !important;',
6594
+ ]),
6595
+ _clRule(hostCss.summaryHidden, [
6596
+ ' display: none !important;',
6597
+ ]),
6598
+ _clRule(hostCss.hostShellRawText, [
6599
+ ' display: none !important;',
6600
+ ]),
5769
6601
  '.cl-remote-agent-raw-hidden > .chat-text,',
5770
6602
  '.cl-remote-agent-raw-hidden.chat-bubble > .chat-text {',
5771
6603
  ' display: none !important;',
5772
6604
  '}',
5773
6605
  '/* Phase A: 不依赖 host-shell class,用 :has() 直接隐藏宿主 raw text */',
5774
- '.chat-tools-collapse__body:has(.cl-remote-agent-card) > .chat-text,',
5775
- '.chat-tool-msg-body:has(.cl-remote-agent-card) > .chat-text,',
5776
- '.chat-tool-card__detail:has(.cl-remote-agent-card) > .chat-text,',
5777
- '.chat-tools-collapse__body:has(.cl-remote-agent-output-placeholder) > .chat-text,',
5778
- '.chat-tool-msg-body:has(.cl-remote-agent-output-placeholder) > .chat-text,',
5779
- '.chat-tool-card__detail:has(.cl-remote-agent-output-placeholder) > .chat-text {',
5780
- ' display: none !important;',
5781
- '}',
5782
- 'details.chat-tools-collapse:has(.cl-remote-agent-card) > .chat-tools-collapse__body,',
5783
- 'details.chat-tool-msg-collapse:has(.cl-remote-agent-card) > .chat-tool-msg-body,',
5784
- '.chat-tools-collapse:has(.cl-remote-agent-card) > .chat-tools-collapse__body,',
5785
- '.chat-tool-msg-collapse:has(.cl-remote-agent-card) > .chat-tool-msg-body {',
5786
- ' border: 0 !important;',
5787
- ' outline: 0 !important;',
5788
- ' background: transparent !important;',
5789
- ' box-shadow: none !important;',
5790
- ' padding: 0 !important;',
5791
- ' margin: 0 !important;',
5792
- '}',
6606
+ _clRule(hostCss.rawTextCardHosts, [
6607
+ ' display: none !important;',
6608
+ ]),
6609
+ _clRule(hostCss.rawTextPlaceholderHosts, [
6610
+ ' display: none !important;',
6611
+ ]),
6612
+ _clRule(hostCss.hostBody, [
6613
+ ' border: 0 !important;',
6614
+ ' outline: 0 !important;',
6615
+ ' background: transparent !important;',
6616
+ ' box-shadow: none !important;',
6617
+ ' padding: 0 !important;',
6618
+ ' margin: 0 !important;',
6619
+ ' width: 100% !important;',
6620
+ ' max-width: 100% !important;',
6621
+ ' min-width: 0 !important;',
6622
+ ' box-sizing: border-box !important;',
6623
+ ]),
5793
6624
  '.chat-bubble:has(.cl-remote-agent-card) {',
5794
6625
  ' border: 0 !important;',
5795
6626
  ' background: transparent !important;',
5796
6627
  ' box-shadow: none !important;',
5797
- ' padding-top: 0 !important;',
6628
+ ' padding: 10px 0 !important;',
6629
+ ' width: 100%;',
6630
+ ' max-width: 100% !important;',
6631
+ ' min-width: 0 !important;',
6632
+ ' overflow: hidden !important;',
6633
+ ' box-sizing: border-box !important;',
6634
+ '}',
6635
+ '.chat-split-container:has(.cl-output-card),',
6636
+ '.chat-main:has(.cl-output-card),',
6637
+ '.chat-sidebar:has(.cl-output-card),',
6638
+ '.chat-side-result:has(.cl-output-card),',
6639
+ '.chat-side-result__body:has(.cl-output-card) {',
6640
+ ' min-width: 0 !important;',
6641
+ ' max-width: 100% !important;',
6642
+ ' box-sizing: border-box !important;',
6643
+ '}',
6644
+ _clRule(hostCss.manualOpenReset, [
6645
+ ' margin-left: 0 !important;',
6646
+ ]),
6647
+ // ── 外层活动组容器 ──
6648
+ '.chat-activity-group__body:has(.cl-remote-agent-card) {',
6649
+ ' border-radius: 14px;',
6650
+ ' border: 1px solid #E5E5EA;',
6651
+ ' background: #F8F9FA;',
6652
+ ' margin: 8px;',
5798
6653
  ' padding-bottom: 0 !important;',
5799
6654
  '}',
5800
6655
  '.chat-bubble:has(.cl-remote-agent-card) > .chat-text,',
@@ -5804,588 +6659,725 @@ function _clScan() {
5804
6659
  '.cl-remote-agent-host-shell {',
5805
6660
  ' width: min(100%, 912px) !important;',
5806
6661
  ' max-width: 100% !important;',
6662
+ ' min-width: 0 !important;',
5807
6663
  ' box-sizing: border-box !important;',
5808
6664
  '}',
5809
- '.cl-remote-agent-host-shell.chat-tool-card,',
5810
- '.cl-remote-agent-host-shell.chat-tool-card__detail,',
5811
- '.cl-remote-agent-host-shell.chat-tools-collapse__body,',
5812
- '.cl-remote-agent-host-shell.chat-tool-msg-body,',
5813
- 'details.cl-remote-agent-host-shell {',
5814
- ' border: 0 !important;',
5815
- ' outline: 0 !important;',
5816
- ' background: transparent !important;',
5817
- ' box-shadow: none !important;',
5818
- '}',
5819
- '.cl-remote-agent-host-shell > summary.chat-tools-summary,',
5820
- '.cl-remote-agent-host-shell > summary.chat-tool-msg-summary {',
5821
- ' display: none !important;',
5822
- '}',
6665
+ _clRule(hostCss.hostShellReset, [
6666
+ ' border: 0 !important;',
6667
+ ' outline: 0 !important;',
6668
+ ' background: transparent !important;',
6669
+ ' box-shadow: none !important;',
6670
+ ]),
6671
+ _clRule(hostCss.hostShellSummary, [
6672
+ ' display: none !important;',
6673
+ ]),
5823
6674
  // ── 新卡片容器 ──
5824
6675
  // 覆盖 OpenClaw .chat-tool-card 的 max-height: 120px 限制
5825
6676
  '.cl-remote-agent-card {',
5826
6677
  ' max-height: none;',
5827
6678
  ' overflow: visible;',
5828
- ' width: fit-content;',
6679
+ ' width: 100%;',
5829
6680
  ' max-width: 100%;',
5830
- ' border: 1px solid color-mix(in srgb, var(--border, rgba(47,47,51,0.10)) 85%, transparent);',
5831
- ' border-radius: var(--cl-native-shell-radius, 14px);',
5832
- ' padding: var(--cl-native-shell-padding, 8px);',
5833
- ' background: var(--card, #fff);',
6681
+ ' border: 1px solid rgba(0,0,0,0.05);',
6682
+ ' border-radius: 14px;',
6683
+ ' background: #fff;',
5834
6684
  ' display: flex;',
5835
6685
  ' flex-direction: column;',
5836
- ' gap: var(--cl-native-shell-gap, 4px);',
5837
6686
  ' box-sizing: border-box;',
5838
6687
  '}',
6688
+ _clRule(hostCss.modernCardLayout ? ['.cl-remote-agent-card'] : [], [
6689
+ ' overflow: hidden;',
6690
+ ' min-width: 0;',
6691
+ ' gap: 0;',
6692
+ ' padding: 15px;',
6693
+ ]),
5839
6694
 
5840
6695
  // ── 顶部 OpenAgent 标题条 ──
5841
6696
  '.cl-openagent-header {',
5842
- ' width: fit-content;',
5843
6697
  ' max-width: 100%;',
5844
- ' min-height: var(--cl-native-summary-min-height, 34px);',
5845
6698
  ' display: flex;',
5846
6699
  ' align-items: center;',
5847
- ' gap: var(--cl-native-summary-gap, 6px);',
5848
- ' padding: var(--cl-native-summary-padding, 6px 10px);',
6700
+ ' gap: 6px;',
6701
+ ' height: 34px;',
6702
+ ' padding: 6px 0;',
6703
+ ' border-radius: 10px;',
5849
6704
  ' box-sizing: border-box;',
5850
- ' border: 1px solid color-mix(in srgb, var(--border, rgba(47,47,51,0.10)) 85%, transparent);',
5851
- ' border-radius: var(--cl-native-summary-radius, 10px);',
5852
- ' background: color-mix(in srgb, var(--bg-hover, #F4F5F7) 50%, transparent);',
5853
- ' color: var(--text, #2F2F33);',
6705
+ ' border: none;',
6706
+ ' background: transparent;',
5854
6707
  ' font-family: "PingFang SC", sans-serif;',
5855
- ' font-size: var(--cl-native-summary-font-size, 13px);',
5856
- ' line-height: var(--cl-native-summary-line-height, 1.2);',
5857
6708
  '}',
5858
- '.cl-openagent-header-caret {',
5859
- ' width: 6px;',
5860
- ' color: var(--muted, rgba(47,47,51,0.45));',
5861
- ' font-size: 8px;',
5862
- ' line-height: 1;',
5863
- ' flex: 0 0 auto;',
6709
+ '.cl-openagent-header:hover {',
5864
6710
  '}',
5865
- '.cl-openagent-header-icon {',
5866
- ' position: relative;',
6711
+ _clRule(!hostCss.modernCardLayout ? ['.cl-openagent-header'] : [], [
6712
+ ' height: auto;',
6713
+ ' padding: 16px 25px;',
6714
+ ]),
6715
+ _clRule(hostCss.modernCardLayout ? ['.cl-openagent-header'] : [], [
6716
+ ' gap: 0;',
6717
+ ' height: auto;',
6718
+ ' padding: 15px;',
6719
+ ]),
6720
+ '/* Output mode (Figma 373:12082) */',
6721
+ '.cl-exec-v2 .cl-openagent-header--output {',
6722
+ ' border-radius: 10px 10px 0 0 !important;',
6723
+ ' border: 1px solid rgba(229, 229, 234, 0.75) !important;',
6724
+ ' background: linear-gradient(90deg, rgba(220, 38, 38, 0.09) 0%, rgba(220, 38, 38, 0) 34%),',
6725
+ ' linear-gradient(90deg, rgb(253, 253, 254) 0%, rgb(253, 253, 254) 100%) !important;',
6726
+ ' box-shadow: 0px 8px 11px rgba(0, 0, 0, 0.12);',
6727
+ ' padding: 8px 6px !important;',
6728
+ '}',
6729
+ '.cl-exec-v2 .cl-openagent-header--output .cl-openagent-agent {',
6730
+ ' display: none;',
6731
+ '}',
6732
+ '.cl-exec-v2 .cl-openagent-header--output:hover {',
6733
+ ' border-color: rgba(0,0,0,0.1);',
6734
+ '}',
6735
+ '.cl-openagent-expand-icon {',
6736
+ ' display: flex;',
6737
+ ' align-items: center;',
6738
+ ' justify-content: center;',
5867
6739
  ' width: 15px;',
5868
- ' height: 14px;',
5869
- ' flex: 0 0 15px;',
6740
+ ' height: 15px;',
6741
+ ' flex-shrink: 0;',
6742
+ ' transition: transform 0.2s ease;',
5870
6743
  '}',
5871
- '.cl-openagent-header-icon::before,',
5872
- '.cl-openagent-header-icon::after {',
5873
- ' content: "";',
5874
- ' position: absolute;',
5875
- ' width: 8px;',
5876
- ' height: 8px;',
5877
- ' border: 1.5px solid #10BDEB;',
5878
- ' border-radius: 2px;',
5879
- ' box-sizing: border-box;',
6744
+ '.cl-openagent-expand-icon.cl-openagent-expanded {',
6745
+ ' transform: rotate(180deg);',
5880
6746
  '}',
5881
- '.cl-openagent-header-icon::before { left: 2px; top: 5px; }',
5882
- '.cl-openagent-header-icon::after { left: 5px; top: 2px; }',
5883
- '.cl-openagent-header-title {',
6747
+ '.cl-openagent-badge {',
6748
+ ' width: 14px;',
6749
+ ' height: 14px;',
6750
+ ' border-radius: 14px;',
6751
+ ' background: url(./icon.png) center / contain no-repeat;',
6752
+ ' flex-shrink: 0;',
6753
+ ' overflow: hidden;',
6754
+ '}',
6755
+ _clRule(hostCss.modernCardLayout ? ['.cl-openagent-badge'] : [], [
6756
+ ' background: url(./icon.png) center/cover no-repeat;',
6757
+ ' margin: 0 6px;',
6758
+ ]),
6759
+ '.cl-openagent-text-row {',
5884
6760
  ' display: flex;',
5885
6761
  ' align-items: center;',
5886
- ' gap: 3px;',
6762
+ ' gap: 6px;',
5887
6763
  ' min-width: 0;',
6764
+ ' line-height: 1.32;',
6765
+ '}',
6766
+ '.cl-openagent-label {',
6767
+ ' font-size: 12px;',
6768
+ ' font-weight: 500;',
6769
+ ' color: #333;',
5888
6770
  ' white-space: nowrap;',
5889
6771
  '}',
5890
- '.cl-openagent-header-primary {',
5891
- ' color: var(--text, #2F2F33);',
5892
- ' font-weight: 600;',
5893
- ' overflow: hidden;',
5894
- ' text-overflow: ellipsis;',
6772
+ '.cl-openagent-agent {',
6773
+ ' font-size: 12px;',
6774
+ ' font-weight: 500;',
6775
+ ' color: #333;',
6776
+ ' white-space: nowrap;',
5895
6777
  '}',
5896
- '.cl-openagent-header-secondary {',
5897
- ' color: var(--muted, rgba(47,47,51,0.40));',
6778
+ '.cl-openagent-status {',
6779
+ ' font-size: 11px;',
5898
6780
  ' font-weight: 400;',
6781
+ ' color: #666;',
6782
+ ' white-space: nowrap;',
5899
6783
  '}',
5900
- // ── Figma 内容框 ──
6784
+ // ── Execution detail card (Figma 346:181) ──
5901
6785
  '.cl-thought-chain-content {',
5902
- ' width: 100%;',
5903
- ' min-height: 0;',
5904
- ' box-sizing: border-box;',
5905
- ' border: 1px solid color-mix(in srgb, var(--border, rgba(0,0,0,0.04)) 60%, transparent);',
5906
- ' border-radius: 8px;',
5907
- ' background: var(--card, #fff);',
5908
- ' padding: 8px;',
5909
6786
  ' display: flex;',
5910
6787
  ' flex-direction: column;',
5911
- ' align-items: flex-start;',
5912
- ' gap: 12px;',
5913
- '}',
5914
- // ── 共享展开态宿主清理 ──
5915
- 'details.chat-tools-collapse:has(.cl-thought-chain-content--execution),',
5916
- 'details.chat-tools-collapse:has(.cl-output-result),',
5917
- 'details.chat-tool-msg-collapse:has(.cl-thought-chain-content--execution),',
5918
- 'details.chat-tool-msg-collapse:has(.cl-output-result),',
5919
- '.chat-tools-collapse:has(.cl-thought-chain-content--execution),',
5920
- '.chat-tools-collapse:has(.cl-output-result),',
5921
- '.chat-tool-msg-collapse:has(.cl-thought-chain-content--execution),',
5922
- '.chat-tool-msg-collapse:has(.cl-output-result) {',
5923
- ' max-width: 100% !important;',
5924
- ' display: block !important;',
5925
- ' box-sizing: border-box !important;',
5926
- '}',
5927
- // ── 共享展开态 card 基础 ──
5928
- '.cl-remote-agent-card:has(.cl-thought-chain-content--execution),',
5929
- '.cl-remote-agent-card:has(.cl-output-result) {',
5930
- ' /* padding/radius/gap 继承 base card,不覆盖 */',
6788
+ ' gap: 16px;',
6789
+ ' min-width: 0;',
6790
+ ' max-width: 100%;',
5931
6791
  ' box-sizing: border-box;',
5932
6792
  '}',
5933
- '.cl-remote-agent-card:has(.cl-thought-chain-content--execution:not(.cl-content-collapsed)) {',
5934
- ' width: 514px !important;',
6793
+ _clRule(!hostCss.modernCardLayout ? ['.cl-thought-chain-content.cl-thought-chain-content--execution'] : [], [
6794
+ ' padding: 0 15px 15px;',
6795
+ ]),
6796
+ _clRule(hostCss.modernCardLayout ? ['.cl-thought-chain-content'] : [], [
6797
+ ' margin-left: 0;',
6798
+ ' width: 100%;',
6799
+ ' min-width: 0;',
6800
+ ' box-sizing: border-box;',
6801
+ ' overflow: hidden;',
6802
+ ]),
6803
+ '.cl-exec-detail-card {',
6804
+ ' padding: 8px 16px 8px 12px;',
6805
+ ' border-radius: 8px;',
6806
+ ' background: #f8f8f8 url(./bg.png) no-repeat;',
6807
+ ' background-size: 100% 100%;',
6808
+ ' background-position: center;',
6809
+ ' width: 460px;',
5935
6810
  ' max-width: 100%;',
6811
+ ' box-sizing: border-box;',
5936
6812
  '}',
5937
- '.cl-remote-agent-card:has(.cl-thought-chain-content:not(.cl-content-collapsed)) .cl-openagent-header {',
5938
- ' width: 100%;',
6813
+ '.cl-exec-detail-row {',
6814
+ ' display: flex;',
6815
+ ' align-items: center;',
6816
+ ' gap: 16px;',
5939
6817
  '}',
5940
- // ── 展开内容宽度:外层 card 保持 fit-content,content 出现时自然撑开 ──
5941
- '.cl-thought-chain-content--execution {',
5942
- ' width: 100%;',
6818
+ '.cl-exec-agent-avatar {',
6819
+ ' width: 68px;',
6820
+ ' height: 68px;',
6821
+ ' object-fit: contain;',
6822
+ ' flex-shrink: 0;',
5943
6823
  '}',
5944
- '.cl-remote-agent-card:has(.cl-output-result) .cl-thought-chain-content {',
5945
- ' width: min(900px, 100%);',
6824
+ '.cl-exec-detail-info {',
6825
+ ' display: flex;',
6826
+ ' flex-direction: column;',
6827
+ ' gap: 6px;',
6828
+ ' flex: 1;',
6829
+ ' min-width: 0;',
5946
6830
  '}',
5947
- // ── output 专用 content 样式 ──
5948
- '.cl-remote-agent-card:has(.cl-output-result) .cl-thought-chain-content {',
5949
- ' border: 1.5px solid color-mix(in srgb, var(--border, rgba(0,0,0,0.06)) 60%, transparent);',
5950
- ' border-radius: 12px;',
5951
- ' padding: 12px;',
5952
- ' gap: 12px;',
6831
+ '.cl-exec-name-row {',
6832
+ ' display: flex;',
6833
+ ' align-items: center;',
6834
+ ' justify-content: space-between;',
6835
+ ' gap: 8px;',
6836
+ ' margin-bottom: 6px;',
5953
6837
  '}',
5954
- // ── Figma Agent pill(297:696)──
5955
- '.cl-agent-pill {',
5956
- ' display: inline-flex;',
6838
+ '.cl-exec-agent-name {',
6839
+ ' font-family: "PingFang SC", sans-serif;',
6840
+ ' font-size: 17px;',
6841
+ ' font-weight: 500;',
6842
+ ' color: #000;',
6843
+ ' margin: 0;',
6844
+ ' line-height: 1;',
6845
+ '}',
6846
+ '.cl-exec-star-badge {',
6847
+ ' display: flex;',
5957
6848
  ' align-items: center;',
5958
- ' justify-content: center;',
5959
- ' gap: 9px;',
5960
- ' height: 42px;',
5961
- ' min-height: 42px;',
5962
- ' padding: 0 15px;',
5963
- ' border: 0;',
5964
- ' border-radius: 9px;',
5965
- ' background: #FBFBFB;',
5966
- ' box-shadow: inset 0 0 0 1.2px rgba(47,47,51,0.06);',
5967
- ' width: fit-content;',
5968
- ' box-sizing: border-box;',
6849
+ ' gap: 2px;',
6850
+ ' padding: 2px 10px 2px 8px;',
6851
+ ' border-radius: 30px;',
6852
+ ' background: #ebebeb;',
6853
+ ' flex-shrink: 0;',
6854
+ '}',
6855
+ ,
6856
+ ,
6857
+ ,
6858
+ '.cl-exec-star-count {',
6859
+ ' font-family: "PingFang SC", sans-serif;',
6860
+ ' font-size: 11px;',
6861
+ ' font-weight: 500;',
6862
+ ' color: #555;',
6863
+ ' white-space: nowrap;',
6864
+ '}',
6865
+ '.cl-exec-agent-bio {',
6866
+ ' font-family: "PingFang SC", sans-serif;',
6867
+ ' font-size: 14px;',
6868
+ ' font-weight: 400;',
6869
+ ' color: #555;',
5969
6870
  ' margin: 0;',
6871
+ ' line-height: 1;',
5970
6872
  '}',
5971
- '.cl-agent-pill-avatar {',
5972
- ' width: 24px;',
5973
- ' height: 24px;',
5974
- ' border-radius: 50%;',
5975
- ' object-fit: cover;',
5976
- ' flex: 0 0 24px;',
5977
- ' border: 0.6px solid rgba(47,47,51,0.20);',
5978
- ' box-sizing: border-box;',
6873
+ _clRule(!hostCss.modernCardLayout ? ['.cl-exec-agent-bio'] : [], [
6874
+ ' width: 250px;',
6875
+ ' max-width: 100%;',
6876
+ ' min-width: 0;',
6877
+ ' box-sizing: border-box;',
6878
+ ' overflow: hidden;',
6879
+ ' text-overflow: ellipsis;',
6880
+ ' display: -webkit-box;',
6881
+ ' -webkit-line-clamp: 2;',
6882
+ ' -webkit-box-orient: vertical;',
6883
+ ]),
6884
+
6885
+ // ── Progress text (Figma 346:253) ──
6886
+ '.cl-thought-chain-content.cl-content-collapsed {',
6887
+ ' display: none;',
5979
6888
  '}',
5980
- '.cl-agent-pill-name {',
5981
- ' display: inline-flex;',
6889
+ ,
6890
+ '.cl-exec-progress-row {',
6891
+ ' display: flex;',
5982
6892
  ' align-items: center;',
6893
+ ' gap: 2px;',
6894
+ '}',
6895
+ '.cl-exec-progress-text {',
5983
6896
  ' font-family: "PingFang SC", sans-serif;',
5984
- ' font-size: 15px;',
5985
- ' color: rgba(47,47,51,0.90);',
6897
+ ' font-size: 14px;',
6898
+ ' font-weight: 400;',
5986
6899
  ' line-height: 1.2;',
5987
- ' letter-spacing: 0;',
6900
+ ' margin: 0;',
5988
6901
  ' white-space: nowrap;',
6902
+ ' background-image: linear-gradient(90deg, #555 0%, #555 36%, #eee 55%, #555 77%, #555 100%);',
6903
+ ' background-size: 200% 100%;',
6904
+ ' -webkit-background-clip: text;',
6905
+ ' background-clip: text;',
6906
+ ' -webkit-text-fill-color: transparent;',
6907
+ ' animation: cl-progress-shimmer 2.5s ease-in-out infinite;',
5989
6908
  '}',
5990
- '.cl-agent-pill-at { font-weight: 600; }',
5991
- '.cl-agent-pill-label { font-weight: 400; }',
5992
- '.cl-thought-chain-pill-slot {',
6909
+ '.cl-exec-progress-arrow {',
5993
6910
  ' display: flex;',
5994
6911
  ' align-items: center;',
5995
- ' width: 100%;',
6912
+ ' flex-shrink: 0;',
5996
6913
  '}',
5997
- '.cl-thought-chain-divider {',
5998
- ' display: none;',
6914
+
6915
+
6916
+ // ── Progress shimmer keyframes ──
6917
+ '@keyframes cl-progress-shimmer {',
6918
+ ' 0% { background-position: 200% 0; }',
6919
+ ' 100% { background-position: -200% 0; }',
5999
6920
  '}',
6000
- '.cl-thought-chain-content--execution {',
6001
- ' border: 1.5px solid rgba(0,0,0,0.04);',
6921
+
6922
+ // ── Output card(Figma 160:6681) ──
6923
+ '.cl-output-card {',
6924
+ ' background: #fff !important;',
6925
+ ' border: 1.2px solid rgba(47,47,51,0.1) !important;',
6926
+ ' border-radius: 24px !important;',
6927
+ ' padding: 10px 15px !important;',
6928
+ ' width: 100% !important;',
6929
+ ' max-width: 100% !important;',
6930
+ ' min-width: 0 !important;',
6931
+ ' box-sizing: border-box !important;',
6932
+ ' overflow: hidden;',
6933
+ '}',
6934
+ _clRule(hostCss.modernCardLayout ? ['.cl-output-card'] : [], [
6935
+ ' gap: 10px !important;',
6936
+ ]),
6937
+ _clRule(!hostCss.modernCardLayout ? ['.cl-output-card'] : [], [
6938
+ ' border-radius: 14px !important;',
6939
+ ]),
6940
+ _clRule(!hostCss.modernCardLayout ? ['.cl-remote-agent-card.cl-thought-chain.cl-output-card'] : [], [
6941
+ ' padding: 0 !important;',
6942
+ ]),
6943
+ '.cl-output-card > .cl-thought-chain-content {',
6944
+ ' background: #fff;',
6945
+ ' border: 1px solid #f4f4f4;',
6002
6946
  ' border-radius: 12px;',
6003
- ' padding: 12px;',
6004
- ' gap: 18px;',
6947
+ ' padding: 20px 30px;',
6948
+ ' overflow: hidden;',
6949
+ ' width: 100%;',
6950
+ ' max-width: 100%;',
6951
+ ' min-width: 0;',
6952
+ ' box-sizing: border-box;',
6005
6953
  '}',
6006
- '.cl-thought-chain-content--execution .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);',
6954
+ _clRule(!hostCss.modernCardLayout ? ['.cl-output-card > .cl-thought-chain-content'] : [], [
6955
+ ' margin: 10px 15px;',
6956
+ ' width: calc(100% - 30px);',
6957
+ ]),
6958
+ '.cl-output-card .cl-output-result {',
6959
+ ' width: 100%;',
6960
+ ' max-width: 100%;',
6961
+ ' min-width: 0;',
6962
+ ' box-sizing: border-box;',
6963
+ ' overflow-wrap: anywhere;',
6964
+ ' word-break: break-word;',
6014
6965
  '}',
6015
- '.cl-thought-chain-content--execution .cl-agent-pill-avatar {',
6016
- ' width: 24px;',
6017
- ' height: 24px;',
6018
- ' flex-basis: 24px;',
6966
+ '.cl-output-card > .cl-thought-chain-content * {',
6967
+ ' max-width: 100%;',
6968
+ ' min-width: 0;',
6969
+ ' box-sizing: border-box;',
6019
6970
  '}',
6020
- '.cl-thought-chain-content--execution .cl-agent-pill-name {',
6021
- ' font-size: 15px;',
6022
- ' line-height: 1.2;',
6971
+ '.cl-output-card > .cl-thought-chain-content p,',
6972
+ '.cl-output-card > .cl-thought-chain-content li,',
6973
+ '.cl-output-card > .cl-thought-chain-content a {',
6974
+ ' overflow-wrap: anywhere;',
6975
+ ' word-break: break-word;',
6023
6976
  '}',
6024
- '.cl-remote-agent-card:has(.cl-output-result) .cl-agent-pill {',
6025
- ' gap: 9px;',
6026
- ' height: 42px;',
6027
- ' min-height: 42px;',
6028
- ' padding: 0 15px;',
6977
+ '.cl-output-card > .cl-thought-chain-content hr {',
6029
6978
  ' border: 0;',
6030
- ' border-radius: 9px;',
6031
- ' box-shadow: inset 0 0 0 1.2px rgba(47,47,51,0.06);',
6979
+ ' border-top: 1px solid #bdbdbd;',
6032
6980
  '}',
6033
- '.cl-remote-agent-card:has(.cl-output-result) .cl-agent-pill-avatar {',
6034
- ' width: 24px;',
6035
- ' height: 24px;',
6036
- ' flex-basis: 24px;',
6981
+ '.cl-output-card > .cl-thought-chain-content pre,',
6982
+ '.cl-output-card > .cl-thought-chain-content code {',
6983
+ ' overflow-x: auto;',
6984
+ ' white-space: pre-wrap;',
6985
+ ' word-break: break-all;',
6037
6986
  '}',
6038
- '.cl-remote-agent-card:has(.cl-output-result) .cl-agent-pill-name {',
6039
- ' font-size: 15px;',
6040
- ' line-height: 1.2;',
6987
+ // V2 output card:统一 border/padding 与 execution card 一致
6988
+ '.cl-exec-v2.cl-output-card {',
6989
+ ' border: 1px solid rgba(0,0,0,0.05) !important;',
6990
+ ' border-radius: 14px !important;',
6991
+ ' padding: 0 !important;',
6992
+ '}',
6993
+ // V2 output card:去掉 content 区多余的内边距,detail card 自带动间距
6994
+ '.cl-exec-v2.cl-output-card > .cl-thought-chain-content {',
6995
+ ' background: transparent;',
6996
+ ' border: none;',
6997
+ ' border-radius: 0;',
6998
+ ' padding: 0 14px !important;',
6041
6999
  '}',
6042
7000
 
6043
- // ── Figma 思考步骤(297:716)──
6044
- '.cl-thought-chain-steps-section {',
6045
- ' width: 100%;',
6046
- ' display: flex;',
6047
- ' flex-direction: column;',
6048
- ' align-items: flex-start;',
6049
- ' gap: 4px;',
6050
- ' padding: 4px 0;',
6051
- ' box-sizing: border-box;',
7001
+ // ── Collapsed state(Figma 145:3466) ──
7002
+ '.cl-remote-agent-card:has(.cl-content-collapsed) {',
7003
+ ' padding: 0 !important;',
6052
7004
  '}',
6053
- '.cl-tools-collapse-header {',
7005
+ // ── Output card Footer(Figma 131:2091) ──
7006
+ '.cl-output-footer {',
6054
7007
  ' display: flex;',
6055
7008
  ' align-items: center;',
6056
- ' gap: 0;',
6057
- ' padding: 0;',
6058
- ' cursor: default;',
6059
- ' user-select: none;',
6060
- '}',
6061
- '.cl-tools-collapse-header:hover { opacity: 1; }',
6062
- '.cl-tools-collapse-header-icon { display: none; }',
6063
- '.cl-tools-collapse-header-title {',
7009
+ ' gap: 4px;',
6064
7010
  ' font-family: "PingFang SC", sans-serif;',
6065
- ' font-size: 10px;',
6066
- ' font-weight: 600;',
6067
- ' line-height: 1.2;',
6068
- ' color: rgba(47,47,51,0.90);',
7011
+ ' font-size: 14px;',
7012
+ ' color: #999;',
6069
7013
  '}',
6070
- '.cl-tools-collapse-body {',
6071
- ' position: relative;',
7014
+ _clRule(!hostCss.modernCardLayout ? ['.cl-output-footer'] : [], [
7015
+ ' padding: 10px 15px;',
7016
+ ' line-height: 22px;',
7017
+ ]),
7018
+ '.cl-output-footer-text {',
7019
+ ' white-space: nowrap;',
7020
+ '}',
7021
+ '.cl-output-footer-star {',
6072
7022
  ' display: flex;',
6073
- ' flex-direction: column;',
6074
- ' gap: 4px;',
6075
- ' width: 100%;',
6076
- ' overflow: hidden;',
6077
- ' padding: 0;',
6078
- ' transition: max-height 0.25s ease, opacity 0.2s ease;',
7023
+ ' align-items: center;',
7024
+ ' flex-shrink: 0;',
6079
7025
  '}',
6080
- '.cl-tools-collapse-body::before {',
6081
- ' content: "";',
6082
- ' position: absolute;',
6083
- ' left: 7px;',
6084
- ' top: 14px;',
6085
- ' bottom: 14px;',
6086
- ' width: 1px;',
6087
- ' background: rgba(47,47,51,0.10);',
7026
+ '.cl-output-footer-count {',
7027
+ ' font-weight: 500;',
7028
+ ' white-space: nowrap;',
6088
7029
  '}',
6089
- '.cl-tools-collapse-body.cl-expanded { max-height: 2000px; opacity: 1; }',
6090
- '.cl-tools-collapse-body.cl-collapsed { max-height: 0; opacity: 0; }',
6091
- '.cl-tools-collapse-step {',
6092
- ' position: relative;',
6093
- ' display: block;',
6094
- ' width: 100%;',
6095
- ' padding: 0;',
6096
- ' z-index: 1;',
7030
+
7031
+ /* ── Sidebar 面板(Figma 145:5712) ── */
7032
+ '.chat-sidebar {',
7033
+ ' background: #fff !important;',
7034
+ ' border: 1px solid rgba(0,0,0,0.05) !important;',
7035
+ ' border-radius: 14px !important;',
7036
+ ' padding: 16px 20px !important;',
7037
+ ' box-sizing: border-box !important;',
7038
+ ' min-width: 0 !important;',
7039
+ ' max-width: 100% !important;',
7040
+ ' overflow-x: hidden !important;',
7041
+ ' display: flex !important;',
7042
+ ' flex-direction: column !important;',
7043
+ ' gap: 16px !important;',
6097
7044
  '}',
6098
- '.cl-tools-collapse-step-row {',
6099
- ' display: flex;',
6100
- ' align-items: center;',
6101
- ' gap: 8px;',
6102
- ' min-height: 14px;',
7045
+ '.chat-sidebar > .sidebar-panel {',
7046
+ ' display: flex !important;',
7047
+ ' flex-direction: column !important;',
7048
+ ' gap: 16px !important;',
7049
+ ' width: 100% !important;',
7050
+ ' min-width: 0 !important;',
7051
+ ' max-width: 100% !important;',
7052
+ ' overflow-x: hidden !important;',
7053
+ ' box-sizing: border-box !important;',
7054
+ ' background: transparent !important;',
6103
7055
  '}',
6104
- '.cl-tools-collapse-step-icon {',
6105
- ' width: 14px;',
6106
- ' height: 14px;',
6107
- ' flex: 0 0 14px;',
6108
- ' display: flex;',
6109
- ' align-items: center;',
6110
- ' justify-content: center;',
6111
- ' background: #fff;',
7056
+ '.chat-sidebar .sidebar-header {',
7057
+ ' display: flex !important;',
7058
+ ' align-items: center !important;',
7059
+ ' justify-content: space-between !important;',
7060
+ ' padding: 6px 0 !important;',
7061
+ ' border-radius: 10px !important;',
7062
+ ' width: 100% !important;',
7063
+ ' border: none !important;',
7064
+ ' background: transparent !important;',
6112
7065
  '}',
6113
- '.cl-tools-collapse-step-dot {',
6114
- ' width: 5px;',
6115
- ' height: 5px;',
6116
- ' border-radius: 50%;',
6117
- ' background: #D9D9D9;',
6118
- ' animation: none;',
7066
+ '.chat-sidebar .sidebar-title {',
7067
+ ' font-family: "PingFang SC", sans-serif !important;',
7068
+ ' font-weight: 500 !important;',
7069
+ ' font-size: 18px !important;',
7070
+ ' color: #333 !important;',
7071
+ ' line-height: 1.32 !important;',
6119
7072
  '}',
6120
- '.cl-tools-collapse-step-dot::before,',
6121
- '.cl-tools-collapse-step-dot::after,',
6122
- '.cl-tools-collapse-step-dot span {',
6123
- ' content: none;',
6124
- ' display: none;',
7073
+ '.chat-sidebar .sidebar-header button {',
7074
+ ' width: 16px !important;',
7075
+ ' height: 16px !important;',
7076
+ ' padding: 0 !important;',
7077
+ ' border: none !important;',
7078
+ ' background: transparent !important;',
7079
+ ' cursor: pointer !important;',
7080
+ ' flex-shrink: 0 !important;',
6125
7081
  '}',
6126
- '.cl-tools-collapse-step-check {',
6127
- ' position: relative;',
6128
- ' width: 14px;',
6129
- ' height: 14px;',
6130
- ' border-radius: 50%;',
6131
- ' background: #D9D9D9;',
7082
+ '.chat-sidebar .sidebar-content {',
7083
+ ' font-family: "PingFang SC", sans-serif !important;',
7084
+ ' font-size: 14px !important;',
7085
+ ' font-weight: 400 !important;',
7086
+ ' line-height: 1.8 !important;',
7087
+ ' color: #333 !important;',
7088
+ ' width: 100% !important;',
7089
+ ' min-width: 0 !important;',
7090
+ ' max-width: 100% !important;',
7091
+ ' padding: 0 !important;',
7092
+ ' overflow-x: hidden !important;',
7093
+ ' box-sizing: border-box !important;',
7094
+ ' overflow-wrap: anywhere !important;',
6132
7095
  '}',
6133
- '.cl-tools-collapse-step-check::after {',
6134
- ' content: "";',
6135
- ' position: absolute;',
6136
- ' left: 4px;',
6137
- ' top: 3px;',
6138
- ' width: 4px;',
6139
- ' height: 7px;',
6140
- ' border: solid #fff;',
6141
- ' border-width: 0 1.3px 1.3px 0;',
6142
- ' transform: rotate(45deg);',
7096
+ '.chat-sidebar .sidebar-markdown {',
7097
+ ' font-family: "PingFang SC", sans-serif !important;',
7098
+ ' font-size: 14px !important;',
7099
+ ' font-weight: 400 !important;',
7100
+ ' line-height: 1.8 !important;',
7101
+ ' color: #333 !important;',
7102
+ ' background: transparent !important;',
7103
+ ' border: none !important;',
7104
+ ' padding: 0 !important;',
7105
+ ' min-width: 0 !important;',
7106
+ ' max-width: 100% !important;',
7107
+ ' overflow-x: hidden !important;',
7108
+ ' box-sizing: border-box !important;',
7109
+ ' overflow-wrap: anywhere !important;',
6143
7110
  '}',
6144
- '.cl-tools-collapse-step-title {',
6145
- ' font-family: "PingFang SC", sans-serif;',
6146
- ' font-size: 9.5px;',
6147
- ' font-weight: 400;',
6148
- ' line-height: 1.32;',
6149
- ' color: rgba(47,47,51,0.40);',
6150
- ' white-space: nowrap;',
6151
- ' overflow: hidden;',
6152
- ' text-overflow: ellipsis;',
7111
+ '.chat-sidebar .sidebar-markdown * {',
7112
+ ' max-width: 100% !important;',
7113
+ ' min-width: 0 !important;',
7114
+ ' box-sizing: border-box !important;',
6153
7115
  '}',
6154
- '.cl-tools-collapse-step-detail {',
6155
- ' margin: 2px 0 0 22px;',
6156
- ' font-family: "PingFang SC", sans-serif;',
6157
- ' font-size: 9px;',
6158
- ' line-height: 1.32;',
6159
- ' color: rgba(47,47,51,0.40);',
7116
+ '.chat-sidebar .sidebar-markdown pre,',
7117
+ '.chat-sidebar .sidebar-markdown code {',
7118
+ ' white-space: pre-wrap !important;',
7119
+ ' word-break: break-word !important;',
6160
7120
  '}',
6161
- '.cl-thought-chain-content--execution .cl-thought-chain-steps-section {',
6162
- ' gap: 6px;',
6163
- ' padding: 6px 0;',
7121
+ // 隐藏宿主 sidebar 自带的 "Rendered Markdown / View Raw Text" 工具栏
7122
+ '.chat-sidebar .sidebar-markdown-shell__toolbar {',
7123
+ ' display: none !important;',
6164
7124
  '}',
6165
- '.cl-thought-chain-content--execution .cl-tools-collapse-header-title {',
6166
- ' font-size: 15px;',
6167
- ' line-height: 1.2;',
7125
+ // ═══════════════════════════════════════════════════════════════
7126
+ // V2 执行卡片样式(2026.6.9+ 新版 UI)
7127
+ // 所有 V2 样式在 .cl-exec-v2 下隔离,不影响旧版
7128
+ // ═══════════════════════════════════════════════════════════════
7129
+
7130
+ // ── V2 容器 ──
7131
+ '.cl-exec-v2 {',
7132
+ ' position: relative;',
7133
+ ' gap: 10px;',
7134
+ ' padding: 0;',
6168
7135
  '}',
6169
- '.cl-thought-chain-content--execution .cl-tools-collapse-body {',
7136
+
7137
+ // ── V2 Header(Figma 371:6987 — 红晕渐变背景 + 独立边框)──
7138
+ '.cl-exec-v2 .cl-openagent-header-v2 {',
7139
+ ' background: linear-gradient(90deg, rgba(220, 38, 38, 0.09) 0%, rgba(220, 38, 38, 0) 34%),',
7140
+ ' linear-gradient(90deg, rgb(253, 253, 254) 0%, rgb(253, 253, 254) 100%) !important;',
7141
+ ' border-bottom: 1px solid rgba(229, 229, 234, 0.75) !important;',
7142
+ ' padding: 8px 6px !important;',
7143
+ ' margin: 0 !important;',
7144
+ ' border-radius: 10px 10px 0 0;',
7145
+ ' height: auto !important;',
7146
+ ' min-height: auto !important;',
6170
7147
  ' gap: 6px;',
7148
+ ' box-sizing: border-box;',
6171
7149
  '}',
6172
- '.cl-thought-chain-content--execution .cl-tools-collapse-body::before {',
6173
- ' left: 10px;',
6174
- ' top: 21px;',
6175
- ' bottom: 21px;',
6176
- ' width: 1px;',
6177
- ' background: #DBDBDB;',
6178
- ' transform: scaleX(0.3);',
6179
- ' transform-origin: left center;',
7150
+ '.cl-exec-v2 .cl-openagent-header-v2:hover {',
7151
+ ' background: linear-gradient(90deg, rgba(220, 38, 38, 0.12) 0%, rgba(220, 38, 38, 0) 34%),',
7152
+ ' linear-gradient(90deg, rgb(250, 250, 251) 0%, rgb(250, 250, 251) 100%) !important;',
6180
7153
  '}',
6181
- '.cl-thought-chain-content--execution .cl-tools-collapse-step-row {',
6182
- ' gap: 12px;',
6183
- ' min-height: 21px;',
7154
+
7155
+ // ── V2 圆形灰色头像(替代小徽章)──
7156
+ '.cl-exec-v2 .cl-openagent-avatar-v2 {',
7157
+ ' display: inline-block;',
7158
+ ' width: 24px;',
7159
+ ' height: 24px;',
7160
+ ' border-radius: 50%;',
7161
+ ' background: #d0d0d0;',
7162
+ ' flex-shrink: 0;',
7163
+ ' margin-right: 4px;',
6184
7164
  '}',
6185
- '.cl-thought-chain-content--execution .cl-tools-collapse-step-icon {',
6186
- ' width: 21px;',
6187
- ' height: 21px;',
6188
- ' flex-basis: 21px;',
7165
+
7166
+ // ── V2 隐藏旧版 OASN 小徽章和 @agentName ──
7167
+ '.cl-exec-v2 .cl-openagent-badge,',
7168
+ '.cl-exec-v2 .cl-openagent-agent {',
7169
+ ' display: none !important;',
6189
7170
  '}',
6190
- '.cl-thought-chain-content--execution .cl-tools-collapse-step-dot {',
6191
- ' width: 6px;',
6192
- ' height: 6px;',
6193
- ' background: #DCDCDC;',
7171
+ // ── V2 隐藏步骤标题栏(▼ + "思考中..."),保留进度文字行 ──
7172
+ '.cl-exec-v2 .cl-tools-collapse-header-v2 {',
7173
+ ' display: none !important;',
6194
7174
  '}',
6195
- '.cl-thought-chain-content--execution .cl-tools-collapse-step-check {',
6196
- ' width: 15px;',
6197
- ' height: 15px;',
6198
- ' background: #DCDCDC;',
7175
+
7176
+ // ── V2 Detail Card(大头像 + 右置星级 + 网格点背景)──
7177
+ '.cl-exec-v2 .cl-exec-detail-card-v2 {',
7178
+ ' max-width: 488px !important;',
7179
+ ' width: 100% !important;',
7180
+ ' padding: 8px 16px 8px 12px !important;',
7181
+ ' padding-right: 90px !important;',
7182
+ ' border-radius: 12px !important;',
7183
+ ' background: #f7f7f8 !important;',
7184
+ ' margin: 12px 14px 14px 14px !important;',
7185
+ ' margin-top: 0 !important;',
7186
+ ' margin-left: 0 !important;',
7187
+ ' position: relative;',
7188
+ ' overflow: hidden;',
7189
+ ' box-sizing: border-box;',
6199
7190
  '}',
6200
- '.cl-thought-chain-content--execution .cl-tools-collapse-step-check::after {',
6201
- ' left: 4px;',
6202
- ' top: 2px;',
6203
- ' width: 5px;',
6204
- ' height: 8px;',
6205
- ' border-width: 0 1.4px 1.4px 0;',
7191
+ /* 四角网格点装饰 */
7192
+ '.cl-exec-v2 .cl-exec-detail-card-v2::before,',
7193
+ '.cl-exec-v2 .cl-exec-detail-card-v2::after {',
7194
+ ' content: "";',
7195
+ ' position: absolute;',
7196
+ ' width: 40px;',
7197
+ ' height: 40px;',
7198
+ ' background-image: radial-gradient(circle, #ddd 1px, transparent 1px);',
7199
+ ' background-size: 8px 8px;',
7200
+ ' opacity: 0.5;',
6206
7201
  '}',
6207
- '.cl-thought-chain-content--execution .cl-tools-collapse-step-title {',
6208
- ' font-size: 14px;',
6209
- ' line-height: 1.32;',
7202
+ '.cl-exec-v2 .cl-exec-detail-card-v2::before {',
7203
+ ' top: 8px;',
7204
+ ' left: 8px;',
6210
7205
  '}',
6211
- '.cl-thought-chain-content--execution .cl-tools-collapse-step-detail {',
6212
- ' display: none;',
7206
+ '.cl-exec-v2 .cl-exec-detail-card-v2::after {',
7207
+ ' bottom: 8px;',
7208
+ ' right: 8px;',
6213
7209
  '}',
6214
7210
 
6215
- // ── output 等待渲染完成前,隐藏整张 result card 和宿主 shell ──
6216
- 'details.chat-tools-collapse:has(.cl-output-card--pending),',
6217
- 'details.chat-tool-msg-collapse:has(.cl-output-card--pending),',
6218
- '.chat-tools-collapse:has(.cl-output-card--pending),',
6219
- '.chat-tool-msg-collapse:has(.cl-output-card--pending) {',
6220
- ' display: none !important;',
7211
+ '.cl-exec-v2 .cl-exec-detail-row-v2 {',
7212
+ ' display: flex;',
7213
+ ' gap: 16px;',
6221
7214
  '}',
6222
- '.cl-output-card--pending {',
6223
- ' display: none !important;',
7215
+
7216
+ '.cl-exec-v2 .cl-exec-detail-info-v2 {',
7217
+ ' display: flex;',
7218
+ ' flex-direction: column;',
7219
+ ' gap: 6px;',
7220
+ ' flex: 1;',
7221
+ ' min-width: 0;',
6224
7222
  '}',
6225
7223
 
6226
- // ── 结果展示区 ──
6227
- '.cl-output-result {',
6228
- ' margin-top: 4px;',
6229
- ' font-family: "PingFang SC", sans-serif;',
6230
- ' font-size: 13px;',
6231
- ' line-height: 1.6;',
6232
- ' color: #2F2F33;',
6233
- ' word-break: break-word;',
7224
+ // ── V2 大头像 68×68 ──
7225
+ '.cl-exec-v2 .cl-exec-agent-avatar-v2 {',
7226
+ ' width: 68px !important;',
7227
+ ' height: 68px !important;',
7228
+ ' border-radius: 50% !important;',
7229
+ ' object-fit: cover;',
7230
+ ' flex-shrink: 0;',
6234
7231
  '}',
6235
- '.cl-output-result--pending {',
6236
- ' display: none !important;',
7232
+
7233
+ // ── V2 名称 ~20px/600/黑色 ──
7234
+ '.cl-exec-v2 .cl-exec-agent-name-v2 {',
7235
+ ' font-family: "PingFang SC", sans-serif;',
7236
+ ' font-size: 20px !important;',
7237
+ ' font-weight: 600 !important;',
7238
+ ' color: #000 !important;',
7239
+ ' margin: 0;',
7240
+ ' line-height: 1.3;',
6237
7241
  '}',
6238
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result {',
6239
- ' width: 100%;',
6240
- ' max-height: 600px;',
6241
- ' overflow-y: auto;',
6242
- ' overflow-x: hidden;',
6243
- ' box-sizing: border-box;',
6244
- ' margin-top: 0;',
6245
- ' padding: 6px 30px 24px 18px;',
6246
- ' border: 0;',
6247
- ' border-radius: 0;',
6248
- ' background: transparent;',
6249
- ' font-size: 14.25px;',
6250
- ' line-height: 1.42;',
6251
- ' color: rgba(47,47,51,0.50);',
6252
- ' scrollbar-width: thin;',
6253
- ' scrollbar-color: #ECECEC transparent;',
7242
+
7243
+ // ── V2 描述 ~14px/400/灰色 ──
7244
+ '.cl-exec-v2 .cl-exec-agent-bio-v2 {',
7245
+ ' font-family: "PingFang SC", sans-serif;',
7246
+ ' font-size: 14px !important;',
7247
+ ' font-weight: 400;',
7248
+ ' color: #888 !important;',
7249
+ ' margin: 0;',
7250
+ ' line-height: 1.4;',
6254
7251
  '}',
6255
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result::-webkit-scrollbar {',
6256
- ' width: 4.5px;',
7252
+
7253
+ // ── V2 星级右置到卡片右上角 ──
7254
+ '.cl-exec-v2 .cl-exec-star-badge-v2 {',
7255
+ ' position: absolute;',
7256
+ ' right: 24px;',
7257
+ ' top: 20px;',
7258
+ ' display: flex;',
7259
+ ' align-items: center;',
7260
+ ' gap: 4px;',
7261
+ ' padding: 4px 12px;',
7262
+ ' border-radius: 30px;',
7263
+ ' background: #ebebeb;',
7264
+ ' z-index: 1;',
6257
7265
  '}',
6258
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result::-webkit-scrollbar-track {',
6259
- ' background: transparent;',
7266
+ '.cl-exec-v2 .cl-exec-star-count-v2 {',
7267
+ ' font-family: "PingFang SC", sans-serif;',
7268
+ ' font-size: 13px;',
7269
+ ' font-weight: 500;',
7270
+ ' color: #555;',
7271
+ ' white-space: nowrap;',
6260
7272
  '}',
6261
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result::-webkit-scrollbar-thumb {',
6262
- ' background: #ECECEC;',
6263
- ' border-radius: 150px;',
7273
+
7274
+ // ── V2 Progress Row(Figma 373:9765 — shimmer 渐变文字 + 箭头)──
7275
+ '.cl-exec-v2 .cl-exec-progress-row-v2 {',
7276
+ ' display: flex;',
7277
+ ' align-items: center;',
7278
+ ' gap: 2px;',
7279
+ ' margin-top: 16px;',
7280
+ ' padding: 0 4px;',
6264
7281
  '}',
6265
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result h1,',
6266
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result h2 {',
6267
- ' margin: 18px 0 9px;',
6268
- ' font-size: 20px;',
6269
- ' font-weight: 600;',
7282
+ '.cl-exec-v2 .cl-exec-progress-row-v2 .cl-exec-progress-text {',
7283
+ ' font-family: "PingFang SC", sans-serif;',
7284
+ ' font-size: 14px;',
7285
+ ' font-weight: 400;',
6270
7286
  ' line-height: 1.2;',
6271
- ' color: rgba(47,47,51,0.90);',
7287
+ ' margin: 0;',
7288
+ ' white-space: nowrap;',
7289
+ ' background-image: linear-gradient(90deg, #555 0%, #555 36%, #eee 55%, #555 77%, #555 100%);',
7290
+ ' background-size: 200% 100%;',
7291
+ ' -webkit-background-clip: text;',
7292
+ ' background-clip: text;',
7293
+ ' -webkit-text-fill-color: transparent;',
7294
+ ' animation: cl-progress-shimmer 2.5s ease-in-out infinite;',
6272
7295
  '}',
6273
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result h1:first-child,',
6274
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result h2:first-child {',
6275
- ' margin-top: 6px;',
7296
+ '.cl-exec-v2 .cl-exec-progress-row-v2 .cl-exec-progress-arrow {',
7297
+ ' display: flex;',
7298
+ ' align-items: center;',
7299
+ ' flex-shrink: 0;',
7300
+ ' opacity: 1;',
6276
7301
  '}',
6277
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result h3 {',
6278
- ' margin: 18px 0 9px;',
6279
- ' font-size: 15px;',
6280
- ' font-weight: 600;',
6281
- ' line-height: 1.2;',
6282
- ' color: rgba(47,47,51,0.90);',
7302
+
7303
+ // ── V2 隐藏旧版 name-row(星级原来在名称旁边)──
7304
+ '.cl-exec-v2 .cl-exec-name-row,',
7305
+ '.cl-exec-v2 .cl-exec-star-badge:not(.cl-exec-star-badge-v2) {',
7306
+ ' display: none !important;',
6283
7307
  '}',
6284
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result p,',
6285
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result li {',
6286
- ' font-size: 14.25px;',
6287
- ' line-height: 1.42;',
6288
- ' color: rgba(47,47,51,0.50);',
7308
+
7309
+ // ─ V2 步骤列表样式(覆盖 thought-chain-card.js 默认值)──
7310
+ '.cl-exec-v2 .cl-tools-collapse-body-v2 {',
7311
+ ' padding: 4px 0 8px;',
6289
7312
  '}',
6290
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result strong,',
6291
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result b,',
6292
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result a {',
6293
- ' color: rgba(47,47,51,0.90) !important;',
6294
- ' font-weight: 600;',
7313
+ '.cl-exec-v2 .cl-tools-collapse-step {',
7314
+ ' padding: 5px 0;',
7315
+ ' gap: 10px;',
6295
7316
  '}',
6296
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result ul,',
6297
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result ol {',
6298
- ' padding-left: 20px;',
6299
- ' margin: 6px 0;',
7317
+ '.cl-exec-v2 .cl-tools-collapse-step-title {',
7318
+ ' font-size: 13px;',
7319
+ ' color: #555;',
6300
7320
  '}',
6301
- '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result hr {',
6302
- ' border: 0;',
6303
- ' border-top: 1px solid rgba(47,47,51,0.12);',
6304
- ' margin: 15px 0;',
7321
+ '.cl-exec-v2 .cl-tools-collapse-step-check {',
7322
+ ' width: 12px;',
7323
+ ' height: 12px;',
7324
+ ' background: #ccc;',
6305
7325
  '}',
6306
- '.cl-output-result p { margin: 4px 0; }',
6307
- '.cl-output-result ul, .cl-output-result ol { padding-left: 20px; margin: 4px 0; }',
6308
- '.cl-output-result code {',
6309
- ' background: rgba(0,0,0,0.05);',
6310
- ' padding: 1px 4px;',
6311
- ' border-radius: 3px;',
6312
- ' font-size: 12px;',
7326
+ '.cl-exec-v2 .cl-tools-collapse-step-dot {',
7327
+ ' width: 14px;',
7328
+ ' height: 14px;',
7329
+ '}',
7330
+ '.cl-exec-v2 .cl-tools-collapse-step-dot::before,',
7331
+ '.cl-exec-v2 .cl-tools-collapse-step-dot::after,',
7332
+ '.cl-exec-v2 .cl-tools-collapse-step-dot span {',
7333
+ ' width: 3px;',
7334
+ ' height: 3px;',
7335
+ ' background: #bbb;',
6313
7336
  '}',
6314
7337
 
6315
- // ── 附件下载区 ──
6316
- '.cl-openagent-media-links {',
7338
+ // ── V2 Footer(-由xxx完成 + 星级)──
7339
+ '.cl-exec-v2 .cl-output-footer-v2 {',
6317
7340
  ' display: flex;',
6318
- ' flex-wrap: wrap;',
6319
- ' gap: 8px;',
6320
- ' width: 100%;',
6321
- ' box-sizing: border-box;',
6322
- ' padding: 6px 18px 12px;',
6323
- '}',
6324
- '.cl-openagent-media-link {',
6325
- ' display: inline-grid;',
6326
- ' grid-template-columns: auto auto;',
6327
- ' grid-template-areas: "icon action" "icon file";',
6328
7341
  ' align-items: center;',
6329
- ' column-gap: 8px;',
6330
- ' row-gap: 1px;',
6331
- ' max-width: min(100%, 360px);',
6332
- ' box-sizing: border-box;',
6333
- ' padding: 8px 10px;',
6334
- ' border: 1px solid rgba(47,47,51,0.12);',
6335
- ' border-radius: 8px;',
6336
- ' background: rgba(47,47,51,0.03);',
6337
- ' color: rgba(47,47,51,0.90) !important;',
6338
- ' text-decoration: none !important;',
7342
+ ' gap: 4px;',
6339
7343
  ' font-family: "PingFang SC", sans-serif;',
7344
+ ' font-size: 13px;',
7345
+ ' color: #999;',
7346
+ ' padding: 12px;',
7347
+ ' margin-top: 8px;',
6340
7348
  '}',
6341
- '.cl-openagent-media-link:hover {',
6342
- ' background: rgba(16,189,235,0.08);',
6343
- ' border-color: rgba(16,189,235,0.35);',
7349
+ '.cl-exec-v2 .cl-output-footer-v2 .cl-output-footer-text {',
7350
+ ' white-space: nowrap;',
6344
7351
  '}',
6345
- '.cl-openagent-media-link-icon {',
6346
- ' grid-area: icon;',
6347
- ' width: 28px;',
6348
- ' height: 28px;',
6349
- ' border-radius: 6px;',
6350
- ' background: rgba(16,189,235,0.12);',
6351
- ' color: #088BAE;',
6352
- ' display: inline-flex;',
7352
+ '.cl-exec-v2 .cl-output-footer-v2 .cl-output-footer-star {',
7353
+ ' display: flex;',
6353
7354
  ' align-items: center;',
6354
- ' justify-content: center;',
6355
- ' font-size: 11px;',
6356
- ' font-weight: 700;',
6357
- '}',
6358
- '.cl-openagent-media-link-text {',
6359
- ' grid-area: action;',
6360
- ' min-width: 0;',
6361
- ' font-size: 13px;',
6362
- ' font-weight: 600;',
6363
- ' line-height: 1.2;',
7355
+ ' flex-shrink: 0;',
7356
+ ' margin-left: 2px;',
6364
7357
  '}',
6365
- '.cl-openagent-media-link-file {',
6366
- ' grid-area: file;',
6367
- ' min-width: 0;',
6368
- ' overflow: hidden;',
6369
- ' text-overflow: ellipsis;',
7358
+ '.cl-exec-v2 .cl-output-footer-v2 .cl-output-footer-count {',
7359
+ ' font-weight: 500;',
6370
7360
  ' white-space: nowrap;',
6371
- ' font-size: 11px;',
6372
- ' line-height: 1.2;',
6373
- ' color: rgba(47,47,51,0.50);',
6374
7361
  '}',
6375
7362
 
6376
- // ── 错误状态 ──
6377
- '.cl-remote-agent-card--error {',
6378
- ' border-color: rgba(220, 38, 38, 0.3);',
6379
- ' background: rgba(254, 242, 242, 0.5);',
7363
+ // ── chat-text 下 p 标签样式 ──
7364
+ '.cl-remote-agent-card .chat-text p {',
7365
+ ' color: #2F2F33 !important;',
7366
+ ' text-align: justify;',
7367
+ ' font-family: "PingFang SC" !important;',
7368
+ ' font-size: 14px !important;',
7369
+ ' font-style: normal !important;',
7370
+ ' font-weight: 400 !important;',
7371
+ ' line-height: 132% !important;',
6380
7372
  '}',
6381
7373
 
6382
- // ── Header 折叠/展开 ──
6383
- '.cl-openagent-header:hover {',
6384
- ' background: color-mix(in srgb, var(--bg-hover, #ECEDF0) 75%, transparent);',
6385
- ' transition: background 0.15s ease;',
6386
- '}',
6387
- '.cl-content-collapsed {',
6388
- ' display: none !important;',
7374
+ // ── chat-text code 标签样式(去背景、去边框、加粗)──
7375
+ '.chat-text code,',
7376
+ '.cl-remote-agent-card .chat-text code,',
7377
+ '.cl-remote-agent-card .chat-text p code {',
7378
+ ' background: transparent !important;',
7379
+ ' border: none !important;',
7380
+ ' font-weight: 700 !important;',
6389
7381
  '}',
6390
7382
  ].join('\n');
6391
7383
  document.head.appendChild(style);
@@ -6393,6 +7385,7 @@ function _clScan() {
6393
7385
  // 只处理当前 cardNode 的祖先链路,不 querySelectorAll 全局
6394
7386
  window._clMarkRemoteAgentHostShell = function _clMarkRemoteAgentHostShell(cardNode) {
6395
7387
  try {
7388
+ var hostAdapter = CL.hostAdapter || {};
6396
7389
  var node = cardNode && cardNode.parentElement;
6397
7390
  var hops = 0;
6398
7391
  while (node && node !== document.body && hops < 10) {
@@ -6405,17 +7398,8 @@ function _clScan() {
6405
7398
 
6406
7399
  var shouldMark = false;
6407
7400
  var tag = (node.tagName || '').toLowerCase();
6408
- if (tag === 'details') {
6409
- shouldMark = node.matches && node.matches(
6410
- 'details.chat-tools-collapse, details.chat-tool-msg-collapse'
6411
- );
6412
- } else if (node.matches) {
6413
- shouldMark = node.matches(
6414
- '.chat-tool-card,' +
6415
- '.chat-tool-card__detail,' +
6416
- '.chat-tools-collapse__body,' +
6417
- '.chat-tool-msg-body'
6418
- );
7401
+ if (typeof hostAdapter.isMarkableHost === 'function') {
7402
+ shouldMark = hostAdapter.isMarkableHost(node);
6419
7403
  }
6420
7404
 
6421
7405
  if (shouldMark && node.classList) {
@@ -7008,6 +7992,73 @@ function _clInferToolCardKind(card) {
7008
7992
  return 'call';
7009
7993
  }
7010
7994
 
7995
+ function _clPickAgentDescription(source) {
7996
+ if (!source) return '';
7997
+ var keys = [
7998
+ 'agent_bio',
7999
+ 'agentBio',
8000
+ 'bio',
8001
+ 'description',
8002
+ 'desc',
8003
+ 'agent_description',
8004
+ 'agentDescription',
8005
+ 'MOM',
8006
+ 'mom',
8007
+ 'introduction',
8008
+ 'summary'
8009
+ ];
8010
+ for (var i = 0; i < keys.length; i++) {
8011
+ var value = source[keys[i]];
8012
+ if (typeof value === 'string' && value.trim()) return value.trim();
8013
+ }
8014
+ return '';
8015
+ }
8016
+
8017
+ function _clIsFailureStatusValue(value) {
8018
+ var normalized = String(value || '').trim().toLowerCase();
8019
+ return normalized === 'failed'
8020
+ || normalized === 'failure'
8021
+ || normalized === 'error'
8022
+ || normalized === 'errored'
8023
+ || normalized === 'rejected'
8024
+ || normalized === 'cancelled'
8025
+ || normalized === 'canceled';
8026
+ }
8027
+
8028
+ function _clLooksLikeRemoteFailureText(text) {
8029
+ var value = String(text || '').trim();
8030
+ if (!value || value.length > 300) return false;
8031
+ return /(^|[,。;\s])(调用失败|执行失败|任务失败|远端服务目前连不上|远端服务.*不可用|两次都返回了调用失败)([,。;\s]|$)/.test(value);
8032
+ }
8033
+
8034
+ function _clInferToolCardError(card, chunks, rawText) {
8035
+ if (chunks && chunks.some(function(c) { return c && c.type === 'error'; })) return true;
8036
+ if (!card) return _clLooksLikeRemoteFailureText(rawText);
8037
+ if (card.isError === true || card.error === true) return true;
8038
+ if (_clIsFailureStatusValue(card.status)
8039
+ || _clIsFailureStatusValue(card.state)
8040
+ || _clIsFailureStatusValue(card.resultStatus)) {
8041
+ return true;
8042
+ }
8043
+ if (card.error && typeof card.error === 'object') return true;
8044
+ return _clLooksLikeRemoteFailureText(rawText);
8045
+ }
8046
+
8047
+ function _clApplyAgentIdentityToModel(model) {
8048
+ if (!model || typeof CL === 'undefined' || !CL || typeof CL.getAgentIdentity !== 'function') return model;
8049
+ var identity = CL.getAgentIdentity(model.agentId, model.agentName);
8050
+ if (!identity) return model;
8051
+ model.agentId = model.agentId || identity.id || identity.agent_id;
8052
+ if (!model.agentName || model.agentName === 'Remote Agent') {
8053
+ model.agentName = identity.name || model.agentName;
8054
+ }
8055
+ model.agentAvatar = model.agentAvatar || identity.avatar || identity.avatar_url || identity.avatarUrl || null;
8056
+ if (!model.agentBio) {
8057
+ model.agentBio = _clPickAgentDescription(identity);
8058
+ }
8059
+ return model;
8060
+ }
8061
+
7011
8062
  function _clParseToolCardModel(card) {
7012
8063
  var inferredKind = _clInferToolCardKind(card);
7013
8064
 
@@ -7016,6 +8067,8 @@ function _clParseToolCardModel(card) {
7016
8067
  var agentId = args.agent_id || args.agentId || null;
7017
8068
  var agentName = args.agent_name || args.agentName || agentId || 'Remote Agent';
7018
8069
  var agentAvatar = args.agent_avatar || args.agentAvatar || args.avatar || args.avatar_url || args.avatarUrl || null;
8070
+ var agentBio = _clPickAgentDescription(args);
8071
+ var agentStars = args.agent_stars || args.agentStars || args.stars || args.claws || '3.2万';
7019
8072
  var taskText = args.task || args.message || args.instruction || '';
7020
8073
 
7021
8074
  // 从 text 解析思考步骤 / 最终文本
@@ -7025,22 +8078,27 @@ function _clParseToolCardModel(card) {
7025
8078
  rawText: rawText
7026
8079
  });
7027
8080
  var hasOutput = inferredKind === 'result' && rawText.trim().length > 0;
7028
- var isError = chunks.some(function(c) { return c.type === 'error'; });
8081
+ var isError = _clInferToolCardError(card, chunks, rawText);
7029
8082
 
7030
8083
  var model = {
7031
8084
  agentId: agentId,
7032
8085
  agentName: agentName,
7033
8086
  agentAvatar: agentAvatar,
8087
+ agentBio: agentBio,
8088
+ agentStars: agentStars,
7034
8089
  taskText: taskText,
7035
8090
  toolCallId: card.toolCallId || '',
7036
- status: hasOutput ? 'completed' : 'executing',
8091
+ status: isError ? 'failed' : (hasOutput ? 'completed' : 'executing'),
7037
8092
  rawText: rawText,
8093
+ text: rawText,
8094
+ outputText: rawText,
7038
8095
  chunks: chunks,
7039
8096
  isError: isError,
7040
8097
  inferredKind: inferredKind,
7041
8098
  };
8099
+ _clApplyAgentIdentityToModel(model);
7042
8100
 
7043
- console.log('[cl-model] parsed:', 'agent=' + agentName,
8101
+ console.log('[cl-model] parsed:', 'agent=' + model.agentName,
7044
8102
  'status=' + model.status,
7045
8103
  'chunks=' + chunks.length,
7046
8104
  'error=' + isError);
@@ -7065,6 +8123,11 @@ function _clParseToolCardModel(card) {
7065
8123
  // UI 结构使用 shared thought-chain styles,数据来源是 RenderHook model。
7066
8124
 
7067
8125
  function _clRenderExecutionCard(model) {
8126
+ // ── V2 版本判断:≥ 2026.6.9 启用新版 UI ──
8127
+ if (typeof _clIsHostVersionGte === 'function' && _clIsHostVersionGte('2026.6.9')) {
8128
+ return _clRenderExecutionCardV2(model);
8129
+ }
8130
+
7068
8131
  var container = document.createElement('div');
7069
8132
  container.className = 'cl-remote-agent-card cl-thought-chain';
7070
8133
  if (CL && typeof CL.diagMarkCard === 'function') {
@@ -7074,111 +8137,46 @@ function _clRenderExecutionCard(model) {
7074
8137
  container.appendChild(_clCreateOpenAgentHeader(model));
7075
8138
 
7076
8139
  var content = document.createElement('div');
7077
- content.className = 'cl-thought-chain-content cl-thought-chain-content--execution';
8140
+ content.className = 'cl-thought-chain-content cl-thought-chain-content--execution cl-content-collapsed';
7078
8141
  container.appendChild(content);
7079
8142
 
7080
- // ── Agent Pill ──
7081
- console.log('[cl-exec] 🏷️ agentName=' + JSON.stringify(model.agentName) + ' agentId=' + JSON.stringify(model.agentId));
7082
- var pillSlot = document.createElement('div');
7083
- pillSlot.className = 'cl-thought-chain-pill-slot';
7084
- var pill = _clCreateAgentPill(model.agentName, model.agentId, model.agentAvatar);
7085
- pillSlot.appendChild(pill);
7086
- content.appendChild(pillSlot);
7087
-
7088
- // ── 分隔线 ──
7089
- var divider = document.createElement('div');
7090
- divider.className = 'cl-thought-chain-divider';
7091
- content.appendChild(divider);
7092
-
7093
- // ── 思考步骤区 ──
7094
- var stepsSection = document.createElement('div');
7095
- stepsSection.className = 'cl-thought-chain-steps-section';
7096
-
7097
- // 标题栏
7098
- var header = document.createElement('div');
7099
- header.className = 'cl-tools-collapse-header';
7100
-
7101
- var headerIcon = document.createElement('span');
7102
- headerIcon.className = 'cl-tools-collapse-header-icon';
7103
- headerIcon.textContent = '▼';
7104
-
7105
- var headerTitle = document.createElement('span');
7106
- headerTitle.className = 'cl-tools-collapse-header-title';
7107
-
7108
- // 从 chunks 提取步骤
7109
- var steps = [];
7110
- for (var i = 0; i < model.chunks.length; i++) {
7111
- var chunk = model.chunks[i];
7112
- if (chunk.type === 'step') {
7113
- steps.push({ title: chunk.title, detail: chunk.detail || '' });
7114
- }
7115
- }
7116
-
7117
- // 合并预缓冲步骤(WS 先于 Lit 渲染到达时)
7118
- if (model._bufferedSteps && model._bufferedSteps.length > 0) {
7119
- steps = model._bufferedSteps;
7120
- }
7121
- if (typeof _cl_compactThoughtSteps === 'function') {
7122
- steps = _cl_compactThoughtSteps(steps);
7123
- }
7124
-
7125
- headerTitle.textContent = '思考中...';
7126
-
7127
- header.appendChild(headerIcon);
7128
- header.appendChild(headerTitle);
7129
-
7130
- // 步骤列表(可折叠)
7131
- var body = document.createElement('div');
7132
- body.className = 'cl-tools-collapse-body cl-expanded';
7133
-
7134
- for (var si = 0; si < steps.length; si++) {
7135
- var isLatest = (si === steps.length - 1);
7136
- var stepEl = _clCreateStepElement(steps[si], isLatest);
7137
- body.appendChild(stepEl);
7138
- }
7139
-
7140
- // 折叠/展开
7141
- header.style.cursor = 'pointer';
7142
- header.addEventListener('click', function(evt) {
7143
- evt.stopPropagation(); // 防止外层容器拦截
7144
- var isExpanded = body.classList.contains('cl-expanded');
7145
- console.log('[cl-exec] 🖱️ header click: expanded=' + isExpanded + ' bodyChildren=' + body.childElementCount);
7146
- if (isExpanded) {
7147
- body.classList.remove('cl-expanded');
7148
- body.classList.add('cl-collapsed');
7149
- headerIcon.classList.add('cl-collapsed');
7150
- if (typeof _cl_setCardUiState === 'function') {
7151
- _cl_setCardUiState(model, { stepsExpanded: false });
7152
- }
7153
- } else {
7154
- body.classList.remove('cl-collapsed');
7155
- body.classList.add('cl-expanded');
7156
- headerIcon.classList.remove('cl-collapsed');
7157
- if (typeof _cl_setCardUiState === 'function') {
7158
- _cl_setCardUiState(model, { stepsExpanded: true });
7159
- }
7160
- }
7161
- });
7162
-
7163
- stepsSection.appendChild(header);
7164
- stepsSection.appendChild(body);
7165
- content.appendChild(stepsSection);
8143
+ // ── Agent 详情卡片(Figma 346:181) ──
8144
+ try {
8145
+ var detailCard = _clCreateAgentDetailCard(model);
8146
+ content.appendChild(detailCard);
8147
+ } catch(e) {
8148
+ console.warn('[cl-exec] detail card creation failed:', e);
8149
+ }
8150
+
8151
+ // ── 进度文字(Figma 346:253) — 动态读取 response.progress?.safe_status_message ──
8152
+ var progressRow = document.createElement('div');
8153
+ progressRow.className = 'cl-exec-progress-row';
8154
+ var progressText = document.createElement('p');
8155
+ progressText.className = 'cl-exec-progress-text';
8156
+ progressText.textContent = (model.progressMessage || model.rawText || '').trim() || '思考中,正在了解你的需求';
8157
+ progressRow.appendChild(progressText);
8158
+ // 箭头图标
8159
+ var arrowIcon = document.createElement('span');
8160
+ arrowIcon.className = 'cl-exec-progress-arrow';
8161
+ 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>';
8162
+ progressRow.appendChild(arrowIcon);
8163
+ content.appendChild(progressRow);
8164
+ if (model.status === 'completed') progressRow.style.display = 'none';
7166
8165
 
7167
8166
  // ── 异步更新真实 Agent 身份 ──
7168
8167
  if ((model.agentId || model.agentName) && typeof fetchAgentById === 'function') {
7169
8168
  fetchAgentById(model.agentId, model.agentName).then(function(agent) {
7170
8169
  if (!agent) return;
7171
- var pa = container.querySelector('.cl-agent-pill-avatar');
7172
- var pn = container.querySelector('.cl-agent-pill-name');
7173
- if (pa && typeof avatarUrl === 'function') {
7174
- var resolvedAvatar = avatarUrl(agent);
7175
- console.log('[cl-diag][pill] fetch-update agentId=' + JSON.stringify(model.agentId)
7176
- + ' name=' + JSON.stringify(agent.name || model.agentName)
7177
- + ' src=' + JSON.stringify(resolvedAvatar));
7178
- pa.src = resolvedAvatar;
7179
- pa.style.display = '';
7180
- }
7181
- _clSetAgentPillName(container, agent.name || model.agentName);
8170
+ var avatarEl = container.querySelector('.cl-exec-agent-avatar');
8171
+ var nameEl = container.querySelector('.cl-exec-agent-name');
8172
+ var bioEl = container.querySelector('.cl-exec-agent-bio');
8173
+ var agentBio = _clGetAgentDescriptionText(agent);
8174
+ // avatar 保持 icon.png,不覆盖
8175
+ if (nameEl) nameEl.textContent = agent.name || model.agentName;
8176
+ if (bioEl && agentBio) bioEl.textContent = agentBio;
8177
+ var starsEl = container.querySelector('.cl-exec-star-count');
8178
+ if (starsEl && agent.claws) starsEl.textContent = _cl_formatStarCount(agent.claws);
8179
+ if (starsEl && agent.stars && !agent.claws) starsEl.textContent = _cl_formatStarCount(agent.stars);
7182
8180
  _clSetOpenAgentHeaderAgent(container, agent.name || model.agentName);
7183
8181
  }).catch(function() {});
7184
8182
  }
@@ -7187,40 +8185,137 @@ function _clRenderExecutionCard(model) {
7187
8185
  _cl_applyCardUiState(container, model);
7188
8186
  }
7189
8187
 
7190
- console.log('[cl-exec] execution card built: steps=' + steps.length);
8188
+ console.log('[cl-exec] execution card built');
7191
8189
  return container;
7192
8190
  }
7193
8191
 
7194
- // ── 共用 DOM 构建函数 ──
8192
+ function _clGetAgentDescriptionText(model) {
8193
+ if (typeof _clPickAgentDescription === 'function') {
8194
+ var direct = _clPickAgentDescription(model || {});
8195
+ if (direct) return direct;
8196
+ if (model && typeof CL !== 'undefined' && CL && typeof CL.getAgentIdentity === 'function') {
8197
+ var identity = CL.getAgentIdentity(
8198
+ model.agentId || model.agent_id || model.id || model.tag,
8199
+ model.agentName || model.agent_name || model.name
8200
+ );
8201
+ var identityBio = _clPickAgentDescription(identity || {});
8202
+ if (identityBio) return identityBio;
8203
+ }
8204
+ return '';
8205
+ }
8206
+ if (!model) return '';
8207
+ return model.agentBio || model.bio || model.description || model.desc || model.agentDescription || model.agent_description || model.MOM || '';
8208
+ }
7195
8209
 
7196
- function _clCreateOpenAgentHeader(model) {
7197
- var header = document.createElement('div');
7198
- header.className = 'cl-openagent-header';
7199
- header.style.cursor = 'pointer';
8210
+ function _clSyncOutputFooterVisibility(card, isCollapsed) {
8211
+ if (!card || !card.querySelector || !card.querySelector('.cl-openagent-header--output')) return;
8212
+ var footers = card.querySelectorAll('.cl-output-footer');
8213
+ for (var i = 0; i < footers.length; i++) {
8214
+ footers[i].style.display = isCollapsed ? 'none' : '';
8215
+ }
8216
+ }
8217
+
8218
+ function _clGetAgentStatusText(status) {
8219
+ if (status === 'completed') return '执行已完成';
8220
+ if (status === 'failed' || status === 'error') return '执行失败';
8221
+ return '正在执行任务';
8222
+ }
7200
8223
 
7201
- var caret = document.createElement('span');
7202
- caret.className = 'cl-openagent-header-caret';
7203
- caret.textContent = '▼';
7204
- header.appendChild(caret);
8224
+ function _clIsAgentTerminalStatus(status) {
8225
+ return status === 'completed' || status === 'failed' || status === 'error';
8226
+ }
8227
+
8228
+ // ── Agent 详情卡片(Figma 266:11136) ──
8229
+ function _clCreateAgentDetailCard(model) {
8230
+ var card = document.createElement('div');
8231
+ card.className = 'cl-exec-detail-card';
8232
+
8233
+ var row = document.createElement('div');
8234
+ row.className = 'cl-exec-detail-row';
7205
8235
 
7206
- var icon = document.createElement('span');
7207
- icon.className = 'cl-openagent-header-icon';
7208
- icon.setAttribute('aria-hidden', 'true');
7209
- header.appendChild(icon);
8236
+ // 头像 68×68
8237
+ var avatar = document.createElement('img');
8238
+ avatar.className = 'cl-exec-agent-avatar';
8239
+ avatar.alt = model.agentName || '';
8240
+ avatar.src = './icon.png';
8241
+ avatar.onerror = function() { this.style.visibility = 'hidden'; };
8242
+ row.appendChild(avatar);
8243
+
8244
+ // 信息列
8245
+ var info = document.createElement('div');
8246
+ info.className = 'cl-exec-detail-info';
8247
+
8248
+ // 名称行:名称 + 星级徽章
8249
+ var nameRow = document.createElement('div');
8250
+ nameRow.className = 'cl-exec-name-row';
8251
+
8252
+ var nameEl = document.createElement('p');
8253
+ nameEl.className = 'cl-exec-agent-name';
8254
+ nameEl.textContent = model.agentName || 'Remote Agent';
8255
+ nameRow.appendChild(nameEl);
8256
+
8257
+ // 星级徽章
8258
+ var starBadge = document.createElement('div');
8259
+ starBadge.className = 'cl-exec-star-badge';
8260
+ var starSvgOutline = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none"><path d="M6.46401 1.8327C6.66621 1.36177 7.33396 1.36174 7.53612 1.8327L8.82412 4.83481L12.0718 5.1373C12.5808 5.18469 12.7873 5.8177 12.4039 6.15586L9.95148 8.31772L10.6687 11.5101C10.7809 12.0098 10.2404 12.4012 9.80052 12.139L7.00006 10.4699L4.19904 12.139C3.75913 12.4012 3.21924 12.0098 3.33145 11.5101L4.04808 8.31772L1.59626 6.15586C1.21282 5.81777 1.4189 5.18488 1.9278 5.1373L5.17601 4.83481L6.46401 1.8327ZM5.89435 5.8226L3.10073 6.08237L5.20905 7.94118L4.59325 10.6818L7.00006 9.24798L9.40575 10.6818L8.79108 7.94118L10.8983 6.08237L8.10521 5.8226L6.9995 3.24603L5.89435 5.8226Z" fill="#555555"/></svg>';
8261
+ starBadge.innerHTML = starSvgOutline +
8262
+ '<span class="cl-exec-star-count">' + (model.agentStars || '3.2万') + '</span>';
8263
+ nameRow.appendChild(starBadge);
8264
+ info.appendChild(nameRow);
8265
+
8266
+ var bioEl = document.createElement('p');
8267
+ bioEl.className = 'cl-exec-agent-bio';
8268
+ bioEl.textContent = _clGetAgentDescriptionText(model);
8269
+ info.appendChild(bioEl);
8270
+
8271
+ row.appendChild(info);
8272
+ card.appendChild(row);
7210
8273
 
7211
- var title = document.createElement('div');
7212
- title.className = 'cl-openagent-header-title';
8274
+ return card;
8275
+ }
7213
8276
 
7214
- var primary = document.createElement('span');
7215
- primary.className = 'cl-openagent-header-primary';
7216
- primary.textContent = 'OpenAgent @' + (model.agentName || 'Remote Agent');
7217
- title.appendChild(primary);
8277
+ // ── 共用 DOM 构建函数 ──
7218
8278
 
7219
- var secondary = document.createElement('span');
7220
- secondary.className = 'cl-openagent-header-secondary';
7221
- title.appendChild(secondary);
8279
+ function _clCreateOpenAgentHeader(model) {
8280
+ var header = document.createElement('div');
8281
+ header.className = 'cl-openagent-header';
8282
+ if (model._outputMode) header.classList.add('cl-openagent-header--output');
8283
+ header.style.cursor = 'pointer';
7222
8284
 
7223
- header.appendChild(title);
8285
+ // 展开/收起图标
8286
+ var expandIcon = document.createElement('span');
8287
+ expandIcon.className = 'cl-openagent-expand-icon';
8288
+ // 收起态三角(向右)
8289
+ 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>';
8290
+ // 展开态三角(向下)
8291
+ 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>';
8292
+ header.appendChild(expandIcon);
8293
+
8294
+ // OASN 小图标
8295
+ var oasnBadge = document.createElement('span');
8296
+ oasnBadge.className = 'cl-openagent-badge';
8297
+ header.appendChild(oasnBadge);
8298
+
8299
+ // 文字行
8300
+ var textRow = document.createElement('span');
8301
+ textRow.className = 'cl-openagent-text-row';
8302
+
8303
+ var labelOpenAgent = document.createElement('span');
8304
+ labelOpenAgent.className = 'cl-openagent-label';
8305
+ labelOpenAgent.textContent = 'OpenAgent';
8306
+ textRow.appendChild(labelOpenAgent);
8307
+
8308
+ var labelAgent = document.createElement('span');
8309
+ labelAgent.className = 'cl-openagent-agent';
8310
+ labelAgent.textContent = '@' + (model.agentName || 'Remote Agent');
8311
+ textRow.appendChild(labelAgent);
8312
+
8313
+ var labelStatus = document.createElement('span');
8314
+ labelStatus.className = 'cl-openagent-status';
8315
+ labelStatus.textContent = _clGetAgentStatusText(model.status);
8316
+ textRow.appendChild(labelStatus);
8317
+
8318
+ header.appendChild(textRow);
7224
8319
 
7225
8320
  // 点击 header 折叠/展开卡片内容
7226
8321
  header.addEventListener('click', function(e) {
@@ -7230,7 +8325,11 @@ function _clCreateOpenAgentHeader(model) {
7230
8325
  var content = card.querySelector('.cl-thought-chain-content');
7231
8326
  if (!content) return;
7232
8327
  var isCollapsed = content.classList.toggle('cl-content-collapsed');
7233
- caret.textContent = isCollapsed ? '▶' : '▼';
8328
+ _clSyncOutputFooterVisibility(card, isCollapsed);
8329
+ // 切换图标
8330
+ expandIcon.innerHTML = isCollapsed
8331
+ ? '<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>'
8332
+ : '<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>';
7234
8333
  if (typeof _cl_setCardUiState === 'function') {
7235
8334
  _cl_setCardUiState(model, { contentCollapsed: isCollapsed });
7236
8335
  }
@@ -7240,8 +8339,8 @@ function _clCreateOpenAgentHeader(model) {
7240
8339
  }
7241
8340
 
7242
8341
  function _clSetOpenAgentHeaderAgent(container, agentName) {
7243
- var title = container && container.querySelector('.cl-openagent-header-primary');
7244
- if (title) title.textContent = 'OpenAgent @' + (agentName || 'Remote Agent');
8342
+ var label = container && container.querySelector('.cl-openagent-agent');
8343
+ if (label) label.textContent = '@' + (agentName || 'Remote Agent');
7245
8344
  }
7246
8345
 
7247
8346
  function _clCreateAgentPill(agentName, agentId, agentAvatar) {
@@ -7263,7 +8362,7 @@ function _clCreateAgentPill(agentName, agentId, agentAvatar) {
7263
8362
  console.log('[cl-diag][pill] create agentName=' + JSON.stringify(agentName || '')
7264
8363
  + ' agentId=' + JSON.stringify(agentId || '')
7265
8364
  + ' src=' + JSON.stringify(avatar.getAttribute('src')));
7266
- avatar.onerror = function() { this.style.display = 'none'; };
8365
+ avatar.onerror = function() { this.style.visibility = 'hidden'; };
7267
8366
  pill.appendChild(avatar);
7268
8367
 
7269
8368
  var nameEl = document.createElement('span');
@@ -7322,6 +8421,226 @@ function _clCreateStepElement(step, isLatest) {
7322
8421
  return item;
7323
8422
  }
7324
8423
 
8424
+
8425
+ // ── 动态更新 header 状态文字 ──
8426
+ function _clUpdateAgentStatusText(cardNode, status) {
8427
+ var label = cardNode && cardNode.querySelector('.cl-openagent-status');
8428
+ if (label) label.textContent = _clGetAgentStatusText(status);
8429
+ var progressRow = cardNode && cardNode.querySelector('.cl-exec-progress-row');
8430
+ if (progressRow) progressRow.style.display = _clIsAgentTerminalStatus(status) ? 'none' : '';
8431
+ }
8432
+
8433
+ function _cl_formatStarCount(count) {
8434
+ var n = Number(count);
8435
+ if (!isFinite(n)) return '3.2万';
8436
+ if (n >= 10000) return (n / 10000).toFixed(1).replace(/.0$/, '') + '万';
8437
+ if (n >= 1000) return (n / 1000).toFixed(1).replace(/.0$/, '') + 'k';
8438
+ return String(Math.floor(n));
8439
+ }
8440
+
8441
+ // ═══════════════════════════════════════════════════════════════
8442
+ // V2 执行卡片渲染(2026.6.9+ 新版 UI)
8443
+ // ═══════════════════════════════════════════════════════════════
8444
+
8445
+ function _clRenderExecutionCardV2(model) {
8446
+ var container = document.createElement('div');
8447
+ container.className = 'cl-remote-agent-card cl-thought-chain cl-exec-v2';
8448
+ if (CL && typeof CL.diagMarkCard === 'function') {
8449
+ CL.diagMarkCard(container, 'execution', { tcid: model.toolCallId || '' });
8450
+ }
8451
+
8452
+ container.appendChild(_clCreateOpenAgentHeaderV2(model));
8453
+
8454
+ var content = document.createElement('div');
8455
+ content.className = 'cl-thought-chain-content cl-thought-chain-content--execution cl-content-collapsed';
8456
+ container.appendChild(content);
8457
+
8458
+ // ── Agent 详情卡片 V2 ──
8459
+ try {
8460
+ var detailCard = _clCreateAgentDetailCardV2(model);
8461
+ content.appendChild(detailCard);
8462
+ } catch(e) {
8463
+ console.warn('[cl-exec-v2] detail card creation failed:', e);
8464
+ }
8465
+
8466
+ // ── 进度文字 V2 ──
8467
+ var progressRow = document.createElement('div');
8468
+ progressRow.className = 'cl-exec-progress-row cl-exec-progress-row-v2';
8469
+ var progressText = document.createElement('p');
8470
+ progressText.className = 'cl-exec-progress-text';
8471
+ progressText.textContent = (model.progressMessage || model.rawText || '').trim() || '思考中,正在了解你的需求';
8472
+ progressRow.appendChild(progressText);
8473
+ var arrowIcon = document.createElement('span');
8474
+ arrowIcon.className = 'cl-exec-progress-arrow';
8475
+ 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>';
8476
+ progressRow.appendChild(arrowIcon);
8477
+ content.appendChild(progressRow);
8478
+ if (model.status === 'completed') progressRow.style.display = 'none';
8479
+
8480
+ // ── 步骤列表容器(供 _cl_updateCardSteps 使用)──
8481
+ var stepsHeader = document.createElement('div');
8482
+ stepsHeader.className = 'cl-tools-collapse-header cl-tools-collapse-header-v2';
8483
+ var stepsHeaderIcon = document.createElement('span');
8484
+ stepsHeaderIcon.className = 'cl-tools-collapse-header-icon';
8485
+ stepsHeaderIcon.textContent = '▼';
8486
+ stepsHeader.appendChild(stepsHeaderIcon);
8487
+ var stepsHeaderTitle = document.createElement('span');
8488
+ stepsHeaderTitle.className = 'cl-tools-collapse-header-title cl-tools-collapse-header-title-v2';
8489
+ stepsHeaderTitle.textContent = '思考中...';
8490
+ stepsHeader.appendChild(stepsHeaderTitle);
8491
+ content.appendChild(stepsHeader);
8492
+
8493
+ var stepsBody = document.createElement('div');
8494
+ stepsBody.className = 'cl-tools-collapse-body cl-tools-collapse-body-v2 cl-expanded';
8495
+ content.appendChild(stepsBody);
8496
+
8497
+ // ─ Footer(Figma: -由xxx完成 + 星级)──
8498
+ var footer = document.createElement('div');
8499
+ footer.className = 'cl-output-footer cl-output-footer-v2';
8500
+ footer.innerHTML = '<span class="cl-output-footer-text">-由' + (model.agentName || 'Remote Agent') + '完成</span>'
8501
+ + '<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>'
8502
+ + '<span class="cl-output-footer-count">' + (model.agentStars || '3.2万') + '</span>';
8503
+ container.appendChild(footer);
8504
+
8505
+ // ── 异步更新真实 Agent 身份 ──
8506
+ if ((model.agentId || model.agentName) && typeof fetchAgentById === 'function') {
8507
+ fetchAgentById(model.agentId, model.agentName).then(function(agent) {
8508
+ if (!agent) return;
8509
+ var avatarEl = container.querySelector('.cl-exec-agent-avatar-v2');
8510
+ var nameEl = container.querySelector('.cl-exec-agent-name-v2');
8511
+ var bioEl = container.querySelector('.cl-exec-agent-bio-v2');
8512
+ var agentBio = _clGetAgentDescriptionText(agent);
8513
+ if (nameEl) nameEl.textContent = agent.name || model.agentName;
8514
+ if (bioEl && agentBio) bioEl.textContent = agentBio;
8515
+ var starsEl = container.querySelector('.cl-exec-star-count-v2');
8516
+ if (starsEl && agent.claws) starsEl.textContent = _cl_formatStarCount(agent.claws);
8517
+ if (starsEl && agent.stars && !agent.claws) starsEl.textContent = _cl_formatStarCount(agent.stars);
8518
+ }).catch(function() {});
8519
+ }
8520
+
8521
+ if (typeof _cl_applyCardUiState === 'function') {
8522
+ _cl_applyCardUiState(container, model);
8523
+ }
8524
+
8525
+ console.log('[cl-exec-v2] execution card built');
8526
+ return container;
8527
+ }
8528
+
8529
+ // ── V2 Header(粉色背景 + 圆形头像 + 无 @agentName)──
8530
+ function _clCreateOpenAgentHeaderV2(model) {
8531
+ var header = document.createElement('div');
8532
+ header.className = 'cl-openagent-header cl-openagent-header-v2';
8533
+ if (model._outputMode) header.classList.add('cl-openagent-header--output');
8534
+ header.style.cursor = 'pointer';
8535
+
8536
+ // 展开/收起图标
8537
+ var expandIcon = document.createElement('span');
8538
+ expandIcon.className = 'cl-openagent-expand-icon';
8539
+ 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>';
8540
+ 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>';
8541
+ header.appendChild(expandIcon);
8542
+
8543
+ // 圆形灰色头像(替代小徽章)
8544
+ var avatar = document.createElement('span');
8545
+ avatar.className = 'cl-openagent-avatar-v2';
8546
+ header.appendChild(avatar);
8547
+
8548
+ // 文字行:OpenAgent + 状态文字(去掉 @agentName)
8549
+ var textRow = document.createElement('span');
8550
+ textRow.className = 'cl-openagent-text-row';
8551
+
8552
+ var labelOpenAgent = document.createElement('span');
8553
+ labelOpenAgent.className = 'cl-openagent-label';
8554
+ labelOpenAgent.textContent = 'OpenAgent';
8555
+ textRow.appendChild(labelOpenAgent);
8556
+
8557
+ var labelStatus = document.createElement('span');
8558
+ labelStatus.className = 'cl-openagent-status';
8559
+ labelStatus.textContent = _clGetAgentStatusText(model.status);
8560
+ textRow.appendChild(labelStatus);
8561
+
8562
+ header.appendChild(textRow);
8563
+
8564
+ // 点击 header 折叠/展开卡片内容
8565
+ header.addEventListener('click', function(e) {
8566
+ e.stopPropagation();
8567
+ var card = header.closest('.cl-remote-agent-card');
8568
+ if (!card) return;
8569
+ var content = card.querySelector('.cl-thought-chain-content');
8570
+ if (!content) return;
8571
+ var isCollapsed = content.classList.toggle('cl-content-collapsed');
8572
+ _clSyncOutputFooterVisibility(card, isCollapsed);
8573
+ expandIcon.innerHTML = isCollapsed
8574
+ ? '<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>'
8575
+ : expandedSvg;
8576
+ if (typeof _cl_setCardUiState === 'function') {
8577
+ _cl_setCardUiState(model, { contentCollapsed: isCollapsed });
8578
+ }
8579
+ });
8580
+
8581
+ return header;
8582
+ }
8583
+
8584
+ // ─ V2 Agent 详情卡片(大头像 + 右置星级 + 网格点背景)──
8585
+ function _clCreateAgentDetailCardV2(model) {
8586
+ var card = document.createElement('div');
8587
+ card.className = 'cl-exec-detail-card cl-exec-detail-card-v2';
8588
+
8589
+ var row = document.createElement('div');
8590
+ row.className = 'cl-exec-detail-row cl-exec-detail-row-v2';
8591
+
8592
+ // 大头像 80×80
8593
+ var avatar = document.createElement('img');
8594
+ avatar.className = 'cl-exec-agent-avatar cl-exec-agent-avatar-v2';
8595
+ avatar.alt = model.agentName || '';
8596
+ avatar.src = './icon.png';
8597
+ avatar.onerror = function() { this.style.visibility = 'hidden'; };
8598
+ row.appendChild(avatar);
8599
+
8600
+ // 信息列
8601
+ var info = document.createElement('div');
8602
+ info.className = 'cl-exec-detail-info cl-exec-detail-info-v2';
8603
+
8604
+ // 名称(无星级徽章,星级右置到卡片右上角)
8605
+ var nameEl = document.createElement('p');
8606
+ nameEl.className = 'cl-exec-agent-name cl-exec-agent-name-v2';
8607
+ nameEl.textContent = model.agentName || 'Remote Agent';
8608
+ info.appendChild(nameEl);
8609
+
8610
+ // 描述文字
8611
+ var bioEl = document.createElement('p');
8612
+ bioEl.className = 'cl-exec-agent-bio cl-exec-agent-bio-v2';
8613
+ bioEl.textContent = _clGetAgentDescriptionText(model);
8614
+ info.appendChild(bioEl);
8615
+
8616
+ row.appendChild(info);
8617
+ card.appendChild(row);
8618
+
8619
+ // 星级徽章右置到卡片右上角
8620
+ var starBadge = document.createElement('div');
8621
+ starBadge.className = 'cl-exec-star-badge cl-exec-star-badge-v2';
8622
+ var starSvgOutline = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none"><path d="M6.46401 1.8327C6.66621 1.36177 7.33396 1.36174 7.53612 1.8327L8.82412 4.83481L12.0718 5.1373C12.5808 5.18469 12.7873 5.8177 12.4039 6.15586L9.95148 8.31772L10.6687 11.5101C10.7809 12.0098 10.2404 12.4012 9.80052 12.139L7.00006 10.4699L4.19904 12.139C3.75913 12.4012 3.21924 12.0098 3.33145 11.5101L4.04808 8.31772L1.59626 6.15586C1.21282 5.81777 1.4189 5.18488 1.9278 5.1373L5.17601 4.83481L6.46401 1.8327ZM5.89435 5.8226L3.10073 6.08237L5.20905 7.94118L4.59325 10.6818L7.00006 9.24798L9.40575 10.6818L8.79108 7.94118L10.8983 6.08237L8.10521 5.8226L6.9995 3.24603L5.89435 5.8226Z" fill="#555555"/></svg>';
8623
+ starBadge.innerHTML = starSvgOutline +
8624
+ '<span class="cl-exec-star-count cl-exec-star-count-v2">' + (model.agentStars || '3.2万') + '</span>';
8625
+ card.appendChild(starBadge);
8626
+
8627
+ return card;
8628
+ }
8629
+
8630
+ // ── V2 状态文字更新 ──
8631
+ function _clUpdateAgentStatusTextV2(cardNode, status) {
8632
+ var label = cardNode && cardNode.querySelector('.cl-openagent-status');
8633
+ if (label) label.textContent = _clGetAgentStatusText(status);
8634
+ // 进度文字行:完成后隐藏
8635
+ var progressRow = cardNode && cardNode.querySelector('.cl-exec-progress-row-v2');
8636
+ if (progressRow) progressRow.style.display = _clIsAgentTerminalStatus(status) ? 'none' : '';
8637
+ // 步骤列表:完成后隐藏
8638
+ var stepsBody = cardNode && cardNode.querySelector('.cl-tools-collapse-body-v2');
8639
+ if (stepsBody) stepsBody.style.display = _clIsAgentTerminalStatus(status) ? 'none' : '';
8640
+ var stepsHeader = cardNode && cardNode.querySelector('.cl-tools-collapse-header-v2');
8641
+ if (stepsHeader) stepsHeader.style.display = _clIsAgentTerminalStatus(status) ? 'none' : '';
8642
+ }
8643
+
7325
8644
  // ════════════════════════════════════════════════════════════════
7326
8645
  // MODULE: remote-agent/markdown-renderer.js
7327
8646
  // ════════════════════════════════════════════════════════════════
@@ -7776,14 +9095,26 @@ function _clRenderOutputCard(model, onOpenSidebar) {
7776
9095
  ? _clStripOpenagentMediaLines(chunk.text)
7777
9096
  : chunk.text;
7778
9097
  if (_clShouldRenderOutputText(textChunk)) resultTexts.push(textChunk);
9098
+ } else if (chunk.type === 'error') {
9099
+ var errorText = chunk.text || model.rawText || '远端 Agent 调用失败';
9100
+ if (_clShouldRenderOutputText(errorText)) resultTexts.push(errorText);
7779
9101
  }
7780
9102
  }
7781
9103
 
9104
+ // ── V2 版本判断 ──
9105
+ var isV2 = typeof _clIsHostVersionGte === 'function' && _clIsHostVersionGte('2026.6.9');
9106
+
7782
9107
  if (resultTexts.length === 0 && mediaLinks.length === 0) {
7783
9108
  var placeholder = document.createElement('span');
7784
9109
  placeholder.className = 'cl-remote-agent-card cl-remote-agent-output-placeholder';
7785
9110
  placeholder.style.display = 'none';
7786
9111
  placeholder.__clEmptyOutput = true;
9112
+ // 防止 OpenClaw native 代码读 .textContent 报 undefined.trim()
9113
+ var hiddenText = document.createElement('span');
9114
+ hiddenText.className = 'chat-text';
9115
+ hiddenText.style.display = 'none';
9116
+ hiddenText.textContent = '';
9117
+ placeholder.appendChild(hiddenText);
7787
9118
  if (model.toolCallId) {
7788
9119
  placeholder.dataset.clCardTcid = model.toolCallId;
7789
9120
  }
@@ -7792,34 +9123,54 @@ function _clRenderOutputCard(model, onOpenSidebar) {
7792
9123
  }
7793
9124
 
7794
9125
  var container = document.createElement('div');
7795
- container.className = 'cl-remote-agent-card cl-thought-chain cl-output-card'
9126
+ var cardClasses = 'cl-remote-agent-card cl-thought-chain cl-output-card'
7796
9127
  + (resultTexts.length > 0 ? ' cl-output-card--pending' : '');
9128
+ if (isV2) cardClasses += ' cl-exec-v2';
9129
+ container.className = cardClasses;
7797
9130
  container.dataset.clCardRole = 'output';
9131
+ // 防止 OpenClaw native 代码读 .textContent 报 undefined.trim()
9132
+ var safetyText = document.createElement('div');
9133
+ safetyText.className = 'chat-text';
9134
+ safetyText.style.display = 'none';
9135
+ safetyText.textContent = '';
9136
+ container.appendChild(safetyText);
9137
+ if (model.toolCallId) container.dataset.clCardTcid = model.toolCallId;
9138
+ // 阻止点击冒泡到原生 tool card handler
9139
+ container.addEventListener('click', function(e) { e.stopPropagation(); });
7798
9140
  if (CL && typeof CL.diagMarkCard === 'function') {
7799
9141
  CL.diagMarkCard(container, 'output', { tcid: model.toolCallId || '' });
7800
9142
  }
7801
9143
 
7802
- var shellHeader = _clCreateOpenAgentHeader(model);
7803
- container.appendChild(shellHeader);
7804
- if (typeof _clSetOpenAgentHeaderAgent === 'function') {
7805
- _clSetOpenAgentHeaderAgent(container, model.agentName || model.agentId || 'Remote Agent');
9144
+ model._outputMode = true;
9145
+ model.status = model.isError ? 'failed' : 'completed';
9146
+ if (isV2) {
9147
+ var v2Header = _clCreateOpenAgentHeaderV2(model);
9148
+ v2Header.classList.remove('cl-openagent-header--output');
9149
+ container.appendChild(v2Header);
9150
+ if (typeof _clUpdateAgentStatusTextV2 === 'function') {
9151
+ _clUpdateAgentStatusTextV2(container, model.status);
9152
+ }
9153
+ } else {
9154
+ var shellHeader = _clCreateOpenAgentHeader(model);
9155
+ container.appendChild(shellHeader);
9156
+ if (typeof _clSetOpenAgentHeaderAgent === 'function') {
9157
+ _clSetOpenAgentHeaderAgent(container, model.agentName || model.agentId || 'Remote Agent');
9158
+ }
7806
9159
  }
7807
9160
 
7808
9161
  var content = document.createElement('div');
7809
9162
  content.className = 'cl-thought-chain-content';
7810
9163
  container.appendChild(content);
7811
9164
 
7812
- // ── Agent Pill ──
7813
- var pillSlot = document.createElement('div');
7814
- pillSlot.className = 'cl-thought-chain-pill-slot';
7815
- var pill = _clCreateAgentPill(model.agentName, model.agentId, model.agentAvatar);
7816
- pillSlot.appendChild(pill);
7817
- content.appendChild(pillSlot);
7818
-
7819
- // ── 分隔线 ──
7820
- var divider = document.createElement('div');
7821
- divider.className = 'cl-thought-chain-divider';
7822
- content.appendChild(divider);
9165
+ // ── V2 Agent 详情卡片 ──
9166
+ if (isV2) {
9167
+ try {
9168
+ var detailCard = _clCreateAgentDetailCardV2(model);
9169
+ content.appendChild(detailCard);
9170
+ } catch(e) {
9171
+ console.warn('[cl-output-v2] detail card creation failed:', e);
9172
+ }
9173
+ }
7823
9174
 
7824
9175
  // ── 附件下载链接 ──
7825
9176
  if (mediaLinks.length > 0 && typeof _clCreateOpenagentMediaLinksSection === 'function') {
@@ -7864,12 +9215,23 @@ function _clRenderOutputCard(model, onOpenSidebar) {
7864
9215
  }
7865
9216
 
7866
9217
  // ── onOpenSidebar 支持:点击展开到侧边栏 ──
7867
- if (onOpenSidebar && model.rawText) {
9218
+ // 宿主 sidebar 渲染器要求 content 为 { kind: 'markdown', content, rawText } 对象,
9219
+ // kind 必须为 'markdown' 才会进入 markdown 渲染路径,否则显示 "No previewable markdown content."。
9220
+ // travel card 标签(<sh_card>等)sidebar 原生 markdown 解析不认,先 strip 再传。
9221
+ var sidebarRaw = resultText || model.rawText || '';
9222
+ var sidebarText = String(sidebarRaw).replace(/<\/?[a-z]+_card[^>]*>/gi, '');
9223
+ if (typeof _clStripSuppressedTravelTags === 'function') {
9224
+ sidebarText = _clStripSuppressedTravelTags(sidebarText);
9225
+ }
9226
+ if (onOpenSidebar && sidebarText.trim()) {
7868
9227
  container.style.cursor = 'pointer';
7869
9228
  container.addEventListener('click', function(e) {
7870
- // 不拦截折叠/展开点击
7871
9229
  if (e.target.closest('.cl-tools-collapse-header')) return;
7872
- onOpenSidebar(model.rawText);
9230
+ onOpenSidebar({ kind: 'markdown', content: sidebarText, rawText: sidebarText });
9231
+ setTimeout(function() {
9232
+ var titleEl = document.querySelector('.chat-sidebar .sidebar-title');
9233
+ if (titleEl) titleEl.textContent = 'OpenAgent @' + (model.agentName || 'Remote Agent');
9234
+ }, 100);
7873
9235
  });
7874
9236
  }
7875
9237
 
@@ -7877,26 +9239,47 @@ function _clRenderOutputCard(model, onOpenSidebar) {
7877
9239
  if ((model.agentId || model.agentName) && typeof fetchAgentById === 'function') {
7878
9240
  fetchAgentById(model.agentId, model.agentName).then(function(agent) {
7879
9241
  if (!agent) return;
7880
- var pa = container.querySelector('.cl-agent-pill-avatar');
7881
- var pn = container.querySelector('.cl-agent-pill-name');
7882
- if (pa && typeof avatarUrl === 'function') {
7883
- var resolvedAvatar = avatarUrl(agent);
7884
- console.log('[cl-diag][pill] fetch-update agentId=' + JSON.stringify(model.agentId)
7885
- + ' name=' + JSON.stringify(agent.name || model.agentName)
7886
- + ' src=' + JSON.stringify(resolvedAvatar));
7887
- pa.src = resolvedAvatar;
7888
- pa.style.display = '';
9242
+ if (isV2) {
9243
+ var avatarElV2 = container.querySelector('.cl-exec-agent-avatar-v2');
9244
+ var nameElV2 = container.querySelector('.cl-exec-agent-name-v2');
9245
+ var bioElV2 = container.querySelector('.cl-exec-agent-bio-v2');
9246
+ var agentBioV2 = typeof _clGetAgentDescriptionText === 'function'
9247
+ ? _clGetAgentDescriptionText(agent)
9248
+ : (agent.bio || agent.description || '');
9249
+ if (nameElV2) nameElV2.textContent = agent.name || model.agentName;
9250
+ if (bioElV2 && agentBioV2) bioElV2.textContent = agentBioV2;
9251
+ var starsElV2 = container.querySelector('.cl-exec-star-count-v2');
9252
+ if (starsElV2 && agent.claws) starsElV2.textContent = _cl_formatStarCount(agent.claws);
9253
+ if (starsElV2 && agent.stars && !agent.claws) starsElV2.textContent = _cl_formatStarCount(agent.stars);
9254
+ } else {
9255
+ _clSetOpenAgentHeaderAgent(container, agent.name || model.agentName);
7889
9256
  }
7890
- _clSetAgentPillName(container, agent.name || model.agentName);
7891
- _clSetOpenAgentHeaderAgent(container, agent.name || model.agentName);
7892
9257
  }).catch(function() {});
7893
9258
  }
7894
9259
 
9260
+ // ── Footer ──
9261
+ if (isV2) {
9262
+ var footerV2 = document.createElement('div');
9263
+ footerV2.className = 'cl-output-footer cl-output-footer-v2';
9264
+ footerV2.innerHTML = '<span class="cl-output-footer-text">-由' + (model.agentName || 'Remote Agent') + '完成</span>'
9265
+ + '<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>'
9266
+ + '<span class="cl-output-footer-count">' + (model.agentStars || '3.2万') + '</span>';
9267
+ container.appendChild(footerV2);
9268
+ } else {
9269
+ // ── Footer(Figma 131:2091) ──
9270
+ var footer = document.createElement('div');
9271
+ footer.className = 'cl-output-footer';
9272
+ footer.innerHTML = '<span class="cl-output-footer-text">-由' + (model.agentName || 'Remote Agent') + '完成</span>'
9273
+ + '<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>'
9274
+ + '<span class="cl-output-footer-count">' + (model.agentStars || '3.2万') + '</span>';
9275
+ container.appendChild(footer);
9276
+ }
9277
+
7895
9278
  if (typeof _cl_applyCardUiState === 'function') {
7896
9279
  _cl_applyCardUiState(container, model);
7897
9280
  }
7898
9281
 
7899
- console.log('[cl-output] ✅ output card built: results=' + resultTexts.length);
9282
+ console.log('[cl-output] ✅ output card built: results=' + resultTexts.length + ' v2=' + isV2);
7900
9283
  return container;
7901
9284
  }
7902
9285
 
@@ -8020,6 +9403,8 @@ function _clScheduleOutputCardProcessing(resultSection, model) {
8020
9403
  setTimeout(run, 0);
8021
9404
  }
8022
9405
 
9406
+ // ── Sidebar Figma 145:5712 内联样式 ──
9407
+
8023
9408
  // ════════════════════════════════════════════════════════════════
8024
9409
  // MODULE: remote-agent/render-hooks.js
8025
9410
  // ════════════════════════════════════════════════════════════════
@@ -8039,8 +9424,14 @@ var __cl_toolStates = new Map();
8039
9424
  // 每个 entry: { steps: [], phase: 'active'|'completed', cardNode: null, args: {} }
8040
9425
 
8041
9426
  var __cl_lastCallModel = null; // 同一 render cycle 里 call card 的 model(供 result card 读取 agent 身份)
8042
- var __cl_outputCardCache = new Map(); // toolCallId → cached output DOM
8043
- var __cl_cardUiStates = new Map(); // execution/output 展开状态,避免 OpenClaw rerender 覆盖用户操作
9427
+ var __cl_outputCardCache = new Map(); // toolCallId → cached output DOM
9428
+ var __cl_executionCardCache = new Map(); // toolCallId cached historical execution DOM
9429
+ var __cl_cardUiStates = new Map(); // execution/output 展开状态,避免 OpenClaw rerender 覆盖用户操作
9430
+ var __cl_progressMessageMap = new Map(); // toolCallId → 动态进度文字(来自 response.progress?.safe_status_message)
9431
+
9432
+ // ── 诊断:渲染频率计数器 ──
9433
+ var __clDiag = { renderCalls: 0, lastDiagTs: 0, version: 'v4-oneshot-20260630' };
9434
+ console.log('[cl-diag] render-hooks loaded, version=' + __clDiag.version);
8044
9435
 
8045
9436
  var CL_REMOTE_AGENT_PROGRESS_MODE_TRAVEL_TITLE = 'travel-title';
8046
9437
  var CL_REMOTE_AGENT_PROGRESS_MODE_GENERIC_STREAM = 'generic-stream';
@@ -8336,6 +9727,16 @@ function _cl_ensureRemoteToolState(toolCallId, data, rawText) {
8336
9727
  // ═══════════════════════════════════════════════════════════════
8337
9728
 
8338
9729
  window.__openagentRenderToolCard = function(card, onOpenSidebar) {
9730
+ // ── 诊断:渲染频率计数器 ──
9731
+ __clDiag.renderCalls++;
9732
+ var diagNow = Date.now();
9733
+ if (diagNow - __clDiag.lastDiagTs > 2000) {
9734
+ var rps = (__clDiag.renderCalls / ((diagNow - __clDiag.lastDiagTs) / 1000)).toFixed(1);
9735
+ console.log('[cl-diag] render rate: ' + rps + ' calls/sec, total=' + __clDiag.renderCalls + ', version=' + __clDiag.version);
9736
+ __clDiag.renderCalls = 0;
9737
+ __clDiag.lastDiagTs = diagNow;
9738
+ }
9739
+
8339
9740
  var n = (card && card.name || '').toLowerCase();
8340
9741
  var cardTcid = card && (card.toolCallId || '');
8341
9742
  var cardKind = typeof _clInferToolCardKind === 'function' ? _clInferToolCardKind(card) : (card && card.kind || '');
@@ -8373,19 +9774,34 @@ window.__openagentRenderToolCard = function(card, onOpenSidebar) {
8373
9774
  }
8374
9775
  if (state.phase === 'active') {
8375
9776
  model.status = 'executing';
9777
+ if (typeof _clUpdateAgentStatusTextV2 === 'function' && state.cardNode && state.cardNode.classList.contains('cl-exec-v2')) {
9778
+ _clUpdateAgentStatusTextV2(state.cardNode, 'executing');
9779
+ } else if (typeof _clUpdateAgentStatusText === 'function') {
9780
+ _clUpdateAgentStatusText(state.cardNode, 'executing');
9781
+ }
8376
9782
  }
8377
9783
  // 有 streaming 状态 — 复用或新建
8378
9784
  if (state.cardNode) {
8379
9785
  // Lit 重复调用会复用同一个 DOM 节点;但 OpenClaw 外层 native
8380
9786
  // <details> 可能被 rerender 成 closed。这里重新打开的是外层原生
8381
- // details,不影响卡片内部的“思考中/思考完成”折叠状态。
9787
+ // details,不影响卡片内部的”思考中/思考完成”折叠状态。
8382
9788
  _cl_applyCardUiState(state.cardNode, { toolCallId: tcid, cardKind: 'call' });
8383
9789
  if (state.phase === 'active') {
8384
9790
  _cl_autoOpenStepsIfUncontrolled(state.cardNode);
8385
9791
  }
8386
- _cl_forceOpenNativeToolDetails(state.cardNode, 'execution-cache', tcid);
8387
- if (typeof _cl_scheduleHostShellMark === 'function') _cl_scheduleHostShellMark(state.cardNode);
8388
- _cl_hideHostRawText(state.cardNode);
9792
+ // ── 更新进度文字:来自 response.progress?.safe_status_message ──
9793
+ var progressEl = state.cardNode.querySelector('.cl-exec-progress-text');
9794
+ if (progressEl && model.rawText) {
9795
+ var msg = (model.rawText || '').trim();
9796
+ if (msg) progressEl.textContent = msg;
9797
+ }
9798
+ // ── 一次性外壳初始化:首次渲染时打开 native details + 隐藏 raw text,之后永久跳过 ──
9799
+ if (!state.cardNode.__clShellReady) {
9800
+ state.cardNode.__clShellReady = true;
9801
+ _cl_forceOpenNativeToolDetails(state.cardNode, 'execution-cache', tcid);
9802
+ if (typeof _cl_scheduleHostShellMark === 'function') _cl_scheduleHostShellMark(state.cardNode);
9803
+ _cl_hideHostRawText(state.cardNode);
9804
+ }
8389
9805
  return state.cardNode;
8390
9806
  }
8391
9807
 
@@ -8423,6 +9839,20 @@ window.__openagentRenderToolCard = function(card, onOpenSidebar) {
8423
9839
 
8424
9840
  // 无状态 → 刷新/历史态。前端 store 如果有同一 toolCallId 的卡片快照,
8425
9841
  // 就用快照参数重建 steps;没有 store 时仍展示完成态外壳。
9842
+
9843
+ // 缓存:历史态 execution card 只创建一次,Lit 重复调用时复用(与 output card 逻辑一致)
9844
+ var cachedExecution = tcid ? __cl_executionCardCache.get(tcid) : null;
9845
+ if (cachedExecution && cachedExecution.isConnected) {
9846
+ _cl_applyCardUiState(cachedExecution, { toolCallId: tcid, cardKind: 'call' });
9847
+ if (!cachedExecution.__clShellReady) {
9848
+ cachedExecution.__clShellReady = true;
9849
+ _cl_forceOpenNativeToolDetails(cachedExecution, 'execution-history-cache', tcid);
9850
+ if (typeof _cl_scheduleHostShellMark === 'function') _cl_scheduleHostShellMark(cachedExecution);
9851
+ _cl_hideHostRawText(cachedExecution);
9852
+ }
9853
+ return cachedExecution;
9854
+ }
9855
+
8426
9856
  var storedCallRecord = tcid && typeof _clRemoteAgentProgressStore !== 'undefined' && _clRemoteAgentProgressStore
8427
9857
  ? _clRemoteAgentProgressStore.get(tcid)
8428
9858
  : null;
@@ -8439,10 +9869,16 @@ window.__openagentRenderToolCard = function(card, onOpenSidebar) {
8439
9869
  model.cardKind = 'call';
8440
9870
  model.status = 'completed';
8441
9871
  var historyNode = _clRenderExecutionCard(model);
9872
+ if (historyNode && historyNode.classList && historyNode.classList.contains('cl-exec-v2')) {
9873
+ if (typeof _clUpdateAgentStatusTextV2 === 'function') _clUpdateAgentStatusTextV2(historyNode, 'completed');
9874
+ } else if (typeof _clUpdateAgentStatusText === 'function') {
9875
+ _clUpdateAgentStatusText(historyNode, 'completed');
9876
+ }
8442
9877
  _cl_finalizeCard(historyNode, model._bufferedSteps || []);
8443
9878
  _cl_forceOpenNativeToolDetails(historyNode, 'execution-history', tcid);
8444
9879
  if (typeof _cl_scheduleHostShellMark === 'function') _cl_scheduleHostShellMark(historyNode);
8445
9880
  _cl_hideHostRawText(historyNode);
9881
+ if (tcid) __cl_executionCardCache.set(tcid, historyNode);
8446
9882
  console.log('[cl-render] 🗂️ built historical call card, tcid=' + tcid.substring(0, 8));
8447
9883
  return historyNode;
8448
9884
  }
@@ -8490,14 +9926,27 @@ window.__openagentRenderToolCard = function(card, onOpenSidebar) {
8490
9926
 
8491
9927
  model.toolCallId = resTcid;
8492
9928
  model.cardKind = 'result';
9929
+ if (model.isError) {
9930
+ var executionNodeForResult = (resState && resState.cardNode)
9931
+ || (resTcid ? __cl_executionCardCache.get(resTcid) : null);
9932
+ if (executionNodeForResult && executionNodeForResult.classList && executionNodeForResult.classList.contains('cl-exec-v2')) {
9933
+ if (typeof _clUpdateAgentStatusTextV2 === 'function') _clUpdateAgentStatusTextV2(executionNodeForResult, 'failed');
9934
+ } else if (executionNodeForResult && typeof _clUpdateAgentStatusText === 'function') {
9935
+ _clUpdateAgentStatusText(executionNodeForResult, 'failed');
9936
+ }
9937
+ }
8493
9938
 
8494
9939
  // 缓存:同一 toolCallId 的 output card 只创建一次,Lit 重复调用时复用
8495
9940
  var cachedOutput = resTcid ? __cl_outputCardCache.get(resTcid) : null;
8496
9941
  if (cachedOutput && cachedOutput.isConnected) {
8497
9942
  _cl_applyCardUiState(cachedOutput, { toolCallId: resTcid, cardKind: 'result' });
8498
- _cl_forceOpenNativeToolDetails(cachedOutput, 'output-cache', resTcid);
8499
- if (typeof _cl_scheduleHostShellMark === 'function') _cl_scheduleHostShellMark(cachedOutput);
8500
- _cl_hideHostRawText(cachedOutput);
9943
+ // ── 一次性外壳初始化:首次渲染时打开 native details + 隐藏 raw text,之后永久跳过 ──
9944
+ if (!cachedOutput.__clShellReady) {
9945
+ cachedOutput.__clShellReady = true;
9946
+ _cl_forceOpenNativeToolDetails(cachedOutput, 'output-cache', resTcid);
9947
+ if (typeof _cl_scheduleHostShellMark === 'function') _cl_scheduleHostShellMark(cachedOutput);
9948
+ _cl_hideHostRawText(cachedOutput);
9949
+ }
8501
9950
  return cachedOutput;
8502
9951
  }
8503
9952
 
@@ -8580,6 +10029,8 @@ function _cl_replayBufferedSteps(toolCallId, state) {
8580
10029
 
8581
10030
  function _cl_hideHostRawText(cardNode) {
8582
10031
  if (!cardNode) return;
10032
+ // 幂等性守卫:如果父链已经标记为隐藏,跳过重复操作
10033
+ if (cardNode.closest && cardNode.closest('.cl-remote-agent-raw-hidden')) return;
8583
10034
  function hide() {
8584
10035
  var hosts = _cl_collectRawTextHosts(cardNode);
8585
10036
  for (var h = 0; h < hosts.length; h++) {
@@ -8589,10 +10040,7 @@ function _cl_hideHostRawText(cardNode) {
8589
10040
  hide();
8590
10041
  if (typeof requestAnimationFrame === 'function') requestAnimationFrame(hide);
8591
10042
  setTimeout(hide, 0);
8592
- setTimeout(hide, 80);
8593
- setTimeout(hide, 250);
8594
- setTimeout(hide, 800);
8595
- setTimeout(hide, 2000);
10043
+ setTimeout(hide, 200);
8596
10044
  }
8597
10045
 
8598
10046
  function _cl_isRemoteToolNameText(text) {
@@ -8611,26 +10059,32 @@ function _cl_isRemoteRawTextContent(text) {
8611
10059
  return false;
8612
10060
  }
8613
10061
 
10062
+ function _cl_getHostAdapter() {
10063
+ return (typeof CL !== 'undefined' && CL.hostAdapter) ? CL.hostAdapter : {};
10064
+ }
10065
+
8614
10066
  function _cl_collectRawTextHosts(node) {
8615
10067
  var hosts = [];
10068
+ var adapter = _cl_getHostAdapter();
10069
+ var selectors = adapter.selectors && adapter.selectors.rawTextHostClosest;
8616
10070
  function add(host) {
8617
10071
  if (!host || hosts.indexOf(host) !== -1) return;
8618
10072
  hosts.push(host);
8619
10073
  }
8620
10074
  add(node.parentElement);
8621
- if (node.closest) {
8622
- add(node.closest('.chat-tools-collapse__body'));
8623
- add(node.closest('.chat-tool-msg-body'));
8624
- add(node.closest('.chat-tool-card__detail'));
8625
- add(node.closest('.chat-bubble'));
10075
+ if (node.closest && Array.isArray(selectors)) {
10076
+ for (var i = 0; i < selectors.length; i++) {
10077
+ add(node.closest(selectors[i]));
10078
+ }
8626
10079
  }
8627
10080
  return hosts;
8628
10081
  }
8629
10082
 
8630
10083
  function _cl_hideRawTextInHost(host) {
8631
10084
  if (!host || !host.querySelectorAll) return;
10085
+ var adapter = _cl_getHostAdapter();
8632
10086
  host.classList.add('cl-remote-agent-raw-hidden');
8633
- if (host.classList.contains('chat-tools-collapse__body') || host.classList.contains('chat-tool-msg-body')) {
10087
+ if (adapter.isToolBody && adapter.isToolBody(host)) {
8634
10088
  host.classList.add('cl-remote-agent-host-shell');
8635
10089
  }
8636
10090
  var texts = host.querySelectorAll(':scope > .chat-text');
@@ -8641,16 +10095,11 @@ function _cl_hideRawTextInHost(host) {
8641
10095
  }
8642
10096
 
8643
10097
  function _cl_findRemoteNativeToolShell(node) {
10098
+ var adapter = _cl_getHostAdapter();
8644
10099
  var cur = node && (node.nodeType === 1 ? node : node.parentElement);
8645
10100
  var hops = 0;
8646
10101
  while (cur && cur !== document.body && hops < 12) {
8647
- if (cur.matches && cur.matches(
8648
- 'details.chat-tools-collapse,' +
8649
- 'details.chat-tool-msg-collapse,' +
8650
- '.chat-tools-collapse,' +
8651
- '.chat-tool-msg-collapse,' +
8652
- '.chat-tool-card'
8653
- )) {
10102
+ if (adapter.isRemoteNativeToolShellCandidate && adapter.isRemoteNativeToolShellCandidate(cur)) {
8654
10103
  if (_cl_isRemoteNativeToolShell(cur)) return cur;
8655
10104
  }
8656
10105
  cur = cur.parentElement;
@@ -8661,14 +10110,12 @@ function _cl_findRemoteNativeToolShell(node) {
8661
10110
 
8662
10111
  function _cl_isRemoteNativeToolShell(shell) {
8663
10112
  if (!shell) return false;
10113
+ var adapter = _cl_getHostAdapter();
10114
+ var summarySelector = adapter.selectors && adapter.selectors.summary;
8664
10115
  var summaryText = '';
8665
- var summary = shell.querySelector && shell.querySelector(
8666
- ':scope > summary,' +
8667
- ':scope > .chat-tools-summary,' +
8668
- ':scope > .chat-tool-msg-summary,' +
8669
- '.chat-tools-summary,' +
8670
- '.chat-tool-msg-summary'
8671
- );
10116
+ var summary = shell.querySelector && summarySelector
10117
+ ? shell.querySelector(summarySelector)
10118
+ : null;
8672
10119
  if (summary) summaryText = summary.textContent || '';
8673
10120
  if (_cl_isRemoteToolNameText(summaryText)) return true;
8674
10121
 
@@ -8709,27 +10156,23 @@ function _cl_tryHideRemoteRawTextNode(node) {
8709
10156
 
8710
10157
  var shell = _cl_findRemoteNativeToolShell(node);
8711
10158
  if (shell && shell.querySelectorAll) {
8712
- var hosts = shell.querySelectorAll('.chat-tools-collapse__body, .chat-tool-msg-body, .chat-tool-card__detail, .chat-bubble');
8713
- for (var h = 0; h < hosts.length; h++) {
8714
- _cl_hideRawTextInHost(hosts[h]);
10159
+ var adapter = _cl_getHostAdapter();
10160
+ var hostSelector = adapter.selectors && adapter.selectors.rawTextHostsWithinShell;
10161
+ if (hostSelector) {
10162
+ var hosts = shell.querySelectorAll(hostSelector);
10163
+ for (var h = 0; h < hosts.length; h++) {
10164
+ _cl_hideRawTextInHost(hosts[h]);
10165
+ }
8715
10166
  }
8716
10167
  }
8717
10168
  }
8718
10169
 
8719
10170
  function _cl_findNearestToolLikeShell(node) {
10171
+ var adapter = _cl_getHostAdapter();
8720
10172
  var cur = node && (node.nodeType === 1 ? node : node.parentElement);
8721
10173
  var hops = 0;
8722
10174
  while (cur && cur !== document.body && hops < 12) {
8723
- if (cur.matches && cur.matches(
8724
- 'details.chat-tools-collapse,' +
8725
- 'details.chat-tool-msg-collapse,' +
8726
- '.chat-tools-collapse,' +
8727
- '.chat-tool-msg-collapse,' +
8728
- '.chat-tool-card,' +
8729
- '.chat-tools-collapse__body,' +
8730
- '.chat-tool-msg-body,' +
8731
- '.chat-tool-card__detail'
8732
- )) {
10175
+ if (adapter.isToolLikeShell && adapter.isToolLikeShell(cur)) {
8733
10176
  return cur;
8734
10177
  }
8735
10178
  cur = cur.parentElement;
@@ -8778,15 +10221,11 @@ _cl_installRemoteRawTextObserver();
8778
10221
  // ── 局部打开最近宿主 wrapper(不做全局扫描)──
8779
10222
 
8780
10223
  function _cl_findNearestNativeToolShell(node) {
10224
+ var adapter = _cl_getHostAdapter();
8781
10225
  var cur = node && node.parentElement;
8782
10226
  var hops = 0;
8783
10227
  while (cur && cur !== document.body && hops < 10) {
8784
- if (cur.matches && cur.matches(
8785
- 'details.chat-tools-collapse,' +
8786
- 'details.chat-tool-msg-collapse,' +
8787
- '.chat-tools-collapse,' +
8788
- '.chat-tool-msg-collapse'
8789
- )) {
10228
+ if (adapter.isNativeToolShell && adapter.isNativeToolShell(cur)) {
8790
10229
  return cur;
8791
10230
  }
8792
10231
  cur = cur.parentElement;
@@ -8814,7 +10253,9 @@ function _cl_forceOpenNativeToolDetails(node, source, tcid) {
8814
10253
 
8815
10254
  if (shell.classList && !shell.classList.contains('is-open')) {
8816
10255
  shell.classList.add('is-open');
8817
- var header = shell.querySelector('.chat-tool-msg-summary, .chat-tools-summary');
10256
+ var adapter = _cl_getHostAdapter();
10257
+ var headerSelector = (adapter.selectors && adapter.selectors.forceOpenHeader) || '';
10258
+ var header = headerSelector ? shell.querySelector(headerSelector) : null;
8818
10259
  if (header) header.setAttribute('aria-expanded', 'true');
8819
10260
  console.log('[cl-render] 🔓 opened native collapse source=' + source
8820
10261
  + ' tcid=' + String(tcid || '').substring(0, 8));
@@ -8826,8 +10267,6 @@ function _cl_forceOpenNativeToolDetails(node, source, tcid) {
8826
10267
  // openNearest 是幂等的(已 open 不重复操作),不需要防抖。
8827
10268
  openNearest();
8828
10269
  if (typeof requestAnimationFrame === 'function') requestAnimationFrame(openNearest);
8829
- setTimeout(openNearest, 0);
8830
- setTimeout(openNearest, 80);
8831
10270
  setTimeout(openNearest, 300); // 兜底:慢速 Lit render / 异步 wrapper 挂载
8832
10271
  }
8833
10272
 
@@ -8892,6 +10331,9 @@ function _cl_applyCardUiState(container, modelOrNode) {
8892
10331
  content.classList.remove('cl-content-collapsed');
8893
10332
  if (caret) caret.textContent = '▼';
8894
10333
  }
10334
+ if (typeof _clSyncOutputFooterVisibility === 'function') {
10335
+ _clSyncOutputFooterVisibility(container, state.contentCollapsed);
10336
+ }
8895
10337
  }
8896
10338
 
8897
10339
  var body = container.querySelector('.cl-tools-collapse-body');
@@ -8921,6 +10363,14 @@ function _cl_applyStoredRecordToModel(model, record) {
8921
10363
  if (!model.agentAvatar) {
8922
10364
  model.agentAvatar = args.agent_avatar || args.agentAvatar || args.avatar || args.avatar_url || args.avatarUrl || null;
8923
10365
  }
10366
+ if (!model.agentBio) {
10367
+ model.agentBio = typeof _clPickAgentDescription === 'function'
10368
+ ? _clPickAgentDescription(args)
10369
+ : (args.agent_bio || args.agentBio || args.description || args.agent_description || args.MOM || '');
10370
+ }
10371
+ if (!model.agentStars) {
10372
+ model.agentStars = args.agent_stars || args.agentStars || '3.2万';
10373
+ }
8924
10374
  var identity = CL && typeof CL.getAgentIdentity === 'function'
8925
10375
  ? CL.getAgentIdentity(model.agentId, model.agentName)
8926
10376
  : null;
@@ -8928,6 +10378,11 @@ function _cl_applyStoredRecordToModel(model, record) {
8928
10378
  model.agentId = model.agentId || identity.id || identity.agent_id;
8929
10379
  model.agentName = (model.agentName && model.agentName !== 'Remote Agent') ? model.agentName : (identity.name || model.agentName);
8930
10380
  model.agentAvatar = model.agentAvatar || identity.avatar || null;
10381
+ if (!model.agentBio) {
10382
+ model.agentBio = typeof _clPickAgentDescription === 'function'
10383
+ ? _clPickAgentDescription(identity)
10384
+ : (identity.bio || identity.description || identity.agent_bio || identity.agentBio || identity.MOM || '');
10385
+ }
8931
10386
  }
8932
10387
  model.taskText = model.taskText || args.task || args.message || args.instruction || '';
8933
10388
  }
@@ -9326,8 +10781,6 @@ function _cl_updateCardSteps(card, steps) {
9326
10781
  var stepEl = _clCreateStepElement(steps[i], i === steps.length - 1);
9327
10782
  body.appendChild(stepEl);
9328
10783
  }
9329
-
9330
- _cl_forceOpenNativeToolDetails(card, 'steps-update', card.dataset && card.dataset.clCardTcid || '');
9331
10784
  }
9332
10785
 
9333
10786
  function _cl_autoOpenStepsIfUncontrolled(card) {
@@ -9335,7 +10788,11 @@ function _cl_autoOpenStepsIfUncontrolled(card) {
9335
10788
  var uiState = _cl_getCardUiState(card);
9336
10789
  if (uiState && uiState.stepsExpanded !== undefined) return;
9337
10790
 
9338
- var body = card.querySelector('.cl-tools-collapse-body');
10791
+ // 缓存 body 引用,避免 5-16Hz Lit rerender 时重复 querySelector
10792
+ if (!card.__clStepsBody) {
10793
+ card.__clStepsBody = card.querySelector('.cl-tools-collapse-body');
10794
+ }
10795
+ var body = card.__clStepsBody;
9339
10796
  if (!body) return;
9340
10797
 
9341
10798
  body.classList.remove('cl-collapsed');
@@ -9390,6 +10847,11 @@ function _cl_countChunkTypes(chunks) {
9390
10847
  }
9391
10848
 
9392
10849
  function _cl_finalizeCard(card, steps) {
10850
+ if (card && card.classList && card.classList.contains('cl-exec-v2')) {
10851
+ if (typeof _clUpdateAgentStatusTextV2 === 'function') _clUpdateAgentStatusTextV2(card, 'completed');
10852
+ } else if (typeof _clUpdateAgentStatusText === 'function') {
10853
+ _clUpdateAgentStatusText(card, 'completed');
10854
+ }
9393
10855
  var header = card.querySelector('.cl-tools-collapse-header-title');
9394
10856
  if (header) {
9395
10857
  header.textContent = '思考完成';
@@ -9400,6 +10862,20 @@ function _cl_finalizeCard(card, steps) {
9400
10862
  dots[i].className = 'cl-tools-collapse-step-check';
9401
10863
  }
9402
10864
 
10865
+ // 执行完成后隐藏第一个 chat-bubble(execution card),仅保留 output card
10866
+ // 仅 V2 启用:V1 的 output card 布局不同,不宜隐藏 execution bubble
10867
+ var isV2Finalize = typeof _clIsHostVersionGte === 'function' && _clIsHostVersionGte('2026.6.9');
10868
+ if (isV2Finalize && card && !card.__clBubbleHidden) {
10869
+ card.__clBubbleHidden = true;
10870
+ var bubble = card.closest && card.closest('.chat-bubble');
10871
+ if (bubble) {
10872
+ // 延迟隐藏,等 output card(第二个 bubble)渲染完毕
10873
+ setTimeout(function() {
10874
+ bubble.style.display = 'none';
10875
+ }, 500);
10876
+ }
10877
+ }
10878
+
9403
10879
  // Finalize 只负责把 execution card 标记为完成态。
9404
10880
  // 不在这里强制折叠 steps:OpenClaw 会周期性 rerender,若 finalize 每次都
9405
10881
  // 写 cl-collapsed,会覆盖用户手动展开后的状态。
@@ -9645,7 +11121,7 @@ var _clObserverTarget = null;
9645
11121
 
9646
11122
  const _clObserver = new MutationObserver(() => {
9647
11123
  if (_clDebounceTimer) clearTimeout(_clDebounceTimer);
9648
- _clDebounceTimer = setTimeout(_debouncedClScan, 50); // Reduced from 500ms to 50ms to fix UI flash
11124
+ _clDebounceTimer = setTimeout(_debouncedClScan, 300); // Debounce to reduce DOM churn feedback loops
9649
11125
  });
9650
11126
 
9651
11127
  function _debouncedClScan() {