dsh-decision-layer 0.5.2 → 0.5.3
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/README.en.md +2 -2
- package/README.md +2 -2
- package/lib/client.js +284 -324
- package/package.json +1 -1
- package/service/manager-api.mjs +11 -2
- package/service/narrowing.mjs +18 -6
- package/service/self-check.mjs +9 -16
- package/service/steer-once.mjs +25 -0
- package/service/task-completion.mjs +17 -19
package/lib/client.js
CHANGED
|
@@ -569,6 +569,37 @@ function DecisionLogList({ entries, ratings, onRate, t, newestFirst = true }) {
|
|
|
569
569
|
] }, entry.id ?? `${entry.at}-${index}`)) });
|
|
570
570
|
}
|
|
571
571
|
|
|
572
|
+
// src/client/cards.tsx
|
|
573
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
574
|
+
function CardHead({ title, total, unit, rate }) {
|
|
575
|
+
const totalSpan = /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "decision-card-total", children: [
|
|
576
|
+
total,
|
|
577
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("small", { children: unit })
|
|
578
|
+
] });
|
|
579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("header", { className: "decision-card-head", children: [
|
|
580
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "decision-card-title", children: title }),
|
|
581
|
+
rate ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "decision-card-head-metrics", children: [
|
|
582
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "decision-card-rate-inline", children: [
|
|
583
|
+
rate.label,
|
|
584
|
+
" ",
|
|
585
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("b", { children: rate.value })
|
|
586
|
+
] }),
|
|
587
|
+
totalSpan
|
|
588
|
+
] }) : totalSpan
|
|
589
|
+
] });
|
|
590
|
+
}
|
|
591
|
+
function Stat({ label, value, pct, tone }) {
|
|
592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "decision-stat", children: [
|
|
593
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: `decision-stat-num${tone ? ` decision-stat-${tone}` : ""}`, children: value }),
|
|
594
|
+
typeof pct === "number" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "decision-stat-pct", children: [
|
|
595
|
+
pct,
|
|
596
|
+
"%"
|
|
597
|
+
] }),
|
|
598
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "decision-stat-label", children: label })
|
|
599
|
+
] });
|
|
600
|
+
}
|
|
601
|
+
var share = (n, total) => total > 0 ? Math.round(n / total * 100) : null;
|
|
602
|
+
|
|
572
603
|
// src/client/use-annotations.ts
|
|
573
604
|
var import_react = require("react");
|
|
574
605
|
function useAnnotations(sessionId, onFail) {
|
|
@@ -577,7 +608,11 @@ function useAnnotations(sessionId, onFail) {
|
|
|
577
608
|
setRatings(analysis?.ratings ?? {});
|
|
578
609
|
}, []);
|
|
579
610
|
const annotate = (0, import_react.useCallback)(async (id, rating) => {
|
|
580
|
-
|
|
611
|
+
let previous;
|
|
612
|
+
setRatings((prev) => {
|
|
613
|
+
previous = prev[id];
|
|
614
|
+
return { ...prev, [id]: rating };
|
|
615
|
+
});
|
|
581
616
|
try {
|
|
582
617
|
await request("annotate", {
|
|
583
618
|
method: "POST",
|
|
@@ -588,7 +623,8 @@ function useAnnotations(sessionId, onFail) {
|
|
|
588
623
|
onFail();
|
|
589
624
|
setRatings((prev) => {
|
|
590
625
|
const next = { ...prev };
|
|
591
|
-
delete next[id];
|
|
626
|
+
if (previous === void 0) delete next[id];
|
|
627
|
+
else next[id] = previous;
|
|
592
628
|
return next;
|
|
593
629
|
});
|
|
594
630
|
}
|
|
@@ -597,23 +633,27 @@ function useAnnotations(sessionId, onFail) {
|
|
|
597
633
|
}
|
|
598
634
|
|
|
599
635
|
// src/client/panel.tsx
|
|
600
|
-
var
|
|
636
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
601
637
|
function DecisionPanel(props) {
|
|
602
|
-
return /* @__PURE__ */ (0,
|
|
638
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SessionPanel, { ...props }, props.sessionId);
|
|
603
639
|
}
|
|
604
640
|
function Bar({ allow, ask, deny }) {
|
|
605
641
|
const total = allow + ask + deny;
|
|
606
|
-
if (total === 0) return /* @__PURE__ */ (0,
|
|
642
|
+
if (total === 0) return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "decision-bar decision-bar-empty", "aria-hidden": "true" });
|
|
607
643
|
const pct = (n) => `${n / total * 100}%`;
|
|
608
|
-
return /* @__PURE__ */ (0,
|
|
609
|
-
allow > 0 && /* @__PURE__ */ (0,
|
|
610
|
-
ask > 0 && /* @__PURE__ */ (0,
|
|
611
|
-
deny > 0 && /* @__PURE__ */ (0,
|
|
644
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "decision-bar", "aria-hidden": "true", children: [
|
|
645
|
+
allow > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "decision-bar-allow", style: { width: pct(allow) } }),
|
|
646
|
+
ask > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "decision-bar-ask", style: { width: pct(ask) } }),
|
|
647
|
+
deny > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "decision-bar-deny", style: { width: pct(deny) } })
|
|
612
648
|
] });
|
|
613
649
|
}
|
|
614
650
|
function SessionPanel({ sessionId, t }) {
|
|
615
651
|
const dialog = (0, import_react2.useRef)(null);
|
|
616
652
|
const trigger = (0, import_react2.useRef)(null);
|
|
653
|
+
const mounted = (0, import_react2.useRef)(true);
|
|
654
|
+
(0, import_react2.useEffect)(() => () => {
|
|
655
|
+
mounted.current = false;
|
|
656
|
+
}, []);
|
|
617
657
|
const [open, setOpen] = (0, import_react2.useState)(false);
|
|
618
658
|
const [enabled, setEnabled] = (0, import_react2.useState)(null);
|
|
619
659
|
const [busy, setBusy] = (0, import_react2.useState)(false);
|
|
@@ -637,13 +677,12 @@ function SessionPanel({ sessionId, t }) {
|
|
|
637
677
|
live = false;
|
|
638
678
|
};
|
|
639
679
|
}, [sessionId, t]);
|
|
640
|
-
const checkStatus = (
|
|
680
|
+
const checkStatus = () => {
|
|
641
681
|
setStatus("checking");
|
|
642
682
|
void request("probe", { method: "POST" }).then((value) => {
|
|
643
|
-
if (
|
|
644
|
-
setStatus(value.connected ? "ok" : "down");
|
|
683
|
+
if (mounted.current) setStatus(value.connected ? "ok" : "down");
|
|
645
684
|
}).catch(() => {
|
|
646
|
-
if (
|
|
685
|
+
if (mounted.current) setStatus("down");
|
|
647
686
|
});
|
|
648
687
|
};
|
|
649
688
|
(0, import_react2.useEffect)(() => {
|
|
@@ -669,7 +708,7 @@ function SessionPanel({ sessionId, t }) {
|
|
|
669
708
|
alive = false;
|
|
670
709
|
element.close();
|
|
671
710
|
};
|
|
672
|
-
}, [open,
|
|
711
|
+
}, [open, sessionId, seed]);
|
|
673
712
|
const updateEnabled = async (next) => {
|
|
674
713
|
setBusy(true);
|
|
675
714
|
try {
|
|
@@ -685,7 +724,6 @@ function SessionPanel({ sessionId, t }) {
|
|
|
685
724
|
setBusy(false);
|
|
686
725
|
}
|
|
687
726
|
};
|
|
688
|
-
const time2 = (at) => new Date(at).toLocaleTimeString();
|
|
689
727
|
const statusLabel = status === "ok" ? t("statusOk") : status === "down" ? t("statusDown") : status === "checking" ? t("statusChecking") : t("statusIdle");
|
|
690
728
|
const attempts = metrics?.attempts ?? 0;
|
|
691
729
|
const severity = metrics?.check?.trend?.severity ?? "normal";
|
|
@@ -694,19 +732,19 @@ function SessionPanel({ sessionId, t }) {
|
|
|
694
732
|
const checkPassRate = metrics?.check && checkValid > 0 ? Math.round((checkValid - metrics.check.low) / checkValid * 100) : null;
|
|
695
733
|
const narrowValid = metrics?.narrow ? metrics.narrow.attempts - metrics.narrow.failures : 0;
|
|
696
734
|
const narrowApplyRate = metrics?.narrow && narrowValid > 0 ? Math.round(metrics.narrow.applied / narrowValid * 100) : null;
|
|
697
|
-
return /* @__PURE__ */ (0,
|
|
698
|
-
/* @__PURE__ */ (0,
|
|
699
|
-
/* @__PURE__ */ (0,
|
|
700
|
-
/* @__PURE__ */ (0,
|
|
701
|
-
/* @__PURE__ */ (0,
|
|
735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
736
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("button", { ref: trigger, className: `decision-trigger decision-trend-${severity}`, type: "button", "aria-haspopup": "dialog", "aria-expanded": open, "aria-busy": enabled === null, "aria-label": t("button"), title: trendTitle, onClick: () => setOpen(true), children: [
|
|
737
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { className: "decision-trigger-icon", width: "15", height: "15", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
738
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "8", cy: "8", r: "6.4", stroke: "currentColor", "stroke-width": "1.3" }),
|
|
739
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M8 4.6 11.3 11H4.7L8 4.6Z", fill: "currentColor", stroke: "none" })
|
|
702
740
|
] }),
|
|
703
|
-
/* @__PURE__ */ (0,
|
|
741
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "decision-trigger-text", children: [
|
|
704
742
|
t("triggerDecisions"),
|
|
705
743
|
" ",
|
|
706
|
-
/* @__PURE__ */ (0,
|
|
744
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("b", { children: attempts })
|
|
707
745
|
] })
|
|
708
746
|
] }),
|
|
709
|
-
/* @__PURE__ */ (0,
|
|
747
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
710
748
|
"dialog",
|
|
711
749
|
{
|
|
712
750
|
ref: dialog,
|
|
@@ -731,19 +769,19 @@ function SessionPanel({ sessionId, t }) {
|
|
|
731
769
|
trigger.current?.focus();
|
|
732
770
|
},
|
|
733
771
|
children: [
|
|
734
|
-
/* @__PURE__ */ (0,
|
|
735
|
-
/* @__PURE__ */ (0,
|
|
736
|
-
/* @__PURE__ */ (0,
|
|
772
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "decision-head", children: [
|
|
773
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { id: "decision-panel-title", children: t("title") }),
|
|
774
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", onClick: () => {
|
|
737
775
|
dialog.current?.close();
|
|
738
776
|
}, "aria-label": t("close"), children: "\xD7" })
|
|
739
777
|
] }),
|
|
740
|
-
/* @__PURE__ */ (0,
|
|
741
|
-
/* @__PURE__ */ (0,
|
|
742
|
-
enabled === null && /* @__PURE__ */ (0,
|
|
743
|
-
/* @__PURE__ */ (0,
|
|
744
|
-
/* @__PURE__ */ (0,
|
|
745
|
-
/* @__PURE__ */ (0,
|
|
746
|
-
/* @__PURE__ */ (0,
|
|
778
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "decision-body", children: [
|
|
779
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { children: [
|
|
780
|
+
enabled === null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { role: "status", children: t("loading") }),
|
|
781
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "decision-toggle", children: [
|
|
782
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "decision-toggle-text", children: t("enabled") }),
|
|
783
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "decision-toggle-box", children: [
|
|
784
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
747
785
|
"input",
|
|
748
786
|
{
|
|
749
787
|
className: "decision-toggle-input",
|
|
@@ -753,160 +791,118 @@ function SessionPanel({ sessionId, t }) {
|
|
|
753
791
|
onChange: (event) => void updateEnabled(event.target.checked)
|
|
754
792
|
}
|
|
755
793
|
),
|
|
756
|
-
/* @__PURE__ */ (0,
|
|
794
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "decision-toggle-track", "aria-hidden": "true" })
|
|
757
795
|
] })
|
|
758
796
|
] }),
|
|
759
|
-
/* @__PURE__ */ (0,
|
|
760
|
-
/* @__PURE__ */ (0,
|
|
761
|
-
/* @__PURE__ */ (0,
|
|
797
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "decision-status", children: [
|
|
798
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: `decision-status-dot decision-status-${status}`, "aria-hidden": "true" }),
|
|
799
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "decision-status-label", children: [
|
|
762
800
|
t("backendStatus"),
|
|
763
801
|
"\uFF1A",
|
|
764
802
|
statusLabel
|
|
765
803
|
] }),
|
|
766
|
-
/* @__PURE__ */ (0,
|
|
804
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "decision-status-recheck", disabled: status === "checking", onClick: () => checkStatus(), children: t("recheck") })
|
|
767
805
|
] })
|
|
768
806
|
] }),
|
|
769
|
-
/* @__PURE__ */ (0,
|
|
770
|
-
/* @__PURE__ */ (0,
|
|
771
|
-
!metrics?.gate && !metrics?.check && !metrics?.narrow && !metrics?.complete ? /* @__PURE__ */ (0,
|
|
772
|
-
metrics.gate && /* @__PURE__ */ (0,
|
|
773
|
-
/* @__PURE__ */ (0,
|
|
774
|
-
/* @__PURE__ */ (0,
|
|
775
|
-
/* @__PURE__ */ (0,
|
|
807
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { children: [
|
|
808
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { children: t("metrics") }),
|
|
809
|
+
!metrics?.gate && !metrics?.check && !metrics?.narrow && !metrics?.complete ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "decision-empty", role: "status", children: t("empty") }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "decision-cards", children: [
|
|
810
|
+
metrics.gate && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("article", { className: "decision-card decision-card-wide", children: [
|
|
811
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("header", { className: "decision-card-head", children: [
|
|
812
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "decision-card-title", children: t("cardGate") }),
|
|
813
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "decision-card-total", children: [
|
|
776
814
|
metrics.gate.attempts,
|
|
777
|
-
/* @__PURE__ */ (0,
|
|
815
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("small", { children: t("cardTimes") })
|
|
778
816
|
] })
|
|
779
817
|
] }),
|
|
780
|
-
/* @__PURE__ */ (0,
|
|
781
|
-
/* @__PURE__ */ (0,
|
|
782
|
-
/* @__PURE__ */ (0,
|
|
783
|
-
/* @__PURE__ */ (0,
|
|
818
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Bar, { allow: metrics.gate.allow, ask: metrics.gate.ask, deny: metrics.gate.deny }),
|
|
819
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("ul", { className: "decision-legend", children: [
|
|
820
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { children: [
|
|
821
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "decision-legend-dot decision-dot-allow", "aria-hidden": "true" }),
|
|
784
822
|
t("allow"),
|
|
785
|
-
/* @__PURE__ */ (0,
|
|
823
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("b", { children: metrics.gate.allow })
|
|
786
824
|
] }),
|
|
787
|
-
/* @__PURE__ */ (0,
|
|
788
|
-
/* @__PURE__ */ (0,
|
|
825
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { children: [
|
|
826
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "decision-legend-dot decision-dot-ask", "aria-hidden": "true" }),
|
|
789
827
|
t("ask"),
|
|
790
|
-
/* @__PURE__ */ (0,
|
|
828
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("b", { children: metrics.gate.ask })
|
|
791
829
|
] }),
|
|
792
|
-
/* @__PURE__ */ (0,
|
|
793
|
-
/* @__PURE__ */ (0,
|
|
830
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { children: [
|
|
831
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "decision-legend-dot decision-dot-deny", "aria-hidden": "true" }),
|
|
794
832
|
t("deny"),
|
|
795
|
-
/* @__PURE__ */ (0,
|
|
833
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("b", { children: metrics.gate.deny })
|
|
796
834
|
] })
|
|
797
835
|
] }),
|
|
798
|
-
/* @__PURE__ */ (0,
|
|
799
|
-
/* @__PURE__ */ (0,
|
|
836
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("footer", { className: "decision-card-foot", children: [
|
|
837
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { children: [
|
|
800
838
|
t("actualShort"),
|
|
801
|
-
/* @__PURE__ */ (0,
|
|
839
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("b", { children: [
|
|
802
840
|
metrics.gate.actual.allow,
|
|
803
841
|
" / ",
|
|
804
842
|
metrics.gate.actual.deny
|
|
805
843
|
] })
|
|
806
844
|
] }),
|
|
807
|
-
/* @__PURE__ */ (0,
|
|
845
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { children: [
|
|
808
846
|
t("failures"),
|
|
809
|
-
/* @__PURE__ */ (0,
|
|
847
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("b", { children: metrics.gate.failures })
|
|
810
848
|
] })
|
|
811
849
|
] })
|
|
812
850
|
] }),
|
|
813
|
-
metrics.check && /* @__PURE__ */ (0,
|
|
814
|
-
/* @__PURE__ */ (0,
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
] }),
|
|
828
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "decision-card-stats", children: [
|
|
829
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "decision-stat", children: [
|
|
830
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "decision-stat-num decision-stat-warn", children: metrics.check.low }),
|
|
831
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "decision-stat-label", children: t("checkLow") })
|
|
832
|
-
] }),
|
|
833
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "decision-stat", children: [
|
|
834
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "decision-stat-num", children: metrics.check.attempts - metrics.check.low - metrics.check.failures }),
|
|
835
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "decision-stat-label", children: t("checkOk") })
|
|
836
|
-
] }),
|
|
837
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "decision-stat", children: [
|
|
838
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "decision-stat-num decision-stat-muted", children: metrics.check.failures }),
|
|
839
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "decision-stat-label", children: t("failures") })
|
|
840
|
-
] })
|
|
851
|
+
metrics.check && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("article", { className: "decision-card", children: [
|
|
852
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
853
|
+
CardHead,
|
|
854
|
+
{
|
|
855
|
+
title: t("cardCheck"),
|
|
856
|
+
total: metrics.check.attempts,
|
|
857
|
+
unit: t("cardTimes"),
|
|
858
|
+
rate: { label: t("checkPassRate"), value: checkPassRate === null ? t("rateNa") : `${checkPassRate}%` }
|
|
859
|
+
}
|
|
860
|
+
),
|
|
861
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "decision-card-stats", children: [
|
|
862
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Stat, { label: t("checkLow"), value: metrics.check.low, tone: "warn" }),
|
|
863
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Stat, { label: t("checkOk"), value: metrics.check.attempts - metrics.check.low - metrics.check.failures }),
|
|
864
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Stat, { label: t("failures"), value: metrics.check.failures, tone: "muted" })
|
|
841
865
|
] })
|
|
842
866
|
] }),
|
|
843
|
-
metrics.narrow && /* @__PURE__ */ (0,
|
|
844
|
-
/* @__PURE__ */ (0,
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
] }),
|
|
858
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "decision-card-stats", children: [
|
|
859
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "decision-stat", children: [
|
|
860
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "decision-stat-num", children: metrics.narrow.applied }),
|
|
861
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "decision-stat-label", children: t("narrowAppliedLabel") })
|
|
862
|
-
] }),
|
|
863
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "decision-stat", children: [
|
|
864
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "decision-stat-num", children: metrics.narrow.dropped }),
|
|
865
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "decision-stat-label", children: t("narrowDroppedLabel") })
|
|
866
|
-
] }),
|
|
867
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "decision-stat", children: [
|
|
868
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "decision-stat-num decision-stat-muted", children: metrics.narrow.failures }),
|
|
869
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "decision-stat-label", children: t("failures") })
|
|
870
|
-
] })
|
|
867
|
+
metrics.narrow && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("article", { className: "decision-card", children: [
|
|
868
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
869
|
+
CardHead,
|
|
870
|
+
{
|
|
871
|
+
title: t("cardNarrow"),
|
|
872
|
+
total: metrics.narrow.attempts,
|
|
873
|
+
unit: t("cardTimes"),
|
|
874
|
+
rate: { label: t("narrowApplyRate"), value: narrowApplyRate === null ? t("rateNa") : `${narrowApplyRate}%` }
|
|
875
|
+
}
|
|
876
|
+
),
|
|
877
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "decision-card-stats", children: [
|
|
878
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Stat, { label: t("narrowAppliedLabel"), value: metrics.narrow.applied }),
|
|
879
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Stat, { label: t("narrowDroppedLabel"), value: metrics.narrow.dropped }),
|
|
880
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Stat, { label: t("failures"), value: metrics.narrow.failures, tone: "muted" })
|
|
871
881
|
] })
|
|
872
882
|
] }),
|
|
873
|
-
metrics.complete && /* @__PURE__ */ (0,
|
|
874
|
-
/* @__PURE__ */ (0,
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
] }),
|
|
888
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "decision-card-stats", children: [
|
|
889
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "decision-stat", children: [
|
|
890
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "decision-stat-num", children: metrics.complete.satisfied }),
|
|
891
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "decision-stat-label", children: t("completeSatisfied") })
|
|
892
|
-
] }),
|
|
893
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "decision-stat", children: [
|
|
894
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "decision-stat-num decision-stat-warn", children: metrics.complete.unsatisfied }),
|
|
895
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "decision-stat-label", children: t("completeUnsatisfied") })
|
|
896
|
-
] }),
|
|
897
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "decision-stat", children: [
|
|
898
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "decision-stat-num decision-stat-muted", children: metrics.complete.insufficient }),
|
|
899
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "decision-stat-label", children: t("completeInsufficient") })
|
|
900
|
-
] })
|
|
883
|
+
metrics.complete && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("article", { className: "decision-card", children: [
|
|
884
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
885
|
+
CardHead,
|
|
886
|
+
{
|
|
887
|
+
title: t("cardComplete"),
|
|
888
|
+
total: metrics.complete.attempts,
|
|
889
|
+
unit: t("cardTimes"),
|
|
890
|
+
rate: { label: t("failures"), value: `${metrics.complete.failures}` }
|
|
891
|
+
}
|
|
892
|
+
),
|
|
893
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "decision-card-stats", children: [
|
|
894
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Stat, { label: t("completeSatisfied"), value: metrics.complete.satisfied }),
|
|
895
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Stat, { label: t("completeUnsatisfied"), value: metrics.complete.unsatisfied, tone: "warn" }),
|
|
896
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Stat, { label: t("completeInsufficient"), value: metrics.complete.insufficient, tone: "muted" })
|
|
901
897
|
] })
|
|
902
898
|
] })
|
|
903
899
|
] })
|
|
904
900
|
] }),
|
|
905
|
-
/* @__PURE__ */ (0,
|
|
906
|
-
/* @__PURE__ */ (0,
|
|
907
|
-
log.length === 0 ? /* @__PURE__ */ (0,
|
|
901
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { children: [
|
|
902
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { children: t("log") }),
|
|
903
|
+
log.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "decision-empty", role: "status", children: t("logEmpty") }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DecisionLogList, { entries: log, ratings, onRate: (id, rating) => void annotate(id, rating), t })
|
|
908
904
|
] }),
|
|
909
|
-
message && /* @__PURE__ */ (0,
|
|
905
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { role: "status", className: "decision-message decision-message-warn", children: message })
|
|
910
906
|
] })
|
|
911
907
|
]
|
|
912
908
|
}
|
|
@@ -916,18 +912,7 @@ function SessionPanel({ sessionId, t }) {
|
|
|
916
912
|
|
|
917
913
|
// src/client/analysis-view.tsx
|
|
918
914
|
var import_react3 = require("react");
|
|
919
|
-
var
|
|
920
|
-
function Stat({ label, value, pct, tone }) {
|
|
921
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "decision-stat", children: [
|
|
922
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: `decision-stat-num${tone ? ` decision-stat-${tone}` : ""}`, children: value }),
|
|
923
|
-
typeof pct === "number" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "decision-stat-pct", children: [
|
|
924
|
-
pct,
|
|
925
|
-
"%"
|
|
926
|
-
] }),
|
|
927
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "decision-stat-label", children: label })
|
|
928
|
-
] });
|
|
929
|
-
}
|
|
930
|
-
var share = (n, total) => total > 0 ? Math.round(n / total * 100) : null;
|
|
915
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
931
916
|
function AnalysisView({ sessionId, t }) {
|
|
932
917
|
const [analysis, setAnalysis] = (0, import_react3.useState)(null);
|
|
933
918
|
const [log, setLog] = (0, import_react3.useState)([]);
|
|
@@ -960,101 +945,77 @@ function AnalysisView({ sessionId, t }) {
|
|
|
960
945
|
const annotations = analysis?.annotations;
|
|
961
946
|
const meanScore = profile && profile.check.scoreCount > 0 ? Math.round(profile.check.scoreSum / profile.check.scoreCount * 10) / 10 : null;
|
|
962
947
|
const completeTotal = profile ? profile.complete.satisfied + profile.complete.unsatisfied + profile.complete.insufficient : 0;
|
|
963
|
-
return /* @__PURE__ */ (0,
|
|
964
|
-
/* @__PURE__ */ (0,
|
|
965
|
-
/* @__PURE__ */ (0,
|
|
966
|
-
loaded && (!analysis || analysis.totalDecisions === 0) ? /* @__PURE__ */ (0,
|
|
967
|
-
profile && /* @__PURE__ */ (0,
|
|
968
|
-
/* @__PURE__ */ (0,
|
|
969
|
-
/* @__PURE__ */ (0,
|
|
970
|
-
profile.gate.attempts > 0 && /* @__PURE__ */ (0,
|
|
971
|
-
/* @__PURE__ */ (0,
|
|
972
|
-
|
|
973
|
-
/* @__PURE__ */ (0,
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
] }),
|
|
978
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "decision-card-stats", children: [
|
|
979
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Stat, { label: t("deny"), value: profile.gate.deny, pct: share(profile.gate.deny, profile.gate.attempts), tone: "warn" }),
|
|
980
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Stat, { label: t("allow"), value: profile.gate.allow, pct: share(profile.gate.allow, profile.gate.attempts) }),
|
|
981
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Stat, { label: t("ask"), value: profile.gate.ask, pct: share(profile.gate.ask, profile.gate.attempts) }),
|
|
982
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Stat, { label: t("failures"), value: profile.gate.error, pct: share(profile.gate.error, profile.gate.attempts), tone: "muted" })
|
|
948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "decision-analysis", role: "region", "aria-label": t("analysisTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "decision-analysis-inner", children: [
|
|
949
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h2", { className: "decision-analysis-title", children: t("analysisTitle") }),
|
|
950
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "decision-muted decision-analysis-intro", children: t("analysisIntro") }),
|
|
951
|
+
loaded && (!analysis || analysis.totalDecisions === 0) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "decision-empty", role: "status", children: t("logEmpty") }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
952
|
+
profile && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: "decision-analysis-section", children: [
|
|
953
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { children: t("analysisProfile") }),
|
|
954
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "decision-analysis-cards", children: [
|
|
955
|
+
profile.gate.attempts > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("article", { className: "decision-card", children: [
|
|
956
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CardHead, { title: t("cardGate"), total: profile.gate.attempts, unit: t("cardTimes") }),
|
|
957
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "decision-card-stats", children: [
|
|
958
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Stat, { label: t("deny"), value: profile.gate.deny, pct: share(profile.gate.deny, profile.gate.attempts), tone: "warn" }),
|
|
959
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Stat, { label: t("allow"), value: profile.gate.allow, pct: share(profile.gate.allow, profile.gate.attempts) }),
|
|
960
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Stat, { label: t("ask"), value: profile.gate.ask, pct: share(profile.gate.ask, profile.gate.attempts) }),
|
|
961
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Stat, { label: t("failures"), value: profile.gate.error, pct: share(profile.gate.error, profile.gate.attempts), tone: "muted" })
|
|
983
962
|
] })
|
|
984
963
|
] }),
|
|
985
|
-
profile.check.attempts > 0 && /* @__PURE__ */ (0,
|
|
986
|
-
/* @__PURE__ */ (0,
|
|
987
|
-
|
|
988
|
-
/* @__PURE__ */ (0,
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
] }),
|
|
993
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "decision-card-stats", children: [
|
|
994
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Stat, { label: t("checkLow"), value: profile.check.low, pct: share(profile.check.low, profile.check.attempts), tone: "warn" }),
|
|
995
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Stat, { label: t("checkOk"), value: profile.check.ok, pct: share(profile.check.ok, profile.check.attempts) }),
|
|
996
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Stat, { label: t("analysisMeanScore"), value: meanScore === null ? t("rateNa") : `${meanScore}/2` }),
|
|
997
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Stat, { label: t("failures"), value: profile.check.error, pct: share(profile.check.error, profile.check.attempts), tone: "muted" })
|
|
964
|
+
profile.check.attempts > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("article", { className: "decision-card", children: [
|
|
965
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CardHead, { title: t("cardCheck"), total: profile.check.attempts, unit: t("cardTimes") }),
|
|
966
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "decision-card-stats", children: [
|
|
967
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Stat, { label: t("checkLow"), value: profile.check.low, pct: share(profile.check.low, profile.check.attempts), tone: "warn" }),
|
|
968
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Stat, { label: t("checkOk"), value: profile.check.ok, pct: share(profile.check.ok, profile.check.attempts) }),
|
|
969
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Stat, { label: t("analysisMeanScore"), value: meanScore === null ? t("rateNa") : `${meanScore}/2` }),
|
|
970
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Stat, { label: t("failures"), value: profile.check.error, pct: share(profile.check.error, profile.check.attempts), tone: "muted" })
|
|
998
971
|
] })
|
|
999
972
|
] }),
|
|
1000
|
-
profile.narrow.attempts > 0 && /* @__PURE__ */ (0,
|
|
1001
|
-
/* @__PURE__ */ (0,
|
|
1002
|
-
|
|
1003
|
-
/* @__PURE__ */ (0,
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
] })
|
|
1007
|
-
] }),
|
|
1008
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "decision-card-stats", children: [
|
|
1009
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Stat, { label: t("narrowAppliedLabel"), value: profile.narrow.applied, pct: share(profile.narrow.applied, profile.narrow.attempts) }),
|
|
1010
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Stat, { label: t("narrowDroppedLabel"), value: profile.narrow.droppedSum }),
|
|
1011
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Stat, { label: t("failures"), value: profile.narrow.error, pct: share(profile.narrow.error, profile.narrow.attempts), tone: "muted" })
|
|
973
|
+
profile.narrow.attempts > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("article", { className: "decision-card", children: [
|
|
974
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CardHead, { title: t("cardNarrow"), total: profile.narrow.attempts, unit: t("cardTimes") }),
|
|
975
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "decision-card-stats", children: [
|
|
976
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Stat, { label: t("narrowAppliedLabel"), value: profile.narrow.applied, pct: share(profile.narrow.applied, profile.narrow.attempts) }),
|
|
977
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Stat, { label: t("narrowDroppedLabel"), value: profile.narrow.droppedSum }),
|
|
978
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Stat, { label: t("failures"), value: profile.narrow.error, pct: share(profile.narrow.error, profile.narrow.attempts), tone: "muted" })
|
|
1012
979
|
] })
|
|
1013
980
|
] }),
|
|
1014
|
-
profile.complete.attempts > 0 && /* @__PURE__ */ (0,
|
|
1015
|
-
/* @__PURE__ */ (0,
|
|
1016
|
-
|
|
1017
|
-
/* @__PURE__ */ (0,
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
] })
|
|
1021
|
-
] }),
|
|
1022
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "decision-card-stats", children: [
|
|
1023
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Stat, { label: t("completeSatisfied"), value: profile.complete.satisfied, pct: share(profile.complete.satisfied, completeTotal) }),
|
|
1024
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Stat, { label: t("completeUnsatisfied"), value: profile.complete.unsatisfied, pct: share(profile.complete.unsatisfied, completeTotal), tone: "warn" }),
|
|
1025
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Stat, { label: t("completeInsufficient"), value: profile.complete.insufficient, pct: share(profile.complete.insufficient, completeTotal), tone: "muted" })
|
|
981
|
+
profile.complete.attempts > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("article", { className: "decision-card", children: [
|
|
982
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CardHead, { title: t("cardComplete"), total: profile.complete.attempts, unit: t("cardTimes") }),
|
|
983
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "decision-card-stats", children: [
|
|
984
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Stat, { label: t("completeSatisfied"), value: profile.complete.satisfied, pct: share(profile.complete.satisfied, completeTotal) }),
|
|
985
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Stat, { label: t("completeUnsatisfied"), value: profile.complete.unsatisfied, pct: share(profile.complete.unsatisfied, completeTotal), tone: "warn" }),
|
|
986
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Stat, { label: t("completeInsufficient"), value: profile.complete.insufficient, pct: share(profile.complete.insufficient, completeTotal), tone: "muted" })
|
|
1026
987
|
] })
|
|
1027
988
|
] })
|
|
1028
989
|
] })
|
|
1029
990
|
] }),
|
|
1030
|
-
backtest && /* @__PURE__ */ (0,
|
|
1031
|
-
/* @__PURE__ */ (0,
|
|
1032
|
-
/* @__PURE__ */ (0,
|
|
1033
|
-
/* @__PURE__ */ (0,
|
|
1034
|
-
/* @__PURE__ */ (0,
|
|
1035
|
-
/* @__PURE__ */ (0,
|
|
991
|
+
backtest && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: "decision-analysis-section", children: [
|
|
992
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { children: t("analysisTrend") }),
|
|
993
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "decision-card-stats decision-analysis-trend", children: [
|
|
994
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Stat, { label: t("analysisTrendWarn"), value: backtest.warnHits }),
|
|
995
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Stat, { label: t("analysisTrendSevere"), value: backtest.severeHits, tone: "warn" }),
|
|
996
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Stat, { label: t("analysisTrendMaxRun"), value: backtest.maxRun })
|
|
1036
997
|
] }),
|
|
1037
|
-
/* @__PURE__ */ (0,
|
|
998
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "decision-muted decision-analysis-note", children: t("analysisTrendNote") })
|
|
1038
999
|
] }),
|
|
1039
|
-
annotations && /* @__PURE__ */ (0,
|
|
1040
|
-
/* @__PURE__ */ (0,
|
|
1041
|
-
annotations.rated === 0 ? /* @__PURE__ */ (0,
|
|
1000
|
+
annotations && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: "decision-analysis-section", children: [
|
|
1001
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { children: t("analysisAccuracy") }),
|
|
1002
|
+
annotations.rated === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "decision-muted", children: t("analysisAccuracyEmpty") }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "decision-muted decision-rate-summary", children: t("rateSummary", { rated: annotations.rated, good: annotations.good, bad: annotations.bad, unsure: annotations.unsure }) })
|
|
1042
1003
|
] }),
|
|
1043
|
-
/* @__PURE__ */ (0,
|
|
1044
|
-
/* @__PURE__ */ (0,
|
|
1045
|
-
log.length === 0 ? /* @__PURE__ */ (0,
|
|
1046
|
-
/* @__PURE__ */ (0,
|
|
1047
|
-
/* @__PURE__ */ (0,
|
|
1004
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: "decision-analysis-section", children: [
|
|
1005
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { children: t("log") }),
|
|
1006
|
+
log.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "decision-empty", role: "status", children: t("analysisLogTruncated") }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1007
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DecisionLogList, { entries: log, ratings, onRate: (id, rating) => void annotate(id, rating), t }),
|
|
1008
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "decision-muted decision-analysis-note", children: t("analysisLogNote") })
|
|
1048
1009
|
] })
|
|
1049
1010
|
] })
|
|
1050
1011
|
] }),
|
|
1051
|
-
message && /* @__PURE__ */ (0,
|
|
1012
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "status", className: "decision-message decision-message-warn", children: message })
|
|
1052
1013
|
] }) });
|
|
1053
1014
|
}
|
|
1054
1015
|
|
|
1055
1016
|
// src/client/config-form.tsx
|
|
1056
1017
|
var import_react4 = require("react");
|
|
1057
|
-
var
|
|
1018
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1058
1019
|
var api = "/plugins/dsh-decision-layer/api";
|
|
1059
1020
|
async function request2(path, fetchFn, init) {
|
|
1060
1021
|
const response = await fetchFn(`${api}/${path}`, init);
|
|
@@ -1071,31 +1032,31 @@ var maxCandidatesOf = (settings) => settings?.maxCandidates ?? DEFAULT_MAX_CANDI
|
|
|
1071
1032
|
var thresholdOf = (settings) => settings?.threshold ?? DEFAULT_THRESHOLD;
|
|
1072
1033
|
function HeadIcon({ name }) {
|
|
1073
1034
|
const glyphs = {
|
|
1074
|
-
features: /* @__PURE__ */ (0,
|
|
1075
|
-
/* @__PURE__ */ (0,
|
|
1076
|
-
/* @__PURE__ */ (0,
|
|
1077
|
-
/* @__PURE__ */ (0,
|
|
1078
|
-
/* @__PURE__ */ (0,
|
|
1035
|
+
features: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
1036
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("rect", { x: "2", y: "3", width: "12", height: "4.2", rx: "2.1", stroke: "currentColor", "stroke-width": "1.3" }),
|
|
1037
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "11.9", cy: "5.1", r: "1.25", fill: "currentColor" }),
|
|
1038
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("rect", { x: "2", y: "8.8", width: "12", height: "4.2", rx: "2.1", stroke: "currentColor", "stroke-width": "1.3" }),
|
|
1039
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "4.1", cy: "10.9", r: "1.25", fill: "currentColor" })
|
|
1079
1040
|
] }),
|
|
1080
|
-
advanced: /* @__PURE__ */ (0,
|
|
1081
|
-
/* @__PURE__ */ (0,
|
|
1082
|
-
/* @__PURE__ */ (0,
|
|
1083
|
-
/* @__PURE__ */ (0,
|
|
1041
|
+
advanced: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
1042
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M2.5 5h11M2.5 11h11", stroke: "currentColor", "stroke-width": "1.3", "stroke-linecap": "round" }),
|
|
1043
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "10.5", cy: "5", r: "1.9", fill: "var(--dsw-alias-bg-layer-2,#fff)", stroke: "currentColor", "stroke-width": "1.3" }),
|
|
1044
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "5.5", cy: "11", r: "1.9", fill: "var(--dsw-alias-bg-layer-2,#fff)", stroke: "currentColor", "stroke-width": "1.3" })
|
|
1084
1045
|
] }),
|
|
1085
|
-
backend: /* @__PURE__ */ (0,
|
|
1086
|
-
/* @__PURE__ */ (0,
|
|
1087
|
-
/* @__PURE__ */ (0,
|
|
1088
|
-
/* @__PURE__ */ (0,
|
|
1089
|
-
/* @__PURE__ */ (0,
|
|
1046
|
+
backend: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
1047
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("rect", { x: "2.3", y: "2.6", width: "11.4", height: "4.6", rx: "1.1", stroke: "currentColor", "stroke-width": "1.3" }),
|
|
1048
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("rect", { x: "2.3", y: "8.8", width: "11.4", height: "4.6", rx: "1.1", stroke: "currentColor", "stroke-width": "1.3" }),
|
|
1049
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "5", cy: "4.9", r: ".7", fill: "currentColor" }),
|
|
1050
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "5", cy: "11.1", r: ".7", fill: "currentColor" })
|
|
1090
1051
|
] })
|
|
1091
1052
|
};
|
|
1092
|
-
return /* @__PURE__ */ (0,
|
|
1053
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: `decision-head-icon decision-head-icon-${name}`, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { width: "15", height: "15", viewBox: "0 0 16 16", fill: "none", children: glyphs[name] }) });
|
|
1093
1054
|
}
|
|
1094
1055
|
function Toggle({ label, checked, disabled, onChange }) {
|
|
1095
|
-
return /* @__PURE__ */ (0,
|
|
1096
|
-
/* @__PURE__ */ (0,
|
|
1097
|
-
/* @__PURE__ */ (0,
|
|
1098
|
-
/* @__PURE__ */ (0,
|
|
1056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "decision-toggle", children: [
|
|
1057
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "decision-toggle-text", children: label }),
|
|
1058
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "decision-toggle-box", children: [
|
|
1059
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1099
1060
|
"input",
|
|
1100
1061
|
{
|
|
1101
1062
|
className: "decision-toggle-input",
|
|
@@ -1105,7 +1066,7 @@ function Toggle({ label, checked, disabled, onChange }) {
|
|
|
1105
1066
|
onChange: (event) => onChange(event.target.checked)
|
|
1106
1067
|
}
|
|
1107
1068
|
),
|
|
1108
|
-
/* @__PURE__ */ (0,
|
|
1069
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "decision-toggle-track", "aria-hidden": "true" })
|
|
1109
1070
|
] })
|
|
1110
1071
|
] });
|
|
1111
1072
|
}
|
|
@@ -1247,17 +1208,17 @@ ${url}`)) return;
|
|
|
1247
1208
|
setBusy(false);
|
|
1248
1209
|
}
|
|
1249
1210
|
};
|
|
1250
|
-
return /* @__PURE__ */ (0,
|
|
1251
|
-
/* @__PURE__ */ (0,
|
|
1252
|
-
/* @__PURE__ */ (0,
|
|
1253
|
-
/* @__PURE__ */ (0,
|
|
1254
|
-
/* @__PURE__ */ (0,
|
|
1211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "decision-config", children: [
|
|
1212
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("details", { className: "decision-collapse", open: true, children: [
|
|
1213
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("summary", { className: "decision-collapse-head", children: [
|
|
1214
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("h3", { children: [
|
|
1215
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HeadIcon, { name: "features" }),
|
|
1255
1216
|
t("basicFeatures")
|
|
1256
1217
|
] }),
|
|
1257
|
-
/* @__PURE__ */ (0,
|
|
1218
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "decision-collapse-icon", "aria-hidden": "true" })
|
|
1258
1219
|
] }),
|
|
1259
|
-
/* @__PURE__ */ (0,
|
|
1260
|
-
/* @__PURE__ */ (0,
|
|
1220
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "decision-collapse-body", children: [
|
|
1221
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1261
1222
|
Toggle,
|
|
1262
1223
|
{
|
|
1263
1224
|
label: t("featureGate"),
|
|
@@ -1269,8 +1230,8 @@ ${url}`)) return;
|
|
|
1269
1230
|
}
|
|
1270
1231
|
}
|
|
1271
1232
|
),
|
|
1272
|
-
/* @__PURE__ */ (0,
|
|
1273
|
-
/* @__PURE__ */ (0,
|
|
1233
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "decision-muted", children: t("featureGateHint") }),
|
|
1234
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1274
1235
|
Toggle,
|
|
1275
1236
|
{
|
|
1276
1237
|
label: t("featureCheck"),
|
|
@@ -1282,8 +1243,8 @@ ${url}`)) return;
|
|
|
1282
1243
|
}
|
|
1283
1244
|
}
|
|
1284
1245
|
),
|
|
1285
|
-
/* @__PURE__ */ (0,
|
|
1286
|
-
/* @__PURE__ */ (0,
|
|
1246
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "decision-muted", children: t("featureCheckHint") }),
|
|
1247
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1287
1248
|
Toggle,
|
|
1288
1249
|
{
|
|
1289
1250
|
label: t("featureNarrow"),
|
|
@@ -1295,8 +1256,8 @@ ${url}`)) return;
|
|
|
1295
1256
|
}
|
|
1296
1257
|
}
|
|
1297
1258
|
),
|
|
1298
|
-
/* @__PURE__ */ (0,
|
|
1299
|
-
/* @__PURE__ */ (0,
|
|
1259
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "decision-muted", children: t("featureNarrowHint") }),
|
|
1260
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1300
1261
|
Toggle,
|
|
1301
1262
|
{
|
|
1302
1263
|
label: t("featureComplete"),
|
|
@@ -1308,22 +1269,22 @@ ${url}`)) return;
|
|
|
1308
1269
|
}
|
|
1309
1270
|
}
|
|
1310
1271
|
),
|
|
1311
|
-
/* @__PURE__ */ (0,
|
|
1272
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "decision-muted", children: t("featureCompleteHint") })
|
|
1312
1273
|
] })
|
|
1313
1274
|
] }),
|
|
1314
|
-
/* @__PURE__ */ (0,
|
|
1315
|
-
/* @__PURE__ */ (0,
|
|
1316
|
-
/* @__PURE__ */ (0,
|
|
1317
|
-
/* @__PURE__ */ (0,
|
|
1275
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("details", { className: "decision-collapse", children: [
|
|
1276
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("summary", { className: "decision-collapse-head", children: [
|
|
1277
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("h3", { children: [
|
|
1278
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HeadIcon, { name: "advanced" }),
|
|
1318
1279
|
t("advancedConfig")
|
|
1319
1280
|
] }),
|
|
1320
|
-
/* @__PURE__ */ (0,
|
|
1281
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "decision-collapse-icon", "aria-hidden": "true" })
|
|
1321
1282
|
] }),
|
|
1322
|
-
/* @__PURE__ */ (0,
|
|
1323
|
-
/* @__PURE__ */ (0,
|
|
1324
|
-
/* @__PURE__ */ (0,
|
|
1325
|
-
/* @__PURE__ */ (0,
|
|
1326
|
-
/* @__PURE__ */ (0,
|
|
1283
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("form", { className: "decision-collapse-body", onSubmit: (event) => void saveAdvanced(event), children: [
|
|
1284
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "decision-advanced-grid", children: [
|
|
1285
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "decision-field-block", children: [
|
|
1286
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "decision-subhead", children: t("advancedSwitches") }),
|
|
1287
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1327
1288
|
Toggle,
|
|
1328
1289
|
{
|
|
1329
1290
|
label: t("selfCheckSteer"),
|
|
@@ -1335,8 +1296,8 @@ ${url}`)) return;
|
|
|
1335
1296
|
}
|
|
1336
1297
|
}
|
|
1337
1298
|
),
|
|
1338
|
-
/* @__PURE__ */ (0,
|
|
1339
|
-
/* @__PURE__ */ (0,
|
|
1299
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "decision-muted", children: t("selfCheckHint") }),
|
|
1300
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1340
1301
|
Toggle,
|
|
1341
1302
|
{
|
|
1342
1303
|
label: t("narrowObserveLabel"),
|
|
@@ -1348,8 +1309,8 @@ ${url}`)) return;
|
|
|
1348
1309
|
}
|
|
1349
1310
|
}
|
|
1350
1311
|
),
|
|
1351
|
-
/* @__PURE__ */ (0,
|
|
1352
|
-
/* @__PURE__ */ (0,
|
|
1312
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "decision-muted", children: t("narrowHint") }),
|
|
1313
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1353
1314
|
Toggle,
|
|
1354
1315
|
{
|
|
1355
1316
|
label: t("completeSteer"),
|
|
@@ -1361,13 +1322,13 @@ ${url}`)) return;
|
|
|
1361
1322
|
}
|
|
1362
1323
|
}
|
|
1363
1324
|
),
|
|
1364
|
-
/* @__PURE__ */ (0,
|
|
1325
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "decision-muted", children: t("completeHint") })
|
|
1365
1326
|
] }),
|
|
1366
|
-
/* @__PURE__ */ (0,
|
|
1367
|
-
/* @__PURE__ */ (0,
|
|
1368
|
-
/* @__PURE__ */ (0,
|
|
1327
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "decision-field-block", children: [
|
|
1328
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "decision-subhead", children: t("advancedParams") }),
|
|
1329
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "decision-field", children: [
|
|
1369
1330
|
t("narrowKeepLabel"),
|
|
1370
|
-
/* @__PURE__ */ (0,
|
|
1331
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1371
1332
|
"textarea",
|
|
1372
1333
|
{
|
|
1373
1334
|
className: "decision-prefixes",
|
|
@@ -1381,11 +1342,11 @@ ${url}`)) return;
|
|
|
1381
1342
|
}
|
|
1382
1343
|
}
|
|
1383
1344
|
),
|
|
1384
|
-
/* @__PURE__ */ (0,
|
|
1345
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("small", { className: "decision-muted", children: t("narrowKeepHint") })
|
|
1385
1346
|
] }),
|
|
1386
|
-
/* @__PURE__ */ (0,
|
|
1347
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "decision-field decision-field-inline", children: [
|
|
1387
1348
|
t("narrowMaxLabel"),
|
|
1388
|
-
/* @__PURE__ */ (0,
|
|
1349
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1389
1350
|
"input",
|
|
1390
1351
|
{
|
|
1391
1352
|
className: "decision-narrow-cap",
|
|
@@ -1402,11 +1363,11 @@ ${url}`)) return;
|
|
|
1402
1363
|
}
|
|
1403
1364
|
}
|
|
1404
1365
|
),
|
|
1405
|
-
/* @__PURE__ */ (0,
|
|
1366
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("small", { className: "decision-muted", children: t("narrowMaxHint") })
|
|
1406
1367
|
] }),
|
|
1407
|
-
/* @__PURE__ */ (0,
|
|
1368
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "decision-field decision-field-inline", children: [
|
|
1408
1369
|
t("narrowThresholdLabel"),
|
|
1409
|
-
/* @__PURE__ */ (0,
|
|
1370
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1410
1371
|
"input",
|
|
1411
1372
|
{
|
|
1412
1373
|
className: "decision-narrow-cap",
|
|
@@ -1423,26 +1384,26 @@ ${url}`)) return;
|
|
|
1423
1384
|
}
|
|
1424
1385
|
}
|
|
1425
1386
|
),
|
|
1426
|
-
/* @__PURE__ */ (0,
|
|
1387
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("small", { className: "decision-muted", children: t("narrowThresholdHint") })
|
|
1427
1388
|
] })
|
|
1428
1389
|
] })
|
|
1429
1390
|
] }),
|
|
1430
|
-
/* @__PURE__ */ (0,
|
|
1391
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "decision-actions", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { disabled: busy || !ready || !advancedDirty, type: "submit", children: t("saveAdvanced") }) })
|
|
1431
1392
|
] })
|
|
1432
1393
|
] }),
|
|
1433
|
-
/* @__PURE__ */ (0,
|
|
1434
|
-
/* @__PURE__ */ (0,
|
|
1435
|
-
/* @__PURE__ */ (0,
|
|
1394
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { children: [
|
|
1395
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("h3", { children: [
|
|
1396
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HeadIcon, { name: "backend" }),
|
|
1436
1397
|
t("backend")
|
|
1437
1398
|
] }),
|
|
1438
|
-
ready && /* @__PURE__ */ (0,
|
|
1399
|
+
ready && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { className: "decision-muted decision-destination", children: [
|
|
1439
1400
|
t("destination"),
|
|
1440
|
-
/* @__PURE__ */ (0,
|
|
1401
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("code", { children: config.effectiveUrl })
|
|
1441
1402
|
] }),
|
|
1442
|
-
/* @__PURE__ */ (0,
|
|
1443
|
-
/* @__PURE__ */ (0,
|
|
1403
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("form", { onSubmit: (event) => void saveBackend(event), children: [
|
|
1404
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "decision-field", children: [
|
|
1444
1405
|
t("url"),
|
|
1445
|
-
/* @__PURE__ */ (0,
|
|
1406
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1446
1407
|
"input",
|
|
1447
1408
|
{
|
|
1448
1409
|
type: "url",
|
|
@@ -1457,9 +1418,9 @@ ${url}`)) return;
|
|
|
1457
1418
|
}
|
|
1458
1419
|
)
|
|
1459
1420
|
] }),
|
|
1460
|
-
/* @__PURE__ */ (0,
|
|
1421
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "decision-field", children: [
|
|
1461
1422
|
t("model"),
|
|
1462
|
-
/* @__PURE__ */ (0,
|
|
1423
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1463
1424
|
"input",
|
|
1464
1425
|
{
|
|
1465
1426
|
value: config.model,
|
|
@@ -1473,9 +1434,9 @@ ${url}`)) return;
|
|
|
1473
1434
|
}
|
|
1474
1435
|
)
|
|
1475
1436
|
] }),
|
|
1476
|
-
/* @__PURE__ */ (0,
|
|
1437
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "decision-field", children: [
|
|
1477
1438
|
t("key"),
|
|
1478
|
-
/* @__PURE__ */ (0,
|
|
1439
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1479
1440
|
"input",
|
|
1480
1441
|
{
|
|
1481
1442
|
type: "password",
|
|
@@ -1490,23 +1451,23 @@ ${url}`)) return;
|
|
|
1490
1451
|
}
|
|
1491
1452
|
}
|
|
1492
1453
|
),
|
|
1493
|
-
/* @__PURE__ */ (0,
|
|
1454
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("small", { className: "decision-muted", children: config.apiKeySet ? t("keyHintSaved") : t("keyHintEmpty") })
|
|
1494
1455
|
] }),
|
|
1495
|
-
/* @__PURE__ */ (0,
|
|
1496
|
-
/* @__PURE__ */ (0,
|
|
1497
|
-
/* @__PURE__ */ (0,
|
|
1498
|
-
probeResult && /* @__PURE__ */ (0,
|
|
1456
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "decision-actions", children: [
|
|
1457
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { disabled: busy || !ready, type: "submit", children: t("save") }),
|
|
1458
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "decision-secondary", disabled: busy || !ready || backendDirty, type: "button", onClick: () => void probe(), children: t("probe") }),
|
|
1459
|
+
probeResult && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { role: "status", className: `decision-probe-result${probeResult.ok ? " decision-message-ok" : " decision-message-warn"}`, children: probeResult.text })
|
|
1499
1460
|
] })
|
|
1500
1461
|
] }),
|
|
1501
|
-
config.apiKeySet && /* @__PURE__ */ (0,
|
|
1502
|
-
/* @__PURE__ */ (0,
|
|
1503
|
-
/* @__PURE__ */ (0,
|
|
1504
|
-
/* @__PURE__ */ (0,
|
|
1462
|
+
config.apiKeySet && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "decision-danger-row", children: [
|
|
1463
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "decision-danger-text", children: [
|
|
1464
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "decision-danger-title", children: t("removeKey") }),
|
|
1465
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("small", { className: "decision-muted", children: t("removeKeyHint") })
|
|
1505
1466
|
] }),
|
|
1506
|
-
/* @__PURE__ */ (0,
|
|
1467
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "decision-danger-button", disabled: busy || !ready, onClick: () => void removeSavedKey(), children: t("removeKeyButton") })
|
|
1507
1468
|
] })
|
|
1508
1469
|
] }),
|
|
1509
|
-
message && /* @__PURE__ */ (0,
|
|
1470
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { role: "status", className: `decision-message${message.ok ? " decision-message-ok" : " decision-message-warn"}`, children: message.text })
|
|
1510
1471
|
] });
|
|
1511
1472
|
}
|
|
1512
1473
|
|
|
@@ -1565,7 +1526,6 @@ var css = `
|
|
|
1565
1526
|
.decision-dot-deny{background:#c0392b}
|
|
1566
1527
|
.decision-card-foot{display:flex;justify-content:space-between;gap:1rem;margin-top:.7rem;padding-top:.6rem;border-top:1px solid var(--dsw-alias-border-l2,#eef1f3);font-size:.76rem;color:var(--dsw-alias-label-secondary,#59636e)}
|
|
1567
1528
|
.decision-card-foot b{color:var(--dsw-alias-label-primary,#202124);font-variant-numeric:tabular-nums;margin-left:.3rem}
|
|
1568
|
-
.decision-card-rate{justify-content:center}
|
|
1569
1529
|
.decision-card-stats{display:flex;gap:.6rem}
|
|
1570
1530
|
.decision-stat{flex:1 1 0;display:flex;flex-direction:column;align-items:center;gap:.2rem;padding:.5rem .3rem;border-radius:10px;background:var(--dsw-alias-bg-layer-1,#f6f8fa)}
|
|
1571
1531
|
.decision-stat-num{font-size:1.35rem;font-weight:700;line-height:1;font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary,#202124)}
|
|
@@ -1705,7 +1665,7 @@ function installStyles() {
|
|
|
1705
1665
|
}
|
|
1706
1666
|
|
|
1707
1667
|
// src/client/index.tsx
|
|
1708
|
-
var
|
|
1668
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1709
1669
|
var inject = ["slots", "locale"];
|
|
1710
1670
|
function apply(ctx) {
|
|
1711
1671
|
const t = ctx.locale.bind("dsh-decision-layer");
|
|
@@ -1730,7 +1690,7 @@ function apply(ctx) {
|
|
|
1730
1690
|
}, AnalysisView));
|
|
1731
1691
|
ctx.slots.inject("plugins.bundle.config", () => ctx.slots.register(
|
|
1732
1692
|
{ name: "plugins.bundle.config", key: "dsh-decision-layer", locale: "dsh-decision-layer" },
|
|
1733
|
-
(props) => props.view === "summary" ? props.t("summary") : /* @__PURE__ */ (0,
|
|
1693
|
+
(props) => props.view === "summary" ? props.t("summary") : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ConfigForm, { t: props.t })
|
|
1734
1694
|
));
|
|
1735
1695
|
}
|
|
1736
1696
|
|