diff --git a/docker-compose.yml b/docker-compose.yml index daeed13..fc07f88 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/public/admin/assets/css/autonomy.css b/public/admin/assets/css/autonomy.css new file mode 100644 index 0000000..4cda4aa --- /dev/null +++ b/public/admin/assets/css/autonomy.css @@ -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; } +} diff --git a/public/admin/assets/css/base.css b/public/admin/assets/css/base.css index 028a135..1e2f363 100644 --- a/public/admin/assets/css/base.css +++ b/public/admin/assets/css/base.css @@ -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; } +} diff --git a/public/admin/assets/css/components.css b/public/admin/assets/css/components.css index ff35cef..214e404 100644 --- a/public/admin/assets/css/components.css +++ b/public/admin/assets/css/components.css @@ -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; } +} diff --git a/public/admin/assets/css/intel.css b/public/admin/assets/css/intel.css index c2c39c3..52af2c9 100644 --- a/public/admin/assets/css/intel.css +++ b/public/admin/assets/css/intel.css @@ -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) ── */ diff --git a/public/admin/assets/css/layout.css b/public/admin/assets/css/layout.css index a878bcc..6e2c982 100644 --- a/public/admin/assets/css/layout.css +++ b/public/admin/assets/css/layout.css @@ -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; } } diff --git a/public/admin/assets/js/app.js b/public/admin/assets/js/app.js index b4b57a9..cc61c01 100644 --- a/public/admin/assets/js/app.js +++ b/public/admin/assets/js/app.js @@ -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 = `DDuriinAutonomous intelligence`; + + const nav = header.querySelector(".tabs"); + if (nav && !nav.querySelector('[href="/admin/autonomy"]')) { + nav.insertAdjacentHTML("afterbegin", 'Autonomy'); + } + 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 = `
Connecting
Runtime status
`; + 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(); }); diff --git a/public/admin/assets/js/autonomy.js b/public/admin/assets/js/autonomy.js new file mode 100644 index 0000000..341d84b --- /dev/null +++ b/public/admin/assets/js/autonomy.js @@ -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 = '
No autonomy hypotheses yet. The coordinator is working through the evidence queue.
'; + 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 `
+
${escapeHtml(row.instrument)}
${escapeHtml(row.direction)}
+
${escapeHtml(String(row.event_type || "event").replaceAll("_", " "))}
${escapeHtml(row.causal_channel || "Evidence-backed market hypothesis")}
+
${row.evidence_count || 0} evidence source${row.evidence_count === 1 ? "" : "s"}
${row.horizon_days} trading-day horizon
${formatRelative(row.created_at)}
+ ${escapeHtml(action)} +
`; + }).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 => ` + ${escapeHtml(row.instrument)} + ${escapeHtml(row.action)} + ${escapeHtml(row.direction)} + ${formatPercent(row.calibrated_probability)} + ${row.horizon_days}d + ${formatRelative(row.created_at)} + `).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 = '
Runtime data is unavailable.
'; + toast("Autonomy overview unavailable", true); + }); +})(); diff --git a/public/admin/pages/autonomy.html b/public/admin/pages/autonomy.html new file mode 100644 index 0000000..a85e338 --- /dev/null +++ b/public/admin/pages/autonomy.html @@ -0,0 +1,137 @@ + + + + + + +Duriin — Autonomy + + + + + + + +
+

Duriin

+ +
+ +
+
+
+
Autonomy runtime
+

Duriin is observing.

+

Building evidence-backed hypotheses from the archive and measuring them against the market.

+
+
+ Execution authority + + Connecting to broker state… +
+
+ +
+
+ Open hypotheses + + — resolved +
+
+ Directional accuracy + + Waiting for outcomes +
+
+ Average excess return + + Against SPY benchmark +
+
+ Tradable universe + + Verified Alpaca instruments +
+
+ +
+
+
01

Learning loop

+ Updating… +
+
+
01ObserveArchive events
+
+
02ProposeEvidence hypotheses
+
+
03MeasureMarket outcomes
+
+
04CalibrateEmpirical confidence
+
+
05ActPolicy decisions
+
+
+ +
+
+
+
02

Latest hypotheses

+ Legacy intelligence ↗ +
+
+
+ + +
+ +
+
+
04

Decision ledger

Shadow
+
+ + + +
InstrumentDecisionDirectionCalibrationHorizonCreated
Waiting for calibrated decisions.
+
+
+ + +
+
+ +
+ + + + diff --git a/src/routes/admin.js b/src/routes/admin.js index 38c4627..827ff54 100644 --- a/src/routes/admin.js +++ b/src/routes/admin.js @@ -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; @@ -779,4 +868,4 @@ async function adminRoutes(fastify) { }); } -module.exports = adminRoutes; \ No newline at end of file +module.exports = adminRoutes;