adp-openclaw 0.0.40 → 0.0.41

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.41",
4
4
  "description": "ADP-OpenClaw demo channel plugin (Go WebSocket backend)",
5
5
  "type": "module",
6
6
  "dependencies": {
@@ -285,8 +285,11 @@ export async function adpUploadFile(
285
285
  fileType?: string
286
286
  ): Promise<UploadResult> {
287
287
  try {
288
+ // 如果没有传入 fileType,根据文件扩展名推断
289
+ const actualFileType = fileType || inferMimeType(basename(filePath));
290
+
288
291
  // 1. 获取预签名URL
289
- const credential = await getStorageCredential(botToken, fileType);
292
+ const credential = await getStorageCredential(botToken, actualFileType);
290
293
 
291
294
  // 2. 上传文件到 COS(返回下载URL)
292
295
  const fileUrl = await uploadFileToCos(filePath, credential);
@@ -708,8 +711,9 @@ export const uploadFilesToAdpEndpoint = async (
708
711
  fileMetadatas,
709
712
  maxConcurrency,
710
713
  async (metadata, _index): Promise<UploadedFileInfo> => {
711
- // 为每个文件获取预签名URL
712
- const credential = await getStorageCredential(botToken, fileType);
714
+ // 为每个文件获取预签名URL,优先使用传入的 fileType,否则使用文件的 contentType
715
+ const actualFileType = fileType || metadata.contentType || "";
716
+ const credential = await getStorageCredential(botToken, actualFileType);
713
717
  // 上传文件并获取下载URL
714
718
  const downloadUrl = await uploadFileToCos(metadata.path, credential);
715
719
  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;