openclaw-openagent 1.0.0

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 (113) hide show
  1. package/index.ts +114 -0
  2. package/openclaw.plugin.json +159 -0
  3. package/package.json +79 -0
  4. package/skills/clawlink/SKILL.md +145 -0
  5. package/skills/clawlink/SKILL.md.bak +165 -0
  6. package/src/app/channel-tools.ts +249 -0
  7. package/src/app/discovery-tools.ts +273 -0
  8. package/src/app/hooks.ts +60 -0
  9. package/src/app/index.ts +78 -0
  10. package/src/app/messaging-tools.ts +79 -0
  11. package/src/app/ops-tools.ts +155 -0
  12. package/src/app/remote-agent-tool.ts +476 -0
  13. package/src/app/types.ts +67 -0
  14. package/src/app/verbose-preflight.ts +190 -0
  15. package/src/auth/config.ts +197 -0
  16. package/src/auth/credential-manager.ts +146 -0
  17. package/src/auth/index.ts +24 -0
  18. package/src/auth/verify.ts +99 -0
  19. package/src/channel.ts +565 -0
  20. package/src/compat.ts +82 -0
  21. package/src/config/config-schema.ts +39 -0
  22. package/src/messaging/aggregator.ts +120 -0
  23. package/src/messaging/collector.ts +89 -0
  24. package/src/messaging/executor.ts +72 -0
  25. package/src/messaging/inbound.ts +150 -0
  26. package/src/messaging/index.ts +11 -0
  27. package/src/messaging/mention-protocol.ts +94 -0
  28. package/src/messaging/process-c2c-request.ts +564 -0
  29. package/src/messaging/process-message.ts +373 -0
  30. package/src/messaging/scheduler.ts +55 -0
  31. package/src/messaging/types.ts +38 -0
  32. package/src/plugin-ui/assets/agentbook-icon.svg +5 -0
  33. package/src/plugin-ui/assets/magic.svg +5 -0
  34. package/src/plugin-ui/assets/openagent-override.js +9329 -0
  35. package/src/plugin-ui/build.cjs +175 -0
  36. package/src/plugin-ui/index.ts +18 -0
  37. package/src/plugin-ui/modules/agent-book/panel/agent-book.js +458 -0
  38. package/src/plugin-ui/modules/agent-book/panel/agent-card.js +154 -0
  39. package/src/plugin-ui/modules/agent-book/panel/agent-data.js +644 -0
  40. package/src/plugin-ui/modules/agent-book/panel/inject-ui.js +456 -0
  41. package/src/plugin-ui/modules/agent-book/panel/mention-state.js +206 -0
  42. package/src/plugin-ui/modules/agent-book/panel/styles.js +670 -0
  43. package/src/plugin-ui/modules/agent-book/remote-agent-tool/components-core.js +293 -0
  44. package/src/plugin-ui/modules/agent-book/remote-agent-tool/thought-chain-card.js +208 -0
  45. package/src/plugin-ui/modules/agent-book/scanner.js +119 -0
  46. package/src/plugin-ui/modules/agent-book/travelcard/travel-cards.js +500 -0
  47. package/src/plugin-ui/modules/agent-book/travelcard/travel-engine.js +652 -0
  48. package/src/plugin-ui/modules/agent-book/travelcard/travel-styles.js +251 -0
  49. package/src/plugin-ui/modules/loader/bootstrap.js +38 -0
  50. package/src/plugin-ui/modules/loader/shared-state.js +560 -0
  51. package/src/plugin-ui/modules/loader/ws-intercept.js +199 -0
  52. package/src/plugin-ui/modules/remote-agent/chunk-parser.js +161 -0
  53. package/src/plugin-ui/modules/remote-agent/execution-card.js +269 -0
  54. package/src/plugin-ui/modules/remote-agent/markdown-renderer.js +256 -0
  55. package/src/plugin-ui/modules/remote-agent/native-style-adapter.js +146 -0
  56. package/src/plugin-ui/modules/remote-agent/output-card.js +259 -0
  57. package/src/plugin-ui/modules/remote-agent/progress-store.js +363 -0
  58. package/src/plugin-ui/modules/remote-agent/render-hooks.js +1609 -0
  59. package/src/plugin-ui/modules/remote-agent/styles.js +668 -0
  60. package/src/plugin-ui/modules/remote-agent/tool-card-model.js +56 -0
  61. package/src/plugin-ui/ui-extension-loader/backup.ts +92 -0
  62. package/src/plugin-ui/ui-extension-loader/index.ts +276 -0
  63. package/src/plugin-ui/ui-extension-loader/locator.ts +152 -0
  64. package/src/plugin-ui/ui-extension-loader/manifest.ts +57 -0
  65. package/src/plugin-ui/ui-extension-loader/registry-regex.ts +729 -0
  66. package/src/plugin-ui/ui-extension-loader/removed-extensions.ts +70 -0
  67. package/src/plugin-ui/ui-extension-loader/types.ts +68 -0
  68. package/src/proxy/auth-proxy.ts +356 -0
  69. package/src/runtime/account.ts +572 -0
  70. package/src/runtime/index.ts +7 -0
  71. package/src/runtime/plugin-runtime.ts +94 -0
  72. package/src/runtime/registry.ts +71 -0
  73. package/src/sdk/CLASS_MAP.md +143 -0
  74. package/src/sdk/index.d.ts +126 -0
  75. package/src/sdk/index.js +23990 -0
  76. package/src/sdk/modules/cloud-search-module.js +1117 -0
  77. package/src/sdk/modules/follow-module.js +1069 -0
  78. package/src/sdk/modules/group-module.js +7397 -0
  79. package/src/sdk/modules/relationship-module.js +2269 -0
  80. package/src/sdk/modules/signaling-module.js +1468 -0
  81. package/src/sdk/modules/tim-upload-plugin.js +730 -0
  82. package/src/sdk/node-env/http-request.js +90 -0
  83. package/src/sdk/node-env/index.js +57 -0
  84. package/src/sdk/node-env/storage.js +114 -0
  85. package/src/sdk/package.json +10 -0
  86. package/src/sdk/tsconfig.json +16 -0
  87. package/src/state/pending-invocation-store.ts +43 -0
  88. package/src/state/store.ts +676 -0
  89. package/src/tim/c2c.ts +451 -0
  90. package/src/tim/channels.ts +364 -0
  91. package/src/tim/client.ts +330 -0
  92. package/src/tim/index.ts +18 -0
  93. package/src/tim/messages.ts +166 -0
  94. package/src/tim/sdk-logger-init.ts +50 -0
  95. package/src/tools.ts +10 -0
  96. package/src/transport/factory.ts +95 -0
  97. package/src/transport/oasn/index.ts +17 -0
  98. package/src/transport/oasn/oasn-agent-card.ts +111 -0
  99. package/src/transport/oasn/oasn-discovery.ts +108 -0
  100. package/src/transport/oasn/oasn-files.ts +210 -0
  101. package/src/transport/oasn/oasn-http.ts +483 -0
  102. package/src/transport/oasn/oasn-invocation.ts +527 -0
  103. package/src/transport/oasn/oasn-normalize.ts +159 -0
  104. package/src/transport/oasn/oasn-register.ts +106 -0
  105. package/src/transport/oasn/oasn-transport.ts +341 -0
  106. package/src/transport/oasn/oasn-types.ts +353 -0
  107. package/src/transport/tim/index.ts +8 -0
  108. package/src/transport/tim/tim-transport.ts +515 -0
  109. package/src/transport/types.ts +541 -0
  110. package/src/types/openclaw.d.ts +97 -0
  111. package/src/types/tencentcloud-chat.d.ts +15 -0
  112. package/src/util/http.ts +113 -0
  113. package/src/util/logger.ts +131 -0
@@ -0,0 +1,668 @@
1
+ // ── OpenAgent Remote Agent Card Styles ──
2
+ //
3
+ // 补充样式。核心样式(.cl-thought-chain, .cl-agent-pill, .cl-tools-collapse-*)
4
+ // 已由 thought-chain-card.js 注入,此处只补新增的类。
5
+ //
6
+ // 注意:不使用 .chat-tool-card 类名,避免 scanner.js 误匹配。
7
+
8
+ (function _clInjectRemoteAgentStyles() {
9
+ if (document.getElementById('cl-remote-agent-styles')) return;
10
+ var style = document.createElement('style');
11
+ style.id = 'cl-remote-agent-styles';
12
+ style.textContent = [
13
+ // ── RenderHook 远端 Agent 卡片接管 native tool header ──
14
+ 'details.chat-tools-collapse:has(.cl-remote-agent-card),',
15
+ 'details.chat-tool-msg-collapse:has(.cl-remote-agent-card),',
16
+ '.chat-tools-collapse:has(.cl-remote-agent-card),',
17
+ '.chat-tool-msg-collapse:has(.cl-remote-agent-card) {',
18
+ ' width: 100% !important;',
19
+ ' max-width: none !important;',
20
+ ' box-sizing: border-box !important;',
21
+ ' border: 0 !important;',
22
+ ' background: transparent !important;',
23
+ ' box-shadow: none !important;',
24
+ '}',
25
+ '/* Align output host shells with execution shells. 3.28 renders output as',
26
+ ' chat-tools-collapse + .cl-output-card; some versions use chat-tool-msg-collapse.',
27
+ ' Move the host shell, not the inner OpenAgent card. */',
28
+ 'details.chat-tools-collapse:has(.cl-output-card),',
29
+ '.chat-tools-collapse:has(.cl-output-card),',
30
+ 'details.chat-tool-msg-collapse:has(.cl-remote-agent-card),',
31
+ '.chat-tool-msg-collapse:has(.cl-remote-agent-card) {',
32
+ ' margin-left: 12px !important;',
33
+ '}',
34
+ 'details.chat-tools-collapse:has(.cl-remote-agent-card) > summary.chat-tools-summary,',
35
+ 'details.chat-tool-msg-collapse:has(.cl-remote-agent-card) > summary.chat-tool-msg-summary,',
36
+ '.chat-tools-collapse:has(.cl-remote-agent-card) > .chat-tools-summary,',
37
+ '.chat-tool-msg-collapse:has(.cl-remote-agent-card) > .chat-tool-msg-summary {',
38
+ ' display: none !important;',
39
+ '}',
40
+ '.chat-tools-collapse__body.cl-remote-agent-host-shell > .chat-text,',
41
+ '.chat-tool-msg-body.cl-remote-agent-host-shell > .chat-text {',
42
+ ' display: none !important;',
43
+ '}',
44
+ '.cl-remote-agent-raw-hidden > .chat-text,',
45
+ '.cl-remote-agent-raw-hidden.chat-bubble > .chat-text {',
46
+ ' display: none !important;',
47
+ '}',
48
+ '/* Phase A: 不依赖 host-shell class,用 :has() 直接隐藏宿主 raw text */',
49
+ '.chat-tools-collapse__body:has(.cl-remote-agent-card) > .chat-text,',
50
+ '.chat-tool-msg-body:has(.cl-remote-agent-card) > .chat-text,',
51
+ '.chat-tool-card__detail:has(.cl-remote-agent-card) > .chat-text,',
52
+ '.chat-tools-collapse__body:has(.cl-remote-agent-output-placeholder) > .chat-text,',
53
+ '.chat-tool-msg-body:has(.cl-remote-agent-output-placeholder) > .chat-text,',
54
+ '.chat-tool-card__detail:has(.cl-remote-agent-output-placeholder) > .chat-text {',
55
+ ' display: none !important;',
56
+ '}',
57
+ 'details.chat-tools-collapse:has(.cl-remote-agent-card) > .chat-tools-collapse__body,',
58
+ 'details.chat-tool-msg-collapse:has(.cl-remote-agent-card) > .chat-tool-msg-body,',
59
+ '.chat-tools-collapse:has(.cl-remote-agent-card) > .chat-tools-collapse__body,',
60
+ '.chat-tool-msg-collapse:has(.cl-remote-agent-card) > .chat-tool-msg-body {',
61
+ ' border: 0 !important;',
62
+ ' outline: 0 !important;',
63
+ ' background: transparent !important;',
64
+ ' box-shadow: none !important;',
65
+ ' padding: 0 !important;',
66
+ ' margin: 0 !important;',
67
+ '}',
68
+ '.chat-bubble:has(.cl-remote-agent-card) {',
69
+ ' border: 0 !important;',
70
+ ' background: transparent !important;',
71
+ ' box-shadow: none !important;',
72
+ ' padding-top: 0 !important;',
73
+ ' padding-bottom: 0 !important;',
74
+ '}',
75
+ '.chat-bubble:has(.cl-remote-agent-card) > .chat-text,',
76
+ '.chat-bubble:has(.cl-remote-agent-output-placeholder) > .chat-text {',
77
+ ' display: none !important;',
78
+ '}',
79
+ '.cl-remote-agent-host-shell {',
80
+ ' width: min(100%, 912px) !important;',
81
+ ' max-width: 100% !important;',
82
+ ' box-sizing: border-box !important;',
83
+ '}',
84
+ '.cl-remote-agent-host-shell.chat-tool-card,',
85
+ '.cl-remote-agent-host-shell.chat-tool-card__detail,',
86
+ '.cl-remote-agent-host-shell.chat-tools-collapse__body,',
87
+ '.cl-remote-agent-host-shell.chat-tool-msg-body,',
88
+ 'details.cl-remote-agent-host-shell {',
89
+ ' border: 0 !important;',
90
+ ' outline: 0 !important;',
91
+ ' background: transparent !important;',
92
+ ' box-shadow: none !important;',
93
+ '}',
94
+ '.cl-remote-agent-host-shell > summary.chat-tools-summary,',
95
+ '.cl-remote-agent-host-shell > summary.chat-tool-msg-summary {',
96
+ ' display: none !important;',
97
+ '}',
98
+ // ── 新卡片容器 ──
99
+ // 覆盖 OpenClaw .chat-tool-card 的 max-height: 120px 限制
100
+ '.cl-remote-agent-card {',
101
+ ' max-height: none;',
102
+ ' overflow: visible;',
103
+ ' width: fit-content;',
104
+ ' max-width: 100%;',
105
+ ' border: 1px solid color-mix(in srgb, var(--border, rgba(47,47,51,0.10)) 85%, transparent);',
106
+ ' border-radius: var(--cl-native-shell-radius, 14px);',
107
+ ' padding: var(--cl-native-shell-padding, 8px);',
108
+ ' background: var(--card, #fff);',
109
+ ' display: flex;',
110
+ ' flex-direction: column;',
111
+ ' gap: var(--cl-native-shell-gap, 4px);',
112
+ ' box-sizing: border-box;',
113
+ '}',
114
+
115
+ // ── 顶部 OpenAgent 标题条 ──
116
+ '.cl-openagent-header {',
117
+ ' width: fit-content;',
118
+ ' max-width: 100%;',
119
+ ' min-height: var(--cl-native-summary-min-height, 34px);',
120
+ ' display: flex;',
121
+ ' align-items: center;',
122
+ ' gap: var(--cl-native-summary-gap, 6px);',
123
+ ' padding: var(--cl-native-summary-padding, 6px 10px);',
124
+ ' box-sizing: border-box;',
125
+ ' border: 1px solid color-mix(in srgb, var(--border, rgba(47,47,51,0.10)) 85%, transparent);',
126
+ ' border-radius: var(--cl-native-summary-radius, 10px);',
127
+ ' background: color-mix(in srgb, var(--bg-hover, #F4F5F7) 50%, transparent);',
128
+ ' color: var(--text, #2F2F33);',
129
+ ' font-family: "PingFang SC", sans-serif;',
130
+ ' font-size: var(--cl-native-summary-font-size, 13px);',
131
+ ' line-height: var(--cl-native-summary-line-height, 1.2);',
132
+ '}',
133
+ '.cl-openagent-header-caret {',
134
+ ' width: 6px;',
135
+ ' color: var(--muted, rgba(47,47,51,0.45));',
136
+ ' font-size: 8px;',
137
+ ' line-height: 1;',
138
+ ' flex: 0 0 auto;',
139
+ '}',
140
+ '.cl-openagent-header-icon {',
141
+ ' position: relative;',
142
+ ' width: 15px;',
143
+ ' height: 14px;',
144
+ ' flex: 0 0 15px;',
145
+ '}',
146
+ '.cl-openagent-header-icon::before,',
147
+ '.cl-openagent-header-icon::after {',
148
+ ' content: "";',
149
+ ' position: absolute;',
150
+ ' width: 8px;',
151
+ ' height: 8px;',
152
+ ' border: 1.5px solid #10BDEB;',
153
+ ' border-radius: 2px;',
154
+ ' box-sizing: border-box;',
155
+ '}',
156
+ '.cl-openagent-header-icon::before { left: 2px; top: 5px; }',
157
+ '.cl-openagent-header-icon::after { left: 5px; top: 2px; }',
158
+ '.cl-openagent-header-title {',
159
+ ' display: flex;',
160
+ ' align-items: center;',
161
+ ' gap: 3px;',
162
+ ' min-width: 0;',
163
+ ' white-space: nowrap;',
164
+ '}',
165
+ '.cl-openagent-header-primary {',
166
+ ' color: var(--text, #2F2F33);',
167
+ ' font-weight: 600;',
168
+ ' overflow: hidden;',
169
+ ' text-overflow: ellipsis;',
170
+ '}',
171
+ '.cl-openagent-header-secondary {',
172
+ ' color: var(--muted, rgba(47,47,51,0.40));',
173
+ ' font-weight: 400;',
174
+ '}',
175
+ // ── Figma 内容框 ──
176
+ '.cl-thought-chain-content {',
177
+ ' width: 100%;',
178
+ ' min-height: 0;',
179
+ ' box-sizing: border-box;',
180
+ ' border: 1px solid color-mix(in srgb, var(--border, rgba(0,0,0,0.04)) 60%, transparent);',
181
+ ' border-radius: 8px;',
182
+ ' background: var(--card, #fff);',
183
+ ' padding: 8px;',
184
+ ' display: flex;',
185
+ ' flex-direction: column;',
186
+ ' align-items: flex-start;',
187
+ ' gap: 12px;',
188
+ '}',
189
+ // ── 共享展开态宿主清理 ──
190
+ 'details.chat-tools-collapse:has(.cl-thought-chain-content--execution),',
191
+ 'details.chat-tools-collapse:has(.cl-output-result),',
192
+ 'details.chat-tool-msg-collapse:has(.cl-thought-chain-content--execution),',
193
+ 'details.chat-tool-msg-collapse:has(.cl-output-result),',
194
+ '.chat-tools-collapse:has(.cl-thought-chain-content--execution),',
195
+ '.chat-tools-collapse:has(.cl-output-result),',
196
+ '.chat-tool-msg-collapse:has(.cl-thought-chain-content--execution),',
197
+ '.chat-tool-msg-collapse:has(.cl-output-result) {',
198
+ ' max-width: 100% !important;',
199
+ ' display: block !important;',
200
+ ' box-sizing: border-box !important;',
201
+ '}',
202
+ // ── 共享展开态 card 基础 ──
203
+ '.cl-remote-agent-card:has(.cl-thought-chain-content--execution),',
204
+ '.cl-remote-agent-card:has(.cl-output-result) {',
205
+ ' /* padding/radius/gap 继承 base card,不覆盖 */',
206
+ ' box-sizing: border-box;',
207
+ '}',
208
+ '.cl-remote-agent-card:has(.cl-thought-chain-content--execution:not(.cl-content-collapsed)) {',
209
+ ' width: 514px !important;',
210
+ ' max-width: 100%;',
211
+ '}',
212
+ '.cl-remote-agent-card:has(.cl-thought-chain-content:not(.cl-content-collapsed)) .cl-openagent-header {',
213
+ ' width: 100%;',
214
+ '}',
215
+ // ── 展开内容宽度:外层 card 保持 fit-content,content 出现时自然撑开 ──
216
+ '.cl-thought-chain-content--execution {',
217
+ ' width: 100%;',
218
+ '}',
219
+ '.cl-remote-agent-card:has(.cl-output-result) .cl-thought-chain-content {',
220
+ ' width: min(900px, 100%);',
221
+ '}',
222
+ // ── output 专用 content 样式 ──
223
+ '.cl-remote-agent-card:has(.cl-output-result) .cl-thought-chain-content {',
224
+ ' border: 1.5px solid color-mix(in srgb, var(--border, rgba(0,0,0,0.06)) 60%, transparent);',
225
+ ' border-radius: 12px;',
226
+ ' padding: 12px;',
227
+ ' gap: 12px;',
228
+ '}',
229
+ // ── Figma Agent pill(297:696)──
230
+ '.cl-agent-pill {',
231
+ ' display: inline-flex;',
232
+ ' align-items: center;',
233
+ ' justify-content: center;',
234
+ ' gap: 9px;',
235
+ ' height: 42px;',
236
+ ' min-height: 42px;',
237
+ ' padding: 0 15px;',
238
+ ' border: 0;',
239
+ ' border-radius: 9px;',
240
+ ' background: #FBFBFB;',
241
+ ' box-shadow: inset 0 0 0 1.2px rgba(47,47,51,0.06);',
242
+ ' width: fit-content;',
243
+ ' box-sizing: border-box;',
244
+ ' margin: 0;',
245
+ '}',
246
+ '.cl-agent-pill-avatar {',
247
+ ' width: 24px;',
248
+ ' height: 24px;',
249
+ ' border-radius: 50%;',
250
+ ' object-fit: cover;',
251
+ ' flex: 0 0 24px;',
252
+ ' border: 0.6px solid rgba(47,47,51,0.20);',
253
+ ' box-sizing: border-box;',
254
+ '}',
255
+ '.cl-agent-pill-name {',
256
+ ' display: inline-flex;',
257
+ ' align-items: center;',
258
+ ' font-family: "PingFang SC", sans-serif;',
259
+ ' font-size: 15px;',
260
+ ' color: rgba(47,47,51,0.90);',
261
+ ' line-height: 1.2;',
262
+ ' letter-spacing: 0;',
263
+ ' white-space: nowrap;',
264
+ '}',
265
+ '.cl-agent-pill-at { font-weight: 600; }',
266
+ '.cl-agent-pill-label { font-weight: 400; }',
267
+ '.cl-thought-chain-pill-slot {',
268
+ ' display: flex;',
269
+ ' align-items: center;',
270
+ ' width: 100%;',
271
+ '}',
272
+ '.cl-thought-chain-divider {',
273
+ ' display: none;',
274
+ '}',
275
+ '.cl-thought-chain-content--execution {',
276
+ ' border: 1.5px solid rgba(0,0,0,0.04);',
277
+ ' border-radius: 12px;',
278
+ ' padding: 12px;',
279
+ ' gap: 18px;',
280
+ '}',
281
+ '.cl-thought-chain-content--execution .cl-agent-pill {',
282
+ ' gap: 9px;',
283
+ ' height: 42px;',
284
+ ' min-height: 42px;',
285
+ ' padding: 0 15px;',
286
+ ' border: 0;',
287
+ ' border-radius: 9px;',
288
+ ' box-shadow: inset 0 0 0 1.2px rgba(47,47,51,0.06);',
289
+ '}',
290
+ '.cl-thought-chain-content--execution .cl-agent-pill-avatar {',
291
+ ' width: 24px;',
292
+ ' height: 24px;',
293
+ ' flex-basis: 24px;',
294
+ '}',
295
+ '.cl-thought-chain-content--execution .cl-agent-pill-name {',
296
+ ' font-size: 15px;',
297
+ ' line-height: 1.2;',
298
+ '}',
299
+ '.cl-remote-agent-card:has(.cl-output-result) .cl-agent-pill {',
300
+ ' gap: 9px;',
301
+ ' height: 42px;',
302
+ ' min-height: 42px;',
303
+ ' padding: 0 15px;',
304
+ ' border: 0;',
305
+ ' border-radius: 9px;',
306
+ ' box-shadow: inset 0 0 0 1.2px rgba(47,47,51,0.06);',
307
+ '}',
308
+ '.cl-remote-agent-card:has(.cl-output-result) .cl-agent-pill-avatar {',
309
+ ' width: 24px;',
310
+ ' height: 24px;',
311
+ ' flex-basis: 24px;',
312
+ '}',
313
+ '.cl-remote-agent-card:has(.cl-output-result) .cl-agent-pill-name {',
314
+ ' font-size: 15px;',
315
+ ' line-height: 1.2;',
316
+ '}',
317
+
318
+ // ── Figma 思考步骤(297:716)──
319
+ '.cl-thought-chain-steps-section {',
320
+ ' width: 100%;',
321
+ ' display: flex;',
322
+ ' flex-direction: column;',
323
+ ' align-items: flex-start;',
324
+ ' gap: 4px;',
325
+ ' padding: 4px 0;',
326
+ ' box-sizing: border-box;',
327
+ '}',
328
+ '.cl-tools-collapse-header {',
329
+ ' display: flex;',
330
+ ' align-items: center;',
331
+ ' gap: 0;',
332
+ ' padding: 0;',
333
+ ' cursor: default;',
334
+ ' user-select: none;',
335
+ '}',
336
+ '.cl-tools-collapse-header:hover { opacity: 1; }',
337
+ '.cl-tools-collapse-header-icon { display: none; }',
338
+ '.cl-tools-collapse-header-title {',
339
+ ' font-family: "PingFang SC", sans-serif;',
340
+ ' font-size: 10px;',
341
+ ' font-weight: 600;',
342
+ ' line-height: 1.2;',
343
+ ' color: rgba(47,47,51,0.90);',
344
+ '}',
345
+ '.cl-tools-collapse-body {',
346
+ ' position: relative;',
347
+ ' display: flex;',
348
+ ' flex-direction: column;',
349
+ ' gap: 4px;',
350
+ ' width: 100%;',
351
+ ' overflow: hidden;',
352
+ ' padding: 0;',
353
+ ' transition: max-height 0.25s ease, opacity 0.2s ease;',
354
+ '}',
355
+ '.cl-tools-collapse-body::before {',
356
+ ' content: "";',
357
+ ' position: absolute;',
358
+ ' left: 7px;',
359
+ ' top: 14px;',
360
+ ' bottom: 14px;',
361
+ ' width: 1px;',
362
+ ' background: rgba(47,47,51,0.10);',
363
+ '}',
364
+ '.cl-tools-collapse-body.cl-expanded { max-height: 2000px; opacity: 1; }',
365
+ '.cl-tools-collapse-body.cl-collapsed { max-height: 0; opacity: 0; }',
366
+ '.cl-tools-collapse-step {',
367
+ ' position: relative;',
368
+ ' display: block;',
369
+ ' width: 100%;',
370
+ ' padding: 0;',
371
+ ' z-index: 1;',
372
+ '}',
373
+ '.cl-tools-collapse-step-row {',
374
+ ' display: flex;',
375
+ ' align-items: center;',
376
+ ' gap: 8px;',
377
+ ' min-height: 14px;',
378
+ '}',
379
+ '.cl-tools-collapse-step-icon {',
380
+ ' width: 14px;',
381
+ ' height: 14px;',
382
+ ' flex: 0 0 14px;',
383
+ ' display: flex;',
384
+ ' align-items: center;',
385
+ ' justify-content: center;',
386
+ ' background: #fff;',
387
+ '}',
388
+ '.cl-tools-collapse-step-dot {',
389
+ ' width: 5px;',
390
+ ' height: 5px;',
391
+ ' border-radius: 50%;',
392
+ ' background: #D9D9D9;',
393
+ ' animation: none;',
394
+ '}',
395
+ '.cl-tools-collapse-step-dot::before,',
396
+ '.cl-tools-collapse-step-dot::after,',
397
+ '.cl-tools-collapse-step-dot span {',
398
+ ' content: none;',
399
+ ' display: none;',
400
+ '}',
401
+ '.cl-tools-collapse-step-check {',
402
+ ' position: relative;',
403
+ ' width: 14px;',
404
+ ' height: 14px;',
405
+ ' border-radius: 50%;',
406
+ ' background: #D9D9D9;',
407
+ '}',
408
+ '.cl-tools-collapse-step-check::after {',
409
+ ' content: "";',
410
+ ' position: absolute;',
411
+ ' left: 4px;',
412
+ ' top: 3px;',
413
+ ' width: 4px;',
414
+ ' height: 7px;',
415
+ ' border: solid #fff;',
416
+ ' border-width: 0 1.3px 1.3px 0;',
417
+ ' transform: rotate(45deg);',
418
+ '}',
419
+ '.cl-tools-collapse-step-title {',
420
+ ' font-family: "PingFang SC", sans-serif;',
421
+ ' font-size: 9.5px;',
422
+ ' font-weight: 400;',
423
+ ' line-height: 1.32;',
424
+ ' color: rgba(47,47,51,0.40);',
425
+ ' white-space: nowrap;',
426
+ ' overflow: hidden;',
427
+ ' text-overflow: ellipsis;',
428
+ '}',
429
+ '.cl-tools-collapse-step-detail {',
430
+ ' margin: 2px 0 0 22px;',
431
+ ' font-family: "PingFang SC", sans-serif;',
432
+ ' font-size: 9px;',
433
+ ' line-height: 1.32;',
434
+ ' color: rgba(47,47,51,0.40);',
435
+ '}',
436
+ '.cl-thought-chain-content--execution .cl-thought-chain-steps-section {',
437
+ ' gap: 6px;',
438
+ ' padding: 6px 0;',
439
+ '}',
440
+ '.cl-thought-chain-content--execution .cl-tools-collapse-header-title {',
441
+ ' font-size: 15px;',
442
+ ' line-height: 1.2;',
443
+ '}',
444
+ '.cl-thought-chain-content--execution .cl-tools-collapse-body {',
445
+ ' gap: 6px;',
446
+ '}',
447
+ '.cl-thought-chain-content--execution .cl-tools-collapse-body::before {',
448
+ ' left: 10px;',
449
+ ' top: 21px;',
450
+ ' bottom: 21px;',
451
+ ' width: 1px;',
452
+ ' background: #DBDBDB;',
453
+ ' transform: scaleX(0.3);',
454
+ ' transform-origin: left center;',
455
+ '}',
456
+ '.cl-thought-chain-content--execution .cl-tools-collapse-step-row {',
457
+ ' gap: 12px;',
458
+ ' min-height: 21px;',
459
+ '}',
460
+ '.cl-thought-chain-content--execution .cl-tools-collapse-step-icon {',
461
+ ' width: 21px;',
462
+ ' height: 21px;',
463
+ ' flex-basis: 21px;',
464
+ '}',
465
+ '.cl-thought-chain-content--execution .cl-tools-collapse-step-dot {',
466
+ ' width: 6px;',
467
+ ' height: 6px;',
468
+ ' background: #DCDCDC;',
469
+ '}',
470
+ '.cl-thought-chain-content--execution .cl-tools-collapse-step-check {',
471
+ ' width: 15px;',
472
+ ' height: 15px;',
473
+ ' background: #DCDCDC;',
474
+ '}',
475
+ '.cl-thought-chain-content--execution .cl-tools-collapse-step-check::after {',
476
+ ' left: 4px;',
477
+ ' top: 2px;',
478
+ ' width: 5px;',
479
+ ' height: 8px;',
480
+ ' border-width: 0 1.4px 1.4px 0;',
481
+ '}',
482
+ '.cl-thought-chain-content--execution .cl-tools-collapse-step-title {',
483
+ ' font-size: 14px;',
484
+ ' line-height: 1.32;',
485
+ '}',
486
+ '.cl-thought-chain-content--execution .cl-tools-collapse-step-detail {',
487
+ ' display: none;',
488
+ '}',
489
+
490
+ // ── output 等待渲染完成前,隐藏整张 result card 和宿主 shell ──
491
+ 'details.chat-tools-collapse:has(.cl-output-card--pending),',
492
+ 'details.chat-tool-msg-collapse:has(.cl-output-card--pending),',
493
+ '.chat-tools-collapse:has(.cl-output-card--pending),',
494
+ '.chat-tool-msg-collapse:has(.cl-output-card--pending) {',
495
+ ' display: none !important;',
496
+ '}',
497
+ '.cl-output-card--pending {',
498
+ ' display: none !important;',
499
+ '}',
500
+
501
+ // ── 结果展示区 ──
502
+ '.cl-output-result {',
503
+ ' margin-top: 4px;',
504
+ ' font-family: "PingFang SC", sans-serif;',
505
+ ' font-size: 13px;',
506
+ ' line-height: 1.6;',
507
+ ' color: #2F2F33;',
508
+ ' word-break: break-word;',
509
+ '}',
510
+ '.cl-output-result--pending {',
511
+ ' display: none !important;',
512
+ '}',
513
+ '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result {',
514
+ ' width: 100%;',
515
+ ' max-height: 600px;',
516
+ ' overflow-y: auto;',
517
+ ' overflow-x: hidden;',
518
+ ' box-sizing: border-box;',
519
+ ' margin-top: 0;',
520
+ ' padding: 6px 30px 24px 18px;',
521
+ ' border: 0;',
522
+ ' border-radius: 0;',
523
+ ' background: transparent;',
524
+ ' font-size: 14.25px;',
525
+ ' line-height: 1.42;',
526
+ ' color: rgba(47,47,51,0.50);',
527
+ ' scrollbar-width: thin;',
528
+ ' scrollbar-color: #ECECEC transparent;',
529
+ '}',
530
+ '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result::-webkit-scrollbar {',
531
+ ' width: 4.5px;',
532
+ '}',
533
+ '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result::-webkit-scrollbar-track {',
534
+ ' background: transparent;',
535
+ '}',
536
+ '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result::-webkit-scrollbar-thumb {',
537
+ ' background: #ECECEC;',
538
+ ' border-radius: 150px;',
539
+ '}',
540
+ '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result h1,',
541
+ '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result h2 {',
542
+ ' margin: 18px 0 9px;',
543
+ ' font-size: 20px;',
544
+ ' font-weight: 600;',
545
+ ' line-height: 1.2;',
546
+ ' color: rgba(47,47,51,0.90);',
547
+ '}',
548
+ '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result h1:first-child,',
549
+ '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result h2:first-child {',
550
+ ' margin-top: 6px;',
551
+ '}',
552
+ '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result h3 {',
553
+ ' margin: 18px 0 9px;',
554
+ ' font-size: 15px;',
555
+ ' font-weight: 600;',
556
+ ' line-height: 1.2;',
557
+ ' color: rgba(47,47,51,0.90);',
558
+ '}',
559
+ '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result p,',
560
+ '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result li {',
561
+ ' font-size: 14.25px;',
562
+ ' line-height: 1.42;',
563
+ ' color: rgba(47,47,51,0.50);',
564
+ '}',
565
+ '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result strong,',
566
+ '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result b,',
567
+ '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result a {',
568
+ ' color: rgba(47,47,51,0.90) !important;',
569
+ ' font-weight: 600;',
570
+ '}',
571
+ '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result ul,',
572
+ '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result ol {',
573
+ ' padding-left: 20px;',
574
+ ' margin: 6px 0;',
575
+ '}',
576
+ '.cl-remote-agent-card:has(.cl-output-result) .cl-output-result hr {',
577
+ ' border: 0;',
578
+ ' border-top: 1px solid rgba(47,47,51,0.12);',
579
+ ' margin: 15px 0;',
580
+ '}',
581
+ '.cl-output-result p { margin: 4px 0; }',
582
+ '.cl-output-result ul, .cl-output-result ol { padding-left: 20px; margin: 4px 0; }',
583
+ '.cl-output-result code {',
584
+ ' background: rgba(0,0,0,0.05);',
585
+ ' padding: 1px 4px;',
586
+ ' border-radius: 3px;',
587
+ ' font-size: 12px;',
588
+ '}',
589
+
590
+ // ── 错误状态 ──
591
+ '.cl-remote-agent-card--error {',
592
+ ' border-color: rgba(220, 38, 38, 0.3);',
593
+ ' background: rgba(254, 242, 242, 0.5);',
594
+ '}',
595
+
596
+ // ── Header 折叠/展开 ──
597
+ '.cl-openagent-header:hover {',
598
+ ' background: color-mix(in srgb, var(--bg-hover, #ECEDF0) 75%, transparent);',
599
+ ' transition: background 0.15s ease;',
600
+ '}',
601
+ '.cl-content-collapsed {',
602
+ ' display: none !important;',
603
+ '}',
604
+ ].join('\n');
605
+ document.head.appendChild(style);
606
+ // ── 局部 host-shell 标记(不做全局扫描)──
607
+ // 只处理当前 cardNode 的祖先链路,不 querySelectorAll 全局
608
+ window._clMarkRemoteAgentHostShell = function _clMarkRemoteAgentHostShell(cardNode) {
609
+ try {
610
+ var node = cardNode && cardNode.parentElement;
611
+ var hops = 0;
612
+ while (node && node !== document.body && hops < 10) {
613
+ if (node.matches && node.matches(
614
+ '.chat,.chat-main,.chat-thread,.chat-thread-inner,' +
615
+ '.chat-split-container,.content,.content--chat,.shell,.shell--chat'
616
+ )) {
617
+ break;
618
+ }
619
+
620
+ var shouldMark = false;
621
+ var tag = (node.tagName || '').toLowerCase();
622
+ if (tag === 'details') {
623
+ shouldMark = node.matches && node.matches(
624
+ 'details.chat-tools-collapse, details.chat-tool-msg-collapse'
625
+ );
626
+ } else if (node.matches) {
627
+ shouldMark = node.matches(
628
+ '.chat-tool-card,' +
629
+ '.chat-tool-card__detail,' +
630
+ '.chat-tools-collapse__body,' +
631
+ '.chat-tool-msg-body'
632
+ );
633
+ }
634
+
635
+ if (shouldMark && node.classList) {
636
+ node.classList.add('cl-remote-agent-host-shell');
637
+ if (tag === 'details' && !node.open) {
638
+ node.open = true;
639
+ node.setAttribute('open', '');
640
+ }
641
+ }
642
+ node = node.parentElement;
643
+ hops++;
644
+ }
645
+ } catch (err) {}
646
+ };
647
+
648
+ // 调度器:render hook 生命周期内调用,带延迟重试 + per-node 防抖
649
+ window._cl_scheduleHostShellMark = function _cl_scheduleHostShellMark(cardNode) {
650
+ if (!cardNode || typeof window._clMarkRemoteAgentHostShell !== 'function') return;
651
+
652
+ // 防抖:同一 cardNode 150ms 内不重复调度(标记是幂等的,但有遍历成本)
653
+ if (cardNode.__clShellMarkScheduled) return;
654
+ cardNode.__clShellMarkScheduled = true;
655
+ setTimeout(function() { cardNode.__clShellMarkScheduled = false; }, 150);
656
+
657
+ function run() {
658
+ try { window._clMarkRemoteAgentHostShell(cardNode); } catch (err) {}
659
+ }
660
+
661
+ run();
662
+ if (typeof requestAnimationFrame === 'function') requestAnimationFrame(run);
663
+ setTimeout(run, 0);
664
+ setTimeout(run, 80);
665
+ };
666
+
667
+ console.log('[cl-styles] ✅ remote agent styles injected');
668
+ })();