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,210 +0,0 @@
1
- /**
2
- * OASN 文件上传 + Artifact 下载
3
- *
4
- * 设计依据:
5
- * - docs/specs/2026-06-16-oasn-api-module-mapping.md §2.16 / §2.17
6
- * - docs/specs/2026-06-16-oasn-transport-abstraction-design.md §11.4(file_ref LRU)
7
- *
8
- * 端点:
9
- * - POST /api/files multipart 上传 → file_ref
10
- * - GET /api/artifacts/{id}/content 二进制下载(带 Content-Disposition)
11
- *
12
- * §11.4 file_ref 过期刷新:
13
- * - 维护内存 LRU:sha256(content) → { fileRef, expiresAt, mimeType, displayName }
14
- * - 上传前调用 ensureFileRef(file):命中且未过期 → 复用;否则重传
15
- * - 条目数上限 100,淘汰用 LRU
16
- * - expires_at 临近 60s 视为已过期(避免边缘竞态)
17
- *
18
- * 注意:
19
- * - LRU 仅在单进程内有效;进程重启后丢失,会触发一次重传(可接受)
20
- * - sha256 是 Node 内置,无外部依赖
21
- */
22
-
23
- import { createHash } from 'node:crypto';
24
-
25
- import { logger } from '../../util/logger.js';
26
- import type {
27
- DownloadArtifactResult,
28
- UploadFileParams,
29
- UploadFileResult,
30
- } from '../types.js';
31
- import type { OasnHttpClient } from './oasn-http.js';
32
- import { OASN_ENDPOINTS, type UploadFileResponse } from './oasn-types.js';
33
-
34
- /** LRU 上限 */
35
- const FILE_REF_LRU_MAX = 100;
36
- /** expires_at 临近多少 ms 视为已过期 */
37
- const EXPIRY_MARGIN_MS = 60_000;
38
-
39
- interface FileRefCacheEntry {
40
- fileRef: string;
41
- /** epoch ms */
42
- expiresAt: number;
43
- mimeType: string;
44
- displayName: string;
45
- sizeBytes: number;
46
- }
47
-
48
- export class OasnFiles {
49
- /**
50
- * §11.4 LRU 缓存。
51
- * 利用 Map 的插入顺序天然 = 访问顺序:每次访问后 delete + set 重新插入到尾部。
52
- */
53
- private _refCache = new Map<string, FileRefCacheEntry>();
54
-
55
- constructor(private readonly _http: OasnHttpClient) {}
56
-
57
- // ═══════════════════════════════════════════════════════════════
58
- // 上传
59
- // ═══════════════════════════════════════════════════════════════
60
-
61
- /**
62
- * 上传文件,返回 file_ref。
63
- *
64
- * 调用方应优先用 ensureFileRef() 复用;本方法是"无脑重传"路径。
65
- */
66
- async uploadFile(file: UploadFileParams): Promise<UploadFileResult> {
67
- const buffer = await this._toBuffer(file.content);
68
- return this._doUpload(buffer, file);
69
- }
70
-
71
- /**
72
- * §11.4 入口:根据内容 hash 命中缓存就复用,否则重传。
73
- * sendTask 前应调用此方法,避免 file_ref 过期导致 invocation 400。
74
- */
75
- async ensureFileRef(file: UploadFileParams): Promise<UploadFileResult> {
76
- const buffer = await this._toBuffer(file.content);
77
- const hash = this._hashBuffer(buffer);
78
- const cached = this._refCache.get(hash);
79
-
80
- if (cached && cached.expiresAt - EXPIRY_MARGIN_MS > Date.now()) {
81
- // LRU touch:移到尾部
82
- this._refCache.delete(hash);
83
- this._refCache.set(hash, cached);
84
- logger.info(`[transport/oasn/files] file_ref cache HIT hash=${hash.slice(0, 8)} ref=${cached.fileRef}`);
85
- return {
86
- fileRef: cached.fileRef,
87
- displayName: cached.displayName,
88
- mimeType: cached.mimeType,
89
- sizeBytes: cached.sizeBytes,
90
- expiresAt: cached.expiresAt,
91
- };
92
- }
93
-
94
- // 未命中或已过期 → 重传
95
- if (cached) {
96
- logger.info(`[transport/oasn/files] file_ref cache STALE hash=${hash.slice(0, 8)}, will re-upload`);
97
- this._refCache.delete(hash);
98
- }
99
- const result = await this._doUpload(buffer, file);
100
- this._cachePut(hash, result);
101
- return result;
102
- }
103
-
104
- // ═══════════════════════════════════════════════════════════════
105
- // 下载(Artifact 二进制内容)
106
- // ═══════════════════════════════════════════════════════════════
107
-
108
- /**
109
- * 下载 Artifact 内容。
110
- *
111
- * 注意:不缓存(artifact 一般是大文件 / 一次性消费),需要缓存的请上层包装。
112
- */
113
- async downloadArtifact(artifactIdOrContentUrl: string): Promise<DownloadArtifactResult> {
114
- logger.info(`[transport/oasn/files] downloadArtifact ref=${artifactIdOrContentUrl}`);
115
- const path = this._artifactContentPath(artifactIdOrContentUrl);
116
- const resp = await this._http.getBinary(path);
117
- return {
118
- content: resp.content,
119
- mimeType: resp.mimeType,
120
- displayName: resp.displayName,
121
- };
122
- }
123
-
124
- // ═══════════════════════════════════════════════════════════════
125
- // 内部
126
- // ═══════════════════════════════════════════════════════════════
127
-
128
- /**
129
- * 实际上传逻辑。multipart/form-data:
130
- * - file 文件二进制
131
- * - display_name / purpose / expires_in_seconds 字段(按需)
132
- */
133
- private async _doUpload(buffer: Buffer, file: UploadFileParams): Promise<UploadFileResult> {
134
- const fields: Record<string, string> = {
135
- display_name: file.displayName,
136
- };
137
- if (file.purpose) fields.purpose = file.purpose;
138
- if (file.expiresInSeconds !== undefined) fields.expires_in_seconds = String(file.expiresInSeconds);
139
-
140
- logger.info(
141
- `[transport/oasn/files] upload name=${file.displayName} size=${buffer.byteLength} `
142
- + `mime=${file.mimeType ?? 'auto'} purpose=${file.purpose ?? 'none'}`,
143
- );
144
-
145
- const resp = await this._http.postMultipart<UploadFileResponse>(
146
- OASN_ENDPOINTS.FILES,
147
- {
148
- file: {
149
- content: buffer,
150
- filename: file.displayName,
151
- mimeType: file.mimeType,
152
- },
153
- fields,
154
- },
155
- );
156
-
157
- return {
158
- fileRef: resp.fileRef ?? resp.file_ref ?? '',
159
- displayName: resp.displayName ?? resp.display_name ?? 'unknown',
160
- mimeType: resp.mimeType ?? resp.mime_type ?? 'application/octet-stream',
161
- sizeBytes: resp.sizeBytes ?? resp.size_bytes ?? 0,
162
- expiresAt: this._parseExpiresAt(resp.expiresAt ?? resp.expires_at ?? ''),
163
- };
164
- }
165
-
166
- /** Map LRU put:满了就淘汰最旧 */
167
- private _cachePut(hash: string, result: UploadFileResult): void {
168
- if (this._refCache.size >= FILE_REF_LRU_MAX) {
169
- // 淘汰第一个 key(Map 迭代顺序 = 插入/touch 顺序)
170
- const firstKey = this._refCache.keys().next().value;
171
- if (firstKey !== undefined) {
172
- this._refCache.delete(firstKey);
173
- logger.info(`[transport/oasn/files] LRU evict hash=${(firstKey as string).slice(0, 8)}`);
174
- }
175
- }
176
- this._refCache.set(hash, {
177
- fileRef: result.fileRef,
178
- expiresAt: result.expiresAt,
179
- mimeType: result.mimeType,
180
- displayName: result.displayName,
181
- sizeBytes: result.sizeBytes,
182
- });
183
- }
184
-
185
- private _artifactContentPath(artifactIdOrContentUrl: string): string {
186
- if (/^https?:\/\//i.test(artifactIdOrContentUrl) || artifactIdOrContentUrl.startsWith('/')) {
187
- return artifactIdOrContentUrl;
188
- }
189
- return OASN_ENDPOINTS.ARTIFACT_CONTENT(artifactIdOrContentUrl);
190
- }
191
-
192
- /** Blob | Buffer → Buffer */
193
- private async _toBuffer(content: Blob | Buffer): Promise<Buffer> {
194
- if (Buffer.isBuffer(content)) return content;
195
- // Browser Blob path(Node 18+ 内置 Blob)
196
- const ab = await content.arrayBuffer();
197
- return Buffer.from(ab);
198
- }
199
-
200
- /** sha256 hex —— 标识文件唯一性 */
201
- private _hashBuffer(buf: Buffer): string {
202
- return createHash('sha256').update(buf).digest('hex');
203
- }
204
-
205
- /** ISO 8601 → epoch ms(解析失败时给 0,让缓存下次 miss) */
206
- private _parseExpiresAt(iso: string): number {
207
- const ms = Date.parse(iso);
208
- return Number.isNaN(ms) ? 0 : ms;
209
- }
210
- }