supbuddy 3.1.18 → 3.1.22

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/bin.js CHANGED
@@ -19207,6 +19207,12 @@ function startRelayServer(child, opts) {
19207
19207
  let hostBridgeOwner = null;
19208
19208
  let seq2 = 0;
19209
19209
  const pending = /* @__PURE__ */ new Map();
19210
+ const sendOwnerReady = () => {
19211
+ try {
19212
+ child.send?.({ type: "host-bridge:owner-ready" });
19213
+ } catch {
19214
+ }
19215
+ };
19210
19216
  const failAllPending = (reason) => {
19211
19217
  for (const [, p] of pending) {
19212
19218
  clearTimeout(p.timer);
@@ -19225,17 +19231,11 @@ function startRelayServer(child, opts) {
19225
19231
  }
19226
19232
  });
19227
19233
  socket2.on("host-bridge:claim", () => {
19228
- const hadOwner = hostBridgeOwner !== null;
19229
19234
  if (hostBridgeOwner && hostBridgeOwner.id !== socket2.id) {
19230
19235
  hostBridgeOwner.emit("host-bridge:revoked");
19231
19236
  }
19232
19237
  hostBridgeOwner = socket2;
19233
- if (!hadOwner) {
19234
- try {
19235
- child.send?.({ type: "host-bridge:owner-ready" });
19236
- } catch {
19237
- }
19238
- }
19238
+ sendOwnerReady();
19239
19239
  });
19240
19240
  socket2.on("host-bridge:reply", ({ correlationId, reply }) => {
19241
19241
  const p = pending.get(correlationId);
@@ -19265,6 +19265,10 @@ function startRelayServer(child, opts) {
19265
19265
  });
19266
19266
  };
19267
19267
  const onChildMessage = (m) => {
19268
+ if (m?.type === "host-bridge:owner?") {
19269
+ if (hostBridgeOwner) sendOwnerReady();
19270
+ return;
19271
+ }
19268
19272
  if (isHostBridgeMessage(m)) return;
19269
19273
  io2.emit("worker:message", m);
19270
19274
  };
@@ -19803,7 +19807,7 @@ function cliBuildKind(env3 = process.env) {
19803
19807
  return raw === "host" || raw === "npm" ? raw : "dev";
19804
19808
  }
19805
19809
  function cliVersion(env3 = process.env) {
19806
- return "3.1.18".trim() || "0.0.0-dev";
19810
+ return "3.1.22".trim() || "0.0.0-dev";
19807
19811
  }
19808
19812
  function isDevBuild(env3) {
19809
19813
  return cliBuildKind(env3) === "dev";
@@ -39154,7 +39158,10 @@ async function probe443(timeoutMs = 1e3) {
39154
39158
  }
39155
39159
  async function probePort(port, timeoutMs = 1e3) {
39156
39160
  const results = await Promise.all(["127.0.0.1", "::1"].map((host) => probeHost(host, port, timeoutMs)));
39157
- return results.some(Boolean);
39161
+ if (results.some(Boolean)) return true;
39162
+ await new Promise((r) => setTimeout(r, 150));
39163
+ const confirm = await Promise.all(["127.0.0.1", "::1"].map((host) => probeHost(host, port, timeoutMs)));
39164
+ return confirm.some(Boolean);
39158
39165
  }
39159
39166
  async function probeHost(host, port, timeoutMs) {
39160
39167
  const net2 = await import("net");
@@ -30248,7 +30248,10 @@ async function probe443(timeoutMs = 1e3) {
30248
30248
  }
30249
30249
  async function probePort(port, timeoutMs = 1e3) {
30250
30250
  const results = await Promise.all(["127.0.0.1", "::1"].map((host) => probeHost(host, port, timeoutMs)));
30251
- return results.some(Boolean);
30251
+ if (results.some(Boolean)) return true;
30252
+ await new Promise((r) => setTimeout(r, 150));
30253
+ const confirm2 = await Promise.all(["127.0.0.1", "::1"].map((host) => probeHost(host, port, timeoutMs)));
30254
+ return confirm2.some(Boolean);
30252
30255
  }
30253
30256
  async function probeHost(host, port, timeoutMs) {
30254
30257
  const net2 = await __vitePreload(() => import("net"), false ? __VITE_PRELOAD__ : void 0);
@@ -51581,9 +51584,15 @@ async function requestPrivilegedBatch(command, prompt, tmpFiles = []) {
51581
51584
  process.on("message", handler);
51582
51585
  });
51583
51586
  }
51587
+ let privilegedRepairAttempted = false;
51584
51588
  let guiProxyAutoStartDone = false;
51585
51589
  let lastPrivilegedError = null;
51590
+ let privilegedWorkPending = null;
51586
51591
  const TRANSIENT_PRIVILEGED_FAILURE = /TTY|ASKPASS|detached/i;
51592
+ function shouldFinishPrivilegedSetup(proxyState, privilegedError, workPending) {
51593
+ if (shouldRetryPrivilegedSetup(proxyState, privilegedError)) return true;
51594
+ return TRANSIENT_PRIVILEGED_FAILURE.test(workPending || "");
51595
+ }
51587
51596
  function shouldRetryPrivilegedSetup(proxyState, privilegedError) {
51588
51597
  if (!proxyState.needsPrivilegedRepair) return false;
51589
51598
  return TRANSIENT_PRIVILEGED_FAILURE.test(privilegedError || "");
@@ -51594,14 +51603,21 @@ function isPfRulesetRejection(err, stderr) {
51594
51603
  return stderr.trim().length > 0;
51595
51604
  }
51596
51605
  async function maybeAutoStartProxyForGui() {
51597
- if (guiProxyAutoStartDone) return;
51598
51606
  const store2 = useStore.getState();
51599
51607
  const status = store2.proxyState.status;
51608
+ if (privilegedWorkPending && !privilegedRepairAttempted) {
51609
+ console.log(
51610
+ `[Proxy] owner-ready: status=${status} repairAttempted=${privilegedRepairAttempted} needsRepair=${!!store2.proxyState.needsPrivilegedRepair} pending=${JSON.stringify(privilegedWorkPending)}`
51611
+ );
51612
+ }
51613
+ if (status === "running" && !privilegedRepairAttempted && shouldFinishPrivilegedSetup(store2.proxyState, lastPrivilegedError, privilegedWorkPending)) {
51614
+ privilegedRepairAttempted = true;
51615
+ await retryPrivilegedSetupOnce("proxy is running but its privileged setup never ran (no GUI owner at boot)");
51616
+ return;
51617
+ }
51618
+ if (guiProxyAutoStartDone) return;
51600
51619
  if (status === "running" || status === "starting") {
51601
51620
  guiProxyAutoStartDone = true;
51602
- if (status === "running" && shouldRetryPrivilegedSetup(store2.proxyState, lastPrivilegedError)) {
51603
- await retryPrivilegedSetupOnce("proxy is running but its privileged setup never ran (no GUI owner at boot)");
51604
- }
51605
51621
  return;
51606
51622
  }
51607
51623
  if (!store2.settings.autoStart) return;
@@ -51632,7 +51648,7 @@ async function retryPrivilegedSetupOnce(reason) {
51632
51648
  }
51633
51649
  async function handleStartProxy() {
51634
51650
  const alreadyRunning = isCaddyRunning();
51635
- const repairPending = !!useStore.getState().proxyState.needsPrivilegedRepair;
51651
+ const repairPending = !!useStore.getState().proxyState.needsPrivilegedRepair || !!privilegedWorkPending;
51636
51652
  if (alreadyRunning && !repairPending) {
51637
51653
  const { probeProxyReachability: probeProxyReachability2 } = await __vitePreload(async () => {
51638
51654
  const { probeProxyReachability: probeProxyReachability3 } = await Promise.resolve().then(() => dnsPlatform);
@@ -51762,11 +51778,13 @@ async function handleStartProxy() {
51762
51778
  });
51763
51779
  if (!sudoResult.success) {
51764
51780
  privilegedFailure = sudoResult.error || "unknown error";
51781
+ privilegedWorkPending = privilegedFailure;
51765
51782
  console.error(
51766
51783
  `[Proxy] privileged setup failed (continuing degraded — Caddy still starts): ${privilegedFailure}`
51767
51784
  );
51768
51785
  } else {
51769
51786
  console.log("[Proxy] sudo setup result: success");
51787
+ privilegedWorkPending = null;
51770
51788
  const resolverAudit = await auditResolverState().catch(() => null);
51771
51789
  if (resolverAudit && resolverAudit.in_sync === false && resolverAudit.missing.length > 0) {
51772
51790
  privilegedFailure = `DNS resolver files missing after privileged setup: ${resolverAudit.missing.join(", ")}`;
@@ -51775,6 +51793,7 @@ async function handleStartProxy() {
51775
51793
  }
51776
51794
  } catch (privErr) {
51777
51795
  privilegedFailure = privErr?.message || String(privErr);
51796
+ privilegedWorkPending = privilegedFailure;
51778
51797
  console.error(
51779
51798
  "[Proxy] privileged setup threw (continuing degraded — Caddy still starts):",
51780
51799
  privilegedFailure
@@ -54668,6 +54687,10 @@ async function init() {
54668
54687
  process.exit(0);
54669
54688
  }
54670
54689
  };
54690
+ try {
54691
+ process.send?.({ type: "host-bridge:owner?" });
54692
+ } catch {
54693
+ }
54671
54694
  process.on("SIGINT", () => cleanup());
54672
54695
  process.on("SIGTERM", () => cleanup());
54673
54696
  shutdownHandler = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supbuddy",
3
- "version": "3.1.18",
3
+ "version": "3.1.22",
4
4
  "description": "Run multiple Supabase projects at once on custom local domains with HTTPS. A headless CLI and daemon (proxy, DNS, Supabase/Compose lifecycle, MCP) for macOS and Linux.",
5
5
  "keywords": [
6
6
  "supabase",