@agent-wechat/cli 0.8.3 → 0.8.5
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/README.md +1 -1
- package/dist/cli.js +48 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ wx messages send <chatId> --text "Hello"
|
|
|
46
46
|
| `wx up [--proxy user:pass@host:port]` | Start the agent-wechat container |
|
|
47
47
|
| `wx down` | Stop and remove the container |
|
|
48
48
|
| `wx logs` | Tail container logs |
|
|
49
|
-
| `wx status` | Show container and login status |
|
|
49
|
+
| `wx status` | Show container up/down status and login status (when available) |
|
|
50
50
|
|
|
51
51
|
### Auth
|
|
52
52
|
|
package/dist/cli.js
CHANGED
|
@@ -7911,7 +7911,7 @@ import qrTerminal from "qrcode-terminal";
|
|
|
7911
7911
|
import os from "os";
|
|
7912
7912
|
import path from "path";
|
|
7913
7913
|
import { fileURLToPath } from "url";
|
|
7914
|
-
var VERSION = "0.8.
|
|
7914
|
+
var VERSION = "0.8.5";
|
|
7915
7915
|
var CONTAINER_NAME = "agent-wechat";
|
|
7916
7916
|
var GHCR_IMAGE = "ghcr.io/thisnick/agent-wechat";
|
|
7917
7917
|
var DEFAULT_PORT = 6174;
|
|
@@ -8090,10 +8090,53 @@ program2.command("a11y").description("Dump accessibility tree").addOption(
|
|
|
8090
8090
|
await cmdA11y(getClient(), options.format);
|
|
8091
8091
|
});
|
|
8092
8092
|
async function cmdStatus(client) {
|
|
8093
|
-
const
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
|
|
8093
|
+
const container = getContainerRuntimeState();
|
|
8094
|
+
if (container === "up") {
|
|
8095
|
+
console.log("Container: up");
|
|
8096
|
+
} else if (container === "down") {
|
|
8097
|
+
console.log("Container: down");
|
|
8098
|
+
return;
|
|
8099
|
+
} else {
|
|
8100
|
+
console.log("Container: unknown (Docker unavailable)");
|
|
8101
|
+
return;
|
|
8102
|
+
}
|
|
8103
|
+
try {
|
|
8104
|
+
const status = await client.status();
|
|
8105
|
+
console.log("Server: reachable");
|
|
8106
|
+
console.log("Version:", status.version);
|
|
8107
|
+
} catch (err) {
|
|
8108
|
+
console.log("Server: unreachable");
|
|
8109
|
+
console.log(`Error: ${err instanceof Error ? err.message : String(err)}`);
|
|
8110
|
+
return;
|
|
8111
|
+
}
|
|
8112
|
+
try {
|
|
8113
|
+
const auth = await client.authStatus();
|
|
8114
|
+
if (auth.status === "logged_in") {
|
|
8115
|
+
console.log(`Login: logged in${auth.loggedInUser ? ` as ${auth.loggedInUser}` : ""}`);
|
|
8116
|
+
} else {
|
|
8117
|
+
console.log(`Login: ${auth.status.replace(/_/g, " ")}`);
|
|
8118
|
+
}
|
|
8119
|
+
} catch {
|
|
8120
|
+
console.log("Login: unknown (auth status unavailable)");
|
|
8121
|
+
}
|
|
8122
|
+
}
|
|
8123
|
+
function getContainerRuntimeState() {
|
|
8124
|
+
try {
|
|
8125
|
+
const existing = execSync(`docker ps -aq -f "name=^${CONTAINER_NAME}$"`, {
|
|
8126
|
+
encoding: "utf-8",
|
|
8127
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
8128
|
+
}).trim();
|
|
8129
|
+
if (!existing) {
|
|
8130
|
+
return "down";
|
|
8131
|
+
}
|
|
8132
|
+
const running = execSync(`docker ps -q -f "name=^${CONTAINER_NAME}$"`, {
|
|
8133
|
+
encoding: "utf-8",
|
|
8134
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
8135
|
+
}).trim();
|
|
8136
|
+
return running ? "up" : "down";
|
|
8137
|
+
} catch {
|
|
8138
|
+
return "unknown";
|
|
8139
|
+
}
|
|
8097
8140
|
}
|
|
8098
8141
|
async function cmdLogin(options, timeoutMs = 3e5, newAccount = false) {
|
|
8099
8142
|
console.log(newAccount ? "Initiating login with new account...\n" : "Initiating login...\n");
|