shellx-cli 0.0.20 → 0.0.21
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/bundle/shellx.js +82 -59
- package/package.json +3 -1
package/bundle/shellx.js
CHANGED
|
@@ -143076,7 +143076,7 @@ var GIT_COMMIT_INFO, CLI_VERSION;
|
|
|
143076
143076
|
var init_git_commit = __esm({
|
|
143077
143077
|
"packages/core/dist/src/generated/git-commit.js"() {
|
|
143078
143078
|
"use strict";
|
|
143079
|
-
GIT_COMMIT_INFO = "
|
|
143079
|
+
GIT_COMMIT_INFO = "0db37712";
|
|
143080
143080
|
CLI_VERSION = "0.15.0-nightly.20251107.b8eeb553";
|
|
143081
143081
|
}
|
|
143082
143082
|
});
|
|
@@ -233003,7 +233003,7 @@ async function createContentGenerator(config, gcConfig, sessionId2) {
|
|
|
233003
233003
|
if (gcConfig.fakeResponses) {
|
|
233004
233004
|
return FakeContentGenerator.fromFile(gcConfig.fakeResponses);
|
|
233005
233005
|
}
|
|
233006
|
-
const version3 = "0.0.
|
|
233006
|
+
const version3 = "0.0.21";
|
|
233007
233007
|
const userAgent = `GeminiCLI/${version3} (${process.platform}; ${process.arch})`;
|
|
233008
233008
|
const baseHeaders = {
|
|
233009
233009
|
"User-Agent": userAgent
|
|
@@ -302330,7 +302330,7 @@ async function getClientMetadata() {
|
|
|
302330
302330
|
if (!clientMetadataPromise) {
|
|
302331
302331
|
clientMetadataPromise = (async () => ({
|
|
302332
302332
|
ideName: "GEMINI_CLI",
|
|
302333
|
-
ideVersion: "0.0.
|
|
302333
|
+
ideVersion: "0.0.21",
|
|
302334
302334
|
platform: getPlatform(),
|
|
302335
302335
|
updateChannel: await getReleaseChannel(__dirname3)
|
|
302336
302336
|
}))();
|
|
@@ -319583,7 +319583,7 @@ var require_domain_manager = __commonJS({
|
|
|
319583
319583
|
return config.protocol + domain;
|
|
319584
319584
|
}
|
|
319585
319585
|
function getWsServerUrl(config = DEFAULT_DOMAIN_CONFIG) {
|
|
319586
|
-
return
|
|
319586
|
+
return config.international;
|
|
319587
319587
|
}
|
|
319588
319588
|
function buildDeviceApiUrl(deviceId, config = DEFAULT_DOMAIN_CONFIG) {
|
|
319589
319589
|
return `${getApiBaseUrl(config)}/api/device/${deviceId}`;
|
|
@@ -331687,8 +331687,32 @@ var require_dist9 = __commonJS({
|
|
|
331687
331687
|
onReconnectFailed: () => {
|
|
331688
331688
|
}
|
|
331689
331689
|
};
|
|
331690
|
+
function extractUUIDFromUrl(url2) {
|
|
331691
|
+
try {
|
|
331692
|
+
const uuidMatch = url2.match(/\/(?:api\/[ts]\/)([a-f0-9\-]{36})(?:\?|\/|$)/);
|
|
331693
|
+
if (uuidMatch && uuidMatch[1]) {
|
|
331694
|
+
console.log(`[ShellX] Extracted UUID from WebSocket URL: ${uuidMatch[1]}, url: ${url2}`);
|
|
331695
|
+
return uuidMatch[1];
|
|
331696
|
+
}
|
|
331697
|
+
console.log(`[ShellX] Could not extract UUID from WebSocket URL: ${url2}`);
|
|
331698
|
+
return null;
|
|
331699
|
+
} catch (error) {
|
|
331700
|
+
console.error(`[ShellX] Error extracting UUID from URL: ${error.message}, url: ${url2}`);
|
|
331701
|
+
return null;
|
|
331702
|
+
}
|
|
331703
|
+
}
|
|
331704
|
+
function addSessionIdToUrl(url2) {
|
|
331705
|
+
const uuid = extractUUIDFromUrl(url2);
|
|
331706
|
+
if (!uuid) {
|
|
331707
|
+
console.log(`[ShellX] No UUID found in URL, returning original URL: ${url2}`);
|
|
331708
|
+
return url2;
|
|
331709
|
+
}
|
|
331710
|
+
const separator = url2.includes("?") ? "&" : "?";
|
|
331711
|
+
const urlWithSessionId = `${url2}${separator}session_id=${uuid}`;
|
|
331712
|
+
console.log(`[ShellX] Added session_id to WebSocket URL: ${urlWithSessionId}, session_id: ${uuid}`);
|
|
331713
|
+
return urlWithSessionId;
|
|
331714
|
+
}
|
|
331690
331715
|
var cbor_1 = require_cbor();
|
|
331691
|
-
var authKey = (0, utils_1.getEnvVar)("SHELLX_AUTH_KEY");
|
|
331692
331716
|
function getWebSocket() {
|
|
331693
331717
|
return __awaiter(this, void 0, void 0, function* () {
|
|
331694
331718
|
if (typeof globalThis.WebSocket !== "undefined") {
|
|
@@ -331733,17 +331757,29 @@ var require_dist9 = __commonJS({
|
|
|
331733
331757
|
this.reconnect();
|
|
331734
331758
|
return;
|
|
331735
331759
|
}
|
|
331760
|
+
const wsUrlWithSessionId = addSessionIdToUrl(this.wsUrl);
|
|
331736
331761
|
console.log("Initializing ShellX client wsUrl:" + this.wsUrl + " deviceId: " + this.deviceId);
|
|
331762
|
+
console.log("WebSocket URL with session_id: " + wsUrlWithSessionId);
|
|
331737
331763
|
const WebSocketConstructor = yield getWebSocket();
|
|
331738
|
-
this.ws = new WebSocketConstructor(
|
|
331764
|
+
this.ws = new WebSocketConstructor(wsUrlWithSessionId);
|
|
331739
331765
|
if (this.ws.binaryType !== void 0) {
|
|
331740
331766
|
this.ws.binaryType = "arraybuffer";
|
|
331741
331767
|
}
|
|
331742
331768
|
this.ws.onopen = () => {
|
|
331743
|
-
|
|
331769
|
+
var _a6, _b3;
|
|
331770
|
+
console.log("\u{1F517} [ShellX] WebSocket\u8FDE\u63A5\u5DF2\u5EFA\u7ACB:" + this.wsUrl);
|
|
331744
331771
|
this.wsConnected = true;
|
|
331745
331772
|
this.reconnectAttempts = 0;
|
|
331746
|
-
this.
|
|
331773
|
+
this.shellxConnected = true;
|
|
331774
|
+
(_b3 = (_a6 = this.config).onOpen) === null || _b3 === void 0 ? void 0 : _b3.call(_a6, this.deviceId);
|
|
331775
|
+
this.flushQueue();
|
|
331776
|
+
this.startPing();
|
|
331777
|
+
const isAndroidSandbox = process.env["SANDBOX"] === "android";
|
|
331778
|
+
if (isAndroidSandbox) {
|
|
331779
|
+
this.getScreenInfo();
|
|
331780
|
+
} else {
|
|
331781
|
+
this.getAndWakeScreen();
|
|
331782
|
+
}
|
|
331747
331783
|
};
|
|
331748
331784
|
this.ws.onmessage = (event) => {
|
|
331749
331785
|
this.handleMessage(event);
|
|
@@ -331796,11 +331832,6 @@ var require_dist9 = __commonJS({
|
|
|
331796
331832
|
console.warn("\u274C [Auth] \u8BBE\u5907ID\u672A\u8BBE\u7F6E\uFF0C\u672C\u5730\u672A\u8FDE\u63A5USB\uFF0C\u8BF7\u8BBE\u7F6E\u73AF\u5883\u53D8\u91CF SHELLX_DEVICE_ID \u6216\u8005 USB\u8FDE\u63A5\u8BBE\u5907");
|
|
331797
331833
|
return void 0;
|
|
331798
331834
|
}
|
|
331799
|
-
authKey = (0, utils_1.getEnvVar)("SHELLX_AUTH_KEY");
|
|
331800
|
-
if (!authKey) {
|
|
331801
|
-
authKey = (0, uuid_1.v4)();
|
|
331802
|
-
console.log("\u2705 [Auth] SHELLX_AUTH_KEY \u73AF\u5883\u53D8\u91CF\u672A\u8BBE\u7F6E, \u751F\u6210\u65B0\u7684authKey: " + authKey);
|
|
331803
|
-
}
|
|
331804
331835
|
try {
|
|
331805
331836
|
console.log("\u{1F511} [Auth] \u6B63\u5728\u8BA4\u8BC1\u8BBE\u5907...");
|
|
331806
331837
|
const featGlobal = this.getFetch();
|
|
@@ -331865,29 +331896,6 @@ var require_dist9 = __commonJS({
|
|
|
331865
331896
|
}
|
|
331866
331897
|
});
|
|
331867
331898
|
}
|
|
331868
|
-
/**
|
|
331869
|
-
* 发送认证消息
|
|
331870
|
-
*/
|
|
331871
|
-
sendAuthenticationMessage() {
|
|
331872
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
331873
|
-
try {
|
|
331874
|
-
authKey = (0, utils_1.getEnvVar)("SHELLX_AUTH_KEY");
|
|
331875
|
-
if (!authKey) {
|
|
331876
|
-
authKey = (0, uuid_1.v4)();
|
|
331877
|
-
console.log("\u2705 [Auth] SHELLX_AUTH_KEY \u73AF\u5883\u53D8\u91CF\u672A\u8BBE\u7F6E, \u751F\u6210\u65B0\u7684authKey: " + authKey);
|
|
331878
|
-
}
|
|
331879
|
-
const authMessage = { authenticate: authKey };
|
|
331880
|
-
console.log("\u{1F4E4} [Auth] \u53D1\u9001\u8BA4\u8BC1\u6D88\u606F:", { authenticate: authKey });
|
|
331881
|
-
if (this.ws && this.wsConnected) {
|
|
331882
|
-
this.ws.send((0, cbor_1.encode)(authMessage));
|
|
331883
|
-
} else {
|
|
331884
|
-
console.error("\u274C [Auth] ShellX \u672A\u8FDE\u63A5\uFF0C\u65E0\u6CD5\u53D1\u9001\u8BA4\u8BC1\u6D88\u606F");
|
|
331885
|
-
}
|
|
331886
|
-
} catch (error) {
|
|
331887
|
-
console.error("\u274C [Auth] \u53D1\u9001\u8BA4\u8BC1\u6D88\u606F\u5931\u8D25:", error);
|
|
331888
|
-
}
|
|
331889
|
-
});
|
|
331890
|
-
}
|
|
331891
331899
|
handleMessage(event) {
|
|
331892
331900
|
let serverMessage;
|
|
331893
331901
|
try {
|
|
@@ -331920,22 +331928,8 @@ var require_dist9 = __commonJS({
|
|
|
331920
331928
|
}
|
|
331921
331929
|
}
|
|
331922
331930
|
processServerMessage(message) {
|
|
331923
|
-
var _a5, _b2
|
|
331924
|
-
this.
|
|
331925
|
-
if (this.authenticated && !this.shellxConnected) {
|
|
331926
|
-
this.shellxConnected = true;
|
|
331927
|
-
console.log("\u2705 [ShellX] ShellX.ai\u670D\u52A1\u8FDE\u63A5\u6210\u529F\uFF01");
|
|
331928
|
-
(_b2 = (_a5 = this.config).onOpen) === null || _b2 === void 0 ? void 0 : _b2.call(_a5);
|
|
331929
|
-
this.flushQueue();
|
|
331930
|
-
this.startPing();
|
|
331931
|
-
const isAndroidSandbox = process.env["SANDBOX"] === "android";
|
|
331932
|
-
if (isAndroidSandbox) {
|
|
331933
|
-
this.getScreenInfo();
|
|
331934
|
-
} else {
|
|
331935
|
-
this.getAndWakeScreen();
|
|
331936
|
-
}
|
|
331937
|
-
}
|
|
331938
|
-
(_d = (_c2 = this.config).onMessage) === null || _d === void 0 ? void 0 : _d.call(_c2, message);
|
|
331931
|
+
var _a5, _b2;
|
|
331932
|
+
(_b2 = (_a5 = this.config).onMessage) === null || _b2 === void 0 ? void 0 : _b2.call(_a5, message);
|
|
331939
331933
|
if (message.jsonData) {
|
|
331940
331934
|
this.handleJsonDataResponse(message.jsonData);
|
|
331941
331935
|
}
|
|
@@ -334223,7 +334217,31 @@ async function isShellXUpdate() {
|
|
|
334223
334217
|
const localVersion = getLocalBinaryVersion();
|
|
334224
334218
|
return !localVersion || localVersion !== targetVersion;
|
|
334225
334219
|
}
|
|
334226
|
-
|
|
334220
|
+
function getDeviceIdFromFile() {
|
|
334221
|
+
try {
|
|
334222
|
+
if (fs36.existsSync(SHELLX_DEVICE_ID_FILE)) {
|
|
334223
|
+
const deviceId = fs36.readFileSync(SHELLX_DEVICE_ID_FILE, "utf8").trim();
|
|
334224
|
+
return deviceId || null;
|
|
334225
|
+
}
|
|
334226
|
+
} catch (error) {
|
|
334227
|
+
console.warn("Failed to read device ID from file:", error);
|
|
334228
|
+
}
|
|
334229
|
+
return null;
|
|
334230
|
+
}
|
|
334231
|
+
function saveDeviceIdToFile(deviceId) {
|
|
334232
|
+
try {
|
|
334233
|
+
const dir = path35.dirname(SHELLX_DEVICE_ID_FILE);
|
|
334234
|
+
if (!fs36.existsSync(dir)) {
|
|
334235
|
+
fs36.mkdirSync(dir, { recursive: true });
|
|
334236
|
+
}
|
|
334237
|
+
fs36.writeFileSync(SHELLX_DEVICE_ID_FILE, deviceId, "utf8");
|
|
334238
|
+
return true;
|
|
334239
|
+
} catch (error) {
|
|
334240
|
+
console.warn("Failed to save device ID to file:", error);
|
|
334241
|
+
return false;
|
|
334242
|
+
}
|
|
334243
|
+
}
|
|
334244
|
+
var import_extract_zip, shellxFilesArm64Path, SUPPORTED_PLATFORMS, SHELLX_INSTALL_DIR, SHELLX_BIN_DIR, SHELLX_APK_FILE, SHELLX_APK_SIGN_FILE, SHELLX_PLATFORM_TOOLS_PACKAGE, SHELLX_BINARY_VERSION_FILE, SHELLX_DEVICE_ID_FILE;
|
|
334227
334245
|
var init_shellx_manager = __esm({
|
|
334228
334246
|
"packages/core/dist/src/shellx/shellx-manager.js"() {
|
|
334229
334247
|
"use strict";
|
|
@@ -334248,6 +334266,7 @@ var init_shellx_manager = __esm({
|
|
|
334248
334266
|
SHELLX_APK_SIGN_FILE = path35.join(SHELLX_BIN_DIR, "shellx.apk.sha256");
|
|
334249
334267
|
SHELLX_PLATFORM_TOOLS_PACKAGE = "shellx-platform-tools";
|
|
334250
334268
|
SHELLX_BINARY_VERSION_FILE = path35.join(SHELLX_INSTALL_DIR, "binary-version.txt");
|
|
334269
|
+
SHELLX_DEVICE_ID_FILE = path35.join(SHELLX_INSTALL_DIR, "device-id.txt");
|
|
334251
334270
|
}
|
|
334252
334271
|
});
|
|
334253
334272
|
|
|
@@ -334807,7 +334826,10 @@ var init_config3 = __esm({
|
|
|
334807
334826
|
console.log("ShellX is already connected, skipping reconnection.");
|
|
334808
334827
|
return;
|
|
334809
334828
|
}
|
|
334810
|
-
|
|
334829
|
+
let deviceId = process24.env["SHELLX_DEVICE_ID"];
|
|
334830
|
+
if (!deviceId) {
|
|
334831
|
+
deviceId = getDeviceIdFromFile() || void 0;
|
|
334832
|
+
}
|
|
334811
334833
|
try {
|
|
334812
334834
|
if (retryCount === 0) {
|
|
334813
334835
|
console.log("\u{1F50C} Connecting to ShellX...");
|
|
@@ -334835,7 +334857,8 @@ var init_config3 = __esm({
|
|
|
334835
334857
|
resolve23(client);
|
|
334836
334858
|
}
|
|
334837
334859
|
},
|
|
334838
|
-
onOpen: () => {
|
|
334860
|
+
onOpen: (deviceId2) => {
|
|
334861
|
+
saveDeviceIdToFile(deviceId2);
|
|
334839
334862
|
this.startConnectionMonitoring();
|
|
334840
334863
|
try {
|
|
334841
334864
|
client.getClient().sendMessage({
|
|
@@ -415269,7 +415292,7 @@ var WarningMessage = ({ text }) => {
|
|
|
415269
415292
|
};
|
|
415270
415293
|
|
|
415271
415294
|
// packages/cli/src/generated/git-commit.ts
|
|
415272
|
-
var GIT_COMMIT_INFO2 = "
|
|
415295
|
+
var GIT_COMMIT_INFO2 = "0db37712";
|
|
415273
415296
|
|
|
415274
415297
|
// packages/cli/src/ui/components/AboutBox.tsx
|
|
415275
415298
|
var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -429009,7 +429032,7 @@ var __filename3 = fileURLToPath10(import.meta.url);
|
|
|
429009
429032
|
var __dirname7 = path59.dirname(__filename3);
|
|
429010
429033
|
async function getCliVersion() {
|
|
429011
429034
|
const pkgJson = await getPackageJson(__dirname7);
|
|
429012
|
-
return "0.0.
|
|
429035
|
+
return "0.0.21";
|
|
429013
429036
|
}
|
|
429014
429037
|
|
|
429015
429038
|
// packages/cli/src/ui/commands/aboutCommand.ts
|
|
@@ -433359,7 +433382,7 @@ var checkCwdSync = (dir) => {
|
|
|
433359
433382
|
}
|
|
433360
433383
|
}
|
|
433361
433384
|
};
|
|
433362
|
-
var
|
|
433385
|
+
var mkdirSync6 = (dir, opt) => {
|
|
433363
433386
|
dir = normalizeWindowsPath(dir);
|
|
433364
433387
|
const umask = opt.umask ?? 18;
|
|
433365
433388
|
const mode = opt.mode | 448;
|
|
@@ -434209,7 +434232,7 @@ var UnpackSync = class extends Unpack {
|
|
|
434209
434232
|
}
|
|
434210
434233
|
[MKDIR](dir, mode) {
|
|
434211
434234
|
try {
|
|
434212
|
-
return
|
|
434235
|
+
return mkdirSync6(normalizeWindowsPath(dir), {
|
|
434213
434236
|
uid: this.uid,
|
|
434214
434237
|
gid: this.gid,
|
|
434215
434238
|
processUid: this.processUid,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shellx-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=20.0.0"
|
|
6
6
|
},
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"sandboxImageUri": "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.15.0-nightly.20251107.b8eeb553"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
|
+
"postinstall": "node scripts/install-shellx-files.js",
|
|
19
20
|
"start": "cross-env NODE_ENV=development node scripts/start.js",
|
|
20
21
|
"start:a2a-server": "CODER_AGENT_PORT=41242 npm run start --workspace @google/gemini-cli-a2a-server",
|
|
21
22
|
"debug": "cross-env DEBUG=1 node --inspect-brk scripts/start.js",
|
|
@@ -123,6 +124,7 @@
|
|
|
123
124
|
"eval": "^0.1.8",
|
|
124
125
|
"latest-version": "^9.0.0",
|
|
125
126
|
"shellx-files-arm64": "^0.0.2",
|
|
127
|
+
"shellx-platform-tools": "^0.0.16",
|
|
126
128
|
"simple-git": "^3.28.0"
|
|
127
129
|
},
|
|
128
130
|
"optionalDependencies": {
|