@frumu/tandem-panel 0.4.14 → 0.4.15

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/.env.example CHANGED
@@ -70,3 +70,20 @@ TANDEM_SEARCH_TIMEOUT_MS=10000
70
70
 
71
71
  # Session TTL in minutes
72
72
  TANDEM_CONTROL_PANEL_SESSION_TTL_MINUTES=1440
73
+
74
+ # ─── ACA Integration ─────────────────────────────────────────────────
75
+ # Optional external ACA base URL. Leave blank to disable ACA integration.
76
+ # When set, the control panel probes this URL on startup and exposes it via
77
+ # /api/capabilities as aca_integration.
78
+ # Example: ACA_BASE_URL=http://127.0.0.1:39735
79
+ ACA_BASE_URL=
80
+
81
+ # Path on ACA_BASE_URL to use for health/status probe (default: /health)
82
+ ACA_HEALTH_PATH=/health
83
+
84
+ # Probe timeout in milliseconds. Probes that take longer return "aca_probe_timeout".
85
+ ACA_PROBE_TIMEOUT_MS=5000
86
+
87
+ # How long to cache capability probe results, in milliseconds (default: 45000 = 45 s).
88
+ # Set lower for faster ACA availability detection, higher to reduce probe frequency.
89
+ ACA_CAPABILITY_CACHE_TTL_MS=45000
package/bin/setup.js CHANGED
@@ -12,7 +12,8 @@ import { fileURLToPath } from "url";
12
12
  import { createRequire } from "module";
13
13
  import { homedir } from "os";
14
14
  import { ensureBootstrapEnv, resolveEnvLoadOrder } from "../lib/setup/env.js";
15
- import { createSwarmApiHandler } from "../server/routes/swarm.js";
15
+ import { createSwarmApiHandler, getOrchestratorMetrics } from "../server/routes/swarm.js";
16
+ import { createCapabilitiesHandler, getCapabilitiesMetrics } from "../server/routes/capabilities.js";
16
17
 
17
18
  function parseDotEnv(content) {
18
19
  const out = {};
@@ -4519,6 +4520,18 @@ const handleSwarmApi = createSwarmApiHandler({
4519
4520
  setActiveSwarmRunId,
4520
4521
  });
4521
4522
 
4523
+ const handleCapabilities = createCapabilitiesHandler({
4524
+ PROBE_TIMEOUT_MS: Number.parseInt(process.env.ACA_PROBE_TIMEOUT_MS || "5000", 10),
4525
+ ACA_BASE_URL: process.env.ACA_BASE_URL || "",
4526
+ ACA_HEALTH_PATH: "/health",
4527
+ engineHealth: async (token) => {
4528
+ const health = await engineHealth(token).catch(() => null);
4529
+ return health;
4530
+ },
4531
+ sendJson,
4532
+ cacheTtlMs: Number.parseInt(process.env.ACA_CAPABILITY_CACHE_TTL_MS || "45000", 10),
4533
+ });
4534
+
4522
4535
  async function handleApi(req, res) {
4523
4536
  const pathname = new URL(req.url, `http://127.0.0.1:${PORTAL_PORT}`).pathname;
4524
4537
 
@@ -4534,6 +4547,21 @@ async function handleApi(req, res) {
4534
4547
  return true;
4535
4548
  }
4536
4549
 
4550
+ if (pathname === "/api/capabilities" && req.method === "GET") {
4551
+ await handleCapabilities(req, res);
4552
+ return true;
4553
+ }
4554
+
4555
+ if (pathname === "/api/capabilities/metrics" && req.method === "GET") {
4556
+ sendJson(res, 200, getCapabilitiesMetrics());
4557
+ return true;
4558
+ }
4559
+
4560
+ if (pathname === "/api/system/orchestrator-metrics" && req.method === "GET") {
4561
+ sendJson(res, 200, getOrchestratorMetrics());
4562
+ return true;
4563
+ }
4564
+
4537
4565
  if (pathname === "/api/system/search-settings" && req.method === "GET") {
4538
4566
  const session = requireSession(req, res);
4539
4567
  if (!session) return true;