shellx-cli 0.0.21 → 0.0.22

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.
Files changed (2) hide show
  1. package/bundle/shellx.js +99 -13
  2. package/package.json +6 -6
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 = "0db37712";
143079
+ GIT_COMMIT_INFO = "c04c6e88";
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.21";
233006
+ const version3 = "0.0.22";
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.21",
302333
+ ideVersion: "0.0.22",
302334
302334
  platform: getPlatform(),
302335
302335
  updateChannel: await getReleaseChannel(__dirname3)
302336
302336
  }))();
@@ -331751,7 +331751,7 @@ var require_dist9 = __commonJS({
331751
331751
  return __awaiter(this, void 0, void 0, function* () {
331752
331752
  var _a5, _b2;
331753
331753
  try {
331754
- this.wsUrl = yield this.authenticateDevice(this.deviceId);
331754
+ this.wsUrl = yield this.authenticateDevice();
331755
331755
  if (!this.wsUrl) {
331756
331756
  this.config.onError(new Event("connection"));
331757
331757
  this.reconnect();
@@ -331805,7 +331805,7 @@ var require_dist9 = __commonJS({
331805
331805
  }
331806
331806
  });
331807
331807
  }
331808
- authenticateDevice(deviceId) {
331808
+ authenticateDevice() {
331809
331809
  return __awaiter(this, void 0, void 0, function* () {
331810
331810
  let fallbackUrl = void 0;
331811
331811
  try {
@@ -331817,7 +331817,7 @@ var require_dist9 = __commonJS({
331817
331817
  if (localResp.ok) {
331818
331818
  const info2 = yield localResp.json();
331819
331819
  if (info2 && (info2.status === "ok" || info2.status === 1) && info2.uuid) {
331820
- if (deviceId === void 0 || deviceId === info2.uuid) {
331820
+ if (this.deviceId === void 0 || this.deviceId === info2.uuid) {
331821
331821
  const localUuid = info2.uuid;
331822
331822
  this.deviceId = localUuid;
331823
331823
  fallbackUrl = `ws://127.0.0.1:9091/api/s/${localUuid}`;
@@ -331828,14 +331828,14 @@ var require_dist9 = __commonJS({
331828
331828
  }
331829
331829
  } catch (e3) {
331830
331830
  }
331831
- if (deviceId === void 0) {
331831
+ if (this.deviceId === void 0) {
331832
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");
331833
331833
  return void 0;
331834
331834
  }
331835
331835
  try {
331836
331836
  console.log("\u{1F511} [Auth] \u6B63\u5728\u8BA4\u8BC1\u8BBE\u5907...");
331837
331837
  const featGlobal = this.getFetch();
331838
- const deviceApiUrl = (0, domain_manager_1.buildDeviceApiUrl)(deviceId);
331838
+ const deviceApiUrl = (0, domain_manager_1.buildDeviceApiUrl)(this.deviceId);
331839
331839
  const jsonData = yield featGlobal(deviceApiUrl, {
331840
331840
  method: "GET",
331841
331841
  headers: {
@@ -331846,7 +331846,7 @@ var require_dist9 = __commonJS({
331846
331846
  if (!jsonData || jsonData === null || !jsonData.machine || !jsonData.authenticate) {
331847
331847
  console.error("\u274C [Auth] ShellX.ai\u8BBE\u5907\u672A\u6CE8\u518C\u6216\u8BA4\u8BC1\u4FE1\u606F\u65E0\u6548");
331848
331848
  const wsServerUrl = (0, domain_manager_1.getWsServerUrl)();
331849
- return `wss://${wsServerUrl}/api/s/${deviceId}`;
331849
+ return `wss://${wsServerUrl}/api/s/${this.deviceId}`;
331850
331850
  }
331851
331851
  console.log("\u2705 [Auth] ShellX.ai\u8BBE\u5907\u8BA4\u8BC1\u6210\u529F");
331852
331852
  console.log(`\u{1F4E1} [Auth] \u8BBE\u5907ID: ${jsonData.authenticate}`);
@@ -334164,6 +334164,29 @@ async function killShellX() {
334164
334164
  return false;
334165
334165
  }
334166
334166
  }
334167
+ async function stopShellX() {
334168
+ console.log("Stopping ShellX...");
334169
+ try {
334170
+ const platform13 = os14.platform();
334171
+ const shellxBin = platform13 === "win32" ? path35.join(SHELLX_BIN_DIR, "shellx.exe") : path35.join(SHELLX_BIN_DIR, "shellx");
334172
+ if (!fs36.existsSync(shellxBin)) {
334173
+ console.warn("ShellX binary not found; skipping stop request.");
334174
+ return false;
334175
+ }
334176
+ const subprocess = child_process.spawn(shellxBin, ["--stop"], {
334177
+ detached: true,
334178
+ stdio: "pipe",
334179
+ windowsHide: false,
334180
+ shell: false,
334181
+ cwd: SHELLX_BIN_DIR
334182
+ });
334183
+ subprocess.unref();
334184
+ return true;
334185
+ } catch (error) {
334186
+ console.error("Failed to stop ShellX:", error);
334187
+ return false;
334188
+ }
334189
+ }
334167
334190
  function isShellXInstalled() {
334168
334191
  const platform13 = os14.platform();
334169
334192
  const shellxBin = platform13 === "win32" ? path35.join(SHELLX_BIN_DIR, "shellx.exe") : path35.join(SHELLX_BIN_DIR, "shellx");
@@ -334230,11 +334253,15 @@ function getDeviceIdFromFile() {
334230
334253
  }
334231
334254
  function saveDeviceIdToFile(deviceId) {
334232
334255
  try {
334256
+ if (!deviceId || typeof deviceId !== "string" || deviceId.trim() === "") {
334257
+ console.warn("Invalid device ID provided, skipping save:", deviceId);
334258
+ return false;
334259
+ }
334233
334260
  const dir = path35.dirname(SHELLX_DEVICE_ID_FILE);
334234
334261
  if (!fs36.existsSync(dir)) {
334235
334262
  fs36.mkdirSync(dir, { recursive: true });
334236
334263
  }
334237
- fs36.writeFileSync(SHELLX_DEVICE_ID_FILE, deviceId, "utf8");
334264
+ fs36.writeFileSync(SHELLX_DEVICE_ID_FILE, deviceId.trim(), "utf8");
334238
334265
  return true;
334239
334266
  } catch (error) {
334240
334267
  console.warn("Failed to save device ID to file:", error);
@@ -334858,7 +334885,9 @@ var init_config3 = __esm({
334858
334885
  }
334859
334886
  },
334860
334887
  onOpen: (deviceId2) => {
334861
- saveDeviceIdToFile(deviceId2);
334888
+ if (deviceId2) {
334889
+ saveDeviceIdToFile(deviceId2);
334890
+ }
334862
334891
  this.startConnectionMonitoring();
334863
334892
  try {
334864
334893
  client.getClient().sendMessage({
@@ -415292,7 +415321,7 @@ var WarningMessage = ({ text }) => {
415292
415321
  };
415293
415322
 
415294
415323
  // packages/cli/src/generated/git-commit.ts
415295
- var GIT_COMMIT_INFO2 = "0db37712";
415324
+ var GIT_COMMIT_INFO2 = "c04c6e88";
415296
415325
 
415297
415326
  // packages/cli/src/ui/components/AboutBox.tsx
415298
415327
  var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
@@ -429032,7 +429061,7 @@ var __filename3 = fileURLToPath10(import.meta.url);
429032
429061
  var __dirname7 = path59.dirname(__filename3);
429033
429062
  async function getCliVersion() {
429034
429063
  const pkgJson = await getPackageJson(__dirname7);
429035
- return "0.0.21";
429064
+ return "0.0.22";
429036
429065
  }
429037
429066
 
429038
429067
  // packages/cli/src/ui/commands/aboutCommand.ts
@@ -436116,6 +436145,62 @@ ${deviceManagementUrl}`
436116
436145
  }
436117
436146
  };
436118
436147
 
436148
+ // packages/cli/src/ui/commands/stopCommand.ts
436149
+ init_dist6();
436150
+ var stopCommand = {
436151
+ name: "stop",
436152
+ altNames: [],
436153
+ description: "Stop ShellX platform tools service",
436154
+ kind: "built-in" /* BUILT_IN */,
436155
+ action: async (context2) => {
436156
+ const { ui: ui2 } = context2;
436157
+ if (ui2.pendingItem) {
436158
+ ui2.addItem(
436159
+ {
436160
+ type: "error" /* ERROR */,
436161
+ text: "Already processing a request, wait for previous request to complete"
436162
+ },
436163
+ Date.now()
436164
+ );
436165
+ return;
436166
+ }
436167
+ ui2.setPendingItem({
436168
+ type: "info" /* INFO */,
436169
+ text: "Stopping ShellX..."
436170
+ });
436171
+ try {
436172
+ const result = await stopShellX();
436173
+ if (result) {
436174
+ ui2.addItem(
436175
+ {
436176
+ type: "info" /* INFO */,
436177
+ text: `\u2705 ShellX stopped successfully`
436178
+ },
436179
+ Date.now()
436180
+ );
436181
+ } else {
436182
+ ui2.addItem(
436183
+ {
436184
+ type: "error" /* ERROR */,
436185
+ text: `\u274C Failed to stop ShellX`
436186
+ },
436187
+ Date.now()
436188
+ );
436189
+ }
436190
+ } catch (error) {
436191
+ ui2.addItem(
436192
+ {
436193
+ type: "error" /* ERROR */,
436194
+ text: `Stop failed: ${error instanceof Error ? error.message : String(error)}`
436195
+ },
436196
+ Date.now()
436197
+ );
436198
+ } finally {
436199
+ ui2.setPendingItem(null);
436200
+ }
436201
+ }
436202
+ };
436203
+
436119
436204
  // packages/cli/src/ui/commands/quitCommand.ts
436120
436205
  var quitCommand = {
436121
436206
  name: "quit",
@@ -436464,6 +436549,7 @@ var BuiltinCommandLoader = class {
436464
436549
  loginCommand,
436465
436550
  installCommand,
436466
436551
  startCommand,
436552
+ stopCommand,
436467
436553
  // shellx.ai add end
436468
436554
  aboutCommand,
436469
436555
  // authCommand,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shellx-cli",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "engines": {
5
5
  "node": ">=20.0.0"
6
6
  },
@@ -99,6 +99,7 @@
99
99
  "eslint-plugin-license-header": "^0.8.0",
100
100
  "eslint-plugin-react": "^7.37.5",
101
101
  "eslint-plugin-react-hooks": "^5.2.0",
102
+ "eval": "^0.1.8",
102
103
  "glob": "^10.4.5",
103
104
  "globals": "^16.0.0",
104
105
  "google-artifactregistry-auth": "^3.4.0",
@@ -114,6 +115,9 @@
114
115
  "prettier": "^3.5.3",
115
116
  "react-devtools-core": "^6.1.2",
116
117
  "semver": "^7.7.2",
118
+ "shellx-files-arm64": "^0.0.2",
119
+ "shellx-platform-tools": "^0.0.16",
120
+ "simple-git": "^3.28.0",
117
121
  "strip-ansi": "^7.1.2",
118
122
  "tsx": "^4.20.3",
119
123
  "typescript-eslint": "^8.30.1",
@@ -121,11 +125,7 @@
121
125
  "yargs": "^17.7.2"
122
126
  },
123
127
  "dependencies": {
124
- "eval": "^0.1.8",
125
- "latest-version": "^9.0.0",
126
- "shellx-files-arm64": "^0.0.2",
127
- "shellx-platform-tools": "^0.0.16",
128
- "simple-git": "^3.28.0"
128
+ "latest-version": "^9.0.0"
129
129
  },
130
130
  "optionalDependencies": {
131
131
  "@lydell/node-pty": "1.1.0",