@harness-engineering/dashboard 0.6.0 → 0.6.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.
@@ -4,7 +4,7 @@ import {
4
4
  GRAPH_DIR,
5
5
  getOrchestratorTarget,
6
6
  orchestratorProxyMiddleware
7
- } from "./chunk-S6MTXOVY.js";
7
+ } from "./chunk-V7NGMLCN.js";
8
8
 
9
9
  // src/server/index.ts
10
10
  import { Hono as Hono13 } from "hono";
@@ -10,6 +10,7 @@ var GRAPH_DIR = ".harness/graph";
10
10
 
11
11
  // src/server/orchestrator-proxy.ts
12
12
  import http from "http";
13
+ import { isBadPort } from "@harness-engineering/core";
13
14
  var ORCHESTRATOR_PREFIXES = [
14
15
  "/ws",
15
16
  "/api/v1",
@@ -26,6 +27,11 @@ var ORCHESTRATOR_PREFIXES = [
26
27
  "/api/maintenance"
27
28
  ];
28
29
  function getOrchestratorTarget() {
30
+ const target = resolveOrchestratorUrl();
31
+ if (target) warnIfBadProxyPort(target);
32
+ return target;
33
+ }
34
+ function resolveOrchestratorUrl() {
29
35
  const explicit = process.env["ORCHESTRATOR_URL"];
30
36
  if (explicit) {
31
37
  try {
@@ -39,11 +45,31 @@ function getOrchestratorTarget() {
39
45
  if (port) return new URL(`http://127.0.0.1:${port}`);
40
46
  return null;
41
47
  }
48
+ var warnedBadProxyPort = false;
49
+ function warnIfBadProxyPort(target) {
50
+ if (warnedBadProxyPort) return;
51
+ const port = Number(target.port) || ORCHESTRATOR_PORT;
52
+ if (isBadPort(port)) {
53
+ warnedBadProxyPort = true;
54
+ console.error(
55
+ `Orchestrator target ${target.origin} uses port ${port}, which is on the WHATWG fetch bad-ports list. Every proxy request will fail with 502 'fetch failed (cause: bad port)'. Restart the orchestrator on a different port. See https://fetch.spec.whatwg.org/#port-blocking.`
56
+ );
57
+ }
58
+ }
42
59
  function isOrchestratorRoute(pathname) {
43
60
  return ORCHESTRATOR_PREFIXES.some(
44
61
  (prefix) => pathname === prefix || pathname.startsWith(prefix + "/")
45
62
  );
46
63
  }
64
+ function formatProxyErrorMessage(err) {
65
+ const baseMsg = err instanceof Error ? err.message : String(err);
66
+ const cause = err instanceof Error ? err.cause : void 0;
67
+ if (!cause) return baseMsg;
68
+ const causeMsg = cause instanceof Error ? cause.message : void 0;
69
+ const causeCode = typeof cause === "object" && cause !== null && "code" in cause ? String(cause.code) : void 0;
70
+ const detail = causeMsg ?? causeCode;
71
+ return detail ? `${baseMsg} (cause: ${detail})` : baseMsg;
72
+ }
47
73
  function orchestratorProxyMiddleware() {
48
74
  return async (c, next) => {
49
75
  const target = getOrchestratorTarget();
@@ -67,8 +93,7 @@ function orchestratorProxyMiddleware() {
67
93
  headers: resp.headers
68
94
  });
69
95
  } catch (err) {
70
- const message = err instanceof Error ? err.message : String(err);
71
- return c.json({ error: `Orchestrator proxy error: ${message}` }, 502);
96
+ return c.json({ error: `Orchestrator proxy error: ${formatProxyErrorMessage(err)}` }, 502);
72
97
  }
73
98
  };
74
99
  }
@@ -3,21 +3,23 @@ import {
3
3
  attachWsProxy,
4
4
  getBindHost,
5
5
  getOrchestratorTarget
6
- } from "./chunk-S6MTXOVY.js";
6
+ } from "./chunk-V7NGMLCN.js";
7
7
 
8
8
  // src/server/serve.ts
9
9
  import { serve } from "@hono/node-server";
10
10
  import { existsSync } from "fs";
11
11
  import { dirname, join, resolve } from "path";
12
12
  import { fileURLToPath } from "url";
13
+ import { assertPortUsable } from "@harness-engineering/core";
13
14
  var __dirname = dirname(fileURLToPath(import.meta.url));
14
15
  var clientDir = resolve(__dirname, "..", "client");
15
16
  if (existsSync(join(clientDir, "index.html")) && existsSync(join(clientDir, "assets"))) {
16
17
  process.env["DASHBOARD_CLIENT_ROOT"] = clientDir;
17
18
  console.log(`Serving dashboard client from ${clientDir}`);
18
19
  }
19
- var { app } = await import("./-VJKK6LKX.js");
20
+ var { app } = await import("./-U54UVWO2.js");
20
21
  var port = Number(process.env["DASHBOARD_API_PORT"] ?? API_PORT);
22
+ assertPortUsable(port, "dashboard API");
21
23
  var hostname = getBindHost();
22
24
  console.log(`Hono server starting on http://${hostname}:${port}`);
23
25
  var server = serve({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harness-engineering/dashboard",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "Local web dashboard for harness project health and roadmap visualization",
5
5
  "type": "module",
6
6
  "exports": {
@@ -16,7 +16,7 @@
16
16
  "@tailwindcss/typography": "^0.5.19",
17
17
  "framer-motion": "^12.38.0",
18
18
  "glob": "^13.0.6",
19
- "hono": "^4.12.12",
19
+ "hono": "^4.12.18",
20
20
  "lucide-react": "^1.8.0",
21
21
  "react": "^18.3.1",
22
22
  "react-dom": "^18.3.1",
@@ -26,8 +26,8 @@
26
26
  "react-virtuoso": "^4.18.5",
27
27
  "remark-gfm": "^4.0.1",
28
28
  "zustand": "^5.0.12",
29
- "@harness-engineering/core": "0.24.0",
30
- "@harness-engineering/graph": "0.8.0",
29
+ "@harness-engineering/core": "0.26.0",
30
+ "@harness-engineering/graph": "0.9.0",
31
31
  "@harness-engineering/types": "0.11.0"
32
32
  },
33
33
  "devDependencies": {