supbuddy 3.0.7 → 3.0.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
@@ -79,9 +79,9 @@ function makeElevate(quiet) {
79
79
  const askpass = process.env.SUPBUDDY_ASKPASS || process.env.SUDO_ASKPASS;
80
80
  let cmd;
81
81
  let args;
82
- const env2 = { ...process.env };
82
+ const env3 = { ...process.env };
83
83
  if (askpass) {
84
- env2.SUDO_ASKPASS = askpass;
84
+ env3.SUDO_ASKPASS = askpass;
85
85
  cmd = "sudo";
86
86
  args = ["-A", "bash", "-c", command];
87
87
  } else if (process.stdin.isTTY) {
@@ -99,7 +99,7 @@ function makeElevate(quiet) {
99
99
  }
100
100
  try {
101
101
  await new Promise((resolve, reject) => {
102
- const child = spawn(cmd, args, { stdio: "inherit", env: env2 });
102
+ const child = spawn(cmd, args, { stdio: "inherit", env: env3 });
103
103
  child.on("error", reject);
104
104
  child.on(
105
105
  "exit",
@@ -166,9 +166,9 @@ var init_host_cli = __esm({
166
166
  }
167
167
  });
168
168
 
169
- // ../../node_modules/accepts/node_modules/negotiator/lib/charset.js
169
+ // ../../node_modules/.pnpm/negotiator@0.6.3/node_modules/negotiator/lib/charset.js
170
170
  var require_charset = __commonJS({
171
- "../../node_modules/accepts/node_modules/negotiator/lib/charset.js"(exports, module) {
171
+ "../../node_modules/.pnpm/negotiator@0.6.3/node_modules/negotiator/lib/charset.js"(exports, module) {
172
172
  "use strict";
173
173
  module.exports = preferredCharsets;
174
174
  module.exports.preferredCharsets = preferredCharsets;
@@ -253,9 +253,9 @@ var require_charset = __commonJS({
253
253
  }
254
254
  });
255
255
 
256
- // ../../node_modules/accepts/node_modules/negotiator/lib/encoding.js
256
+ // ../../node_modules/.pnpm/negotiator@0.6.3/node_modules/negotiator/lib/encoding.js
257
257
  var require_encoding = __commonJS({
258
- "../../node_modules/accepts/node_modules/negotiator/lib/encoding.js"(exports, module) {
258
+ "../../node_modules/.pnpm/negotiator@0.6.3/node_modules/negotiator/lib/encoding.js"(exports, module) {
259
259
  "use strict";
260
260
  module.exports = preferredEncodings;
261
261
  module.exports.preferredEncodings = preferredEncodings;
@@ -351,9 +351,9 @@ var require_encoding = __commonJS({
351
351
  }
352
352
  });
353
353
 
354
- // ../../node_modules/accepts/node_modules/negotiator/lib/language.js
354
+ // ../../node_modules/.pnpm/negotiator@0.6.3/node_modules/negotiator/lib/language.js
355
355
  var require_language = __commonJS({
356
- "../../node_modules/accepts/node_modules/negotiator/lib/language.js"(exports, module) {
356
+ "../../node_modules/.pnpm/negotiator@0.6.3/node_modules/negotiator/lib/language.js"(exports, module) {
357
357
  "use strict";
358
358
  module.exports = preferredLanguages;
359
359
  module.exports.preferredLanguages = preferredLanguages;
@@ -446,9 +446,9 @@ var require_language = __commonJS({
446
446
  }
447
447
  });
448
448
 
449
- // ../../node_modules/accepts/node_modules/negotiator/lib/mediaType.js
449
+ // ../../node_modules/.pnpm/negotiator@0.6.3/node_modules/negotiator/lib/mediaType.js
450
450
  var require_mediaType = __commonJS({
451
- "../../node_modules/accepts/node_modules/negotiator/lib/mediaType.js"(exports, module) {
451
+ "../../node_modules/.pnpm/negotiator@0.6.3/node_modules/negotiator/lib/mediaType.js"(exports, module) {
452
452
  "use strict";
453
453
  module.exports = preferredMediaTypes;
454
454
  module.exports.preferredMediaTypes = preferredMediaTypes;
@@ -608,9 +608,9 @@ var require_mediaType = __commonJS({
608
608
  }
609
609
  });
610
610
 
611
- // ../../node_modules/accepts/node_modules/negotiator/index.js
611
+ // ../../node_modules/.pnpm/negotiator@0.6.3/node_modules/negotiator/index.js
612
612
  var require_negotiator = __commonJS({
613
- "../../node_modules/accepts/node_modules/negotiator/index.js"(exports, module) {
613
+ "../../node_modules/.pnpm/negotiator@0.6.3/node_modules/negotiator/index.js"(exports, module) {
614
614
  "use strict";
615
615
  var preferredCharsets = require_charset();
616
616
  var preferredEncodings = require_encoding();
@@ -663,9 +663,9 @@ var require_negotiator = __commonJS({
663
663
  }
664
664
  });
665
665
 
666
- // ../../node_modules/mime-db/db.json
666
+ // ../../node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/db.json
667
667
  var require_db = __commonJS({
668
- "../../node_modules/mime-db/db.json"(exports, module) {
668
+ "../../node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/db.json"(exports, module) {
669
669
  module.exports = {
670
670
  "application/1d-interleaved-parityfec": {
671
671
  source: "iana"
@@ -9188,17 +9188,17 @@ var require_db = __commonJS({
9188
9188
  }
9189
9189
  });
9190
9190
 
9191
- // ../../node_modules/mime-db/index.js
9191
+ // ../../node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/index.js
9192
9192
  var require_mime_db = __commonJS({
9193
- "../../node_modules/mime-db/index.js"(exports, module) {
9193
+ "../../node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/index.js"(exports, module) {
9194
9194
  "use strict";
9195
9195
  module.exports = require_db();
9196
9196
  }
9197
9197
  });
9198
9198
 
9199
- // ../../node_modules/accepts/node_modules/mime-types/index.js
9199
+ // ../../node_modules/.pnpm/mime-types@2.1.35/node_modules/mime-types/index.js
9200
9200
  var require_mime_types = __commonJS({
9201
- "../../node_modules/accepts/node_modules/mime-types/index.js"(exports) {
9201
+ "../../node_modules/.pnpm/mime-types@2.1.35/node_modules/mime-types/index.js"(exports) {
9202
9202
  "use strict";
9203
9203
  var db = require_mime_db();
9204
9204
  var extname = __require("path").extname;
@@ -9251,11 +9251,11 @@ var require_mime_types = __commonJS({
9251
9251
  }
9252
9252
  return exts[0];
9253
9253
  }
9254
- function lookup(path12) {
9255
- if (!path12 || typeof path12 !== "string") {
9254
+ function lookup(path13) {
9255
+ if (!path13 || typeof path13 !== "string") {
9256
9256
  return false;
9257
9257
  }
9258
- var extension2 = extname("x." + path12).toLowerCase().substr(1);
9258
+ var extension2 = extname("x." + path13).toLowerCase().substr(1);
9259
9259
  if (!extension2) {
9260
9260
  return false;
9261
9261
  }
@@ -9286,9 +9286,9 @@ var require_mime_types = __commonJS({
9286
9286
  }
9287
9287
  });
9288
9288
 
9289
- // ../../node_modules/accepts/index.js
9289
+ // ../../node_modules/.pnpm/accepts@1.3.8/node_modules/accepts/index.js
9290
9290
  var require_accepts = __commonJS({
9291
- "../../node_modules/accepts/index.js"(exports, module) {
9291
+ "../../node_modules/.pnpm/accepts@1.3.8/node_modules/accepts/index.js"(exports, module) {
9292
9292
  "use strict";
9293
9293
  var Negotiator = require_negotiator();
9294
9294
  var mime = require_mime_types();
@@ -9367,9 +9367,9 @@ var require_accepts = __commonJS({
9367
9367
  }
9368
9368
  });
9369
9369
 
9370
- // ../../node_modules/base64id/lib/base64id.js
9370
+ // ../../node_modules/.pnpm/base64id@2.0.0/node_modules/base64id/lib/base64id.js
9371
9371
  var require_base64id = __commonJS({
9372
- "../../node_modules/base64id/lib/base64id.js"(exports, module) {
9372
+ "../../node_modules/.pnpm/base64id@2.0.0/node_modules/base64id/lib/base64id.js"(exports, module) {
9373
9373
  "use strict";
9374
9374
  var crypto2 = __require("crypto");
9375
9375
  var Base64Id = function() {
@@ -9430,9 +9430,9 @@ var require_base64id = __commonJS({
9430
9430
  }
9431
9431
  });
9432
9432
 
9433
- // ../../node_modules/engine.io-parser/build/cjs/commons.js
9433
+ // ../../node_modules/.pnpm/engine.io-parser@5.2.3/node_modules/engine.io-parser/build/cjs/commons.js
9434
9434
  var require_commons = __commonJS({
9435
- "../../node_modules/engine.io-parser/build/cjs/commons.js"(exports) {
9435
+ "../../node_modules/.pnpm/engine.io-parser@5.2.3/node_modules/engine.io-parser/build/cjs/commons.js"(exports) {
9436
9436
  "use strict";
9437
9437
  Object.defineProperty(exports, "__esModule", { value: true });
9438
9438
  exports.ERROR_PACKET = exports.PACKET_TYPES_REVERSE = exports.PACKET_TYPES = void 0;
@@ -9455,9 +9455,9 @@ var require_commons = __commonJS({
9455
9455
  }
9456
9456
  });
9457
9457
 
9458
- // ../../node_modules/engine.io-parser/build/cjs/encodePacket.js
9458
+ // ../../node_modules/.pnpm/engine.io-parser@5.2.3/node_modules/engine.io-parser/build/cjs/encodePacket.js
9459
9459
  var require_encodePacket = __commonJS({
9460
- "../../node_modules/engine.io-parser/build/cjs/encodePacket.js"(exports) {
9460
+ "../../node_modules/.pnpm/engine.io-parser@5.2.3/node_modules/engine.io-parser/build/cjs/encodePacket.js"(exports) {
9461
9461
  "use strict";
9462
9462
  Object.defineProperty(exports, "__esModule", { value: true });
9463
9463
  exports.encodePacket = void 0;
@@ -9494,9 +9494,9 @@ var require_encodePacket = __commonJS({
9494
9494
  }
9495
9495
  });
9496
9496
 
9497
- // ../../node_modules/engine.io-parser/build/cjs/decodePacket.js
9497
+ // ../../node_modules/.pnpm/engine.io-parser@5.2.3/node_modules/engine.io-parser/build/cjs/decodePacket.js
9498
9498
  var require_decodePacket = __commonJS({
9499
- "../../node_modules/engine.io-parser/build/cjs/decodePacket.js"(exports) {
9499
+ "../../node_modules/.pnpm/engine.io-parser@5.2.3/node_modules/engine.io-parser/build/cjs/decodePacket.js"(exports) {
9500
9500
  "use strict";
9501
9501
  Object.defineProperty(exports, "__esModule", { value: true });
9502
9502
  exports.decodePacket = void 0;
@@ -9549,9 +9549,9 @@ var require_decodePacket = __commonJS({
9549
9549
  }
9550
9550
  });
9551
9551
 
9552
- // ../../node_modules/engine.io-parser/build/cjs/index.js
9552
+ // ../../node_modules/.pnpm/engine.io-parser@5.2.3/node_modules/engine.io-parser/build/cjs/index.js
9553
9553
  var require_cjs = __commonJS({
9554
- "../../node_modules/engine.io-parser/build/cjs/index.js"(exports) {
9554
+ "../../node_modules/.pnpm/engine.io-parser@5.2.3/node_modules/engine.io-parser/build/cjs/index.js"(exports) {
9555
9555
  "use strict";
9556
9556
  Object.defineProperty(exports, "__esModule", { value: true });
9557
9557
  exports.decodePayload = exports.decodePacket = exports.encodePayload = exports.encodePacket = exports.protocol = void 0;
@@ -9711,9 +9711,9 @@ var require_cjs = __commonJS({
9711
9711
  }
9712
9712
  });
9713
9713
 
9714
- // ../../node_modules/engine.io/build/parser-v3/utf8.js
9714
+ // ../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/parser-v3/utf8.js
9715
9715
  var require_utf8 = __commonJS({
9716
- "../../node_modules/engine.io/build/parser-v3/utf8.js"(exports, module) {
9716
+ "../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/parser-v3/utf8.js"(exports, module) {
9717
9717
  "use strict";
9718
9718
  var stringFromCharCode = String.fromCharCode;
9719
9719
  function ucs2decode(string) {
@@ -9883,9 +9883,9 @@ var require_utf8 = __commonJS({
9883
9883
  }
9884
9884
  });
9885
9885
 
9886
- // ../../node_modules/engine.io/build/parser-v3/index.js
9886
+ // ../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/parser-v3/index.js
9887
9887
  var require_parser_v3 = __commonJS({
9888
- "../../node_modules/engine.io/build/parser-v3/index.js"(exports) {
9888
+ "../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/parser-v3/index.js"(exports) {
9889
9889
  "use strict";
9890
9890
  Object.defineProperty(exports, "__esModule", { value: true });
9891
9891
  exports.packets = exports.protocol = void 0;
@@ -10172,9 +10172,9 @@ var require_parser_v3 = __commonJS({
10172
10172
  }
10173
10173
  });
10174
10174
 
10175
- // ../../node_modules/ms/index.js
10175
+ // ../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js
10176
10176
  var require_ms = __commonJS({
10177
- "../../node_modules/ms/index.js"(exports, module) {
10177
+ "../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js"(exports, module) {
10178
10178
  "use strict";
10179
10179
  var s = 1e3;
10180
10180
  var m = s * 60;
@@ -10289,11 +10289,11 @@ var require_ms = __commonJS({
10289
10289
  }
10290
10290
  });
10291
10291
 
10292
- // ../../node_modules/debug/src/common.js
10292
+ // ../../node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/common.js
10293
10293
  var require_common = __commonJS({
10294
- "../../node_modules/debug/src/common.js"(exports, module) {
10294
+ "../../node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/common.js"(exports, module) {
10295
10295
  "use strict";
10296
- function setup(env2) {
10296
+ function setup(env3) {
10297
10297
  createDebug.debug = createDebug;
10298
10298
  createDebug.default = createDebug;
10299
10299
  createDebug.coerce = coerce2;
@@ -10302,8 +10302,8 @@ var require_common = __commonJS({
10302
10302
  createDebug.enabled = enabled;
10303
10303
  createDebug.humanize = require_ms();
10304
10304
  createDebug.destroy = destroy;
10305
- Object.keys(env2).forEach((key) => {
10306
- createDebug[key] = env2[key];
10305
+ Object.keys(env3).forEach((key) => {
10306
+ createDebug[key] = env3[key];
10307
10307
  });
10308
10308
  createDebug.names = [];
10309
10309
  createDebug.skips = [];
@@ -10467,9 +10467,9 @@ var require_common = __commonJS({
10467
10467
  }
10468
10468
  });
10469
10469
 
10470
- // ../../node_modules/debug/src/browser.js
10470
+ // ../../node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/browser.js
10471
10471
  var require_browser = __commonJS({
10472
- "../../node_modules/debug/src/browser.js"(exports, module) {
10472
+ "../../node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/browser.js"(exports, module) {
10473
10473
  "use strict";
10474
10474
  exports.formatArgs = formatArgs;
10475
10475
  exports.save = save;
@@ -10638,138 +10638,161 @@ var require_browser = __commonJS({
10638
10638
  }
10639
10639
  });
10640
10640
 
10641
- // ../../node_modules/has-flag/index.js
10642
- var require_has_flag = __commonJS({
10643
- "../../node_modules/has-flag/index.js"(exports, module) {
10644
- "use strict";
10645
- module.exports = (flag, argv = process.argv) => {
10646
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
10647
- const position = argv.indexOf(prefix + flag);
10648
- const terminatorPosition = argv.indexOf("--");
10649
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
10650
- };
10651
- }
10641
+ // ../../node_modules/.pnpm/supports-color@10.2.2/node_modules/supports-color/index.js
10642
+ var supports_color_exports = {};
10643
+ __export(supports_color_exports, {
10644
+ createSupportsColor: () => createSupportsColor,
10645
+ default: () => supports_color_default
10652
10646
  });
10653
-
10654
- // ../../node_modules/supports-color/index.js
10655
- var require_supports_color = __commonJS({
10656
- "../../node_modules/supports-color/index.js"(exports, module) {
10657
- "use strict";
10658
- var os7 = __require("os");
10659
- var tty2 = __require("tty");
10660
- var hasFlag3 = require_has_flag();
10661
- var { env: env2 } = process;
10662
- var flagForceColor2;
10663
- if (hasFlag3("no-color") || hasFlag3("no-colors") || hasFlag3("color=false") || hasFlag3("color=never")) {
10664
- flagForceColor2 = 0;
10665
- } else if (hasFlag3("color") || hasFlag3("colors") || hasFlag3("color=true") || hasFlag3("color=always")) {
10666
- flagForceColor2 = 1;
10667
- }
10668
- function envForceColor2() {
10669
- if ("FORCE_COLOR" in env2) {
10670
- if (env2.FORCE_COLOR === "true") {
10671
- return 1;
10672
- }
10673
- if (env2.FORCE_COLOR === "false") {
10674
- return 0;
10675
- }
10676
- return env2.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env2.FORCE_COLOR, 10), 3);
10677
- }
10647
+ import process2 from "process";
10648
+ import os from "os";
10649
+ import tty from "tty";
10650
+ function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
10651
+ const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
10652
+ const position = argv.indexOf(prefix + flag);
10653
+ const terminatorPosition = argv.indexOf("--");
10654
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
10655
+ }
10656
+ function envForceColor() {
10657
+ if (!("FORCE_COLOR" in env)) {
10658
+ return;
10659
+ }
10660
+ if (env.FORCE_COLOR === "true") {
10661
+ return 1;
10662
+ }
10663
+ if (env.FORCE_COLOR === "false") {
10664
+ return 0;
10665
+ }
10666
+ if (env.FORCE_COLOR.length === 0) {
10667
+ return 1;
10668
+ }
10669
+ const level = Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
10670
+ if (![0, 1, 2, 3].includes(level)) {
10671
+ return;
10672
+ }
10673
+ return level;
10674
+ }
10675
+ function translateLevel(level) {
10676
+ if (level === 0) {
10677
+ return false;
10678
+ }
10679
+ return {
10680
+ level,
10681
+ hasBasic: true,
10682
+ has256: level >= 2,
10683
+ has16m: level >= 3
10684
+ };
10685
+ }
10686
+ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
10687
+ const noFlagForceColor = envForceColor();
10688
+ if (noFlagForceColor !== void 0) {
10689
+ flagForceColor = noFlagForceColor;
10690
+ }
10691
+ const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
10692
+ if (forceColor === 0) {
10693
+ return 0;
10694
+ }
10695
+ if (sniffFlags) {
10696
+ if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
10697
+ return 3;
10678
10698
  }
10679
- function translateLevel2(level) {
10680
- if (level === 0) {
10681
- return false;
10682
- }
10683
- return {
10684
- level,
10685
- hasBasic: true,
10686
- has256: level >= 2,
10687
- has16m: level >= 3
10688
- };
10699
+ if (hasFlag("color=256")) {
10700
+ return 2;
10689
10701
  }
10690
- function supportsColor2(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
10691
- const noFlagForceColor = envForceColor2();
10692
- if (noFlagForceColor !== void 0) {
10693
- flagForceColor2 = noFlagForceColor;
10694
- }
10695
- const forceColor = sniffFlags ? flagForceColor2 : noFlagForceColor;
10696
- if (forceColor === 0) {
10697
- return 0;
10698
- }
10699
- if (sniffFlags) {
10700
- if (hasFlag3("color=16m") || hasFlag3("color=full") || hasFlag3("color=truecolor")) {
10701
- return 3;
10702
- }
10703
- if (hasFlag3("color=256")) {
10704
- return 2;
10705
- }
10706
- }
10707
- if (haveStream && !streamIsTTY && forceColor === void 0) {
10708
- return 0;
10709
- }
10710
- const min = forceColor || 0;
10711
- if (env2.TERM === "dumb") {
10712
- return min;
10713
- }
10714
- if (process.platform === "win32") {
10715
- const osRelease = os7.release().split(".");
10716
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
10717
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
10718
- }
10719
- return 1;
10720
- }
10721
- if ("CI" in env2) {
10722
- if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE", "DRONE"].some((sign) => sign in env2) || env2.CI_NAME === "codeship") {
10723
- return 1;
10724
- }
10725
- return min;
10726
- }
10727
- if ("TEAMCITY_VERSION" in env2) {
10728
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env2.TEAMCITY_VERSION) ? 1 : 0;
10729
- }
10730
- if (env2.COLORTERM === "truecolor") {
10731
- return 3;
10732
- }
10733
- if ("TERM_PROGRAM" in env2) {
10734
- const version = Number.parseInt((env2.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
10735
- switch (env2.TERM_PROGRAM) {
10736
- case "iTerm.app":
10737
- return version >= 3 ? 3 : 2;
10738
- case "Apple_Terminal":
10739
- return 2;
10740
- }
10702
+ }
10703
+ if ("TF_BUILD" in env && "AGENT_NAME" in env) {
10704
+ return 1;
10705
+ }
10706
+ if (haveStream && !streamIsTTY && forceColor === void 0) {
10707
+ return 0;
10708
+ }
10709
+ const min = forceColor || 0;
10710
+ if (env.TERM === "dumb") {
10711
+ return min;
10712
+ }
10713
+ if (process2.platform === "win32") {
10714
+ const osRelease = os.release().split(".");
10715
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
10716
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
10717
+ }
10718
+ return 1;
10719
+ }
10720
+ if ("CI" in env) {
10721
+ if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
10722
+ return 3;
10723
+ }
10724
+ if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
10725
+ return 1;
10726
+ }
10727
+ return min;
10728
+ }
10729
+ if ("TEAMCITY_VERSION" in env) {
10730
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
10731
+ }
10732
+ if (env.COLORTERM === "truecolor") {
10733
+ return 3;
10734
+ }
10735
+ if (env.TERM === "xterm-kitty") {
10736
+ return 3;
10737
+ }
10738
+ if (env.TERM === "xterm-ghostty") {
10739
+ return 3;
10740
+ }
10741
+ if (env.TERM === "wezterm") {
10742
+ return 3;
10743
+ }
10744
+ if ("TERM_PROGRAM" in env) {
10745
+ const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
10746
+ switch (env.TERM_PROGRAM) {
10747
+ case "iTerm.app": {
10748
+ return version >= 3 ? 3 : 2;
10741
10749
  }
10742
- if (/-256(color)?$/i.test(env2.TERM)) {
10750
+ case "Apple_Terminal": {
10743
10751
  return 2;
10744
10752
  }
10745
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env2.TERM)) {
10746
- return 1;
10747
- }
10748
- if ("COLORTERM" in env2) {
10749
- return 1;
10750
- }
10751
- return min;
10752
- }
10753
- function getSupportLevel(stream, options = {}) {
10754
- const level = supportsColor2(stream, {
10755
- streamIsTTY: stream && stream.isTTY,
10756
- ...options
10757
- });
10758
- return translateLevel2(level);
10759
10753
  }
10760
- module.exports = {
10761
- supportsColor: getSupportLevel,
10762
- stdout: getSupportLevel({ isTTY: tty2.isatty(1) }),
10763
- stderr: getSupportLevel({ isTTY: tty2.isatty(2) })
10754
+ }
10755
+ if (/-256(color)?$/i.test(env.TERM)) {
10756
+ return 2;
10757
+ }
10758
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
10759
+ return 1;
10760
+ }
10761
+ if ("COLORTERM" in env) {
10762
+ return 1;
10763
+ }
10764
+ return min;
10765
+ }
10766
+ function createSupportsColor(stream, options = {}) {
10767
+ const level = _supportsColor(stream, {
10768
+ streamIsTTY: stream && stream.isTTY,
10769
+ ...options
10770
+ });
10771
+ return translateLevel(level);
10772
+ }
10773
+ var env, flagForceColor, supportsColor, supports_color_default;
10774
+ var init_supports_color = __esm({
10775
+ "../../node_modules/.pnpm/supports-color@10.2.2/node_modules/supports-color/index.js"() {
10776
+ "use strict";
10777
+ ({ env } = process2);
10778
+ if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
10779
+ flagForceColor = 0;
10780
+ } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
10781
+ flagForceColor = 1;
10782
+ }
10783
+ supportsColor = {
10784
+ stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
10785
+ stderr: createSupportsColor({ isTTY: tty.isatty(2) })
10764
10786
  };
10787
+ supports_color_default = supportsColor;
10765
10788
  }
10766
10789
  });
10767
10790
 
10768
- // ../../node_modules/debug/src/node.js
10791
+ // ../../node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/node.js
10769
10792
  var require_node = __commonJS({
10770
- "../../node_modules/debug/src/node.js"(exports, module) {
10793
+ "../../node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/node.js"(exports, module) {
10771
10794
  "use strict";
10772
- var tty2 = __require("tty");
10795
+ var tty3 = __require("tty");
10773
10796
  var util2 = __require("util");
10774
10797
  exports.init = init;
10775
10798
  exports.log = log;
@@ -10784,8 +10807,8 @@ var require_node = __commonJS({
10784
10807
  );
10785
10808
  exports.colors = [6, 2, 3, 4, 5, 1];
10786
10809
  try {
10787
- const supportsColor2 = require_supports_color();
10788
- if (supportsColor2 && (supportsColor2.stderr || supportsColor2).level >= 2) {
10810
+ const supportsColor3 = (init_supports_color(), __toCommonJS(supports_color_exports));
10811
+ if (supportsColor3 && (supportsColor3.stderr || supportsColor3).level >= 2) {
10789
10812
  exports.colors = [
10790
10813
  20,
10791
10814
  21,
@@ -10887,7 +10910,7 @@ var require_node = __commonJS({
10887
10910
  return obj;
10888
10911
  }, {});
10889
10912
  function useColors() {
10890
- return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty2.isatty(process.stderr.fd);
10913
+ return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty3.isatty(process.stderr.fd);
10891
10914
  }
10892
10915
  function formatArgs(args) {
10893
10916
  const { namespace: name, useColors: useColors2 } = this;
@@ -10940,9 +10963,9 @@ var require_node = __commonJS({
10940
10963
  }
10941
10964
  });
10942
10965
 
10943
- // ../../node_modules/debug/src/index.js
10966
+ // ../../node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/index.js
10944
10967
  var require_src = __commonJS({
10945
- "../../node_modules/debug/src/index.js"(exports, module) {
10968
+ "../../node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/index.js"(exports, module) {
10946
10969
  "use strict";
10947
10970
  if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
10948
10971
  module.exports = require_browser();
@@ -10952,9 +10975,9 @@ var require_src = __commonJS({
10952
10975
  }
10953
10976
  });
10954
10977
 
10955
- // ../../node_modules/engine.io/build/transport.js
10978
+ // ../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/transport.js
10956
10979
  var require_transport = __commonJS({
10957
- "../../node_modules/engine.io/build/transport.js"(exports) {
10980
+ "../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/transport.js"(exports) {
10958
10981
  "use strict";
10959
10982
  Object.defineProperty(exports, "__esModule", { value: true });
10960
10983
  exports.Transport = void 0;
@@ -11064,9 +11087,9 @@ var require_transport = __commonJS({
11064
11087
  }
11065
11088
  });
11066
11089
 
11067
- // ../../node_modules/engine.io/build/transports/polling.js
11090
+ // ../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/transports/polling.js
11068
11091
  var require_polling = __commonJS({
11069
- "../../node_modules/engine.io/build/transports/polling.js"(exports) {
11092
+ "../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/transports/polling.js"(exports) {
11070
11093
  "use strict";
11071
11094
  Object.defineProperty(exports, "__esModule", { value: true });
11072
11095
  exports.Polling = void 0;
@@ -11157,7 +11180,8 @@ var require_polling = __commonJS({
11157
11180
  }
11158
11181
  const isBinary = "application/octet-stream" === req.headers["content-type"];
11159
11182
  if (isBinary && this.protocol === 4) {
11160
- return this.onError("invalid content");
11183
+ this.onError("invalid content");
11184
+ return res.writeHead(400).end();
11161
11185
  }
11162
11186
  this.dataReq = req;
11163
11187
  this.dataRes = res;
@@ -11380,9 +11404,9 @@ var require_polling = __commonJS({
11380
11404
  }
11381
11405
  });
11382
11406
 
11383
- // ../../node_modules/engine.io/build/transports/polling-jsonp.js
11407
+ // ../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/transports/polling-jsonp.js
11384
11408
  var require_polling_jsonp = __commonJS({
11385
- "../../node_modules/engine.io/build/transports/polling-jsonp.js"(exports) {
11409
+ "../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/transports/polling-jsonp.js"(exports) {
11386
11410
  "use strict";
11387
11411
  Object.defineProperty(exports, "__esModule", { value: true });
11388
11412
  exports.JSONP = void 0;
@@ -11418,9 +11442,9 @@ var require_polling_jsonp = __commonJS({
11418
11442
  }
11419
11443
  });
11420
11444
 
11421
- // ../../node_modules/engine.io/build/transports/websocket.js
11445
+ // ../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/transports/websocket.js
11422
11446
  var require_websocket = __commonJS({
11423
- "../../node_modules/engine.io/build/transports/websocket.js"(exports) {
11447
+ "../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/transports/websocket.js"(exports) {
11424
11448
  "use strict";
11425
11449
  Object.defineProperty(exports, "__esModule", { value: true });
11426
11450
  exports.WebSocket = void 0;
@@ -11510,9 +11534,9 @@ var require_websocket = __commonJS({
11510
11534
  }
11511
11535
  });
11512
11536
 
11513
- // ../../node_modules/engine.io/build/transports/webtransport.js
11537
+ // ../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/transports/webtransport.js
11514
11538
  var require_webtransport = __commonJS({
11515
- "../../node_modules/engine.io/build/transports/webtransport.js"(exports) {
11539
+ "../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/transports/webtransport.js"(exports) {
11516
11540
  "use strict";
11517
11541
  Object.defineProperty(exports, "__esModule", { value: true });
11518
11542
  exports.WebTransport = void 0;
@@ -11574,9 +11598,9 @@ var require_webtransport = __commonJS({
11574
11598
  }
11575
11599
  });
11576
11600
 
11577
- // ../../node_modules/engine.io/build/transports/index.js
11601
+ // ../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/transports/index.js
11578
11602
  var require_transports = __commonJS({
11579
- "../../node_modules/engine.io/build/transports/index.js"(exports) {
11603
+ "../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/transports/index.js"(exports) {
11580
11604
  "use strict";
11581
11605
  Object.defineProperty(exports, "__esModule", { value: true });
11582
11606
  var polling_1 = require_polling();
@@ -11599,9 +11623,9 @@ var require_transports = __commonJS({
11599
11623
  }
11600
11624
  });
11601
11625
 
11602
- // ../../node_modules/engine.io/build/socket.js
11626
+ // ../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/socket.js
11603
11627
  var require_socket = __commonJS({
11604
- "../../node_modules/engine.io/build/socket.js"(exports) {
11628
+ "../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/socket.js"(exports) {
11605
11629
  "use strict";
11606
11630
  Object.defineProperty(exports, "__esModule", { value: true });
11607
11631
  exports.Socket = void 0;
@@ -12035,9 +12059,9 @@ var require_socket = __commonJS({
12035
12059
  }
12036
12060
  });
12037
12061
 
12038
- // ../../node_modules/cookie/index.js
12062
+ // ../../node_modules/.pnpm/cookie@0.7.2/node_modules/cookie/index.js
12039
12063
  var require_cookie = __commonJS({
12040
- "../../node_modules/cookie/index.js"(exports) {
12064
+ "../../node_modules/.pnpm/cookie@0.7.2/node_modules/cookie/index.js"(exports) {
12041
12065
  "use strict";
12042
12066
  exports.parse = parse;
12043
12067
  exports.serialize = serialize;
@@ -12201,9 +12225,9 @@ var require_cookie = __commonJS({
12201
12225
  }
12202
12226
  });
12203
12227
 
12204
- // ../../node_modules/object-assign/index.js
12228
+ // ../../node_modules/.pnpm/object-assign@4.1.1/node_modules/object-assign/index.js
12205
12229
  var require_object_assign = __commonJS({
12206
- "../../node_modules/object-assign/index.js"(exports, module) {
12230
+ "../../node_modules/.pnpm/object-assign@4.1.1/node_modules/object-assign/index.js"(exports, module) {
12207
12231
  "use strict";
12208
12232
  var getOwnPropertySymbols = Object.getOwnPropertySymbols;
12209
12233
  var hasOwnProperty = Object.prototype.hasOwnProperty;
@@ -12271,9 +12295,9 @@ var require_object_assign = __commonJS({
12271
12295
  }
12272
12296
  });
12273
12297
 
12274
- // ../../node_modules/vary/index.js
12298
+ // ../../node_modules/.pnpm/vary@1.1.2/node_modules/vary/index.js
12275
12299
  var require_vary = __commonJS({
12276
- "../../node_modules/vary/index.js"(exports, module) {
12300
+ "../../node_modules/.pnpm/vary@1.1.2/node_modules/vary/index.js"(exports, module) {
12277
12301
  "use strict";
12278
12302
  module.exports = vary;
12279
12303
  module.exports.append = append;
@@ -12344,9 +12368,9 @@ var require_vary = __commonJS({
12344
12368
  }
12345
12369
  });
12346
12370
 
12347
- // ../../node_modules/cors/lib/index.js
12371
+ // ../../node_modules/.pnpm/cors@2.8.6/node_modules/cors/lib/index.js
12348
12372
  var require_lib = __commonJS({
12349
- "../../node_modules/cors/lib/index.js"(exports, module) {
12373
+ "../../node_modules/.pnpm/cors@2.8.6/node_modules/cors/lib/index.js"(exports, module) {
12350
12374
  "use strict";
12351
12375
  (function() {
12352
12376
  "use strict";
@@ -12553,9 +12577,9 @@ var require_lib = __commonJS({
12553
12577
  }
12554
12578
  });
12555
12579
 
12556
- // ../../node_modules/engine.io/build/server.js
12580
+ // ../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/server.js
12557
12581
  var require_server = __commonJS({
12558
- "../../node_modules/engine.io/build/server.js"(exports) {
12582
+ "../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/server.js"(exports) {
12559
12583
  "use strict";
12560
12584
  Object.defineProperty(exports, "__esModule", { value: true });
12561
12585
  exports.Server = exports.BaseServer = void 0;
@@ -12579,6 +12603,9 @@ var require_server = __commonJS({
12579
12603
  } catch (e) {
12580
12604
  }
12581
12605
  }
12606
+ function hasOwn(obj, key) {
12607
+ return Object.prototype.hasOwnProperty.call(obj, key);
12608
+ }
12582
12609
  var BaseServer = class extends events_1.EventEmitter {
12583
12610
  /**
12584
12611
  * Server constructor.
@@ -12609,8 +12636,7 @@ var require_server = __commonJS({
12609
12636
  this.opts.cookie = Object.assign({
12610
12637
  name: "io",
12611
12638
  path: "/",
12612
- // @ts-ignore
12613
- httpOnly: opts.cookie.path !== false,
12639
+ httpOnly: true,
12614
12640
  sameSite: "lax"
12615
12641
  }, opts.cookie);
12616
12642
  }
@@ -12630,11 +12656,11 @@ var require_server = __commonJS({
12630
12656
  * @protected
12631
12657
  */
12632
12658
  _computePath(options) {
12633
- let path12 = (options.path || "/engine.io").replace(/\/$/, "");
12659
+ let path13 = (options.path || "/engine.io").replace(/\/$/, "");
12634
12660
  if (options.addTrailingSlash !== false) {
12635
- path12 += "/";
12661
+ path13 += "/";
12636
12662
  }
12637
- return path12;
12663
+ return path13;
12638
12664
  }
12639
12665
  /**
12640
12666
  * Returns a list of available transports for upgrade given a certain transport.
@@ -12671,7 +12697,7 @@ var require_server = __commonJS({
12671
12697
  }
12672
12698
  const sid = req._query.sid;
12673
12699
  if (sid) {
12674
- if (!this.clients.hasOwnProperty(sid)) {
12700
+ if (!hasOwn(this.clients, sid)) {
12675
12701
  debug('unknown sid "%s"', sid);
12676
12702
  return fn(Server2.errors.UNKNOWN_SID, {
12677
12703
  sid
@@ -12757,9 +12783,9 @@ var require_server = __commonJS({
12757
12783
  */
12758
12784
  close() {
12759
12785
  debug("closing all open clients");
12760
- for (let i in this.clients) {
12761
- if (this.clients.hasOwnProperty(i)) {
12762
- this.clients[i].close(true);
12786
+ for (const sid in this.clients) {
12787
+ if (hasOwn(this.clients, sid)) {
12788
+ this.clients[sid].close(true);
12763
12789
  }
12764
12790
  }
12765
12791
  this.cleanup();
@@ -12863,6 +12889,10 @@ var require_server = __commonJS({
12863
12889
  return transport;
12864
12890
  }
12865
12891
  async onWebTransportSession(session) {
12892
+ if (this.middlewares.length > 0) {
12893
+ debug("closing session since WebTransport is not compatible with middlewares");
12894
+ return session.close();
12895
+ }
12866
12896
  const timeout = setTimeout(() => {
12867
12897
  debug("the client failed to establish a bidirectional stream in the given period");
12868
12898
  session.close();
@@ -12870,21 +12900,32 @@ var require_server = __commonJS({
12870
12900
  const streamReader = session.incomingBidirectionalStreams.getReader();
12871
12901
  const result = await streamReader.read();
12872
12902
  if (result.done) {
12903
+ clearTimeout(timeout);
12873
12904
  debug("session is closed");
12874
12905
  return;
12875
12906
  }
12876
12907
  const stream = result.value;
12877
12908
  const transformStream = (0, engine_io_parser_1.createPacketDecoderStream)(this.opts.maxHttpBufferSize, "nodebuffer");
12878
12909
  const reader = stream.readable.pipeThrough(transformStream).getReader();
12910
+ const closeSession = async () => {
12911
+ try {
12912
+ await reader.cancel();
12913
+ } catch (e) {
12914
+ debug("error while canceling WebTransport stream reader: %s", e.message);
12915
+ }
12916
+ reader.releaseLock();
12917
+ session.close();
12918
+ };
12879
12919
  const { value, done } = await reader.read();
12920
+ clearTimeout(timeout);
12880
12921
  if (done) {
12881
12922
  debug("stream is closed");
12923
+ reader.releaseLock();
12882
12924
  return;
12883
12925
  }
12884
- clearTimeout(timeout);
12885
12926
  if (value.type !== "open") {
12886
12927
  debug("invalid WebTransport handshake");
12887
- return session.close();
12928
+ return closeSession();
12888
12929
  }
12889
12930
  if (value.data === void 0) {
12890
12931
  const transport = new webtransport_1.WebTransport(session, stream, reader);
@@ -12901,20 +12942,20 @@ var require_server = __commonJS({
12901
12942
  return;
12902
12943
  }
12903
12944
  const sid = parseSessionId(value.data);
12904
- if (!sid) {
12945
+ if (!sid || !hasOwn(this.clients, sid)) {
12905
12946
  debug("invalid WebTransport handshake");
12906
- return session.close();
12947
+ return closeSession();
12907
12948
  }
12908
12949
  const client = this.clients[sid];
12909
12950
  if (!client) {
12910
12951
  debug("upgrade attempt for closed client");
12911
- session.close();
12952
+ return closeSession();
12912
12953
  } else if (client.upgrading) {
12913
12954
  debug("transport has already been trying to upgrade");
12914
- session.close();
12955
+ return closeSession();
12915
12956
  } else if (client.upgraded) {
12916
12957
  debug("transport had already been upgraded");
12917
- session.close();
12958
+ return closeSession();
12918
12959
  } else {
12919
12960
  debug("upgrading existing transport");
12920
12961
  const transport = new webtransport_1.WebTransport(session, stream, reader);
@@ -13018,17 +13059,18 @@ var require_server = __commonJS({
13018
13059
  /**
13019
13060
  * Handles an Engine.IO HTTP request.
13020
13061
  *
13021
- * @param {EngineRequest} req
13062
+ * @param {IncomingMessage} req
13022
13063
  * @param {ServerResponse} res
13023
13064
  */
13024
13065
  handleRequest(req, res) {
13025
13066
  debug('handling "%s" http request "%s"', req.method, req.url);
13026
- this.prepare(req);
13027
- req.res = res;
13067
+ const engineRequest = req;
13068
+ this.prepare(engineRequest);
13069
+ engineRequest.res = res;
13028
13070
  const callback = (errorCode, errorContext) => {
13029
13071
  if (errorCode !== void 0) {
13030
13072
  this.emit("connection_error", {
13031
- req,
13073
+ req: engineRequest,
13032
13074
  code: errorCode,
13033
13075
  message: _Server.errorMessages[errorCode],
13034
13076
  context: errorContext
@@ -13036,19 +13078,19 @@ var require_server = __commonJS({
13036
13078
  abortRequest(res, errorCode, errorContext);
13037
13079
  return;
13038
13080
  }
13039
- if (req._query.sid) {
13081
+ if (engineRequest._query.sid) {
13040
13082
  debug("setting new request for existing client");
13041
- this.clients[req._query.sid].transport.onRequest(req);
13083
+ this.clients[engineRequest._query.sid].transport.onRequest(engineRequest);
13042
13084
  } else {
13043
13085
  const closeConnection = (errorCode2, errorContext2) => abortRequest(res, errorCode2, errorContext2);
13044
- this.handshake(req._query.transport, req, closeConnection);
13086
+ this.handshake(engineRequest._query.transport, engineRequest, closeConnection);
13045
13087
  }
13046
13088
  };
13047
- this._applyMiddlewares(req, res, (err) => {
13089
+ this._applyMiddlewares(engineRequest, res, (err) => {
13048
13090
  if (err) {
13049
13091
  callback(_Server.errors.BAD_REQUEST, { name: "MIDDLEWARE_FAILURE" });
13050
13092
  } else {
13051
- this.verify(req, false, callback);
13093
+ this.verify(engineRequest, false, callback);
13052
13094
  }
13053
13095
  });
13054
13096
  }
@@ -13056,12 +13098,13 @@ var require_server = __commonJS({
13056
13098
  * Handles an Engine.IO HTTP Upgrade.
13057
13099
  */
13058
13100
  handleUpgrade(req, socket, upgradeHead) {
13059
- this.prepare(req);
13060
- const res = new WebSocketResponse(req, socket);
13101
+ const engineRequest = req;
13102
+ this.prepare(engineRequest);
13103
+ const res = new WebSocketResponse(engineRequest, socket);
13061
13104
  const callback = (errorCode, errorContext) => {
13062
13105
  if (errorCode !== void 0) {
13063
13106
  this.emit("connection_error", {
13064
- req,
13107
+ req: engineRequest,
13065
13108
  code: errorCode,
13066
13109
  message: _Server.errorMessages[errorCode],
13067
13110
  context: errorContext
@@ -13072,15 +13115,15 @@ var require_server = __commonJS({
13072
13115
  const head = Buffer.from(upgradeHead);
13073
13116
  upgradeHead = null;
13074
13117
  res.writeHead();
13075
- this.ws.handleUpgrade(req, socket, head, (websocket) => {
13076
- this.onWebSocket(req, socket, websocket);
13118
+ this.ws.handleUpgrade(engineRequest, socket, head, (websocket) => {
13119
+ this.onWebSocket(engineRequest, socket, websocket);
13077
13120
  });
13078
13121
  };
13079
- this._applyMiddlewares(req, res, (err) => {
13122
+ this._applyMiddlewares(engineRequest, res, (err) => {
13080
13123
  if (err) {
13081
13124
  callback(_Server.errors.BAD_REQUEST, { name: "MIDDLEWARE_FAILURE" });
13082
13125
  } else {
13083
- this.verify(req, true, callback);
13126
+ this.verify(engineRequest, true, callback);
13084
13127
  }
13085
13128
  });
13086
13129
  }
@@ -13133,10 +13176,10 @@ var require_server = __commonJS({
13133
13176
  * @param {Object} options
13134
13177
  */
13135
13178
  attach(server, options = {}) {
13136
- const path12 = this._computePath(options);
13179
+ const path13 = this._computePath(options);
13137
13180
  const destroyUpgradeTimeout = options.destroyUpgradeTimeout || 1e3;
13138
13181
  function check(req) {
13139
- return path12 === req.url.slice(0, path12.length);
13182
+ return path13 === req.url.slice(0, path13.length);
13140
13183
  }
13141
13184
  const listeners = server.listeners("request").slice(0);
13142
13185
  server.removeAllListeners("request");
@@ -13144,7 +13187,7 @@ var require_server = __commonJS({
13144
13187
  server.on("listening", this.init.bind(this));
13145
13188
  server.on("request", (req, res) => {
13146
13189
  if (check(req)) {
13147
- debug('intercepting request for path "%s"', path12);
13190
+ debug('intercepting request for path "%s"', path13);
13148
13191
  this.handleRequest(req, res);
13149
13192
  } else {
13150
13193
  let i = 0;
@@ -13498,9 +13541,9 @@ var require_server = __commonJS({
13498
13541
  }
13499
13542
  });
13500
13543
 
13501
- // ../../node_modules/engine.io/build/transports-uws/polling.js
13544
+ // ../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/transports-uws/polling.js
13502
13545
  var require_polling2 = __commonJS({
13503
- "../../node_modules/engine.io/build/transports-uws/polling.js"(exports) {
13546
+ "../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/transports-uws/polling.js"(exports) {
13504
13547
  "use strict";
13505
13548
  Object.defineProperty(exports, "__esModule", { value: true });
13506
13549
  exports.Polling = void 0;
@@ -13603,7 +13646,8 @@ var require_polling2 = __commonJS({
13603
13646
  }
13604
13647
  const isBinary = "application/octet-stream" === req.headers["content-type"];
13605
13648
  if (isBinary && this.protocol === 4) {
13606
- return this.onError("invalid content");
13649
+ this.onError("invalid content");
13650
+ return res.writeStatus("400 Bad Request").end();
13607
13651
  }
13608
13652
  this.dataReq = req;
13609
13653
  this.dataRes = res;
@@ -13848,9 +13892,9 @@ var require_polling2 = __commonJS({
13848
13892
  }
13849
13893
  });
13850
13894
 
13851
- // ../../node_modules/engine.io/build/transports-uws/websocket.js
13895
+ // ../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/transports-uws/websocket.js
13852
13896
  var require_websocket2 = __commonJS({
13853
- "../../node_modules/engine.io/build/transports-uws/websocket.js"(exports) {
13897
+ "../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/transports-uws/websocket.js"(exports) {
13854
13898
  "use strict";
13855
13899
  Object.defineProperty(exports, "__esModule", { value: true });
13856
13900
  exports.WebSocket = void 0;
@@ -13924,9 +13968,9 @@ var require_websocket2 = __commonJS({
13924
13968
  }
13925
13969
  });
13926
13970
 
13927
- // ../../node_modules/engine.io/build/transports-uws/index.js
13971
+ // ../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/transports-uws/index.js
13928
13972
  var require_transports_uws = __commonJS({
13929
- "../../node_modules/engine.io/build/transports-uws/index.js"(exports) {
13973
+ "../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/transports-uws/index.js"(exports) {
13930
13974
  "use strict";
13931
13975
  Object.defineProperty(exports, "__esModule", { value: true });
13932
13976
  var polling_1 = require_polling2();
@@ -13938,9 +13982,9 @@ var require_transports_uws = __commonJS({
13938
13982
  }
13939
13983
  });
13940
13984
 
13941
- // ../../node_modules/engine.io/build/userver.js
13985
+ // ../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/userver.js
13942
13986
  var require_userver = __commonJS({
13943
- "../../node_modules/engine.io/build/userver.js"(exports) {
13987
+ "../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/userver.js"(exports) {
13944
13988
  "use strict";
13945
13989
  Object.defineProperty(exports, "__esModule", { value: true });
13946
13990
  exports.uServer = void 0;
@@ -13983,8 +14027,8 @@ var require_userver = __commonJS({
13983
14027
  * @param options
13984
14028
  */
13985
14029
  attach(app, options = {}) {
13986
- const path12 = this._computePath(options);
13987
- app.any(path12, this.handleRequest.bind(this)).ws(path12, {
14030
+ const path13 = this._computePath(options);
14031
+ app.any(path13, this.handleRequest.bind(this)).ws(path13, {
13988
14032
  compression: options.compression,
13989
14033
  idleTimeout: options.idleTimeout,
13990
14034
  maxBackpressure: options.maxBackpressure,
@@ -14084,7 +14128,16 @@ var require_userver = __commonJS({
14084
14128
  return;
14085
14129
  }
14086
14130
  }
14131
+ const additionalHeaders = {};
14132
+ const isInitialRequest = !id;
14133
+ if (isInitialRequest) {
14134
+ this.emit("initial_headers", additionalHeaders, req);
14135
+ }
14136
+ this.emit("headers", additionalHeaders, req);
14087
14137
  req.res.writeStatus("101 Switching Protocols");
14138
+ Object.keys(additionalHeaders).forEach((key) => {
14139
+ req.res.writeHeader(key, additionalHeaders[key]);
14140
+ });
14088
14141
  res.upgrade({
14089
14142
  transport
14090
14143
  }, req.getHeader("sec-websocket-key"), req.getHeader("sec-websocket-protocol"), req.getHeader("sec-websocket-extensions"), context);
@@ -14196,9 +14249,9 @@ var require_userver = __commonJS({
14196
14249
  }
14197
14250
  });
14198
14251
 
14199
- // ../../node_modules/engine.io/build/engine.io.js
14252
+ // ../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/engine.io.js
14200
14253
  var require_engine_io = __commonJS({
14201
- "../../node_modules/engine.io/build/engine.io.js"(exports) {
14254
+ "../../node_modules/.pnpm/engine.io@6.6.9/node_modules/engine.io/build/engine.io.js"(exports) {
14202
14255
  "use strict";
14203
14256
  Object.defineProperty(exports, "__esModule", { value: true });
14204
14257
  exports.protocol = exports.Transport = exports.Socket = exports.uServer = exports.parser = exports.transports = exports.Server = void 0;
@@ -14248,7 +14301,7 @@ var require_engine_io = __commonJS({
14248
14301
  }
14249
14302
  });
14250
14303
 
14251
- // ../../node_modules/@socket.io/component-emitter/lib/esm/index.js
14304
+ // ../../node_modules/.pnpm/@socket.io+component-emitter@3.1.2/node_modules/@socket.io/component-emitter/lib/esm/index.js
14252
14305
  var esm_exports = {};
14253
14306
  __export(esm_exports, {
14254
14307
  Emitter: () => Emitter
@@ -14263,7 +14316,7 @@ function mixin(obj) {
14263
14316
  return obj;
14264
14317
  }
14265
14318
  var init_esm = __esm({
14266
- "../../node_modules/@socket.io/component-emitter/lib/esm/index.js"() {
14319
+ "../../node_modules/.pnpm/@socket.io+component-emitter@3.1.2/node_modules/@socket.io/component-emitter/lib/esm/index.js"() {
14267
14320
  "use strict";
14268
14321
  Emitter.prototype.on = Emitter.prototype.addEventListener = function(event, fn) {
14269
14322
  this._callbacks = this._callbacks || {};
@@ -14329,9 +14382,9 @@ var init_esm = __esm({
14329
14382
  }
14330
14383
  });
14331
14384
 
14332
- // ../../node_modules/socket.io-parser/build/cjs/is-binary.js
14385
+ // ../../node_modules/.pnpm/socket.io-parser@4.2.6_supports-color@10.2.2/node_modules/socket.io-parser/build/cjs/is-binary.js
14333
14386
  var require_is_binary = __commonJS({
14334
- "../../node_modules/socket.io-parser/build/cjs/is-binary.js"(exports) {
14387
+ "../../node_modules/.pnpm/socket.io-parser@4.2.6_supports-color@10.2.2/node_modules/socket.io-parser/build/cjs/is-binary.js"(exports) {
14335
14388
  "use strict";
14336
14389
  Object.defineProperty(exports, "__esModule", { value: true });
14337
14390
  exports.isBinary = isBinary;
@@ -14374,9 +14427,9 @@ var require_is_binary = __commonJS({
14374
14427
  }
14375
14428
  });
14376
14429
 
14377
- // ../../node_modules/socket.io-parser/build/cjs/binary.js
14430
+ // ../../node_modules/.pnpm/socket.io-parser@4.2.6_supports-color@10.2.2/node_modules/socket.io-parser/build/cjs/binary.js
14378
14431
  var require_binary = __commonJS({
14379
- "../../node_modules/socket.io-parser/build/cjs/binary.js"(exports) {
14432
+ "../../node_modules/.pnpm/socket.io-parser@4.2.6_supports-color@10.2.2/node_modules/socket.io-parser/build/cjs/binary.js"(exports) {
14380
14433
  "use strict";
14381
14434
  Object.defineProperty(exports, "__esModule", { value: true });
14382
14435
  exports.deconstructPacket = deconstructPacket;
@@ -14445,9 +14498,9 @@ var require_binary = __commonJS({
14445
14498
  }
14446
14499
  });
14447
14500
 
14448
- // ../../node_modules/socket.io-parser/build/cjs/index.js
14501
+ // ../../node_modules/.pnpm/socket.io-parser@4.2.6_supports-color@10.2.2/node_modules/socket.io-parser/build/cjs/index.js
14449
14502
  var require_cjs2 = __commonJS({
14450
- "../../node_modules/socket.io-parser/build/cjs/index.js"(exports) {
14503
+ "../../node_modules/.pnpm/socket.io-parser@4.2.6_supports-color@10.2.2/node_modules/socket.io-parser/build/cjs/index.js"(exports) {
14451
14504
  "use strict";
14452
14505
  Object.defineProperty(exports, "__esModule", { value: true });
14453
14506
  exports.Decoder = exports.Encoder = exports.PacketType = exports.protocol = void 0;
@@ -14548,12 +14601,13 @@ var require_cjs2 = __commonJS({
14548
14601
  var Decoder = class _Decoder extends component_emitter_1.Emitter {
14549
14602
  /**
14550
14603
  * Decoder constructor
14551
- *
14552
- * @param {function} reviver - custom reviver to pass down to JSON.stringify
14553
14604
  */
14554
- constructor(reviver) {
14605
+ constructor(opts) {
14555
14606
  super();
14556
- this.reviver = reviver;
14607
+ this.opts = Object.assign({
14608
+ reviver: void 0,
14609
+ maxAttachments: 10
14610
+ }, typeof opts === "function" ? { reviver: opts } : opts);
14557
14611
  }
14558
14612
  /**
14559
14613
  * Decodes an encoded packet string into packet JSON.
@@ -14613,7 +14667,13 @@ var require_cjs2 = __commonJS({
14613
14667
  if (buf != Number(buf) || str.charAt(i) !== "-") {
14614
14668
  throw new Error("Illegal attachments");
14615
14669
  }
14616
- p.attachments = Number(buf);
14670
+ const n = Number(buf);
14671
+ if (!isInteger(n) || n < 0) {
14672
+ throw new Error("Illegal attachments");
14673
+ } else if (n > this.opts.maxAttachments) {
14674
+ throw new Error("too many attachments");
14675
+ }
14676
+ p.attachments = n;
14617
14677
  }
14618
14678
  if ("/" === str.charAt(i + 1)) {
14619
14679
  const start = i + 1;
@@ -14655,7 +14715,7 @@ var require_cjs2 = __commonJS({
14655
14715
  }
14656
14716
  tryParse(str) {
14657
14717
  try {
14658
- return JSON.parse(str, this.reviver);
14718
+ return JSON.parse(str, this.opts.reviver);
14659
14719
  } catch (e) {
14660
14720
  return false;
14661
14721
  }
@@ -14752,9 +14812,9 @@ var require_cjs2 = __commonJS({
14752
14812
  }
14753
14813
  });
14754
14814
 
14755
- // ../../node_modules/socket.io/dist/client.js
14815
+ // ../../node_modules/.pnpm/socket.io@4.8.3/node_modules/socket.io/dist/client.js
14756
14816
  var require_client = __commonJS({
14757
- "../../node_modules/socket.io/dist/client.js"(exports) {
14817
+ "../../node_modules/.pnpm/socket.io@4.8.3/node_modules/socket.io/dist/client.js"(exports) {
14758
14818
  "use strict";
14759
14819
  var __importDefault = exports && exports.__importDefault || function(mod) {
14760
14820
  return mod && mod.__esModule ? mod : { "default": mod };
@@ -15014,9 +15074,9 @@ var require_client = __commonJS({
15014
15074
  }
15015
15075
  });
15016
15076
 
15017
- // ../../node_modules/socket.io/dist/typed-events.js
15077
+ // ../../node_modules/.pnpm/socket.io@4.8.3/node_modules/socket.io/dist/typed-events.js
15018
15078
  var require_typed_events = __commonJS({
15019
- "../../node_modules/socket.io/dist/typed-events.js"(exports) {
15079
+ "../../node_modules/.pnpm/socket.io@4.8.3/node_modules/socket.io/dist/typed-events.js"(exports) {
15020
15080
  "use strict";
15021
15081
  Object.defineProperty(exports, "__esModule", { value: true });
15022
15082
  exports.StrictEventEmitter = void 0;
@@ -15088,9 +15148,9 @@ var require_typed_events = __commonJS({
15088
15148
  }
15089
15149
  });
15090
15150
 
15091
- // ../../node_modules/socket.io/dist/socket-types.js
15151
+ // ../../node_modules/.pnpm/socket.io@4.8.3/node_modules/socket.io/dist/socket-types.js
15092
15152
  var require_socket_types = __commonJS({
15093
- "../../node_modules/socket.io/dist/socket-types.js"(exports) {
15153
+ "../../node_modules/.pnpm/socket.io@4.8.3/node_modules/socket.io/dist/socket-types.js"(exports) {
15094
15154
  "use strict";
15095
15155
  Object.defineProperty(exports, "__esModule", { value: true });
15096
15156
  exports.RESERVED_EVENTS = void 0;
@@ -15105,9 +15165,9 @@ var require_socket_types = __commonJS({
15105
15165
  }
15106
15166
  });
15107
15167
 
15108
- // ../../node_modules/socket.io/dist/broadcast-operator.js
15168
+ // ../../node_modules/.pnpm/socket.io@4.8.3/node_modules/socket.io/dist/broadcast-operator.js
15109
15169
  var require_broadcast_operator = __commonJS({
15110
- "../../node_modules/socket.io/dist/broadcast-operator.js"(exports) {
15170
+ "../../node_modules/.pnpm/socket.io@4.8.3/node_modules/socket.io/dist/broadcast-operator.js"(exports) {
15111
15171
  "use strict";
15112
15172
  Object.defineProperty(exports, "__esModule", { value: true });
15113
15173
  exports.RemoteSocket = exports.BroadcastOperator = void 0;
@@ -15534,9 +15594,9 @@ var require_broadcast_operator = __commonJS({
15534
15594
  }
15535
15595
  });
15536
15596
 
15537
- // ../../node_modules/socket.io/dist/socket.js
15597
+ // ../../node_modules/.pnpm/socket.io@4.8.3/node_modules/socket.io/dist/socket.js
15538
15598
  var require_socket2 = __commonJS({
15539
- "../../node_modules/socket.io/dist/socket.js"(exports) {
15599
+ "../../node_modules/.pnpm/socket.io@4.8.3/node_modules/socket.io/dist/socket.js"(exports) {
15540
15600
  "use strict";
15541
15601
  var __importDefault = exports && exports.__importDefault || function(mod) {
15542
15602
  return mod && mod.__esModule ? mod : { "default": mod };
@@ -16441,9 +16501,9 @@ var require_socket2 = __commonJS({
16441
16501
  }
16442
16502
  });
16443
16503
 
16444
- // ../../node_modules/socket.io/dist/namespace.js
16504
+ // ../../node_modules/.pnpm/socket.io@4.8.3/node_modules/socket.io/dist/namespace.js
16445
16505
  var require_namespace = __commonJS({
16446
- "../../node_modules/socket.io/dist/namespace.js"(exports) {
16506
+ "../../node_modules/.pnpm/socket.io@4.8.3/node_modules/socket.io/dist/namespace.js"(exports) {
16447
16507
  "use strict";
16448
16508
  var __importDefault = exports && exports.__importDefault || function(mod) {
16449
16509
  return mod && mod.__esModule ? mod : { "default": mod };
@@ -16953,9 +17013,9 @@ var require_namespace = __commonJS({
16953
17013
  }
16954
17014
  });
16955
17015
 
16956
- // ../../node_modules/socket.io-adapter/dist/contrib/yeast.js
17016
+ // ../../node_modules/.pnpm/socket.io-adapter@2.5.8_supports-color@10.2.2/node_modules/socket.io-adapter/dist/contrib/yeast.js
16957
17017
  var require_yeast = __commonJS({
16958
- "../../node_modules/socket.io-adapter/dist/contrib/yeast.js"(exports) {
17018
+ "../../node_modules/.pnpm/socket.io-adapter@2.5.8_supports-color@10.2.2/node_modules/socket.io-adapter/dist/contrib/yeast.js"(exports) {
16959
17019
  "use strict";
16960
17020
  Object.defineProperty(exports, "__esModule", { value: true });
16961
17021
  exports.encode = encode;
@@ -16993,9 +17053,9 @@ var require_yeast = __commonJS({
16993
17053
  }
16994
17054
  });
16995
17055
 
16996
- // ../../node_modules/socket.io-adapter/dist/in-memory-adapter.js
17056
+ // ../../node_modules/.pnpm/socket.io-adapter@2.5.8_supports-color@10.2.2/node_modules/socket.io-adapter/dist/in-memory-adapter.js
16997
17057
  var require_in_memory_adapter = __commonJS({
16998
- "../../node_modules/socket.io-adapter/dist/in-memory-adapter.js"(exports) {
17058
+ "../../node_modules/.pnpm/socket.io-adapter@2.5.8_supports-color@10.2.2/node_modules/socket.io-adapter/dist/in-memory-adapter.js"(exports) {
16999
17059
  "use strict";
17000
17060
  var _a;
17001
17061
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -17379,9 +17439,9 @@ var require_in_memory_adapter = __commonJS({
17379
17439
  }
17380
17440
  });
17381
17441
 
17382
- // ../../node_modules/socket.io-adapter/dist/cluster-adapter.js
17442
+ // ../../node_modules/.pnpm/socket.io-adapter@2.5.8_supports-color@10.2.2/node_modules/socket.io-adapter/dist/cluster-adapter.js
17383
17443
  var require_cluster_adapter = __commonJS({
17384
- "../../node_modules/socket.io-adapter/dist/cluster-adapter.js"(exports) {
17444
+ "../../node_modules/.pnpm/socket.io-adapter@2.5.8_supports-color@10.2.2/node_modules/socket.io-adapter/dist/cluster-adapter.js"(exports) {
17385
17445
  "use strict";
17386
17446
  var __rest = exports && exports.__rest || function(s, e) {
17387
17447
  var t = {};
@@ -17622,7 +17682,7 @@ var require_cluster_adapter = __commonJS({
17622
17682
  });
17623
17683
  this.addOffsetIfNecessary(packet, opts, offset);
17624
17684
  } catch (e) {
17625
- return debug("[%s] error while broadcasting message: %s", this.uid, e.message);
17685
+ debug("[%s] error while broadcasting message: %s", this.uid, e.message);
17626
17686
  }
17627
17687
  }
17628
17688
  super.broadcast(packet, opts);
@@ -18038,9 +18098,9 @@ var require_cluster_adapter = __commonJS({
18038
18098
  }
18039
18099
  });
18040
18100
 
18041
- // ../../node_modules/socket.io-adapter/dist/index.js
18101
+ // ../../node_modules/.pnpm/socket.io-adapter@2.5.8_supports-color@10.2.2/node_modules/socket.io-adapter/dist/index.js
18042
18102
  var require_dist = __commonJS({
18043
- "../../node_modules/socket.io-adapter/dist/index.js"(exports) {
18103
+ "../../node_modules/.pnpm/socket.io-adapter@2.5.8_supports-color@10.2.2/node_modules/socket.io-adapter/dist/index.js"(exports) {
18044
18104
  "use strict";
18045
18105
  Object.defineProperty(exports, "__esModule", { value: true });
18046
18106
  exports.MessageType = exports.ClusterAdapterWithHeartbeat = exports.ClusterAdapter = exports.SessionAwareAdapter = exports.Adapter = void 0;
@@ -18064,9 +18124,9 @@ var require_dist = __commonJS({
18064
18124
  }
18065
18125
  });
18066
18126
 
18067
- // ../../node_modules/socket.io/dist/parent-namespace.js
18127
+ // ../../node_modules/.pnpm/socket.io@4.8.3/node_modules/socket.io/dist/parent-namespace.js
18068
18128
  var require_parent_namespace = __commonJS({
18069
- "../../node_modules/socket.io/dist/parent-namespace.js"(exports) {
18129
+ "../../node_modules/.pnpm/socket.io@4.8.3/node_modules/socket.io/dist/parent-namespace.js"(exports) {
18070
18130
  "use strict";
18071
18131
  var __importDefault = exports && exports.__importDefault || function(mod) {
18072
18132
  return mod && mod.__esModule ? mod : { "default": mod };
@@ -18133,9 +18193,9 @@ var require_parent_namespace = __commonJS({
18133
18193
  }
18134
18194
  });
18135
18195
 
18136
- // ../../node_modules/socket.io/dist/uws.js
18196
+ // ../../node_modules/.pnpm/socket.io@4.8.3/node_modules/socket.io/dist/uws.js
18137
18197
  var require_uws = __commonJS({
18138
- "../../node_modules/socket.io/dist/uws.js"(exports) {
18198
+ "../../node_modules/.pnpm/socket.io@4.8.3/node_modules/socket.io/dist/uws.js"(exports) {
18139
18199
  "use strict";
18140
18200
  var __importDefault = exports && exports.__importDefault || function(mod) {
18141
18201
  return mod && mod.__esModule ? mod : { "default": mod };
@@ -18262,9 +18322,9 @@ var require_uws = __commonJS({
18262
18322
  }
18263
18323
  });
18264
18324
 
18265
- // ../../node_modules/socket.io/package.json
18325
+ // ../../node_modules/.pnpm/socket.io@4.8.3/node_modules/socket.io/package.json
18266
18326
  var require_package = __commonJS({
18267
- "../../node_modules/socket.io/package.json"(exports, module) {
18327
+ "../../node_modules/.pnpm/socket.io@4.8.3/node_modules/socket.io/package.json"(exports, module) {
18268
18328
  module.exports = {
18269
18329
  name: "socket.io",
18270
18330
  version: "4.8.3",
@@ -18356,9 +18416,9 @@ var require_package = __commonJS({
18356
18416
  }
18357
18417
  });
18358
18418
 
18359
- // ../../node_modules/socket.io/dist/index.js
18419
+ // ../../node_modules/.pnpm/socket.io@4.8.3/node_modules/socket.io/dist/index.js
18360
18420
  var require_dist2 = __commonJS({
18361
- "../../node_modules/socket.io/dist/index.js"(exports, module) {
18421
+ "../../node_modules/.pnpm/socket.io@4.8.3/node_modules/socket.io/dist/index.js"(exports, module) {
18362
18422
  "use strict";
18363
18423
  var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
18364
18424
  if (k2 === void 0) k2 = k;
@@ -18397,7 +18457,7 @@ var require_dist2 = __commonJS({
18397
18457
  var zlib_1 = __require("zlib");
18398
18458
  var accepts = require_accepts();
18399
18459
  var stream_1 = __require("stream");
18400
- var path12 = __require("path");
18460
+ var path13 = __require("path");
18401
18461
  var engine_io_1 = require_engine_io();
18402
18462
  var client_1 = require_client();
18403
18463
  var events_1 = __require("events");
@@ -18592,7 +18652,7 @@ var require_dist2 = __commonJS({
18592
18652
  res.writeHeader("cache-control", "public, max-age=0");
18593
18653
  res.writeHeader("content-type", "application/" + (isMap ? "json" : "javascript") + "; charset=utf-8");
18594
18654
  res.writeHeader("etag", expectedEtag);
18595
- const filepath = path12.join(__dirname, "../client-dist/", filename);
18655
+ const filepath = path13.join(__dirname, "../client-dist/", filename);
18596
18656
  (0, uws_1.serveFile)(res, filepath);
18597
18657
  });
18598
18658
  }
@@ -18674,7 +18734,7 @@ var require_dist2 = __commonJS({
18674
18734
  * @private
18675
18735
  */
18676
18736
  static sendFile(filename, req, res) {
18677
- const readStream = (0, fs_1.createReadStream)(path12.join(__dirname, "../client-dist/", filename));
18737
+ const readStream = (0, fs_1.createReadStream)(path13.join(__dirname, "../client-dist/", filename));
18678
18738
  const encoding = accepts(req).encodings(["br", "gzip", "deflate"]);
18679
18739
  const onError = (err) => {
18680
18740
  if (err) {
@@ -19108,10 +19168,10 @@ var require_dist2 = __commonJS({
19108
19168
  }
19109
19169
  });
19110
19170
 
19111
- // ../../node_modules/socket.io/wrapper.mjs
19171
+ // ../../node_modules/.pnpm/socket.io@4.8.3/node_modules/socket.io/wrapper.mjs
19112
19172
  var import_dist, Server, Namespace, Socket;
19113
19173
  var init_wrapper = __esm({
19114
- "../../node_modules/socket.io/wrapper.mjs"() {
19174
+ "../../node_modules/.pnpm/socket.io@4.8.3/node_modules/socket.io/wrapper.mjs"() {
19115
19175
  "use strict";
19116
19176
  import_dist = __toESM(require_dist2(), 1);
19117
19177
  ({ Server, Namespace, Socket } = import_dist.default);
@@ -19482,6 +19542,64 @@ var init_daemon_json = __esm({
19482
19542
  }
19483
19543
  });
19484
19544
 
19545
+ // src/daemon-logging.ts
19546
+ import fs4 from "fs";
19547
+ import path3 from "path";
19548
+ function daemonLogPaths(stateDir) {
19549
+ const logDir = path3.join(stateDir, "logs");
19550
+ return { logDir, out: path3.join(logDir, "daemon.log"), err: path3.join(logDir, "daemon-error.log") };
19551
+ }
19552
+ function openDaemonLogFds(stateDir) {
19553
+ const { logDir, out, err } = daemonLogPaths(stateDir);
19554
+ fs4.mkdirSync(logDir, { recursive: true });
19555
+ return { outFd: fs4.openSync(out, "a"), errFd: fs4.openSync(err, "a") };
19556
+ }
19557
+ function installStdioTee(stateDir) {
19558
+ if (!process.stdout.isTTY || process.env.SUPBUDDY_DAEMON_STDIO_TO_FILES) return () => {
19559
+ };
19560
+ const { logDir, out } = daemonLogPaths(stateDir);
19561
+ let fd;
19562
+ try {
19563
+ fs4.mkdirSync(logDir, { recursive: true });
19564
+ fd = fs4.openSync(out, "a");
19565
+ } catch {
19566
+ return () => {
19567
+ };
19568
+ }
19569
+ const origOut = process.stdout.write;
19570
+ const origErr = process.stderr.write;
19571
+ const sink = (chunk) => {
19572
+ try {
19573
+ if (fs4.fstatSync(fd).size > MAX_LOG_BYTES) fs4.ftruncateSync(fd, 0);
19574
+ fs4.writeSync(fd, typeof chunk === "string" ? chunk : chunk.toString());
19575
+ } catch (e) {
19576
+ origErr.call(process.stderr, `[daemon-logging] sink write failed: ${e.message}
19577
+ `);
19578
+ }
19579
+ };
19580
+ const patch = (orig, stream) => (chunk, ...rest) => {
19581
+ sink(chunk);
19582
+ return orig.call(stream, chunk, ...rest);
19583
+ };
19584
+ process.stdout.write = patch(origOut, process.stdout);
19585
+ process.stderr.write = patch(origErr, process.stderr);
19586
+ return () => {
19587
+ process.stdout.write = origOut;
19588
+ process.stderr.write = origErr;
19589
+ try {
19590
+ fs4.closeSync(fd);
19591
+ } catch {
19592
+ }
19593
+ };
19594
+ }
19595
+ var MAX_LOG_BYTES;
19596
+ var init_daemon_logging = __esm({
19597
+ "src/daemon-logging.ts"() {
19598
+ "use strict";
19599
+ MAX_LOG_BYTES = 5 * 1024 * 1024;
19600
+ }
19601
+ });
19602
+
19485
19603
  // src/mcp-control.ts
19486
19604
  function rpc(child, op, extra = {}, timeoutMs = 1e4) {
19487
19605
  const req_id = reqSeq++;
@@ -19524,7 +19642,7 @@ var init_mcp_control = __esm({
19524
19642
  });
19525
19643
 
19526
19644
  // src/network-monitor.ts
19527
- import os from "os";
19645
+ import os2 from "os";
19528
19646
  function networkSignature(ifaces) {
19529
19647
  try {
19530
19648
  return Object.values(ifaces).flat().filter((i) => !!i && !i.internal && i.family === "IPv4").map((i) => i.address).sort().join(",");
@@ -19534,7 +19652,7 @@ function networkSignature(ifaces) {
19534
19652
  }
19535
19653
  function createNetworkMonitor(opts) {
19536
19654
  const now = opts.now ?? Date.now;
19537
- const readIfaces = opts.ifaces ?? os.networkInterfaces;
19655
+ const readIfaces = opts.ifaces ?? os2.networkInterfaces;
19538
19656
  const intervalMs = opts.intervalMs ?? 5e3;
19539
19657
  const cooldownMs = opts.cooldownMs ?? 1e4;
19540
19658
  let lastSig = networkSignature(readIfaces());
@@ -19583,15 +19701,15 @@ var init_network_monitor = __esm({
19583
19701
  });
19584
19702
 
19585
19703
  // src/state-dir.ts
19586
- import os2 from "os";
19587
- import path3 from "path";
19704
+ import os3 from "os";
19705
+ import path4 from "path";
19588
19706
  function defaultStateDir() {
19589
19707
  const override = process.env.SUPBUDDY_STATE_DIR;
19590
19708
  if (override) return override;
19591
- const home = os2.homedir();
19592
- if (process.platform === "darwin") return path3.join(home, "Library", "Application Support", "Supbuddy");
19593
- if (process.platform === "win32") return path3.join(process.env.APPDATA ?? path3.join(home, "AppData", "Roaming"), "Supbuddy");
19594
- return path3.join(process.env.XDG_CONFIG_HOME ?? path3.join(home, ".config"), "Supbuddy");
19709
+ const home = os3.homedir();
19710
+ if (process.platform === "darwin") return path4.join(home, "Library", "Application Support", "Supbuddy");
19711
+ if (process.platform === "win32") return path4.join(process.env.APPDATA ?? path4.join(home, "AppData", "Roaming"), "Supbuddy");
19712
+ return path4.join(process.env.XDG_CONFIG_HOME ?? path4.join(home, ".config"), "Supbuddy");
19595
19713
  }
19596
19714
  var init_state_dir = __esm({
19597
19715
  "src/state-dir.ts"() {
@@ -19601,7 +19719,7 @@ var init_state_dir = __esm({
19601
19719
 
19602
19720
  // src/caddy-resolve.ts
19603
19721
  import { createRequire } from "module";
19604
- import path4 from "path";
19722
+ import path5 from "path";
19605
19723
  function caddyPackageName(platform = process.platform, arch = process.arch) {
19606
19724
  if (platform === "darwin") {
19607
19725
  return arch === "arm64" ? "@supbuddy/caddy-darwin-arm64" : "@supbuddy/caddy-darwin-amd64";
@@ -19616,7 +19734,7 @@ function resolvePackagedCaddyDir(deps = {}) {
19616
19734
  if (!pkgName) return null;
19617
19735
  const resolve = deps.resolve ?? ((id) => requireFromHere.resolve(id));
19618
19736
  try {
19619
- return path4.dirname(resolve(`${pkgName}/package.json`));
19737
+ return path5.dirname(resolve(`${pkgName}/package.json`));
19620
19738
  } catch {
19621
19739
  return null;
19622
19740
  }
@@ -19728,6 +19846,11 @@ var init_mcp_features = __esm({
19728
19846
  set_supabase_config_path: "pro_writes",
19729
19847
  enable_project: "pro_writes",
19730
19848
  disable_project: "pro_writes",
19849
+ // Supbuddy Cloud (write-class metadata — authorization is by scope, not a paywall)
19850
+ get_cloud_status: "free",
19851
+ push_to_cloud: "pro_writes",
19852
+ cloud_teardown: "pro_writes",
19853
+ cloud_sign_in: "pro_writes",
19731
19854
  scan_project: "pro_writes",
19732
19855
  update_settings: "pro_writes",
19733
19856
  copy_env_var: "pro_env_values",
@@ -19875,6 +19998,20 @@ var init_vm_migration = __esm({
19875
19998
  }
19876
19999
  });
19877
20000
 
20001
+ // ../../packages/shared/types/cloud-graph-plan.ts
20002
+ var init_cloud_graph_plan = __esm({
20003
+ "../../packages/shared/types/cloud-graph-plan.ts"() {
20004
+ "use strict";
20005
+ }
20006
+ });
20007
+
20008
+ // ../../packages/shared/types/cloud-state.ts
20009
+ var init_cloud_state = __esm({
20010
+ "../../packages/shared/types/cloud-state.ts"() {
20011
+ "use strict";
20012
+ }
20013
+ });
20014
+
19878
20015
  // ../../packages/shared/types/index.ts
19879
20016
  var init_types = __esm({
19880
20017
  "../../packages/shared/types/index.ts"() {
@@ -19891,13 +20028,15 @@ var init_types = __esm({
19891
20028
  init_mcp_features();
19892
20029
  init_project_context();
19893
20030
  init_vm_migration();
20031
+ init_cloud_graph_plan();
20032
+ init_cloud_state();
19894
20033
  }
19895
20034
  });
19896
20035
 
19897
- // ../../node_modules/zod/v3/helpers/util.js
20036
+ // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js
19898
20037
  var util, objectUtil, ZodParsedType, getParsedType;
19899
20038
  var init_util = __esm({
19900
- "../../node_modules/zod/v3/helpers/util.js"() {
20039
+ "../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js"() {
19901
20040
  "use strict";
19902
20041
  (function(util2) {
19903
20042
  util2.assertEqual = (_) => {
@@ -20032,10 +20171,10 @@ var init_util = __esm({
20032
20171
  }
20033
20172
  });
20034
20173
 
20035
- // ../../node_modules/zod/v3/ZodError.js
20174
+ // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js
20036
20175
  var ZodIssueCode, quotelessJson, ZodError;
20037
20176
  var init_ZodError = __esm({
20038
- "../../node_modules/zod/v3/ZodError.js"() {
20177
+ "../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js"() {
20039
20178
  "use strict";
20040
20179
  init_util();
20041
20180
  ZodIssueCode = util.arrayToEnum([
@@ -20157,10 +20296,10 @@ var init_ZodError = __esm({
20157
20296
  }
20158
20297
  });
20159
20298
 
20160
- // ../../node_modules/zod/v3/locales/en.js
20299
+ // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js
20161
20300
  var errorMap, en_default;
20162
20301
  var init_en = __esm({
20163
- "../../node_modules/zod/v3/locales/en.js"() {
20302
+ "../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js"() {
20164
20303
  "use strict";
20165
20304
  init_ZodError();
20166
20305
  init_util();
@@ -20268,7 +20407,7 @@ var init_en = __esm({
20268
20407
  }
20269
20408
  });
20270
20409
 
20271
- // ../../node_modules/zod/v3/errors.js
20410
+ // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js
20272
20411
  function setErrorMap(map) {
20273
20412
  overrideErrorMap = map;
20274
20413
  }
@@ -20277,14 +20416,14 @@ function getErrorMap() {
20277
20416
  }
20278
20417
  var overrideErrorMap;
20279
20418
  var init_errors = __esm({
20280
- "../../node_modules/zod/v3/errors.js"() {
20419
+ "../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js"() {
20281
20420
  "use strict";
20282
20421
  init_en();
20283
20422
  overrideErrorMap = en_default;
20284
20423
  }
20285
20424
  });
20286
20425
 
20287
- // ../../node_modules/zod/v3/helpers/parseUtil.js
20426
+ // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
20288
20427
  function addIssueToContext(ctx, issueData) {
20289
20428
  const overrideMap = getErrorMap();
20290
20429
  const issue = makeIssue({
@@ -20306,13 +20445,13 @@ function addIssueToContext(ctx, issueData) {
20306
20445
  }
20307
20446
  var makeIssue, EMPTY_PATH, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync;
20308
20447
  var init_parseUtil = __esm({
20309
- "../../node_modules/zod/v3/helpers/parseUtil.js"() {
20448
+ "../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js"() {
20310
20449
  "use strict";
20311
20450
  init_errors();
20312
20451
  init_en();
20313
20452
  makeIssue = (params) => {
20314
- const { data, path: path12, errorMaps, issueData } = params;
20315
- const fullPath = [...path12, ...issueData.path || []];
20453
+ const { data, path: path13, errorMaps, issueData } = params;
20454
+ const fullPath = [...path13, ...issueData.path || []];
20316
20455
  const fullIssue = {
20317
20456
  ...issueData,
20318
20457
  path: fullPath
@@ -20402,17 +20541,17 @@ var init_parseUtil = __esm({
20402
20541
  }
20403
20542
  });
20404
20543
 
20405
- // ../../node_modules/zod/v3/helpers/typeAliases.js
20544
+ // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/typeAliases.js
20406
20545
  var init_typeAliases = __esm({
20407
- "../../node_modules/zod/v3/helpers/typeAliases.js"() {
20546
+ "../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/typeAliases.js"() {
20408
20547
  "use strict";
20409
20548
  }
20410
20549
  });
20411
20550
 
20412
- // ../../node_modules/zod/v3/helpers/errorUtil.js
20551
+ // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js
20413
20552
  var errorUtil;
20414
20553
  var init_errorUtil = __esm({
20415
- "../../node_modules/zod/v3/helpers/errorUtil.js"() {
20554
+ "../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js"() {
20416
20555
  "use strict";
20417
20556
  (function(errorUtil2) {
20418
20557
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
@@ -20421,7 +20560,7 @@ var init_errorUtil = __esm({
20421
20560
  }
20422
20561
  });
20423
20562
 
20424
- // ../../node_modules/zod/v3/types.js
20563
+ // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
20425
20564
  function processCreateParams(params) {
20426
20565
  if (!params)
20427
20566
  return {};
@@ -20615,7 +20754,7 @@ function custom(check, _params = {}, fatal) {
20615
20754
  }
20616
20755
  var ParseInputLazyPath, handleResult, ZodType, cuidRegex, cuid2Regex, ulidRegex, uuidRegex, nanoidRegex, jwtRegex, durationRegex, emailRegex, _emojiRegex, emojiRegex, ipv4Regex, ipv4CidrRegex, ipv6Regex, ipv6CidrRegex, base64Regex, base64urlRegex, dateRegexSource, dateRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, BRAND, ZodBranded, ZodPipeline, ZodReadonly, late, ZodFirstPartyTypeKind, instanceOfType, stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType, ostring, onumber, oboolean, coerce, NEVER;
20617
20756
  var init_types2 = __esm({
20618
- "../../node_modules/zod/v3/types.js"() {
20757
+ "../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js"() {
20619
20758
  "use strict";
20620
20759
  init_ZodError();
20621
20760
  init_errors();
@@ -20623,11 +20762,11 @@ var init_types2 = __esm({
20623
20762
  init_parseUtil();
20624
20763
  init_util();
20625
20764
  ParseInputLazyPath = class {
20626
- constructor(parent, value, path12, key) {
20765
+ constructor(parent, value, path13, key) {
20627
20766
  this._cachedPath = [];
20628
20767
  this.parent = parent;
20629
20768
  this.data = value;
20630
- this._path = path12;
20769
+ this._path = path13;
20631
20770
  this._key = key;
20632
20771
  }
20633
20772
  get path() {
@@ -23878,7 +24017,7 @@ var init_types2 = __esm({
23878
24017
  }
23879
24018
  });
23880
24019
 
23881
- // ../../node_modules/zod/v3/external.js
24020
+ // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js
23882
24021
  var external_exports = {};
23883
24022
  __export(external_exports, {
23884
24023
  BRAND: () => BRAND,
@@ -23990,7 +24129,7 @@ __export(external_exports, {
23990
24129
  void: () => voidType
23991
24130
  });
23992
24131
  var init_external = __esm({
23993
- "../../node_modules/zod/v3/external.js"() {
24132
+ "../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js"() {
23994
24133
  "use strict";
23995
24134
  init_errors();
23996
24135
  init_parseUtil();
@@ -24001,9 +24140,9 @@ var init_external = __esm({
24001
24140
  }
24002
24141
  });
24003
24142
 
24004
- // ../../node_modules/zod/index.js
24143
+ // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/index.js
24005
24144
  var init_zod = __esm({
24006
- "../../node_modules/zod/index.js"() {
24145
+ "../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/index.js"() {
24007
24146
  "use strict";
24008
24147
  init_external();
24009
24148
  init_external();
@@ -24157,7 +24296,7 @@ var init_project2 = __esm({
24157
24296
  });
24158
24297
 
24159
24298
  // ../../packages/shared/schemas/mcp.ts
24160
- var McpClientKindSchema, McpScopesSchema, McpClientRecordSchema, McpAuditResultSchema, McpAuditEntrySchema, McpServerStateSchema, McpErrorPayloadSchema, DOMAIN_REGEX, PORT, ID, SCOPE_KEY, ToolFilterMethod, ContextTargetBoolPatchSchema, CONTEXT_TARGET_KEY, ContextTargetScopePatchSchema, MCP_TOOL_SCHEMAS;
24299
+ var McpClientKindSchema, McpScopesSchema, McpClientRecordSchema, McpAuditResultSchema, McpAuditEntrySchema, McpServerStateSchema, McpErrorPayloadSchema, DOMAIN_REGEX, TLD_REGEX, PORT, ID, SCOPE_KEY, ToolFilterMethod, ContextTargetBoolPatchSchema, CONTEXT_TARGET_KEY, ContextTargetScopePatchSchema, MCP_TOOL_SCHEMAS;
24161
24300
  var init_mcp2 = __esm({
24162
24301
  "../../packages/shared/schemas/mcp.ts"() {
24163
24302
  "use strict";
@@ -24245,6 +24384,7 @@ var init_mcp2 = __esm({
24245
24384
  details: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
24246
24385
  }).strict();
24247
24386
  DOMAIN_REGEX = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i;
24387
+ TLD_REGEX = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/i;
24248
24388
  PORT = external_exports.number().int().min(1).max(65535);
24249
24389
  ID = external_exports.string().min(1);
24250
24390
  SCOPE_KEY = external_exports.enum(["read", "log_tail", "mappings", "projects", "services", "config", "system", "apply"]);
@@ -24328,8 +24468,11 @@ var init_mcp2 = __esm({
24328
24468
  }).strict(),
24329
24469
  enable_mapping: external_exports.object({ id: ID }).strict(),
24330
24470
  disable_mapping: external_exports.object({ id: ID }).strict(),
24331
- register_project: external_exports.object({ root_path: external_exports.string().min(1), label: external_exports.string().optional(), auto_scan: external_exports.boolean().default(true), isolation: external_exports.enum(["host", "thin"]).optional() }).strict(),
24332
- update_project: external_exports.object({ id: ID, patch: external_exports.object({ name: external_exports.string().optional(), enabled: external_exports.boolean().optional(), domain: external_exports.string().regex(DOMAIN_REGEX).optional(), isolation: external_exports.enum(["host"]).optional() }).strict() }).strict(),
24471
+ register_project: external_exports.object({ root_path: external_exports.string().min(1), label: external_exports.string().optional(), auto_scan: external_exports.boolean().default(true), isolation: external_exports.enum(["host", "thin"]).optional(), tld: external_exports.string().regex(TLD_REGEX).optional() }).strict(),
24472
+ // `tld` also accepts '' the clear signal for a per-project TLD override
24473
+ // (see resolveProjectTldUpdate in packages/core/tld-normalization.ts), which
24474
+ // TLD_REGEX alone rejects (it requires at least one DNS-label character).
24475
+ update_project: external_exports.object({ id: ID, patch: external_exports.object({ name: external_exports.string().optional(), enabled: external_exports.boolean().optional(), domain: external_exports.string().regex(DOMAIN_REGEX).optional(), isolation: external_exports.enum(["host"]).optional(), tld: external_exports.string().regex(TLD_REGEX).or(external_exports.literal("")).optional() }).strict() }).strict(),
24333
24476
  // `supabase_path` is the project-relative directory that CONTAINS the
24334
24477
  // `supabase/` folder ("." = repo root, e.g. "apps/getnightowls"), matching
24335
24478
  // the operative semantics of findSupabaseConfig (which appends
@@ -24338,6 +24481,11 @@ var init_mcp2 = __esm({
24338
24481
  enable_project: external_exports.object({ id: ID }).strict(),
24339
24482
  disable_project: external_exports.object({ id: ID }).strict(),
24340
24483
  scan_project: external_exports.object({ root_path: external_exports.string().min(1) }).strict(),
24484
+ // Supbuddy Cloud
24485
+ get_cloud_status: external_exports.object({ project_id: ID.optional() }).strict(),
24486
+ push_to_cloud: external_exports.object({ project_id: ID, github_repo: external_exports.string().min(1).optional(), force: external_exports.boolean().optional(), supabase_services: external_exports.enum(["minimal", "full"]).optional() }).strict(),
24487
+ cloud_teardown: external_exports.object({ project_id: ID }).strict(),
24488
+ cloud_sign_in: external_exports.object({ email: external_exports.string().email(), password: external_exports.string().min(1) }).strict(),
24341
24489
  update_settings: external_exports.object({ patch: external_exports.record(external_exports.string(), external_exports.unknown()) }).strict(),
24342
24490
  restore_mapping: external_exports.object({ id: ID }).strict(),
24343
24491
  restore_project: external_exports.object({ id: ID, restore_children: external_exports.boolean().default(true) }).strict(),
@@ -24799,24 +24947,24 @@ var init_shared = __esm({
24799
24947
  // src/daemon.ts
24800
24948
  import { spawn as spawn2 } from "child_process";
24801
24949
  import { fileURLToPath } from "url";
24802
- import fs4 from "fs";
24803
- import path5 from "path";
24950
+ import fs5 from "fs";
24951
+ import path6 from "path";
24804
24952
  function resolveWorkerEntry(deps = {}) {
24805
24953
  const binDir = deps.binDir ?? __dirname2;
24806
24954
  const repoRoot = deps.repoRoot ?? REPO_ROOT;
24807
- const env2 = deps.env ?? process.env;
24808
- const exists = deps.exists ?? fs4.existsSync;
24809
- const bundle = env2.SUPBUDDY_WORKER_BUNDLE;
24955
+ const env3 = deps.env ?? process.env;
24956
+ const exists = deps.exists ?? fs5.existsSync;
24957
+ const bundle = env3.SUPBUDDY_WORKER_BUNDLE;
24810
24958
  if (bundle) {
24811
- return { cmd: process.execPath, args: [bundle], workerEntry: bundle, cwd: path5.dirname(bundle), mode: "host" };
24959
+ return { cmd: process.execPath, args: [bundle], workerEntry: bundle, cwd: path6.dirname(bundle), mode: "host" };
24812
24960
  }
24813
- const pkgWorker = path5.join(binDir, "daemon", "worker.cjs");
24961
+ const pkgWorker = path6.join(binDir, "daemon", "worker.cjs");
24814
24962
  if (exists(pkgWorker)) {
24815
- return { cmd: process.execPath, args: [pkgWorker], workerEntry: pkgWorker, cwd: path5.dirname(pkgWorker), mode: "npm" };
24963
+ return { cmd: process.execPath, args: [pkgWorker], workerEntry: pkgWorker, cwd: path6.dirname(pkgWorker), mode: "npm" };
24816
24964
  }
24817
- const bootstrap = path5.join(repoRoot, "apps", "cli", "src", "worker-bootstrap.ts");
24965
+ const bootstrap = path6.join(repoRoot, "apps", "cli", "src", "worker-bootstrap.ts");
24818
24966
  if (exists(bootstrap)) {
24819
- const workerEntry = path5.join(repoRoot, "packages", "core", "index.ts");
24967
+ const workerEntry = path6.join(repoRoot, "packages", "core", "index.ts");
24820
24968
  return { cmd: process.execPath, args: ["--import", "tsx", bootstrap], workerEntry, cwd: repoRoot, mode: "dev" };
24821
24969
  }
24822
24970
  throw new WorkerUnavailableError();
@@ -24825,16 +24973,16 @@ async function startDaemon(opts = {}) {
24825
24973
  const { stateDir, workerPort, assumeYes, quiet } = opts;
24826
24974
  const effectiveStateDir = stateDir ?? defaultStateDir();
24827
24975
  const { cmd, args, workerEntry, cwd, mode } = resolveWorkerEntry();
24828
- const env2 = { ...process.env, NODE_ENV: process.env.NODE_ENV ?? "development" };
24829
- env2.SUPBUDDY_WORKER_ENTRY = workerEntry;
24830
- env2.SUPBUDDY_STATE_DIR = effectiveStateDir;
24831
- if (workerPort) env2.WORKER_PORT = String(workerPort);
24832
- if (mode === "npm" && !env2.SUPBUDDY_BIN_DIR) {
24976
+ const env3 = { ...process.env, NODE_ENV: process.env.NODE_ENV ?? "development" };
24977
+ env3.SUPBUDDY_WORKER_ENTRY = workerEntry;
24978
+ env3.SUPBUDDY_STATE_DIR = effectiveStateDir;
24979
+ if (workerPort) env3.WORKER_PORT = String(workerPort);
24980
+ if (mode === "npm" && !env3.SUPBUDDY_BIN_DIR) {
24833
24981
  const caddyDir = resolvePackagedCaddyDir();
24834
24982
  if (!caddyDir) throw new CaddyUnavailableError();
24835
- env2.SUPBUDDY_BIN_DIR = caddyDir;
24983
+ env3.SUPBUDDY_BIN_DIR = caddyDir;
24836
24984
  }
24837
- const child = spawn2(cmd, args, { stdio: ["ignore", "pipe", "pipe", "ipc"], env: env2, cwd });
24985
+ const child = spawn2(cmd, args, { stdio: ["ignore", "pipe", "pipe", "ipc"], env: env3, cwd });
24838
24986
  const startedAt = (/* @__PURE__ */ new Date()).toISOString();
24839
24987
  const baseSocketPort = workerPort ?? DEFAULT_WORKER_PORT;
24840
24988
  let resolveMcpPort;
@@ -24962,6 +25110,7 @@ async function runDaemonForeground(opts = {}) {
24962
25110
  console.error(`[daemon] already running (pid ${running.pid}, mcp :${running.mcpPort})`);
24963
25111
  return 1;
24964
25112
  }
25113
+ installStdioTee(effectiveStateDir);
24965
25114
  const handle = await startDaemon(opts);
24966
25115
  let stopping = false;
24967
25116
  const onSignal = async () => {
@@ -24985,12 +25134,22 @@ async function runDaemonDetached(opts = {}) {
24985
25134
  }
24986
25135
  const entry = process.argv[1];
24987
25136
  const isTsEntry = entry.endsWith(".ts");
24988
- const execPath = isTsEntry ? path5.join(REPO_ROOT, "node_modules", ".bin", "tsx") : process.execPath;
25137
+ const execPath = isTsEntry ? path6.join(REPO_ROOT, "node_modules", ".bin", "tsx") : process.execPath;
24989
25138
  const args = [entry, "daemon"];
24990
25139
  if (opts.stateDir) args.push(`--state-dir=${opts.stateDir}`);
24991
25140
  if (opts.workerPort) args.push(`--worker-port=${opts.workerPort}`);
24992
- const child = spawn2(execPath, args, { detached: true, stdio: "ignore", env: process.env });
25141
+ const { outFd, errFd } = openDaemonLogFds(dir);
25142
+ const child = spawn2(execPath, args, {
25143
+ detached: true,
25144
+ stdio: ["ignore", outFd, errFd],
25145
+ env: { ...process.env, SUPBUDDY_DAEMON_STDIO_TO_FILES: "1" }
25146
+ });
24993
25147
  child.unref();
25148
+ try {
25149
+ fs5.closeSync(outFd);
25150
+ fs5.closeSync(errFd);
25151
+ } catch {
25152
+ }
24994
25153
  for (let i = 0; i < 50; i++) {
24995
25154
  const info = await readDaemonInfo(dir);
24996
25155
  if (info && isPidAlive(info.pid)) {
@@ -25008,14 +25167,15 @@ var init_daemon = __esm({
25008
25167
  "use strict";
25009
25168
  init_host_cli2();
25010
25169
  init_daemon_json();
25170
+ init_daemon_logging();
25011
25171
  init_mcp_control();
25012
25172
  init_relay_server();
25013
25173
  init_network_monitor();
25014
25174
  init_state_dir();
25015
25175
  init_caddy_resolve();
25016
25176
  init_shared();
25017
- __dirname2 = path5.dirname(fileURLToPath(import.meta.url));
25018
- REPO_ROOT = path5.resolve(__dirname2, "..", "..", "..");
25177
+ __dirname2 = path6.dirname(fileURLToPath(import.meta.url));
25178
+ REPO_ROOT = path6.resolve(__dirname2, "..", "..", "..");
25019
25179
  WorkerUnavailableError = class extends Error {
25020
25180
  constructor() {
25021
25181
  super(
@@ -25586,6 +25746,7 @@ var init_completions = __esm({
25586
25746
  project: ["ls", "add", "get", "scan", "set", "enable", "disable", "rm", "restore", "env", "env-read", "set-supabase-path", "refresh-context"],
25587
25747
  projects: [],
25588
25748
  supabase: ["start", "stop", "restart", "status", "config", "init", "backups", "restore", "cancel", "force-recreate", "restart-container", "analytics"],
25749
+ cloud: ["login", "status", "push", "teardown"],
25589
25750
  logs: ["requests", "audit", "get"],
25590
25751
  compose: ["up", "down", "restart", "status", "logs"],
25591
25752
  isolation: ["switch", "pending-migrations"],
@@ -25626,6 +25787,9 @@ var init_completions = __esm({
25626
25787
  "project:restore": "projects",
25627
25788
  "project:env": "projects",
25628
25789
  "project:refresh-context": "projects",
25790
+ "cloud:push": "projects",
25791
+ "cloud:status": "projects",
25792
+ "cloud:teardown": "projects",
25629
25793
  "supabase:start": "projects",
25630
25794
  "supabase:stop": "projects",
25631
25795
  "supabase:restart": "projects",
@@ -25661,6 +25825,7 @@ var init_completions = __esm({
25661
25825
  map: "domain \u2192 port mappings",
25662
25826
  project: "registered dev projects",
25663
25827
  supabase: "local Supabase lifecycle",
25828
+ cloud: "Supbuddy Cloud (push/status/teardown)",
25664
25829
  compose: "docker compose services",
25665
25830
  scripts: "project dev scripts",
25666
25831
  logs: "request + audit logs",
@@ -25703,7 +25868,7 @@ var init_completions = __esm({
25703
25868
  "project:add": "register a project",
25704
25869
  "project:get": "show project details",
25705
25870
  "project:scan": "scan for services",
25706
- "project:set": "update name/domain",
25871
+ "project:set": "update name/domain/tld",
25707
25872
  "project:enable": "enable a project",
25708
25873
  "project:disable": "disable a project",
25709
25874
  "project:rm": "delete a project",
@@ -25725,6 +25890,11 @@ var init_completions = __esm({
25725
25890
  "supabase:force-recreate": "force-recreate containers",
25726
25891
  "supabase:restart-container": "restart one container",
25727
25892
  "supabase:analytics": "analytics on/off",
25893
+ // cloud
25894
+ "cloud:login": "sign in to Supbuddy Cloud",
25895
+ "cloud:push": "push a project to the cloud",
25896
+ "cloud:status": "cloud sign-in / stack status",
25897
+ "cloud:teardown": "tear down a cloud stack",
25728
25898
  // compose
25729
25899
  "compose:up": "start services",
25730
25900
  "compose:restart": "restart services",
@@ -25803,10 +25973,10 @@ __export(install_exports, {
25803
25973
  });
25804
25974
  import { spawnSync } from "child_process";
25805
25975
  import readline2 from "readline";
25806
- import path6 from "path";
25976
+ import path7 from "path";
25807
25977
  function isEphemeralNpx() {
25808
25978
  const argv1 = process.argv[1] || "";
25809
- if (argv1.includes(`${path6.sep}_npx${path6.sep}`) || argv1.includes("/_npx/")) return true;
25979
+ if (argv1.includes(`${path7.sep}_npx${path7.sep}`) || argv1.includes("/_npx/")) return true;
25810
25980
  if (process.env.npm_command === "exec") return true;
25811
25981
  return false;
25812
25982
  }
@@ -25879,9 +26049,9 @@ var init_install = __esm({
25879
26049
  var selftest_exports = {};
25880
26050
  import net from "net";
25881
26051
  import http from "http";
25882
- import fs5 from "fs/promises";
25883
- import os4 from "os";
25884
- import path7 from "path";
26052
+ import fs6 from "fs/promises";
26053
+ import os5 from "os";
26054
+ import path8 from "path";
25885
26055
  function getFreePort() {
25886
26056
  return new Promise((resolve, reject) => {
25887
26057
  const srv = net.createServer();
@@ -25965,7 +26135,7 @@ async function main() {
25965
26135
  const workerPort = await getFreePort();
25966
26136
  let mcpPort = await getFreePort();
25967
26137
  if (mcpPort === workerPort) mcpPort = await getFreePort();
25968
- const stateDir = await fs5.mkdtemp(path7.join(os4.tmpdir(), "supbuddy-selftest-"));
26138
+ const stateDir = await fs6.mkdtemp(path8.join(os5.tmpdir(), "supbuddy-selftest-"));
25969
26139
  const seed = {
25970
26140
  projects: [],
25971
26141
  mappings: [],
@@ -25975,7 +26145,7 @@ async function main() {
25975
26145
  mcp: { enabled: true, port: mcpPort, audit_cap: 5e3, trash_ttl_days: 7 }
25976
26146
  }
25977
26147
  };
25978
- await fs5.writeFile(path7.join(stateDir, "state.json"), JSON.stringify(seed, null, 2));
26148
+ await fs6.writeFile(path8.join(stateDir, "state.json"), JSON.stringify(seed, null, 2));
25979
26149
  console.log(`isolated state dir: ${stateDir}`);
25980
26150
  console.log(`worker (Socket.IO) port: ${workerPort} MCP port: ${mcpPort}
25981
26151
  `);
@@ -25996,7 +26166,7 @@ async function main() {
25996
26166
  } finally {
25997
26167
  console.log("\nstopping worker (graceful shutdown)...");
25998
26168
  await handle.stop();
25999
- await fs5.rm(stateDir, { recursive: true, force: true }).catch(() => {
26169
+ await fs6.rm(stateDir, { recursive: true, force: true }).catch(() => {
26000
26170
  });
26001
26171
  }
26002
26172
  console.log("\n\u2500\u2500 results \u2500\u2500");
@@ -26024,10 +26194,10 @@ __export(update_exports, {
26024
26194
  runUpdate: () => runUpdate
26025
26195
  });
26026
26196
  import https from "https";
26027
- import fs6 from "fs/promises";
26197
+ import fs7 from "fs/promises";
26028
26198
  import { createWriteStream } from "fs";
26029
- import os5 from "os";
26030
- import path8 from "path";
26199
+ import os6 from "os";
26200
+ import path9 from "path";
26031
26201
  import crypto from "crypto";
26032
26202
  import readline3 from "readline";
26033
26203
  import { execFile, execFileSync as execFileSync2, spawn as spawn3 } from "child_process";
@@ -26129,7 +26299,7 @@ function installedVersion() {
26129
26299
  }
26130
26300
  }
26131
26301
  async function sha256(file) {
26132
- const buf = await fs6.readFile(file);
26302
+ const buf = await fs7.readFile(file);
26133
26303
  return crypto.createHash("sha256").update(buf).digest("hex");
26134
26304
  }
26135
26305
  function promptYesNo(question) {
@@ -26143,7 +26313,7 @@ function promptYesNo(question) {
26143
26313
  }
26144
26314
  async function canWrite(dir) {
26145
26315
  try {
26146
- await fs6.access(dir, (await import("fs")).constants.W_OK);
26316
+ await fs7.access(dir, (await import("fs")).constants.W_OK);
26147
26317
  return true;
26148
26318
  } catch {
26149
26319
  return false;
@@ -26153,20 +26323,20 @@ function sq(p) {
26153
26323
  return `'${p.replace(/'/g, "'\\''")}'`;
26154
26324
  }
26155
26325
  async function swapApp(newApp) {
26156
- const dir = path8.dirname(INSTALLED_APP);
26326
+ const dir = path9.dirname(INSTALLED_APP);
26157
26327
  if (await canWrite(dir)) {
26158
26328
  const bak = `${INSTALLED_APP}.bak-${process.pid}`;
26159
- if (await fs6.stat(INSTALLED_APP).then(() => true).catch(() => false)) {
26160
- await fs6.rename(INSTALLED_APP, bak);
26329
+ if (await fs7.stat(INSTALLED_APP).then(() => true).catch(() => false)) {
26330
+ await fs7.rename(INSTALLED_APP, bak);
26161
26331
  }
26162
26332
  try {
26163
- await fs6.rename(newApp, INSTALLED_APP);
26333
+ await fs7.rename(newApp, INSTALLED_APP);
26164
26334
  } catch (e) {
26165
- await fs6.rename(bak, INSTALLED_APP).catch(() => {
26335
+ await fs7.rename(bak, INSTALLED_APP).catch(() => {
26166
26336
  });
26167
26337
  throw e;
26168
26338
  }
26169
- await fs6.rm(bak, { recursive: true, force: true }).catch(() => {
26339
+ await fs7.rm(bak, { recursive: true, force: true }).catch(() => {
26170
26340
  });
26171
26341
  return;
26172
26342
  }
@@ -26228,25 +26398,25 @@ supbuddy update: could not reach the release server \u2014 ${e.message}`);
26228
26398
  return 0;
26229
26399
  }
26230
26400
  }
26231
- const tmp = await fs6.mkdtemp(path8.join(os5.tmpdir(), "supbuddy-update-"));
26232
- const tar = path8.join(tmp, TAR_ASSET);
26233
- const shaFile = path8.join(tmp, SHA_ASSET);
26234
- const extractDir = path8.join(tmp, "extracted");
26401
+ const tmp = await fs7.mkdtemp(path9.join(os6.tmpdir(), "supbuddy-update-"));
26402
+ const tar = path9.join(tmp, TAR_ASSET);
26403
+ const shaFile = path9.join(tmp, SHA_ASSET);
26404
+ const extractDir = path9.join(tmp, "extracted");
26235
26405
  try {
26236
26406
  console.log("Downloading\u2026");
26237
26407
  await downloadAsset(pick.tarUrl, tar);
26238
26408
  await downloadAsset(pick.shaUrl, shaFile);
26239
26409
  console.log("Verifying checksum\u2026");
26240
- const expected = (await fs6.readFile(shaFile, "utf8")).trim().split(/\s+/)[0];
26410
+ const expected = (await fs7.readFile(shaFile, "utf8")).trim().split(/\s+/)[0];
26241
26411
  const actual = await sha256(tar);
26242
26412
  if (!expected || expected.toLowerCase() !== actual.toLowerCase()) {
26243
26413
  console.error("supbuddy update: SHA-256 mismatch \u2014 refusing to install. The download may be corrupted.");
26244
26414
  return 1;
26245
26415
  }
26246
- await fs6.mkdir(extractDir, { recursive: true });
26416
+ await fs7.mkdir(extractDir, { recursive: true });
26247
26417
  execFileSync2("tar", ["-xzf", tar, "-C", extractDir]);
26248
- const newApp = path8.join(extractDir, "Supbuddy.app");
26249
- if (!await fs6.stat(newApp).then(() => true).catch(() => false)) {
26418
+ const newApp = path9.join(extractDir, "Supbuddy.app");
26419
+ if (!await fs7.stat(newApp).then(() => true).catch(() => false)) {
26250
26420
  console.error("supbuddy update: the archive did not contain Supbuddy.app.");
26251
26421
  return 1;
26252
26422
  }
@@ -26260,7 +26430,7 @@ supbuddy update: could not reach the release server \u2014 ${e.message}`);
26260
26430
  console.error(`supbuddy update: ${e.message}`);
26261
26431
  return 1;
26262
26432
  } finally {
26263
- await fs6.rm(tmp, { recursive: true, force: true }).catch(() => {
26433
+ await fs7.rm(tmp, { recursive: true, force: true }).catch(() => {
26264
26434
  });
26265
26435
  }
26266
26436
  if (opts.noRestart) {
@@ -26299,20 +26469,20 @@ function detectFramework(argv) {
26299
26469
  return "unknown";
26300
26470
  }
26301
26471
  }
26302
- function hasFlag2(argv, ...names) {
26472
+ function hasFlag3(argv, ...names) {
26303
26473
  return argv.some((tok) => names.some((n) => tok === n || tok.startsWith(`${n}=`)));
26304
26474
  }
26305
26475
  function injectBindHost(argv, ip) {
26306
26476
  const framework = detectFramework(argv);
26307
26477
  switch (framework) {
26308
26478
  case "next": {
26309
- if (hasFlag2(argv, "-H", "--hostname")) return { argv, framework };
26479
+ if (hasFlag3(argv, "-H", "--hostname")) return { argv, framework };
26310
26480
  return { argv: [...argv, "-H", ip], framework };
26311
26481
  }
26312
26482
  case "vite": {
26313
26483
  const out = [...argv];
26314
- if (!hasFlag2(out, "--host")) out.push("--host", ip);
26315
- if (!hasFlag2(out, "--strictPort")) out.push("--strictPort");
26484
+ if (!hasFlag3(out, "--host")) out.push("--host", ip);
26485
+ if (!hasFlag3(out, "--strictPort")) out.push("--strictPort");
26316
26486
  return { argv: out, framework };
26317
26487
  }
26318
26488
  case "bun":
@@ -26371,20 +26541,20 @@ __export(run_exports, {
26371
26541
  selectDevUrls: () => selectDevUrls
26372
26542
  });
26373
26543
  import { spawn as spawn4, execSync } from "child_process";
26374
- import fs7 from "fs";
26375
- import path9 from "path";
26544
+ import fs8 from "fs";
26545
+ import path10 from "path";
26376
26546
  function readMeta(startDir) {
26377
26547
  let dir = startDir;
26378
26548
  for (; ; ) {
26379
- const metaPath = path9.join(dir, ".supbuddy", "meta.json");
26380
- if (fs7.existsSync(metaPath)) {
26549
+ const metaPath = path10.join(dir, ".supbuddy", "meta.json");
26550
+ if (fs8.existsSync(metaPath)) {
26381
26551
  try {
26382
- return JSON.parse(fs7.readFileSync(metaPath, "utf-8"));
26552
+ return JSON.parse(fs8.readFileSync(metaPath, "utf-8"));
26383
26553
  } catch {
26384
26554
  return {};
26385
26555
  }
26386
26556
  }
26387
- const parent = path9.dirname(dir);
26557
+ const parent = path10.dirname(dir);
26388
26558
  if (parent === dir) return {};
26389
26559
  dir = parent;
26390
26560
  }
@@ -26520,9 +26690,9 @@ __export(service_exports, {
26520
26690
  systemdUnit: () => systemdUnit,
26521
26691
  uninstallService: () => uninstallService
26522
26692
  });
26523
- import fs8 from "fs/promises";
26524
- import os6 from "os";
26525
- import path10 from "path";
26693
+ import fs9 from "fs/promises";
26694
+ import os7 from "os";
26695
+ import path11 from "path";
26526
26696
  import { fileURLToPath as fileURLToPath2 } from "url";
26527
26697
  import { spawnSync as spawnSync2 } from "child_process";
26528
26698
  function launchdPlist(o) {
@@ -26545,9 +26715,9 @@ function launchdPlist(o) {
26545
26715
  <key>KeepAlive</key>
26546
26716
  <true/>
26547
26717
  <key>StandardOutPath</key>
26548
- <string>${path10.join(o.logDir, "daemon.log")}</string>
26718
+ <string>${path11.join(o.logDir, "daemon.log")}</string>
26549
26719
  <key>StandardErrorPath</key>
26550
- <string>${path10.join(o.logDir, "daemon-error.log")}</string>
26720
+ <string>${path11.join(o.logDir, "daemon-error.log")}</string>
26551
26721
  </dict>
26552
26722
  </plist>
26553
26723
  `;
@@ -26567,16 +26737,16 @@ WantedBy=default.target
26567
26737
  `;
26568
26738
  }
26569
26739
  function launchdPlistPath() {
26570
- return path10.join(os6.homedir(), "Library", "LaunchAgents", `${LAUNCHD_LABEL}.plist`);
26740
+ return path11.join(os7.homedir(), "Library", "LaunchAgents", `${LAUNCHD_LABEL}.plist`);
26571
26741
  }
26572
26742
  function systemdUnitPath() {
26573
- const configHome = process.env.XDG_CONFIG_HOME ?? path10.join(os6.homedir(), ".config");
26574
- return path10.join(configHome, "systemd", "user", SYSTEMD_SERVICE);
26743
+ const configHome = process.env.XDG_CONFIG_HOME ?? path11.join(os7.homedir(), ".config");
26744
+ return path11.join(configHome, "systemd", "user", SYSTEMD_SERVICE);
26575
26745
  }
26576
26746
  function resolveBinPath() {
26577
- const __dirname3 = path10.dirname(fileURLToPath2(import.meta.url));
26578
- const repoRoot = path10.resolve(__dirname3, "..", "..", "..");
26579
- return path10.join(repoRoot, "apps", "cli", "dist", "bin.js");
26747
+ const __dirname3 = path11.dirname(fileURLToPath2(import.meta.url));
26748
+ const repoRoot = path11.resolve(__dirname3, "..", "..", "..");
26749
+ return path11.join(repoRoot, "apps", "cli", "dist", "bin.js");
26580
26750
  }
26581
26751
  async function installService(opts = {}, run = defaultRunner) {
26582
26752
  const platform = process.platform;
@@ -26587,7 +26757,7 @@ async function installService(opts = {}, run = defaultRunner) {
26587
26757
  const nodePath = process.execPath;
26588
26758
  const binPath = resolveBinPath();
26589
26759
  try {
26590
- await fs8.access(binPath);
26760
+ await fs9.access(binPath);
26591
26761
  } catch {
26592
26762
  console.error(
26593
26763
  `supbuddy service: compiled binary not found at ${binPath}
@@ -26596,13 +26766,13 @@ Run \`yarn workspace supbuddy build\` first.`
26596
26766
  return 1;
26597
26767
  }
26598
26768
  const stateDir = opts.stateDir ?? defaultStateDir();
26599
- const logDir = path10.join(stateDir, "logs");
26600
- await fs8.mkdir(logDir, { recursive: true });
26769
+ const logDir = path11.join(stateDir, "logs");
26770
+ await fs9.mkdir(logDir, { recursive: true });
26601
26771
  if (platform === "darwin") {
26602
26772
  const plistPath = launchdPlistPath();
26603
- await fs8.mkdir(path10.dirname(plistPath), { recursive: true });
26773
+ await fs9.mkdir(path11.dirname(plistPath), { recursive: true });
26604
26774
  const content2 = launchdPlist({ label: LAUNCHD_LABEL, nodePath, binPath, stateDir, logDir });
26605
- await fs8.writeFile(plistPath, content2, { encoding: "utf8", mode: 420 });
26775
+ await fs9.writeFile(plistPath, content2, { encoding: "utf8", mode: 420 });
26606
26776
  run("launchctl", ["unload", plistPath]);
26607
26777
  const load = run("launchctl", ["load", "-w", plistPath]);
26608
26778
  if (load.code !== 0) {
@@ -26613,9 +26783,9 @@ Run \`yarn workspace supbuddy build\` first.`
26613
26783
  return 0;
26614
26784
  }
26615
26785
  const unitPath = systemdUnitPath();
26616
- await fs8.mkdir(path10.dirname(unitPath), { recursive: true });
26786
+ await fs9.mkdir(path11.dirname(unitPath), { recursive: true });
26617
26787
  const content = systemdUnit({ label: LAUNCHD_LABEL, nodePath, binPath, stateDir, logDir });
26618
- await fs8.writeFile(unitPath, content, { encoding: "utf8", mode: 420 });
26788
+ await fs9.writeFile(unitPath, content, { encoding: "utf8", mode: 420 });
26619
26789
  const reload = run("systemctl", ["--user", "daemon-reload"]);
26620
26790
  if (reload.code !== 0) {
26621
26791
  console.error(`supbuddy service: systemctl daemon-reload failed (exit ${reload.code})`);
@@ -26639,7 +26809,7 @@ async function uninstallService(run = defaultRunner) {
26639
26809
  const plistPath = launchdPlistPath();
26640
26810
  let exists2 = false;
26641
26811
  try {
26642
- await fs8.access(plistPath);
26812
+ await fs9.access(plistPath);
26643
26813
  exists2 = true;
26644
26814
  } catch {
26645
26815
  }
@@ -26648,14 +26818,14 @@ async function uninstallService(run = defaultRunner) {
26648
26818
  return 0;
26649
26819
  }
26650
26820
  run("launchctl", ["unload", "-w", plistPath]);
26651
- await fs8.rm(plistPath, { force: true });
26821
+ await fs9.rm(plistPath, { force: true });
26652
26822
  console.log(`supbuddy service: uninstalled (removed ${plistPath})`);
26653
26823
  return 0;
26654
26824
  }
26655
26825
  const unitPath = systemdUnitPath();
26656
26826
  let exists = false;
26657
26827
  try {
26658
- await fs8.access(unitPath);
26828
+ await fs9.access(unitPath);
26659
26829
  exists = true;
26660
26830
  } catch {
26661
26831
  }
@@ -26664,7 +26834,7 @@ async function uninstallService(run = defaultRunner) {
26664
26834
  return 0;
26665
26835
  }
26666
26836
  run("systemctl", ["--user", "disable", "--now", SYSTEMD_SERVICE]);
26667
- await fs8.rm(unitPath, { force: true });
26837
+ await fs9.rm(unitPath, { force: true });
26668
26838
  run("systemctl", ["--user", "daemon-reload"]);
26669
26839
  console.log(`supbuddy service: uninstalled (removed ${unitPath})`);
26670
26840
  return 0;
@@ -26679,7 +26849,7 @@ async function serviceStatus(run = defaultRunner) {
26679
26849
  const plistPath = launchdPlistPath();
26680
26850
  let installed2 = false;
26681
26851
  try {
26682
- await fs8.access(plistPath);
26852
+ await fs9.access(plistPath);
26683
26853
  installed2 = true;
26684
26854
  } catch {
26685
26855
  }
@@ -26695,7 +26865,7 @@ async function serviceStatus(run = defaultRunner) {
26695
26865
  const unitPath = systemdUnitPath();
26696
26866
  let installed = false;
26697
26867
  try {
26698
- await fs8.access(unitPath);
26868
+ await fs9.access(unitPath);
26699
26869
  installed = true;
26700
26870
  } catch {
26701
26871
  }
@@ -26729,13 +26899,13 @@ init_state_dir();
26729
26899
  import { realpathSync } from "fs";
26730
26900
  import { spawnSync as spawnSync3 } from "child_process";
26731
26901
  import { fileURLToPath as fileURLToPath3 } from "url";
26732
- import path11 from "path";
26902
+ import path12 from "path";
26733
26903
 
26734
26904
  // src/commands.ts
26735
26905
  init_client();
26736
26906
  import { readFileSync } from "fs";
26737
26907
 
26738
- // ../../node_modules/chalk/source/vendor/ansi-styles/index.js
26908
+ // ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
26739
26909
  var ANSI_BACKGROUND_OFFSET = 10;
26740
26910
  var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
26741
26911
  var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
@@ -26921,35 +27091,35 @@ function assembleStyles() {
26921
27091
  var ansiStyles = assembleStyles();
26922
27092
  var ansi_styles_default = ansiStyles;
26923
27093
 
26924
- // ../../node_modules/chalk/source/vendor/supports-color/index.js
26925
- import process2 from "process";
26926
- import os3 from "os";
26927
- import tty from "tty";
26928
- function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
27094
+ // ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
27095
+ import process3 from "process";
27096
+ import os4 from "os";
27097
+ import tty2 from "tty";
27098
+ function hasFlag2(flag, argv = globalThis.Deno ? globalThis.Deno.args : process3.argv) {
26929
27099
  const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
26930
27100
  const position = argv.indexOf(prefix + flag);
26931
27101
  const terminatorPosition = argv.indexOf("--");
26932
27102
  return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
26933
27103
  }
26934
- var { env } = process2;
26935
- var flagForceColor;
26936
- if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
26937
- flagForceColor = 0;
26938
- } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
26939
- flagForceColor = 1;
27104
+ var { env: env2 } = process3;
27105
+ var flagForceColor2;
27106
+ if (hasFlag2("no-color") || hasFlag2("no-colors") || hasFlag2("color=false") || hasFlag2("color=never")) {
27107
+ flagForceColor2 = 0;
27108
+ } else if (hasFlag2("color") || hasFlag2("colors") || hasFlag2("color=true") || hasFlag2("color=always")) {
27109
+ flagForceColor2 = 1;
26940
27110
  }
26941
- function envForceColor() {
26942
- if ("FORCE_COLOR" in env) {
26943
- if (env.FORCE_COLOR === "true") {
27111
+ function envForceColor2() {
27112
+ if ("FORCE_COLOR" in env2) {
27113
+ if (env2.FORCE_COLOR === "true") {
26944
27114
  return 1;
26945
27115
  }
26946
- if (env.FORCE_COLOR === "false") {
27116
+ if (env2.FORCE_COLOR === "false") {
26947
27117
  return 0;
26948
27118
  }
26949
- return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
27119
+ return env2.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env2.FORCE_COLOR, 10), 3);
26950
27120
  }
26951
27121
  }
26952
- function translateLevel(level) {
27122
+ function translateLevel2(level) {
26953
27123
  if (level === 0) {
26954
27124
  return false;
26955
27125
  }
@@ -26960,67 +27130,67 @@ function translateLevel(level) {
26960
27130
  has16m: level >= 3
26961
27131
  };
26962
27132
  }
26963
- function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
26964
- const noFlagForceColor = envForceColor();
27133
+ function _supportsColor2(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
27134
+ const noFlagForceColor = envForceColor2();
26965
27135
  if (noFlagForceColor !== void 0) {
26966
- flagForceColor = noFlagForceColor;
27136
+ flagForceColor2 = noFlagForceColor;
26967
27137
  }
26968
- const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
27138
+ const forceColor = sniffFlags ? flagForceColor2 : noFlagForceColor;
26969
27139
  if (forceColor === 0) {
26970
27140
  return 0;
26971
27141
  }
26972
27142
  if (sniffFlags) {
26973
- if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
27143
+ if (hasFlag2("color=16m") || hasFlag2("color=full") || hasFlag2("color=truecolor")) {
26974
27144
  return 3;
26975
27145
  }
26976
- if (hasFlag("color=256")) {
27146
+ if (hasFlag2("color=256")) {
26977
27147
  return 2;
26978
27148
  }
26979
27149
  }
26980
- if ("TF_BUILD" in env && "AGENT_NAME" in env) {
27150
+ if ("TF_BUILD" in env2 && "AGENT_NAME" in env2) {
26981
27151
  return 1;
26982
27152
  }
26983
27153
  if (haveStream && !streamIsTTY && forceColor === void 0) {
26984
27154
  return 0;
26985
27155
  }
26986
27156
  const min = forceColor || 0;
26987
- if (env.TERM === "dumb") {
27157
+ if (env2.TERM === "dumb") {
26988
27158
  return min;
26989
27159
  }
26990
- if (process2.platform === "win32") {
26991
- const osRelease = os3.release().split(".");
27160
+ if (process3.platform === "win32") {
27161
+ const osRelease = os4.release().split(".");
26992
27162
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
26993
27163
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
26994
27164
  }
26995
27165
  return 1;
26996
27166
  }
26997
- if ("CI" in env) {
26998
- if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
27167
+ if ("CI" in env2) {
27168
+ if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env2)) {
26999
27169
  return 3;
27000
27170
  }
27001
- if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
27171
+ if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env2) || env2.CI_NAME === "codeship") {
27002
27172
  return 1;
27003
27173
  }
27004
27174
  return min;
27005
27175
  }
27006
- if ("TEAMCITY_VERSION" in env) {
27007
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
27176
+ if ("TEAMCITY_VERSION" in env2) {
27177
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env2.TEAMCITY_VERSION) ? 1 : 0;
27008
27178
  }
27009
- if (env.COLORTERM === "truecolor") {
27179
+ if (env2.COLORTERM === "truecolor") {
27010
27180
  return 3;
27011
27181
  }
27012
- if (env.TERM === "xterm-kitty") {
27182
+ if (env2.TERM === "xterm-kitty") {
27013
27183
  return 3;
27014
27184
  }
27015
- if (env.TERM === "xterm-ghostty") {
27185
+ if (env2.TERM === "xterm-ghostty") {
27016
27186
  return 3;
27017
27187
  }
27018
- if (env.TERM === "wezterm") {
27188
+ if (env2.TERM === "wezterm") {
27019
27189
  return 3;
27020
27190
  }
27021
- if ("TERM_PROGRAM" in env) {
27022
- const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
27023
- switch (env.TERM_PROGRAM) {
27191
+ if ("TERM_PROGRAM" in env2) {
27192
+ const version = Number.parseInt((env2.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
27193
+ switch (env2.TERM_PROGRAM) {
27024
27194
  case "iTerm.app": {
27025
27195
  return version >= 3 ? 3 : 2;
27026
27196
  }
@@ -27029,31 +27199,31 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
27029
27199
  }
27030
27200
  }
27031
27201
  }
27032
- if (/-256(color)?$/i.test(env.TERM)) {
27202
+ if (/-256(color)?$/i.test(env2.TERM)) {
27033
27203
  return 2;
27034
27204
  }
27035
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
27205
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env2.TERM)) {
27036
27206
  return 1;
27037
27207
  }
27038
- if ("COLORTERM" in env) {
27208
+ if ("COLORTERM" in env2) {
27039
27209
  return 1;
27040
27210
  }
27041
27211
  return min;
27042
27212
  }
27043
- function createSupportsColor(stream, options = {}) {
27044
- const level = _supportsColor(stream, {
27213
+ function createSupportsColor2(stream, options = {}) {
27214
+ const level = _supportsColor2(stream, {
27045
27215
  streamIsTTY: stream && stream.isTTY,
27046
27216
  ...options
27047
27217
  });
27048
- return translateLevel(level);
27218
+ return translateLevel2(level);
27049
27219
  }
27050
- var supportsColor = {
27051
- stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
27052
- stderr: createSupportsColor({ isTTY: tty.isatty(2) })
27220
+ var supportsColor2 = {
27221
+ stdout: createSupportsColor2({ isTTY: tty2.isatty(1) }),
27222
+ stderr: createSupportsColor2({ isTTY: tty2.isatty(2) })
27053
27223
  };
27054
- var supports_color_default = supportsColor;
27224
+ var supports_color_default2 = supportsColor2;
27055
27225
 
27056
- // ../../node_modules/chalk/source/utilities.js
27226
+ // ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/utilities.js
27057
27227
  function stringReplaceAll(string, substring, replacer) {
27058
27228
  let index = string.indexOf(substring);
27059
27229
  if (index === -1) {
@@ -27083,8 +27253,8 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
27083
27253
  return returnValue;
27084
27254
  }
27085
27255
 
27086
- // ../../node_modules/chalk/source/index.js
27087
- var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
27256
+ // ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/index.js
27257
+ var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default2;
27088
27258
  var GENERATOR = /* @__PURE__ */ Symbol("GENERATOR");
27089
27259
  var STYLER = /* @__PURE__ */ Symbol("STYLER");
27090
27260
  var IS_EMPTY = /* @__PURE__ */ Symbol("IS_EMPTY");
@@ -27349,7 +27519,8 @@ function formatConciseList(data) {
27349
27519
  const titleKey = ["name", "domain", "label", "id"].find((k) => row[k] != null);
27350
27520
  const title = titleKey ? String(row[titleKey]) : "(item)";
27351
27521
  const sub = titleKey === "name" && row.domain ? String(row.domain) : "";
27352
- return `${statusGlyph(row)} ${source_default.bold(title)}` + (sub ? ` ${source_default.dim(sub)}` : "");
27522
+ const cloud = row.cloud && typeof row.cloud === "object" ? ` ${source_default.cyan("\u2601")}` : "";
27523
+ return `${statusGlyph(row)} ${source_default.bold(title)}${cloud}` + (sub ? ` ${source_default.dim(sub)}` : "");
27353
27524
  }).join("\n");
27354
27525
  }
27355
27526
  function formatSupabaseStatus(status, project) {
@@ -27440,8 +27611,9 @@ function formatRichList(data) {
27440
27611
  const titleKey = ["name", "domain", "label", "id"].find((k) => o[k] != null);
27441
27612
  const title = titleKey ? String(o[titleKey]) : "(item)";
27442
27613
  const sub = titleKey === "name" && o.domain ? String(o.domain) : "";
27443
- const head = `${statusGlyph(o)} ${source_default.bold(title)}` + (sub ? ` ${source_default.dim(sub)}` : "");
27444
- const facts = richFacts(o, /* @__PURE__ */ new Set([titleKey ?? "", sub ? "domain" : ""]));
27614
+ const cloud = o.cloud && typeof o.cloud === "object" ? ` ${source_default.cyan("\u2601")}` : "";
27615
+ const head = `${statusGlyph(o)} ${source_default.bold(title)}${cloud}` + (sub ? ` ${source_default.dim(sub)}` : "");
27616
+ const facts = richFacts(o, /* @__PURE__ */ new Set([titleKey ?? "", sub ? "domain" : "", "cloud"]));
27445
27617
  return facts.length ? `${head}
27446
27618
  ${source_default.dim(facts.join(" \xB7 "))}` : head;
27447
27619
  }).join("\n");
@@ -27561,6 +27733,8 @@ function defaultTimeoutFor(mod, sub) {
27561
27733
  // Use ACTUAL subcommand names: the arg is `restore` (not `restore-backup`),
27562
27734
  // and `backups`/`restore` can be slow. `config` covers `config apply|validate`.
27563
27735
  supabase: ["start", "stop", "restart", "init", "restore", "backups", "force-recreate", "restart-container", "config"],
27736
+ cloud: ["push", "teardown"],
27737
+ // push dumps+uploads+provisions; teardown destroys a Fly graph — both slow
27564
27738
  compose: ["up", "down", "restart"],
27565
27739
  migrate: ["start", "finish"],
27566
27740
  isolation: ["switch"],
@@ -27687,11 +27861,12 @@ async function runCommand(argv, flags, clientFactory) {
27687
27861
  if (sub === "add") {
27688
27862
  const rootPath = rest[0] ?? (typeof flags.path === "string" ? flags.path : void 0);
27689
27863
  if (!rootPath) {
27690
- console.error("usage: supbuddy project add <path> [--label=<l>]");
27864
+ console.error("usage: supbuddy project add <path> [--label=<l>] [--tld=<tld>]");
27691
27865
  return 1;
27692
27866
  }
27693
27867
  const args = { root_path: rootPath };
27694
27868
  if (typeof flags.label === "string") args.label = flags.label;
27869
+ if (typeof flags.tld === "string" && flags.tld) args.tld = flags.tld;
27695
27870
  print(await client.call("register_project", args), flags);
27696
27871
  return 0;
27697
27872
  }
@@ -27713,13 +27888,14 @@ async function runCommand(argv, flags, clientFactory) {
27713
27888
  }
27714
27889
  if (sub === "set") {
27715
27890
  if (!rest[0]) {
27716
- console.error("usage: supbuddy project set <id|name> [--name|--domain|--enable|--disable]");
27891
+ console.error("usage: supbuddy project set <id|name> [--name=<n>|--domain=<d>|--tld=<t>|--enable|--disable] (--tld= clears the per-project TLD override)");
27717
27892
  return 1;
27718
27893
  }
27719
27894
  const id = await refToId(client, rest[0]);
27720
27895
  const patch = {};
27721
27896
  if (typeof flags.name === "string") patch.name = flags.name;
27722
27897
  if (typeof flags.domain === "string") patch.domain = flags.domain;
27898
+ if (typeof flags.tld === "string") patch.tld = flags.tld;
27723
27899
  if (flags.enable) patch.enabled = true;
27724
27900
  if (flags.disable) patch.enabled = false;
27725
27901
  print(await client.call("update_project", { id, patch }), flags);
@@ -27769,12 +27945,12 @@ async function runCommand(argv, flags, clientFactory) {
27769
27945
  return 0;
27770
27946
  }
27771
27947
  if (sub === "env-read") {
27772
- const path12 = rest[0];
27773
- if (!path12) {
27948
+ const path13 = rest[0];
27949
+ if (!path13) {
27774
27950
  console.error("usage: supbuddy project env-read <path> [--key K]");
27775
27951
  return 1;
27776
27952
  }
27777
- const args = { path: path12 };
27953
+ const args = { path: path13 };
27778
27954
  if (typeof flags.key === "string") args.key = flags.key;
27779
27955
  print(await client.call("read_env_file", args), flags);
27780
27956
  return 0;
@@ -27807,6 +27983,42 @@ async function runCommand(argv, flags, clientFactory) {
27807
27983
  console.error("usage: supbuddy project ls|add|get|scan|set|enable|disable|rm|restore|env|env-read|set-supabase-path|refresh-context");
27808
27984
  return 1;
27809
27985
  }
27986
+ case "cloud": {
27987
+ if (sub === "login") {
27988
+ const [email, argPassword] = rest;
27989
+ const password = argPassword ?? process.env.SUPBUDDY_CLOUD_PASSWORD;
27990
+ if (!email || !password) {
27991
+ console.error("usage: supbuddy cloud login <email> [<password>] (or set SUPBUDDY_CLOUD_PASSWORD to keep it out of argv/history)");
27992
+ return 1;
27993
+ }
27994
+ print(await client.call("cloud_sign_in", { email, password }), flags);
27995
+ return 0;
27996
+ }
27997
+ if (sub === "status") {
27998
+ if (rest[0]) {
27999
+ const projects = await client.call("list_projects", {});
28000
+ print(await client.call("get_cloud_status", { project_id: resolveProjectId(projects, rest[0]) }), flags);
28001
+ } else {
28002
+ print(await client.call("get_cloud_status", {}), flags);
28003
+ }
28004
+ return 0;
28005
+ }
28006
+ if (sub === "push" && rest[0]) {
28007
+ const projects = await client.call("list_projects", {});
28008
+ const args = { project_id: resolveProjectId(projects, rest[0]) };
28009
+ if (typeof flags.repo === "string") args.github_repo = flags.repo;
28010
+ if (flags.force) args.force = true;
28011
+ print(await client.call("push_to_cloud", args), flags);
28012
+ return 0;
28013
+ }
28014
+ if (sub === "teardown" && rest[0]) {
28015
+ const projects = await client.call("list_projects", {});
28016
+ print(await client.call("cloud_teardown", { project_id: resolveProjectId(projects, rest[0]) }), flags);
28017
+ return 0;
28018
+ }
28019
+ console.error("usage: supbuddy cloud <login <email> [<pw>] | status [project] | push <project> [--repo=owner/repo] [--force] | teardown <project>>");
28020
+ return 1;
28021
+ }
27810
28022
  case "supabase": {
27811
28023
  if ((sub === "start" || sub === "stop") && rest[0]) {
27812
28024
  const projects = await client.call("list_projects", {});
@@ -28022,8 +28234,8 @@ async function runCommand(argv, flags, clientFactory) {
28022
28234
  return 0;
28023
28235
  }
28024
28236
  if (sub === "write") {
28025
- const [path12, ...pairs] = rest;
28026
- if (!path12 || pairs.length === 0) {
28237
+ const [path13, ...pairs] = rest;
28238
+ if (!path13 || pairs.length === 0) {
28027
28239
  console.error("usage: supbuddy env write <path> <key=val>...");
28028
28240
  return 1;
28029
28241
  }
@@ -28038,7 +28250,7 @@ async function runCommand(argv, flags, clientFactory) {
28038
28250
  const v = pair.slice(eqIdx + 1);
28039
28251
  patch[k] = v === "" ? null : v;
28040
28252
  }
28041
- print(await client.call("write_env_file", { path: path12, patch }), flags);
28253
+ print(await client.call("write_env_file", { path: path13, patch }), flags);
28042
28254
  return 0;
28043
28255
  }
28044
28256
  console.error("usage: supbuddy env copy|write ...");
@@ -28436,10 +28648,10 @@ Usage:
28436
28648
 
28437
28649
  supbuddy project ls List registered projects.
28438
28650
  supbuddy projects Alias for 'project ls' (rich list).
28439
- supbuddy project add <path> [--label=<l>] Register a project.
28651
+ supbuddy project add <path> [--label=<l>] [--tld=<t>] Register a project (--tld for a per-project TLD).
28440
28652
  supbuddy project get <id> Get project details.
28441
28653
  supbuddy project scan <path> Scan project for services.
28442
- supbuddy project set <id> [--name|--domain|--enable|--disable] Update a project.
28654
+ supbuddy project set <id> [--name|--domain|--tld|--enable|--disable] Update a project (--tld= clears the override).
28443
28655
  supbuddy project enable|disable <id> Enable/disable a project.
28444
28656
  supbuddy project rm <id> Delete a project.
28445
28657
  supbuddy project restore <id> Restore from trash.
@@ -28453,6 +28665,11 @@ Usage:
28453
28665
  supbuddy supabase config apply <proj> <file> Apply supabase config from a TOML file.
28454
28666
  supbuddy supabase config validate <proj> Validate the project's supabase config.
28455
28667
 
28668
+ supbuddy cloud login <email> [<password>] Sign in to Supbuddy Cloud (or set SUPBUDDY_CLOUD_PASSWORD).
28669
+ supbuddy cloud push <proj> [--repo=owner/repo] Push a project to Supbuddy Cloud (with its Supabase data).
28670
+ supbuddy cloud status [<proj>] Cloud sign-in state, or a project's cloud stack status.
28671
+ supbuddy cloud teardown <proj> Tear down a project's cloud stack + unlink it.
28672
+
28456
28673
  supbuddy compose up|down|restart <proj> [svcs...] Compose lifecycle.
28457
28674
  supbuddy compose status <project> Compose service status.
28458
28675
  supbuddy compose logs <proj> <service> [-f|--follow] Tail service logs.
@@ -28535,20 +28752,20 @@ Global flags:
28535
28752
 
28536
28753
  See docs/MULTIMODE_DELIVERY_ASSESSMENT.md for the full roadmap.`;
28537
28754
  async function runShell(opts, stateDir, module) {
28538
- const os7 = await import("os");
28539
- const fs9 = await import("fs");
28755
+ const os8 = await import("os");
28756
+ const fs10 = await import("fs");
28540
28757
  const shellEntry = fileURLToPath3(new URL("../../tui/src/shell/bin.tsx", import.meta.url));
28541
- const REPO_ROOT2 = path11.resolve(fileURLToPath3(import.meta.url), "..", "..", "..", "..");
28542
- const tsxBin = path11.join(REPO_ROOT2, "node_modules", ".bin", "tsx");
28543
- const resultFile = path11.join(os7.tmpdir(), `supbuddy-shell-${process.pid}-${Date.now()}.json`);
28544
- const env2 = { ...process.env, SUPBUDDY_SHELL_RESULT: resultFile };
28545
- if (stateDir) env2.SUPBUDDY_STATE_DIR = stateDir;
28546
- if (module) env2.SUPBUDDY_SHELL_MODULE = module;
28547
- spawnSync3(tsxBin, [shellEntry], { stdio: "inherit", env: env2 });
28758
+ const REPO_ROOT2 = path12.resolve(fileURLToPath3(import.meta.url), "..", "..", "..", "..");
28759
+ const tsxBin = path12.join(REPO_ROOT2, "node_modules", ".bin", "tsx");
28760
+ const resultFile = path12.join(os8.tmpdir(), `supbuddy-shell-${process.pid}-${Date.now()}.json`);
28761
+ const env3 = { ...process.env, SUPBUDDY_SHELL_RESULT: resultFile };
28762
+ if (stateDir) env3.SUPBUDDY_STATE_DIR = stateDir;
28763
+ if (module) env3.SUPBUDDY_SHELL_MODULE = module;
28764
+ spawnSync3(tsxBin, [shellEntry], { stdio: "inherit", env: env3 });
28548
28765
  let chosen = null;
28549
28766
  try {
28550
- chosen = JSON.parse(fs9.readFileSync(resultFile, "utf8"));
28551
- fs9.unlinkSync(resultFile);
28767
+ chosen = JSON.parse(fs10.readFileSync(resultFile, "utf8"));
28768
+ fs10.unlinkSync(resultFile);
28552
28769
  } catch {
28553
28770
  chosen = null;
28554
28771
  }
@@ -28637,18 +28854,18 @@ async function dispatch(argv, opts) {
28637
28854
  case "tui":
28638
28855
  case "dash": {
28639
28856
  const tuiEntry = fileURLToPath3(new URL("../../tui/src/bin.tsx", import.meta.url));
28640
- const REPO_ROOT2 = path11.resolve(fileURLToPath3(import.meta.url), "..", "..", "..", "..");
28641
- const tsxBin = path11.join(REPO_ROOT2, "node_modules", ".bin", "tsx");
28642
- const env2 = { ...process.env };
28643
- if (typeof flags["state-dir"] === "string") env2.SUPBUDDY_STATE_DIR = flags["state-dir"];
28644
- if (typeof flags["url"] === "string") env2.SUPBUDDY_DAEMON_URL = flags["url"];
28645
- if (typeof flags["token"] === "string") env2.SUPBUDDY_BOOT_TOKEN = flags["token"];
28857
+ const REPO_ROOT2 = path12.resolve(fileURLToPath3(import.meta.url), "..", "..", "..", "..");
28858
+ const tsxBin = path12.join(REPO_ROOT2, "node_modules", ".bin", "tsx");
28859
+ const env3 = { ...process.env };
28860
+ if (typeof flags["state-dir"] === "string") env3.SUPBUDDY_STATE_DIR = flags["state-dir"];
28861
+ if (typeof flags["url"] === "string") env3.SUPBUDDY_DAEMON_URL = flags["url"];
28862
+ if (typeof flags["token"] === "string") env3.SUPBUDDY_BOOT_TOKEN = flags["token"];
28646
28863
  if (opts?.spawner) {
28647
- const result2 = await opts.spawner(tsxBin, [tuiEntry], { stdio: "inherit", env: env2 });
28864
+ const result2 = await opts.spawner(tsxBin, [tuiEntry], { stdio: "inherit", env: env3 });
28648
28865
  const ec = result2?.exitCode;
28649
28866
  return typeof ec === "number" ? ec : ec instanceof Promise ? await ec : 0;
28650
28867
  }
28651
- const result = spawnSync3(tsxBin, [tuiEntry], { stdio: "inherit", env: env2 });
28868
+ const result = spawnSync3(tsxBin, [tuiEntry], { stdio: "inherit", env: env3 });
28652
28869
  return result.status ?? 0;
28653
28870
  }
28654
28871
  case "shell":