thrust-cli 1.0.3 → 1.0.4

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/package.json +1 -1
  2. package/utils/daemon.js +20 -18
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thrust-cli",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "The local agent for Thrust AI Director",
5
5
  "type": "module",
6
6
  "homepage": "https://thrust.web.app",
package/utils/daemon.js CHANGED
@@ -151,7 +151,8 @@ export async function startDaemon(preferredPort) {
151
151
  }
152
152
  }
153
153
 
154
- function safeOpenBrowser(url) {
154
+ // --- BULLETPROOF BROWSER OPENER ---
155
+ async function safeOpenBrowser(url) {
155
156
  try {
156
157
  if (process.env.TERMUX_VERSION) {
157
158
  exec(`termux-open-url ${url}`, (err) => {
@@ -160,25 +161,26 @@ function safeOpenBrowser(url) {
160
161
  } else if (!process.env.DISPLAY && process.platform === 'linux') {
161
162
  console.log("šŸ‘‰ [Headless] Please open the URL manually in a browser.");
162
163
  } else {
163
- // Async wrapper to handle fallback logic safely
164
- const launchBrowser = async () => {
164
+ try {
165
+ // OS-Specific Chrome Executable Names to force App Mode
166
+ const chromeName = process.platform === 'darwin' ? 'google chrome' :
167
+ process.platform === 'win32' ? 'chrome' : 'google-chrome';
168
+
169
+ // Force a small, docked 800x600 native app window without toolbars
170
+ await open(url, {
171
+ app: {
172
+ name: chromeName,
173
+ arguments: [`--app=${url}`, '--window-size=800,600']
174
+ }
175
+ });
176
+ } catch (err) {
177
+ // If Chrome isn't installed, fail gracefully to the default normal browser
165
178
  try {
166
- // Try to launch Chrome in minimal app mode (Requires newer open version)
167
- if (open.apps && open.apps.chrome) {
168
- await open(url, { app: { name: open.apps.chrome, arguments: [`--app=${url}`, '--window-size=1000,800'] } });
169
- } else {
170
- throw new Error("Chrome App mode unsupported by package.");
171
- }
172
- } catch (err) {
173
- // Fallback to the system's default browser safely
174
- try {
175
- await open(url);
176
- } catch (fallbackErr) {
177
- console.log("\nšŸ‘‰ OS prevented launching the browser automatically. Please open the URL above manually.\n");
178
- }
179
+ await open(url);
180
+ } catch (fallbackErr) {
181
+ console.log("\nšŸ‘‰ OS prevented launching the browser automatically. Please open the URL above manually.\n");
179
182
  }
180
- };
181
- launchBrowser();
183
+ }
182
184
  }
183
185
  } catch (e) {
184
186
  console.log("\nšŸ‘‰ Please open the URL above manually.\n");