unbrowse 3.7.0-preview.3 → 3.7.0-preview.5

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/cli.js CHANGED
@@ -31,7 +31,7 @@ var __promiseAll = (args) => Promise.all(args);
31
31
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
32
32
 
33
33
  // ../../src/build-info.generated.ts
34
- var BUILD_RELEASE_VERSION = "3.7.0-preview.3", BUILD_GIT_SHA = "652904c236e5", BUILD_CODE_HASH = "5d9ebf619c61", BUILD_RELEASE_MANIFEST_BASE64 = "eyJzY2hlbWFfdmVyc2lvbiI6MSwicmVsZWFzZV92ZXJzaW9uIjoiMy43LjAtcHJldmlldy4zIiwiZ2l0X3NoYSI6IjY1MjkwNGMyMzZlNSIsImNvZGVfaGFzaCI6IjVkOWViZjYxOWM2MSIsInRyYWNlX3ZlcnNpb24iOiI1ZDllYmY2MTljNjFANjUyOTA0YzIzNmU1IiwiaXNzdWVkX2F0IjoiMjAyNi0wNC0xMFQwNzoyNzozNS44ODZaIn0", BUILD_RELEASE_MANIFEST_SIGNATURE = "IXw8XfBaII9eVNJCmgvwRyesbKiWJVNMurzf5P2mRb0", BUILD_DEFAULT_BACKEND_URL = "https://beta-api.unbrowse.ai";
34
+ var BUILD_RELEASE_VERSION = "3.7.0-preview.5", BUILD_GIT_SHA = "0179e74b74d8", BUILD_CODE_HASH = "5d9ebf619c61", BUILD_RELEASE_MANIFEST_BASE64 = "eyJzY2hlbWFfdmVyc2lvbiI6MSwicmVsZWFzZV92ZXJzaW9uIjoiMy43LjAtcHJldmlldy41IiwiZ2l0X3NoYSI6IjAxNzllNzRiNzRkOCIsImNvZGVfaGFzaCI6IjVkOWViZjYxOWM2MSIsInRyYWNlX3ZlcnNpb24iOiI1ZDllYmY2MTljNjFAMDE3OWU3NGI3NGQ4IiwiaXNzdWVkX2F0IjoiMjAyNi0wNC0xMFQwODoyNDo0NS40NDBaIn0", BUILD_RELEASE_MANIFEST_SIGNATURE = "IrWCQimPHcH9iVKgAJ3-Bz1Mn363051yBjmnUOQNsXw", BUILD_DEFAULT_BACKEND_URL = "https://beta-api.unbrowse.ai";
35
35
 
36
36
  // ../../src/version.ts
37
37
  import { createHash } from "crypto";
@@ -3375,43 +3375,59 @@ async function bootstrapAgentMailKey() {
3375
3375
  let currentUrl = await getCurrentUrl(tabId);
3376
3376
  let onDashboard = typeof currentUrl === "string" && currentUrl.includes("/dashboard");
3377
3377
  if (!onDashboard) {
3378
- log("bootstrap-agentmail", "not logged in — looking for GitHub OAuth");
3379
- const githubBtn = await evaluate(tabId, `(() => {
3380
- // Clerk renders OAuth buttons — look for GitHub
3378
+ log("bootstrap-agentmail", "not logged in — looking for social OAuth");
3379
+ const clickResult = await evaluate(tabId, `(() => {
3380
+ // Clerk's social button class pattern
3381
+ const socialBtns = document.querySelectorAll('.cl-socialButtonsBlockButton, [data-provider]');
3382
+ for (const btn of socialBtns) {
3383
+ const text = (btn.textContent || '').toLowerCase();
3384
+ const provider = btn.getAttribute('data-provider') || '';
3385
+ // Match any social provider — Google, GitHub, etc.
3386
+ if (text || provider) {
3387
+ btn.click();
3388
+ return 'clicked:' + (provider || text.slice(0, 20));
3389
+ }
3390
+ }
3391
+ // Fallback: look for any button with a known OAuth provider name
3381
3392
  const btns = document.querySelectorAll('button, a');
3382
3393
  for (const btn of btns) {
3383
3394
  const text = (btn.textContent || '').toLowerCase();
3384
- const ariaLabel = (btn.getAttribute('aria-label') || '').toLowerCase();
3385
- if (text.includes('github') || ariaLabel.includes('github') ||
3386
- btn.querySelector('img[alt*="github" i], svg[aria-label*="github" i]')) {
3395
+ if (text.includes('google') || text.includes('github') || text.includes('continue with')) {
3387
3396
  btn.click();
3388
- return 'clicked';
3397
+ return 'clicked:' + text.slice(0, 30);
3389
3398
  }
3390
3399
  }
3391
- // Also check for social login containers
3392
- const social = document.querySelector('.cl-socialButtonsBlockButton__github, [data-provider="github"]');
3393
- if (social) { social.click(); return 'clicked'; }
3394
3400
  return 'not_found';
3395
3401
  })()`);
3396
- if (githubBtn === "clicked") {
3397
- log("bootstrap-agentmail", "clicked GitHub OAuth — waiting for redirect");
3402
+ const clickStr = typeof clickResult === "string" ? clickResult : String(clickResult);
3403
+ log("bootstrap-agentmail", `social button result: ${clickStr}`);
3404
+ if (clickStr.startsWith("clicked")) {
3405
+ log("bootstrap-agentmail", "clicked social OAuth — waiting for redirect");
3398
3406
  const start2 = Date.now();
3399
3407
  while (Date.now() - start2 < AUTH_TIMEOUT_MS) {
3400
3408
  await new Promise((r) => setTimeout(r, 2000));
3401
3409
  currentUrl = await getCurrentUrl(tabId);
3402
3410
  if (typeof currentUrl === "string" && currentUrl.includes("/dashboard")) {
3403
3411
  onDashboard = true;
3404
- log("bootstrap-agentmail", "GitHub OAuth completed — on dashboard");
3412
+ log("bootstrap-agentmail", "OAuth completed — on dashboard");
3405
3413
  break;
3406
3414
  }
3407
3415
  }
3408
3416
  }
3409
3417
  if (!onDashboard) {
3410
3418
  log("bootstrap-agentmail", "could not auto-login — manual setup needed");
3419
+ const pageInfo = await evaluate(tabId, `JSON.stringify({
3420
+ url: window.location.href,
3421
+ title: document.title,
3422
+ visible_buttons: Array.from(document.querySelectorAll('button,a'))
3423
+ .map(e => (e.textContent || '').trim().slice(0, 30))
3424
+ .filter(t => t)
3425
+ .slice(0, 10),
3426
+ })`).catch(() => "{}");
3411
3427
  return {
3412
3428
  success: false,
3413
3429
  method: "manual",
3414
- error: "Could not auto-login to AgentMail console. Sign up at https://console.agentmail.to and create an API key manually."
3430
+ error: `Could not auto-login to AgentMail console. Page state: ${pageInfo}. Sign up at https://console.agentmail.to and create an API key manually, then: export AGENTMAIL_API_KEY=<key>`
3415
3431
  };
3416
3432
  }
3417
3433
  }
@@ -6792,6 +6808,11 @@ async function cmdSetup(flags) {
6792
6808
  properties: { command: "setup" }
6793
6809
  });
6794
6810
  info("Running setup checks");
6811
+ try {
6812
+ await ensureRegistered({ promptForEmail: false, exitOnFailure: false });
6813
+ } catch (err) {
6814
+ info(`[setup] background registration issue: ${err instanceof Error ? err.message : err}`);
6815
+ }
6795
6816
  const report = await runSetup({
6796
6817
  cwd: process.cwd(),
6797
6818
  opencode: normalizeSetupScope(flags.opencode),
@@ -7603,8 +7624,22 @@ async function cmdLoginAuto(args, flags) {
7603
7624
  }
7604
7625
  })();
7605
7626
  const { autonomousEmailLogin: autonomousEmailLogin3, isAgentMailAvailable: isAgentMailAvailable3 } = await init_agent_mail2().then(() => exports_agent_mail2);
7606
- if (!isAgentMailAvailable3())
7607
- return die("AGENTMAIL_API_KEY not set \u2014 run: export AGENTMAIL_API_KEY=<key>");
7627
+ if (!isAgentMailAvailable3()) {
7628
+ info(`[login-auto] AGENTMAIL_API_KEY not set \u2014 attempting auto-bootstrap via console.agentmail.to`);
7629
+ try {
7630
+ const { bootstrapAgentMailKey: bootstrapAgentMailKey2 } = await init_bootstrap_agentmail().then(() => exports_bootstrap_agentmail);
7631
+ const bootstrap = await bootstrapAgentMailKey2();
7632
+ if (bootstrap.success && bootstrap.api_key) {
7633
+ process.env.AGENTMAIL_API_KEY = bootstrap.api_key;
7634
+ info(`[login-auto] bootstrapped AgentMail key via ${bootstrap.method ?? "browser"}`);
7635
+ } else {
7636
+ return die(`AGENTMAIL_API_KEY not set and bootstrap failed: ${bootstrap.error ?? "unknown"}. Get a key at https://agentmail.to and run: export AGENTMAIL_API_KEY=<key>`);
7637
+ }
7638
+ } catch (err) {
7639
+ const msg = err instanceof Error ? err.message : String(err);
7640
+ return die(`AGENTMAIL_API_KEY not set and bootstrap errored: ${msg}. Get a key at https://agentmail.to and run: export AGENTMAIL_API_KEY=<key>`);
7641
+ }
7642
+ }
7608
7643
  info(`[login-auto] creating agent email for ${domain}...`);
7609
7644
  const session = await autonomousEmailLogin3(domain);
7610
7645
  info(`[login-auto] email: ${session.email}`);
package/dist/mcp.js CHANGED
@@ -225,11 +225,11 @@ import { dirname, join, parse } from "path";
225
225
  import { fileURLToPath as fileURLToPath2 } from "url";
226
226
 
227
227
  // ../../src/build-info.generated.ts
228
- var BUILD_RELEASE_VERSION = "3.7.0-preview.3";
229
- var BUILD_GIT_SHA = "652904c236e5";
228
+ var BUILD_RELEASE_VERSION = "3.7.0-preview.5";
229
+ var BUILD_GIT_SHA = "0179e74b74d8";
230
230
  var BUILD_CODE_HASH = "5d9ebf619c61";
231
- var BUILD_RELEASE_MANIFEST_BASE64 = "eyJzY2hlbWFfdmVyc2lvbiI6MSwicmVsZWFzZV92ZXJzaW9uIjoiMy43LjAtcHJldmlldy4zIiwiZ2l0X3NoYSI6IjY1MjkwNGMyMzZlNSIsImNvZGVfaGFzaCI6IjVkOWViZjYxOWM2MSIsInRyYWNlX3ZlcnNpb24iOiI1ZDllYmY2MTljNjFANjUyOTA0YzIzNmU1IiwiaXNzdWVkX2F0IjoiMjAyNi0wNC0xMFQwNzoyNzozNS44ODZaIn0";
232
- var BUILD_RELEASE_MANIFEST_SIGNATURE = "IXw8XfBaII9eVNJCmgvwRyesbKiWJVNMurzf5P2mRb0";
231
+ var BUILD_RELEASE_MANIFEST_BASE64 = "eyJzY2hlbWFfdmVyc2lvbiI6MSwicmVsZWFzZV92ZXJzaW9uIjoiMy43LjAtcHJldmlldy41IiwiZ2l0X3NoYSI6IjAxNzllNzRiNzRkOCIsImNvZGVfaGFzaCI6IjVkOWViZjYxOWM2MSIsInRyYWNlX3ZlcnNpb24iOiI1ZDllYmY2MTljNjFAMDE3OWU3NGI3NGQ4IiwiaXNzdWVkX2F0IjoiMjAyNi0wNC0xMFQwODoyNDo0NS40NDBaIn0";
232
+ var BUILD_RELEASE_MANIFEST_SIGNATURE = "IrWCQimPHcH9iVKgAJ3-Bz1Mn363051yBjmnUOQNsXw";
233
233
  var BUILD_DEFAULT_BACKEND_URL = "https://beta-api.unbrowse.ai";
234
234
 
235
235
  // ../../src/version.ts
package/dist/server.js CHANGED
@@ -7120,7 +7120,7 @@ var init_capture = __esm(async () => {
7120
7120
  });
7121
7121
 
7122
7122
  // ../../src/build-info.generated.ts
7123
- var BUILD_RELEASE_VERSION = "3.7.0-preview.3", BUILD_GIT_SHA = "652904c236e5", BUILD_CODE_HASH = "5d9ebf619c61", BUILD_RELEASE_MANIFEST_BASE64 = "eyJzY2hlbWFfdmVyc2lvbiI6MSwicmVsZWFzZV92ZXJzaW9uIjoiMy43LjAtcHJldmlldy4zIiwiZ2l0X3NoYSI6IjY1MjkwNGMyMzZlNSIsImNvZGVfaGFzaCI6IjVkOWViZjYxOWM2MSIsInRyYWNlX3ZlcnNpb24iOiI1ZDllYmY2MTljNjFANjUyOTA0YzIzNmU1IiwiaXNzdWVkX2F0IjoiMjAyNi0wNC0xMFQwNzoyNzozNS44ODZaIn0", BUILD_RELEASE_MANIFEST_SIGNATURE = "IXw8XfBaII9eVNJCmgvwRyesbKiWJVNMurzf5P2mRb0", BUILD_DEFAULT_BACKEND_URL = "https://beta-api.unbrowse.ai";
7123
+ var BUILD_RELEASE_VERSION = "3.7.0-preview.5", BUILD_GIT_SHA = "0179e74b74d8", BUILD_CODE_HASH = "5d9ebf619c61", BUILD_RELEASE_MANIFEST_BASE64 = "eyJzY2hlbWFfdmVyc2lvbiI6MSwicmVsZWFzZV92ZXJzaW9uIjoiMy43LjAtcHJldmlldy41IiwiZ2l0X3NoYSI6IjAxNzllNzRiNzRkOCIsImNvZGVfaGFzaCI6IjVkOWViZjYxOWM2MSIsInRyYWNlX3ZlcnNpb24iOiI1ZDllYmY2MTljNjFAMDE3OWU3NGI3NGQ4IiwiaXNzdWVkX2F0IjoiMjAyNi0wNC0xMFQwODoyNDo0NS40NDBaIn0", BUILD_RELEASE_MANIFEST_SIGNATURE = "IrWCQimPHcH9iVKgAJ3-Bz1Mn363051yBjmnUOQNsXw", BUILD_DEFAULT_BACKEND_URL = "https://beta-api.unbrowse.ai";
7124
7124
 
7125
7125
  // ../../src/version.ts
7126
7126
  import { createHash as createHash2 } from "crypto";
@@ -26566,11 +26566,18 @@ async function registerRoutes(app) {
26566
26566
  app.addHook("onRequest", async (req, reply) => {
26567
26567
  if (req.url === "/health" || req.url === "/v1/stats" || req.url.startsWith("/v1/settings"))
26568
26568
  return;
26569
- const key = getApiKey();
26569
+ let key = getApiKey();
26570
+ if (!key) {
26571
+ try {
26572
+ const { waitForBackgroundRegistration: waitForBackgroundRegistration2 } = await Promise.resolve().then(() => (init_client2(), exports_client2));
26573
+ await waitForBackgroundRegistration2(1e4);
26574
+ key = getApiKey();
26575
+ } catch {}
26576
+ }
26570
26577
  if (!key) {
26571
26578
  return reply.code(401).send({
26572
26579
  error: "api_key_required",
26573
- message: "No API key configured. Restart the server to auto-register, or run: bash scripts/setup.sh",
26580
+ message: "No API key configured. Run `unbrowse setup` to register, or set UNBROWSE_API_KEY manually.",
26574
26581
  docs_url: "https://unbrowse.ai"
26575
26582
  });
26576
26583
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unbrowse",
3
- "version": "3.7.0-preview.3",
3
+ "version": "3.7.0-preview.5",
4
4
  "description": "Reverse-engineer any website into reusable API skills. Zero-dep single binary with embedded browser engine.",
5
5
  "type": "module",
6
6
  "bin": {