shellx-ai 1.0.5 → 1.0.6
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/index.js +7 -7
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -57,7 +57,7 @@ exports.DEFAULT_CONFIG = {
|
|
|
57
57
|
onError: () => { },
|
|
58
58
|
onReconnectFailed: () => { },
|
|
59
59
|
};
|
|
60
|
-
const
|
|
60
|
+
const cbor_1 = require("cbor");
|
|
61
61
|
// 安全地获取环境变量,兼容浏览器和Node.js环境
|
|
62
62
|
let authKey = (0, utils_1.getEnvVar)('SHELLX_AUTH_KEY');
|
|
63
63
|
/**
|
|
@@ -171,7 +171,7 @@ class WebSocketTaskClient {
|
|
|
171
171
|
const authMessage = { authenticate: authKey };
|
|
172
172
|
console.log('📤 [Auth] 发送认证消息:', { authenticate: authKey });
|
|
173
173
|
if (this.ws && this.wsConnected) {
|
|
174
|
-
this.ws.send((0,
|
|
174
|
+
this.ws.send((0, cbor_1.encode)(authMessage));
|
|
175
175
|
}
|
|
176
176
|
else {
|
|
177
177
|
console.error('❌ [Auth] WebSocket未连接,无法发送认证消息');
|
|
@@ -199,7 +199,7 @@ class WebSocketTaskClient {
|
|
|
199
199
|
this.processServerMessage(serverMessage);
|
|
200
200
|
return;
|
|
201
201
|
}
|
|
202
|
-
serverMessage = (0,
|
|
202
|
+
serverMessage = (0, cbor_1.decode)(binaryData);
|
|
203
203
|
this.processServerMessage(serverMessage);
|
|
204
204
|
}
|
|
205
205
|
catch (cborError) {
|
|
@@ -321,7 +321,7 @@ class WebSocketTaskClient {
|
|
|
321
321
|
if (this.shellxConnected && this.ws) {
|
|
322
322
|
try {
|
|
323
323
|
console.log('📤 [ShellX] 发送消息:', message);
|
|
324
|
-
this.ws.send((0,
|
|
324
|
+
this.ws.send((0, cbor_1.encode)(message));
|
|
325
325
|
if (!taskType)
|
|
326
326
|
resolve(undefined); // For fire-and-forget messages
|
|
327
327
|
}
|
|
@@ -506,7 +506,7 @@ class WebSocketTaskClient {
|
|
|
506
506
|
if (this.shellxConnected && this.ws) {
|
|
507
507
|
try {
|
|
508
508
|
console.log('📤 [ShellX] 发送消息:', message);
|
|
509
|
-
this.ws.send((0,
|
|
509
|
+
this.ws.send((0, cbor_1.encode)(message));
|
|
510
510
|
const promise = new Promise((promiseResolve, promiseReject) => {
|
|
511
511
|
if (taskType) {
|
|
512
512
|
if (taskId != null) {
|
|
@@ -543,7 +543,7 @@ class WebSocketTaskClient {
|
|
|
543
543
|
console.log('🏓 [ShellX] 开始心跳检测...');
|
|
544
544
|
this.pingIntervalId = setInterval(() => {
|
|
545
545
|
if (this.ws && this.shellxConnected) {
|
|
546
|
-
this.ws.send((0,
|
|
546
|
+
this.ws.send((0, cbor_1.encode)({ ping: BigInt(Date.now()) }));
|
|
547
547
|
}
|
|
548
548
|
}, this.config.pingInterval);
|
|
549
549
|
}
|
|
@@ -573,7 +573,7 @@ class WebSocketTaskClient {
|
|
|
573
573
|
if (message) {
|
|
574
574
|
try {
|
|
575
575
|
console.log('flushQueue Sending message:', message);
|
|
576
|
-
this.ws.send((0,
|
|
576
|
+
this.ws.send((0, cbor_1.encode)(message));
|
|
577
577
|
}
|
|
578
578
|
catch (error) {
|
|
579
579
|
console.error('Failed to send queued message:', error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shellx-ai",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "shellx is a powerful WebSocket-based client for controlling shell commands and UI automation on remote devices.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "git+https://github.com/10cl/shellx.git",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"author": "10cl <notice@toscl.com>",
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"cbor
|
|
33
|
+
"cbor": "^9.0.0",
|
|
34
34
|
"dotenv": "^16.4.5",
|
|
35
35
|
"ofetch": "^1.4.1",
|
|
36
36
|
"uuid": "^11.1.0"
|