shellx-cli 0.0.7 → 0.0.9
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/assets/shellx.apk +0 -0
- package/bundle/assets/shellx.apk.sha256 +1 -1
- package/bundle/shellx.js +120 -43
- package/package.json +1 -1
- package/bundle/assets/README.md +0 -5
- package/bundle/assets/shellx-linux-x86_64-1.1.9.zip +0 -0
- package/bundle/assets/shellx-macos-aarch64-1.1.9.zip +0 -0
- package/bundle/assets/shellx-macos-x86_64-1.1.9.zip +0 -0
- package/bundle/assets/shellx-win-x64-1.1.9.zip +0 -0
- package/bundle/assets/shellx-win-x86-1.1.9.zip +0 -0
package/bundle/assets/shellx.apk
CHANGED
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
7306e895435f5ee2758e92d34a4d82a581a854eebaa1448378c7437a2a79d3b8 *shellx.apk
|
package/bundle/shellx.js
CHANGED
|
@@ -138006,8 +138006,8 @@ var GIT_COMMIT_INFO, CLI_VERSION;
|
|
|
138006
138006
|
var init_git_commit = __esm({
|
|
138007
138007
|
"packages/core/dist/src/generated/git-commit.js"() {
|
|
138008
138008
|
"use strict";
|
|
138009
|
-
GIT_COMMIT_INFO = "
|
|
138010
|
-
CLI_VERSION = "0.0.
|
|
138009
|
+
GIT_COMMIT_INFO = "979a427a";
|
|
138010
|
+
CLI_VERSION = "0.0.9";
|
|
138011
138011
|
}
|
|
138012
138012
|
});
|
|
138013
138013
|
|
|
@@ -150655,7 +150655,7 @@ function createContentGeneratorConfig(config, authType) {
|
|
|
150655
150655
|
return contentGeneratorConfig;
|
|
150656
150656
|
}
|
|
150657
150657
|
async function createContentGenerator(config, gcConfig, sessionId2) {
|
|
150658
|
-
const version2 = "0.0.
|
|
150658
|
+
const version2 = "0.0.9";
|
|
150659
150659
|
const userAgent2 = `GeminiCLI/${version2} (${process.platform}; ${process.arch})`;
|
|
150660
150660
|
const baseHeaders = {
|
|
150661
150661
|
"User-Agent": userAgent2
|
|
@@ -236819,13 +236819,53 @@ async function ensureInstallDir() {
|
|
|
236819
236819
|
await fs32.promises.mkdir(SHELLX_BIN_DIR, { recursive: true });
|
|
236820
236820
|
}
|
|
236821
236821
|
}
|
|
236822
|
+
async function copyFileWithSkip(source2, dest) {
|
|
236823
|
+
try {
|
|
236824
|
+
await fs32.promises.copyFile(source2, dest);
|
|
236825
|
+
return true;
|
|
236826
|
+
} catch (error) {
|
|
236827
|
+
if (error.code === "EBUSY" || error.code === "EPERM" || error.code === "EACCES" || error.code === "ETXTBSY") {
|
|
236828
|
+
console.log(`Skipping ${path31.basename(dest)} (file is in use or locked)`);
|
|
236829
|
+
return false;
|
|
236830
|
+
}
|
|
236831
|
+
throw error;
|
|
236832
|
+
}
|
|
236833
|
+
}
|
|
236834
|
+
async function copyDirContents(sourceDir, destDir) {
|
|
236835
|
+
let total = 0;
|
|
236836
|
+
let skipped = 0;
|
|
236837
|
+
const entries = await fs32.promises.readdir(sourceDir, { withFileTypes: true });
|
|
236838
|
+
for (const entry of entries) {
|
|
236839
|
+
const sourcePath = path31.join(sourceDir, entry.name);
|
|
236840
|
+
const destPath = path31.join(destDir, entry.name);
|
|
236841
|
+
if (entry.isDirectory()) {
|
|
236842
|
+
if (!fs32.existsSync(destPath)) {
|
|
236843
|
+
await fs32.promises.mkdir(destPath, { recursive: true });
|
|
236844
|
+
}
|
|
236845
|
+
const result = await copyDirContents(sourcePath, destPath);
|
|
236846
|
+
total += result.total;
|
|
236847
|
+
skipped += result.skipped;
|
|
236848
|
+
} else {
|
|
236849
|
+
total++;
|
|
236850
|
+
const success = await copyFileWithSkip(sourcePath, destPath);
|
|
236851
|
+
if (!success) {
|
|
236852
|
+
skipped++;
|
|
236853
|
+
}
|
|
236854
|
+
}
|
|
236855
|
+
}
|
|
236856
|
+
return { total, skipped };
|
|
236857
|
+
}
|
|
236822
236858
|
async function extractShellX(assetPath) {
|
|
236859
|
+
let tempDir = null;
|
|
236823
236860
|
try {
|
|
236824
236861
|
await ensureInstallDir();
|
|
236862
|
+
tempDir = path31.join(os13.tmpdir(), `shellx-extract-${Date.now()}`);
|
|
236863
|
+
await fs32.promises.mkdir(tempDir, { recursive: true });
|
|
236864
|
+
console.log("Extracting to temporary directory:", tempDir);
|
|
236825
236865
|
const isLinux2 = process.platform === "linux";
|
|
236826
236866
|
if (isLinux2) {
|
|
236827
236867
|
await new Promise((resolve23, reject) => {
|
|
236828
|
-
const unzip = child_process.spawn("unzip", ["-o", assetPath, "-d",
|
|
236868
|
+
const unzip = child_process.spawn("unzip", ["-o", assetPath, "-d", tempDir]);
|
|
236829
236869
|
unzip.on("error", reject);
|
|
236830
236870
|
unzip.on("close", (code) => {
|
|
236831
236871
|
if (code === 0)
|
|
@@ -236835,13 +236875,20 @@ async function extractShellX(assetPath) {
|
|
|
236835
236875
|
});
|
|
236836
236876
|
});
|
|
236837
236877
|
} else {
|
|
236838
|
-
await (0, import_extract_zip.default)(assetPath, { dir:
|
|
236878
|
+
await (0, import_extract_zip.default)(assetPath, { dir: tempDir });
|
|
236879
|
+
}
|
|
236880
|
+
console.log("Copying files to installation directory...");
|
|
236881
|
+
const { total, skipped } = await copyDirContents(tempDir, SHELLX_BIN_DIR);
|
|
236882
|
+
if (skipped > 0) {
|
|
236883
|
+
console.log(`Copied ${total - skipped}/${total} files (${skipped} files skipped due to being in use)`);
|
|
236884
|
+
} else {
|
|
236885
|
+
console.log(`All ${total} files copied successfully`);
|
|
236839
236886
|
}
|
|
236840
236887
|
const assetDir = path31.dirname(assetPath);
|
|
236841
236888
|
const sourceApkPath = path31.join(assetDir, "shellx.apk");
|
|
236842
|
-
await
|
|
236889
|
+
await copyFileWithSkip(sourceApkPath, SHELLX_APK_FILE);
|
|
236843
236890
|
const sourceApkSignPath = path31.join(assetDir, "shellx.apk.sha256");
|
|
236844
|
-
await
|
|
236891
|
+
await copyFileWithSkip(sourceApkSignPath, SHELLX_APK_SIGN_FILE);
|
|
236845
236892
|
console.log("ShellX extracted successfully.");
|
|
236846
236893
|
const version2 = path31.basename(assetPath).split("-")[2].replace(".zip", "");
|
|
236847
236894
|
await fs32.promises.writeFile(SHELLX_VERSION_FILE, version2);
|
|
@@ -236850,6 +236897,14 @@ async function extractShellX(assetPath) {
|
|
|
236850
236897
|
} catch (error) {
|
|
236851
236898
|
console.error("Failed to extract ShellX:", error);
|
|
236852
236899
|
return false;
|
|
236900
|
+
} finally {
|
|
236901
|
+
if (tempDir && fs32.existsSync(tempDir)) {
|
|
236902
|
+
try {
|
|
236903
|
+
await fs32.promises.rm(tempDir, { recursive: true, force: true });
|
|
236904
|
+
} catch (error) {
|
|
236905
|
+
console.log("Failed to clean up temporary directory:", error);
|
|
236906
|
+
}
|
|
236907
|
+
}
|
|
236853
236908
|
}
|
|
236854
236909
|
}
|
|
236855
236910
|
async function launchShellX(justStart = true) {
|
|
@@ -236902,11 +236957,11 @@ function getShellXExecutableInfo() {
|
|
|
236902
236957
|
}
|
|
236903
236958
|
async function launchShellXIfInstalled() {
|
|
236904
236959
|
if (isShellXInstalled()) {
|
|
236905
|
-
return await launchShellX();
|
|
236960
|
+
return await launchShellX(true);
|
|
236906
236961
|
}
|
|
236907
236962
|
return false;
|
|
236908
236963
|
}
|
|
236909
|
-
async function ensureShellXAndLaunch(justStart =
|
|
236964
|
+
async function ensureShellXAndLaunch(justStart = true) {
|
|
236910
236965
|
try {
|
|
236911
236966
|
console.log("Checking ShellX installation...");
|
|
236912
236967
|
const assetPath = getAssetPath();
|
|
@@ -386325,14 +386380,17 @@ var init_config2 = __esm({
|
|
|
386325
386380
|
this.toolRegistry = await this.createToolRegistry();
|
|
386326
386381
|
logCliConfiguration(this, new StartSessionEvent(this, this.toolRegistry));
|
|
386327
386382
|
}
|
|
386328
|
-
|
|
386329
|
-
|
|
386330
|
-
|
|
386331
|
-
|
|
386332
|
-
}
|
|
386333
|
-
const newContentGeneratorConfig = createContentGeneratorConfig(this, authMethod);
|
|
386383
|
+
/**
|
|
386384
|
+
* Connect to ShellX with retry logic
|
|
386385
|
+
*/
|
|
386386
|
+
async connectToShellX(retryCount = 0) {
|
|
386334
386387
|
const deviceId = process23.env["SHELLX_DEVICE_ID"];
|
|
386335
386388
|
try {
|
|
386389
|
+
if (retryCount === 0) {
|
|
386390
|
+
console.log("\u{1F50C} Connecting to ShellX...");
|
|
386391
|
+
} else {
|
|
386392
|
+
console.log(`\u{1F504} Retry attempt ${retryCount}: Reconnecting to ShellX...`);
|
|
386393
|
+
}
|
|
386336
386394
|
let connectionResolved = false;
|
|
386337
386395
|
const createShellXPromise = new Promise(async (resolve23, reject) => {
|
|
386338
386396
|
try {
|
|
@@ -386371,33 +386429,51 @@ var init_config2 = __esm({
|
|
|
386371
386429
|
}, 15e3);
|
|
386372
386430
|
});
|
|
386373
386431
|
this.shellxClient = await Promise.race([createShellXPromise, timeoutPromise]);
|
|
386374
|
-
console.log("ShellX
|
|
386375
|
-
const newGeminiClient = new GeminiClient(this);
|
|
386376
|
-
await newGeminiClient.initialize(newContentGeneratorConfig);
|
|
386377
|
-
const fromGenaiToVertex = this.contentGeneratorConfig?.authType === AuthType2.USE_GEMINI && authMethod === AuthType2.LOGIN_WITH_GOOGLE;
|
|
386378
|
-
this.contentGeneratorConfig = newContentGeneratorConfig;
|
|
386379
|
-
this.geminiClient = newGeminiClient;
|
|
386380
|
-
if (existingHistory.length > 0) {
|
|
386381
|
-
this.geminiClient.setHistory(existingHistory, {
|
|
386382
|
-
stripThoughts: fromGenaiToVertex
|
|
386383
|
-
});
|
|
386384
|
-
}
|
|
386385
|
-
this.inFallbackMode = false;
|
|
386432
|
+
console.log("\u2705 ShellX connected successfully!");
|
|
386386
386433
|
} catch (error) {
|
|
386387
|
-
console.warn(
|
|
386388
|
-
|
|
386389
|
-
|
|
386390
|
-
|
|
386391
|
-
|
|
386392
|
-
|
|
386393
|
-
|
|
386394
|
-
|
|
386395
|
-
|
|
386396
|
-
|
|
386397
|
-
|
|
386398
|
-
|
|
386434
|
+
console.warn(`\u274C ShellX connection failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
386435
|
+
if (retryCount === 0) {
|
|
386436
|
+
console.log("");
|
|
386437
|
+
console.log("\u{1F4E6} Checking ShellX installation...");
|
|
386438
|
+
const shellxResult = await ensureShellXAndLaunch(true);
|
|
386439
|
+
if (shellxResult.success) {
|
|
386440
|
+
console.log(`\u2705 ${shellxResult.message}`);
|
|
386441
|
+
} else {
|
|
386442
|
+
console.error(`\u274C ${shellxResult.message}`);
|
|
386443
|
+
console.log("");
|
|
386444
|
+
console.log("Please ensure:");
|
|
386445
|
+
console.log(" 1. ShellX app is installed on your Android device");
|
|
386446
|
+
console.log(" 2. Device is connected via ADB");
|
|
386447
|
+
console.log(" 3. USB debugging is enabled");
|
|
386448
|
+
console.log(' 4. Run "adb devices" to verify device connection');
|
|
386449
|
+
}
|
|
386399
386450
|
}
|
|
386451
|
+
const retryDelay = Math.min(5e3 + retryCount * 2e3, 3e4);
|
|
386452
|
+
console.log("");
|
|
386453
|
+
console.log(`\u23F3 Retrying in ${retryDelay / 1e3} seconds...`);
|
|
386454
|
+
console.log(` (Attempt ${retryCount + 1})`);
|
|
386455
|
+
console.log("");
|
|
386456
|
+
await new Promise((resolve23) => setTimeout(resolve23, retryDelay));
|
|
386457
|
+
return await this.connectToShellX(retryCount + 1);
|
|
386458
|
+
}
|
|
386459
|
+
}
|
|
386460
|
+
async refreshAuth(authMethod) {
|
|
386461
|
+
let existingHistory = [];
|
|
386462
|
+
if (this.geminiClient && this.geminiClient.isInitialized()) {
|
|
386463
|
+
existingHistory = this.geminiClient.getHistory();
|
|
386464
|
+
}
|
|
386465
|
+
const newContentGeneratorConfig = createContentGeneratorConfig(this, authMethod);
|
|
386466
|
+
const newGeminiClient = new GeminiClient(this);
|
|
386467
|
+
await newGeminiClient.initialize(newContentGeneratorConfig);
|
|
386468
|
+
const fromGenaiToVertex = this.contentGeneratorConfig?.authType === AuthType2.USE_GEMINI && authMethod === AuthType2.LOGIN_WITH_GOOGLE;
|
|
386469
|
+
this.contentGeneratorConfig = newContentGeneratorConfig;
|
|
386470
|
+
this.geminiClient = newGeminiClient;
|
|
386471
|
+
if (existingHistory.length > 0) {
|
|
386472
|
+
this.geminiClient.setHistory(existingHistory, {
|
|
386473
|
+
stripThoughts: fromGenaiToVertex
|
|
386474
|
+
});
|
|
386400
386475
|
}
|
|
386476
|
+
this.inFallbackMode = false;
|
|
386401
386477
|
}
|
|
386402
386478
|
getSessionId() {
|
|
386403
386479
|
return this.sessionId;
|
|
@@ -433799,6 +433875,7 @@ var useAuthCommand = (settings, setAuthError, config) => {
|
|
|
433799
433875
|
}
|
|
433800
433876
|
try {
|
|
433801
433877
|
setIsAuthenticating(true);
|
|
433878
|
+
await config.connectToShellX();
|
|
433802
433879
|
await config.refreshAuth(authType);
|
|
433803
433880
|
console.log(`Authenticated via "${authType}".`);
|
|
433804
433881
|
} catch (e4) {
|
|
@@ -434609,7 +434686,7 @@ async function getPackageJson() {
|
|
|
434609
434686
|
// packages/cli/src/utils/version.ts
|
|
434610
434687
|
async function getCliVersion() {
|
|
434611
434688
|
const pkgJson = await getPackageJson();
|
|
434612
|
-
return "0.0.
|
|
434689
|
+
return "0.0.9";
|
|
434613
434690
|
}
|
|
434614
434691
|
|
|
434615
434692
|
// packages/cli/src/ui/commands/aboutCommand.ts
|
|
@@ -434947,7 +435024,7 @@ init_open();
|
|
|
434947
435024
|
import process31 from "node:process";
|
|
434948
435025
|
|
|
434949
435026
|
// packages/cli/src/generated/git-commit.ts
|
|
434950
|
-
var GIT_COMMIT_INFO2 = "
|
|
435027
|
+
var GIT_COMMIT_INFO2 = "fecca9c3";
|
|
434951
435028
|
|
|
434952
435029
|
// packages/cli/src/ui/commands/bugCommand.ts
|
|
434953
435030
|
init_dist5();
|
|
@@ -458807,7 +458884,7 @@ function AuthInProgress({
|
|
|
458807
458884
|
flexDirection: "column",
|
|
458808
458885
|
padding: 1,
|
|
458809
458886
|
width: "100%",
|
|
458810
|
-
children: timedOut ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { color: Colors.AccentRed, children: "Authentication timed out. Please try again." }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Box_default, { flexDirection: "column", gap: 1, children: [
|
|
458887
|
+
children: timedOut ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { color: Colors.AccentRed, children: "Authentication timed out. Please try again. Ensure your Android device is connected and USB debugging is enabled before continuing." }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Box_default, { flexDirection: "column", gap: 1, children: [
|
|
458811
458888
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Text, { children: [
|
|
458812
458889
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(build_default, { type: "dots" }),
|
|
458813
458890
|
" Waiting for authentication... (Press ESC or CTRL+C to cancel)"
|
|
@@ -470300,7 +470377,7 @@ ${queuedText}` : queuedText;
|
|
|
470300
470377
|
AuthInProgress,
|
|
470301
470378
|
{
|
|
470302
470379
|
onTimeout: () => {
|
|
470303
|
-
setAuthError("Authentication timed out. Please try again.");
|
|
470380
|
+
setAuthError("Authentication timed out. Please try again. Ensure your Android device is connected and USB debugging is enabled before continuing.");
|
|
470304
470381
|
cancelAuthentication();
|
|
470305
470382
|
openAuthDialog();
|
|
470306
470383
|
}
|
package/package.json
CHANGED
package/bundle/assets/README.md
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|