web: chat — session list, open/close, history paging, markdown, scroll (C1/C3/C4/C7/C14)

Browser Chat destination for parity with the Android app:
- session list grouped by directory (closed grouped under "Closed"), kind
  chip, activity badge, work-label meta line, "Search chats" filter (C1)
- open/close/reopen with the Android copy verbatim (C3)
- conversation history paging via the opaque next_cursor (C4)
- markdown subset renderer + code blocks (C7)
- scroll follow / "Jump to latest" / per-session saved position (C14)

Request builders in src/repository.js; pure merge/format/markdown/paging
logic in src/chat.js and src/markdown.js; view in app.js. Every server
string set with textContent, markdown built as DOM nodes.
This commit is contained in:
2026-10-19 05:39:29 +01:00
parent 3d98c60de6
commit 0688127253
10 changed files with 2863 additions and 6 deletions
+120
View File
@@ -1269,3 +1269,123 @@ code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-
}
.rename-input:focus { outline: none; border-color: var(--accent); }
.rename-save { border-color: var(--accent); color: var(--accent); font-weight: 600; }
/* ---------------------------------------------------------------------------
Chat (C1/C3/C4/C7/C14): the session list, the conversation and its rendered
markdown transcript. Hand-written, on the app's dark palette; the transcript
is untrusted model output, so every node is built with textContent.
--------------------------------------------------------------------------- */
.chat-list { display: flex; flex-direction: column; }
.chat-search { flex: 1 1 auto; min-width: 0; }
.chat-group-header {
padding: 8px 12px 4px;
font-size: 11px;
letter-spacing: 0.04em;
text-transform: uppercase;
color: var(--muted);
}
.chat-row {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
gap: 2px 8px;
align-items: start;
cursor: pointer;
}
.chat-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.chat-row .row-head { grid-column: 1; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chat-row .row-title { min-width: 0; }
.chat-row .row-meta { grid-column: 1; }
.chat-row-actions { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.chat-row-actions button { padding: 3px 10px; font-size: 12px; }
.chat-close { border-color: var(--warn); color: var(--warn); }
.chat-reopen { border-color: var(--accent); color: var(--accent); }
.chat-closed-chip { opacity: 0.8; }
.chat-activity { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); }
.chat-activity-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chat-activity-streaming { color: var(--accent); }
.chat-activity-new { color: #7fb2f0; }
.chat-detail { display: flex; flex-direction: column; gap: 10px; }
.chat-bar { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.chat-bar-titles { display: grid; gap: 2px; min-width: 0; }
.chat-bar-title { margin: 0; font-size: 16px; }
.chat-bar-meta { font-size: 12px; }
.chat-context { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.chat-load-older { white-space: nowrap; font-size: 12px; }
.chat-transcript-empty { padding: 24px 12px; }
.chat-transcript-wrap { position: relative; flex: 1 1 auto; min-height: 320px; }
.chat-transcript {
position: relative;
display: flex;
flex-direction: column;
gap: 10px;
max-height: min(62vh, 660px);
overflow-y: auto;
padding: 12px;
background: var(--bg);
border: 1px solid var(--border);
border-radius: 10px;
}
.chat-turn { display: flex; }
.chat-turn-user { justify-content: flex-end; }
.chat-turn-agent { justify-content: flex-start; }
.chat-bubble { max-width: min(560px, 100%); padding: 10px 12px; border-radius: 10px; }
.user-bubble { background: var(--surface-2); border: 1px solid var(--border); }
.agent-bubble { background: var(--surface); border: 1px solid var(--border); }
.chat-client { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.chat-user-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-tools { margin: 4px 0 8px; }
.chat-reasoning { margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px dashed var(--border); }
.chat-reasoning-toggle {
display: flex;
gap: 6px;
align-items: center;
padding: 2px 0;
background: transparent;
border: 0;
color: var(--muted);
font-size: 12px;
}
.chat-reasoning-toggle:hover { color: var(--text); }
.chat-reasoning-body {
margin: 6px 0 2px;
white-space: pre-wrap;
overflow-wrap: anywhere;
color: var(--muted);
font-size: 12px;
}
.chat-jump { position: absolute; right: 14px; bottom: 14px; border-color: var(--accent); color: var(--accent); }
/* The rendered markdown subset. Every node is created, never parsed from HTML. */
.markdown { display: grid; gap: 8px; min-width: 0; }
.markdown > * { margin: 0; }
.md-heading { font-size: 15px; }
.md-paragraph { line-height: 1.55; overflow-wrap: anywhere; }
.md-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }
.md-code-block { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--bg); }
.md-code-label {
padding: 4px 10px;
font-size: 11px;
letter-spacing: 0.04em;
text-transform: uppercase;
color: var(--muted);
background: var(--surface-2);
border-bottom: 1px solid var(--border);
}
.md-pre { margin: 0; padding: 10px; overflow-x: auto; }
.md-pre code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.md-quote { display: grid; gap: 6px; padding-left: 10px; border-left: 3px solid var(--border); color: var(--muted); }
.md-list { display: grid; gap: 4px; margin: 0; padding-left: 20px; }
.md-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.md-table th, .md-table td { border: 1px solid var(--border); padding: 4px 8px; text-align: left; }
.md-table th { background: var(--surface-2); }
.md-rule { border: 0; border-top: 1px solid var(--border); }
.md-link { color: var(--accent); }
.md-link-plain { color: var(--muted); }