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
@@ -34,12 +34,27 @@ function _setTextareaValue(textarea, value) {
34
34
  textarea.dispatchEvent(new Event('input', { bubbles: true }));
35
35
  }
36
36
 
37
+ function _escapeRemoteAgentMarkerValue(value) {
38
+ return String(value || '')
39
+ .replace(/\s+/g, ' ')
40
+ .trim()
41
+ .replace(/"/g, "'");
42
+ }
43
+
37
44
  function _buildRemoteAgentMarker(mention, userText) {
38
45
  const hasChinese = /[\u4e00-\u9fff]/.test(userText || '');
39
46
  const instruction = hasChinese
40
47
  ? '请调用 openagent_call_remote_agent 工具将此请求转发给远端 Agent 处理'
41
48
  : 'Please invoke the openagent_call_remote_agent tool to forward this request to the remote agent';
42
- return `{openagent_call_remote_agent:agent_id="${mention.agent_id}",agent_name="${mention.name}",instruction="${instruction}"}`;
49
+ const attrs = [
50
+ `agent_id="${_escapeRemoteAgentMarkerValue(mention.agent_id)}"`,
51
+ `agent_name="${_escapeRemoteAgentMarkerValue(mention.name)}"`,
52
+ ];
53
+ if (mention.agent_bio) {
54
+ attrs.push(`agent_bio="${_escapeRemoteAgentMarkerValue(mention.agent_bio)}"`);
55
+ }
56
+ attrs.push(`instruction="${_escapeRemoteAgentMarkerValue(instruction)}"`);
57
+ return `{openagent_call_remote_agent:${attrs.join(',')}}`;
43
58
  }
44
59
 
45
60
  function _composeRemoteAgentMessage(textarea, mention) {
@@ -281,13 +296,13 @@ function tryInject() {
281
296
  console.log('[openagent] ✅ Agent Book UI injected (v3 hook-driven)');
282
297
 
283
298
  // ── 提示栏(Figma 141:3293):页面加载即显示 ──
284
- _injectHintBar(inputContainer || textarea.parentElement);
299
+ _injectHintBar(inputContainer || textarea.parentElement, toolbarRow);
285
300
 
286
301
  return true;
287
302
  }
288
303
 
289
304
  /** 注入提示栏到输入区域上方 */
290
- function _injectHintBar(anchorEl) {
305
+ function _injectHintBar(anchorEl, toolbarEl) {
291
306
  if (!anchorEl || document.querySelector('.openagent-hint-bar')) return;
292
307
 
293
308
  const hintBar = document.createElement('div');
@@ -323,8 +338,95 @@ function _injectHintBar(anchorEl) {
323
338
  hintBar.style.display = 'none';
324
339
  });
325
340
 
341
+ // ── V2 版本兼容:≥ 2026.6.9 使用 absolute 定位,bottom 动态跟随输入区高度 ──
342
+ var isV2 = typeof _clIsHostVersionGte === 'function' && _clIsHostVersionGte('2026.6.9');
343
+ if (isV2) {
344
+ hintBar.style.position = 'absolute';
345
+ }
346
+
326
347
  // 插入到 wrapper 外面、上方
327
348
  anchorEl.parentElement.insertBefore(hintBar, anchorEl);
349
+
350
+ function _findHintBarToolbar() {
351
+ if (toolbarEl) return toolbarEl;
352
+ var parentEl = anchorEl.parentElement;
353
+ if (parentEl) {
354
+ for (var i = 0; i < parentEl.children.length; i++) {
355
+ var child = parentEl.children[i];
356
+ if (child !== anchorEl && child.className && String(child.className).indexOf('agent-chat__toolbar') !== -1) {
357
+ return child;
358
+ }
359
+ }
360
+ }
361
+ return anchorEl.closest && anchorEl.closest('.agent-chat__input')
362
+ ? anchorEl.closest('.agent-chat__input').querySelector('.agent-chat__toolbar')
363
+ : null;
364
+ }
365
+
366
+ function _readElementHeight(el) {
367
+ if (!el) return 0;
368
+ var rect = el.getBoundingClientRect ? el.getBoundingClientRect() : null;
369
+ if (rect && rect.height > 0) return rect.height;
370
+ return typeof el.offsetHeight === 'number' ? el.offsetHeight : 0;
371
+ }
372
+
373
+ // 跟随 composer wrapper 的实际尺寸。侧栏拖拽/布局重排不一定触发 window resize。
374
+ function _syncHintBarLayout() {
375
+ var rect = anchorEl.getBoundingClientRect();
376
+ if (rect.width > 0) {
377
+ hintBar.style.width = rect.width + 'px';
378
+ var rootStyle = document.documentElement && document.documentElement.style;
379
+ if (rootStyle) {
380
+ rootStyle.setProperty('--openagent-input-wrapper-right-offset', Math.max(0, window.innerWidth - rect.right) + 'px');
381
+ rootStyle.setProperty('--openagent-input-wrapper-right-edge', Math.max(0, rect.right) + 'px');
382
+ rootStyle.setProperty('--openagent-input-wrapper-width', rect.width + 'px');
383
+ }
384
+ _syncSidebarRightEdge(rect);
385
+ }
386
+ if (isV2) {
387
+ var toolbar = _findHintBarToolbar();
388
+ var bottom = _readElementHeight(anchorEl) + _readElementHeight(toolbar) + 6;
389
+ hintBar.style.bottom = bottom + 'px';
390
+ }
391
+ }
392
+
393
+ function _syncSidebarRightEdge(inputRect) {
394
+ var sidebars = document.querySelectorAll('.chat-sidebar');
395
+ for (var i = 0; i < sidebars.length; i++) {
396
+ var sidebar = sidebars[i];
397
+ var sidebarRect = sidebar.getBoundingClientRect();
398
+ if (!sidebarRect || sidebarRect.width <= 0) continue;
399
+ var left = Math.max(0, sidebarRect.left);
400
+ var targetRight = Math.min(window.innerWidth, Math.max(0, inputRect.right));
401
+ var targetWidth = Math.floor(targetRight - left);
402
+ if (targetWidth <= 0) continue;
403
+ sidebar.style.setProperty('--openagent-sidebar-target-width', targetWidth + 'px');
404
+ sidebar.style.setProperty('width', targetWidth + 'px', 'important');
405
+ sidebar.style.setProperty('max-width', targetWidth + 'px', 'important');
406
+ sidebar.style.setProperty('flex-basis', targetWidth + 'px', 'important');
407
+ sidebar.style.setProperty('margin-right', '0px', 'important');
408
+ }
409
+ }
410
+
411
+ function _scheduleHintBarLayoutSync() {
412
+ window.requestAnimationFrame
413
+ ? window.requestAnimationFrame(_syncHintBarLayout)
414
+ : setTimeout(_syncHintBarLayout, 0);
415
+ }
416
+
417
+ _syncHintBarLayout();
418
+ _scheduleHintBarLayoutSync();
419
+ window.addEventListener('resize', _scheduleHintBarLayoutSync);
420
+ if (typeof ResizeObserver === 'function') {
421
+ var hintBarResizeObserver = new ResizeObserver(_scheduleHintBarLayoutSync);
422
+ hintBarResizeObserver.observe(anchorEl);
423
+ var toolbarForResize = _findHintBarToolbar();
424
+ if (toolbarForResize) hintBarResizeObserver.observe(toolbarForResize);
425
+ }
426
+ if (typeof MutationObserver === 'function' && document.body) {
427
+ var sidebarLayoutObserver = new MutationObserver(_scheduleHintBarLayoutSync);
428
+ sidebarLayoutObserver.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['class'] });
429
+ }
328
430
  }
329
431
 
330
432
  // ════════════════════════════════════════════════════════════════
@@ -1,10 +1,13 @@
1
1
  // ── 样式注入 ──
2
2
 
3
3
  function injectStyles() {
4
- if (document.getElementById('openagent-override-styles')) return;
4
+ var oldStyle = document.getElementById('openagent-override-styles');
5
+ if (oldStyle) oldStyle.remove();
5
6
 
6
7
  const style = document.createElement('style');
7
8
  style.id = 'openagent-override-styles';
9
+ style.setAttribute('data-openagent-style', 'agent-book-panel');
10
+ style.setAttribute('data-openagent-host-version', CL.hostVersion || 'unknown');
8
11
  style.textContent = `
9
12
  /* ── 流式回复边框闪烁:覆盖为蓝色 ── */
10
13
  @keyframes chatStreamPulse {
@@ -73,7 +76,6 @@ function injectStyles() {
73
76
  background: var(--oa-panel-bg, #fff);
74
77
  border: 0.5px solid #dbdbdb;
75
78
  border-radius: 16px;
76
- 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));
77
79
  z-index: 99999;
78
80
  overflow: hidden;
79
81
  display: none;
@@ -82,9 +84,17 @@ function injectStyles() {
82
84
  padding: 14px;
83
85
  font-family: "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
84
86
  box-sizing: border-box;
87
+ scrollbar-width: none;
88
+ -ms-overflow-style: none;
89
+ }
90
+ .openagent-agent-panel::-webkit-scrollbar {
91
+ width: 0;
92
+ height: 0;
93
+ display: none;
85
94
  }
86
95
  .openagent-agent-panel.visible {
87
96
  display: flex;
97
+ padding: 30px;
88
98
  animation: openagent-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
89
99
  }
90
100
  @keyframes openagent-up {
@@ -98,22 +108,21 @@ function injectStyles() {
98
108
  justify-content: space-between;
99
109
  align-items: center;
100
110
  min-height: 26px;
101
- padding: 6px 10px 0 10px;
102
111
  border-bottom: none;
103
112
  }
104
113
  .openagent-panel-title {
105
114
  display: flex;
106
115
  align-items: center;
107
116
  gap: 6px;
108
- font-size: 16px;
117
+ font-size: 18px;
109
118
  font-weight: 500;
110
- color: rgba(47, 47, 51, 0.8);
119
+ color: #333;
111
120
  text-transform: uppercase;
112
121
  letter-spacing: 0.3px;
113
122
  }
114
123
  .openagent-panel-title-icon {
115
- width: 21px;
116
- height: 21px;
124
+ width: 24px;
125
+ height: 24px;
117
126
  flex-shrink: 0;
118
127
  }
119
128
  .openagent-panel-close {
@@ -140,7 +149,7 @@ function injectStyles() {
140
149
  .openagent-panel-divider {
141
150
  height: 0;
142
151
  border: none;
143
- border-top: 0.2px solid rgba(47, 47, 51, 0.16);
152
+ border-top: 0.2px solid #EAEAEA;
144
153
  margin: 0;
145
154
  }
146
155
 
@@ -319,32 +328,23 @@ function injectStyles() {
319
328
  flex: 1;
320
329
  display: flex;
321
330
  flex-direction: column;
322
- gap: 14px;
323
331
  min-height: 0;
324
332
  max-height: min(56vh, 451px);
325
- scrollbar-width: thin;
326
- scrollbar-color: #ddd transparent;
333
+ scrollbar-width: none;
334
+ -ms-overflow-style: none;
327
335
  }
328
336
  .openagent-agent-list::-webkit-scrollbar {
329
- width: 4px;
330
- }
331
- .openagent-agent-list::-webkit-scrollbar-track {
332
- background: transparent;
333
- }
334
- .openagent-agent-list::-webkit-scrollbar-thumb {
335
- background: #ddd;
336
- border-radius: 2px;
337
- }
338
- .openagent-agent-list::-webkit-scrollbar-thumb:hover {
339
- background: #bbb;
337
+ width: 0;
338
+ height: 0;
339
+ display: none;
340
340
  }
341
341
 
342
342
  .openagent-agent-section {
343
343
  display: flex;
344
344
  flex-direction: column;
345
- gap: 8px;
346
345
  width: 100%;
347
346
  min-width: 0;
347
+ margin-bottom: 30px;
348
348
  }
349
349
 
350
350
  /* ── 父分类标题(两级结构:Research > Market Research) ── */
@@ -355,33 +355,22 @@ function injectStyles() {
355
355
  width: 100%;
356
356
  min-width: 0;
357
357
  }
358
- .openagent-parent-heading {
359
- font-size: 11px;
360
- font-weight: 600;
361
- line-height: 13px;
362
- color: rgba(47, 47, 51, 0.45);
363
- padding: 0 12px;
364
- text-transform: uppercase;
365
- letter-spacing: 0.8px;
366
- }
367
-
368
358
  /* ── 分组标题 ── */
369
359
  .openagent-section-heading {
370
360
  font-size: 16px;
371
361
  font-weight: 400;
372
362
  line-height: 16px;
373
363
  color: rgba(47, 47, 51, 0.80);
374
- padding: 0 12px 0 12px;
375
364
  letter-spacing: 0;
365
+ margin-bottom: 20px;
376
366
  }
377
367
 
378
368
  /* ── 分组网格容器 ── */
379
369
  .openagent-section-grid {
380
370
  display: grid;
381
- grid-template-columns: repeat(3, minmax(0, 439.5px));
371
+ grid-template-columns: repeat(3, 1fr);
382
372
  justify-content: start;
383
- gap: 8px 14px;
384
- padding: 0 12px;
373
+ gap: 12px;
385
374
  width: 100%;
386
375
  box-sizing: border-box;
387
376
  }
@@ -414,9 +403,15 @@ function injectStyles() {
414
403
  .agent-card__body { flex: 1; min-width: 0; }
415
404
  .agent-card__name-line { display: flex; align-items: baseline; gap: 8px; }
416
405
  .agent-card__name {
406
+ display: block;
407
+ min-width: 0;
408
+ max-width: 100%;
417
409
  font-family: "PingFang SC", sans-serif;
418
410
  font-weight: 600;
419
411
  color: rgba(47, 47, 51, 1);
412
+ white-space: nowrap;
413
+ overflow: hidden;
414
+ text-overflow: ellipsis;
420
415
  }
421
416
  .agent-card__tag { font-size: 12px; color: #6366f1; font-weight: 500; }
422
417
  .agent-card__specialty { font-size: 12px; color: #999; font-weight: 400; }
@@ -491,12 +486,31 @@ function injectStyles() {
491
486
  border-radius: 20px;
492
487
  border: 0.5px solid #dbdbdb;
493
488
  background: #fff;
494
- min-height: 0;
495
489
  min-width: 0;
496
490
  box-sizing: border-box;
497
491
  }
498
492
  .agent-card--mention:hover {
499
- background: rgba(0, 0, 0, 0.02);
493
+ border-color: transparent;
494
+ box-shadow: 0 4px 12px 0 rgba(149, 147, 240, 0.10);
495
+ }
496
+ .openagent-agent-list .agent-card--mention:hover,
497
+ .openagent-agent-list .agent-card--search:hover {
498
+ position: relative;
499
+ border-color: transparent;
500
+ }
501
+ .openagent-agent-list .agent-card--mention:hover::after,
502
+ .openagent-agent-list .agent-card--search:hover::after {
503
+ content: "";
504
+ position: absolute;
505
+ inset: 0;
506
+ border-radius: inherit;
507
+ padding: 1px;
508
+ background: linear-gradient(90deg, rgba(92, 74, 255, 0.5), rgba(130, 116, 255, 0.5));
509
+ pointer-events: none;
510
+ box-sizing: border-box;
511
+ -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
512
+ -webkit-mask-composite: xor;
513
+ mask-composite: exclude;
500
514
  }
501
515
  /* avart 外壳简化 — 不再需要 */
502
516
  .agent-card--mention .agent-card__avart {
@@ -625,9 +639,6 @@ function injectStyles() {
625
639
  border: 0.5px solid transparent;
626
640
  box-sizing: border-box;
627
641
  }
628
- .agent-card--search:hover {
629
- background: rgba(0, 0, 0, 0.02);
630
- }
631
642
  .agent-card--search .agent-card__avatar {
632
643
  width: 40px;
633
644
  height: 40px;
@@ -745,7 +756,6 @@ function injectStyles() {
745
756
  [data-theme-mode="dark"] .openagent-agent-panel,
746
757
  [data-theme="dark"] .openagent-agent-panel {
747
758
  background: #1c1c1c; border-color: rgba(255,255,255,0.12);
748
- box-shadow: 0 -4px 24px rgba(0,0,0,0.3);
749
759
  }
750
760
  [data-theme-mode="dark"] .openagent-panel-head,
751
761
  [data-theme="dark"] .openagent-panel-head { border-color: #2a2a2a; }
@@ -757,8 +767,6 @@ function injectStyles() {
757
767
  [data-theme="dark"] .openagent-panel-close:hover { background: #333; }
758
768
  [data-theme-mode="dark"] .openagent-section-heading,
759
769
  [data-theme="dark"] .openagent-section-heading { color: rgba(224, 224, 224, 0.45); }
760
- [data-theme-mode="dark"] .openagent-parent-heading,
761
- [data-theme="dark"] .openagent-parent-heading { color: rgba(224, 224, 224, 0.3); }
762
770
  [data-theme-mode="dark"] .openagent-panel-divider,
763
771
  [data-theme="dark"] .openagent-panel-divider { border-color: rgba(255,255,255,0.1); }
764
772
 
@@ -772,7 +780,7 @@ function injectStyles() {
772
780
  [data-theme-mode="dark"] .agent-card--mention,
773
781
  [data-theme="dark"] .agent-card--mention { background: #1c1c1c; border-color: rgba(255,255,255,0.12); }
774
782
  [data-theme-mode="dark"] .agent-card--mention:hover,
775
- [data-theme="dark"] .agent-card--mention:hover { background: #252525; }
783
+ [data-theme="dark"] .agent-card--mention:hover { border-color: transparent; }
776
784
  [data-theme-mode="dark"] .agent-card--mention .agent-card__name,
777
785
  [data-theme="dark"] .agent-card--mention .agent-card__name { color: #e0e0e0; }
778
786
  [data-theme-mode="dark"] .agent-card--mention .agent-card__bio,
@@ -787,8 +795,6 @@ function injectStyles() {
787
795
  }
788
796
  [data-theme-mode="dark"] .agent-card--mention .agent-card__action:hover,
789
797
  [data-theme="dark"] .agent-card--mention .agent-card__action:hover { background: rgba(255,255,255,0.06); }
790
- [data-theme-mode="dark"] .agent-card--search:hover,
791
- [data-theme="dark"] .agent-card--search:hover { background: #252525; }
792
798
  [data-theme-mode="dark"] .agent-card--search .agent-card__name,
793
799
  [data-theme="dark"] .agent-card--search .agent-card__name { color: #e0e0e0; }
794
800
  [data-theme-mode="dark"] .agent-card--search .agent-card__bio,
@@ -103,10 +103,12 @@ registerComponent('agent-card', async (data) => {
103
103
  function _clHandleTripDataSignal(payload, contextNode) {
104
104
  if (!payload) return;
105
105
  console.log('[trip-data] detected signal, payload:', payload.substring(0, 40));
106
+ const hostTextContextSelector = (typeof CL !== 'undefined' && CL.hostAdapter && CL.hostAdapter.selectors && CL.hostAdapter.selectors.textContext)
107
+ || '.chat-text';
106
108
 
107
109
  if (payload === 'file') {
108
110
  const chatText = contextNode && contextNode.closest
109
- ? contextNode.closest('.chat-text, .chat-tool-card__detail, .chat-tools-collapse__body')
111
+ ? contextNode.closest(hostTextContextSelector)
110
112
  : null;
111
113
  if (chatText) {
112
114
  chatText.dataset.clProcessed = '';
@@ -123,7 +125,7 @@ function _clHandleTripDataSignal(payload, contextNode) {
123
125
  }
124
126
  console.log('[trip-data] ✅ Card data from base64');
125
127
  const chatText = contextNode && contextNode.closest
126
- ? contextNode.closest('.chat-text, .chat-tool-card__detail, .chat-tools-collapse__body')
128
+ ? contextNode.closest(hostTextContextSelector)
127
129
  : null;
128
130
  if (chatText) {
129
131
  chatText.dataset.clProcessed = '';
@@ -6,9 +6,12 @@
6
6
  // ── 1. CSS 注入 ──
7
7
 
8
8
  (function injectThoughtChainStyles() {
9
- if (document.getElementById('cl-tools-collapse-css')) return;
9
+ var oldStyle = document.getElementById('cl-tools-collapse-css');
10
+ if (oldStyle) oldStyle.remove();
10
11
  const style = document.createElement('style');
11
12
  style.id = 'cl-tools-collapse-css';
13
+ style.setAttribute('data-openagent-style', 'thought-chain');
14
+ style.setAttribute('data-openagent-host-version', CL.hostVersion || 'unknown');
12
15
  style.textContent = `
13
16
  /* ── Agent Pill(通用身份标签) ── */
14
17
  .cl-agent-pill {
@@ -5,20 +5,32 @@
5
5
 
6
6
  // CL.clScanCount lives on CL.clScanCount
7
7
 
8
+ function _clIsInsideNativeToolHost(node) {
9
+ var adapter = CL && CL.hostAdapter;
10
+ var cur = node;
11
+ var hops = 0;
12
+ while (cur && cur !== document.body && hops < 12) {
13
+ if (adapter && adapter.isToolLikeShell && adapter.isToolLikeShell(cur)) return true;
14
+ cur = cur.parentElement;
15
+ hops++;
16
+ }
17
+ return !!(node && node.closest && node.closest('details'));
18
+ }
19
+
8
20
  function _clScan() {
9
21
  CL.clScanCount++;
10
22
 
11
23
  // ── 0.5 清理标记 → 显示为 @agentName ──
12
- // 新格式: {openagent_call_remote_agent:agent_id="...",agent_name="...",instruction="..."}
24
+ // 新格式: {openagent_call_remote_agent:agent_id="...",agent_name="...",agent_bio="...",instruction="..."}
13
25
  // 旧格式: {openagent:agent_id="...",agent_name="..."}
14
26
  // 两种都要匹配清理;这里只处理普通聊天气泡,不处理 ToolCard。
15
27
  var CL_MENTION_STYLE = '';
16
28
  document.querySelectorAll('.chat-bubble').forEach(function(el) {
17
29
  if (el.dataset.clMarkerCleaned) return;
18
- if (el.closest('.chat-tool-card, .chat-tools-collapse, details')) return;
30
+ if (_clIsInsideNativeToolHost(el)) return;
19
31
 
20
32
  var text = el.textContent || '';
21
- var rawRegex = /\{openagent(?:_call_remote_agent)?:agent_id="([^"]*)",agent_name="([^"]*)"(?:,instruction="[^"]*")?\}\s*/g;
33
+ var rawRegex = /\{openagent(?:_call_remote_agent)?:agent_id="([^"]*)",agent_name="([^"]*)"(?:,[^{}]*)?\}\s*/g;
22
34
  if (!rawRegex.test(text)) return;
23
35
 
24
36
  if (el.querySelector('.cl-remote-agent-card')) {
@@ -26,7 +38,7 @@ function _clScan() {
26
38
  return; // 包含活 DOM,跳过 innerHTML 重写
27
39
  }
28
40
 
29
- var htmlRegex = /\{openagent(?:_call_remote_agent)?:agent_id=(?:&quot;|")([^&"]*)(?:&quot;|"),agent_name=(?:&quot;|")([^&"]*)(?:&quot;|")(?:,instruction=(?:&quot;|")[^&"]*(?:&quot;|"))?\}\s*/g;
41
+ var htmlRegex = /\{openagent(?:_call_remote_agent)?:agent_id=(?:&quot;|")([^&"]*)(?:&quot;|"),agent_name=(?:&quot;|")([^&"]*)(?:&quot;|")(?:,[^{}]*)?\}\s*/g;
30
42
  if (CL && typeof CL.diagHtmlRewrite === 'function') {
31
43
  CL.diagHtmlRewrite('scanner.marker.before', el, { scan: CL.clScanCount });
32
44
  }
@@ -61,7 +73,7 @@ function _clScan() {
61
73
  if (mentionedAgents.length > 0) {
62
74
  document.querySelectorAll('.chat-bubble').forEach(function(el) {
63
75
  if (el.dataset.clAgentStyled) return;
64
- if (el.closest('.chat-tool-card, .chat-tools-collapse, details')) return;
76
+ if (_clIsInsideNativeToolHost(el)) return;
65
77
 
66
78
  var text = el.textContent || '';
67
79
  var html = el.innerHTML;
@@ -1,5 +1,10 @@
1
1
  // ── 1. CSS 注入 ──
2
+ var _oldTripCSS = document.getElementById('openagent-trip-card-styles');
3
+ if (_oldTripCSS) _oldTripCSS.remove();
2
4
  const _tripCSS = document.createElement('style');
5
+ _tripCSS.id = 'openagent-trip-card-styles';
6
+ _tripCSS.setAttribute('data-openagent-style', 'trip-card');
7
+ _tripCSS.setAttribute('data-openagent-host-version', CL.hostVersion || 'unknown');
3
8
  _tripCSS.textContent = `
4
9
  /* ── 行程文字:普通文字灰色,特殊标注(粗体/链接/标题)黑色 ── */
5
10
  .trip-styled li, .trip-styled p { color: #888 !important; }
@@ -74,7 +79,13 @@ margin: 0 8px; position: relative; top: -1px;
74
79
  .trip-img-card {
75
80
  display: flex; flex-direction: row; gap: 6px;
76
81
  overflow-x: auto; padding: 8px 0; margin-left: 20px;
77
- scrollbar-width: thin;
82
+ scrollbar-width: none;
83
+ -ms-overflow-style: none;
84
+ }
85
+ .trip-img-card::-webkit-scrollbar {
86
+ width: 0;
87
+ height: 0;
88
+ display: none;
78
89
  }
79
90
  .trip-img-item {
80
91
  position: relative; width: 191px; height: 100px; border-radius: 8px;
@@ -26,9 +26,104 @@ function _startClObserver() {
26
26
  _clObserverTarget = document.querySelector('openclaw-app') || document.body;
27
27
  _clObserver.observe(_clObserverTarget, { childList: true, subtree: true });
28
28
  setTimeout(_debouncedClScan, 2000);
29
+ setTimeout(_clCheckPluginUpdateStatus, 5000);
29
30
  /* muted */ void 0;
30
31
  }
31
32
 
33
+ function _clCheckPluginUpdateStatus() {
34
+ fetch('/plugins/openagent/update-status', { cache: 'no-store' })
35
+ .then(function(res) {
36
+ if (!res.ok) return null;
37
+ return res.json();
38
+ })
39
+ .then(function(status) {
40
+ if (!status || !status.updateAvailable) return;
41
+ _clShowPluginUpdateNotice(status);
42
+ })
43
+ .catch(function() {});
44
+ }
45
+
46
+ function _clShowPluginUpdateNotice(status) {
47
+ var latestVersion = String(status.latestVersion || '').trim();
48
+ var currentVersion = String(status.currentVersion || '').trim();
49
+ var dismissKey = 'openagent-update-dismissed-' + latestVersion;
50
+ try {
51
+ if (latestVersion && localStorage.getItem(dismissKey) === '1') return;
52
+ } catch (e) {}
53
+
54
+ var existing = document.getElementById('openagent-update-notice');
55
+ if (existing) existing.remove();
56
+
57
+ var notice = document.createElement('div');
58
+ notice.id = 'openagent-update-notice';
59
+ notice.style.cssText = [
60
+ 'position:fixed',
61
+ 'right:18px',
62
+ 'bottom:18px',
63
+ 'z-index:2147483647',
64
+ 'max-width:360px',
65
+ 'padding:14px 16px',
66
+ 'border:1px solid rgba(0,0,0,0.08)',
67
+ 'border-radius:12px',
68
+ 'background:#fff',
69
+ 'box-shadow:0 12px 32px rgba(15,23,42,0.16)',
70
+ 'font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif',
71
+ 'color:#1f2937',
72
+ 'font-size:13px',
73
+ 'line-height:1.5'
74
+ ].join(';');
75
+
76
+ var title = document.createElement('div');
77
+ title.textContent = 'OpenAgent 有新版本 ' + latestVersion;
78
+ title.style.cssText = 'font-weight:600;font-size:14px;margin-right:22px;margin-bottom:4px;';
79
+ notice.appendChild(title);
80
+
81
+ var body = document.createElement('div');
82
+ var command = String(status.installCommand || 'npx -y openclaw-openagent-cli update');
83
+ body.textContent = currentVersion ? ('当前版本 ' + currentVersion + ',运行命令完成更新。') : '运行命令完成更新。';
84
+ body.style.cssText = 'color:#4b5563;margin-bottom:10px;';
85
+ notice.appendChild(body);
86
+
87
+ var code = document.createElement('code');
88
+ code.textContent = command;
89
+ code.style.cssText = 'display:block;white-space:normal;word-break:break-all;background:#f6f7f9;border-radius:8px;padding:8px 10px;color:#111827;';
90
+ notice.appendChild(code);
91
+
92
+ var actions = document.createElement('div');
93
+ actions.style.cssText = 'display:flex;justify-content:flex-end;gap:8px;margin-top:10px;';
94
+ var copy = document.createElement('button');
95
+ copy.type = 'button';
96
+ copy.textContent = '复制命令';
97
+ copy.style.cssText = 'border:1px solid #d1d5db;background:#fff;border-radius:8px;padding:6px 10px;cursor:pointer;color:#374151;';
98
+ copy.onclick = function() {
99
+ try {
100
+ navigator.clipboard.writeText(command);
101
+ copy.textContent = '已复制';
102
+ } catch (e) {}
103
+ };
104
+ actions.appendChild(copy);
105
+
106
+ var close = document.createElement('button');
107
+ close.type = 'button';
108
+ close.textContent = '关闭';
109
+ close.style.cssText = 'border:0;background:#111827;color:#fff;border-radius:8px;padding:6px 10px;cursor:pointer;';
110
+ close.onclick = function() {
111
+ try {
112
+ if (latestVersion) localStorage.setItem(dismissKey, '1');
113
+ } catch (e) {}
114
+ notice.remove();
115
+ };
116
+ actions.appendChild(close);
117
+ notice.appendChild(actions);
118
+
119
+ if (status.policy === 'auto' && status.autoUpdateStarted) {
120
+ body.textContent = '正在自动更新,OpenClaw Gateway 可能会自动重启。';
121
+ actions.remove();
122
+ }
123
+
124
+ document.body.appendChild(notice);
125
+ }
126
+
32
127
  if (document.readyState === 'loading') {
33
128
  document.addEventListener('DOMContentLoaded', _startClObserver);
34
129
  } else {