shellx-ai 1.0.0
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 +335 -0
- package/dist/constants.d.ts +13 -0
- package/dist/constants.js +14 -0
- package/dist/index.d.ts +110 -0
- package/dist/index.js +398 -0
- package/dist/protocol.d.ts +319 -0
- package/dist/protocol.js +2 -0
- package/dist/shellx.d.ts +175 -0
- package/dist/shellx.js +866 -0
- package/dist/utils.d.ts +6 -0
- package/dist/utils.js +37 -0
- package/package.json +61 -0
package/dist/utils.d.ts
ADDED
package/dist/utils.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.wait = void 0;
|
|
4
|
+
exports.getWebSocketUrl = getWebSocketUrl;
|
|
5
|
+
const wait = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
|
6
|
+
exports.wait = wait;
|
|
7
|
+
/**
|
|
8
|
+
* 检查并获取 WebSocket URL 环境变量
|
|
9
|
+
* 如果未设置则显示错误并退出程序
|
|
10
|
+
*/
|
|
11
|
+
function getWebSocketUrl() {
|
|
12
|
+
const wsUrl = process.env.WEBSOCKET_URL;
|
|
13
|
+
if (!wsUrl || wsUrl.trim() === '') {
|
|
14
|
+
console.error('❌ 错误: 未设置 WEBSOCKET_URL 环境变量!');
|
|
15
|
+
console.error('');
|
|
16
|
+
console.error('📋 解决方案:');
|
|
17
|
+
console.error('1. 在项目根目录创建 .env 文件');
|
|
18
|
+
console.error('2. 在 .env 文件中添加以下内容:');
|
|
19
|
+
console.error(' WEBSOCKET_URL=ws://127.0.0.1:9091/api/s/your-session-id');
|
|
20
|
+
console.error('');
|
|
21
|
+
console.error('💡 提示:');
|
|
22
|
+
console.error('- 请将 your-session-id 替换为实际的会话ID');
|
|
23
|
+
console.error('- 确保 ShellX 服务器正在运行');
|
|
24
|
+
console.error('- 检查端口号是否正确(默认9091)');
|
|
25
|
+
console.error('');
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
// 简单的 URL 格式验证
|
|
29
|
+
if (!wsUrl.startsWith('ws://') && !wsUrl.startsWith('wss://')) {
|
|
30
|
+
console.error('❌ 错误: WEBSOCKET_URL 格式不正确!');
|
|
31
|
+
console.error(`当前值: ${wsUrl}`);
|
|
32
|
+
console.error('应该以 ws:// 或 wss:// 开头');
|
|
33
|
+
console.error('例如: ws://127.0.0.1:9091/api/s/your-session-id');
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
return wsUrl;
|
|
37
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "shellx-ai",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "shellx is a powerful WebSocket-based client for controlling shell commands and UI automation on remote devices.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"url": "git+https://github.com/10cl/shellx.git",
|
|
7
|
+
"type": "git"
|
|
8
|
+
},
|
|
9
|
+
"main": "dist/index.js",
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"postbuild": "echo Build completed successfully",
|
|
17
|
+
"prepublishOnly": "npm run build",
|
|
18
|
+
"test": "jest",
|
|
19
|
+
"test:examples": "ts-node -r dotenv/config examples/basic.ts && ts-node -r dotenv/config examples/with-custom-types.ts && ts-node -r dotenv/config examples/queue-and-reconnect.ts",
|
|
20
|
+
"test:comprehensive": "ts-node -r dotenv/config examples/comprehensive-protocol-demo.ts",
|
|
21
|
+
"test:helpers": "ts-node -r dotenv/config examples/helpers-demo.ts",
|
|
22
|
+
"test:paytm": "ts-node -r dotenv/config examples/paytm.ts",
|
|
23
|
+
"test:shellx-ai": "ts-node -r dotenv/config examples/shellx.ai/index.ts",
|
|
24
|
+
"test:shell-commands": "ts-node -r dotenv/config examples/shell-commands-demo.ts",
|
|
25
|
+
"test:no-output": "ts-node -r dotenv/config examples/no-output-command-test.ts",
|
|
26
|
+
"test:find-elements": "ts-node -r dotenv/config examples/find-elements-demo.ts"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"websocket",
|
|
30
|
+
"shell",
|
|
31
|
+
"automation",
|
|
32
|
+
"ui-automation",
|
|
33
|
+
"remote-control",
|
|
34
|
+
"android",
|
|
35
|
+
"adb",
|
|
36
|
+
"device-control"
|
|
37
|
+
],
|
|
38
|
+
"author": "10cl <notice@toscl.com>",
|
|
39
|
+
"license": "MIT",
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"cbor-x": "^1.6.0",
|
|
42
|
+
"dotenv": "^16.4.5",
|
|
43
|
+
"uuid": "^11.1.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/jest": "^30.0.0",
|
|
47
|
+
"@types/node": "^24.0.13",
|
|
48
|
+
"jest": "^30.0.4",
|
|
49
|
+
"ts-jest": "^29.4.0",
|
|
50
|
+
"ts-node": "^10.9.2",
|
|
51
|
+
"typescript": "^5.8.3",
|
|
52
|
+
"langchain": "^0.1.34",
|
|
53
|
+
"promptflow-eval": "1.0.0",
|
|
54
|
+
"promptflow-template": "1.0.0",
|
|
55
|
+
"promptflowx": "^0.1.7"
|
|
56
|
+
},
|
|
57
|
+
"bugs": {
|
|
58
|
+
"url": "https://github.com/10cl/shellx/issues"
|
|
59
|
+
},
|
|
60
|
+
"homepage": "https://github.com/10cl/shellx#readme"
|
|
61
|
+
}
|