agentflow-dashboard 0.7.0 → 0.7.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.
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>AgentFlow Dashboard</title>
7
- <script type="module" crossorigin src="/assets/index-BQUye2Lc.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-DSuI0NgP.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-Ds_npIxI.css">
9
9
  </head>
10
10
  <body>
package/dist/index.cjs CHANGED
@@ -2083,11 +2083,23 @@ async function startDashboard() {
2083
2083
  case "--cors":
2084
2084
  config.enableCors = true;
2085
2085
  break;
2086
+ case "--no-collector":
2087
+ config.enableCollector = false;
2088
+ break;
2089
+ case "--collector-token":
2090
+ config.collectorAuthToken = args[++i];
2091
+ break;
2086
2092
  case "--help":
2087
2093
  printHelp();
2088
2094
  process.exit(0);
2089
2095
  }
2090
2096
  }
2097
+ if (!config.collectorAuthToken && process.env.AGENTFLOW_COLLECTOR_TOKEN) {
2098
+ config.collectorAuthToken = process.env.AGENTFLOW_COLLECTOR_TOKEN;
2099
+ }
2100
+ if (process.env.AGENTFLOW_NO_COLLECTOR === "true") {
2101
+ config.enableCollector = false;
2102
+ }
2091
2103
  const tracesPath = path2.resolve(config.tracesDir);
2092
2104
  if (!fs2.existsSync(tracesPath)) {
2093
2105
  fs2.mkdirSync(tracesPath, { recursive: true });
@@ -2130,6 +2142,8 @@ Options:
2130
2142
  -h, --host <address> Host address (default: localhost)
2131
2143
  --data-dir <path> Extra data directory for process discovery (repeatable)
2132
2144
  --cors Enable CORS headers
2145
+ --no-collector Disable OTLP trace collector (POST /v1/traces)
2146
+ --collector-token <tok> Require auth token for collector (or set AGENTFLOW_COLLECTOR_TOKEN)
2133
2147
  --help Show this help message
2134
2148
 
2135
2149
  Examples:
@@ -2709,46 +2723,54 @@ var DashboardServer = class {
2709
2723
  res.status(500).json({ error: "Failed to update directory config" });
2710
2724
  }
2711
2725
  });
2712
- this.app.post("/v1/traces", import_express.default.json({ limit: "10mb" }), (req, res) => {
2713
- try {
2714
- const traces = parseOtlpPayload(req.body);
2715
- let ingested = 0;
2716
- for (const trace of traces) {
2717
- const nodes = /* @__PURE__ */ new Map();
2718
- for (const [id, node] of Object.entries(trace.nodes)) {
2719
- nodes.set(id, { ...node, state: {} });
2726
+ if (this.config.enableCollector !== false) {
2727
+ this.app.post("/v1/traces", import_express.default.json({ limit: "10mb" }), (req, res) => {
2728
+ try {
2729
+ if (this.config.collectorAuthToken) {
2730
+ const auth = req.headers.authorization;
2731
+ if (!auth || auth !== `Bearer ${this.config.collectorAuthToken}`) {
2732
+ return res.status(401).json({ error: "Unauthorized \u2014 provide Authorization: Bearer <token>" });
2733
+ }
2720
2734
  }
2721
- const watched = {
2722
- id: trace.id,
2723
- rootNodeId: Object.keys(trace.nodes)[0] ?? "",
2724
- agentId: trace.agentId,
2725
- name: trace.name,
2726
- trigger: trace.trigger,
2727
- startTime: trace.startTime,
2728
- endTime: trace.endTime,
2729
- status: trace.status,
2730
- nodes,
2731
- edges: [],
2732
- events: [],
2733
- metadata: { ...trace.metadata, adapterSource: "otel" },
2734
- sessionEvents: [],
2735
- sourceType: "session",
2736
- filename: `otel-${trace.id}`,
2737
- lastModified: Date.now(),
2738
- sourceDir: "http-collector"
2739
- };
2740
- this.watcher.traces.set(`otel:${trace.id}`, watched);
2741
- ingested++;
2742
- }
2743
- if (ingested > 0) {
2744
- this.broadcast({ type: "traces-updated", count: ingested });
2735
+ const traces = parseOtlpPayload(req.body);
2736
+ let ingested = 0;
2737
+ for (const trace of traces) {
2738
+ const nodes = /* @__PURE__ */ new Map();
2739
+ for (const [id, node] of Object.entries(trace.nodes)) {
2740
+ nodes.set(id, { ...node, state: {} });
2741
+ }
2742
+ const watched = {
2743
+ id: trace.id,
2744
+ rootNodeId: Object.keys(trace.nodes)[0] ?? "",
2745
+ agentId: trace.agentId,
2746
+ name: trace.name,
2747
+ trigger: trace.trigger,
2748
+ startTime: trace.startTime,
2749
+ endTime: trace.endTime,
2750
+ status: trace.status,
2751
+ nodes,
2752
+ edges: [],
2753
+ events: [],
2754
+ metadata: { ...trace.metadata, adapterSource: "otel" },
2755
+ sessionEvents: [],
2756
+ sourceType: "session",
2757
+ filename: `otel-${trace.id}`,
2758
+ lastModified: Date.now(),
2759
+ sourceDir: "http-collector"
2760
+ };
2761
+ this.watcher.traces.set(`otel:${trace.id}`, watched);
2762
+ ingested++;
2763
+ }
2764
+ if (ingested > 0) {
2765
+ this.broadcast({ type: "traces-updated", count: ingested });
2766
+ }
2767
+ res.json({ ok: true, tracesIngested: ingested });
2768
+ } catch (error) {
2769
+ console.error("OTLP collector error:", error);
2770
+ res.status(400).json({ error: "Failed to parse OTLP payload" });
2745
2771
  }
2746
- res.json({ ok: true, tracesIngested: ingested });
2747
- } catch (error) {
2748
- console.error("OTLP collector error:", error);
2749
- res.status(400).json({ error: "Failed to parse OTLP payload" });
2750
- }
2751
- });
2772
+ });
2773
+ }
2752
2774
  this.app.get("/health", (_req, res) => {
2753
2775
  res.json({
2754
2776
  status: "ok",
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  AgentStats,
4
4
  DashboardServer,
5
5
  TraceWatcher
6
- } from "./chunk-GA2Y6E62.js";
6
+ } from "./chunk-3S4AAIPA.js";
7
7
  export {
8
8
  AgentStats,
9
9
  DashboardServer,
package/dist/server.cjs CHANGED
@@ -2078,11 +2078,23 @@ async function startDashboard() {
2078
2078
  case "--cors":
2079
2079
  config.enableCors = true;
2080
2080
  break;
2081
+ case "--no-collector":
2082
+ config.enableCollector = false;
2083
+ break;
2084
+ case "--collector-token":
2085
+ config.collectorAuthToken = args[++i];
2086
+ break;
2081
2087
  case "--help":
2082
2088
  printHelp();
2083
2089
  process.exit(0);
2084
2090
  }
2085
2091
  }
2092
+ if (!config.collectorAuthToken && process.env.AGENTFLOW_COLLECTOR_TOKEN) {
2093
+ config.collectorAuthToken = process.env.AGENTFLOW_COLLECTOR_TOKEN;
2094
+ }
2095
+ if (process.env.AGENTFLOW_NO_COLLECTOR === "true") {
2096
+ config.enableCollector = false;
2097
+ }
2086
2098
  const tracesPath = path2.resolve(config.tracesDir);
2087
2099
  if (!fs2.existsSync(tracesPath)) {
2088
2100
  fs2.mkdirSync(tracesPath, { recursive: true });
@@ -2125,6 +2137,8 @@ Options:
2125
2137
  -h, --host <address> Host address (default: localhost)
2126
2138
  --data-dir <path> Extra data directory for process discovery (repeatable)
2127
2139
  --cors Enable CORS headers
2140
+ --no-collector Disable OTLP trace collector (POST /v1/traces)
2141
+ --collector-token <tok> Require auth token for collector (or set AGENTFLOW_COLLECTOR_TOKEN)
2128
2142
  --help Show this help message
2129
2143
 
2130
2144
  Examples:
@@ -2704,46 +2718,54 @@ var DashboardServer = class {
2704
2718
  res.status(500).json({ error: "Failed to update directory config" });
2705
2719
  }
2706
2720
  });
2707
- this.app.post("/v1/traces", import_express.default.json({ limit: "10mb" }), (req, res) => {
2708
- try {
2709
- const traces = parseOtlpPayload(req.body);
2710
- let ingested = 0;
2711
- for (const trace of traces) {
2712
- const nodes = /* @__PURE__ */ new Map();
2713
- for (const [id, node] of Object.entries(trace.nodes)) {
2714
- nodes.set(id, { ...node, state: {} });
2721
+ if (this.config.enableCollector !== false) {
2722
+ this.app.post("/v1/traces", import_express.default.json({ limit: "10mb" }), (req, res) => {
2723
+ try {
2724
+ if (this.config.collectorAuthToken) {
2725
+ const auth = req.headers.authorization;
2726
+ if (!auth || auth !== `Bearer ${this.config.collectorAuthToken}`) {
2727
+ return res.status(401).json({ error: "Unauthorized \u2014 provide Authorization: Bearer <token>" });
2728
+ }
2715
2729
  }
2716
- const watched = {
2717
- id: trace.id,
2718
- rootNodeId: Object.keys(trace.nodes)[0] ?? "",
2719
- agentId: trace.agentId,
2720
- name: trace.name,
2721
- trigger: trace.trigger,
2722
- startTime: trace.startTime,
2723
- endTime: trace.endTime,
2724
- status: trace.status,
2725
- nodes,
2726
- edges: [],
2727
- events: [],
2728
- metadata: { ...trace.metadata, adapterSource: "otel" },
2729
- sessionEvents: [],
2730
- sourceType: "session",
2731
- filename: `otel-${trace.id}`,
2732
- lastModified: Date.now(),
2733
- sourceDir: "http-collector"
2734
- };
2735
- this.watcher.traces.set(`otel:${trace.id}`, watched);
2736
- ingested++;
2737
- }
2738
- if (ingested > 0) {
2739
- this.broadcast({ type: "traces-updated", count: ingested });
2730
+ const traces = parseOtlpPayload(req.body);
2731
+ let ingested = 0;
2732
+ for (const trace of traces) {
2733
+ const nodes = /* @__PURE__ */ new Map();
2734
+ for (const [id, node] of Object.entries(trace.nodes)) {
2735
+ nodes.set(id, { ...node, state: {} });
2736
+ }
2737
+ const watched = {
2738
+ id: trace.id,
2739
+ rootNodeId: Object.keys(trace.nodes)[0] ?? "",
2740
+ agentId: trace.agentId,
2741
+ name: trace.name,
2742
+ trigger: trace.trigger,
2743
+ startTime: trace.startTime,
2744
+ endTime: trace.endTime,
2745
+ status: trace.status,
2746
+ nodes,
2747
+ edges: [],
2748
+ events: [],
2749
+ metadata: { ...trace.metadata, adapterSource: "otel" },
2750
+ sessionEvents: [],
2751
+ sourceType: "session",
2752
+ filename: `otel-${trace.id}`,
2753
+ lastModified: Date.now(),
2754
+ sourceDir: "http-collector"
2755
+ };
2756
+ this.watcher.traces.set(`otel:${trace.id}`, watched);
2757
+ ingested++;
2758
+ }
2759
+ if (ingested > 0) {
2760
+ this.broadcast({ type: "traces-updated", count: ingested });
2761
+ }
2762
+ res.json({ ok: true, tracesIngested: ingested });
2763
+ } catch (error) {
2764
+ console.error("OTLP collector error:", error);
2765
+ res.status(400).json({ error: "Failed to parse OTLP payload" });
2740
2766
  }
2741
- res.json({ ok: true, tracesIngested: ingested });
2742
- } catch (error) {
2743
- console.error("OTLP collector error:", error);
2744
- res.status(400).json({ error: "Failed to parse OTLP payload" });
2745
- }
2746
- });
2767
+ });
2768
+ }
2747
2769
  this.app.get("/health", (_req, res) => {
2748
2770
  res.json({
2749
2771
  status: "ok",
package/dist/server.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DashboardServer
3
- } from "./chunk-GA2Y6E62.js";
3
+ } from "./chunk-3S4AAIPA.js";
4
4
  export {
5
5
  DashboardServer
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentflow-dashboard",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Real-time monitoring dashboard for AgentFlow - Visualize agent execution graphs and performance",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",