aai-lark-bridge 0.2.40 → 0.2.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/dist/cli.js +14 -4
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Command } from "commander";
|
|
|
4
4
|
// package.json
|
|
5
5
|
var package_default = {
|
|
6
6
|
name: "aai-lark-bridge",
|
|
7
|
-
version: "0.2.
|
|
7
|
+
version: "0.2.41",
|
|
8
8
|
description: "Lark AI Native Bridge - Lark\u57FA\u7840\u8BBE\u65BD\u5C42\u548CCLI\u96C6\u6210",
|
|
9
9
|
type: "module",
|
|
10
10
|
main: "./dist/index.js",
|
|
@@ -20844,7 +20844,8 @@ function createGateway(opts) {
|
|
|
20844
20844
|
const started = Date.now();
|
|
20845
20845
|
const { messageId, fileKey, opts: ropts } = readFileParams(input);
|
|
20846
20846
|
const dir = tmpDirOf(h.runId);
|
|
20847
|
-
const
|
|
20847
|
+
const outName = `${fileKey}.bin`;
|
|
20848
|
+
let path = join29(dir, outName);
|
|
20848
20849
|
const fail = (result, extra = {}) => log.warn("user-gateway", "read.failed", { ...fields, result, ...extra });
|
|
20849
20850
|
if (!existsSync10(path)) {
|
|
20850
20851
|
if (await tmpBytes() >= (opts.tmpMaxBytes ?? MAX_TMP_BYTES)) {
|
|
@@ -20857,7 +20858,7 @@ function createGateway(opts) {
|
|
|
20857
20858
|
dl = (async () => {
|
|
20858
20859
|
await mkdir19(dir, { recursive: true, mode: 448 });
|
|
20859
20860
|
const r2 = await opts.exec(
|
|
20860
|
-
["im", "+messages-resources-download", "--message-id", messageId, "--file-key", fileKey, "--type", "file", "--as", "user", "--output",
|
|
20861
|
+
["im", "+messages-resources-download", "--message-id", messageId, "--file-key", fileKey, "--type", "file", "--as", "user", "--output", outName],
|
|
20861
20862
|
env(userDir(h.openId)),
|
|
20862
20863
|
DOWNLOAD_TIMEOUT_MS,
|
|
20863
20864
|
dir
|
|
@@ -20872,11 +20873,20 @@ function createGateway(opts) {
|
|
|
20872
20873
|
return larkFailure(h, fields, r);
|
|
20873
20874
|
}
|
|
20874
20875
|
}
|
|
20876
|
+
if (!existsSync10(path)) {
|
|
20877
|
+
try {
|
|
20878
|
+
const hit = (await readdir6(dir)).filter((n) => n.startsWith(fileKey));
|
|
20879
|
+
if (hit.length === 1) path = join29(dir, hit[0]);
|
|
20880
|
+
} catch {
|
|
20881
|
+
}
|
|
20882
|
+
}
|
|
20875
20883
|
let size;
|
|
20876
20884
|
try {
|
|
20877
20885
|
size = (await stat8(path)).size;
|
|
20878
20886
|
} catch {
|
|
20879
|
-
return { status: "expired" };
|
|
20887
|
+
if (![...handles.values()].includes(h)) return { status: "expired" };
|
|
20888
|
+
fail("lark_error", { detail: "\u4E0B\u8F7D\u540E\u627E\u4E0D\u5230\u6587\u4EF6" });
|
|
20889
|
+
return { status: "lark_error", detail: "\u4E0B\u8F7D\u540E\u627E\u4E0D\u5230\u6587\u4EF6" };
|
|
20880
20890
|
}
|
|
20881
20891
|
if (size > MAX_FILE_BYTES) {
|
|
20882
20892
|
await rm14(path, { force: true });
|