@jamiexiongr/panda-hub 0.1.1 → 0.1.3

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.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ import('../dist/cli.mjs')
@@ -5,16 +5,17 @@ import {
5
5
  resolveTailscaleServeEnabled,
6
6
  resolveTailscaleServePort,
7
7
  startPandaSessionService
8
- } from "./chunk-GPLVIR3L.mjs";
8
+ } from "./chunk-I3VRWQCP.mjs";
9
9
 
10
10
  // release/panda-hub/src/index.ts
11
+ import fs from "fs";
11
12
  import path from "path";
12
13
  import { fileURLToPath } from "url";
13
14
 
14
15
  // release/panda-hub/package.json
15
16
  var package_default = {
16
17
  name: "@jamiexiongr/panda-hub",
17
- version: "0.1.1",
18
+ version: "0.1.3",
18
19
  type: "module",
19
20
  private: false,
20
21
  description: "Panda hub runtime",
@@ -24,12 +25,13 @@ var package_default = {
24
25
  fastify: "^5.2.1"
25
26
  },
26
27
  bin: {
27
- "panda-hub": "./dist/cli.mjs"
28
+ "panda-hub": "./bin/panda-hub.cjs"
28
29
  },
29
30
  exports: {
30
31
  ".": "./dist/index.mjs"
31
32
  },
32
33
  files: [
34
+ "bin",
33
35
  "dist"
34
36
  ],
35
37
  publishConfig: {
@@ -43,6 +45,14 @@ var package_default = {
43
45
 
44
46
  // release/panda-hub/src/index.ts
45
47
  var currentDirectory = path.dirname(fileURLToPath(import.meta.url));
48
+ var resolveBundledWebUiDir = () => {
49
+ const candidates = [
50
+ path.resolve(currentDirectory, "web"),
51
+ path.resolve(currentDirectory, "../dist/web"),
52
+ path.resolve(currentDirectory, "../web")
53
+ ];
54
+ return candidates.find((candidate) => fs.existsSync(candidate)) ?? candidates[0];
55
+ };
46
56
  var startJamiexiongrHub = async (options) => {
47
57
  const port = Number(process.env.PANDA_HUB_PORT ?? 4343);
48
58
  const tailscaleServe = configureTailscaleServe({
@@ -63,7 +73,7 @@ var startJamiexiongrHub = async (options) => {
63
73
  if (hubApiKey.apiKey) {
64
74
  process.env.PANDA_HUB_API_KEY = hubApiKey.apiKey;
65
75
  }
66
- const webUiDir = path.resolve(currentDirectory, "../web");
76
+ const webUiDir = resolveBundledWebUiDir();
67
77
  const app = await startPandaSessionService({
68
78
  serviceName: "panda-hub",
69
79
  mode: "hub",
@@ -12726,7 +12726,7 @@ var startPandaSessionService = async ({
12726
12726
  if (managedTimeline) {
12727
12727
  return mergeTimelineEntries(managedTimeline, readTimelineOverlay(sessionId, managedTimeline));
12728
12728
  }
12729
- const { readCodexTimeline: readCodexTimeline2 } = await import("./src-LEEO2YLS.mjs");
12729
+ const { readCodexTimeline: readCodexTimeline2 } = await import("./src-A2O4IXQ2.mjs");
12730
12730
  const discoveredTimeline = await readCodexTimeline2(sessionId, {
12731
12731
  codexHome,
12732
12732
  sessionFiles: discoveredSessionFiles
@@ -13411,7 +13411,7 @@ var startPandaSessionService = async ({
13411
13411
  lastSnapshotRefreshAt = Date.now();
13412
13412
  return snapshot;
13413
13413
  }
13414
- const { discoverLocalCodexData: discoverLocalCodexData2 } = await import("./src-LEEO2YLS.mjs");
13414
+ const { discoverLocalCodexData: discoverLocalCodexData2 } = await import("./src-A2O4IXQ2.mjs");
13415
13415
  const discovery = await discoverLocalCodexData2({
13416
13416
  agentId: localAgentId,
13417
13417
  agentName: localAgentName,
@@ -15656,6 +15656,25 @@ var parsePort = (value) => {
15656
15656
  }
15657
15657
  return parsed;
15658
15658
  };
15659
+ var trimExecOutput = (value) => {
15660
+ if (typeof value === "string") {
15661
+ const trimmed = value.trim();
15662
+ return trimmed || null;
15663
+ }
15664
+ if (Buffer.isBuffer(value)) {
15665
+ const trimmed = value.toString("utf8").trim();
15666
+ return trimmed || null;
15667
+ }
15668
+ return null;
15669
+ };
15670
+ var describeExecError = (error) => {
15671
+ if (!(error instanceof Error)) {
15672
+ return "tailscale serve failed";
15673
+ }
15674
+ const commandError = error;
15675
+ const output = trimExecOutput(commandError.stderr) ?? trimExecOutput(commandError.stdout);
15676
+ return output ?? error.message;
15677
+ };
15659
15678
  var readTailscaleStatus = () => {
15660
15679
  try {
15661
15680
  const stdout = execFileSync("tailscale", ["status", "--json"], {
@@ -15767,6 +15786,7 @@ var configureTailscaleServe = (options) => {
15767
15786
  "tailscale",
15768
15787
  [
15769
15788
  "serve",
15789
+ "--yes",
15770
15790
  "--bg",
15771
15791
  `--https=${options.servePort}`,
15772
15792
  `http://127.0.0.1:${options.localPort}`
@@ -15779,7 +15799,7 @@ var configureTailscaleServe = (options) => {
15779
15799
  }
15780
15800
  );
15781
15801
  } catch (error) {
15782
- const message = error instanceof Error ? error.message : "tailscale serve failed";
15802
+ const message = describeExecError(error);
15783
15803
  options.logger?.warn?.(
15784
15804
  `Unable to publish ${options.serviceName} via Tailscale Serve: ${message}`
15785
15805
  );
package/dist/cli.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  startJamiexiongrHub
3
- } from "./chunk-B2DDQ2FD.mjs";
3
+ } from "./chunk-GX7OAH4Z.mjs";
4
4
  import {
5
5
  resolveTailscaleServeEnabled
6
- } from "./chunk-GPLVIR3L.mjs";
6
+ } from "./chunk-I3VRWQCP.mjs";
7
7
 
8
8
  // release/panda-hub/src/cli.ts
9
9
  void startJamiexiongrHub({
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  startJamiexiongrHub
3
- } from "./chunk-B2DDQ2FD.mjs";
4
- import "./chunk-GPLVIR3L.mjs";
3
+ } from "./chunk-GX7OAH4Z.mjs";
4
+ import "./chunk-I3VRWQCP.mjs";
5
5
  export {
6
6
  startJamiexiongrHub
7
7
  };
@@ -42,7 +42,7 @@ import {
42
42
  writeCodexGlobalState,
43
43
  writePandaSessionPrefs,
44
44
  writePandaThreadPrefs
45
- } from "./chunk-GPLVIR3L.mjs";
45
+ } from "./chunk-I3VRWQCP.mjs";
46
46
  export {
47
47
  CodexAdapter,
48
48
  appendSessionIndexUpdate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jamiexiongr/panda-hub",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "description": "Panda hub runtime",
@@ -10,12 +10,13 @@
10
10
  "fastify": "^5.2.1"
11
11
  },
12
12
  "bin": {
13
- "panda-hub": "./dist/cli.mjs"
13
+ "panda-hub": "./bin/panda-hub.cjs"
14
14
  },
15
15
  "exports": {
16
16
  ".": "./dist/index.mjs"
17
17
  },
18
18
  "files": [
19
+ "bin",
19
20
  "dist"
20
21
  ],
21
22
  "publishConfig": {