@agent-wechat/cli 0.15.1 → 0.15.2
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 +20 -3
- package/package.json +3 -2
package/dist/cli.js
CHANGED
|
@@ -7870,11 +7870,15 @@ var getMediaParamsSchema = external_exports.object({
|
|
|
7870
7870
|
quality: external_exports.enum(["full", "thumbnail"]).optional()
|
|
7871
7871
|
});
|
|
7872
7872
|
var mediaResultSchema = external_exports.object({
|
|
7873
|
-
type: external_exports.enum(["image", "emoji", "voice", "video", "file", "pending", "unsupported"]),
|
|
7873
|
+
type: external_exports.enum(["image", "emoji", "voice", "video", "file", "pending", "expired", "unsupported"]),
|
|
7874
7874
|
data: external_exports.string().optional(),
|
|
7875
7875
|
url: external_exports.string().optional(),
|
|
7876
7876
|
format: external_exports.string(),
|
|
7877
|
-
filename: external_exports.string()
|
|
7877
|
+
filename: external_exports.string(),
|
|
7878
|
+
quality: external_exports.enum(["full", "standard", "thumbnail"]).optional(),
|
|
7879
|
+
reason: external_exports.string().optional(),
|
|
7880
|
+
expiresAt: external_exports.number().int().positive().optional(),
|
|
7881
|
+
retryable: external_exports.boolean().optional()
|
|
7878
7882
|
});
|
|
7879
7883
|
var agentConfigSchema = external_exports.object({
|
|
7880
7884
|
maxTurns: external_exports.number().int().positive().default(30),
|
|
@@ -7921,6 +7925,14 @@ function createSubscriptionClient(options) {
|
|
|
7921
7925
|
};
|
|
7922
7926
|
}
|
|
7923
7927
|
|
|
7928
|
+
// src/lib/media-status.ts
|
|
7929
|
+
function expiredMediaMessage(result) {
|
|
7930
|
+
if (result.type !== "expired" || result.data) return void 0;
|
|
7931
|
+
const expiry = typeof result.expiresAt === "number" ? new Date(result.expiresAt * 1e3) : void 0;
|
|
7932
|
+
const when = expiry && Number.isFinite(expiry.getTime()) ? ` (${expiry.toISOString()})` : "";
|
|
7933
|
+
return `Media has expired${when} and no cached copy is available. Ask the sender to resend; automatic retries will not recover it.`;
|
|
7934
|
+
}
|
|
7935
|
+
|
|
7924
7936
|
// src/cli.ts
|
|
7925
7937
|
import { spawn, execSync } from "child_process";
|
|
7926
7938
|
import { randomBytes } from "crypto";
|
|
@@ -7929,7 +7941,7 @@ import qrTerminal from "qrcode-terminal";
|
|
|
7929
7941
|
import os from "os";
|
|
7930
7942
|
import path from "path";
|
|
7931
7943
|
import { fileURLToPath } from "url";
|
|
7932
|
-
var VERSION = "0.15.
|
|
7944
|
+
var VERSION = "0.15.2";
|
|
7933
7945
|
var CONTAINER_NAME = "agent-wechat";
|
|
7934
7946
|
var GHCR_IMAGE = "ghcr.io/thisnick/agent-wechat";
|
|
7935
7947
|
var DEFAULT_PORT = 6174;
|
|
@@ -8397,6 +8409,11 @@ ${messages.length} message(s) shown.`);
|
|
|
8397
8409
|
}
|
|
8398
8410
|
async function cmdMedia(client, chatId, localId, outputPath, quality = "best") {
|
|
8399
8411
|
const result = await client.getMedia(chatId, localId, quality);
|
|
8412
|
+
const expired = expiredMediaMessage(result);
|
|
8413
|
+
if (expired) {
|
|
8414
|
+
console.error(expired);
|
|
8415
|
+
process.exit(1);
|
|
8416
|
+
}
|
|
8400
8417
|
if (result.type === "unsupported") {
|
|
8401
8418
|
console.error("No media found for this message (unsupported type or not found).");
|
|
8402
8419
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-wechat/cli",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"wx": "./dist/cli.js"
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "node build.js",
|
|
33
|
-
"typecheck": "tsc --noEmit"
|
|
33
|
+
"typecheck": "tsc --noEmit",
|
|
34
|
+
"test": "node --test --experimental-strip-types src/lib/*.test.mjs"
|
|
34
35
|
}
|
|
35
36
|
}
|