@aidotnet/astra-gate 0.11.7 → 0.13.0-preview.1

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/index.js CHANGED
@@ -972,10 +972,35 @@ function walkDirs(dir, depth) {
972
972
  }
973
973
  return out;
974
974
  }
975
+ var DESKTOP_MARKER = "astra-desktop.json";
976
+ function isInside(root, target) {
977
+ const rel = path7.relative(root, target);
978
+ return rel !== "" && !rel.startsWith("..") && !path7.isAbsolute(rel);
979
+ }
980
+ function readMarkerEntry(appDir, platform) {
981
+ try {
982
+ const raw = JSON.parse(fs7.readFileSync(path7.join(appDir, DESKTOP_MARKER), "utf8"));
983
+ if (!raw || typeof raw !== "object") return null;
984
+ const { entry, kind } = raw;
985
+ if (typeof entry !== "string" || entry === "" || path7.isAbsolute(entry)) return null;
986
+ const isBundle = platform === "darwin";
987
+ if (kind !== (isBundle ? "app-bundle" : "exe")) return null;
988
+ const full = path7.resolve(appDir, entry);
989
+ if (!isInside(path7.resolve(appDir), full)) return null;
990
+ if (!isInside(fs7.realpathSync(appDir), fs7.realpathSync(full))) return null;
991
+ const st = fs7.statSync(full);
992
+ if (isBundle ? !st.isDirectory() || !full.endsWith(".app") : !st.isFile()) return null;
993
+ return { path: full, isBundle };
994
+ } catch {
995
+ return null;
996
+ }
997
+ }
975
998
  function findDesktopEntry(appDir, platform) {
976
999
  if (!fs7.existsSync(appDir)) {
977
1000
  throw new Error(`The desktop package does not contain an app directory (${appDir}).`);
978
1001
  }
1002
+ const marked = readMarkerEntry(appDir, platform);
1003
+ if (marked) return marked;
979
1004
  if (platform === "darwin") {
980
1005
  const bundles = walkDirs(appDir, 4).filter((d) => d.endsWith(".app")).sort((a, b) => a.length - b.length);
981
1006
  const first2 = bundles[0];
@@ -1288,7 +1313,7 @@ import { fileURLToPath } from "url";
1288
1313
  // package.json
1289
1314
  var package_default = {
1290
1315
  name: "@aidotnet/astra-gate",
1291
- version: "0.11.7",
1316
+ version: "0.13.0-preview.1",
1292
1317
  description: "Astra \u2014 a local AI gateway. Install, start, stop and manage the astra-server from the terminal.",
1293
1318
  license: "MIT",
1294
1319
  type: "module",
@@ -1319,12 +1344,12 @@ var package_default = {
1319
1344
  commander: "^12.1.0"
1320
1345
  },
1321
1346
  optionalDependencies: {
1322
- "@aidotnet/server-darwin-arm64": "0.11.7",
1323
- "@aidotnet/server-darwin-x64": "0.11.7",
1324
- "@aidotnet/server-linux-arm64": "0.11.7",
1325
- "@aidotnet/server-linux-x64": "0.11.7",
1326
- "@aidotnet/server-win32-arm64": "0.11.7",
1327
- "@aidotnet/server-win32-x64": "0.11.7"
1347
+ "@aidotnet/server-darwin-arm64": "0.13.0-preview.1",
1348
+ "@aidotnet/server-darwin-x64": "0.13.0-preview.1",
1349
+ "@aidotnet/server-linux-arm64": "0.13.0-preview.1",
1350
+ "@aidotnet/server-linux-x64": "0.13.0-preview.1",
1351
+ "@aidotnet/server-win32-arm64": "0.13.0-preview.1",
1352
+ "@aidotnet/server-win32-x64": "0.13.0-preview.1"
1328
1353
  },
1329
1354
  devDependencies: {
1330
1355
  "@aidotnet/update-core": "workspace:*",