tingly-box 1.261002.1 → 1.261006.2

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/bin.js CHANGED
@@ -13755,7 +13755,7 @@ var require_snapshot_recorder = __commonJS({
13755
13755
  "../node_modules/undici/lib/mock/snapshot-recorder.js"(exports2, module2) {
13756
13756
  "use strict";
13757
13757
  var { writeFile, readFile, mkdir } = __require("node:fs/promises");
13758
- var { dirname: dirname4, resolve } = __require("node:path");
13758
+ var { dirname: dirname5, resolve } = __require("node:path");
13759
13759
  var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("node:timers");
13760
13760
  var { InvalidArgumentError, UndiciError } = require_errors();
13761
13761
  var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
@@ -13986,7 +13986,7 @@ var require_snapshot_recorder = __commonJS({
13986
13986
  throw new InvalidArgumentError("Snapshot path is required");
13987
13987
  }
13988
13988
  const resolvedPath = resolve(path);
13989
- await mkdir(dirname4(resolvedPath), { recursive: true });
13989
+ await mkdir(dirname5(resolvedPath), { recursive: true });
13990
13990
  const data = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
13991
13991
  hash,
13992
13992
  snapshot
@@ -26376,7 +26376,7 @@ var require_BufferList = __commonJS({
26376
26376
  this.head = this.tail = null;
26377
26377
  this.length = 0;
26378
26378
  };
26379
- BufferList.prototype.join = function join6(s) {
26379
+ BufferList.prototype.join = function join7(s) {
26380
26380
  if (this.length === 0) return "";
26381
26381
  var p = this.head;
26382
26382
  var ret2 = "" + p.data;
@@ -28671,14 +28671,14 @@ var require_graceful_fs = __commonJS({
28671
28671
  return close;
28672
28672
  })(fs.close);
28673
28673
  fs.closeSync = (function(fs$closeSync) {
28674
- function closeSync(fd) {
28674
+ function closeSync2(fd) {
28675
28675
  fs$closeSync.apply(fs, arguments);
28676
28676
  resetQueue();
28677
28677
  }
28678
- Object.defineProperty(closeSync, previousSymbol, {
28678
+ Object.defineProperty(closeSync2, previousSymbol, {
28679
28679
  value: fs$closeSync
28680
28680
  });
28681
- return closeSync;
28681
+ return closeSync2;
28682
28682
  })(fs.closeSync);
28683
28683
  if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
28684
28684
  process.on("exit", function() {
@@ -28700,7 +28700,7 @@ var require_graceful_fs = __commonJS({
28700
28700
  polyfills(fs2);
28701
28701
  fs2.gracefulify = patch;
28702
28702
  fs2.createReadStream = createReadStream;
28703
- fs2.createWriteStream = createWriteStream2;
28703
+ fs2.createWriteStream = createWriteStream;
28704
28704
  var fs$readFile = fs2.readFile;
28705
28705
  fs2.readFile = readFile;
28706
28706
  function readFile(path, options, cb) {
@@ -28912,7 +28912,7 @@ var require_graceful_fs = __commonJS({
28912
28912
  function createReadStream(path, options) {
28913
28913
  return new fs2.ReadStream(path, options);
28914
28914
  }
28915
- function createWriteStream2(path, options) {
28915
+ function createWriteStream(path, options) {
28916
28916
  return new fs2.WriteStream(path, options);
28917
28917
  }
28918
28918
  var fs$open = fs2.open;
@@ -30047,7 +30047,7 @@ var require_jsonfile = __commonJS({
30047
30047
  return obj2;
30048
30048
  }
30049
30049
  var readFile = universalify.fromPromise(_readFile);
30050
- function readFileSync2(file, options = {}) {
30050
+ function readFileSync4(file, options = {}) {
30051
30051
  if (typeof options === "string") {
30052
30052
  options = { encoding: options };
30053
30053
  }
@@ -30072,16 +30072,16 @@ var require_jsonfile = __commonJS({
30072
30072
  await universalify.fromCallback(fs.writeFile)(file, str, options);
30073
30073
  }
30074
30074
  var writeFile = universalify.fromPromise(_writeFile);
30075
- function writeFileSync(file, obj2, options = {}) {
30075
+ function writeFileSync2(file, obj2, options = {}) {
30076
30076
  const fs = options.fs || _fs;
30077
30077
  const str = stringify(obj2, options);
30078
30078
  return fs.writeFileSync(file, str, options);
30079
30079
  }
30080
30080
  module2.exports = {
30081
30081
  readFile,
30082
- readFileSync: readFileSync2,
30082
+ readFileSync: readFileSync4,
30083
30083
  writeFile,
30084
- writeFileSync
30084
+ writeFileSync: writeFileSync2
30085
30085
  };
30086
30086
  }
30087
30087
  });
@@ -33863,15 +33863,15 @@ var require_generators = __commonJS({
33863
33863
  var stack = new Error().stack;
33864
33864
  return function() {
33865
33865
  var generator = generatorFunction.apply(this, arguments);
33866
- var spawn = new PromiseSpawn$(
33866
+ var spawn2 = new PromiseSpawn$(
33867
33867
  void 0,
33868
33868
  void 0,
33869
33869
  yieldHandler,
33870
33870
  stack
33871
33871
  );
33872
- var ret2 = spawn.promise();
33873
- spawn._generator = generator;
33874
- spawn._promiseFulfilled(void 0);
33872
+ var ret2 = spawn2.promise();
33873
+ spawn2._generator = generator;
33874
+ spawn2._promiseFulfilled(void 0);
33875
33875
  return ret2;
33876
33876
  };
33877
33877
  };
@@ -33886,9 +33886,9 @@ var require_generators = __commonJS({
33886
33886
  if (typeof generatorFunction !== "function") {
33887
33887
  return apiRejection("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");
33888
33888
  }
33889
- var spawn = new PromiseSpawn(generatorFunction, this);
33890
- var ret2 = spawn.promise();
33891
- spawn._run(Promise2.spawn);
33889
+ var spawn2 = new PromiseSpawn(generatorFunction, this);
33890
+ var ret2 = spawn2.promise();
33891
+ spawn2._run(Promise2.spawn);
33892
33892
  return ret2;
33893
33893
  };
33894
33894
  };
@@ -36338,10 +36338,10 @@ var require_unzip2 = __commonJS({
36338
36338
  });
36339
36339
 
36340
36340
  // bin.js
36341
- import { existsSync as existsSync3, mkdirSync as mkdirSync2 } from "fs";
36341
+ import { existsSync as existsSync4, mkdirSync as mkdirSync3 } from "fs";
36342
36342
  import { createRequire as createRequire2 } from "module";
36343
- import { dirname as dirname3, join as join5 } from "path";
36344
- import { fileURLToPath } from "url";
36343
+ import { dirname as dirname4, join as join6 } from "path";
36344
+ import { fileURLToPath as fileURLToPath2 } from "url";
36345
36345
 
36346
36346
  // ../shared/cachedir.js
36347
36347
  import { join } from "path";
@@ -36399,7 +36399,7 @@ function cleanupStaleBinaryCaches(cacheRoot, keepTag) {
36399
36399
  // ../shared/download.js
36400
36400
  var import_undici = __toESM(require_undici(), 1);
36401
36401
  var import_unzipper = __toESM(require_unzip2(), 1);
36402
- import { chmodSync, createWriteStream, existsSync, mkdirSync, readFileSync, statSync as statSync2 } from "fs";
36402
+ import { chmodSync, existsSync, mkdirSync, readFileSync, statSync as statSync2, writeFileSync } from "fs";
36403
36403
  import { join as join3 } from "path";
36404
36404
  import { Readable } from "stream";
36405
36405
  var httpProxy = process.env.HTTP_PROXY || process.env.http_proxy;
@@ -36504,16 +36504,7 @@ async function extractZipBuffer(zipBuffer, extractDir) {
36504
36504
  continue;
36505
36505
  }
36506
36506
  const content = await file.buffer();
36507
- const fileStream = createWriteStream(filePath);
36508
- await new Promise((resolve, reject) => {
36509
- fileStream.write(content, (err) => {
36510
- if (err) reject(err);
36511
- else {
36512
- fileStream.end();
36513
- resolve();
36514
- }
36515
- });
36516
- });
36507
+ writeFileSync(filePath, content);
36517
36508
  if (process.platform !== "win32") {
36518
36509
  const permissions = file.unixPermissions && file.unixPermissions > 0 ? file.unixPermissions : 493;
36519
36510
  chmodSync(filePath, permissions);
@@ -36610,6 +36601,49 @@ function execBinary(binaryPath, args, { retryCmd, cacheRoot } = {}) {
36610
36601
  }
36611
36602
  }
36612
36603
 
36604
+ // ../shared/gui.js
36605
+ import { execFileSync as execFileSync3, spawn, spawnSync } from "child_process";
36606
+ import { chmodSync as chmodSync2, closeSync, existsSync as existsSync3, mkdirSync as mkdirSync2, openSync, readFileSync as readFileSync3, rmSync as rmSync2 } from "fs";
36607
+ import { dirname as dirname3, join as join5 } from "path";
36608
+ import { fileURLToPath, pathToFileURL } from "url";
36609
+
36610
+ // ../shared/linuxgui.js
36611
+ import { execFileSync as execFileSync2 } from "child_process";
36612
+ import { readFileSync as readFileSync2 } from "fs";
36613
+ var REQUIRED_LIBS = ["libgtk-3.so.0", "libwebkit2gtk-4.1.so.0"];
36614
+ function missingLibs(ldconfigOutput) {
36615
+ return REQUIRED_LIBS.filter((lib) => !ldconfigOutput.split("\n").some((l) => l.trim().startsWith(`${lib} `)));
36616
+ }
36617
+ function checkLibs() {
36618
+ for (const bin of ["ldconfig", "/sbin/ldconfig", "/usr/sbin/ldconfig"]) {
36619
+ try {
36620
+ return missingLibs(execFileSync2(bin, ["-p"], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }));
36621
+ } catch {
36622
+ }
36623
+ }
36624
+ return null;
36625
+ }
36626
+ function installHint(osRelease) {
36627
+ const field = (k) => (osRelease.match(new RegExp(`^${k}=("?)(.*)\\1$`, "m")) || [])[2] || "";
36628
+ const ids = `${field("ID")} ${field("ID_LIKE")}`.toLowerCase().split(/\s+/);
36629
+ const has = (...names) => names.some((n) => ids.includes(n));
36630
+ if (has("debian", "ubuntu")) return "sudo apt install libgtk-3-0 libwebkit2gtk-4.1-0";
36631
+ if (has("fedora", "rhel", "centos")) return "sudo dnf install gtk3 webkit2gtk4.1";
36632
+ if (has("arch")) return "sudo pacman -S gtk3 webkit2gtk-4.1";
36633
+ if (has("suse", "opensuse")) return "sudo zypper install libgtk-3-0 libwebkit2gtk-4_1-0";
36634
+ return null;
36635
+ }
36636
+ function readInstallHint() {
36637
+ try {
36638
+ return installHint(readFileSync2("/etc/os-release", "utf8"));
36639
+ } catch {
36640
+ return null;
36641
+ }
36642
+ }
36643
+ function hasDisplay(env2 = process.env) {
36644
+ return Boolean(env2.DISPLAY || env2.WAYLAND_DISPLAY);
36645
+ }
36646
+
36613
36647
  // ../shared/platform.js
36614
36648
  import { createRequire } from "module";
36615
36649
  import { existsSync as existsSync2 } from "fs";
@@ -36621,12 +36655,21 @@ var PLATFORM_PACKAGES = {
36621
36655
  "darwin-arm64": { name: "@tingly-dev/tingly-box-darwin-arm64", zip: "tingly-box-macos-arm64.zip" },
36622
36656
  "win32-x64": { name: "@tingly-dev/tingly-box-win32-x64", zip: "tingly-box-windows-amd64.zip" }
36623
36657
  };
36658
+ var GUI_PLATFORM_PACKAGES = {
36659
+ "linux-x64": { name: "@tingly-dev/tingly-box-gui-linux-x64", zip: "tingly-box-gui-linux-amd64.zip" },
36660
+ "linux-arm64": { name: "@tingly-dev/tingly-box-gui-linux-arm64", zip: "tingly-box-gui-linux-arm64.zip" },
36661
+ "darwin-arm64": { name: "@tingly-dev/tingly-box-gui-darwin-arm64", zip: "tingly-box-gui-macos-arm64.zip" },
36662
+ "win32-x64": { name: "@tingly-dev/tingly-box-gui-win32-x64", zip: "tingly-box-gui-windows-amd64.zip" }
36663
+ };
36664
+ function guiPlatformPackage() {
36665
+ return GUI_PLATFORM_PACKAGES[`${process.platform}-${process.arch}`] || null;
36666
+ }
36624
36667
  function platformPackageName() {
36625
36668
  const entry = PLATFORM_PACKAGES[`${process.platform}-${process.arch}`];
36626
36669
  return entry ? entry.name : null;
36627
36670
  }
36628
- function findPlatformPackage(fromUrl) {
36629
- const entry = PLATFORM_PACKAGES[`${process.platform}-${process.arch}`];
36671
+ function findPlatformPackage(fromUrl, packages = PLATFORM_PACKAGES) {
36672
+ const entry = packages[`${process.platform}-${process.arch}`];
36630
36673
  if (!entry) return null;
36631
36674
  try {
36632
36675
  const resolver = createRequire(fromUrl);
@@ -36640,6 +36683,301 @@ function findPlatformPackage(fromUrl) {
36640
36683
  }
36641
36684
  }
36642
36685
 
36686
+ // ../shared/gui.js
36687
+ var BASE_URL = "https://github.com/tingly-dev/tingly-box/releases/download";
36688
+ function resolveSource(ctx) {
36689
+ if (ctx.version !== "latest") return { kind: "download", tag: ctx.version };
36690
+ const local = findPlatformPackage(ctx.shimUrl, GUI_PLATFORM_PACKAGES);
36691
+ if (local && local.version === ctx.ownVersion) {
36692
+ return { kind: "package", tag: `v${local.version}`, local };
36693
+ }
36694
+ if (ctx.fromRegistry) {
36695
+ return { kind: "registry", tag: `v${ctx.ownVersion}` };
36696
+ }
36697
+ if (local) {
36698
+ console.warn(`\u26A0\uFE0F ${local.name}@${local.version} does not match tingly-box-gui@${ctx.ownVersion}, downloading the release instead`);
36699
+ }
36700
+ return { kind: "download", tag: ctx.releaseTag };
36701
+ }
36702
+ function installFromRegistry(version, prefix, ctx) {
36703
+ const entry = guiPlatformPackage();
36704
+ const spec = `${entry.name}@${version}`;
36705
+ console.log(`\u{1F4E5} Fetching ${spec} from the npm registry...`);
36706
+ mkdirSync2(prefix, { recursive: true });
36707
+ const win = process.platform === "win32";
36708
+ const args = [
36709
+ "install",
36710
+ "--prefix",
36711
+ win ? `"${prefix}"` : prefix,
36712
+ "--no-save",
36713
+ "--no-audit",
36714
+ "--no-fund",
36715
+ "--ignore-scripts",
36716
+ "--loglevel=error",
36717
+ spec
36718
+ ];
36719
+ const r = spawnSync(win ? "npm.cmd" : "npm", args, { encoding: "utf8", shell: win });
36720
+ if (r.error || r.status !== 0) {
36721
+ const out = `${r.stderr || ""}${r.stdout || ""}`;
36722
+ console.error(`
36723
+ \u274C Could not install ${spec}`);
36724
+ if (r.error && r.error.code === "ENOENT") {
36725
+ console.error(` npm was not found on PATH; it is needed to fetch the desktop app.`);
36726
+ } else if (/E404|ETARGET|notarget|404 Not Found/i.test(out)) {
36727
+ console.error(` That version of the desktop app is not published on npm: the app is released`);
36728
+ console.error(` separately from the CLI, and tingly-box ${version} has no matching app yet.`);
36729
+ console.error(` Newest published app: npm view ${entry.name} version`);
36730
+ process.exit(1);
36731
+ } else if (out.trim()) {
36732
+ console.error(out.trim().split("\n").slice(-6).map((l) => ` ${l}`).join("\n"));
36733
+ }
36734
+ console.error(`
36735
+ \u{1F504} To retry, run: ${ctx.retryCmd}`);
36736
+ process.exit(1);
36737
+ }
36738
+ const local = findPlatformPackage(pathToFileURL(join5(prefix, "x.js")).href, GUI_PLATFORM_PACKAGES);
36739
+ if (!local || local.version !== version) {
36740
+ console.error(`
36741
+ \u274C ${spec} installed but is not usable (found: ${local ? local.version : "nothing"})`);
36742
+ process.exit(1);
36743
+ }
36744
+ return local;
36745
+ }
36746
+ async function getPlatformArchAndBinary() {
36747
+ const platform = process.platform;
36748
+ const arch = process.arch;
36749
+ let platformDir;
36750
+ let archDir;
36751
+ let suffix = "";
36752
+ let appName = "TinglyBox.app";
36753
+ if (platform === "darwin") {
36754
+ platformDir = "macos";
36755
+ archDir = "arm64";
36756
+ } else if (platform === "linux") {
36757
+ platformDir = "linux";
36758
+ if (arch === "x64") archDir = "amd64";
36759
+ else if (arch === "ia32") archDir = "386";
36760
+ else archDir = arch;
36761
+ } else if (platform === "win32") {
36762
+ platformDir = "windows";
36763
+ if (arch === "x64") archDir = "amd64";
36764
+ else if (arch === "ia32") archDir = "386";
36765
+ else archDir = arch;
36766
+ suffix = ".exe";
36767
+ } else {
36768
+ console.error(`Unsupported platform/arch: ${platform}/${arch}`);
36769
+ process.exit(1);
36770
+ }
36771
+ return { platformDir, archDir, binaryName: "tingly-box-gui", suffix, appName };
36772
+ }
36773
+ function preflightLinux(releasesUrl) {
36774
+ if (!hasDisplay()) {
36775
+ console.error(`
36776
+ \u274C No desktop session found (neither DISPLAY nor WAYLAND_DISPLAY is set)`);
36777
+ console.error(` The desktop app needs a graphical session. Over SSH or in a container use the CLI instead:`);
36778
+ console.error(` npx tingly-box`);
36779
+ process.exit(1);
36780
+ }
36781
+ const missing = checkLibs();
36782
+ if (missing && missing.length > 0) {
36783
+ console.error(`
36784
+ \u274C Missing system libraries: ${missing.join(", ")}`);
36785
+ console.error(` The Linux desktop app uses the system's GTK 3 and WebKitGTK 4.1`);
36786
+ console.error(` (Ubuntu 22.04+, Debian 12+, Fedora 36+).`);
36787
+ const hint = readInstallHint();
36788
+ console.error(`
36789
+ \u{1F4A1} Install them${hint ? `:
36790
+ ${hint}` : ` (${REQUIRED_LIBS.join(", ")}) with your package manager`}`);
36791
+ console.error(` Or use the CLI, which needs no system libraries: npx tingly-box`);
36792
+ console.error(` Newer distributions can install the .deb / .rpm instead: ${releasesUrl}`);
36793
+ process.exit(1);
36794
+ }
36795
+ }
36796
+ function launchLinux(appPath, cacheRoot) {
36797
+ console.log(`\u{1F680} Launching ${appPath}...`);
36798
+ mkdirSync2(cacheRoot, { recursive: true });
36799
+ const logPath = join5(cacheRoot, "app.log");
36800
+ const errFd = openSync(logPath, "w");
36801
+ const child = spawn(appPath, [], { detached: true, stdio: ["ignore", "ignore", errFd] });
36802
+ closeSync(errFd);
36803
+ child.on("error", (e) => {
36804
+ console.error(`
36805
+ \u274C Failed to launch ${appPath}: ${e.message}`);
36806
+ console.error(` Clear the cache and retry: rm -rf "${cacheRoot}"`);
36807
+ process.exit(1);
36808
+ });
36809
+ child.on("exit", (code, signal) => {
36810
+ if (code === 0) process.exit(0);
36811
+ console.error(`
36812
+ \u274C ${appPath} exited right after start (${signal || `code ${code}`})`);
36813
+ let stderr = "";
36814
+ try {
36815
+ stderr = readFileSync3(logPath, "utf8").slice(0, 4096);
36816
+ } catch {
36817
+ }
36818
+ if (stderr.trim()) console.error(stderr.trim().split("\n").map((l) => ` ${l}`).join("\n"));
36819
+ console.error(`
36820
+ \u{1F4A1} Use the CLI instead: npx tingly-box`);
36821
+ process.exit(code || 1);
36822
+ });
36823
+ setTimeout(() => {
36824
+ child.removeAllListeners("exit");
36825
+ child.unref();
36826
+ console.log(`\u{1F4DD} App log: ${logPath}`);
36827
+ }, 2e3);
36828
+ }
36829
+ async function launchGui(ctx) {
36830
+ cleanupRetiredInstallDirs(dirname3(fileURLToPath(ctx.shimUrl)));
36831
+ const platform = process.platform;
36832
+ const releasesUrl = "https://github.com/tingly-dev/tingly-box/releases/latest";
36833
+ let unsupported = null;
36834
+ if (platform === "linux" && process.arch !== "x64" && process.arch !== "arm64") {
36835
+ unsupported = {
36836
+ name: "Linux on " + process.arch,
36837
+ status: ["The desktop app is built for x64 and arm64 Linux only"]
36838
+ };
36839
+ } else if (platform === "win32" && process.arch !== "x64") {
36840
+ unsupported = {
36841
+ name: "Windows on " + process.arch,
36842
+ status: ["The desktop app is built for x64 Windows only"]
36843
+ };
36844
+ } else if (platform === "darwin" && process.arch !== "arm64") {
36845
+ unsupported = {
36846
+ name: "macOS on Intel",
36847
+ status: ["The desktop app is built for Apple Silicon Macs only"]
36848
+ };
36849
+ }
36850
+ if (unsupported) {
36851
+ console.error(`
36852
+ \u274C ${unsupported.name} is not supported by npx tingly-box-gui`);
36853
+ console.error(`\u250C\u2500 Status:`);
36854
+ for (const line of unsupported.status) console.error(`\u2502 ${line}`);
36855
+ console.error(`\u2514\u2500 Platform: ${platform} (${process.arch})`);
36856
+ console.error(`
36857
+ \u{1F4A1} Alternatives:`);
36858
+ console.error(` \u2022 Use the CLI version: npx tingly-box`);
36859
+ process.exit(1);
36860
+ }
36861
+ if (platform === "linux") {
36862
+ preflightLinux(releasesUrl);
36863
+ }
36864
+ const platformInfo = await getPlatformArchAndBinary();
36865
+ const { platformDir, archDir, binaryName, suffix, appName } = platformInfo;
36866
+ const source = resolveSource(ctx);
36867
+ const branchName = source.tag;
36868
+ console.log(`Tingly Box desktop app ${branchName}`);
36869
+ const zipFileName = `${binaryName}-${platformDir}-${archDir}.zip`;
36870
+ const downloadUrl = `${BASE_URL}/${branchName}/${zipFileName}`;
36871
+ const cacheRoot = join5(cacheDir(), "tingly-box-gui");
36872
+ const tinglyBinDir = join5(cacheRoot, branchName, "bin");
36873
+ try {
36874
+ if (!existsSync3(tinglyBinDir)) {
36875
+ mkdirSync2(tinglyBinDir, { recursive: true });
36876
+ }
36877
+ } catch (mkdirError) {
36878
+ console.error(`\u274C Failed to create directory ${tinglyBinDir}:`, mkdirError.message);
36879
+ process.exit(1);
36880
+ }
36881
+ const isMac = platform === "darwin";
36882
+ const appPath = isMac ? join5(tinglyBinDir, appName) : join5(tinglyBinDir, `tingly-box-gui${suffix}`);
36883
+ if (!existsSync3(appPath)) {
36884
+ if (source.kind === "package") {
36885
+ console.log(`\u{1F4E6} Installing the app from ${source.local.name}@${source.local.version}...`);
36886
+ await extractZipFile(source.local.zipPath, tinglyBinDir);
36887
+ } else if (source.kind === "registry") {
36888
+ const pkgDir = join5(cacheRoot, branchName, "pkg");
36889
+ try {
36890
+ const local = installFromRegistry(ctx.ownVersion, pkgDir, ctx);
36891
+ console.log(`\u{1F4E6} Installing the app from ${local.name}@${local.version}...`);
36892
+ await extractZipFile(local.zipPath, tinglyBinDir);
36893
+ } finally {
36894
+ rmSync2(pkgDir, { recursive: true, force: true });
36895
+ }
36896
+ } else {
36897
+ await downloadAndExtractZip(downloadUrl, tinglyBinDir);
36898
+ }
36899
+ if (!existsSync3(appPath)) {
36900
+ console.error(`\u274C The package did not contain ${appPath}`);
36901
+ process.exit(1);
36902
+ }
36903
+ if (isMac) {
36904
+ const appBinaryPath = join5(appPath, "Contents", "MacOS", "tingly-box-gui");
36905
+ if (existsSync3(appBinaryPath)) {
36906
+ chmodSync2(appBinaryPath, 493);
36907
+ }
36908
+ }
36909
+ console.log(`\u2705 Installed to ${appPath}`);
36910
+ }
36911
+ cleanupStaleBinaryCaches(cacheRoot, branchName);
36912
+ if (platform === "linux") {
36913
+ launchLinux(appPath, cacheRoot);
36914
+ return;
36915
+ }
36916
+ if (!isMac) {
36917
+ console.log(`\u{1F680} Launching ${appPath}...`);
36918
+ try {
36919
+ const child = spawn(appPath, [], { detached: true, stdio: "ignore" });
36920
+ child.on("error", (e) => {
36921
+ console.error(`
36922
+ \u274C Failed to launch ${appPath}: ${e.message}`);
36923
+ console.error(` Clear the cache and retry: rmdir /s /q "${cacheRoot}"`);
36924
+ process.exit(1);
36925
+ });
36926
+ child.unref();
36927
+ } catch (e) {
36928
+ console.error(`
36929
+ \u274C Failed to launch ${appPath}: ${e.message}`);
36930
+ process.exit(1);
36931
+ }
36932
+ return;
36933
+ }
36934
+ console.log(`\u{1F50D} Launching app: ${appPath}`);
36935
+ try {
36936
+ execFileSync3("codesign", ["--verify", "--deep", appPath], { stdio: "ignore" });
36937
+ } catch {
36938
+ try {
36939
+ console.log(`\u{1F510} Signing app with ad-hoc signature...`);
36940
+ execFileSync3("codesign", ["--force", "--deep", "--sign", "-", appPath], { stdio: "inherit" });
36941
+ console.log(`\u2705 App signed successfully`);
36942
+ } catch (signError) {
36943
+ console.error(`\u26A0\uFE0F Warning: Failed to sign app: ${signError.message}`);
36944
+ console.error(` Continuing anyway...`);
36945
+ }
36946
+ }
36947
+ try {
36948
+ console.log(`\u{1F680} Launching ${appName}...`);
36949
+ execFileSync3("open", ["-a", appPath], {
36950
+ stdio: "inherit"
36951
+ });
36952
+ console.log(`\u2705 ${appName} launched successfully!`);
36953
+ } catch (execError) {
36954
+ console.error(`
36955
+ \u274C Failed to launch ${appName}`);
36956
+ console.error(`\u250C\u2500 Error Details:`);
36957
+ console.error(`\u2502 Message: ${execError.message}`);
36958
+ const errorCode = execError.code;
36959
+ if (errorCode) {
36960
+ console.error(`\u2502 Code: ${errorCode}`);
36961
+ }
36962
+ const errorStatus = execError.status;
36963
+ if (errorStatus !== null && errorStatus !== void 0) {
36964
+ console.error(`\u2502 Exit Code: ${errorStatus}`);
36965
+ }
36966
+ console.error(`\u2514\u2500 App Path: ${appPath}`);
36967
+ console.error(` Platform: ${process.platform} (${process.arch})`);
36968
+ console.error(`
36969
+ \u{1F4A1} Troubleshooting:`);
36970
+ console.error(` \u2022 Try opening manually: open "${appPath}"`);
36971
+ console.error(` \u2022 Check if the app is quarantined: xattr -l "${appPath}"`);
36972
+ console.error(` \u2022 Remove quarantine if needed: xattr -cr "${appPath}"`);
36973
+ console.error(`
36974
+ \u{1F504} To retry, run: ${ctx.retryCmd}`);
36975
+ console.error(` Or clear cache first: rm -rf "${cacheRoot}"`);
36976
+ const exitCode = errorStatus !== void 0 ? errorStatus : 1;
36977
+ process.exit(exitCode);
36978
+ }
36979
+ }
36980
+
36643
36981
  // ../shared/transport.js
36644
36982
  function validateTransportVersion(version) {
36645
36983
  if (version === "latest") {
@@ -36674,8 +37012,8 @@ function parseTransportVersion() {
36674
37012
  }
36675
37013
 
36676
37014
  // bin.js
36677
- var BASE_URL = "https://github.com/tingly-dev/tingly-box/releases/download";
36678
- var BINARY_RELEASE_BRANCH = "v1.261002.1";
37015
+ var BASE_URL2 = "https://github.com/tingly-dev/tingly-box/releases/download";
37016
+ var BINARY_RELEASE_BRANCH = "v1.261006.2";
36679
37017
  var { version: VERSION, remainingArgs } = parseTransportVersion();
36680
37018
  var SOURCE_ARGS = sourceArgs("npx", "npm");
36681
37019
  var OWN_VERSION = createRequire2(import.meta.url)("./package.json").version;
@@ -36697,7 +37035,7 @@ async function installFromPackage(local, extractDir) {
36697
37035
  console.log(`\u{1F4E6} Installing binary from ${local.name}@${local.version}...`);
36698
37036
  await extractZipFile(local.zipPath, extractDir);
36699
37037
  }
36700
- async function getPlatformArchAndBinary() {
37038
+ async function getPlatformArchAndBinary2() {
36701
37039
  const platform = process.platform;
36702
37040
  const arch = process.arch;
36703
37041
  let platformDir;
@@ -36727,28 +37065,39 @@ async function getPlatformArchAndBinary() {
36727
37065
  return { platformDir, archDir, binaryName, suffix };
36728
37066
  }
36729
37067
  (async () => {
36730
- cleanupRetiredInstallDirs(dirname3(fileURLToPath(import.meta.url)));
36731
- const platformInfo = await getPlatformArchAndBinary();
37068
+ if (remainingArgs[0] === "gui" || remainingArgs[0] === "app") {
37069
+ await launchGui({
37070
+ shimUrl: import.meta.url,
37071
+ ownVersion: OWN_VERSION,
37072
+ version: VERSION,
37073
+ releaseTag: BINARY_RELEASE_BRANCH,
37074
+ retryCmd: `npx tingly-box ${remainingArgs.join(" ")}`,
37075
+ fromRegistry: true
37076
+ });
37077
+ return;
37078
+ }
37079
+ cleanupRetiredInstallDirs(dirname4(fileURLToPath2(import.meta.url)));
37080
+ const platformInfo = await getPlatformArchAndBinary2();
36732
37081
  const { platformDir, archDir, binaryName, suffix } = platformInfo;
36733
37082
  const source = resolveBinarySource();
36734
37083
  const branchName = source.tag;
36735
37084
  const zipFileName = `${binaryName}-${platformDir}-${archDir}.zip`;
36736
- const downloadUrl = `${BASE_URL}/${branchName}/${zipFileName}`;
36737
- const cacheRoot = join5(cacheDir(), "tingly-box");
36738
- const tinglyBinDir = join5(cacheRoot, branchName, "bin");
37085
+ const downloadUrl = `${BASE_URL2}/${branchName}/${zipFileName}`;
37086
+ const cacheRoot = join6(cacheDir(), "tingly-box");
37087
+ const tinglyBinDir = join6(cacheRoot, branchName, "bin");
36739
37088
  try {
36740
- if (!existsSync3(tinglyBinDir)) {
36741
- mkdirSync2(tinglyBinDir, { recursive: true });
37089
+ if (!existsSync4(tinglyBinDir)) {
37090
+ mkdirSync3(tinglyBinDir, { recursive: true });
36742
37091
  }
36743
37092
  } catch (mkdirError) {
36744
37093
  console.error(`\u274C Failed to create directory ${tinglyBinDir}:`, mkdirError.message);
36745
37094
  process.exit(1);
36746
37095
  }
36747
- const binaryPath = join5(tinglyBinDir, `${binaryName}${suffix}`);
36748
- if (!existsSync3(binaryPath)) {
37096
+ const binaryPath = join6(tinglyBinDir, `${binaryName}${suffix}`);
37097
+ if (!existsSync4(binaryPath)) {
36749
37098
  if (source.kind === "package") {
36750
37099
  await installFromPackage(source.local, tinglyBinDir);
36751
- if (!existsSync3(binaryPath)) {
37100
+ if (!existsSync4(binaryPath)) {
36752
37101
  console.error(`\u274C ${source.local.name} did not contain ${binaryPath}`);
36753
37102
  process.exit(1);
36754
37103
  }
package/install.log CHANGED
@@ -1,13 +1,13 @@
1
- 📦 Installing binary from @tingly-dev/tingly-box-linux-x64@1.261002.1...
1
+ 📦 Installing binary from @tingly-dev/tingly-box-linux-x64@1.261006.2...
2
2
 
3
- 📦 Extracting ZIP to /home/runner/work/_temp/cache/tingly-box/v1.261002.1/bin...
4
- 📄 Extracting: tingly-box -> /home/runner/work/_temp/cache/tingly-box/v1.261002.1/bin/tingly-box
5
- ✅ Extracted ZIP to /home/runner/work/_temp/cache/tingly-box/v1.261002.1/bin
6
- ✅ Installed to /home/runner/work/_temp/cache/tingly-box/v1.261002.1/bin/tingly-box
7
- 🔍 Executing binary: /home/runner/work/_temp/cache/tingly-box/v1.261002.1/bin/tingly-box
3
+ 📦 Extracting ZIP to /home/runner/work/_temp/cache/tingly-box/v1.261006.2/bin...
4
+ 📄 Extracting: tingly-box -> /home/runner/work/_temp/cache/tingly-box/v1.261006.2/bin/tingly-box
5
+ ✅ Extracted ZIP to /home/runner/work/_temp/cache/tingly-box/v1.261006.2/bin
6
+ ✅ Installed to /home/runner/work/_temp/cache/tingly-box/v1.261006.2/bin/tingly-box
7
+ 🔍 Executing binary: /home/runner/work/_temp/cache/tingly-box/v1.261006.2/bin/tingly-box
8
8
  Tingly Box CLI
9
- Version: v1.261002.1
10
- Git Commit: 28bc966c4a391008514b07f93b78a6ae23ec9fd9
11
- Build Time: 2026-10-01-23-59-31
9
+ Version: v1.261006.2
10
+ Git Commit: 75c8c7b17d827cddaa4e3ea4ee82893113aba7df
11
+ Build Time: 2026-10-08-14-24-41
12
12
  Go Version: 1.26.8
13
13
  Platform: linux/amd64
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tingly-box",
3
- "version": "1.261002.1",
3
+ "version": "1.261006.2",
4
4
  "description": "High-performance AI gateway CLI - connect to multiple AI providers through a single API",
5
5
  "keywords": [
6
6
  "ai",
@@ -30,10 +30,10 @@
30
30
  },
31
31
  "type": "module",
32
32
  "optionalDependencies": {
33
- "@tingly-dev/tingly-box-darwin-arm64": "1.261002.1",
34
- "@tingly-dev/tingly-box-darwin-x64": "1.261002.1",
35
- "@tingly-dev/tingly-box-linux-arm64": "1.261002.1",
36
- "@tingly-dev/tingly-box-linux-x64": "1.261002.1",
37
- "@tingly-dev/tingly-box-win32-x64": "1.261002.1"
33
+ "@tingly-dev/tingly-box-darwin-arm64": "1.261006.2",
34
+ "@tingly-dev/tingly-box-darwin-x64": "1.261006.2",
35
+ "@tingly-dev/tingly-box-linux-arm64": "1.261006.2",
36
+ "@tingly-dev/tingly-box-linux-x64": "1.261006.2",
37
+ "@tingly-dev/tingly-box-win32-x64": "1.261006.2"
38
38
  }
39
39
  }
package/publish.log DELETED
@@ -1 +0,0 @@
1
- npm warn Unknown user config "always-auth". This will stop working in the next major version of npm. See `npm help npmrc` for supported config options.