supbuddy 3.2.6 → 3.2.8

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
@@ -19807,7 +19807,7 @@ function cliBuildKind(env3 = process.env) {
19807
19807
  return raw === "host" || raw === "npm" ? raw : "dev";
19808
19808
  }
19809
19809
  function cliVersion(env3 = process.env) {
19810
- return "3.2.6".trim() || "0.0.0-dev";
19810
+ return "3.2.8".trim() || "0.0.0-dev";
19811
19811
  }
19812
19812
  function isDevBuild(env3) {
19813
19813
  return cliBuildKind(env3) === "dev";
@@ -44969,6 +44969,18 @@ async function daemonSyncStart(projectId, authority) {
44969
44969
  const m = await __vitePreload(() => Promise.resolve().then(() => projectSync), false ? __VITE_PRELOAD__ : void 0);
44970
44970
  return m.syncStart(syncDeps(), { projectId, authority });
44971
44971
  }
44972
+ async function daemonSyncReattach() {
44973
+ const m = await __vitePreload(() => Promise.resolve().then(() => projectSync), false ? __VITE_PRELOAD__ : void 0);
44974
+ const known = useStore.getState().projects.filter((p) => p.cloud?.stackId && p.path).map((p) => ({
44975
+ projectId: p.id,
44976
+ stackId: p.cloud.stackId,
44977
+ localPath: p.path,
44978
+ // Unknowable after a restart and inert for an adopted session — see reattachSessions.
44979
+ authority: "cloud"
44980
+ }));
44981
+ if (known.length === 0) return [];
44982
+ return m.syncReattach(syncDeps(), known);
44983
+ }
44972
44984
  async function daemonSyncStatus(projectId) {
44973
44985
  const m = await __vitePreload(() => Promise.resolve().then(() => projectSync), false ? __VITE_PRELOAD__ : void 0);
44974
44986
  let stackStopped = false;
@@ -52012,6 +52024,9 @@ async function handleStartProxy() {
52012
52024
  reconcileAllProjectServices().catch((err) => {
52013
52025
  console.warn("[Worker] boot rescan failed:", err.message);
52014
52026
  });
52027
+ daemonSyncReattach().then((ids) => {
52028
+ if (ids.length) console.log(`[Worker] re-attached ${ids.length} sync session(s)`);
52029
+ }).catch((err) => console.warn("[Worker] sync re-attach failed:", err.message));
52015
52030
  if (store2.settings.lanSharing) {
52016
52031
  startMdnsResponder();
52017
52032
  }
@@ -57326,6 +57341,35 @@ async function stopProjectSync(deps, projectId) {
57326
57341
  sessions.delete(projectId);
57327
57342
  return { stopped: true };
57328
57343
  }
57344
+ async function reattachSessions(deps, known) {
57345
+ const rt = runtimeDeps(deps);
57346
+ const reattached = [];
57347
+ for (const k of known) {
57348
+ if (sessions.has(k.projectId)) continue;
57349
+ const probe2 = await rt.runMutagen(["sync", "list", sessionName(k.stackId)]);
57350
+ if (probe2.exitCode !== 0) continue;
57351
+ sessions.set(k.projectId, {
57352
+ sessionId: sessionName(k.stackId),
57353
+ stackId: k.stackId,
57354
+ localPath: k.localPath,
57355
+ remoteEndpoint: "",
57356
+ // filled by the next observe; not needed to adopt or to stop
57357
+ authority: k.authority,
57358
+ phase: "connecting",
57359
+ conflictCount: 0,
57360
+ startedAt: (/* @__PURE__ */ new Date()).toISOString(),
57361
+ // Adopted sessions are already past their first pass — Mutagen would not be running them
57362
+ // otherwise — so treating one as unseeded could re-trigger a one-way replica over live work.
57363
+ seeded: true,
57364
+ // And already PROMOTED, for the same reason. Without this the next status poll would "promote"
57365
+ // a session that is already two-way, by TERMINATING and recreating it — and recreate orders
57366
+ // alpha/beta from `authority`, which a restarted daemon cannot know because nothing persists it.
57367
+ promoted: true
57368
+ });
57369
+ reattached.push(k.projectId);
57370
+ }
57371
+ return reattached;
57372
+ }
57329
57373
  function syncDataDir() {
57330
57374
  const override = nodeProcess.env.SUPBUDDY_STATE_DIR;
57331
57375
  if (override) return override;
@@ -57348,6 +57392,9 @@ const toDaemonDeps = (d) => ({
57348
57392
  fetchTailnetKey: d.fetchTailnetKey,
57349
57393
  runMutagen: d.runMutagen
57350
57394
  });
57395
+ async function syncReattach(deps, known) {
57396
+ return reattachSessions(toDaemonDeps(deps), known);
57397
+ }
57351
57398
  async function syncStart(deps, args) {
57352
57399
  const ctx = await deps.resolveProject(args.projectId);
57353
57400
  return startProjectSync(toDaemonDeps(deps), {
@@ -57368,6 +57415,7 @@ const projectSync = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
57368
57415
  __proto__: null,
57369
57416
  clientHostname,
57370
57417
  syncDataDir,
57418
+ syncReattach,
57371
57419
  syncStart,
57372
57420
  syncStatus,
57373
57421
  syncStop
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supbuddy",
3
- "version": "3.2.6",
3
+ "version": "3.2.8",
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",