@jamiexiongr/panda-hub 0.1.0 → 0.1.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/README.md CHANGED
@@ -1,3 +1,32 @@
1
1
  # @jamiexiongr/panda-hub
2
2
 
3
3
  Published hub runtime for Panda, including the built web UI.
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ panda-hub
9
+ panda-hub tailscareserv
10
+ ```
11
+
12
+ `tailscareserv` and `--tailscale-serve` both enable automatic `tailscale serve` publishing.
13
+
14
+ When enabled, hub startup will:
15
+
16
+ - detect whether `tailscale` is available and online
17
+ - run `tailscale serve --bg`
18
+ - print the generated Tailscale HTTPS URL in the startup log
19
+
20
+ ## Environment
21
+
22
+ - `PANDA_HUB_PORT`
23
+ Local hub listen port. Default: `4343`
24
+ - `PANDA_HUB_TAILSCALE_SERVE_PORT`
25
+ Tailscale HTTPS port. Default: `443`
26
+ - `PANDA_TAILSCALE_SERVE=1`
27
+ Optional env alternative to the startup flag
28
+
29
+ ## Notes
30
+
31
+ - Tailscale Serve publishes a tailnet HTTPS address, not a public Internet address.
32
+ - This is the recommended way to run the installable PWA on mobile, because the bundled hub serves the built web assets over HTTPS.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ import('../dist/cli.mjs')
@@ -0,0 +1,89 @@
1
+ import {
2
+ configureTailscaleServe,
3
+ ensurePandaHubApiKey,
4
+ printTerminalQr,
5
+ resolveTailscaleServeEnabled,
6
+ resolveTailscaleServePort,
7
+ startPandaSessionService
8
+ } from "./chunk-GPLVIR3L.mjs";
9
+
10
+ // release/panda-hub/src/index.ts
11
+ import path from "path";
12
+ import { fileURLToPath } from "url";
13
+
14
+ // release/panda-hub/package.json
15
+ var package_default = {
16
+ name: "@jamiexiongr/panda-hub",
17
+ version: "0.1.2",
18
+ type: "module",
19
+ private: false,
20
+ description: "Panda hub runtime",
21
+ dependencies: {
22
+ "@fastify/cors": "^10.0.2",
23
+ "@fastify/websocket": "^11.0.2",
24
+ fastify: "^5.2.1"
25
+ },
26
+ bin: {
27
+ "panda-hub": "./bin/panda-hub.cjs"
28
+ },
29
+ exports: {
30
+ ".": "./dist/index.mjs"
31
+ },
32
+ files: [
33
+ "bin",
34
+ "dist"
35
+ ],
36
+ publishConfig: {
37
+ access: "public",
38
+ registry: "https://registry.npmjs.org/"
39
+ },
40
+ engines: {
41
+ node: ">=20.19.0"
42
+ }
43
+ };
44
+
45
+ // release/panda-hub/src/index.ts
46
+ var currentDirectory = path.dirname(fileURLToPath(import.meta.url));
47
+ var startJamiexiongrHub = async (options) => {
48
+ const port = Number(process.env.PANDA_HUB_PORT ?? 4343);
49
+ const tailscaleServe = configureTailscaleServe({
50
+ enabled: options?.tailscaleServe ?? resolveTailscaleServeEnabled(),
51
+ serviceName: "panda-hub",
52
+ localPort: port,
53
+ servePort: resolveTailscaleServePort({
54
+ envPrefix: "PANDA_HUB",
55
+ defaultPort: 443
56
+ }),
57
+ logger: console
58
+ });
59
+ const hubApiKey = await ensurePandaHubApiKey({
60
+ configuredApiKey: process.env.PANDA_HUB_API_KEY ?? null,
61
+ codexHome: process.env.PANDA_CODEX_HOME ?? null,
62
+ logger: console
63
+ });
64
+ if (hubApiKey.apiKey) {
65
+ process.env.PANDA_HUB_API_KEY = hubApiKey.apiKey;
66
+ }
67
+ const webUiDir = path.resolve(currentDirectory, "../web");
68
+ const app = await startPandaSessionService({
69
+ serviceName: "panda-hub",
70
+ mode: "hub",
71
+ port,
72
+ transport: "hub-routed",
73
+ version: package_default.version,
74
+ webUiDir
75
+ });
76
+ if (tailscaleServe.active && tailscaleServe.baseUrl) {
77
+ console.info(`Panda hub Tailscale HTTPS URL: ${tailscaleServe.baseUrl}`);
78
+ console.info(`Agent hub URL env: PANDA_HUB_URL=${tailscaleServe.baseUrl}`);
79
+ printTerminalQr(tailscaleServe.baseUrl, {
80
+ logger: console,
81
+ label: "Scan this QR code to open Panda hub on your phone:"
82
+ });
83
+ }
84
+ return app;
85
+ };
86
+
87
+ export {
88
+ startJamiexiongrHub
89
+ };