ai-fly 0.4.0-alpha.1 → 0.4.0-alpha.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/dist/ai-fly.js CHANGED
@@ -12,6 +12,7 @@ Daemon:
12
12
  ai-fly daemon start [--detach] [--data <dir>] [--relay <url>]... [--proxy <url|env|none>]
13
13
  ai-fly daemon stop [--force] | info | restart [--detach] | log [--lines <n>]
14
14
  ai-fly serve alias of 'daemon start'
15
+ ai-fly app launch the tray GUI (desktop app)
15
16
 
16
17
  Provider:
17
18
  ai-fly service add <name> [--upstream <url> | --preset <id>] [--route <local>=<up>[@forms]]...
@@ -61,7 +62,22 @@ async function dispatch(command, rest) {
61
62
  const lazy = (load) => {
62
63
  return (argv, ctx) => load().then((m) => m.run([...argv], ctx));
63
64
  };
64
- return match(command).with("serve", () => lazy(() => import("./serve-FjBsmK5n.mjs"))(rest)).with("daemon", () => lazy(() => import("./daemon-C4kj0IwL.mjs"))(rest)).with("presets", () => lazy(() => import("./presets-DRO5N4Vm.mjs"))(rest)).with("secret", () => lazy(() => import("./secret-DKN75Vry.mjs"))(rest)).with("settings", async () => (await import("./settings-Dho5hk5Z.mjs")).runAsSettings(rest, {})).with("relay", async () => (await import("./settings-Dho5hk5Z.mjs")).runAsRelay(rest, {})).with("test", () => lazy(() => import("./test-Dxkkc-KN.mjs"))(rest)).with("service", () => lazy(() => import("./service-DnQhGK4m.mjs"))(rest)).with("group", () => lazy(() => import("./group-CjwGDch3.mjs"))(rest)).with("share", () => lazy(() => import("./share-DpQPO1eC.mjs"))(rest)).with("revoke", () => lazy(() => import("./revoke-CXTcFgoT.mjs"))(rest)).with("join", () => lazy(() => import("./join-BJMcNGV-.mjs"))(rest)).with("import", () => lazy(() => import("./import-Zy3LL_PR.mjs"))(rest)).with("run", () => lazy(() => import("./run-W7DBz_bR.mjs"))(rest)).with("ports", () => lazy(() => import("./ports-Csv91JOD.mjs"))(rest)).with("forget", () => lazy(() => import("./forget-oMwM-SsU.mjs"))(rest)).with("key", () => {
65
+ return match(command).with("serve", () => lazy(() => import("./serve-FjBsmK5n.mjs"))(rest)).with("app", async () => {
66
+ const { join, dirname } = await import("node:path");
67
+ const { fileURLToPath } = await import("node:url");
68
+ const { spawn } = await import("node:child_process");
69
+ const entry = join(dirname(fileURLToPath(import.meta.url)), "app", "main.js");
70
+ const { existsSync } = await import("node:fs");
71
+ if (!existsSync(entry)) {
72
+ process.stderr.write(`error: tray GUI not included in this install (missing ${entry})\nnote: rebuild the package with webui + app entries (pnpm app:build)
73
+ `);
74
+ return 1;
75
+ }
76
+ const child = spawn(process.execPath, [entry, ...rest], { stdio: "inherit" });
77
+ return await new Promise((resolve) => {
78
+ child.once("exit", (c) => resolve(c ?? 0));
79
+ });
80
+ }).with("daemon", () => lazy(() => import("./daemon-C4kj0IwL.mjs"))(rest)).with("presets", () => lazy(() => import("./presets-DRO5N4Vm.mjs"))(rest)).with("secret", () => lazy(() => import("./secret-DKN75Vry.mjs"))(rest)).with("settings", async () => (await import("./settings-Dho5hk5Z.mjs")).runAsSettings(rest, {})).with("relay", async () => (await import("./settings-Dho5hk5Z.mjs")).runAsRelay(rest, {})).with("test", () => lazy(() => import("./test-Dxkkc-KN.mjs"))(rest)).with("service", () => lazy(() => import("./service-DnQhGK4m.mjs"))(rest)).with("group", () => lazy(() => import("./group-CjwGDch3.mjs"))(rest)).with("share", () => lazy(() => import("./share-DpQPO1eC.mjs"))(rest)).with("revoke", () => lazy(() => import("./revoke-CXTcFgoT.mjs"))(rest)).with("join", () => lazy(() => import("./join-BJMcNGV-.mjs"))(rest)).with("import", () => lazy(() => import("./import-Zy3LL_PR.mjs"))(rest)).with("run", () => lazy(() => import("./run-W7DBz_bR.mjs"))(rest)).with("ports", () => lazy(() => import("./ports-Csv91JOD.mjs"))(rest)).with("forget", () => lazy(() => import("./forget-oMwM-SsU.mjs"))(rest)).with("key", () => {
65
81
  if (rest[0] === "add") return lazy(() => import("./key-BcNxtRJx.mjs"))(rest);
66
82
  return lazy(() => import("./key-TP7lZeqW.mjs"))(rest);
67
83
  }).with("status", async () => {