@enigmax/dashboard 0.1.10 → 0.1.12
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/assets/index.html +53 -14
- package/package.json +1 -1
package/assets/index.html
CHANGED
|
@@ -205,6 +205,7 @@
|
|
|
205
205
|
<h2>Enigma Systems <small>what's active - configuration, not savings</small></h2>
|
|
206
206
|
<div class="ctrls">
|
|
207
207
|
<button id="refreshBtn" type="button" class="toggle">Refresh</button>
|
|
208
|
+
<button id="fixPathBtn" type="button" class="toggle">Fix tool paths</button>
|
|
208
209
|
<button id="updateBtn" type="button" class="toggle on">Check & update</button>
|
|
209
210
|
</div>
|
|
210
211
|
</div>
|
|
@@ -545,21 +546,36 @@
|
|
|
545
546
|
const reset = w.kind === "session"
|
|
546
547
|
? (w.resetsAt ? "Resets " + fmtResetIn(w.resetsAt) : "No active session")
|
|
547
548
|
: (w.resetsAt ? fmtResetAt(w.resetsAt) : "");
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
549
|
+
const live = w.live ? ' <span class="tag meas">live</span>' : "";
|
|
550
|
+
const span = w.kind === "session" ? 5 * 3600000 : 7 * 86400000;
|
|
551
|
+
const head = '<div class="wcard"><div class="wtitle">' + esc(w.label) + live + '</div><div class="wreset">' + esc(reset) + '</div>';
|
|
552
|
+
if (sub === "weeklySonnet" && (w.used || 0) === 0 && w.pct == null) {
|
|
553
|
+
return head + '<div class="wval muted">You haven\'t used Sonnet yet</div></div>';
|
|
554
|
+
}
|
|
555
|
+
// Every card shows a bar: the real usage % when known (live or vs a set limit),
|
|
556
|
+
// otherwise how much of the window has elapsed in time - so the weekly card has a
|
|
557
|
+
// bar even before the proxy has captured live limits.
|
|
558
|
+
let barPct, barCol, barNote, valLine;
|
|
559
|
+
if (w.pct != null) {
|
|
560
|
+
barPct = Math.min(100, w.pct);
|
|
561
|
+
barCol = w.pct >= 90 ? "var(--accent2)" : "var(--accent)";
|
|
562
|
+
barNote = (w.live ? "live · " : "") + fmt(w.used || 0) + " tok";
|
|
563
|
+
valLine = Math.round(w.pct) + "% used";
|
|
564
|
+
} else if (w.resetsAt) {
|
|
565
|
+
const start = w.resetsAt - span;
|
|
566
|
+
barPct = Math.max(0, Math.min(100, (Date.now() - start) / span * 100));
|
|
567
|
+
barCol = "var(--muted)";
|
|
568
|
+
barNote = "window " + Math.round(barPct) + "% elapsed";
|
|
569
|
+
valLine = fmt(w.used || 0) + " tok";
|
|
556
570
|
} else {
|
|
557
|
-
|
|
558
|
-
+ '<div class="wset"><input type="number" min="0" class="wlimit" data-plan="' + sub + '" placeholder="set limit (tokens)">'
|
|
559
|
-
+ '<button type="button" class="laddb" data-plan="' + sub + '">Set</button></div>';
|
|
571
|
+
barPct = 0; barCol = "var(--muted)"; barNote = ""; valLine = fmt(w.used || 0) + " tok";
|
|
560
572
|
}
|
|
561
|
-
const
|
|
562
|
-
|
|
573
|
+
const bar = '<div class="bar-track" style="margin-top:8px"><div class="bar-fill" style="width:' + barPct + '%;background:' + barCol + '"></div></div>'
|
|
574
|
+
+ (barNote ? '<div class="wreset" style="margin-top:4px">' + esc(barNote) + "</div>" : "");
|
|
575
|
+
const setter = w.pct == null
|
|
576
|
+
? '<div class="wset"><input type="number" min="0" class="wlimit" data-plan="' + sub + '" placeholder="set limit for %"><button type="button" class="laddb" data-plan="' + sub + '">Set</button></div>'
|
|
577
|
+
: "";
|
|
578
|
+
return head + '<div class="wval">' + valLine + "</div>" + bar + setter + "</div>";
|
|
563
579
|
}
|
|
564
580
|
function renderWindows(u) {
|
|
565
581
|
const w = u && u.windows;
|
|
@@ -994,7 +1010,17 @@
|
|
|
994
1010
|
+ item("Local dashboard", pill(s.dashboard === "off" ? "off" : "lvl", s.dashboard || "off"))
|
|
995
1011
|
+ item("Permission bypass (security)", boolPill(sec.permissionBypass))
|
|
996
1012
|
+ item("Commit guard blocks", guard || '<span class="tag">set up with enigma security</span>')
|
|
997
|
-
+ item("Skills", skillTags)
|
|
1013
|
+
+ item("Skills", skillTags)
|
|
1014
|
+
+ item("Tool launch paths", toolPathTags(s.tools));
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
// Per-tool launch-path status: green when launchable, yellow when off PATH, red when missing.
|
|
1018
|
+
function toolPathTags(tools) {
|
|
1019
|
+
if (!tools || !tools.length) return '<span class="tag">unknown</span>';
|
|
1020
|
+
return tools.map((t) => {
|
|
1021
|
+
const cls = t.status === "not installed" ? "warn" : (t.status === "installed, off PATH" ? "ext" : "");
|
|
1022
|
+
return '<span class="tag ' + cls + '">' + esc(t.label) + ": " + esc(t.status) + "</span>";
|
|
1023
|
+
}).join("");
|
|
998
1024
|
}
|
|
999
1025
|
|
|
1000
1026
|
async function runUpdate() {
|
|
@@ -1010,6 +1036,18 @@
|
|
|
1010
1036
|
} catch { $("updateNote").textContent = "Could not reach the server to update."; }
|
|
1011
1037
|
}
|
|
1012
1038
|
|
|
1039
|
+
// Detect & repair every tool's launch path; the server persists any off-PATH
|
|
1040
|
+
// binary so `enigma <tool>` works, and returns the refreshed status.
|
|
1041
|
+
async function runFixPath() {
|
|
1042
|
+
$("updateNote").textContent = "Detecting tool paths...";
|
|
1043
|
+
try {
|
|
1044
|
+
const res = await fetch("/api/fix-path", { method: "POST", headers: { "Content-Type": "application/json" }, body: "{}" });
|
|
1045
|
+
const out = await res.json();
|
|
1046
|
+
$("updateNote").textContent = (out.lines || []).join(" ") || (out.ok ? "Tool paths OK." : "Could not fix all tools.");
|
|
1047
|
+
loadSystems(true);
|
|
1048
|
+
} catch { $("updateNote").textContent = "Could not reach the server to fix tool paths."; }
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1013
1051
|
async function loadSystems(force) {
|
|
1014
1052
|
if (!live && !force) return;
|
|
1015
1053
|
try {
|
|
@@ -1268,6 +1306,7 @@
|
|
|
1268
1306
|
$("cfgExport").addEventListener("click", exportConfig);
|
|
1269
1307
|
$("cfgImport").addEventListener("click", importConfig);
|
|
1270
1308
|
$("updateBtn").addEventListener("click", runUpdate);
|
|
1309
|
+
$("fixPathBtn").addEventListener("click", runFixPath);
|
|
1271
1310
|
$("refreshBtn").addEventListener("click", () => refreshAll(true));
|
|
1272
1311
|
window.addEventListener("hashchange", route);
|
|
1273
1312
|
route();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enigmax/dashboard",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "Local browser dashboard UI for enigma: the static page and chart assets enigma serves on its loopback dashboard (savings, real tool usage, in-browser settings). Installed on demand by enigma-cli; not a runtime dependency.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|