@pulso/companion 0.4.0 → 0.4.1

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/dist/index.js +12 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -530,7 +530,16 @@ async function handleCommand(command, params) {
530
530
  case "sys_open_url": {
531
531
  const url = params.url;
532
532
  if (!url) return { success: false, error: "Missing URL" };
533
- await runShell(`open "${url.replace(/"/g, "")}"`);
533
+ const sanitizedUrl = url.replace(/"/g, '\\"');
534
+ try {
535
+ await runAppleScript(`
536
+ tell application "Google Chrome"
537
+ activate
538
+ tell front window to make new tab with properties {URL:"${sanitizedUrl}"}
539
+ end tell`);
540
+ } catch {
541
+ await runShell(`open "${url.replace(/"/g, "")}"`);
542
+ }
534
543
  return { success: true, data: { opened: url } };
535
544
  }
536
545
  case "sys_speak": {
@@ -1194,7 +1203,7 @@ print("\\(x),\\(y)")`;
1194
1203
  tell application "Safari"
1195
1204
  activate
1196
1205
  if (count of windows) = 0 then make new document
1197
- set URL of front document to "${url.replace(/"/g, '\\"')}"
1206
+ tell front window to set current tab to (make new tab with properties {URL:"${url.replace(/"/g, '\\"')}"})
1198
1207
  end tell`);
1199
1208
  } else {
1200
1209
  await runAppleScript(`
@@ -1202,10 +1211,8 @@ print("\\(x),\\(y)")`;
1202
1211
  activate
1203
1212
  if (count of windows) = 0 then
1204
1213
  make new window
1205
- set URL of active tab of front window to "${url.replace(/"/g, '\\"')}"
1206
- else
1207
- set URL of active tab of front window to "${url.replace(/"/g, '\\"')}"
1208
1214
  end if
1215
+ tell front window to make new tab with properties {URL:"${url.replace(/"/g, '\\"')}"}
1209
1216
  end tell`);
1210
1217
  }
1211
1218
  return { success: true, data: { navigated: url, browser } };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pulso/companion",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "type": "module",
5
5
  "description": "Pulso Companion — gives your AI agent real control over your computer",
6
6
  "bin": {