openclaw-openagent 1.0.11 → 1.0.13

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 (65) hide show
  1. package/dist/index.js +3 -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/config/config-schema.d.ts +9 -0
  5. package/dist/src/config/config-schema.js +6 -0
  6. package/dist/src/plugin-ui/adapters/adapters/oc-2026-04.js +103 -0
  7. package/dist/src/plugin-ui/adapters/adapters/oc-2026-05.js +125 -0
  8. package/dist/src/plugin-ui/adapters/adapters/oc-2026-06.js +125 -0
  9. package/dist/src/plugin-ui/adapters/adapters/oc-unknown.js +48 -0
  10. package/dist/src/plugin-ui/adapters/oc-2026-04.js +103 -0
  11. package/dist/src/plugin-ui/adapters/oc-2026-05.js +125 -0
  12. package/dist/src/plugin-ui/adapters/oc-2026-06.js +125 -0
  13. package/dist/src/plugin-ui/adapters/oc-unknown.js +48 -0
  14. package/dist/src/plugin-ui/assets/openagent-override.js +1129 -273
  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 +75 -8
  20. package/dist/src/plugin-ui/ui-extension-loader/types.d.ts +4 -1
  21. package/dist/src/proxy/auth-proxy.js +5 -0
  22. package/dist/src/runtime/update-checker.d.ts +18 -0
  23. package/dist/src/runtime/update-checker.js +253 -0
  24. package/dist/src/state/store.d.ts +21 -0
  25. package/dist/src/state/store.js +54 -0
  26. package/dist/src/transport/oasn/oasn-invocation.d.ts +3 -0
  27. package/dist/src/transport/oasn/oasn-invocation.js +28 -12
  28. package/dist/src/transport/oasn/oasn-types.d.ts +8 -4
  29. package/index.ts +4 -1
  30. package/package.json +4 -3
  31. package/src/app/remote-agent-tool.ts +131 -16
  32. package/src/app/types.ts +2 -2
  33. package/src/config/config-schema.ts +6 -0
  34. package/src/plugin-ui/adapters/oc-2026-04.js +103 -0
  35. package/src/plugin-ui/adapters/oc-2026-05.js +125 -0
  36. package/src/plugin-ui/adapters/oc-2026-06.js +125 -0
  37. package/src/plugin-ui/adapters/oc-unknown.js +48 -0
  38. package/src/plugin-ui/assets/openagent-override.js +1129 -273
  39. package/src/plugin-ui/build.cjs +249 -38
  40. package/src/plugin-ui/index.ts +2 -2
  41. package/src/plugin-ui/modules/agent-book/panel/agent-book.js +102 -12
  42. package/src/plugin-ui/modules/agent-book/panel/inject-ui.js +105 -3
  43. package/src/plugin-ui/modules/agent-book/panel/styles.js +54 -48
  44. package/src/plugin-ui/modules/agent-book/remote-agent-tool/components-core.js +4 -2
  45. package/src/plugin-ui/modules/agent-book/remote-agent-tool/thought-chain-card.js +4 -1
  46. package/src/plugin-ui/modules/agent-book/scanner.js +17 -5
  47. package/src/plugin-ui/modules/agent-book/travelcard/travel-styles.js +12 -1
  48. package/src/plugin-ui/modules/loader/bootstrap.js +95 -0
  49. package/src/plugin-ui/modules/loader/shared-state.js +244 -20
  50. package/src/plugin-ui/modules/remote-agent/execution-card.js +54 -16
  51. package/src/plugin-ui/modules/remote-agent/native-style-adapter.js +5 -23
  52. package/src/plugin-ui/modules/remote-agent/output-card.js +13 -7
  53. package/src/plugin-ui/modules/remote-agent/render-hooks.js +53 -41
  54. package/src/plugin-ui/modules/remote-agent/styles.js +238 -89
  55. package/src/plugin-ui/modules/remote-agent/tool-card-model.js +72 -4
  56. package/src/plugin-ui/postinstall-deploy.cjs +52 -0
  57. package/src/plugin-ui/ui-extension-loader/index.ts +6 -6
  58. package/src/plugin-ui/ui-extension-loader/registry-regex.ts +81 -9
  59. package/src/plugin-ui/ui-extension-loader/types.ts +5 -1
  60. package/src/proxy/auth-proxy.ts +5 -0
  61. package/src/runtime/update-checker.ts +286 -0
  62. package/src/state/store.ts +80 -0
  63. package/src/transport/oasn/oasn-invocation.ts +47 -12
  64. package/src/transport/oasn/oasn-types.ts +6 -2
  65. package/src/types/openclaw-plugin-sdk-media-store.d.ts +9 -0
@@ -10,62 +10,75 @@
10
10
  if (oldStyle) oldStyle.remove();
11
11
  var style = document.createElement('style');
12
12
  style.id = 'cl-remote-agent-styles';
13
+ style.setAttribute('data-openagent-style', 'remote-agent');
14
+ style.setAttribute('data-openagent-host-version', CL.hostVersion || 'unknown');
15
+ style.setAttribute('data-openagent-host-adapter', (CL.hostAdapter && CL.hostAdapter.id) || 'oc-unknown');
16
+ var hostCss = (CL.hostAdapter && CL.hostAdapter.css) || {};
17
+ function _clSelectorList(selectors) {
18
+ if (!selectors) return '';
19
+ if (Array.isArray(selectors)) return selectors.filter(Boolean).join(',\n');
20
+ return String(selectors || '');
21
+ }
22
+ function _clRule(selectors, declarations) {
23
+ var selectorText = _clSelectorList(selectors);
24
+ if (!selectorText) return '';
25
+ return selectorText + ' {\n' + declarations.join('\n') + '\n}';
26
+ }
13
27
  style.textContent = [
14
- // ── RenderHook 远端 Agent 卡片接管 native tool header ──
15
- 'details.chat-tools-collapse:has(.cl-remote-agent-card),',
16
- 'details.chat-tool-msg-collapse:has(.cl-remote-agent-card),',
17
- '.chat-tools-collapse:has(.cl-remote-agent-card),',
18
- '.chat-tool-msg-collapse:has(.cl-remote-agent-card) {',
19
- ' width: 100% !important;',
20
- ' max-width: none !important;',
21
- ' box-sizing: border-box !important;',
22
- ' border: 0 !important;',
23
- ' background: transparent !important;',
24
- ' box-shadow: none !important;',
25
- '}',
26
- '/* Align output host shells with execution shells. 3.28 renders output as',
27
- ' chat-tools-collapse + .cl-output-card; some versions use chat-tool-msg-collapse.',
28
- ' Move the host shell, not the inner OpenAgent card. */',
29
- 'details.chat-tools-collapse:has(.cl-output-card),',
30
- '.chat-tools-collapse:has(.cl-output-card),',
31
- 'details.chat-tool-msg-collapse:has(.cl-remote-agent-card),',
32
- '.chat-tool-msg-collapse:has(.cl-remote-agent-card) {',
33
- ' margin-left: 12px !important;',
34
- '}',
35
- 'details.chat-tools-collapse:has(.cl-remote-agent-card) > summary.chat-tools-summary,',
36
- 'details.chat-tool-msg-collapse:has(.cl-remote-agent-card) > summary.chat-tool-msg-summary,',
37
- '.chat-tools-collapse:has(.cl-remote-agent-card) > .chat-tools-summary,',
38
- '.chat-tool-msg-collapse:has(.cl-remote-agent-card) > .chat-tool-msg-summary {',
39
- ' display: none !important;',
40
- '}',
41
- '.chat-tools-collapse__body.cl-remote-agent-host-shell > .chat-text,',
42
- '.chat-tool-msg-body.cl-remote-agent-host-shell > .chat-text {',
28
+ // ── 隐藏宿主上下文用量提示 ──
29
+ '.context-notice.context-notice--usage,',
30
+ '.context-notice .context-notice--usage {',
43
31
  ' display: none !important;',
44
32
  '}',
33
+
34
+ // ── RenderHook 远端 Agent 卡片接管 native tool header ──
35
+ _clRule(hostCss.remoteShell, [
36
+ ' width: 100% !important;',
37
+ ' max-width: 100% !important;',
38
+ ' min-width: 0 !important;',
39
+ ' box-sizing: border-box !important;',
40
+ ' border: 0 !important;',
41
+ ' background: transparent !important;',
42
+ ' box-shadow: none !important;',
43
+ ]),
44
+ '/* Align output host shells with execution shells. Keep v4 msg-collapse',
45
+ ' separate from newer tools-collapse so modern spacing never leaks into',
46
+ ' the 2026.4 DOM. Move the host shell, not the inner OpenAgent card. */',
47
+ _clRule(hostCss.outputHostMargin, [
48
+ ' margin-left: 12px !important;',
49
+ ]),
50
+ _clRule(hostCss.outputHostMarginReset, [
51
+ ' margin-left: 0 !important;',
52
+ ]),
53
+ _clRule(hostCss.summaryHidden, [
54
+ ' display: none !important;',
55
+ ]),
56
+ _clRule(hostCss.hostShellRawText, [
57
+ ' display: none !important;',
58
+ ]),
45
59
  '.cl-remote-agent-raw-hidden > .chat-text,',
46
60
  '.cl-remote-agent-raw-hidden.chat-bubble > .chat-text {',
47
61
  ' display: none !important;',
48
62
  '}',
49
63
  '/* Phase A: 不依赖 host-shell class,用 :has() 直接隐藏宿主 raw text */',
50
- '.chat-tools-collapse__body:has(.cl-remote-agent-card) > .chat-text,',
51
- '.chat-tool-msg-body:has(.cl-remote-agent-card) > .chat-text,',
52
- '.chat-tool-card__detail:has(.cl-remote-agent-card) > .chat-text,',
53
- '.chat-tools-collapse__body:has(.cl-remote-agent-output-placeholder) > .chat-text,',
54
- '.chat-tool-msg-body:has(.cl-remote-agent-output-placeholder) > .chat-text,',
55
- '.chat-tool-card__detail:has(.cl-remote-agent-output-placeholder) > .chat-text {',
56
- ' display: none !important;',
57
- '}',
58
- 'details.chat-tools-collapse:has(.cl-remote-agent-card) > .chat-tools-collapse__body,',
59
- 'details.chat-tool-msg-collapse:has(.cl-remote-agent-card) > .chat-tool-msg-body,',
60
- '.chat-tools-collapse:has(.cl-remote-agent-card) > .chat-tools-collapse__body,',
61
- '.chat-tool-msg-collapse:has(.cl-remote-agent-card) > .chat-tool-msg-body {',
62
- ' border: 0 !important;',
63
- ' outline: 0 !important;',
64
- ' background: transparent !important;',
65
- ' box-shadow: none !important;',
66
- ' padding: 0 !important;',
67
- ' margin: 0 !important;',
68
- '}',
64
+ _clRule(hostCss.rawTextCardHosts, [
65
+ ' display: none !important;',
66
+ ]),
67
+ _clRule(hostCss.rawTextPlaceholderHosts, [
68
+ ' display: none !important;',
69
+ ]),
70
+ _clRule(hostCss.hostBody, [
71
+ ' border: 0 !important;',
72
+ ' outline: 0 !important;',
73
+ ' background: transparent !important;',
74
+ ' box-shadow: none !important;',
75
+ ' padding: 0 !important;',
76
+ ' margin: 0 !important;',
77
+ ' width: 100% !important;',
78
+ ' max-width: 100% !important;',
79
+ ' min-width: 0 !important;',
80
+ ' box-sizing: border-box !important;',
81
+ ]),
69
82
  '.chat-bubble:has(.cl-remote-agent-card) {',
70
83
  ' border: 0 !important;',
71
84
  ' background: transparent !important;',
@@ -73,11 +86,22 @@
73
86
  ' padding: 10px 0 !important;',
74
87
  ' width: 100%;',
75
88
  ' max-width: 100% !important;',
89
+ ' min-width: 0 !important;',
76
90
  ' overflow: hidden !important;',
91
+ ' box-sizing: border-box !important;',
77
92
  '}',
78
- '.chat-tool-msg-collapse.chat-tool-msg-collapse--manual.is-open:has(.cl-remote-agent-card) {',
79
- ' margin-left: 0 !important;',
93
+ '.chat-split-container:has(.cl-output-card),',
94
+ '.chat-main:has(.cl-output-card),',
95
+ '.chat-sidebar:has(.cl-output-card),',
96
+ '.chat-side-result:has(.cl-output-card),',
97
+ '.chat-side-result__body:has(.cl-output-card) {',
98
+ ' min-width: 0 !important;',
99
+ ' max-width: 100% !important;',
100
+ ' box-sizing: border-box !important;',
80
101
  '}',
102
+ _clRule(hostCss.manualOpenReset, [
103
+ ' margin-left: 0 !important;',
104
+ ]),
81
105
  // ── 外层活动组容器 ──
82
106
  '.chat-activity-group__body:has(.cl-remote-agent-card) {',
83
107
  ' border-radius: 14px;',
@@ -93,22 +117,18 @@
93
117
  '.cl-remote-agent-host-shell {',
94
118
  ' width: min(100%, 912px) !important;',
95
119
  ' max-width: 100% !important;',
120
+ ' min-width: 0 !important;',
96
121
  ' box-sizing: border-box !important;',
97
122
  '}',
98
- '.cl-remote-agent-host-shell.chat-tool-card,',
99
- '.cl-remote-agent-host-shell.chat-tool-card__detail,',
100
- '.cl-remote-agent-host-shell.chat-tools-collapse__body,',
101
- '.cl-remote-agent-host-shell.chat-tool-msg-body,',
102
- 'details.cl-remote-agent-host-shell {',
103
- ' border: 0 !important;',
104
- ' outline: 0 !important;',
105
- ' background: transparent !important;',
106
- ' box-shadow: none !important;',
107
- '}',
108
- '.cl-remote-agent-host-shell > summary.chat-tools-summary,',
109
- '.cl-remote-agent-host-shell > summary.chat-tool-msg-summary {',
110
- ' display: none !important;',
111
- '}',
123
+ _clRule(hostCss.hostShellReset, [
124
+ ' border: 0 !important;',
125
+ ' outline: 0 !important;',
126
+ ' background: transparent !important;',
127
+ ' box-shadow: none !important;',
128
+ ]),
129
+ _clRule(hostCss.hostShellSummary, [
130
+ ' display: none !important;',
131
+ ]),
112
132
  // ── 新卡片容器 ──
113
133
  // 覆盖 OpenClaw .chat-tool-card 的 max-height: 120px 限制
114
134
  '.cl-remote-agent-card {',
@@ -121,9 +141,14 @@
121
141
  ' background: #fff;',
122
142
  ' display: flex;',
123
143
  ' flex-direction: column;',
124
- ' gap: 10px;',
125
144
  ' box-sizing: border-box;',
126
145
  '}',
146
+ _clRule(hostCss.modernCardLayout ? ['.cl-remote-agent-card'] : [], [
147
+ ' overflow: hidden;',
148
+ ' min-width: 0;',
149
+ ' gap: 0;',
150
+ ' padding: 15px;',
151
+ ]),
127
152
 
128
153
  // ── 顶部 OpenAgent 标题条 ──
129
154
  '.cl-openagent-header {',
@@ -141,8 +166,16 @@
141
166
  '}',
142
167
  '.cl-openagent-header:hover {',
143
168
  '}',
169
+ _clRule(!hostCss.modernCardLayout ? ['.cl-openagent-header'] : [], [
170
+ ' height: auto;',
171
+ ' padding: 16px 25px;',
172
+ ]),
173
+ _clRule(hostCss.modernCardLayout ? ['.cl-openagent-header'] : [], [
174
+ ' gap: 0;',
175
+ ' height: auto;',
176
+ ' padding: 15px;',
177
+ ]),
144
178
  '/* Output mode (Figma 373:12082) */',
145
- '.cl-openagent-header--output,',
146
179
  '.cl-exec-v2 .cl-openagent-header--output {',
147
180
  ' border-radius: 10px 10px 0 0 !important;',
148
181
  ' border: 1px solid rgba(229, 229, 234, 0.75) !important;',
@@ -151,11 +184,9 @@
151
184
  ' box-shadow: 0px 8px 11px rgba(0, 0, 0, 0.12);',
152
185
  ' padding: 8px 6px !important;',
153
186
  '}',
154
- '.cl-openagent-header--output .cl-openagent-agent,',
155
187
  '.cl-exec-v2 .cl-openagent-header--output .cl-openagent-agent {',
156
188
  ' display: none;',
157
189
  '}',
158
- '.cl-openagent-header--output:hover,',
159
190
  '.cl-exec-v2 .cl-openagent-header--output:hover {',
160
191
  ' border-color: rgba(0,0,0,0.1);',
161
192
  '}',
@@ -175,10 +206,14 @@
175
206
  ' width: 14px;',
176
207
  ' height: 14px;',
177
208
  ' border-radius: 14px;',
178
- ' background: url(./icon.png) center/cover no-repeat;',
209
+ ' background: url(./icon.png) center / contain no-repeat;',
179
210
  ' flex-shrink: 0;',
180
211
  ' overflow: hidden;',
181
212
  '}',
213
+ _clRule(hostCss.modernCardLayout ? ['.cl-openagent-badge'] : [], [
214
+ ' background: url(./icon.png) center/cover no-repeat;',
215
+ ' margin: 0 6px;',
216
+ ]),
182
217
  '.cl-openagent-text-row {',
183
218
  ' display: flex;',
184
219
  ' align-items: center;',
@@ -209,7 +244,20 @@
209
244
  ' display: flex;',
210
245
  ' flex-direction: column;',
211
246
  ' gap: 16px;',
247
+ ' min-width: 0;',
248
+ ' max-width: 100%;',
249
+ ' box-sizing: border-box;',
212
250
  '}',
251
+ _clRule(!hostCss.modernCardLayout ? ['.cl-thought-chain-content.cl-thought-chain-content--execution'] : [], [
252
+ ' padding: 0 15px 15px;',
253
+ ]),
254
+ _clRule(hostCss.modernCardLayout ? ['.cl-thought-chain-content'] : [], [
255
+ ' margin-left: 0;',
256
+ ' width: 100%;',
257
+ ' min-width: 0;',
258
+ ' box-sizing: border-box;',
259
+ ' overflow: hidden;',
260
+ ]),
213
261
  '.cl-exec-detail-card {',
214
262
  ' padding: 8px 16px 8px 12px;',
215
263
  ' border-radius: 8px;',
@@ -228,8 +276,7 @@
228
276
  '.cl-exec-agent-avatar {',
229
277
  ' width: 68px;',
230
278
  ' height: 68px;',
231
- ' border-radius: 50%;',
232
- ' object-fit: cover;',
279
+ ' object-fit: contain;',
233
280
  ' flex-shrink: 0;',
234
281
  '}',
235
282
  '.cl-exec-detail-info {',
@@ -281,6 +328,17 @@
281
328
  ' margin: 0;',
282
329
  ' line-height: 1;',
283
330
  '}',
331
+ _clRule(!hostCss.modernCardLayout ? ['.cl-exec-agent-bio'] : [], [
332
+ ' width: 250px;',
333
+ ' max-width: 100%;',
334
+ ' min-width: 0;',
335
+ ' box-sizing: border-box;',
336
+ ' overflow: hidden;',
337
+ ' text-overflow: ellipsis;',
338
+ ' display: -webkit-box;',
339
+ ' -webkit-line-clamp: 2;',
340
+ ' -webkit-box-orient: vertical;',
341
+ ]),
284
342
 
285
343
  // ── Progress text (Figma 346:253) ──
286
344
  '.cl-thought-chain-content.cl-content-collapsed {',
@@ -325,26 +383,72 @@
325
383
  ' border: 1.2px solid rgba(47,47,51,0.1) !important;',
326
384
  ' border-radius: 24px !important;',
327
385
  ' padding: 10px 15px !important;',
328
- ' gap: 10px !important;',
386
+ ' width: 100% !important;',
387
+ ' max-width: 100% !important;',
388
+ ' min-width: 0 !important;',
389
+ ' box-sizing: border-box !important;',
390
+ ' overflow: hidden;',
329
391
  '}',
392
+ _clRule(hostCss.modernCardLayout ? ['.cl-output-card'] : [], [
393
+ ' gap: 10px !important;',
394
+ ]),
395
+ _clRule(!hostCss.modernCardLayout ? ['.cl-output-card'] : [], [
396
+ ' border-radius: 14px !important;',
397
+ ]),
398
+ _clRule(!hostCss.modernCardLayout ? ['.cl-remote-agent-card.cl-thought-chain.cl-output-card'] : [], [
399
+ ' padding: 0 !important;',
400
+ ]),
330
401
  '.cl-output-card > .cl-thought-chain-content {',
331
402
  ' background: #fff;',
332
403
  ' border: 1px solid #f4f4f4;',
333
404
  ' border-radius: 12px;',
334
405
  ' padding: 20px 30px;',
335
406
  ' overflow: hidden;',
407
+ ' width: 100%;',
336
408
  ' max-width: 100%;',
409
+ ' min-width: 0;',
410
+ ' box-sizing: border-box;',
411
+ '}',
412
+ _clRule(!hostCss.modernCardLayout ? ['.cl-output-card > .cl-thought-chain-content'] : [], [
413
+ ' margin: 10px 15px;',
414
+ ' width: calc(100% - 30px);',
415
+ ]),
416
+ '.cl-output-card .cl-output-result {',
417
+ ' width: 100%;',
418
+ ' max-width: 100%;',
419
+ ' min-width: 0;',
337
420
  ' box-sizing: border-box;',
421
+ ' overflow-wrap: anywhere;',
422
+ ' word-break: break-word;',
338
423
  '}',
339
424
  '.cl-output-card > .cl-thought-chain-content * {',
340
425
  ' max-width: 100%;',
426
+ ' min-width: 0;',
341
427
  ' box-sizing: border-box;',
342
428
  '}',
429
+ '.cl-output-card > .cl-thought-chain-content p,',
430
+ '.cl-output-card > .cl-thought-chain-content li,',
431
+ '.cl-output-card > .cl-thought-chain-content a {',
432
+ ' overflow-wrap: anywhere;',
433
+ ' word-break: break-word;',
434
+ '}',
435
+ '.cl-output-card > .cl-thought-chain-content hr {',
436
+ ' border: 0;',
437
+ ' border-top: 1px solid #bdbdbd;',
438
+ '}',
343
439
  '.cl-output-card > .cl-thought-chain-content pre,',
344
440
  '.cl-output-card > .cl-thought-chain-content code {',
345
441
  ' overflow-x: auto;',
346
442
  ' white-space: pre-wrap;',
347
443
  ' word-break: break-all;',
444
+ ' scrollbar-width: none;',
445
+ ' -ms-overflow-style: none;',
446
+ '}',
447
+ '.cl-output-card > .cl-thought-chain-content pre::-webkit-scrollbar,',
448
+ '.cl-output-card > .cl-thought-chain-content code::-webkit-scrollbar {',
449
+ ' width: 0;',
450
+ ' height: 0;',
451
+ ' display: none;',
348
452
  '}',
349
453
  // V2 output card:统一 border/padding 与 execution card 一致
350
454
  '.cl-exec-v2.cl-output-card {',
@@ -373,6 +477,10 @@
373
477
  ' font-size: 14px;',
374
478
  ' color: #999;',
375
479
  '}',
480
+ _clRule(!hostCss.modernCardLayout ? ['.cl-output-footer'] : [], [
481
+ ' padding: 10px 15px;',
482
+ ' line-height: 22px;',
483
+ ]),
376
484
  '.cl-output-footer-text {',
377
485
  ' white-space: nowrap;',
378
486
  '}',
@@ -393,6 +501,9 @@
393
501
  ' border-radius: 14px !important;',
394
502
  ' padding: 16px 20px !important;',
395
503
  ' box-sizing: border-box !important;',
504
+ ' min-width: 0 !important;',
505
+ ' max-width: 100% !important;',
506
+ ' overflow-x: hidden !important;',
396
507
  ' display: flex !important;',
397
508
  ' flex-direction: column !important;',
398
509
  ' gap: 16px !important;',
@@ -402,6 +513,10 @@
402
513
  ' flex-direction: column !important;',
403
514
  ' gap: 16px !important;',
404
515
  ' width: 100% !important;',
516
+ ' min-width: 0 !important;',
517
+ ' max-width: 100% !important;',
518
+ ' overflow-x: hidden !important;',
519
+ ' box-sizing: border-box !important;',
405
520
  ' background: transparent !important;',
406
521
  '}',
407
522
  '.chat-sidebar .sidebar-header {',
@@ -437,7 +552,12 @@
437
552
  ' line-height: 1.8 !important;',
438
553
  ' color: #333 !important;',
439
554
  ' width: 100% !important;',
555
+ ' min-width: 0 !important;',
556
+ ' max-width: 100% !important;',
440
557
  ' padding: 0 !important;',
558
+ ' overflow-x: hidden !important;',
559
+ ' box-sizing: border-box !important;',
560
+ ' overflow-wrap: anywhere !important;',
441
561
  '}',
442
562
  '.chat-sidebar .sidebar-markdown {',
443
563
  ' font-family: "PingFang SC", sans-serif !important;',
@@ -448,6 +568,21 @@
448
568
  ' background: transparent !important;',
449
569
  ' border: none !important;',
450
570
  ' padding: 0 !important;',
571
+ ' min-width: 0 !important;',
572
+ ' max-width: 100% !important;',
573
+ ' overflow-x: hidden !important;',
574
+ ' box-sizing: border-box !important;',
575
+ ' overflow-wrap: anywhere !important;',
576
+ '}',
577
+ '.chat-sidebar .sidebar-markdown * {',
578
+ ' max-width: 100% !important;',
579
+ ' min-width: 0 !important;',
580
+ ' box-sizing: border-box !important;',
581
+ '}',
582
+ '.chat-sidebar .sidebar-markdown pre,',
583
+ '.chat-sidebar .sidebar-markdown code {',
584
+ ' white-space: pre-wrap !important;',
585
+ ' word-break: break-word !important;',
451
586
  '}',
452
587
  // 隐藏宿主 sidebar 自带的 "Rendered Markdown / View Raw Text" 工具栏
453
588
  '.chat-sidebar .sidebar-markdown-shell__toolbar {',
@@ -461,6 +596,8 @@
461
596
  // ── V2 容器 ──
462
597
  '.cl-exec-v2 {',
463
598
  ' position: relative;',
599
+ ' gap: 10px;',
600
+ ' padding: 0;',
464
601
  '}',
465
602
 
466
603
  // ── V2 Header(Figma 371:6987 — 红晕渐变背景 + 独立边框)──
@@ -473,6 +610,7 @@
473
610
  ' border-radius: 10px 10px 0 0;',
474
611
  ' height: auto !important;',
475
612
  ' min-height: auto !important;',
613
+ ' gap: 6px;',
476
614
  ' box-sizing: border-box;',
477
615
  '}',
478
616
  '.cl-exec-v2 .cl-openagent-header-v2:hover {',
@@ -510,6 +648,7 @@
510
648
  ' border-radius: 12px !important;',
511
649
  ' background: #f7f7f8 !important;',
512
650
  ' margin: 12px 14px 14px 14px !important;',
651
+ ' margin-top: 0 !important;',
513
652
  ' margin-left: 0 !important;',
514
653
  ' position: relative;',
515
654
  ' overflow: hidden;',
@@ -537,7 +676,6 @@
537
676
 
538
677
  '.cl-exec-v2 .cl-exec-detail-row-v2 {',
539
678
  ' display: flex;',
540
- ' align-items: flex-start;',
541
679
  ' gap: 16px;',
542
680
  '}',
543
681
 
@@ -549,12 +687,11 @@
549
687
  ' min-width: 0;',
550
688
  '}',
551
689
 
552
- // ── V2 大头像 80×80 ──
690
+ // ── V2 大头像 68×68 ──
553
691
  '.cl-exec-v2 .cl-exec-agent-avatar-v2 {',
554
- ' width: 80px !important;',
555
- ' height: 80px !important;',
556
- ' border-radius: 16px !important;',
557
- ' object-fit: cover;',
692
+ ' width: 68px !important;',
693
+ ' height: 68px !important;',
694
+ ' object-fit: contain;',
558
695
  ' flex-shrink: 0;',
559
696
  '}',
560
697
 
@@ -687,12 +824,33 @@
687
824
  ' font-weight: 500;',
688
825
  ' white-space: nowrap;',
689
826
  '}',
827
+
828
+ // ── chat-text 下 p 标签样式 ──
829
+ '.cl-remote-agent-card .chat-text p {',
830
+ ' color: #2F2F33 !important;',
831
+ ' text-align: justify;',
832
+ ' font-family: "PingFang SC" !important;',
833
+ ' font-size: 14px !important;',
834
+ ' font-style: normal !important;',
835
+ ' font-weight: 400 !important;',
836
+ ' line-height: 132% !important;',
837
+ '}',
838
+
839
+ // ── chat-text 下 code 标签样式(去背景、去边框、加粗)──
840
+ '.chat-text code,',
841
+ '.cl-remote-agent-card .chat-text code,',
842
+ '.cl-remote-agent-card .chat-text p code {',
843
+ ' background: transparent !important;',
844
+ ' border: none !important;',
845
+ ' font-weight: 700 !important;',
846
+ '}',
690
847
  ].join('\n');
691
848
  document.head.appendChild(style);
692
849
  // ── 局部 host-shell 标记(不做全局扫描)──
693
850
  // 只处理当前 cardNode 的祖先链路,不 querySelectorAll 全局
694
851
  window._clMarkRemoteAgentHostShell = function _clMarkRemoteAgentHostShell(cardNode) {
695
852
  try {
853
+ var hostAdapter = CL.hostAdapter || {};
696
854
  var node = cardNode && cardNode.parentElement;
697
855
  var hops = 0;
698
856
  while (node && node !== document.body && hops < 10) {
@@ -705,17 +863,8 @@
705
863
 
706
864
  var shouldMark = false;
707
865
  var tag = (node.tagName || '').toLowerCase();
708
- if (tag === 'details') {
709
- shouldMark = node.matches && node.matches(
710
- 'details.chat-tools-collapse, details.chat-tool-msg-collapse'
711
- );
712
- } else if (node.matches) {
713
- shouldMark = node.matches(
714
- '.chat-tool-card,' +
715
- '.chat-tool-card__detail,' +
716
- '.chat-tools-collapse__body,' +
717
- '.chat-tool-msg-body'
718
- );
866
+ if (typeof hostAdapter.isMarkableHost === 'function') {
867
+ shouldMark = hostAdapter.isMarkableHost(node);
719
868
  }
720
869
 
721
870
  if (shouldMark && node.classList) {
@@ -15,6 +15,73 @@ function _clInferToolCardKind(card) {
15
15
  return 'call';
16
16
  }
17
17
 
18
+ function _clPickAgentDescription(source) {
19
+ if (!source) return '';
20
+ var keys = [
21
+ 'agent_bio',
22
+ 'agentBio',
23
+ 'bio',
24
+ 'description',
25
+ 'desc',
26
+ 'agent_description',
27
+ 'agentDescription',
28
+ 'MOM',
29
+ 'mom',
30
+ 'introduction',
31
+ 'summary'
32
+ ];
33
+ for (var i = 0; i < keys.length; i++) {
34
+ var value = source[keys[i]];
35
+ if (typeof value === 'string' && value.trim()) return value.trim();
36
+ }
37
+ return '';
38
+ }
39
+
40
+ function _clIsFailureStatusValue(value) {
41
+ var normalized = String(value || '').trim().toLowerCase();
42
+ return normalized === 'failed'
43
+ || normalized === 'failure'
44
+ || normalized === 'error'
45
+ || normalized === 'errored'
46
+ || normalized === 'rejected'
47
+ || normalized === 'cancelled'
48
+ || normalized === 'canceled';
49
+ }
50
+
51
+ function _clLooksLikeRemoteFailureText(text) {
52
+ var value = String(text || '').trim();
53
+ if (!value || value.length > 300) return false;
54
+ return /(^|[,。;\s])(调用失败|执行失败|任务失败|远端服务目前连不上|远端服务.*不可用|两次都返回了调用失败)([,。;\s]|$)/.test(value);
55
+ }
56
+
57
+ function _clInferToolCardError(card, chunks, rawText) {
58
+ if (chunks && chunks.some(function(c) { return c && c.type === 'error'; })) return true;
59
+ if (!card) return _clLooksLikeRemoteFailureText(rawText);
60
+ if (card.isError === true || card.error === true) return true;
61
+ if (_clIsFailureStatusValue(card.status)
62
+ || _clIsFailureStatusValue(card.state)
63
+ || _clIsFailureStatusValue(card.resultStatus)) {
64
+ return true;
65
+ }
66
+ if (card.error && typeof card.error === 'object') return true;
67
+ return _clLooksLikeRemoteFailureText(rawText);
68
+ }
69
+
70
+ function _clApplyAgentIdentityToModel(model) {
71
+ if (!model || typeof CL === 'undefined' || !CL || typeof CL.getAgentIdentity !== 'function') return model;
72
+ var identity = CL.getAgentIdentity(model.agentId, model.agentName);
73
+ if (!identity) return model;
74
+ model.agentId = model.agentId || identity.id || identity.agent_id;
75
+ if (!model.agentName || model.agentName === 'Remote Agent') {
76
+ model.agentName = identity.name || model.agentName;
77
+ }
78
+ model.agentAvatar = model.agentAvatar || identity.avatar || identity.avatar_url || identity.avatarUrl || null;
79
+ if (!model.agentBio) {
80
+ model.agentBio = _clPickAgentDescription(identity);
81
+ }
82
+ return model;
83
+ }
84
+
18
85
  function _clParseToolCardModel(card) {
19
86
  var inferredKind = _clInferToolCardKind(card);
20
87
 
@@ -23,7 +90,7 @@ function _clParseToolCardModel(card) {
23
90
  var agentId = args.agent_id || args.agentId || null;
24
91
  var agentName = args.agent_name || args.agentName || agentId || 'Remote Agent';
25
92
  var agentAvatar = args.agent_avatar || args.agentAvatar || args.avatar || args.avatar_url || args.avatarUrl || null;
26
- var agentBio = args.agent_bio || args.agentBio || args.description || args.agent_description || args.MOM || '';
93
+ var agentBio = _clPickAgentDescription(args);
27
94
  var agentStars = args.agent_stars || args.agentStars || args.stars || args.claws || '3.2万';
28
95
  var taskText = args.task || args.message || args.instruction || '';
29
96
 
@@ -34,7 +101,7 @@ function _clParseToolCardModel(card) {
34
101
  rawText: rawText
35
102
  });
36
103
  var hasOutput = inferredKind === 'result' && rawText.trim().length > 0;
37
- var isError = chunks.some(function(c) { return c.type === 'error'; });
104
+ var isError = _clInferToolCardError(card, chunks, rawText);
38
105
 
39
106
  var model = {
40
107
  agentId: agentId,
@@ -44,7 +111,7 @@ function _clParseToolCardModel(card) {
44
111
  agentStars: agentStars,
45
112
  taskText: taskText,
46
113
  toolCallId: card.toolCallId || '',
47
- status: hasOutput ? 'completed' : 'executing',
114
+ status: isError ? 'failed' : (hasOutput ? 'completed' : 'executing'),
48
115
  rawText: rawText,
49
116
  text: rawText,
50
117
  outputText: rawText,
@@ -52,8 +119,9 @@ function _clParseToolCardModel(card) {
52
119
  isError: isError,
53
120
  inferredKind: inferredKind,
54
121
  };
122
+ _clApplyAgentIdentityToModel(model);
55
123
 
56
- console.log('[cl-model] parsed:', 'agent=' + agentName,
124
+ console.log('[cl-model] parsed:', 'agent=' + model.agentName,
57
125
  'status=' + model.status,
58
126
  'chunks=' + chunks.length,
59
127
  'error=' + isError);