@agent-wechat/cli 0.11.0 → 0.11.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 +15 -12
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -7707,7 +7707,6 @@ var sessionSchema = external_exports.object({
|
|
|
7707
7707
|
display: external_exports.string(),
|
|
7708
7708
|
dbusAddress: external_exports.string().optional(),
|
|
7709
7709
|
vncPort: external_exports.number().int(),
|
|
7710
|
-
novncPort: external_exports.number().int(),
|
|
7711
7710
|
status: sessionStatusSchema,
|
|
7712
7711
|
loginState: external_exports.lazy(() => loginStateSchema),
|
|
7713
7712
|
loggedInUser: external_exports.string().optional(),
|
|
@@ -7734,7 +7733,6 @@ var dbSessionRowSchema = external_exports.object({
|
|
|
7734
7733
|
display: external_exports.string(),
|
|
7735
7734
|
dbus_address: external_exports.string().nullable(),
|
|
7736
7735
|
vnc_port: external_exports.number().int(),
|
|
7737
|
-
novnc_port: external_exports.number().int(),
|
|
7738
7736
|
status: external_exports.string(),
|
|
7739
7737
|
login_state: external_exports.string(),
|
|
7740
7738
|
wechat_pid: external_exports.number().int().nullable(),
|
|
@@ -7913,11 +7911,10 @@ import qrTerminal from "qrcode-terminal";
|
|
|
7913
7911
|
import os from "os";
|
|
7914
7912
|
import path from "path";
|
|
7915
7913
|
import { fileURLToPath } from "url";
|
|
7916
|
-
var VERSION = "0.11.
|
|
7914
|
+
var VERSION = "0.11.2";
|
|
7917
7915
|
var CONTAINER_NAME = "agent-wechat";
|
|
7918
7916
|
var GHCR_IMAGE = "ghcr.io/thisnick/agent-wechat";
|
|
7919
7917
|
var DEFAULT_PORT = 6174;
|
|
7920
|
-
var NOVNC_PORT = 6080;
|
|
7921
7918
|
var __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7922
7919
|
var MONOREPO_ROOT = path.resolve(__dirname, "../../..");
|
|
7923
7920
|
var TOKEN_DIR = path.join(os.homedir(), ".config", "agent-wechat");
|
|
@@ -7934,6 +7931,14 @@ function ensureToken() {
|
|
|
7934
7931
|
console.log(`Auth token generated: ${TOKEN_PATH}`);
|
|
7935
7932
|
return token;
|
|
7936
7933
|
}
|
|
7934
|
+
function printNoVncUrl() {
|
|
7935
|
+
const token = readToken();
|
|
7936
|
+
if (token) {
|
|
7937
|
+
console.log(`noVNC: http://localhost:${DEFAULT_PORT}/vnc/?token=${token}&autoconnect=true`);
|
|
7938
|
+
} else {
|
|
7939
|
+
console.log(`noVNC: http://localhost:${DEFAULT_PORT}/vnc/`);
|
|
7940
|
+
}
|
|
7941
|
+
}
|
|
7937
7942
|
function readToken() {
|
|
7938
7943
|
try {
|
|
7939
7944
|
const t = fs.readFileSync(TOKEN_PATH, "utf-8").trim();
|
|
@@ -8471,7 +8476,7 @@ async function cmdSessionList(client) {
|
|
|
8471
8476
|
const login = session.loginState.status === "logged_in" ? "logged in" : session.loginState.status;
|
|
8472
8477
|
console.log(` ${session.id}: ${session.name}`);
|
|
8473
8478
|
console.log(` Status: ${status}, Login: ${login}`);
|
|
8474
|
-
console.log(` Display: ${session.display},
|
|
8479
|
+
console.log(` Display: ${session.display}, VNC: ${session.vncPort}`);
|
|
8475
8480
|
console.log(` User: ${session.linuxUser}`);
|
|
8476
8481
|
if (session.errorMessage) {
|
|
8477
8482
|
console.log(` Error: ${session.errorMessage}`);
|
|
@@ -8487,7 +8492,7 @@ async function cmdSessionCreate(client, name) {
|
|
|
8487
8492
|
console.log(` Name: ${session.name}`);
|
|
8488
8493
|
console.log(` User: ${session.linuxUser}`);
|
|
8489
8494
|
console.log(` Display: ${session.display}`);
|
|
8490
|
-
console.log(`
|
|
8495
|
+
console.log(` VNC Port: ${session.vncPort}`);
|
|
8491
8496
|
console.log(`
|
|
8492
8497
|
Start the session with: pnpm cli session start ${session.name}`);
|
|
8493
8498
|
}
|
|
@@ -8497,7 +8502,7 @@ async function cmdSessionStart(client, idOrName) {
|
|
|
8497
8502
|
console.log(`Session started!`);
|
|
8498
8503
|
console.log(` Status: ${session.status}`);
|
|
8499
8504
|
console.log(` Display: ${session.display}`);
|
|
8500
|
-
console.log(`
|
|
8505
|
+
console.log(` VNC Port: ${session.vncPort}`);
|
|
8501
8506
|
if (session.dbusAddress) {
|
|
8502
8507
|
console.log(` D-Bus: ${session.dbusAddress}`);
|
|
8503
8508
|
}
|
|
@@ -8601,13 +8606,13 @@ async function cmdUp(opts = {}) {
|
|
|
8601
8606
|
if (running) {
|
|
8602
8607
|
console.log(`Container ${CONTAINER_NAME} is already running.`);
|
|
8603
8608
|
console.log(`API: http://localhost:${DEFAULT_PORT}`);
|
|
8604
|
-
|
|
8609
|
+
printNoVncUrl();
|
|
8605
8610
|
return;
|
|
8606
8611
|
}
|
|
8607
8612
|
console.log(`Starting existing container ${CONTAINER_NAME}...`);
|
|
8608
8613
|
execSync(`docker start ${CONTAINER_NAME}`, { stdio: "inherit" });
|
|
8609
8614
|
console.log(`API: http://localhost:${DEFAULT_PORT}`);
|
|
8610
|
-
|
|
8615
|
+
printNoVncUrl();
|
|
8611
8616
|
return;
|
|
8612
8617
|
}
|
|
8613
8618
|
} catch {
|
|
@@ -8648,8 +8653,6 @@ async function cmdUp(opts = {}) {
|
|
|
8648
8653
|
"--cap-add=NET_ADMIN",
|
|
8649
8654
|
"-p",
|
|
8650
8655
|
`${DEFAULT_PORT}:${DEFAULT_PORT}`,
|
|
8651
|
-
"-p",
|
|
8652
|
-
`127.0.0.1:${NOVNC_PORT}:${NOVNC_PORT}`,
|
|
8653
8656
|
"-v",
|
|
8654
8657
|
`${CONTAINER_NAME}-data:/data`,
|
|
8655
8658
|
"-v",
|
|
@@ -8666,7 +8669,7 @@ async function cmdUp(opts = {}) {
|
|
|
8666
8669
|
console.log(`
|
|
8667
8670
|
Container started successfully!`);
|
|
8668
8671
|
console.log(`API: http://localhost:${DEFAULT_PORT}`);
|
|
8669
|
-
|
|
8672
|
+
printNoVncUrl();
|
|
8670
8673
|
console.log(`
|
|
8671
8674
|
Waiting for server to be ready...`);
|
|
8672
8675
|
for (let i = 0; i < 30; i++) {
|