assistme 0.1.8 → 0.1.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/dist/index.js CHANGED
@@ -860,7 +860,7 @@ function isChromeRunning() {
860
860
  return out2.includes("chrome.exe");
861
861
  }
862
862
  if (platform() === "darwin") {
863
- const out2 = execSync('pgrep -f "Google Chrome.app/Contents/MacOS/Google Chrome$"', {
863
+ const out2 = execSync('pgrep -f "Google Chrome.app/Contents/MacOS/Google Chrome"', {
864
864
  encoding: "utf-8",
865
865
  stdio: ["pipe", "pipe", "pipe"]
866
866
  });
@@ -916,23 +916,12 @@ async function killChromeGracefully() {
916
916
  await new Promise((r) => setTimeout(r, 1e3));
917
917
  }
918
918
  function spawnChrome(chromePath, port) {
919
- const os = platform();
920
919
  const cdpFlag = `--remote-debugging-port=${port}`;
921
- let child;
922
- if (os === "darwin") {
923
- const appName = chromePath.includes("Chromium") ? "Chromium" : chromePath.includes("Canary") ? "Google Chrome Canary" : "Google Chrome";
924
- log.debug(`Spawning Chrome via: open -a "${appName}" --args ${cdpFlag} --restore-last-session`);
925
- child = spawn("open", ["-a", appName, "--args", cdpFlag, "--restore-last-session"], {
926
- detached: true,
927
- stdio: "ignore"
928
- });
929
- } else {
930
- log.debug(`Spawning Chrome via: ${chromePath} ${cdpFlag} --restore-last-session`);
931
- child = spawn(chromePath, [cdpFlag, "--restore-last-session"], {
932
- detached: true,
933
- stdio: "ignore"
934
- });
935
- }
920
+ log.debug(`Spawning Chrome: ${chromePath} ${cdpFlag} --restore-last-session`);
921
+ const child = spawn(chromePath, [cdpFlag, "--restore-last-session"], {
922
+ detached: true,
923
+ stdio: "ignore"
924
+ });
936
925
  child.on("error", (err) => {
937
926
  log.error(`Chrome spawn error: ${err.message}`);
938
927
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assistme",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "AssistMe CLI Agent - AI-powered assistant that controls your real browser",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -607,8 +607,9 @@ export function isChromeRunning(): boolean {
607
607
  return out.includes("chrome.exe");
608
608
  }
609
609
  if (platform() === "darwin") {
610
- // Match the actual macOS process name "Google Chrome" (not helper processes)
611
- const out = execSync('pgrep -f "Google Chrome.app/Contents/MacOS/Google Chrome$"', {
610
+ // Match the main Chrome process (not helper/renderer sub-processes).
611
+ // No trailing $ the process command line includes flags after the binary.
612
+ const out = execSync('pgrep -f "Google Chrome.app/Contents/MacOS/Google Chrome"', {
612
613
  encoding: "utf-8",
613
614
  stdio: ["pipe", "pipe", "pipe"],
614
615
  });
@@ -681,30 +682,16 @@ async function killChromeGracefully(): Promise<void> {
681
682
  * Returns the child process so callers can detect early failures.
682
683
  */
683
684
  function spawnChrome(chromePath: string, port: number): ChildProcess {
684
- const os = platform();
685
685
  const cdpFlag = `--remote-debugging-port=${port}`;
686
686
 
687
- let child: ChildProcess;
688
-
689
- if (os === "darwin") {
690
- // Determine app name from binary path
691
- const appName = chromePath.includes("Chromium")
692
- ? "Chromium"
693
- : chromePath.includes("Canary")
694
- ? "Google Chrome Canary"
695
- : "Google Chrome";
696
- log.debug(`Spawning Chrome via: open -a "${appName}" --args ${cdpFlag} --restore-last-session`);
697
- child = spawn("open", ["-a", appName, "--args", cdpFlag, "--restore-last-session"], {
698
- detached: true,
699
- stdio: "ignore",
700
- });
701
- } else {
702
- log.debug(`Spawning Chrome via: ${chromePath} ${cdpFlag} --restore-last-session`);
703
- child = spawn(chromePath, [cdpFlag, "--restore-last-session"], {
704
- detached: true,
705
- stdio: "ignore",
706
- });
707
- }
687
+ // Always invoke the Chrome binary directly rather than `open -a`.
688
+ // On macOS, `open -a` silently ignores --args when Chrome is already
689
+ // running, which would cause CDP to never be enabled.
690
+ log.debug(`Spawning Chrome: ${chromePath} ${cdpFlag} --restore-last-session`);
691
+ const child = spawn(chromePath, [cdpFlag, "--restore-last-session"], {
692
+ detached: true,
693
+ stdio: "ignore",
694
+ });
708
695
 
709
696
  child.on("error", (err) => {
710
697
  log.error(`Chrome spawn error: ${err.message}`);