- POST /api/uploads: base64 -> shared ~/.strata-ctl/uploads store (uuid+ext), content-sniffed kind (image/text/binary), text token-counted via the model tokenizer; metadata persisted in a new uploads table. - Chat attachments routed by kind: images -> Vision bridge (multipart image_url), small text (<=2000 tokens) inlined, large text/binary -> path + shell_exec reminder; binaries never inlined. Attachment context persisted with the turn. - GUI: attach button + file picker, removable chips, attachments sent with the turn and shown on the user bubble; cleared on session switch. - Framework root ~/.strata-ctl separated by type: sessions/<name>/, data/ (SQLite, moved from ~/.config/strata-ctl), uploads/. Legacy DB copied once on first run. - count_tokens seam on Formatter (real tokenizer override) + ChatService. - i18n: upload errors + attachment markers (backend) and attach.* (GUI), it+en. - 121 tests + 2 ignored; clippy/fmt clean; validated live (upload routing, real tokenizer count, image->Vision answered "Rosso", new layout).
262 lines
10 KiB
CSS
262 lines
10 KiB
CSS
/* strata-ctl web GUI — mobile-first. Single column on phones; a persistent
|
|
session sidebar appears on wide screens. Touch-friendly targets, 16px inputs
|
|
(avoids iOS focus zoom), safe-area insets for notched phones. */
|
|
|
|
:root {
|
|
--bg: #0f1115;
|
|
--panel: #171a21;
|
|
--panel-2: #1f2430;
|
|
--border: #2a3040;
|
|
--text: #e6e9ef;
|
|
--muted: #9aa4b2;
|
|
--accent: #4f8cff;
|
|
--accent-press: #3a6fd6;
|
|
--user: #2b3a55;
|
|
--danger: #e5534b;
|
|
--radius: 14px;
|
|
--sidebar-w: 280px;
|
|
}
|
|
|
|
* { box-sizing: border-box; }
|
|
|
|
/* The `hidden` attribute must always win over author `display` rules (e.g. the
|
|
stats modal uses display:flex); otherwise toggling .hidden has no effect. */
|
|
[hidden] { display: none !important; }
|
|
|
|
html, body {
|
|
margin: 0;
|
|
height: 100%;
|
|
background: var(--bg);
|
|
color: var(--text);
|
|
font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
|
font-size: 16px;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
#app { display: flex; height: 100dvh; overflow: hidden; }
|
|
|
|
/* ---- Buttons ---- */
|
|
.btn {
|
|
appearance: none;
|
|
border: 1px solid var(--border);
|
|
background: var(--panel-2);
|
|
color: var(--text);
|
|
border-radius: 10px;
|
|
padding: 10px 14px;
|
|
font-size: 0.95rem;
|
|
cursor: pointer;
|
|
min-height: 44px;
|
|
transition: background 0.12s ease, transform 0.05s ease;
|
|
}
|
|
.btn:active { transform: scale(0.97); }
|
|
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
|
|
.btn.primary:active { background: var(--accent-press); }
|
|
.btn.ghost { background: transparent; }
|
|
.btn.icon { padding: 8px 12px; font-size: 1.2rem; line-height: 1; }
|
|
.btn.danger { color: var(--danger); }
|
|
.btn:disabled { opacity: 0.5; cursor: default; }
|
|
|
|
/* ---- Drawer / sidebar ---- */
|
|
#drawer {
|
|
position: fixed;
|
|
inset: 0 auto 0 0;
|
|
width: min(82vw, var(--sidebar-w));
|
|
background: var(--panel);
|
|
border-right: 1px solid var(--border);
|
|
display: flex;
|
|
flex-direction: column;
|
|
transform: translateX(-100%);
|
|
transition: transform 0.2s ease;
|
|
z-index: 30;
|
|
padding-top: env(safe-area-inset-top);
|
|
}
|
|
#drawer.open { transform: translateX(0); }
|
|
#scrim {
|
|
position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 20;
|
|
}
|
|
/* Resizable sidebar/chat separator: desktop only (mobile uses a drawer). */
|
|
#splitter { display: none; }
|
|
body.resizing { cursor: col-resize; user-select: none; }
|
|
.drawer-head {
|
|
display: flex; align-items: center; justify-content: space-between;
|
|
gap: 8px; padding: 12px;
|
|
border-bottom: 1px solid var(--border);
|
|
}
|
|
.brand { font-weight: 700; letter-spacing: 0.3px; }
|
|
#session-list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; flex: 1; }
|
|
#session-list li {
|
|
padding: 8px 10px; border-radius: 10px; cursor: pointer;
|
|
color: var(--muted); min-height: 44px;
|
|
display: flex; align-items: center; justify-content: space-between; gap: 8px;
|
|
}
|
|
#session-list li:hover { background: var(--panel-2); }
|
|
#session-list li.active { background: var(--panel-2); color: var(--text); }
|
|
.session-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
.session-actions { display: flex; gap: 2px; opacity: 0; transition: opacity 0.12s ease; }
|
|
#session-list li:hover .session-actions, #session-list li.active .session-actions { opacity: 1; }
|
|
.sess-btn {
|
|
background: transparent; border: none; cursor: pointer; font-size: 0.9rem;
|
|
padding: 4px 6px; min-height: 32px; border-radius: 6px; line-height: 1;
|
|
}
|
|
.sess-btn:hover { background: var(--border); }
|
|
.sess-btn.danger:hover { background: var(--danger); }
|
|
@media (hover: none) { .session-actions { opacity: 1; } }
|
|
.drawer-foot { padding: 12px; border-top: 1px solid var(--border); }
|
|
|
|
/* ---- Main column ---- */
|
|
#main { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100dvh; }
|
|
#topbar {
|
|
display: flex; align-items: center; gap: 10px;
|
|
padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top));
|
|
border-bottom: 1px solid var(--border); background: var(--panel);
|
|
}
|
|
.title-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
|
|
#session-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
.muted { color: var(--muted); font-size: 0.8rem; }
|
|
|
|
#transcript {
|
|
flex: 1; overflow-y: auto; padding: 16px 12px;
|
|
display: flex; flex-direction: column; gap: 14px;
|
|
scroll-behavior: smooth;
|
|
}
|
|
.empty { color: var(--muted); text-align: center; margin: auto; max-width: 28ch; }
|
|
|
|
/* ---- Message bubbles ---- */
|
|
.msg { max-width: 860px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; }
|
|
.msg .role { font-size: 0.75rem; color: var(--muted); margin-bottom: 4px; }
|
|
.msg.user { align-items: flex-end; }
|
|
.msg.user .bubble {
|
|
background: var(--user); border-radius: var(--radius) var(--radius) 4px var(--radius);
|
|
padding: 10px 14px; max-width: 85%;
|
|
}
|
|
.msg.assistant .bubble {
|
|
background: var(--panel); border: 1px solid var(--border);
|
|
border-radius: var(--radius) var(--radius) var(--radius) 4px;
|
|
padding: 10px 14px; width: 100%;
|
|
}
|
|
.bubble .content { white-space: pre-wrap; word-wrap: break-word; }
|
|
.bubble .content:empty::after { content: "…"; color: var(--muted); }
|
|
|
|
details.thinking { margin-bottom: 8px; }
|
|
details.thinking summary {
|
|
cursor: pointer; color: var(--muted); font-size: 0.85rem; user-select: none;
|
|
}
|
|
details.thinking .reasoning {
|
|
white-space: pre-wrap; word-wrap: break-word; color: var(--muted);
|
|
font-size: 0.9rem; border-left: 2px solid var(--border);
|
|
padding-left: 10px; margin-top: 6px;
|
|
}
|
|
.usage { color: var(--muted); font-size: 0.72rem; margin-top: 6px; }
|
|
|
|
/* ---- Agent tool blocks ---- */
|
|
.msg.tool .bubble {
|
|
background: var(--panel-2); border: 1px solid var(--border);
|
|
border-radius: var(--radius); padding: 10px 14px; width: 100%;
|
|
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
}
|
|
.tool-cmd { display: block; white-space: pre-wrap; word-wrap: break-word; font-size: 0.9rem; }
|
|
.tool-out {
|
|
margin: 8px 0 0; max-height: 300px; overflow: auto;
|
|
white-space: pre-wrap; word-wrap: break-word; color: var(--muted);
|
|
font-size: 0.82rem; background: var(--bg); border-radius: 8px; padding: 8px;
|
|
}
|
|
.tool-out:empty { display: none; }
|
|
#agent-toggle.active { background: var(--accent); border-color: var(--accent); color: #fff; }
|
|
|
|
/* ---- Composer ---- */
|
|
#composer {
|
|
display: flex; gap: 8px; align-items: flex-end;
|
|
padding: 10px 12px; padding-bottom: calc(10px + env(safe-area-inset-bottom));
|
|
border-top: 1px solid var(--border); background: var(--panel);
|
|
}
|
|
#input {
|
|
flex: 1; resize: none; max-height: 40dvh;
|
|
background: var(--panel-2); color: var(--text);
|
|
border: 1px solid var(--border); border-radius: 12px;
|
|
padding: 12px 14px; font-size: 16px; font-family: inherit; line-height: 1.4;
|
|
}
|
|
#input:focus { outline: none; border-color: var(--accent); }
|
|
#send { min-width: 52px; font-size: 1.3rem; }
|
|
#attach { min-width: 44px; font-size: 1.2rem; }
|
|
|
|
/* ---- Attachment chips (composer + sent user turn) ---- */
|
|
.attachments {
|
|
display: flex; flex-wrap: wrap; gap: 6px;
|
|
padding: 8px 12px 0; background: var(--panel);
|
|
}
|
|
.attach-chip {
|
|
display: inline-flex; align-items: center; gap: 6px;
|
|
max-width: 240px; padding: 4px 8px;
|
|
background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px;
|
|
font-size: 0.8rem; color: var(--text);
|
|
}
|
|
.attach-chip .attach-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
.attach-chip .attach-kind { color: var(--muted); }
|
|
.attach-chip button {
|
|
border: none; background: transparent; color: var(--muted);
|
|
cursor: pointer; font-size: 0.9rem; line-height: 1; padding: 0 2px;
|
|
}
|
|
.attach-chip button:hover { color: var(--danger); }
|
|
.msg-attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
|
|
|
|
/* ---- Stats modal ---- */
|
|
#stats-modal, #dialog, #settings-modal {
|
|
position: fixed; inset: 0; z-index: 40;
|
|
background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center;
|
|
padding: 20px;
|
|
}
|
|
.modal-card {
|
|
background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
|
|
padding: 20px; max-width: 420px; width: 100%;
|
|
}
|
|
.modal-card h2 { margin: 0 0 12px; font-size: 1.1rem; }
|
|
#stats-body { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; margin: 0 0 16px; }
|
|
#stats-body dt { color: var(--muted); }
|
|
#stats-body dd { margin: 0; font-variant-numeric: tabular-nums; }
|
|
#dialog-msg { margin: 0 0 16px; }
|
|
#dialog-input {
|
|
width: 100%; background: var(--panel-2); color: var(--text);
|
|
border: 1px solid var(--border); border-radius: 10px;
|
|
padding: 10px 12px; font-size: 16px; font-family: inherit; margin: 0 0 16px;
|
|
}
|
|
#dialog-input:focus { outline: none; border-color: var(--accent); }
|
|
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; }
|
|
|
|
/* ---- Settings modal ---- */
|
|
.settings-card { width: min(560px, 100%); max-height: 85vh; overflow-y: auto; }
|
|
.scope-toggle { display: flex; gap: 8px; margin: 0 0 12px; }
|
|
.scope-toggle .btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
|
|
#set-hint { margin: 0 0 12px; }
|
|
#set-name-hint { margin: -8px 0 12px; }
|
|
.small { font-size: 0.8rem; }
|
|
.field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 12px; }
|
|
.field > span { font-size: 0.85rem; color: var(--muted); }
|
|
.field input, .field textarea {
|
|
width: 100%; background: var(--panel-2); color: var(--text);
|
|
border: 1px solid var(--border); border-radius: 8px;
|
|
padding: 8px 10px; font-size: 16px; font-family: inherit;
|
|
}
|
|
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
|
|
.field input:disabled { opacity: 0.6; }
|
|
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
|
|
.sess-btn:disabled { opacity: 0.35; cursor: default; }
|
|
|
|
/* ---- Wide screens: persistent sidebar ---- */
|
|
@media (min-width: 900px) {
|
|
#drawer { position: static; transform: none; width: var(--sidebar-w); flex-shrink: 0; }
|
|
#scrim { display: none !important; }
|
|
#menu { display: none; }
|
|
.msg.user .bubble { max-width: 70%; }
|
|
#splitter {
|
|
display: block; flex: 0 0 6px; width: 6px; cursor: col-resize;
|
|
position: relative; background: transparent; touch-action: none;
|
|
}
|
|
#splitter::after {
|
|
content: ""; position: absolute; top: 0; bottom: 0; left: 2px; width: 2px;
|
|
background: var(--border); transition: background 0.12s ease;
|
|
}
|
|
#splitter:hover::after, #splitter:focus-visible::after, body.resizing #splitter::after {
|
|
background: var(--accent);
|
|
}
|
|
#splitter:focus-visible { outline: none; }
|
|
} |