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,363 +0,0 @@
1
- // ── Remote Agent Card Snapshot Store ────────────────────────────────────
2
- //
3
- // 目标不是保存原始 SSE,而是保存“重建同一张卡片需要的参数”。
4
- // 当前 adapter 使用 localStorage;以后换成服务端存储时,RenderHook 不需要改。
5
-
6
- function _clCreateLocalProgressAdapter() {
7
- var STORAGE_KEY = 'openagent.remoteAgent.cardSnapshots.v1';
8
-
9
- function read() {
10
- try {
11
- var raw = localStorage.getItem(STORAGE_KEY);
12
- if (!raw) return { version: 1, records: {} };
13
- var parsed = JSON.parse(raw);
14
- if (!parsed || parsed.version !== 1 || !parsed.records) {
15
- return { version: 1, records: {} };
16
- }
17
- return parsed;
18
- } catch (err) {
19
- console.warn('[cl-store] local read failed: ' + (err && err.message));
20
- return { version: 1, records: {} };
21
- }
22
- }
23
-
24
- function write(data) {
25
- try {
26
- localStorage.setItem(STORAGE_KEY, JSON.stringify(data || { version: 1, records: {} }));
27
- return true;
28
- } catch (err) {
29
- console.warn('[cl-store] local write failed: ' + (err && err.message));
30
- return false;
31
- }
32
- }
33
-
34
- return {
35
- name: 'localStorage',
36
- read: read,
37
- write: write
38
- };
39
- }
40
-
41
- function _clCreateRemoteAgentProgressStore(adapter) {
42
- var MAX_RECORDS = 80;
43
-
44
- function now() {
45
- return Date.now();
46
- }
47
-
48
- function shortId(toolCallId) {
49
- return String(toolCallId || '').substring(0, 8);
50
- }
51
-
52
- function clone(value) {
53
- try {
54
- return JSON.parse(JSON.stringify(value || null));
55
- } catch (err) {
56
- return null;
57
- }
58
- }
59
-
60
- function loadAll() {
61
- var data = adapter.read();
62
- if (!data || data.version !== 1 || !data.records) {
63
- return { version: 1, records: {} };
64
- }
65
- return data;
66
- }
67
-
68
- function saveAll(data) {
69
- prune(data);
70
- adapter.write(data);
71
- }
72
-
73
- function prune(data) {
74
- var records = data.records || {};
75
- var keys = Object.keys(records);
76
- if (keys.length <= MAX_RECORDS) return;
77
- keys.sort(function(a, b) {
78
- return ((records[b] && records[b].updatedAt) || 0) - ((records[a] && records[a].updatedAt) || 0);
79
- });
80
- for (var i = MAX_RECORDS; i < keys.length; i++) {
81
- delete records[keys[i]];
82
- }
83
- }
84
-
85
- function normalizeArgs(args) {
86
- if (!args || typeof args !== 'object') return {};
87
- return clone(args) || {};
88
- }
89
-
90
- function ensureRecord(data, toolCallId) {
91
- if (!toolCallId) return null;
92
- var records = data.records || (data.records = {});
93
- var record = records[toolCallId];
94
- if (!record) {
95
- record = records[toolCallId] = {
96
- version: 1,
97
- toolCallId: toolCallId,
98
- name: '',
99
- args: {},
100
- phase: 'unknown',
101
- progressMode: '',
102
- steps: [],
103
- thinkChunks: [],
104
- lastThinkType: '',
105
- seenChunkKeys: {},
106
- unindexedSeq: 0,
107
- createdAt: now(),
108
- updatedAt: now()
109
- };
110
- }
111
- if (!Array.isArray(record.steps)) record.steps = [];
112
- if (!Array.isArray(record.thinkChunks)) record.thinkChunks = [];
113
- if (!record.args) record.args = {};
114
- if (!record.seenChunkKeys) record.seenChunkKeys = {};
115
- return record;
116
- }
117
-
118
- function recordStart(toolCallId, payload) {
119
- if (!toolCallId) return null;
120
- var data = loadAll();
121
- var record = ensureRecord(data, toolCallId);
122
- if (!record) return null;
123
-
124
- payload = payload || {};
125
- record.name = payload.name || record.name || '';
126
- var incomingArgs = normalizeArgs(payload.args);
127
- if (typeof _cl_mergeArgs === 'function') {
128
- record.args = _cl_mergeArgs(record.args, incomingArgs);
129
- } else if (Object.keys(record.args || {}).length === 0) {
130
- record.args = incomingArgs;
131
- }
132
- if (typeof _cl_getRemoteAgentProgressMode === 'function') {
133
- record.progressMode = _cl_getRemoteAgentProgressMode(record.args, record.progressMode);
134
- }
135
- if (typeof _cl_rebuildThinkStepsByAgentMode === 'function' && record.thinkChunks && record.thinkChunks.length > 0) {
136
- _cl_rebuildThinkStepsByAgentMode(record);
137
- }
138
- record.phase = 'active';
139
- record.updatedAt = now();
140
- saveAll(data);
141
-
142
- console.log('[cl-store] snapshot start tcid=' + shortId(toolCallId)
143
- + ' adapter=' + adapter.name
144
- + ' agent=' + JSON.stringify(record.args.agent_name || record.args.agentName || record.args.agent_id || ''));
145
- return clone(record);
146
- }
147
-
148
- function getChunkKey(record, chunk) {
149
- if (chunk && chunk._clProgressStep) {
150
- return 'p:' + String(chunk.stepIndex) + ':' + (chunk.text || '') + ':' + (chunk.detail || '');
151
- }
152
- if (chunk && Object.prototype.hasOwnProperty.call(chunk, 'index')
153
- && chunk.index !== null && chunk.index !== undefined && chunk.index !== '') {
154
- // 去重 key 包含完整内容:同 index 不同 text 是累计更新,不应跳过
155
- return 'i:' + String(chunk.index) + ':' + (chunk.thinkType || '') + ':' + (chunk.text || '');
156
- }
157
- return 'u:' + (chunk.thinkType || '') + ':' + (chunk.text || '');
158
- }
159
-
160
- function mergeStreamText(current, incoming) {
161
- current = current || '';
162
- incoming = incoming || '';
163
- if (!incoming) return current;
164
- if (!current) return incoming;
165
- if (incoming.length > current.length && incoming.indexOf(current) === 0) return incoming;
166
-
167
- var maxOverlap = Math.min(current.length, incoming.length);
168
- for (var len = maxOverlap; len > 0; len--) {
169
- if (current.slice(current.length - len) === incoming.slice(0, len)) {
170
- return current + incoming.slice(len);
171
- }
172
- }
173
- return current + incoming;
174
- }
175
-
176
- function normalizeTitle(text) {
177
- return String(text || '').replace(/[\u2705\u2611\uFE0F\u2714\uFE0F]/g, '').trim();
178
- }
179
-
180
- function pruneGenericProgressSteps(steps) {
181
- if (!Array.isArray(steps) || steps.length === 0) return [];
182
- return steps.filter(function(step) {
183
- if (typeof _cl_isGenericProgressTitle === 'function') {
184
- return !_cl_isGenericProgressTitle(step && step.title || '');
185
- }
186
- var title = normalizeTitle(step && step.title || '');
187
- return title && title !== '正在整理行程卡片';
188
- });
189
- }
190
-
191
- function applyThinkChunk(record, chunk) {
192
- if (chunk._clProgressStep) {
193
- var beforeProgressSig = typeof _cl_stepsSignature === 'function'
194
- ? _cl_stepsSignature(record.steps)
195
- : JSON.stringify(record.steps || []);
196
- var stepIndex = Number(chunk.stepIndex);
197
- if (!Number.isFinite(stepIndex) || stepIndex < 0) return false;
198
- stepIndex = Math.floor(stepIndex);
199
-
200
- if (chunk._clTripProgressRoot) {
201
- record.steps = pruneGenericProgressSteps(record.steps);
202
- stepIndex = 0;
203
- }
204
-
205
- while (record.steps.length <= stepIndex) {
206
- record.steps.push({ title: '', detail: '' });
207
- }
208
-
209
- var progressStep = record.steps[stepIndex];
210
- var progressTitle = normalizeTitle(chunk.text || '');
211
- var progressChanged = false;
212
-
213
- if (progressTitle && progressStep.title !== progressTitle) {
214
- progressStep.title = progressTitle;
215
- progressChanged = true;
216
- }
217
- if (progressStep.detail) progressStep.detail = '';
218
-
219
- if (typeof _cl_compactThoughtSteps === 'function') {
220
- record.steps = _cl_compactThoughtSteps(record.steps);
221
- }
222
- var afterProgressSig = typeof _cl_stepsSignature === 'function'
223
- ? _cl_stepsSignature(record.steps)
224
- : JSON.stringify(record.steps || []);
225
- if (!(typeof _cl_isGenericProgressTitle === 'function' && _cl_isGenericProgressTitle(progressTitle))) {
226
- record.lastThinkType = 'progress-step';
227
- }
228
- return progressChanged || beforeProgressSig !== afterProgressSig;
229
- }
230
-
231
- var type = chunk.thinkType || '';
232
- var text = typeof chunk.text === 'string' ? chunk.text : '';
233
-
234
- if (typeof _cl_applyThinkChunkByAgentMode === 'function') {
235
- var modeChanged = _cl_applyThinkChunkByAgentMode(record, chunk);
236
- record.lastThinkType = type;
237
- return modeChanged;
238
- }
239
-
240
- // index 是 SSE 事件序号,不是步骤编号。当前 UI 只持久化 title:
241
- // content/process 是过程信息,不展示,也不打断 title 合并。
242
- if (type === 'title') {
243
- var title = normalizeTitle(text);
244
- if (!title) {
245
- record.lastThinkType = type;
246
- return false;
247
- }
248
-
249
- var currentStep = record.steps[record.steps.length - 1];
250
- var titleIndex = typeof _cl_getChunkIndex === 'function' ? _cl_getChunkIndex(chunk) : -1;
251
- var isAdjacentTitle = titleIndex >= 0 && record.lastTitleIndex >= 0
252
- && titleIndex === record.lastTitleIndex + 1;
253
- var shouldMerge = typeof _cl_shouldMergeStepTitle === 'function'
254
- ? (isAdjacentTitle || _cl_shouldMergeStepTitle(currentStep && currentStep.title, title))
255
- : record.lastThinkType === 'title';
256
- if (record.steps.length === 0 || !shouldMerge) {
257
- // 新步骤
258
- record.steps.push({ title: title, detail: '' });
259
- } else {
260
- // 同一个短 title 被拆成多段 → 合并到当前步骤
261
- currentStep.title = normalizeTitle(mergeStreamText(currentStep.title || '', title));
262
- }
263
- if (typeof _cl_compactThoughtSteps === 'function') {
264
- record.steps = _cl_compactThoughtSteps(record.steps);
265
- }
266
- if (titleIndex >= 0) record.lastTitleIndex = titleIndex;
267
- record.lastThinkType = type;
268
- return true;
269
- }
270
-
271
- if (type === 'content') {
272
- return false;
273
- }
274
-
275
- record.lastThinkType = type;
276
- return false;
277
- }
278
-
279
- function getChunkIndex(chunk) {
280
- if (!chunk || chunk.index === null || chunk.index === undefined || chunk.index === '') return -1;
281
- var n = Number(chunk.index);
282
- if (!Number.isFinite(n) || n < 0) return -1;
283
- return Math.floor(n);
284
- }
285
-
286
- function recordChunk(toolCallId, chunk) {
287
- if (!toolCallId || !chunk || chunk.dataType !== 'think') return null;
288
- var data = loadAll();
289
- var record = ensureRecord(data, toolCallId);
290
- if (!record) return null;
291
-
292
- var key = getChunkKey(record, chunk);
293
- if (record.seenChunkKeys[key]) {
294
- console.log('[cl-store] snapshot duplicate tcid=' + shortId(toolCallId)
295
- + ' key=' + key
296
- + ' steps=' + record.steps.length);
297
- return { record: clone(record), steps: clone(record.steps) || [], changed: false };
298
- }
299
-
300
- record.seenChunkKeys[key] = true;
301
- var changed = applyThinkChunk(record, chunk);
302
- record.updatedAt = now();
303
- saveAll(data);
304
-
305
- console.log('[cl-store] snapshot chunk tcid=' + shortId(toolCallId)
306
- + ' key=' + key
307
- + ' type=' + JSON.stringify(chunk.thinkType || '')
308
- + ' changed=' + changed
309
- + ' steps=' + record.steps.length);
310
- return { record: clone(record), steps: clone(record.steps) || [], changed: changed };
311
- }
312
-
313
- function recordResult(toolCallId) {
314
- if (!toolCallId) return null;
315
- var data = loadAll();
316
- var record = ensureRecord(data, toolCallId);
317
- if (!record) return null;
318
- record.phase = 'completed';
319
- record.seenChunkKeys = {}; // 完成后清空,减小 localStorage 体积
320
- record.updatedAt = now();
321
- saveAll(data);
322
- console.log('[cl-store] snapshot result tcid=' + shortId(toolCallId) + ' steps=' + record.steps.length);
323
- return { record: clone(record), steps: clone(record.steps) || [] };
324
- }
325
-
326
- function get(toolCallId) {
327
- if (!toolCallId) return null;
328
- var data = loadAll();
329
- var record = data.records && data.records[toolCallId];
330
- if (!record) {
331
- console.log('[cl-store] snapshot miss tcid=' + shortId(toolCallId));
332
- return null;
333
- }
334
- if (!Array.isArray(record.steps)) record.steps = [];
335
- console.log('[cl-store] snapshot restore tcid=' + shortId(toolCallId)
336
- + ' phase=' + (record.phase || 'unknown')
337
- + ' steps=' + record.steps.length
338
- + ' agent=' + JSON.stringify((record.args || {}).agent_name || (record.args || {}).agentName || ''));
339
- return clone(record);
340
- }
341
-
342
- function getSteps(toolCallId) {
343
- var record = get(toolCallId);
344
- return record ? (clone(record.steps) || []) : [];
345
- }
346
-
347
- function rebuildSteps(record) {
348
- return record && Array.isArray(record.steps) ? (clone(record.steps) || []) : [];
349
- }
350
-
351
- return {
352
- adapterName: adapter.name,
353
- recordStart: recordStart,
354
- recordChunk: recordChunk,
355
- recordResult: recordResult,
356
- get: get,
357
- getSteps: getSteps,
358
- rebuildSteps: rebuildSteps
359
- };
360
- }
361
-
362
- var _clRemoteAgentProgressStore = _clCreateRemoteAgentProgressStore(_clCreateLocalProgressAdapter());
363
- window.__clRemoteAgentProgressStore = _clRemoteAgentProgressStore;