feat: overhaul Duriin autonomy console
This commit is contained in:
@@ -11,6 +11,7 @@ services:
|
||||
NODE_ENV: production
|
||||
INTELLIGENCE_DB: /data/intelligence.sqlite
|
||||
DURIIN_RUN_SCHEDULER: "false"
|
||||
AUTONOMY_EXECUTION_MODE: "${AUTONOMY_EXECUTION_MODE:-shadow}"
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- nginx_proxy_manager_default
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
.page-autonomy { background-image: radial-gradient(circle at 78% 0, rgba(223,255,79,.07), transparent 31rem); }
|
||||
.autonomy-shell { width: min(1500px, 100%); margin: 0 auto; padding: 38px 38px 70px; }
|
||||
|
||||
.autonomy-hero { min-height: 238px; padding: 22px 4px 34px; display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; border-bottom: 1px solid var(--border); }
|
||||
.hero-copy { max-width: 780px; }
|
||||
.eyebrow { margin-bottom: 23px; display: flex; align-items: center; gap: 9px; color: var(--accent); font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
|
||||
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(223,255,79,.5); animation: pulse 2.4s infinite; }
|
||||
@keyframes pulse { 60% { box-shadow: 0 0 0 8px rgba(223,255,79,0); } 100% { box-shadow: 0 0 0 0 rgba(223,255,79,0); } }
|
||||
.hero-copy h2 { max-width: 760px; font-size: clamp(42px, 6vw, 82px); font-weight: 560; letter-spacing: -.068em; line-height: .94; }
|
||||
.hero-copy p { max-width: 640px; margin-top: 22px; color: var(--muted); font-size: 16px; line-height: 1.6; }
|
||||
|
||||
.hero-mode { min-width: 220px; padding: 17px 0 3px 22px; display: flex; flex-direction: column; gap: 5px; border-left: 1px solid var(--border); }
|
||||
.mode-label { color: var(--muted-dark); font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
|
||||
.hero-mode strong { color: var(--accent); font-family: var(--mono); font-size: 25px; letter-spacing: -.04em; }
|
||||
.hero-mode > span:last-child { color: var(--muted); font-size: 11px; }
|
||||
|
||||
.metric-strip { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--border); }
|
||||
.metric-block { min-height: 132px; padding: 26px 24px; display: flex; flex-direction: column; border-right: 1px solid var(--border-light); }
|
||||
.metric-block:first-child { padding-left: 4px; }
|
||||
.metric-block:last-child { border-right: 0; }
|
||||
.metric-kicker { color: var(--muted-dark); font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
|
||||
.metric-block strong { margin-top: auto; color: var(--foreground); font-size: 34px; font-weight: 580; letter-spacing: -.05em; line-height: 1; }
|
||||
.metric-block small { margin-top: 7px; color: #636b61; font-size: 10px; }
|
||||
|
||||
.panel { background: rgba(16,19,16,.74); border: 1px solid var(--border); border-radius: 8px; }
|
||||
.section-head { min-height: 58px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--border-light); }
|
||||
.section-head > div { display: flex; align-items: center; gap: 11px; }
|
||||
.section-head h3 { font-size: 13px; font-weight: 650; letter-spacing: -.01em; }
|
||||
.section-index { color: #596157; font-family: var(--mono); font-size: 9px; }
|
||||
.freshness, .text-link { color: var(--muted-dark); font-family: var(--mono); font-size: 9px; letter-spacing: .04em; text-decoration: none; }
|
||||
.text-link:hover { color: var(--accent); }
|
||||
|
||||
.pipeline-section { margin-top: 26px; }
|
||||
.pipeline { min-height: 158px; padding: 26px 28px; display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr auto 1fr; align-items: center; }
|
||||
.pipeline-step { min-width: 0; display: grid; grid-template-columns: 22px 1fr; grid-template-rows: auto auto auto; align-items: center; }
|
||||
.step-number { grid-row: 1 / span 3; align-self: start; color: #4f574e; font-family: var(--mono); font-size: 9px; }
|
||||
.pipeline-step strong { font-size: 13px; }
|
||||
.pipeline-step small { margin-top: 3px; color: var(--muted-dark); font-size: 10px; }
|
||||
.pipeline-step b { margin-top: 12px; color: var(--accent); font-family: var(--mono); font-size: 18px; font-weight: 550; }
|
||||
.pipeline-arrow { padding: 0 10px; color: #3c433b; font-family: var(--mono); }
|
||||
|
||||
.autonomy-grid { margin-top: 16px; display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(280px, .7fr); gap: 16px; }
|
||||
.hypothesis-list { min-height: 320px; }
|
||||
.hypothesis-row { padding: 18px; display: grid; grid-template-columns: 82px minmax(100px, .7fr) minmax(220px, 1.8fr) 100px; gap: 18px; align-items: center; border-bottom: 1px solid var(--border-light); }
|
||||
.hypothesis-row:last-child { border-bottom: 0; }
|
||||
.hypothesis-symbol { font-family: var(--mono); font-size: 15px; font-weight: 750; }
|
||||
.direction-tag { width: fit-content; margin-top: 5px; color: var(--muted-dark); font-family: var(--mono); font-size: 8px; text-transform: uppercase; }
|
||||
.direction-tag.positive { color: var(--positive); }
|
||||
.direction-tag.negative { color: var(--negative); }
|
||||
.hypothesis-type { color: #d4d7d0; font-size: 12px; font-weight: 600; }
|
||||
.hypothesis-channel { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.5; }
|
||||
.hypothesis-meta { color: var(--muted-dark); font-family: var(--mono); font-size: 9px; line-height: 1.7; }
|
||||
.decision-chip { justify-self: end; padding: 5px 8px; color: var(--warning); background: rgba(243,201,105,.06); border: 1px solid rgba(243,201,105,.16); border-radius: 3px; font-family: var(--mono); font-size: 9px; font-weight: 750; }
|
||||
.decision-chip.buy { color: var(--positive); border-color: rgba(142,230,168,.18); background: rgba(142,230,168,.06); }
|
||||
.decision-chip.sell { color: var(--negative); border-color: rgba(255,141,125,.18); background: rgba(255,141,125,.06); }
|
||||
|
||||
.performance-panel { padding-bottom: 18px; }
|
||||
.accuracy-orbit { --accuracy: 0deg; width: 166px; height: 166px; margin: 28px auto 24px; padding: 1px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--accent) var(--accuracy), #252b24 0); }
|
||||
.accuracy-orbit::before { content: ""; grid-area: 1/1; width: 138px; height: 138px; border-radius: 50%; background: #111411; }
|
||||
.accuracy-orbit > div { z-index: 1; grid-area: 1/1; display: flex; flex-direction: column; align-items: center; }
|
||||
.accuracy-orbit strong { font-size: 31px; font-weight: 570; letter-spacing: -.055em; }
|
||||
.accuracy-orbit span { color: var(--muted-dark); font-family: var(--mono); font-size: 8px; letter-spacing: .1em; text-transform: uppercase; }
|
||||
.performance-facts { margin: 0 18px; border-top: 1px solid var(--border-light); }
|
||||
.performance-facts > div { padding: 11px 0; display: flex; justify-content: space-between; color: var(--muted); border-bottom: 1px solid var(--border-light); font-size: 11px; }
|
||||
.performance-facts strong { color: var(--foreground); font-family: var(--mono); font-size: 11px; }
|
||||
.performance-note { margin: 17px 18px 0; color: var(--muted-dark); font-size: 10px; line-height: 1.55; }
|
||||
|
||||
.lower-grid { grid-template-columns: minmax(0, 1.8fr) minmax(280px, .7fr); }
|
||||
.ledger-table { border: 0; border-radius: 0 0 8px 8px; }
|
||||
.mode-pill { padding: 4px 7px; color: var(--warning); border: 1px solid rgba(243,201,105,.2); border-radius: 20px; font-family: var(--mono); font-size: 8px; font-weight: 700; text-transform: uppercase; }
|
||||
.runtime-list { padding: 7px 18px; }
|
||||
.runtime-list > div { min-height: 41px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); border-bottom: 1px solid var(--border-light); font-size: 10px; }
|
||||
.runtime-list span { display: flex; align-items: center; gap: 8px; }
|
||||
.runtime-list strong { color: var(--foreground); font-family: var(--mono); font-size: 9px; font-weight: 550; }
|
||||
.status-light { width: 6px; height: 6px; border-radius: 50%; background: var(--warning); }
|
||||
.status-light.ok { background: var(--positive); box-shadow: 0 0 8px rgba(142,230,168,.35); }
|
||||
.account-card { margin: 10px 18px 18px; padding: 15px; display: flex; flex-direction: column; background: #0d100e; border: 1px solid var(--border-light); border-radius: 5px; }
|
||||
.account-card span { color: var(--muted-dark); font-family: var(--mono); font-size: 8px; text-transform: uppercase; letter-spacing: .1em; }
|
||||
.account-card strong { margin-top: 9px; font-size: 15px; font-weight: 580; }
|
||||
.account-card small { margin-top: 5px; color: var(--muted-dark); font-size: 9px; }
|
||||
.loading-line { width: 42%; height: 1px; margin: 100px auto; background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: loading 1.2s infinite; }
|
||||
@keyframes loading { from { transform: translateX(-40%); opacity: .25; } 50% { opacity: 1; } to { transform: translateX(40%); opacity: .25; } }
|
||||
|
||||
@media (max-width: 1100px) {
|
||||
.metric-strip { grid-template-columns: repeat(2, 1fr); }
|
||||
.metric-block:nth-child(2) { border-right: 0; }
|
||||
.autonomy-grid, .lower-grid { grid-template-columns: 1fr; }
|
||||
.pipeline { grid-template-columns: repeat(5, 1fr); gap: 10px; }
|
||||
.pipeline-arrow { display: none; }
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.autonomy-shell { padding: 22px 16px 50px; }
|
||||
.autonomy-hero { min-height: 0; padding-top: 16px; flex-direction: column; align-items: stretch; }
|
||||
.hero-copy h2 { font-size: 44px; }
|
||||
.hero-mode { padding-left: 0; border-left: 0; }
|
||||
.metric-block, .metric-block:first-child { min-height: 112px; padding: 18px 12px; }
|
||||
.metric-block strong { font-size: 28px; }
|
||||
.pipeline { grid-template-columns: 1fr; padding: 16px 18px; gap: 18px; }
|
||||
.pipeline-step { grid-template-columns: 24px 1fr auto; grid-template-rows: auto auto; }
|
||||
.pipeline-step b { grid-column: 3; grid-row: 1 / span 2; margin: 0; }
|
||||
.hypothesis-row { grid-template-columns: 72px 1fr auto; gap: 12px; }
|
||||
.hypothesis-meta { display: none; }
|
||||
.decision-chip { grid-column: 3; }
|
||||
}
|
||||
+109
-104
@@ -1,117 +1,122 @@
|
||||
/* design tokens + resets + element defaults shared across every admin page */
|
||||
|
||||
:root {
|
||||
--bg: #020817;
|
||||
--bg-card: #0f172a;
|
||||
--bg-subtle: #0b1120;
|
||||
--border: #1e293b;
|
||||
--border-light: #162032;
|
||||
--foreground: #f8fafc;
|
||||
--muted: #94a3b8;
|
||||
--muted-dark: #475569;
|
||||
--primary: #f8fafc;
|
||||
--primary-bg: #1e293b;
|
||||
--accent: #3b82f6;
|
||||
--accent-hover: #2563eb;
|
||||
--destructive: #7f1d1d;
|
||||
--destructive-fg: #fca5a5;
|
||||
--radius: 6px;
|
||||
--radius-lg: 10px;
|
||||
--bg: #090b0a;
|
||||
--bg-card: #111411;
|
||||
--bg-elevated: #171a17;
|
||||
--bg-subtle: #0d100e;
|
||||
--border: #293029;
|
||||
--border-light: #1d231e;
|
||||
--foreground: #f2f0e8;
|
||||
--muted: #9ca398;
|
||||
--muted-dark: #687066;
|
||||
--primary: #dfff4f;
|
||||
--primary-bg: #dfff4f;
|
||||
--accent: #dfff4f;
|
||||
--accent-hover: #edff93;
|
||||
--positive: #8ee6a8;
|
||||
--negative: #ff8d7d;
|
||||
--warning: #f3c969;
|
||||
--destructive: #8a3029;
|
||||
--destructive-fg: #ffaaa0;
|
||||
--radius: 4px;
|
||||
--radius-lg: 8px;
|
||||
--rail: 224px;
|
||||
--sans: "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
--mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
html { background: var(--bg); }
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
|
||||
background: var(--bg);
|
||||
font-family: var(--sans);
|
||||
background:
|
||||
radial-gradient(circle at 85% -10%, rgba(223, 255, 79, .055), transparent 34rem),
|
||||
var(--bg);
|
||||
color: var(--foreground);
|
||||
font-size: 14px;
|
||||
line-height: 1.45;
|
||||
min-height: 100vh;
|
||||
padding-left: var(--rail);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
|
||||
/* ── inputs / selects ── */
|
||||
|
||||
input[type="text"], input[type="date"], select {
|
||||
background: var(--bg-subtle);
|
||||
border: 1px solid var(--border);
|
||||
color: var(--foreground);
|
||||
padding: 7px 10px;
|
||||
border-radius: var(--radius);
|
||||
font-size: 13px;
|
||||
outline: none;
|
||||
min-width: 140px;
|
||||
transition: border-color .15s, box-shadow .15s;
|
||||
}
|
||||
|
||||
input[type="text"]:focus, input[type="date"]:focus, select:focus {
|
||||
border-color: var(--accent);
|
||||
box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
|
||||
}
|
||||
|
||||
select option { background: #0f172a; }
|
||||
|
||||
|
||||
/* ── buttons ── */
|
||||
|
||||
button {
|
||||
background: var(--primary-bg);
|
||||
border: 1px solid var(--border);
|
||||
color: var(--foreground);
|
||||
padding: 7px 14px;
|
||||
border-radius: var(--radius);
|
||||
cursor: pointer;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
transition: background .15s, opacity .1s;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
button:hover { background: #263347; }
|
||||
|
||||
button.primary {
|
||||
background: var(--foreground);
|
||||
color: #0f172a;
|
||||
border-color: transparent;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
button.primary:hover { background: #e2e8f0; }
|
||||
|
||||
button.danger {
|
||||
background: transparent;
|
||||
border-color: var(--destructive);
|
||||
color: var(--destructive-fg);
|
||||
}
|
||||
|
||||
button.danger:hover { background: rgba(127, 29, 29, .3); }
|
||||
|
||||
button:disabled { opacity: .4; cursor: not-allowed; }
|
||||
|
||||
|
||||
/* textarea — shared across article modal and sql console */
|
||||
|
||||
textarea {
|
||||
background: var(--bg-subtle);
|
||||
border: 1px solid var(--border);
|
||||
color: var(--foreground);
|
||||
padding: 8px 10px;
|
||||
border-radius: var(--radius);
|
||||
font-size: 13px;
|
||||
resize: vertical;
|
||||
font-family: inherit;
|
||||
outline: none;
|
||||
min-height: 120px;
|
||||
transition: border-color .15s, box-shadow .15s;
|
||||
}
|
||||
|
||||
textarea:focus {
|
||||
border-color: var(--accent);
|
||||
box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
|
||||
}
|
||||
|
||||
|
||||
.url-link { color: #60a5fa; text-decoration: none; }
|
||||
.url-link:hover { text-decoration: underline; }
|
||||
::selection { background: var(--accent); color: #0b0d0b; }
|
||||
|
||||
a { color: inherit; }
|
||||
|
||||
button, input, select, textarea { font: inherit; }
|
||||
|
||||
input[type="text"], input[type="date"], input[type="search"], input[type="number"], select {
|
||||
min-width: 140px;
|
||||
height: 38px;
|
||||
padding: 0 11px;
|
||||
color: var(--foreground);
|
||||
background: #0b0e0c;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
outline: none;
|
||||
transition: border-color 140ms, box-shadow 140ms, background 140ms;
|
||||
}
|
||||
|
||||
input::placeholder { color: #596057; }
|
||||
select option { background: #111411; }
|
||||
|
||||
input:focus, select:focus, textarea:focus {
|
||||
border-color: rgba(223,255,79,.75);
|
||||
box-shadow: 0 0 0 3px rgba(223,255,79,.09);
|
||||
background: #0f130f;
|
||||
}
|
||||
|
||||
button {
|
||||
min-height: 36px;
|
||||
padding: 0 14px;
|
||||
color: var(--foreground);
|
||||
background: var(--bg-elevated);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
font-weight: 650;
|
||||
letter-spacing: .02em;
|
||||
transition: transform 100ms, background 140ms, border-color 140ms;
|
||||
}
|
||||
|
||||
button:hover { background: #20251f; border-color: #414a40; }
|
||||
button:active { transform: translateY(1px); }
|
||||
|
||||
button.primary {
|
||||
color: #0c0e0c;
|
||||
background: var(--primary-bg);
|
||||
border-color: var(--primary-bg);
|
||||
}
|
||||
|
||||
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
|
||||
|
||||
button.danger { background: transparent; border-color: #69332e; color: var(--destructive-fg); }
|
||||
button.danger:hover { background: rgba(138,48,41,.22); }
|
||||
button:disabled { opacity: .38; cursor: not-allowed; transform: none; }
|
||||
|
||||
textarea {
|
||||
min-height: 120px;
|
||||
padding: 10px 11px;
|
||||
resize: vertical;
|
||||
color: var(--foreground);
|
||||
background: var(--bg-subtle);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.url-link { color: var(--accent); text-decoration: none; }
|
||||
.url-link:hover { text-decoration: underline; text-underline-offset: 3px; }
|
||||
|
||||
.mono { font-family: var(--mono); }
|
||||
.positive { color: var(--positive); }
|
||||
.negative { color: var(--negative); }
|
||||
.muted { color: var(--muted); }
|
||||
|
||||
@media (max-width: 820px) {
|
||||
:root { --rail: 0px; }
|
||||
body { padding-left: 0; padding-top: 68px; }
|
||||
}
|
||||
|
||||
@@ -1,168 +1,75 @@
|
||||
/* reusable building blocks: tables, badges, pagination, dialogs, toasts */
|
||||
|
||||
|
||||
/* ── table ── */
|
||||
|
||||
.table-wrap {
|
||||
background: var(--bg-card);
|
||||
overflow: auto;
|
||||
background: rgba(17,20,17,.78);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-lg);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
table { width: 100%; border-collapse: collapse; }
|
||||
|
||||
th {
|
||||
text-align: left;
|
||||
padding: 10px 14px;
|
||||
padding: 12px 14px;
|
||||
color: #697167;
|
||||
background: #0e110f;
|
||||
border-bottom: 1px solid var(--border);
|
||||
color: var(--muted-dark);
|
||||
font-size: 11px;
|
||||
text-align: left;
|
||||
font-family: var(--mono);
|
||||
font-size: 9px;
|
||||
font-weight: 700;
|
||||
letter-spacing: .1em;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: .06em;
|
||||
font-weight: 600;
|
||||
background: var(--bg-subtle);
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 10px 14px;
|
||||
border-bottom: 1px solid var(--border-light);
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
tr:last-child td { border-bottom: none; }
|
||||
|
||||
tr:hover td { background: rgba(255,255,255,.02); }
|
||||
|
||||
|
||||
/* ── truncate ── */
|
||||
|
||||
.truncate {
|
||||
max-width: 280px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
display: block;
|
||||
}
|
||||
|
||||
td { padding: 13px 14px; color: #c9cdc5; border-bottom: 1px solid var(--border-light); vertical-align: middle; font-size: 12px; }
|
||||
tr:last-child td { border-bottom: 0; }
|
||||
tbody tr { transition: background 120ms; }
|
||||
tbody tr:hover { background: rgba(255,255,255,.022); }
|
||||
|
||||
/* ── badges ── */
|
||||
.truncate { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
|
||||
|
||||
.badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 2px 8px;
|
||||
border-radius: 4px;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
letter-spacing: .03em;
|
||||
gap: 5px;
|
||||
padding: 3px 7px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 3px;
|
||||
font-family: var(--mono);
|
||||
font-size: 9px;
|
||||
font-weight: 700;
|
||||
letter-spacing: .05em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.badge.ok { background: rgba(20, 83, 45, .5); color: #86efac; border: 1px solid rgba(134,239,172,.15); }
|
||||
.badge.err { background: rgba(127, 29, 29, .5); color: #fca5a5; border: 1px solid rgba(252,165,165,.15); }
|
||||
.badge.pending { background: rgba(30, 58, 95, .5); color: #93c5fd; border: 1px solid rgba(147,197,253,.15); }
|
||||
.badge.null { background: rgba(30, 41, 59, .7); color: #64748b; border: 1px solid var(--border); }
|
||||
.badge.ok { color: var(--positive); background: rgba(74,143,94,.1); border-color: rgba(142,230,168,.2); }
|
||||
.badge.err { color: var(--negative); background: rgba(165,67,54,.1); border-color: rgba(255,141,125,.2); }
|
||||
.badge.pending { color: var(--warning); background: rgba(180,137,47,.1); border-color: rgba(243,201,105,.2); }
|
||||
.badge.null { color: var(--muted-dark); background: rgba(100,110,100,.08); }
|
||||
|
||||
.pagination { display: flex; align-items: center; gap: 10px; margin-top: 14px; color: var(--muted-dark); font-family: var(--mono); font-size: 10px; }
|
||||
.pagination button { min-height: 32px; padding: 0 11px; }
|
||||
|
||||
/* ── pagination ── */
|
||||
|
||||
.pagination {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-top: 14px;
|
||||
color: var(--muted-dark);
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.pagination button { font-size: 12px; padding: 5px 12px; }
|
||||
|
||||
|
||||
/* ── overlay / dialog ── */
|
||||
|
||||
.overlay {
|
||||
display: none;
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(2, 8, 23, .75);
|
||||
backdrop-filter: blur(4px);
|
||||
z-index: 100;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.overlay { display: none; position: fixed; inset: 0; z-index: 100; align-items: center; justify-content: center; padding: 24px; background: rgba(3,5,4,.8); backdrop-filter: blur(10px); }
|
||||
.overlay.open { display: flex; }
|
||||
|
||||
.modal {
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: 28px;
|
||||
width: 680px;
|
||||
max-width: 95vw;
|
||||
max-height: 90vh;
|
||||
overflow-y: auto;
|
||||
box-shadow: 0 25px 50px -12px rgba(0,0,0,.5);
|
||||
}
|
||||
|
||||
.modal h2 {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 6px;
|
||||
letter-spacing: -.01em;
|
||||
}
|
||||
|
||||
.modal-divider {
|
||||
height: 1px;
|
||||
background: var(--border);
|
||||
margin: 16px -28px;
|
||||
}
|
||||
|
||||
.field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 5px; }
|
||||
|
||||
.field label {
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
color: var(--muted);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: .05em;
|
||||
}
|
||||
|
||||
.field input[type="text"],
|
||||
.field textarea,
|
||||
.field select { width: 100%; min-width: unset; }
|
||||
|
||||
.modal-footer {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
margin-top: 20px;
|
||||
padding-top: 16px;
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
|
||||
|
||||
/* ── toast ── */
|
||||
|
||||
#toast {
|
||||
position: fixed;
|
||||
bottom: 24px;
|
||||
right: 24px;
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border);
|
||||
color: var(--foreground);
|
||||
padding: 10px 16px;
|
||||
border-radius: var(--radius);
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
display: none;
|
||||
z-index: 200;
|
||||
box-shadow: 0 8px 24px rgba(0,0,0,.4);
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
.modal { width: 680px; max-width: 100%; max-height: 90vh; overflow-y: auto; padding: 26px; background: #121512; border: 1px solid #343c34; border-radius: 8px; box-shadow: 0 28px 90px rgba(0,0,0,.55); }
|
||||
.modal h2 { font-size: 18px; font-weight: 650; letter-spacing: -.025em; }
|
||||
.modal-divider { height: 1px; margin: 18px -26px; background: var(--border); }
|
||||
.field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
|
||||
.field label { color: var(--muted-dark); font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
|
||||
.field input, .field textarea, .field select { width: 100%; min-width: 0; }
|
||||
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }
|
||||
|
||||
#toast { position: fixed; right: 24px; bottom: 24px; z-index: 200; display: none; align-items: center; gap: 9px; padding: 11px 14px; color: var(--foreground); background: #171b17; border: 1px solid #374037; border-radius: 5px; box-shadow: 0 14px 40px rgba(0,0,0,.45); font-size: 12px; }
|
||||
#toast.show { display: flex; }
|
||||
#toast .toast-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; flex-shrink: 0; }
|
||||
#toast.error .toast-dot { background: #ef4444; }
|
||||
#toast .toast-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--positive); }
|
||||
#toast.error .toast-dot { background: var(--negative); }
|
||||
|
||||
.empty-state { padding: 42px 24px; color: var(--muted-dark); text-align: center; }
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.table-wrap { border-radius: 0; margin-inline: -16px; border-left: 0; border-right: 0; }
|
||||
th, td { padding-inline: 11px; }
|
||||
.modal { padding: 20px; }
|
||||
}
|
||||
|
||||
@@ -58,6 +58,20 @@
|
||||
#intel-stats-row .intel-stat-card:first-child { padding-left: 24px; }
|
||||
#intel-stats-row .intel-stat-card:last-child { border-right: none; }
|
||||
|
||||
/* The autonomy-era shell owns the stat strip layout. Keep the legacy
|
||||
intelligence data but present it in the same visual system. */
|
||||
#intel-stats-row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
||||
}
|
||||
|
||||
#intel-stats-row .intel-stat-card,
|
||||
#intel-stats-row .intel-stat-card:first-child {
|
||||
min-width: 0;
|
||||
padding: 20px 26px;
|
||||
border-right: 1px solid var(--border-light);
|
||||
}
|
||||
|
||||
|
||||
/* ── intel detail body (modal) ── */
|
||||
|
||||
|
||||
+115
-120
@@ -1,178 +1,173 @@
|
||||
/* page chrome — header, tabs, subnav, stats bar, content shell */
|
||||
|
||||
|
||||
/* ── header ── */
|
||||
|
||||
header.app-header {
|
||||
background: var(--bg-card);
|
||||
border-bottom: 1px solid var(--border);
|
||||
padding: 0 24px;
|
||||
position: fixed;
|
||||
inset: 0 auto 0 0;
|
||||
z-index: 80;
|
||||
width: 224px;
|
||||
height: 100vh;
|
||||
padding: 26px 18px 18px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 24px;
|
||||
height: 52px;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
background: rgba(13, 16, 14, .96);
|
||||
border-right: 1px solid var(--border);
|
||||
backdrop-filter: blur(18px);
|
||||
}
|
||||
|
||||
header.app-header h1 {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 11px;
|
||||
margin: 0 8px 34px;
|
||||
color: var(--foreground);
|
||||
letter-spacing: -.01em;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
letter-spacing: -.02em;
|
||||
}
|
||||
|
||||
header.app-header h1 span {
|
||||
color: var(--muted);
|
||||
font-weight: 400;
|
||||
.brand-mark {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
color: #0b0d0b;
|
||||
background: var(--accent);
|
||||
border-radius: 3px 11px 3px 3px;
|
||||
font-family: var(--mono);
|
||||
font-size: 13px;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
|
||||
/* ── primary tabs (underline style) ── */
|
||||
.brand-copy { display: flex; flex-direction: column; line-height: 1.05; }
|
||||
.brand-copy span { margin-top: 5px; color: var(--muted-dark); font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
|
||||
|
||||
.tabs {
|
||||
display: flex;
|
||||
gap: 0;
|
||||
margin-left: auto;
|
||||
height: 100%;
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
margin: 0;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.tabs::before {
|
||||
content: "Workspace";
|
||||
margin: 0 10px 10px;
|
||||
color: #5d655b;
|
||||
font-family: var(--mono);
|
||||
font-size: 9px;
|
||||
font-weight: 700;
|
||||
letter-spacing: .14em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.tabs a {
|
||||
background: none;
|
||||
border: none;
|
||||
border-bottom: 2px solid transparent;
|
||||
color: var(--muted);
|
||||
padding: 0 14px;
|
||||
cursor: pointer;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
transition: color .15s, border-color .15s;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
height: 40px;
|
||||
padding: 0 11px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #899087;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 5px;
|
||||
text-decoration: none;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
transition: color 140ms, background 140ms, border-color 140ms;
|
||||
}
|
||||
|
||||
.tabs a:hover { color: var(--foreground); }
|
||||
.tabs a:hover { color: var(--foreground); background: #151915; }
|
||||
.tabs a.active { color: var(--foreground); background: #1a1f1a; border-color: #293129; }
|
||||
.tabs a.active::after { content: ""; position: absolute; right: 10px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px rgba(223,255,79,.6); }
|
||||
|
||||
.tabs a.active {
|
||||
color: var(--foreground);
|
||||
border-bottom-color: var(--foreground);
|
||||
.rail-status {
|
||||
margin-top: auto;
|
||||
padding: 13px 12px;
|
||||
background: #101310;
|
||||
border: 1px solid var(--border-light);
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
|
||||
/* ── subnav (intelligence sub-sections) ── */
|
||||
.rail-status-label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 600; }
|
||||
.rail-status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 10px rgba(243,201,105,.35); }
|
||||
.rail-status-dot.live { background: var(--positive); box-shadow: 0 0 10px rgba(142,230,168,.4); }
|
||||
.rail-status-meta { margin-top: 7px; color: #5e665d; font-family: var(--mono); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
|
||||
|
||||
.subnav {
|
||||
background: var(--bg-card);
|
||||
border-bottom: 1px solid var(--border);
|
||||
padding: 0 24px;
|
||||
min-height: 48px;
|
||||
padding: 0 32px;
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
gap: 0;
|
||||
height: 38px;
|
||||
gap: 22px;
|
||||
background: rgba(9,11,10,.88);
|
||||
border-bottom: 1px solid var(--border-light);
|
||||
backdrop-filter: blur(14px);
|
||||
}
|
||||
|
||||
.subnav a {
|
||||
color: var(--muted-dark);
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
text-decoration: none;
|
||||
padding: 0 14px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 2px solid transparent;
|
||||
transition: color .15s, border-color .15s;
|
||||
color: var(--muted-dark);
|
||||
border-bottom: 1px solid transparent;
|
||||
text-decoration: none;
|
||||
font-family: var(--mono);
|
||||
font-size: 10px;
|
||||
font-weight: 650;
|
||||
letter-spacing: .09em;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: .05em;
|
||||
}
|
||||
|
||||
.subnav a:hover { color: var(--foreground); }
|
||||
.subnav a.active { color: var(--accent); border-bottom-color: var(--accent); }
|
||||
|
||||
.subnav a.active {
|
||||
color: var(--foreground);
|
||||
border-bottom-color: var(--accent);
|
||||
.stats-bar, #intel-stats-row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
|
||||
background: #0c0f0d;
|
||||
border-bottom: 1px solid var(--border-light);
|
||||
}
|
||||
|
||||
|
||||
/* ── stats bar ── */
|
||||
/* each .stat owns its own horizontal padding so the vertical separator
|
||||
renders edge-to-edge; no margin gap between cells. */
|
||||
|
||||
.stats-bar {
|
||||
display: flex;
|
||||
background: var(--bg-card);
|
||||
border-bottom: 1px solid var(--border);
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.stat {
|
||||
.stat, #intel-stats-row .intel-stat-card {
|
||||
min-width: 0;
|
||||
padding: 20px 26px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
padding: 16px 32px;
|
||||
border-right: 1px solid var(--border);
|
||||
flex: 0 0 auto;
|
||||
gap: 7px;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
border-right: 1px solid var(--border-light);
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.stat:first-child { padding-left: 24px; }
|
||||
.stat:last-child { border-right: none; }
|
||||
.stat:last-child, #intel-stats-row .intel-stat-card:last-child { border-right: 0; }
|
||||
.stat .label, #intel-stats-row .label { color: var(--muted-dark); font-family: var(--mono); font-size: 9px; font-weight: 650; letter-spacing: .11em; text-transform: uppercase; }
|
||||
.stat .value, #intel-stats-row .value { color: var(--foreground); font-size: 25px; font-weight: 630; letter-spacing: -.045em; line-height: 1; }
|
||||
|
||||
.stat .label {
|
||||
color: var(--muted-dark);
|
||||
font-size: 11px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: .06em;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.stat .value {
|
||||
font-size: 22px;
|
||||
font-weight: 700;
|
||||
color: var(--foreground);
|
||||
letter-spacing: -.02em;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
|
||||
/* ── content ── */
|
||||
|
||||
.content { padding: 24px; }
|
||||
|
||||
|
||||
/* ── filters ── */
|
||||
.content { width: min(1480px, 100%); margin: 0 auto; padding: 32px; }
|
||||
|
||||
.filters {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin-bottom: 18px;
|
||||
flex-wrap: wrap;
|
||||
padding: 13px;
|
||||
align-items: flex-end;
|
||||
padding: 14px;
|
||||
background: var(--bg-card);
|
||||
flex-wrap: wrap;
|
||||
background: rgba(17,20,17,.72);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-lg);
|
||||
}
|
||||
|
||||
.filters label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 5px;
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
color: var(--muted);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: .05em;
|
||||
}
|
||||
.filters label { display: flex; flex-direction: column; gap: 6px; color: var(--muted-dark); font-family: var(--mono); font-size: 9px; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; }
|
||||
.section-heading { margin-bottom: 12px; color: var(--muted-dark); font-family: var(--mono); font-size: 10px; font-weight: 650; letter-spacing: .11em; text-transform: uppercase; }
|
||||
|
||||
|
||||
/* ── section heading ── */
|
||||
|
||||
.section-heading {
|
||||
font-size: 12px;
|
||||
color: var(--muted-dark);
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: .06em;
|
||||
margin-bottom: 12px;
|
||||
@media (max-width: 820px) {
|
||||
header.app-header { inset: 0 0 auto 0; width: 100%; height: 68px; padding: 12px 16px; flex-direction: row; align-items: center; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); }
|
||||
header.app-header h1 { margin: 0 10px 0 0; flex: 0 0 auto; }
|
||||
.brand-copy span, .tabs::before, .rail-status { display: none; }
|
||||
.tabs { flex-direction: row; gap: 2px; }
|
||||
.tabs a { height: 38px; padding: 0 10px; white-space: nowrap; }
|
||||
.tabs a.active::after { display: none; }
|
||||
.subnav { padding: 0 18px; overflow-x: auto; }
|
||||
.content { padding: 20px 16px 32px; }
|
||||
.stats-bar, #intel-stats-row { grid-template-columns: repeat(2, 1fr); }
|
||||
.stat, #intel-stats-row .intel-stat-card { padding: 16px; }
|
||||
}
|
||||
|
||||
@@ -34,6 +34,72 @@ function escapeHtml(s) {
|
||||
}
|
||||
|
||||
|
||||
function formatNumber(value, compact = false) {
|
||||
const number = Number(value || 0);
|
||||
return new Intl.NumberFormat("en-GB", compact ? { notation: "compact", maximumFractionDigits: 1 } : {}).format(number);
|
||||
}
|
||||
|
||||
|
||||
function formatPercent(value, digits = 1) {
|
||||
if (value == null || !Number.isFinite(Number(value))) return "—";
|
||||
return `${(Number(value) * 100).toFixed(digits)}%`;
|
||||
}
|
||||
|
||||
|
||||
function formatRelative(value) {
|
||||
if (!value) return "—";
|
||||
const timestamp = new Date(value.endsWith && value.endsWith("Z") ? value : `${value}Z`).getTime();
|
||||
if (!Number.isFinite(timestamp)) return value;
|
||||
const seconds = Math.round((timestamp - Date.now()) / 1000);
|
||||
const units = [[86400, "day"], [3600, "hour"], [60, "minute"]];
|
||||
const formatter = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
|
||||
for (const [size, name] of units) {
|
||||
if (Math.abs(seconds) >= size) return formatter.format(Math.round(seconds / size), name);
|
||||
}
|
||||
return "just now";
|
||||
}
|
||||
|
||||
|
||||
function installChrome() {
|
||||
const header = document.querySelector("header.app-header");
|
||||
if (!header) return;
|
||||
const title = header.querySelector("h1");
|
||||
if (title) title.innerHTML = `<span class="brand-mark">D</span><span class="brand-copy">Duriin<span>Autonomous intelligence</span></span>`;
|
||||
|
||||
const nav = header.querySelector(".tabs");
|
||||
if (nav && !nav.querySelector('[href="/admin/autonomy"]')) {
|
||||
nav.insertAdjacentHTML("afterbegin", '<a href="/admin/autonomy">Autonomy</a>');
|
||||
}
|
||||
if (nav) {
|
||||
const path = location.pathname;
|
||||
nav.querySelectorAll("a").forEach(link => {
|
||||
const href = link.getAttribute("href");
|
||||
const active = href === "/admin/autonomy"
|
||||
? path === href
|
||||
: href === "/admin/ingest"
|
||||
? path.startsWith("/admin/ingest")
|
||||
: href === "/admin/intelligence"
|
||||
? path.startsWith("/admin/intelligence")
|
||||
: path === href;
|
||||
link.classList.toggle("active", active);
|
||||
});
|
||||
}
|
||||
|
||||
const status = document.createElement("div");
|
||||
status.className = "rail-status";
|
||||
status.innerHTML = `<div class="rail-status-label"><span class="rail-status-dot"></span><span id="rail-mode">Connecting</span></div><div class="rail-status-meta" id="rail-meta">Runtime status</div>`;
|
||||
header.appendChild(status);
|
||||
api("/admin/api/autonomy/overview").then(data => {
|
||||
const mode = String(data.mode || "offline").toUpperCase();
|
||||
document.getElementById("rail-mode").textContent = data.enabled ? `${mode} runtime` : "Runtime unavailable";
|
||||
document.getElementById("rail-meta").textContent = data.broker?.configured ? `${data.broker.name} · connected` : "Broker not configured";
|
||||
document.querySelector(".rail-status-dot")?.classList.toggle("live", data.enabled);
|
||||
}).catch(() => {
|
||||
document.getElementById("rail-mode").textContent = "Runtime unavailable";
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// ── url query-param helpers ────────────────────────────────────────────────
|
||||
//
|
||||
// filters and sort state live in the url so reloads and shared links keep
|
||||
@@ -106,6 +172,7 @@ function wireOverlays() {
|
||||
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
installChrome();
|
||||
wireOverlays();
|
||||
loadGlobalStats();
|
||||
});
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
(function () {
|
||||
const byId = id => document.getElementById(id);
|
||||
const count = (rows, key, value) => Number((rows || []).find(row => row[key] === value)?.count || 0);
|
||||
const sum = (rows, predicate) => (rows || []).filter(predicate).reduce((total, row) => total + Number(row.count || 0), 0);
|
||||
|
||||
function renderHypotheses(rows) {
|
||||
const host = byId("hypothesis-list");
|
||||
if (!rows?.length) {
|
||||
host.innerHTML = '<div class="empty-state">No autonomy hypotheses yet. The coordinator is working through the evidence queue.</div>';
|
||||
return;
|
||||
}
|
||||
host.innerHTML = rows.slice(0, 7).map(row => {
|
||||
const action = row.action || (row.status === "resolved" ? "MEASURED" : "OPEN");
|
||||
const direction = row.direction === "positive" ? "positive" : "negative";
|
||||
return `<article class="hypothesis-row">
|
||||
<div><div class="hypothesis-symbol">${escapeHtml(row.instrument)}</div><div class="direction-tag ${direction}">${escapeHtml(row.direction)}</div></div>
|
||||
<div><div class="hypothesis-type">${escapeHtml(String(row.event_type || "event").replaceAll("_", " "))}</div><div class="hypothesis-channel">${escapeHtml(row.causal_channel || "Evidence-backed market hypothesis")}</div></div>
|
||||
<div class="hypothesis-meta">${row.evidence_count || 0} evidence source${row.evidence_count === 1 ? "" : "s"}<br>${row.horizon_days} trading-day horizon<br>${formatRelative(row.created_at)}</div>
|
||||
<span class="decision-chip ${String(action).toLowerCase()}">${escapeHtml(action)}</span>
|
||||
</article>`;
|
||||
}).join("");
|
||||
}
|
||||
|
||||
function renderLedger(rows) {
|
||||
const host = byId("decision-ledger");
|
||||
const decisions = (rows || []).filter(row => row.action);
|
||||
if (!decisions.length) return;
|
||||
host.innerHTML = decisions.map(row => `<tr>
|
||||
<td class="mono">${escapeHtml(row.instrument)}</td>
|
||||
<td><span class="decision-chip ${String(row.action).toLowerCase()}">${escapeHtml(row.action)}</span></td>
|
||||
<td class="${row.direction === "positive" ? "positive" : "negative"}">${escapeHtml(row.direction)}</td>
|
||||
<td class="mono">${formatPercent(row.calibrated_probability)}</td>
|
||||
<td>${row.horizon_days}d</td>
|
||||
<td class="muted">${formatRelative(row.created_at)}</td>
|
||||
</tr>`).join("");
|
||||
}
|
||||
|
||||
function render(data) {
|
||||
if (!data.enabled) throw new Error(data.reason || "Autonomy is unavailable");
|
||||
const mode = String(data.mode || "shadow").toUpperCase();
|
||||
const open = count(data.predictionCounts, "status", "open");
|
||||
const resolved = count(data.predictionCounts, "status", "resolved");
|
||||
const outcomes = Number(data.outcomes?.total || 0);
|
||||
const correct = Number(data.outcomes?.correct || 0);
|
||||
const accuracy = outcomes ? correct / outcomes : null;
|
||||
const pendingHistorical = count((data.jobs || []).filter(row => row.lane === "historical"), "status", "pending");
|
||||
const completedJobs = sum(data.jobs, row => row.status === "complete");
|
||||
const proposals = sum(data.proposalCounts, row => row.status === "accepted");
|
||||
const decisions = sum(data.decisionCounts, () => true);
|
||||
|
||||
byId("execution-mode").textContent = mode;
|
||||
byId("ledger-mode").textContent = mode;
|
||||
byId("runtime-execution").textContent = mode;
|
||||
byId("broker-state").textContent = data.broker?.configured ? `${data.broker.name} connected` : "Broker credentials unavailable";
|
||||
byId("runtime-state").textContent = `${mode} runtime active`;
|
||||
byId("hero-title").textContent = mode === "PAPER" ? "Duriin is trading in simulation." : "Duriin is learning before it acts.";
|
||||
byId("hero-description").textContent = mode === "PAPER"
|
||||
? "Every order is backed by measured evidence, empirical calibration and deterministic risk policy. No model has direct execution authority."
|
||||
: "It is turning evidence into hypotheses, waiting for outcomes, and calibrating its judgment without placing broker orders.";
|
||||
|
||||
byId("metric-open").textContent = formatNumber(open);
|
||||
byId("metric-resolved").textContent = `${formatNumber(resolved)} resolved`;
|
||||
byId("metric-accuracy").textContent = formatPercent(accuracy);
|
||||
byId("metric-sample").textContent = outcomes ? `${formatNumber(outcomes)} measured outcomes` : "Waiting for outcomes";
|
||||
byId("metric-alpha").textContent = formatPercent(data.outcomes?.average_excess_return, 2);
|
||||
byId("metric-universe").textContent = formatNumber(data.allowlistedInstruments, true);
|
||||
|
||||
byId("pipe-observe").textContent = formatNumber(completedJobs, true);
|
||||
byId("pipe-propose").textContent = formatNumber(proposals, true);
|
||||
byId("pipe-measure").textContent = formatNumber(outcomes, true);
|
||||
byId("pipe-calibrate").textContent = formatNumber(data.calibration?.length || 0);
|
||||
byId("pipe-act").textContent = formatNumber(decisions);
|
||||
byId("freshness").textContent = `Updated ${formatRelative(data.generatedAt)}`;
|
||||
|
||||
byId("orbit-value").textContent = formatPercent(accuracy, 0);
|
||||
byId("accuracy-orbit").style.setProperty("--accuracy", `${(accuracy || 0) * 360}deg`);
|
||||
byId("perf-resolved").textContent = formatNumber(outcomes);
|
||||
byId("perf-correct").textContent = formatNumber(correct);
|
||||
byId("perf-cohorts").textContent = formatNumber(data.calibration?.length || 0);
|
||||
if (outcomes) byId("performance-note").textContent = `Measured on ${outcomes} matured predictions. Results remain descriptive until the sample is large enough for stable calibration.`;
|
||||
|
||||
byId("runtime-queue").textContent = `${formatNumber(pendingHistorical, true)} pending`;
|
||||
byId("runtime-coordinator").textContent = pendingHistorical ? "Processing" : "Watching";
|
||||
if (data.account) {
|
||||
byId("account-equity").textContent = new Intl.NumberFormat("en-US", { style: "currency", currency: "USD", maximumFractionDigits: 0 }).format(data.account.equity || 0);
|
||||
byId("account-meta").textContent = `${data.account.broker} · sampled ${formatRelative(data.account.captured_at)}`;
|
||||
}
|
||||
|
||||
renderHypotheses(data.latestPredictions);
|
||||
renderLedger(data.latestPredictions);
|
||||
}
|
||||
|
||||
api("/admin/api/autonomy/overview").then(render).catch(error => {
|
||||
byId("hero-title").textContent = "Duriin cannot read its autonomy state.";
|
||||
byId("hero-description").textContent = error.message;
|
||||
byId("hypothesis-list").innerHTML = '<div class="empty-state">Runtime data is unavailable.</div>';
|
||||
toast("Autonomy overview unavailable", true);
|
||||
});
|
||||
})();
|
||||
@@ -0,0 +1,137 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="theme-color" content="#090b0a">
|
||||
<title>Duriin — Autonomy</title>
|
||||
<link rel="stylesheet" href="/admin/assets/css/base.css">
|
||||
<link rel="stylesheet" href="/admin/assets/css/layout.css">
|
||||
<link rel="stylesheet" href="/admin/assets/css/components.css">
|
||||
<link rel="stylesheet" href="/admin/assets/css/autonomy.css">
|
||||
</head>
|
||||
<body class="page-autonomy">
|
||||
|
||||
<header class="app-header">
|
||||
<h1>Duriin</h1>
|
||||
<nav class="tabs">
|
||||
<a href="/admin/autonomy" class="active">Autonomy</a>
|
||||
<a href="/admin/ingest">Ingest</a>
|
||||
<a href="/admin/intelligence">Intelligence</a>
|
||||
<a href="/admin/stats">Stats</a>
|
||||
<a href="/admin/sql">SQL</a>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main class="autonomy-shell">
|
||||
<section class="autonomy-hero">
|
||||
<div class="hero-copy">
|
||||
<div class="eyebrow"><span class="pulse"></span><span id="runtime-state">Autonomy runtime</span></div>
|
||||
<h2 id="hero-title">Duriin is observing.</h2>
|
||||
<p id="hero-description">Building evidence-backed hypotheses from the archive and measuring them against the market.</p>
|
||||
</div>
|
||||
<div class="hero-mode">
|
||||
<span class="mode-label">Execution authority</span>
|
||||
<strong id="execution-mode">—</strong>
|
||||
<span id="broker-state">Connecting to broker state…</span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="metric-strip" aria-label="Autonomy summary">
|
||||
<article class="metric-block">
|
||||
<span class="metric-kicker">Open hypotheses</span>
|
||||
<strong id="metric-open">—</strong>
|
||||
<small id="metric-resolved">— resolved</small>
|
||||
</article>
|
||||
<article class="metric-block">
|
||||
<span class="metric-kicker">Directional accuracy</span>
|
||||
<strong id="metric-accuracy">—</strong>
|
||||
<small id="metric-sample">Waiting for outcomes</small>
|
||||
</article>
|
||||
<article class="metric-block">
|
||||
<span class="metric-kicker">Average excess return</span>
|
||||
<strong id="metric-alpha">—</strong>
|
||||
<small>Against SPY benchmark</small>
|
||||
</article>
|
||||
<article class="metric-block">
|
||||
<span class="metric-kicker">Tradable universe</span>
|
||||
<strong id="metric-universe">—</strong>
|
||||
<small>Verified Alpaca instruments</small>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<section class="pipeline-section panel">
|
||||
<div class="section-head">
|
||||
<div><span class="section-index">01</span><h3>Learning loop</h3></div>
|
||||
<span class="freshness" id="freshness">Updating…</span>
|
||||
</div>
|
||||
<div class="pipeline" id="pipeline">
|
||||
<div class="pipeline-step"><span class="step-number">01</span><strong>Observe</strong><small>Archive events</small><b id="pipe-observe">—</b></div>
|
||||
<div class="pipeline-arrow">→</div>
|
||||
<div class="pipeline-step"><span class="step-number">02</span><strong>Propose</strong><small>Evidence hypotheses</small><b id="pipe-propose">—</b></div>
|
||||
<div class="pipeline-arrow">→</div>
|
||||
<div class="pipeline-step"><span class="step-number">03</span><strong>Measure</strong><small>Market outcomes</small><b id="pipe-measure">—</b></div>
|
||||
<div class="pipeline-arrow">→</div>
|
||||
<div class="pipeline-step"><span class="step-number">04</span><strong>Calibrate</strong><small>Empirical confidence</small><b id="pipe-calibrate">—</b></div>
|
||||
<div class="pipeline-arrow">→</div>
|
||||
<div class="pipeline-step"><span class="step-number">05</span><strong>Act</strong><small>Policy decisions</small><b id="pipe-act">—</b></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="autonomy-grid">
|
||||
<section class="panel hypotheses-panel">
|
||||
<div class="section-head">
|
||||
<div><span class="section-index">02</span><h3>Latest hypotheses</h3></div>
|
||||
<a href="/admin/intelligence/predictions" class="text-link">Legacy intelligence ↗</a>
|
||||
</div>
|
||||
<div id="hypothesis-list" class="hypothesis-list"><div class="loading-line"></div></div>
|
||||
</section>
|
||||
|
||||
<aside class="panel performance-panel">
|
||||
<div class="section-head"><div><span class="section-index">03</span><h3>Measured performance</h3></div></div>
|
||||
<div class="accuracy-orbit" id="accuracy-orbit">
|
||||
<div><strong id="orbit-value">—</strong><span>correct</span></div>
|
||||
</div>
|
||||
<div class="performance-facts">
|
||||
<div><span>Resolved</span><strong id="perf-resolved">0</strong></div>
|
||||
<div><span>Correct</span><strong id="perf-correct">0</strong></div>
|
||||
<div><span>Calibration cohorts</span><strong id="perf-cohorts">0</strong></div>
|
||||
</div>
|
||||
<p class="performance-note" id="performance-note">Duriin will only claim an edge after predictions mature and are measured out of sample.</p>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
<div class="autonomy-grid lower-grid">
|
||||
<section class="panel ledger-panel">
|
||||
<div class="section-head"><div><span class="section-index">04</span><h3>Decision ledger</h3></div><span class="mode-pill" id="ledger-mode">Shadow</span></div>
|
||||
<div class="table-wrap ledger-table">
|
||||
<table>
|
||||
<thead><tr><th>Instrument</th><th>Decision</th><th>Direction</th><th>Calibration</th><th>Horizon</th><th>Created</th></tr></thead>
|
||||
<tbody id="decision-ledger"><tr><td colspan="6" class="empty-state">Waiting for calibrated decisions.</td></tr></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<aside class="panel runtime-panel">
|
||||
<div class="section-head"><div><span class="section-index">05</span><h3>Runtime</h3></div></div>
|
||||
<div class="runtime-list">
|
||||
<div><span><i class="status-light ok"></i>Coordinator</span><strong id="runtime-coordinator">Active</strong></div>
|
||||
<div><span><i class="status-light ok"></i>Outcome resolver</span><strong>Active</strong></div>
|
||||
<div><span><i class="status-light ok"></i>Calibration</span><strong>Active</strong></div>
|
||||
<div><span><i class="status-light ok"></i>Execution</span><strong id="runtime-execution">Shadow</strong></div>
|
||||
<div><span><i class="status-light"></i>Historical queue</span><strong id="runtime-queue">—</strong></div>
|
||||
</div>
|
||||
<div class="account-card" id="account-card">
|
||||
<span>Paper account</span>
|
||||
<strong id="account-equity">Not sampled in shadow mode</strong>
|
||||
<small id="account-meta">Alpaca Paper connected</small>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<div id="toast"><span class="toast-dot"></span><span id="toast-msg"></span></div>
|
||||
<script src="/admin/assets/js/app.js"></script>
|
||||
<script src="/admin/assets/js/autonomy.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
+96
-7
@@ -54,6 +54,7 @@ const pagesDir = path.join(publicDir, 'pages');
|
||||
// map pretty url → page html file. keep these close to the routes so its
|
||||
// obvious when a page gets added or renamed.
|
||||
const pageMap = {
|
||||
'/admin/autonomy': path.join(pagesDir, 'autonomy.html'),
|
||||
'/admin/ingest/articles': path.join(pagesDir, 'ingest', 'articles.html'),
|
||||
'/admin/ingest/events': path.join(pagesDir, 'ingest', 'events.html'),
|
||||
'/admin/stats': path.join(pagesDir, 'stats.html'),
|
||||
@@ -77,21 +78,19 @@ async function adminRoutes(fastify) {
|
||||
if (!checkAuth(request, reply)) return reply;
|
||||
});
|
||||
|
||||
// static assets (css + js) under /admin/assets/*
|
||||
// cache for an hour — avoids per-navigation revalidation round-trips
|
||||
// for the admin panel. during dev use a hard-reload (cmd-shift-r)
|
||||
// or bump the script src query string to bust it.
|
||||
// Static assets are revalidated so an operator never runs stale UI code
|
||||
// against a newly deployed autonomy API.
|
||||
fastify.register(fastifyStatic, {
|
||||
root: assetsDir,
|
||||
prefix: '/admin/assets/',
|
||||
decorateReply: false,
|
||||
cacheControl: true,
|
||||
maxAge: 3600 * 1000, // 1h, in ms (fastify-static forwards to send())
|
||||
maxAge: 0,
|
||||
});
|
||||
|
||||
// top-level entry — redirect into ingest/articles
|
||||
// top-level entry — the autonomy control room is the primary product surface
|
||||
fastify.get('/admin', async (request, reply) => {
|
||||
reply.redirect('/admin/ingest/articles');
|
||||
reply.redirect('/admin/autonomy');
|
||||
});
|
||||
|
||||
// ingest root — redirect to the articles subsection
|
||||
@@ -113,6 +112,96 @@ async function adminRoutes(fastify) {
|
||||
fastify.get(route, async (request, reply) => sendPage(reply, filePath));
|
||||
}
|
||||
|
||||
// Autonomy control-room data. Keep this behind admin auth: it exposes model
|
||||
// output, broker state and operational queue details that do not belong on the
|
||||
// public status endpoint.
|
||||
fastify.get('/admin/api/autonomy/overview', async (request, reply) => {
|
||||
if (!checkAuth(request, reply)) return;
|
||||
const intelligenceDb = getIntelligenceDb();
|
||||
if (!intelligenceDb) return { enabled: false, reason: 'intelligence database unavailable' };
|
||||
const hasSchema = intelligenceDb.prepare(
|
||||
"SELECT 1 FROM sqlite_master WHERE type='table' AND name='autonomy_jobs'"
|
||||
).get();
|
||||
if (!hasSchema) return { enabled: false, reason: 'autonomy schema is not initialized' };
|
||||
|
||||
const jobs = intelligenceDb.prepare(`
|
||||
SELECT lane, status, COUNT(*) AS count
|
||||
FROM autonomy_jobs GROUP BY lane, status ORDER BY lane, status
|
||||
`).all();
|
||||
const predictionCounts = intelligenceDb.prepare(`
|
||||
SELECT status, COUNT(*) AS count FROM autonomy_predictions GROUP BY status
|
||||
`).all();
|
||||
const decisionCounts = intelligenceDb.prepare(`
|
||||
SELECT action, COUNT(*) AS count FROM autonomy_decisions GROUP BY action
|
||||
`).all();
|
||||
const proposalCounts = intelligenceDb.prepare(`
|
||||
SELECT status, COUNT(*) AS count FROM autonomy_proposals GROUP BY status
|
||||
`).all();
|
||||
const outcomeSummary = intelligenceDb.prepare(`
|
||||
SELECT COUNT(*) AS total, SUM(direction_correct) AS correct,
|
||||
AVG(excess_return) AS average_excess_return
|
||||
FROM autonomy_outcomes
|
||||
`).get();
|
||||
const instruments = intelligenceDb.prepare(`
|
||||
SELECT COUNT(*) AS count FROM autonomy_instruments WHERE active=1 AND tradable=1
|
||||
`).get();
|
||||
const latestPredictions = intelligenceDb.prepare(`
|
||||
SELECT p.id, p.instrument, p.direction, p.event_type, p.causal_channel,
|
||||
p.horizon_days, p.information_cutoff, p.evidence_article_ids,
|
||||
p.invalidation_condition, p.learning_eligible, p.status, p.created_at,
|
||||
d.action, d.calibrated_probability, d.expected_excess_return, d.rationale,
|
||||
o.excess_return, o.direction_correct
|
||||
FROM autonomy_predictions p
|
||||
LEFT JOIN autonomy_decisions d ON d.id = (
|
||||
SELECT MAX(d2.id) FROM autonomy_decisions d2 WHERE d2.prediction_id = p.id
|
||||
)
|
||||
LEFT JOIN autonomy_outcomes o ON o.prediction_id = p.id
|
||||
ORDER BY p.id DESC LIMIT 12
|
||||
`).all().map((row) => {
|
||||
let evidenceCount = 0;
|
||||
try { evidenceCount = JSON.parse(row.evidence_article_ids || '[]').length; } catch (_) {}
|
||||
const { evidence_article_ids: ignored, ...safeRow } = row;
|
||||
return { ...safeRow, evidence_count: evidenceCount };
|
||||
});
|
||||
const latestOrders = intelligenceDb.prepare(`
|
||||
SELECT oi.id, oi.client_order_id, oi.instrument, oi.side, oi.notional,
|
||||
oi.status, oi.broker_order_id, oi.attempts, oi.last_error,
|
||||
oi.created_at, oi.updated_at, d.action
|
||||
FROM autonomy_order_intents oi
|
||||
JOIN autonomy_decisions d ON d.id = oi.decision_id
|
||||
ORDER BY oi.id DESC LIMIT 12
|
||||
`).all();
|
||||
const account = intelligenceDb.prepare(`
|
||||
SELECT broker, equity, cash, buying_power, captured_at
|
||||
FROM autonomy_account_snapshots ORDER BY id DESC LIMIT 1
|
||||
`).get() || null;
|
||||
const calibration = intelligenceDb.prepare(`
|
||||
SELECT cohort_key, sample_size, effective_sample_size, directional_probability,
|
||||
expected_excess_return, lower_return, upper_return, created_at
|
||||
FROM autonomy_calibration_snapshots ORDER BY id DESC LIMIT 8
|
||||
`).all();
|
||||
|
||||
return {
|
||||
enabled: true,
|
||||
mode: process.env.AUTONOMY_EXECUTION_MODE || 'shadow',
|
||||
broker: {
|
||||
name: 'Alpaca Paper',
|
||||
configured: Boolean(process.env.ALPACA_PAPER_KEY_ID && process.env.ALPACA_PAPER_SECRET_KEY),
|
||||
},
|
||||
jobs,
|
||||
predictionCounts,
|
||||
decisionCounts,
|
||||
proposalCounts,
|
||||
outcomes: outcomeSummary,
|
||||
allowlistedInstruments: instruments.count,
|
||||
latestPredictions,
|
||||
latestOrders,
|
||||
account,
|
||||
calibration,
|
||||
generatedAt: new Date().toISOString(),
|
||||
};
|
||||
});
|
||||
|
||||
// list articles — all of them, not just the ones with embeddings
|
||||
fastify.get('/admin/api/articles', async (request, reply) => {
|
||||
if (!checkAuth(request, reply)) return;
|
||||
|
||||
Reference in New Issue
Block a user