adp-openclaw 0.0.40 → 0.0.42

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adp-openclaw",
3
- "version": "0.0.40",
3
+ "version": "0.0.42",
4
4
  "description": "ADP-OpenClaw demo channel plugin (Go WebSocket backend)",
5
5
  "type": "module",
6
6
  "dependencies": {
@@ -207,6 +207,8 @@ export async function getStorageCredential(
207
207
  throw new Error("获取存储凭证失败: 缺少upload_url或file_url信息");
208
208
  }
209
209
 
210
+ console.log(`[ADP-UPLOAD] Credential file_url: ${result.file_url.substring(0, 100)}...`);
211
+
210
212
  return result as DescribeRemoteBotStorageCredentialRsp;
211
213
  }
212
214
 
@@ -230,6 +232,9 @@ export async function uploadFileToCos(
230
232
  // 3. 解码预签名的上传URL和下载URL
231
233
  const uploadUrl = decodeURIComponent(credential.upload_url);
232
234
  const fileUrl = decodeURIComponent(credential.file_url);
235
+
236
+ console.log(`[ADP-UPLOAD] upload_url: ${uploadUrl.substring(0, 100)}...`);
237
+ console.log(`[ADP-UPLOAD] file_url (download): ${fileUrl.substring(0, 100)}...`);
233
238
 
234
239
  // 4. 执行上传(直接PUT到预签名URL,不需要额外签名)
235
240
  const response = await fetchWithTimeout(
@@ -250,6 +255,8 @@ export async function uploadFileToCos(
250
255
  throw new Error(`上传文件失败: ${response.status} ${errorText}`);
251
256
  }
252
257
 
258
+ console.log(`[ADP-UPLOAD] Upload success, returning file_url: ${fileUrl.substring(0, 100)}...`);
259
+
253
260
  // 5. 返回下载URL
254
261
  return fileUrl;
255
262
  }
@@ -285,8 +292,11 @@ export async function adpUploadFile(
285
292
  fileType?: string
286
293
  ): Promise<UploadResult> {
287
294
  try {
295
+ // 如果没有传入 fileType,根据文件扩展名推断
296
+ const actualFileType = fileType || inferMimeType(basename(filePath));
297
+
288
298
  // 1. 获取预签名URL
289
- const credential = await getStorageCredential(botToken, fileType);
299
+ const credential = await getStorageCredential(botToken, actualFileType);
290
300
 
291
301
  // 2. 上传文件到 COS(返回下载URL)
292
302
  const fileUrl = await uploadFileToCos(filePath, credential);
@@ -708,8 +718,9 @@ export const uploadFilesToAdpEndpoint = async (
708
718
  fileMetadatas,
709
719
  maxConcurrency,
710
720
  async (metadata, _index): Promise<UploadedFileInfo> => {
711
- // 为每个文件获取预签名URL
712
- const credential = await getStorageCredential(botToken, fileType);
721
+ // 为每个文件获取预签名URL,优先使用传入的 fileType,否则使用文件的 contentType
722
+ const actualFileType = fileType || metadata.contentType || "";
723
+ const credential = await getStorageCredential(botToken, actualFileType);
713
724
  // 上传文件并获取下载URL
714
725
  const downloadUrl = await uploadFileToCos(metadata.path, credential);
715
726
  return {
package/src/monitor.ts CHANGED
@@ -21,9 +21,11 @@ import {
21
21
  formatUploadResultAsMarkdown,
22
22
  } from "./tool-result-message-blocks.js";
23
23
  import crypto from "crypto";
24
+ // @ts-ignore - import JSON file
25
+ import packageJson from "../package.json" with { type: "json" };
24
26
 
25
27
  // Plugin version from package.json
26
- const PLUGIN_VERSION = "0.0.39";
28
+ const PLUGIN_VERSION = packageJson.version;
27
29
 
28
30
  // WebSocket reconnect delay (fixed at 1 second)
29
31
  const RECONNECT_DELAY_MS = 1000;