openclaw-openagent 1.0.13 → 1.0.14

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 (128) hide show
  1. package/dist/src/messaging/executor.d.ts +2 -3
  2. package/dist/src/messaging/executor.js +4 -31
  3. package/dist/src/plugin-ui/assets/openagent-override.js +4 -5
  4. package/dist/src/runtime/update-checker.d.ts +1 -1
  5. package/dist/src/runtime/update-checker.js +9 -46
  6. package/package.json +1 -3
  7. package/src/app/channel-tools.ts +0 -249
  8. package/src/app/discovery-tools.ts +0 -273
  9. package/src/app/download-file-tool.ts +0 -133
  10. package/src/app/hooks.ts +0 -144
  11. package/src/app/index.ts +0 -84
  12. package/src/app/messaging-tools.ts +0 -79
  13. package/src/app/ops-tools.ts +0 -155
  14. package/src/app/remote-agent-tool.ts +0 -762
  15. package/src/app/types.ts +0 -68
  16. package/src/app/upload-file-tool.ts +0 -411
  17. package/src/app/verbose-preflight.ts +0 -190
  18. package/src/auth/config.ts +0 -266
  19. package/src/auth/credential-manager.ts +0 -146
  20. package/src/auth/index.ts +0 -24
  21. package/src/auth/verify.ts +0 -99
  22. package/src/channel.ts +0 -566
  23. package/src/compat.ts +0 -94
  24. package/src/config/config-schema.ts +0 -45
  25. package/src/messaging/aggregator.ts +0 -120
  26. package/src/messaging/collector.ts +0 -89
  27. package/src/messaging/executor.ts +0 -72
  28. package/src/messaging/inbound.ts +0 -150
  29. package/src/messaging/index.ts +0 -11
  30. package/src/messaging/mention-protocol.ts +0 -94
  31. package/src/messaging/process-c2c-request.ts +0 -564
  32. package/src/messaging/process-message.ts +0 -373
  33. package/src/messaging/scheduler.ts +0 -55
  34. package/src/messaging/types.ts +0 -38
  35. package/src/plugin-ui/adapters/oc-2026-04.js +0 -103
  36. package/src/plugin-ui/adapters/oc-2026-05.js +0 -125
  37. package/src/plugin-ui/adapters/oc-2026-06.js +0 -125
  38. package/src/plugin-ui/adapters/oc-unknown.js +0 -48
  39. package/src/plugin-ui/assets/agentbook-icon.svg +0 -5
  40. package/src/plugin-ui/assets/bg.png +0 -0
  41. package/src/plugin-ui/assets/icon.png +0 -0
  42. package/src/plugin-ui/assets/magic.svg +0 -5
  43. package/src/plugin-ui/assets/openagent-override.js +0 -11263
  44. package/src/plugin-ui/build.cjs +0 -463
  45. package/src/plugin-ui/index.ts +0 -18
  46. package/src/plugin-ui/modules/agent-book/panel/agent-book.js +0 -570
  47. package/src/plugin-ui/modules/agent-book/panel/agent-card.js +0 -170
  48. package/src/plugin-ui/modules/agent-book/panel/agent-data.js +0 -643
  49. package/src/plugin-ui/modules/agent-book/panel/inject-ui.js +0 -665
  50. package/src/plugin-ui/modules/agent-book/panel/mention-state.js +0 -206
  51. package/src/plugin-ui/modules/agent-book/panel/styles.js +0 -832
  52. package/src/plugin-ui/modules/agent-book/panel/theme-adapter.js +0 -86
  53. package/src/plugin-ui/modules/agent-book/remote-agent-tool/components-core.js +0 -295
  54. package/src/plugin-ui/modules/agent-book/remote-agent-tool/thought-chain-card.js +0 -211
  55. package/src/plugin-ui/modules/agent-book/scanner.js +0 -131
  56. package/src/plugin-ui/modules/agent-book/travelcard/travel-cards.js +0 -500
  57. package/src/plugin-ui/modules/agent-book/travelcard/travel-engine.js +0 -652
  58. package/src/plugin-ui/modules/agent-book/travelcard/travel-styles.js +0 -262
  59. package/src/plugin-ui/modules/loader/bootstrap.js +0 -133
  60. package/src/plugin-ui/modules/loader/shared-state.js +0 -838
  61. package/src/plugin-ui/modules/loader/ws-intercept.js +0 -199
  62. package/src/plugin-ui/modules/remote-agent/chunk-parser.js +0 -161
  63. package/src/plugin-ui/modules/remote-agent/execution-card.js +0 -530
  64. package/src/plugin-ui/modules/remote-agent/markdown-renderer.js +0 -256
  65. package/src/plugin-ui/modules/remote-agent/media-links.js +0 -151
  66. package/src/plugin-ui/modules/remote-agent/native-style-adapter.js +0 -134
  67. package/src/plugin-ui/modules/remote-agent/output-card.js +0 -342
  68. package/src/plugin-ui/modules/remote-agent/progress-store.js +0 -363
  69. package/src/plugin-ui/modules/remote-agent/render-hooks.js +0 -1700
  70. package/src/plugin-ui/modules/remote-agent/styles.js +0 -903
  71. package/src/plugin-ui/modules/remote-agent/tool-card-model.js +0 -130
  72. package/src/plugin-ui/postinstall-deploy.cjs +0 -52
  73. package/src/plugin-ui/ui-extension-loader/backup.ts +0 -92
  74. package/src/plugin-ui/ui-extension-loader/index.ts +0 -276
  75. package/src/plugin-ui/ui-extension-loader/locator.ts +0 -152
  76. package/src/plugin-ui/ui-extension-loader/manifest.ts +0 -57
  77. package/src/plugin-ui/ui-extension-loader/registry-regex.ts +0 -944
  78. package/src/plugin-ui/ui-extension-loader/removed-extensions.ts +0 -70
  79. package/src/plugin-ui/ui-extension-loader/types.ts +0 -72
  80. package/src/proxy/auth-proxy.ts +0 -414
  81. package/src/runtime/account.ts +0 -549
  82. package/src/runtime/index.ts +0 -7
  83. package/src/runtime/plugin-runtime.ts +0 -94
  84. package/src/runtime/registry.ts +0 -71
  85. package/src/runtime/update-checker.ts +0 -286
  86. package/src/sdk/CLASS_MAP.md +0 -143
  87. package/src/sdk/index.d.ts +0 -126
  88. package/src/sdk/index.js +0 -23990
  89. package/src/sdk/modules/cloud-search-module.js +0 -1117
  90. package/src/sdk/modules/follow-module.js +0 -1069
  91. package/src/sdk/modules/group-module.js +0 -7397
  92. package/src/sdk/modules/relationship-module.js +0 -2269
  93. package/src/sdk/modules/signaling-module.js +0 -1468
  94. package/src/sdk/modules/tim-upload-plugin.js +0 -730
  95. package/src/sdk/node-env/http-request.js +0 -90
  96. package/src/sdk/node-env/index.js +0 -57
  97. package/src/sdk/node-env/storage.js +0 -114
  98. package/src/sdk/package.json +0 -10
  99. package/src/sdk/tsconfig.json +0 -16
  100. package/src/state/pending-invocation-store.ts +0 -43
  101. package/src/state/store.ts +0 -756
  102. package/src/tim/c2c.ts +0 -451
  103. package/src/tim/channels.ts +0 -364
  104. package/src/tim/client.ts +0 -330
  105. package/src/tim/index.ts +0 -18
  106. package/src/tim/messages.ts +0 -166
  107. package/src/tim/sdk-logger-init.ts +0 -50
  108. package/src/tools.ts +0 -10
  109. package/src/transport/factory.ts +0 -95
  110. package/src/transport/oasn/index.ts +0 -17
  111. package/src/transport/oasn/oasn-agent-card.ts +0 -111
  112. package/src/transport/oasn/oasn-discovery.ts +0 -108
  113. package/src/transport/oasn/oasn-files.ts +0 -210
  114. package/src/transport/oasn/oasn-http.ts +0 -529
  115. package/src/transport/oasn/oasn-invocation.ts +0 -604
  116. package/src/transport/oasn/oasn-normalize.ts +0 -133
  117. package/src/transport/oasn/oasn-register.ts +0 -33
  118. package/src/transport/oasn/oasn-transport.ts +0 -318
  119. package/src/transport/oasn/oasn-types.ts +0 -404
  120. package/src/transport/tim/index.ts +0 -8
  121. package/src/transport/tim/tim-transport.ts +0 -515
  122. package/src/transport/types.ts +0 -538
  123. package/src/types/openclaw-plugin-sdk-media-store.d.ts +0 -9
  124. package/src/types/openclaw.d.ts +0 -97
  125. package/src/types/tencentcloud-chat.d.ts +0 -15
  126. package/src/util/http.ts +0 -113
  127. package/src/util/logger.ts +0 -131
  128. package/src/util/url-resolver.ts +0 -77
@@ -1,262 +0,0 @@
1
- // ── 1. CSS 注入 ──
2
- var _oldTripCSS = document.getElementById('openagent-trip-card-styles');
3
- if (_oldTripCSS) _oldTripCSS.remove();
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');
8
- _tripCSS.textContent = `
9
- /* ── 行程文字:普通文字灰色,特殊标注(粗体/链接/标题)黑色 ── */
10
- .trip-styled li, .trip-styled p { color: #888 !important; }
11
- .trip-styled li strong, .trip-styled li b,
12
- .trip-styled p strong, .trip-styled p b,
13
- .trip-styled li a, .trip-styled p a { color: #111 !important; }
14
- .trip-styled h1, .trip-styled h2, .trip-styled h3,
15
- .trip-styled h4, .trip-styled h5, .trip-styled h6 { color: #111 !important; }
16
- .trip-styled ul { padding-left: 20px; }
17
- sh_card, tr_card, i_card, la_card, fr_card, bg_card, time_data_card {
18
- display: none !important;
19
- }
20
-
21
- /* ── TransportCard ── */
22
- .trip-transport-card {
23
- margin: 12px 0 12px 20px;
24
- border-radius: 12px;
25
- border: 1px solid rgb(229,229,229);
26
- background: #fff;
27
- overflow: hidden;
28
- cursor: pointer;
29
- transition: box-shadow 0.2s;
30
- max-width: 380px;
31
- }
32
- .trip-transport-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
33
- .trip-tc-inner {
34
- display: flex; flex-direction: column; padding: 16px;
35
- }
36
- .trip-tc-station-row {
37
- display: flex; flex-direction: row; align-items: flex-start; width: 100%;
38
- }
39
- .trip-tc-left { display: flex; flex-direction: column; width: max(159px, 50%); }
40
- .trip-tc-left-top { display: flex; flex-direction: row; align-items: center; }
41
- .trip-tc-time {
42
- font-size: 20px; font-weight: 500; line-height: 28px;
43
- color: rgb(17,17,17); white-space: nowrap; flex-shrink: 0;
44
- }
45
- .trip-tc-arrow-area {
46
- display: flex; flex-direction: row; align-items: center;
47
- min-width: 90px; margin-left: 8px; position: relative; flex: 1;
48
- }
49
- .trip-tc-arrow-line { flex: 1; display: block; min-width: 40px; }
50
- .trip-tc-duration {
51
- display: flex; flex-direction: row; align-items: center;
52
- background: rgb(255,255,255); color: rgb(85,85,85);
53
- font-size: 12px; white-space: nowrap;
54
- position: absolute; left: 50%; transform: translateX(-50%);
55
- padding: 0 4px;
56
- }
57
- .trip-tc-station {
58
- font-size: 14px; line-height: 21px; font-weight: 400;
59
- color: rgb(17,17,17); margin-top: 2px; margin-right: 4px;
60
- overflow: hidden; text-overflow: ellipsis;
61
- display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
62
- }
63
- .trip-tc-right { display: flex; flex-direction: column; margin-left: 8px; }
64
- .trip-tc-superscript { color: #FF7D00; font-size: 10px; vertical-align: super; margin-left: 1px; }
65
- .trip-tc-desc {
66
- display: flex; flex-direction: row; flex-wrap: wrap; align-items: center;
67
- margin-top: 4px;
68
- color: rgb(85,85,85); font-size: 14px; line-height: 21px;
69
- }
70
- .trip-tc-desc-tag { display: inline-flex; align-items: center; font-size: 14px; line-height: 21px; }
71
- .trip-tc-desc-tag-positive { color: rgb(6,135,90); flex-shrink: 0; }
72
- .trip-tc-desc-divider {
73
- color: rgb(213,213,213); font-size: 12px; line-height: 18px;
74
- margin: 0 8px; position: relative; top: -1px;
75
- }
76
- .trip-tc-icon { font-family: 'crn_font_xtaro_route'; margin-right: 2px; font-size: 14px; }
77
-
78
- /* ── ImageCard ── */
79
- .trip-img-card {
80
- display: flex; flex-direction: row; gap: 6px;
81
- overflow-x: auto; padding: 8px 0; margin-left: 20px;
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;
89
- }
90
- .trip-img-item {
91
- position: relative; width: 191px; height: 100px; border-radius: 8px;
92
- flex-shrink: 0; overflow: hidden;
93
- }
94
- .trip-img-fallback-item {
95
- width: 240px; height: auto; min-height: 88px;
96
- background: #fff; border: 1px solid #e5e8ef;
97
- box-shadow: 0 2px 8px rgba(17,24,39,0.04);
98
- padding: 10px 12px; display: flex; flex-direction: column; gap: 5px;
99
- }
100
- .trip-img-fallback-title {
101
- font-size: 14px; font-weight: 600; color: #1f2937; line-height: 20px;
102
- }
103
- .trip-img-fallback-desc {
104
- font-size: 13px; color: #6b7280; line-height: 19px;
105
- display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
106
- overflow: hidden;
107
- }
108
- .trip-img-fallback-score {
109
- align-self: flex-start; margin-top: 2px;
110
- font-size: 12px; color: #f97316; background: #fff7ed;
111
- border-radius: 999px; padding: 2px 7px;
112
- }
113
- .trip-img-item img {
114
- width: 191px; height: 100px; border-radius: 8px; object-fit: cover;
115
- display: block;
116
- }
117
- .trip-img-overlay {
118
- position: absolute; bottom: 0; left: 0; right: 0;
119
- background-image: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,0.7));
120
- padding: 4px 8px;
121
- }
122
- .trip-img-name {
123
- color: #fff; font-size: 13px; font-weight: 500; line-height: 18px;
124
- overflow: hidden; text-overflow: ellipsis;
125
- display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
126
- }
127
- .trip-img-score {
128
- display: inline-flex; align-items: center; gap: 2px;
129
- background: rgba(0,0,0,0.4); border-radius: 4px; padding: 1px 4px;
130
- position: absolute; top: 4px; right: 4px;
131
- }
132
- .trip-img-score-icon { color: rgb(255,116,123); font-size: 10px; }
133
- .trip-img-score-text { color: rgb(255,116,123); font-size: 10px; }
134
-
135
- /* ── TimeDataCard ── */
136
- .trip-day-card {
137
- display: flex; align-items: center; gap: 8px;
138
- margin: 20px 0 8px 0; padding: 0;
139
- }
140
- .trip-day-badge {
141
- display: inline-flex; align-items: center; justify-content: center;
142
- background: linear-gradient(135deg, #006ff6 0%, #4d9eff 100%);
143
- color: #fff; font-size: 13px; font-weight: 600;
144
- padding: 4px 14px; border-radius: 16px;
145
- letter-spacing: 0.5px;
146
- }
147
- .trip-day-line { flex: 1; height: 1px; background: #e5e6eb; }
148
-
149
- /* ── ShoppingCard (线路概览表格) ── */
150
- .trip-sh-card { margin: 16px 0 16px 20px; }
151
- .trip-sh-title {
152
- font-size: 20px; font-weight: 500; color: #051a37;
153
- line-height: 26px; margin-bottom: 12px; display: block;
154
- }
155
- .trip-sh-table {
156
- width: 100%; max-width: 400px;
157
- border: 1px solid rgb(229,229,229); border-radius: 8px;
158
- overflow: hidden; background: #fff;
159
- }
160
- .trip-sh-row { display: flex; flex-direction: row; }
161
- .trip-sh-row + .trip-sh-row { border-top: 1px solid #d4d7de; }
162
- .trip-sh-day-cell {
163
- width: 72px; flex-shrink: 0; display: flex; flex-direction: column;
164
- align-items: center; justify-content: center; padding: 12px;
165
- border-right: 1px solid #d4d7de;
166
- }
167
- .trip-sh-day-title { font-size: 12px; color: rgb(133,146,166); }
168
- .trip-sh-day-num { font-size: 24px; font-weight: 700; color: rgb(17,17,17); }
169
- .trip-sh-detail {
170
- flex: 1; padding: 12px 16px; display: flex; flex-direction: column;
171
- justify-content: center;
172
- }
173
- .trip-sh-districts {
174
- display: flex; flex-direction: row; flex-wrap: wrap; align-items: center;
175
- }
176
- .trip-sh-district { font-size: 16px; font-weight: 500; color: #0f294d; }
177
- .trip-sh-district-arrow { font-size: 16px; color: #8592a6; margin: 0 4px; }
178
- .trip-sh-pois {
179
- display: flex; flex-direction: row; flex-wrap: wrap;
180
- align-items: center; margin-top: 4px;
181
- }
182
- .trip-sh-poi { font-size: 14px; color: #4E5969; line-height: 22px; }
183
- .trip-sh-poi-arrow { font-size: 14px; color: #8592a6; margin: 0 6px; }
184
-
185
- /* ── HotelAreaCard ── */
186
- .trip-hotel-card {
187
- border-radius: 8px; border: 1px solid #f0f2f5;
188
- overflow: hidden; background: #fff; margin: 8px 0;
189
- }
190
- .trip-hotel-header {
191
- padding: 10px 12px; background: rgba(0,111,246,0.03);
192
- border-bottom: 1px solid #f0f2f5;
193
- display: flex; align-items: center; gap: 6px;
194
- }
195
- .trip-hotel-icon {
196
- font-family: 'crn_font_xtaro_route'; font-size: 14px; color: #006ff6;
197
- }
198
- .trip-hotel-title { font-size: 14px; font-weight: 600; color: #111; }
199
- .trip-hotel-desc {
200
- font-size: 13px; color: #6b7280; line-height: 20px;
201
- padding: 10px 12px 12px;
202
- }
203
-
204
- /* ── FoodCard ── */
205
- .trip-food-card { margin: 8px 0 8px 20px; }
206
- .trip-food-title {
207
- font-size: 18px; font-weight: 500; color: #111;
208
- line-height: 26px; display: block; margin-bottom: 8px;
209
- }
210
- .trip-food-item {
211
- display: flex; align-items: flex-start; gap: 8px;
212
- padding: 4px 0;
213
- }
214
- .trip-food-dot {
215
- width: 6px; height: 6px; border-radius: 50%; margin-top: 10px; flex-shrink: 0;
216
- }
217
- .trip-food-dot-food { background: #F77234; }
218
- .trip-food-dot-rest { background: #006ff6; }
219
- .trip-food-name { font-size: 16px; color: #111; line-height: 24px; }
220
- .trip-food-meta { font-size: 11px; color: #888; margin-left: 6px; }
221
-
222
- /* ── BudgetCard ── */
223
- .trip-budget-card { margin: 16px 0; }
224
- .trip-budget-title { font-size: 17px; font-weight: 700; color: #111; line-height: 22px; }
225
- .trip-budget-desc { font-size: 13px; color: #333; margin: 6px 0 0 0; line-height: 1.7; }
226
- .trip-budget-chart {
227
- margin-top: 12px; margin-left: 20px; background: #fff; max-width: 320px;
228
- border: 1px solid #e8e8e8; border-radius: 10px; padding: 14px 16px;
229
- }
230
- .trip-budget-header {
231
- display: flex; justify-content: space-between; align-items: center;
232
- }
233
- .trip-budget-person { font-size: 14px; font-weight: 600; color: #111; line-height: 20px; }
234
- .trip-budget-total { font-size: 15px; font-weight: 700; color: #111; line-height: 22px; }
235
- .trip-budget-parts { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
236
- .trip-budget-part {
237
- display: flex; flex-direction: row; align-items: center;
238
- }
239
- .trip-budget-part-icon { width: 16px; height: 16px; margin-right: 4px; font-size: 14px; text-align: center; }
240
- .trip-budget-part-name { font-size: 13px; font-weight: 600; color: #111; line-height: 20px; white-space: nowrap; }
241
- .trip-budget-bar {
242
- flex: 1; height: 6px; border-radius: 3px; margin: 0 10px;
243
- overflow: hidden; min-width: 40px; max-width: 140px;
244
- }
245
- .trip-budget-bar-fill { height: 100%; border-radius: 3px; min-width: 4%; }
246
- .trip-budget-part-price {
247
- font-size: 13px; color: #111; line-height: 20px;
248
- min-width: 55px; text-align: right;
249
- }
250
-
251
- /* ── 暗色主题适配 ── */
252
- @media (prefers-color-scheme: dark) {
253
- .trip-transport-card, .trip-sh-table, .trip-hotel-card, .trip-img-fallback-item { background: #1e1e1e; border-color: #333; }
254
- .trip-tc-time, .trip-tc-station, .trip-sh-district, .trip-hotel-title,
255
- .trip-img-fallback-title, .trip-food-name, .trip-budget-title, .trip-budget-person, .trip-budget-total,
256
- .trip-budget-part-name, .trip-budget-part-price, .trip-sh-day-num { color: #e0e0e0; }
257
- .trip-img-fallback-desc, .trip-hotel-desc { color: #9ca3af; }
258
- .trip-sh-row + .trip-sh-row, .trip-sh-day-cell { border-color: #333; }
259
- .trip-hotel-header { background: rgba(0,111,246,0.08); border-color: #333; }
260
- }
261
- `;
262
- document.head.appendChild(_tripCSS);
@@ -1,133 +0,0 @@
1
- // MutationObserver for faster trigger — with debounce to prevent infinite loops.
2
- // Without debounce, _clScan modifies DOM → triggers observer → _clScan → ...
3
- var _clDebounceTimer = null;
4
- var _clObserverTarget = null;
5
-
6
- const _clObserver = new MutationObserver(() => {
7
- if (_clDebounceTimer) clearTimeout(_clDebounceTimer);
8
- _clDebounceTimer = setTimeout(_debouncedClScan, 300); // Debounce to reduce DOM churn feedback loops
9
- });
10
-
11
- function _debouncedClScan() {
12
- // Disconnect observer during scan to prevent feedback loop
13
- _clObserver.disconnect();
14
- try {
15
- _clScan();
16
- } catch (err) {
17
- console.warn('[openagent] scanner error:', err.message);
18
- }
19
- // Reconnect observer after scan completes
20
- if (_clObserverTarget) {
21
- _clObserver.observe(_clObserverTarget, { childList: true, subtree: true });
22
- }
23
- }
24
-
25
- function _startClObserver() {
26
- _clObserverTarget = document.querySelector('openclaw-app') || document.body;
27
- _clObserver.observe(_clObserverTarget, { childList: true, subtree: true });
28
- setTimeout(_debouncedClScan, 2000);
29
- setTimeout(_clCheckPluginUpdateStatus, 5000);
30
- /* muted */ void 0;
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
-
127
- if (document.readyState === 'loading') {
128
- document.addEventListener('DOMContentLoaded', _startClObserver);
129
- } else {
130
- setTimeout(_startClObserver, 500);
131
- }
132
-
133
- /* muted */ void 0;