@frumu/tandem-panel 0.4.19 → 0.4.22
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/bin/setup.js +38 -1
- package/dist/assets/index-CpyzoZ3L.js +2911 -0
- package/dist/assets/index-D4TNrMtB.css +1 -0
- package/dist/assets/{react-query-BiFBqyAt.js → react-query-DtPmeC_c.js} +1 -1
- package/dist/assets/{vendor-Q0KoFXrG.js → vendor-UNKt3GY8.js} +49 -49
- package/dist/index.html +4 -4
- package/lib/automations/workflow-list.js +147 -0
- package/lib/setup/control-panel-preferences.js +125 -0
- package/lib/setup/control-panel-principal.js +60 -0
- package/package.json +3 -3
- package/server/routes/control-panel-preferences.js +97 -0
- package/src/generated/agent-catalog.json +148 -148
- package/dist/assets/index-7omBpQ9G.js +0 -2900
- package/dist/assets/index-B_avj5aY.css +0 -1
package/bin/setup.js
CHANGED
|
@@ -18,10 +18,13 @@ import {
|
|
|
18
18
|
resolveControlPanelMode,
|
|
19
19
|
summarizeControlPanelConfig,
|
|
20
20
|
} from "../lib/setup/control-panel-config.js";
|
|
21
|
+
import { resolveControlPanelPrincipalIdentity } from "../lib/setup/control-panel-principal.js";
|
|
22
|
+
import { resolveControlPanelPreferencesPath } from "../lib/setup/control-panel-preferences.js";
|
|
21
23
|
import { createSwarmApiHandler, getOrchestratorMetrics } from "../server/routes/swarm.js";
|
|
22
24
|
import { createAcaApiHandler } from "../server/routes/aca.js";
|
|
23
25
|
import { createCapabilitiesHandler, getCapabilitiesMetrics } from "../server/routes/capabilities.js";
|
|
24
26
|
import { createControlPanelConfigHandler } from "../server/routes/control-panel-config.js";
|
|
27
|
+
import { createControlPanelPreferencesHandler } from "../server/routes/control-panel-preferences.js";
|
|
25
28
|
|
|
26
29
|
function parseDotEnv(content) {
|
|
27
30
|
const out = {};
|
|
@@ -190,6 +193,11 @@ const ACA_BASE_URL = String(process.env.ACA_BASE_URL || "")
|
|
|
190
193
|
.trim()
|
|
191
194
|
.replace(/\/+$/, "");
|
|
192
195
|
const CONTROL_PANEL_CONFIG_FILE = String(process.env.TANDEM_CONTROL_PANEL_CONFIG_FILE || "").trim();
|
|
196
|
+
const CONTROL_PANEL_PREFERENCES_FILE = resolveControlPanelPreferencesPath({
|
|
197
|
+
env: process.env,
|
|
198
|
+
explicitPath: String(process.env.TANDEM_CONTROL_PANEL_PREFERENCES_FILE || "").trim(),
|
|
199
|
+
stateDir: process.env.TANDEM_CONTROL_PANEL_STATE_DIR,
|
|
200
|
+
});
|
|
193
201
|
const CONTROL_PANEL_MODE = String(process.env.TANDEM_CONTROL_PANEL_MODE || "auto").trim();
|
|
194
202
|
const DEFAULT_TANDEM_SEARCH_URL = (
|
|
195
203
|
process.env.TANDEM_SEARCH_URL || "https://search.tandem.ac"
|
|
@@ -1759,7 +1767,13 @@ async function handleAuthLogin(req, res) {
|
|
|
1759
1767
|
}
|
|
1760
1768
|
}
|
|
1761
1769
|
const sid = randomBytes(24).toString("hex");
|
|
1762
|
-
|
|
1770
|
+
const principal = resolveControlPanelPrincipalIdentity({ token });
|
|
1771
|
+
sessions.set(sid, {
|
|
1772
|
+
token,
|
|
1773
|
+
createdAt: Date.now(),
|
|
1774
|
+
lastSeenAt: Date.now(),
|
|
1775
|
+
...principal,
|
|
1776
|
+
});
|
|
1763
1777
|
setSessionCookie(res, sid);
|
|
1764
1778
|
sendJson(res, 200, {
|
|
1765
1779
|
ok: true,
|
|
@@ -1769,6 +1783,9 @@ async function handleAuthLogin(req, res) {
|
|
|
1769
1783
|
version: health.version || "unknown",
|
|
1770
1784
|
local: isLocalEngineUrl(ENGINE_URL),
|
|
1771
1785
|
},
|
|
1786
|
+
principal_id: principal.principal_id,
|
|
1787
|
+
principal_source: principal.principal_source,
|
|
1788
|
+
principal_scope: principal.principal_scope,
|
|
1772
1789
|
});
|
|
1773
1790
|
} catch (e) {
|
|
1774
1791
|
sendJson(res, 400, { ok: false, error: e instanceof Error ? e.message : String(e) });
|
|
@@ -4759,6 +4776,14 @@ const handleControlPanelConfig = createControlPanelConfigHandler({
|
|
|
4759
4776
|
readJsonBody,
|
|
4760
4777
|
});
|
|
4761
4778
|
|
|
4779
|
+
const handleControlPanelPreferences = createControlPanelPreferencesHandler({
|
|
4780
|
+
CONTROL_PANEL_PREFERENCES_FILE,
|
|
4781
|
+
TANDEM_CONTROL_PANEL_STATE_DIR: process.env.TANDEM_CONTROL_PANEL_STATE_DIR || "",
|
|
4782
|
+
resolvePrincipalIdentity: resolveControlPanelPrincipalIdentity,
|
|
4783
|
+
sendJson,
|
|
4784
|
+
readJsonBody,
|
|
4785
|
+
});
|
|
4786
|
+
|
|
4762
4787
|
async function handleApi(req, res) {
|
|
4763
4788
|
const pathname = new URL(req.url, `http://127.0.0.1:${PORTAL_PORT}`).pathname;
|
|
4764
4789
|
|
|
@@ -4914,10 +4939,22 @@ async function handleApi(req, res) {
|
|
|
4914
4939
|
engineUrl: ENGINE_URL,
|
|
4915
4940
|
localEngine: isLocalEngineUrl(ENGINE_URL),
|
|
4916
4941
|
engine: health,
|
|
4942
|
+
principal_id: String(session.principal_id || session.principalId || ""),
|
|
4943
|
+
principal_source: String(session.principal_source || session.principalSource || "unknown"),
|
|
4944
|
+
principal_scope: String(session.principal_scope || session.principalScope || "global"),
|
|
4917
4945
|
});
|
|
4918
4946
|
return true;
|
|
4919
4947
|
}
|
|
4920
4948
|
|
|
4949
|
+
if (
|
|
4950
|
+
pathname === "/api/control-panel/preferences" &&
|
|
4951
|
+
(req.method === "GET" || req.method === "PATCH")
|
|
4952
|
+
) {
|
|
4953
|
+
const session = requireSession(req, res);
|
|
4954
|
+
if (!session) return true;
|
|
4955
|
+
return handleControlPanelPreferences(req, res, session);
|
|
4956
|
+
}
|
|
4957
|
+
|
|
4921
4958
|
if (pathname === "/api/control-panel/config" && (req.method === "GET" || req.method === "PATCH")) {
|
|
4922
4959
|
const session = requireSession(req, res);
|
|
4923
4960
|
if (!session) return true;
|