@oya-ai/cli 1.0.127 → 1.0.130

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 +9 -6
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -2294,7 +2294,9 @@ async function signup(options) {
2294
2294
  const saved = options.save !== false && saveKey(answer.api_key, http.baseUrl);
2295
2295
  return { apiKey: answer.api_key, claimUrl: answer.claim_url, cloudBrowsers: answer.cloud_browsers, saved };
2296
2296
  }
2297
- var desktopOf = (all) => all.find((b) => b.provider === DESKTOP_PROVIDER && b.health !== "dead");
2297
+ var desktopOf = (all, persona) => all.find(
2298
+ (b) => b.provider === DESKTOP_PROVIDER && b.health !== "dead" && (!persona || b.persona === persona || b.personaName === persona)
2299
+ );
2298
2300
  async function pairingLink(http, persona) {
2299
2301
  const { code } = await http.request("POST", "/api/pairing", {
2300
2302
  persona
@@ -2317,10 +2319,10 @@ function openLink(link) {
2317
2319
  });
2318
2320
  child.unref();
2319
2321
  }
2320
- async function waitForDesktop(list2, link, timeoutMs) {
2322
+ async function waitForDesktop(list2, link, timeoutMs, persona) {
2321
2323
  const deadline = Date.now() + timeoutMs;
2322
2324
  while (Date.now() < deadline) {
2323
- const found = desktopOf(await list2());
2325
+ const found = desktopOf(await list2(), persona);
2324
2326
  if (found) return found;
2325
2327
  await new Promise((r) => setTimeout(r, READY_POLL_MS2));
2326
2328
  }
@@ -2337,14 +2339,15 @@ var desktopApi = (http, list2) => ({
2337
2339
  * The person's own desktop browser, signed in to their sites. When it is not
2338
2340
  * connected yet this pairs it: it opens a link, the person clicks Connect in
2339
2341
  * the app (with "Import my logins" ticked, their Chrome logins come along),
2340
- * and this waits until it is up.
2342
+ * and this waits until it is up. With `persona`, a running app signed in as
2343
+ * another persona is switched the same way: the link reconnects it as this one.
2341
2344
  */
2342
2345
  connect: async (options = {}) => {
2343
- const running = desktopOf(await list2());
2346
+ const running = desktopOf(await list2(), options.persona);
2344
2347
  if (running) return handleOn(http(), running.id);
2345
2348
  const link = await pairingLink(http(), options.persona);
2346
2349
  if (options.open !== false) openLink(link);
2347
- const found = await waitForDesktop(list2, link, options.timeoutMs ?? DESKTOP_TIMEOUT_MS);
2350
+ const found = await waitForDesktop(list2, link, options.timeoutMs ?? DESKTOP_TIMEOUT_MS, options.persona);
2348
2351
  return handleOn(http(), found.id);
2349
2352
  }
2350
2353
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oya-ai/cli",
3
- "version": "1.0.127",
3
+ "version": "1.0.130",
4
4
  "description": "Command line for the Oya browser control plane.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://oyabrowser.com",
@@ -50,7 +50,7 @@
50
50
  "access": "public"
51
51
  },
52
52
  "devDependencies": {
53
- "@oya-ai/browser": "1.0.127",
53
+ "@oya-ai/browser": "1.0.130",
54
54
  "@types/node": "^20.19.43",
55
55
  "tsup": "^8.0.0",
56
56
  "typescript": "^5.4.0"