openclaw-openagent 1.0.11 → 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.
- package/dist/index.js +1 -1
- package/dist/src/app/remote-agent-tool.js +110 -14
- package/dist/src/app/types.d.ts +2 -2
- package/dist/src/plugin-ui/adapters/adapters/oc-2026-04.js +103 -0
- package/dist/src/plugin-ui/adapters/adapters/oc-2026-05.js +125 -0
- package/dist/src/plugin-ui/adapters/adapters/oc-2026-06.js +125 -0
- package/dist/src/plugin-ui/adapters/adapters/oc-unknown.js +48 -0
- package/dist/src/plugin-ui/adapters/oc-2026-04.js +103 -0
- package/dist/src/plugin-ui/adapters/oc-2026-05.js +125 -0
- package/dist/src/plugin-ui/adapters/oc-2026-06.js +125 -0
- package/dist/src/plugin-ui/adapters/oc-unknown.js +48 -0
- package/dist/src/plugin-ui/assets/openagent-override.js +1007 -258
- package/dist/src/plugin-ui/index.d.ts +1 -1
- package/dist/src/plugin-ui/index.js +2 -2
- package/dist/src/plugin-ui/ui-extension-loader/index.d.ts +2 -1
- package/dist/src/plugin-ui/ui-extension-loader/index.js +5 -5
- package/dist/src/plugin-ui/ui-extension-loader/registry-regex.js +75 -8
- package/dist/src/plugin-ui/ui-extension-loader/types.d.ts +4 -1
- package/dist/src/state/store.d.ts +21 -0
- package/dist/src/state/store.js +54 -0
- package/dist/src/transport/oasn/oasn-invocation.d.ts +3 -0
- package/dist/src/transport/oasn/oasn-invocation.js +28 -12
- package/dist/src/transport/oasn/oasn-types.d.ts +8 -4
- package/index.ts +1 -1
- package/package.json +4 -3
- package/src/app/remote-agent-tool.ts +131 -16
- package/src/app/types.ts +2 -2
- package/src/plugin-ui/adapters/oc-2026-04.js +103 -0
- package/src/plugin-ui/adapters/oc-2026-05.js +125 -0
- package/src/plugin-ui/adapters/oc-2026-06.js +125 -0
- package/src/plugin-ui/adapters/oc-unknown.js +48 -0
- package/src/plugin-ui/assets/openagent-override.js +1007 -258
- package/src/plugin-ui/build.cjs +249 -38
- package/src/plugin-ui/index.ts +2 -2
- package/src/plugin-ui/modules/agent-book/panel/agent-book.js +102 -12
- package/src/plugin-ui/modules/agent-book/panel/inject-ui.js +105 -3
- package/src/plugin-ui/modules/agent-book/panel/styles.js +42 -35
- package/src/plugin-ui/modules/agent-book/remote-agent-tool/components-core.js +4 -2
- package/src/plugin-ui/modules/agent-book/remote-agent-tool/thought-chain-card.js +4 -1
- package/src/plugin-ui/modules/agent-book/scanner.js +17 -5
- package/src/plugin-ui/modules/agent-book/travelcard/travel-styles.js +5 -0
- package/src/plugin-ui/modules/loader/shared-state.js +244 -20
- package/src/plugin-ui/modules/remote-agent/execution-card.js +54 -16
- package/src/plugin-ui/modules/remote-agent/native-style-adapter.js +5 -23
- package/src/plugin-ui/modules/remote-agent/output-card.js +13 -7
- package/src/plugin-ui/modules/remote-agent/render-hooks.js +53 -41
- package/src/plugin-ui/modules/remote-agent/styles.js +230 -88
- package/src/plugin-ui/modules/remote-agent/tool-card-model.js +72 -4
- package/src/plugin-ui/postinstall-deploy.cjs +52 -0
- package/src/plugin-ui/ui-extension-loader/index.ts +6 -6
- package/src/plugin-ui/ui-extension-loader/registry-regex.ts +81 -9
- package/src/plugin-ui/ui-extension-loader/types.ts +5 -1
- package/src/state/store.ts +80 -0
- package/src/transport/oasn/oasn-invocation.ts +47 -12
- package/src/transport/oasn/oasn-types.ts +6 -2
- 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
|
-
|
|
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
|
-
|
|
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;
|
|
@@ -85,6 +87,7 @@ function injectStyles() {
|
|
|
85
87
|
}
|
|
86
88
|
.openagent-agent-panel.visible {
|
|
87
89
|
display: flex;
|
|
90
|
+
padding: 30px;
|
|
88
91
|
animation: openagent-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
|
|
89
92
|
}
|
|
90
93
|
@keyframes openagent-up {
|
|
@@ -98,22 +101,21 @@ function injectStyles() {
|
|
|
98
101
|
justify-content: space-between;
|
|
99
102
|
align-items: center;
|
|
100
103
|
min-height: 26px;
|
|
101
|
-
padding: 6px 10px 0 10px;
|
|
102
104
|
border-bottom: none;
|
|
103
105
|
}
|
|
104
106
|
.openagent-panel-title {
|
|
105
107
|
display: flex;
|
|
106
108
|
align-items: center;
|
|
107
109
|
gap: 6px;
|
|
108
|
-
font-size:
|
|
110
|
+
font-size: 18px;
|
|
109
111
|
font-weight: 500;
|
|
110
|
-
color:
|
|
112
|
+
color: #333;
|
|
111
113
|
text-transform: uppercase;
|
|
112
114
|
letter-spacing: 0.3px;
|
|
113
115
|
}
|
|
114
116
|
.openagent-panel-title-icon {
|
|
115
|
-
width:
|
|
116
|
-
height:
|
|
117
|
+
width: 24px;
|
|
118
|
+
height: 24px;
|
|
117
119
|
flex-shrink: 0;
|
|
118
120
|
}
|
|
119
121
|
.openagent-panel-close {
|
|
@@ -140,7 +142,7 @@ function injectStyles() {
|
|
|
140
142
|
.openagent-panel-divider {
|
|
141
143
|
height: 0;
|
|
142
144
|
border: none;
|
|
143
|
-
border-top: 0.2px solid
|
|
145
|
+
border-top: 0.2px solid #EAEAEA;
|
|
144
146
|
margin: 0;
|
|
145
147
|
}
|
|
146
148
|
|
|
@@ -319,7 +321,6 @@ function injectStyles() {
|
|
|
319
321
|
flex: 1;
|
|
320
322
|
display: flex;
|
|
321
323
|
flex-direction: column;
|
|
322
|
-
gap: 14px;
|
|
323
324
|
min-height: 0;
|
|
324
325
|
max-height: min(56vh, 451px);
|
|
325
326
|
scrollbar-width: thin;
|
|
@@ -342,9 +343,9 @@ function injectStyles() {
|
|
|
342
343
|
.openagent-agent-section {
|
|
343
344
|
display: flex;
|
|
344
345
|
flex-direction: column;
|
|
345
|
-
gap: 8px;
|
|
346
346
|
width: 100%;
|
|
347
347
|
min-width: 0;
|
|
348
|
+
margin-bottom: 30px;
|
|
348
349
|
}
|
|
349
350
|
|
|
350
351
|
/* ── 父分类标题(两级结构:Research > Market Research) ── */
|
|
@@ -355,33 +356,22 @@ function injectStyles() {
|
|
|
355
356
|
width: 100%;
|
|
356
357
|
min-width: 0;
|
|
357
358
|
}
|
|
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
359
|
/* ── 分组标题 ── */
|
|
369
360
|
.openagent-section-heading {
|
|
370
361
|
font-size: 16px;
|
|
371
362
|
font-weight: 400;
|
|
372
363
|
line-height: 16px;
|
|
373
364
|
color: rgba(47, 47, 51, 0.80);
|
|
374
|
-
padding: 0 12px 0 12px;
|
|
375
365
|
letter-spacing: 0;
|
|
366
|
+
margin-bottom: 20px;
|
|
376
367
|
}
|
|
377
368
|
|
|
378
369
|
/* ── 分组网格容器 ── */
|
|
379
370
|
.openagent-section-grid {
|
|
380
371
|
display: grid;
|
|
381
|
-
grid-template-columns: repeat(3,
|
|
372
|
+
grid-template-columns: repeat(3, 1fr);
|
|
382
373
|
justify-content: start;
|
|
383
|
-
gap:
|
|
384
|
-
padding: 0 12px;
|
|
374
|
+
gap: 12px;
|
|
385
375
|
width: 100%;
|
|
386
376
|
box-sizing: border-box;
|
|
387
377
|
}
|
|
@@ -414,9 +404,15 @@ function injectStyles() {
|
|
|
414
404
|
.agent-card__body { flex: 1; min-width: 0; }
|
|
415
405
|
.agent-card__name-line { display: flex; align-items: baseline; gap: 8px; }
|
|
416
406
|
.agent-card__name {
|
|
407
|
+
display: block;
|
|
408
|
+
min-width: 0;
|
|
409
|
+
max-width: 100%;
|
|
417
410
|
font-family: "PingFang SC", sans-serif;
|
|
418
411
|
font-weight: 600;
|
|
419
412
|
color: rgba(47, 47, 51, 1);
|
|
413
|
+
white-space: nowrap;
|
|
414
|
+
overflow: hidden;
|
|
415
|
+
text-overflow: ellipsis;
|
|
420
416
|
}
|
|
421
417
|
.agent-card__tag { font-size: 12px; color: #6366f1; font-weight: 500; }
|
|
422
418
|
.agent-card__specialty { font-size: 12px; color: #999; font-weight: 400; }
|
|
@@ -491,12 +487,31 @@ function injectStyles() {
|
|
|
491
487
|
border-radius: 20px;
|
|
492
488
|
border: 0.5px solid #dbdbdb;
|
|
493
489
|
background: #fff;
|
|
494
|
-
min-height: 0;
|
|
495
490
|
min-width: 0;
|
|
496
491
|
box-sizing: border-box;
|
|
497
492
|
}
|
|
498
493
|
.agent-card--mention:hover {
|
|
499
|
-
|
|
494
|
+
border-color: transparent;
|
|
495
|
+
box-shadow: 0 4px 12px 0 rgba(149, 147, 240, 0.10);
|
|
496
|
+
}
|
|
497
|
+
.openagent-agent-list .agent-card--mention:hover,
|
|
498
|
+
.openagent-agent-list .agent-card--search:hover {
|
|
499
|
+
position: relative;
|
|
500
|
+
border-color: transparent;
|
|
501
|
+
}
|
|
502
|
+
.openagent-agent-list .agent-card--mention:hover::after,
|
|
503
|
+
.openagent-agent-list .agent-card--search:hover::after {
|
|
504
|
+
content: "";
|
|
505
|
+
position: absolute;
|
|
506
|
+
inset: 0;
|
|
507
|
+
border-radius: inherit;
|
|
508
|
+
padding: 1px;
|
|
509
|
+
background: linear-gradient(90deg, rgba(92, 74, 255, 0.5), rgba(130, 116, 255, 0.5));
|
|
510
|
+
pointer-events: none;
|
|
511
|
+
box-sizing: border-box;
|
|
512
|
+
-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
|
|
513
|
+
-webkit-mask-composite: xor;
|
|
514
|
+
mask-composite: exclude;
|
|
500
515
|
}
|
|
501
516
|
/* avart 外壳简化 — 不再需要 */
|
|
502
517
|
.agent-card--mention .agent-card__avart {
|
|
@@ -625,9 +640,6 @@ function injectStyles() {
|
|
|
625
640
|
border: 0.5px solid transparent;
|
|
626
641
|
box-sizing: border-box;
|
|
627
642
|
}
|
|
628
|
-
.agent-card--search:hover {
|
|
629
|
-
background: rgba(0, 0, 0, 0.02);
|
|
630
|
-
}
|
|
631
643
|
.agent-card--search .agent-card__avatar {
|
|
632
644
|
width: 40px;
|
|
633
645
|
height: 40px;
|
|
@@ -745,7 +757,6 @@ function injectStyles() {
|
|
|
745
757
|
[data-theme-mode="dark"] .openagent-agent-panel,
|
|
746
758
|
[data-theme="dark"] .openagent-agent-panel {
|
|
747
759
|
background: #1c1c1c; border-color: rgba(255,255,255,0.12);
|
|
748
|
-
box-shadow: 0 -4px 24px rgba(0,0,0,0.3);
|
|
749
760
|
}
|
|
750
761
|
[data-theme-mode="dark"] .openagent-panel-head,
|
|
751
762
|
[data-theme="dark"] .openagent-panel-head { border-color: #2a2a2a; }
|
|
@@ -757,8 +768,6 @@ function injectStyles() {
|
|
|
757
768
|
[data-theme="dark"] .openagent-panel-close:hover { background: #333; }
|
|
758
769
|
[data-theme-mode="dark"] .openagent-section-heading,
|
|
759
770
|
[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
771
|
[data-theme-mode="dark"] .openagent-panel-divider,
|
|
763
772
|
[data-theme="dark"] .openagent-panel-divider { border-color: rgba(255,255,255,0.1); }
|
|
764
773
|
|
|
@@ -772,7 +781,7 @@ function injectStyles() {
|
|
|
772
781
|
[data-theme-mode="dark"] .agent-card--mention,
|
|
773
782
|
[data-theme="dark"] .agent-card--mention { background: #1c1c1c; border-color: rgba(255,255,255,0.12); }
|
|
774
783
|
[data-theme-mode="dark"] .agent-card--mention:hover,
|
|
775
|
-
[data-theme="dark"] .agent-card--mention:hover {
|
|
784
|
+
[data-theme="dark"] .agent-card--mention:hover { border-color: transparent; }
|
|
776
785
|
[data-theme-mode="dark"] .agent-card--mention .agent-card__name,
|
|
777
786
|
[data-theme="dark"] .agent-card--mention .agent-card__name { color: #e0e0e0; }
|
|
778
787
|
[data-theme-mode="dark"] .agent-card--mention .agent-card__bio,
|
|
@@ -787,8 +796,6 @@ function injectStyles() {
|
|
|
787
796
|
}
|
|
788
797
|
[data-theme-mode="dark"] .agent-card--mention .agent-card__action:hover,
|
|
789
798
|
[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
799
|
[data-theme-mode="dark"] .agent-card--search .agent-card__name,
|
|
793
800
|
[data-theme="dark"] .agent-card--search .agent-card__name { color: #e0e0e0; }
|
|
794
801
|
[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(
|
|
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(
|
|
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
|
-
|
|
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
|
|
30
|
+
if (_clIsInsideNativeToolHost(el)) return;
|
|
19
31
|
|
|
20
32
|
var text = el.textContent || '';
|
|
21
|
-
var rawRegex = /\{openagent(?:_call_remote_agent)?:agent_id="([^"]*)",agent_name="([^"]*)"(?:,
|
|
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=(?:"|")([^&"]*)(?:"|"),agent_name=(?:"|")([^&"]*)(?:"|")(?:,
|
|
41
|
+
var htmlRegex = /\{openagent(?:_call_remote_agent)?:agent_id=(?:"|")([^&"]*)(?:"|"),agent_name=(?:"|")([^&"]*)(?:"|")(?:,[^{}]*)?\}\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
|
|
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; }
|