summaryrefslogtreecommitdiff
path: root/src/agentux/web
diff options
context:
space:
mode:
authorClaude Code <noreply@anthropic.com>2026-11-27 19:55:24 +0530
committerClaude Code <noreply@anthropic.com>2026-11-27 19:55:24 +0530
commit95ea8c8b72d2dbb20ab860ab1505b46add280773 (patch)
tree210c05e766819f336fcaf6892690a3d551fe7789 /src/agentux/web
parentf466d2bb6d8cf04627462e36b98f2d18a6e37aa5 (diff)
Commit modules required for a working Agentux install
agent.py imports context, memory, theme, and several tools that were present on disk but uncommitted, so a clean clone produced a broken installation (import agentux failed). Commit them so the repository's committed state is complete and cloneable. Co-Authored-By: Claude Code <noreply@anthropic.com>
Diffstat (limited to 'src/agentux/web')
-rw-r--r--src/agentux/web/static/app.js592
-rw-r--r--src/agentux/web/static/index.html99
-rw-r--r--src/agentux/web/static/styles.css442
3 files changed, 1133 insertions, 0 deletions
diff --git a/src/agentux/web/static/app.js b/src/agentux/web/static/app.js
new file mode 100644
index 0000000..0534348
--- /dev/null
+++ b/src/agentux/web/static/app.js
@@ -0,0 +1,592 @@
+/* ──────────────────────────────────────────────────────────────
+ Agentux Web Console — client script
+ Vanilla JS, SSE streaming, zero dependencies.
+ ────────────────────────────────────────────────────────────── */
+
+"use strict";
+
+const $ = (sel, root = document) => root.querySelector(sel);
+const $$ = (sel, root = document) => Array.from(root.querySelectorAll(sel));
+
+const state = {
+ busy: false,
+ view: "chat",
+ files: [],
+ tools: [],
+ checkpoints: [],
+ sessions: [],
+ currentFile: null,
+};
+
+/* ── Bootstrap ─────────────────────────────────────────────── */
+async function boot() {
+ try {
+ const status = await api("/api/status");
+ const modelLine = $("#model-line");
+ modelLine.textContent = status.model || "—";
+ modelLine.classList.remove("muted");
+ const wsLine = $("#workspace-line");
+ wsLine.textContent = shortPath(status.workspace);
+ wsLine.title = status.workspace;
+ } catch (e) {
+ console.warn("status fetch failed", e);
+ }
+ loadTools();
+ loadCheckpoints();
+ loadSessions();
+ switchView("chat");
+}
+
+/* ── API helper ────────────────────────────────────────────── */
+async function api(path, opts = {}) {
+ const res = await fetch(path, {
+ method: opts.method || "GET",
+ headers: { "Content-Type": "application/json" },
+ body: opts.body ? JSON.stringify(opts.body) : undefined,
+ });
+ if (!res.ok) {
+ const t = await res.text().catch(() => "");
+ throw new Error(`${res.status} ${t}`);
+ }
+ return res.json();
+}
+
+function shortPath(p) {
+ if (!p) return "—";
+ const parts = p.split("/").filter(Boolean);
+ return parts.length <= 3 ? p : "…" + parts.slice(-3).join("/");
+}
+
+/* ── Views ─────────────────────────────────────────────────── */
+function switchView(name) {
+ state.view = name;
+ $$(".nav-item").forEach(b => b.classList.toggle("active", b.dataset.view === name));
+ $$(".view").forEach(v => v.classList.remove("active"));
+ const el = $("#view-" + name);
+ if (el) el.classList.add("active");
+
+ const titles = {
+ chat: ["Chat", "Ask anything. Tools run inline."],
+ files: ["Workspace", "Browse and edit project files."],
+ tools: ["Tools", "Available tools and their descriptions."],
+ checkpoints: ["Checkpoints", "Snapshots of the working tree."],
+ sessions: ["Sessions", "Saved conversation sessions."],
+ };
+ const [h, sub] = titles[name] || ["", ""];
+ $("#view-title").textContent = h;
+ $("#view-subtitle").textContent = sub;
+
+ if (name === "files") renderFileTree();
+ if (name === "checkpoints") loadCheckpoints();
+ if (name === "sessions") loadSessions();
+}
+
+/* ── Chat ──────────────────────────────────────────────────── */
+function addMessage(role, content = "") {
+ const wrap = document.createElement("div");
+ wrap.className = "msg " + role;
+ const who = document.createElement("div");
+ who.className = "who";
+ who.textContent = role === "user" ? "You" : role === "assistant" ? "Agentux" : "system";
+ const body = document.createElement("div");
+ body.className = "body";
+ if (content) renderMarkdown(body, content);
+ wrap.append(who, body);
+ $("#messages").append(wrap);
+ scrollBottom();
+ return { wrap, body };
+}
+
+function renderMarkdown(el, text) {
+ // Very small markdown: code fences, inline code, tables, lists, bold/italic.
+ const lines = text.split("\n");
+ let i = 0;
+ let block = null;
+
+ function closeBlock() {
+ if (block) { el.append(block); block = null; }
+ }
+
+ function ensureP() {
+ closeBlock();
+ block = document.createElement("p");
+ }
+
+ while (i < lines.length) {
+ const line = lines[i];
+
+ // Code fence
+ const fence = line.match(/^```(\w*)$/);
+ if (fence) {
+ ensureP();
+ closeBlock();
+ const pre = document.createElement("pre");
+ const code = document.createElement("code");
+ let j = i + 1;
+ while (j < lines.length && !lines[j].match(/^```$/)) j++;
+ code.textContent = lines.slice(i + 1, j).join("\n");
+ pre.append(code);
+ el.append(pre);
+ i = j + 1;
+ continue;
+ }
+
+ // Table
+ if (line.includes("|") && i + 1 < lines.length && lines[i + 1].match(/^\|[\s:|-]+\|$/)) {
+ ensureP();
+ closeBlock();
+ const table = document.createElement("table");
+ const head = document.createElement("tr");
+ line.split("|").slice(1, -1).forEach(c => {
+ const th = document.createElement("th");
+ th.textContent = c.trim();
+ head.append(th);
+ });
+ table.append(head);
+ i += 2;
+ while (i < lines.length && lines[i].includes("|")) {
+ const tr = document.createElement("tr");
+ lines[i].split("|").slice(1, -1).forEach(c => {
+ const td = document.createElement("td");
+ td.innerHTML = inline(c.trim());
+ tr.append(td);
+ });
+ table.append(tr);
+ i++;
+ }
+ el.append(table);
+ continue;
+ }
+
+ // Unordered list
+ if (/^\s*[-*]\s/.test(line)) {
+ ensureP();
+ closeBlock();
+ const ul = document.createElement("ul");
+ while (i < lines.length && /^\s*[-*]\s/.test(lines[i])) {
+ const li = document.createElement("li");
+ li.innerHTML = inline(lines[i].replace(/^\s*[-*]\s/, ""));
+ ul.append(li);
+ i++;
+ }
+ el.append(ul);
+ continue;
+ }
+
+ // Ordered list
+ if (/^\s*\d+\.\s/.test(line)) {
+ ensureP();
+ closeBlock();
+ const ol = document.createElement("ol");
+ while (i < lines.length && /^\s*\d+\.\s/.test(lines[i])) {
+ const li = document.createElement("li");
+ li.innerHTML = inline(lines[i].replace(/^\s*\d+\.\s/, ""));
+ ol.append(li);
+ i++;
+ }
+ el.append(ol);
+ continue;
+ }
+
+ // Blank line -> paragraph break
+ if (line.trim() === "") {
+ ensureP();
+ closeBlock();
+ i++;
+ continue;
+ }
+
+ ensureP();
+ block.append(document.createElement("span"));
+ block.lastChild.innerHTML = inline(line);
+ i++;
+ }
+ closeBlock();
+}
+
+function inline(s) {
+ return s
+ .replace(/&/g, "&amp;")
+ .replace(/</g, "&lt;")
+ .replace(/>/g, "&gt;")
+ .replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>")
+ .replace(/\*([^*]+)\*/g, "<em>$1</em>")
+ .replace(/`([^`]+)`/g, '<code>$1</code>');
+}
+
+function scrollBottom() {
+ const m = $("#messages");
+ m.scrollTop = m.scrollHeight;
+}
+
+function addToolCard(name, args, result, error) {
+ const card = document.createElement("div");
+ card.className = "tool-card" + (error ? " error" : "");
+ const tag = error ? "error" : result ? "result" : "running";
+ const argsStr = args ? JSON.stringify(args) : "";
+ card.innerHTML = `
+ <div class="tool-head">
+ <span class="tool-tag">${tag}</span>
+ <span class="tool-name">${escapeHtml(name)}</span>
+ </div>
+ ${argsStr ? `<div class="tool-args">${escapeHtml(argsStr)}</div>` : ""}
+ ${result !== undefined ? `<div class="tool-result">${escapeHtml(result)}</div>` : ""}
+ `;
+ $("#messages").append(card);
+ scrollBottom();
+ return card;
+}
+
+function escapeHtml(s) {
+ return String(s).replace(/[&<>"']/g, c => ({
+ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;"
+ }[c]));
+}
+
+async function sendPrompt() {
+ const input = $("#input");
+ const prompt = input.value.trim();
+ if (!prompt || state.busy) return;
+
+ state.busy = true;
+ $("#send-btn").disabled = true;
+ input.value = "";
+ autoGrow(input);
+
+ addMessage("user", prompt);
+ const assistant = addMessage("assistant");
+ let buffer = "";
+
+ const resp = await fetch("/api/chat", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ prompt }),
+ });
+
+ const reader = resp.body.getReader();
+ const decoder = new TextDecoder();
+ let done = false;
+
+ while (!done) {
+ const { value, done: d } = await reader.read();
+ done = d;
+ if (value) {
+ const chunk = decoder.decode(value, { stream: true });
+ const events = parseSSE(chunk);
+ for (const ev of events) {
+ handleSSE(ev, assistant, buffer);
+ }
+ }
+ }
+
+ state.busy = false;
+ $("#send-btn").disabled = false;
+ input.focus();
+}
+
+function parseSSE(chunk) {
+ const events = [];
+ const blocks = chunk.split(/\n\n/);
+ for (const block of blocks) {
+ if (!block.trim()) continue;
+ let data = "";
+ let event = "message";
+ for (const line of block.split("\n")) {
+ if (line.startsWith("event:")) event = line.slice(6).trim();
+ else if (line.startsWith("data:")) data += line.slice(5).trim();
+ }
+ if (data) {
+ try { events.push({ event, data: JSON.parse(data) }); }
+ catch { events.push({ event, data: { raw: data } }); }
+ }
+ }
+ return events;
+}
+
+function handleSSE(ev, assistant, buffer) {
+ const d = ev.data;
+ switch (ev.event) {
+ case "chunk":
+ buffer += d.delta || "";
+ renderMarkdown(assistant.body, buffer);
+ scrollBottom();
+ break;
+ case "tool_call":
+ addToolCard(d.name, d.arguments);
+ break;
+ case "tool_result":
+ const cards = $("#messages .tool-card.running");
+ if (cards.length) {
+ const last = cards[cards.length - 1];
+ last.classList.remove("running");
+ const res = document.createElement("div");
+ res.className = "tool-result";
+ res.textContent = d.result;
+ last.append(res);
+ } else {
+ addToolCard(d.name, null, d.result);
+ }
+ scrollBottom();
+ break;
+ case "narration":
+ case "reflection": {
+ // Agent narration / reflection nudge. Show as a system line.
+ const sys = addMessage("system");
+ renderMarkdown(sys.body, d.message || "");
+ scrollBottom();
+ break;
+ }
+ case "assistant":
+ // Final answer. The streaming already populated the assistant bubble.
+ break;
+ case "done":
+ addMessage("system", "✓ Completed");
+ break;
+ case "error":
+ const err = document.createElement("div");
+ err.className = "tool-card error";
+ err.innerHTML = `<div class="tool-head"><span class="tool-tag">error</span></div><div class="tool-result">${escapeHtml(d.error)}</div>`;
+ $("#messages").append(err);
+ scrollBottom();
+ break;
+ case "nudge":
+ const n = document.createElement("div");
+ n.className = "tool-card";
+ n.style.borderColor = "var(--purple)";
+ n.innerHTML = `<div class="tool-head" style="color:var(--purple)"><span class="tool-tag">enforced</span></div><div class="tool-args">${escapeHtml(d.message)}</div>`;
+ $("#messages").append(n);
+ scrollBottom();
+ break;
+ }
+}
+
+/* ── Files ─────────────────────────────────────────────────── */
+async function loadFiles() {
+ try {
+ const data = await api("/api/files");
+ state.files = data.files || [];
+ } catch (e) {
+ console.warn(e);
+ }
+}
+
+function renderFileTree() {
+ loadFiles().then(() => {
+ const tree = $("#file-tree");
+ tree.innerHTML = "";
+ if (!state.files.length) {
+ tree.innerHTML = '<div class="empty">No files found</div>';
+ return;
+ }
+ const root = { name: "", children: {} };
+ for (const f of state.files) {
+ const parts = f.split("/");
+ let node = root;
+ for (let i = 0; i < parts.length; i++) {
+ const part = parts[i];
+ if (i === parts.length - 1) {
+ node.files = node.files || [];
+ node.files.push({ name: part, path: f });
+ } else {
+ node.children = node.children || {};
+ node.children[part] = node.children[part] || { name: part, children: {}, files: [] };
+ node = node.children[part];
+ }
+ }
+ }
+ renderNode(tree, root, 0);
+ });
+}
+
+function renderNode(parent, node, depth) {
+ const keys = Object.keys(node.children || {}).sort();
+ for (const name of keys) {
+ const child = node.children[name];
+ const div = document.createElement("div");
+ div.className = "tree-item";
+ div.style.paddingLeft = (8 + depth * 14) + "px";
+ div.innerHTML = `<span class="f-icon">📁</span><span class="indent"></span>${escapeHtml(name)}`;
+ div.onclick = () => {
+ $$(".tree-item").forEach(t => t.classList.remove("active"));
+ div.classList.add("active");
+ };
+ parent.append(div);
+ renderNode(div, child, depth + 1);
+ }
+ for (const f of node.files || []) {
+ const div = document.createElement("div");
+ div.className = "tree-item";
+ div.style.paddingLeft = (8 + depth * 14) + "px";
+ const icon = fileIcon(f.name);
+ div.innerHTML = `<span class="f-icon">${icon}</span>${escapeHtml(f.name)}`;
+ div.onclick = () => openFile(f.path, div);
+ parent.append(div);
+ }
+}
+
+function fileIcon(name) {
+ const ext = name.split(".").pop().toLowerCase();
+ const map = {
+ js: "📄", mjs: "📄", cjs: "📄", ts: "📘", tsx: "📘", jsx: "📘",
+ py: "🐍", rb: "💎", go: "🔵", rs: "🟠", java: "☕", kt: "🟣",
+ c: "🧩", h: "🧩", cpp: "🧩", hpp: "🧩",
+ md: "📝", txt: "📝", json: "🧾", yaml: "⚙️", yml: "⚙️", toml: "⚙️",
+ html: "🌐", css: "🎨", scss: "🎨", sass: "🎨",
+ sh: "⌨️", bash: "⌨️", zsh: "⌨️",
+ sql: "🗄️", db: "🗄️", sqlite: "🗄️",
+ png: "🖼️", jpg: "🖼️", svg: "🖼️", gif: "🖼️",
+ pdf: "📕",
+ };
+ return map[ext] || "📄";
+}
+
+async function openFile(path, el) {
+ if (el) {
+ $$(".tree-item").forEach(t => t.classList.remove("active"));
+ el.classList.add("active");
+ }
+ state.currentFile = path;
+ $("#file-path").textContent = path;
+ $("#file-content").textContent = "Loading…";
+ $("#view-files").classList.add("active");
+ try {
+ const data = await api("/api/file?path=" + encodeURIComponent(path));
+ $("#file-content").textContent = data.content || "(empty)";
+ } catch (e) {
+ $("#file-content").textContent = "Error: " + e.message;
+ }
+}
+
+/* ── Tools ─────────────────────────────────────────────────── */
+async function loadTools() {
+ try {
+ const data = await api("/api/tools");
+ state.tools = data.tools || [];
+ renderTools();
+ } catch (e) {
+ console.warn(e);
+ }
+}
+
+function renderTools() {
+ const grid = $("#tools-grid");
+ grid.innerHTML = "";
+ if (!state.tools.length) {
+ grid.innerHTML = '<div class="empty">No tools registered</div>';
+ return;
+ }
+ for (const t of state.tools) {
+ const card = document.createElement("div");
+ card.className = "tool-chip";
+ card.innerHTML = `
+ <div class="tool-chip-name">${escapeHtml(t.name)}</div>
+ <div class="tool-chip-desc">${escapeHtml(t.description || "")}</div>
+ `;
+ grid.append(card);
+ }
+}
+
+/* ── Checkpoints ───────────────────────────────────────────── */
+async function loadCheckpoints() {
+ try {
+ const data = await api("/api/checkpoints");
+ state.checkpoints = data.checkpoints || [];
+ renderCheckpoints();
+ } catch (e) {
+ console.warn(e);
+ }
+}
+
+function renderCheckpoints() {
+ const box = $("#checkpoints");
+ box.innerHTML = "";
+ if (!state.checkpoints.length) {
+ box.innerHTML = '<div class="empty">No checkpoints yet</div>';
+ return;
+ }
+ for (const cp of state.checkpoints) {
+ const card = document.createElement("div");
+ card.className = "cp-card";
+ card.innerHTML = `
+ <div class="cp-meta">
+ <span class="cp-id">${escapeHtml(cp.id)}</span>
+ <span class="cp-desc">${escapeHtml(cp.description || "")}</span>
+ <span class="cp-time">${escapeHtml(cp.time || "")} · ${cp.files_count || 0} files${cp.git_sha ? " · " + escapeHtml(cp.git_sha.slice(0,7)) : ""}</span>
+ </div>
+ <button class="btn btn-ghost btn-sm" data-id="${escapeHtml(cp.id)}">Rollback</button>
+ `;
+ card.querySelector("button").onclick = () => rollback(cp.id);
+ box.append(card);
+ }
+}
+
+async function rollback(id) {
+ if (!confirm("Roll back to checkpoint " + id + "?")) return;
+ try {
+ const res = await api("/api/checkpoints/rollback", { method: "POST", body: { checkpoint_id: id } });
+ alert(res.message);
+ loadCheckpoints();
+ } catch (e) {
+ alert("Rollback failed: " + e.message);
+ }
+}
+
+/* ── Sessions ──────────────────────────────────────────────── */
+async function loadSessions() {
+ try {
+ const data = await api("/api/sessions");
+ state.sessions = data.sessions || [];
+ renderSessions();
+ } catch (e) {
+ console.warn(e);
+ }
+}
+
+function renderSessions() {
+ const box = $("#sessions");
+ box.innerHTML = "";
+ if (!state.sessions.length) {
+ box.innerHTML = '<div class="empty">No saved sessions</div>';
+ return;
+ }
+ for (const s of state.sessions) {
+ const card = document.createElement("div");
+ card.className = "sess-card";
+ card.innerHTML = `
+ <div class="sess-meta">
+ <span class="sess-id">${escapeHtml(s.id || "")}</span>
+ <span class="sess-title">${escapeHtml(s.title || "Untitled")}</span>
+ <span class="sess-time">${escapeHtml(s.time || "")}</span>
+ </div>
+ `;
+ box.append(card);
+ }
+}
+
+/* ── Composer ──────────────────────────────────────────────── */
+function autoGrow(ta) {
+ ta.style.height = "auto";
+ ta.style.height = Math.min(ta.scrollHeight, 200) + "px";
+}
+
+/* ── Wire up ───────────────────────────────────────────────── */
+document.addEventListener("DOMContentLoaded", () => {
+ $$(".nav-item").forEach(b => b.onclick = () => switchView(b.dataset.view));
+ $("#clear-btn").onclick = () => {
+ $("#messages").innerHTML = "";
+ };
+ $("#close-file-btn").onclick = () => switchView("chat");
+
+ const form = $("#composer");
+ const input = $("#input");
+ form.onsubmit = (e) => { e.preventDefault(); sendPrompt(); };
+ input.oninput = () => autoGrow(input);
+ input.onkeydown = (e) => {
+ if (e.key === "Enter" && !e.shiftKey) {
+ e.preventDefault();
+ sendPrompt();
+ }
+ };
+
+ boot();
+}); \ No newline at end of file
diff --git a/src/agentux/web/static/index.html b/src/agentux/web/static/index.html
new file mode 100644
index 0000000..10ac988
--- /dev/null
+++ b/src/agentux/web/static/index.html
@@ -0,0 +1,99 @@
+<!DOCTYPE html>
+<html lang="en" data-theme="emerald">
+<head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title>Agentux · Web Console</title>
+ <link rel="stylesheet" href="/styles.css" />
+ <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⌋</text></svg>" />
+</head>
+<body>
+ <div class="app">
+ <!-- ────────────────────────── Sidebar ────────────────────────── -->
+ <aside class="sidebar">
+ <div class="brand">
+ <span class="brand-mark">⌋</span>
+ <div class="brand-text">
+ <strong>AGENTUX</strong>
+ <span id="model-line" class="muted">—</span>
+ </div>
+ </div>
+
+ <nav class="nav">
+ <button class="nav-item active" data-view="chat">
+ <span class="nav-icon">💬</span> Chat
+ </button>
+ <button class="nav-item" data-view="files">
+ <span class="nav-icon">🗂</span> Workspace
+ </button>
+ <button class="nav-item" data-view="tools">
+ <span class="nav-icon">🔧</span> Tools
+ </button>
+ <button class="nav-item" data-view="checkpoints">
+ <span class="nav-icon">Snapshots</span> Checkpoints
+ </button>
+ <button class="nav-item" data-view="sessions">
+ <span class="nav-icon">🧾</span> Sessions
+ </button>
+ </nav>
+
+ <div class="sidebar-footer">
+ <span id="workspace-line" class="muted">—</span>
+ </div>
+ </aside>
+
+ <!-- ────────────────────────── Main ────────────────────────── -->
+ <main class="main">
+ <header class="topbar">
+ <div class="view-title">
+ <h1 id="view-title">Chat</h1>
+ <p id="view-subtitle" class="muted">Ask anything. Tools run inline.</p>
+ </div>
+ <div class="topbar-actions">
+ <button id="clear-btn" class="btn btn-ghost" title="Clear conversation">Clear</button>
+ </div>
+ </header>
+
+ <!-- Chat view -->
+ <section class="view chat-view" id="view-chat">
+ <div class="messages" id="messages"></div>
+ <form class="composer" id="composer">
+ <textarea id="input" rows="1" placeholder="Send a message…" autocomplete="off"></textarea>
+ <button type="submit" id="send-btn" class="btn btn-primary">Send</button>
+ </form>
+ </section>
+
+ <!-- Files view -->
+ <section class="view" id="view-files" hidden>
+ <div class="file-browser">
+ <div class="file-tree" id="file-tree"></div>
+ <div class="file-viewer">
+ <div class="file-viewer-head">
+ <span id="file-path" class="muted">No file selected</span>
+ <button id="close-file-btn" class="btn btn-ghost btn-sm">✕</button>
+ </div>
+ <pre id="file-content" class="file-content"></pre>
+ </div>
+ </div>
+ </section>
+
+ <!-- Tools view -->
+ <section class="view" id="view-tools" hidden>
+ <div class="tools-grid" id="tools-grid"></div>
+ </section>
+
+ <!-- Checkpoints view -->
+ <section class="view" id="view-checkpoints" hidden>
+ <div class="checkpoints" id="checkpoints"></div>
+ </section>
+
+ <!-- Sessions view -->
+ <section class="view" id="view-sessions" hidden>
+ <div class="sessions" id="sessions"></div>
+ </section>
+ </main>
+ </div>
+
+ <script src="/app.js"></script>
+</body>
+</html> \ No newline at end of file
diff --git a/src/agentux/web/static/styles.css b/src/agentux/web/static/styles.css
new file mode 100644
index 0000000..be1167b
--- /dev/null
+++ b/src/agentux/web/static/styles.css
@@ -0,0 +1,442 @@
+/* ──────────────────────────────────────────────────────────────
+ Agentux Web Console — single-file stylesheet
+ Theme: emerald on near-black, with cyan and amber accents.
+ Zero dependencies.
+ ────────────────────────────────────────────────────────────── */
+
+:root {
+ --bg: #0a0d12;
+ --bg-2: #11151c;
+ --bg-3: #1a1f2b;
+ --bg-elev: #202633;
+ --border: #2a3140;
+ --border-2: #343d4e;
+ --text: #e6e9ef;
+ --text-2: #a8b1bf;
+ --muted: #6b7383;
+ --emerald: #00ff88;
+ --emerald-d: #00c46a;
+ --cyan: #14d6ff;
+ --amber: #ffb020;
+ --red: #ff5d5d;
+ --purple: #b06bff;
+ --radius: 10px;
+ --shadow: 0 8px 28px rgba(0,0,0,.45);
+ --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
+ --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
+}
+
+[data-theme="emerald"] {
+ --accent: var(--emerald);
+ --accent-d: var(--emerald-d);
+ --accent-glow: rgba(0,255,136,.18);
+}
+
+[data-theme="amber"] {
+ --accent: var(--amber);
+ --accent-d: #e69514;
+ --accent-glow: rgba(255,176,32,.18);
+}
+
+[data-theme="cyan"] {
+ --accent: var(--cyan);
+ --accent-d: #09a8d6;
+ --accent-glow: rgba(20,214,255,.18);
+}
+
+* { box-sizing: border-box; }
+
+html, body {
+ margin: 0;
+ height: 100%;
+ background: var(--bg);
+ color: var(--text);
+ font-family: var(--sans);
+ font-size: 14px;
+ -webkit-font-smoothing: antialiased;
+}
+
+::selection { background: var(--accent-glow); }
+
+.app {
+ display: grid;
+ grid-template-columns: 240px 1fr;
+ height: 100vh;
+ overflow: hidden;
+}
+
+/* ── Sidebar ─────────────────────────────────────────────── */
+.sidebar {
+ background: var(--bg-2);
+ border-right: 1px solid var(--border);
+ display: flex;
+ flex-direction: column;
+ padding: 16px 12px;
+ gap: 8px;
+}
+
+.brand {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ padding: 6px 8px 14px;
+ border-bottom: 1px solid var(--border);
+ margin-bottom: 4px;
+}
+.brand-mark {
+ font-size: 26px;
+ line-height: 1;
+ color: var(--accent);
+ font-weight: 700;
+}
+.brand-text strong {
+ font-size: 15px;
+ letter-spacing: .14em;
+ display: block;
+}
+.muted { color: var(--muted); }
+.muted.small { font-size: 11px; }
+
+.nav { display: flex; flex-direction: column; gap: 2px; }
+
+.nav-item {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ background: transparent;
+ border: 1px solid transparent;
+ color: var(--text-2);
+ font: inherit;
+ font-size: 13px;
+ padding: 8px 10px;
+ border-radius: 8px;
+ cursor: pointer;
+ text-align: left;
+ transition: background .12s, color .12s, border-color .12s;
+}
+.nav-item:hover { background: var(--bg-3); color: var(--text); }
+.nav-item.active {
+ background: var(--accent-glow);
+ color: var(--accent);
+ border-color: var(--border-2);
+}
+.nav-icon { font-size: 14px; width: 16px; text-align: center; }
+
+.sidebar-footer {
+ margin-top: auto;
+ padding-top: 10px;
+ border-top: 1px solid var(--border);
+ font-size: 11px;
+}
+
+/* ── Main ────────────────────────────────────────────────── */
+.main {
+ display: flex;
+ flex-direction: column;
+ min-width: 0;
+ overflow: hidden;
+}
+
+.topbar {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 12px 20px;
+ border-bottom: 1px solid var(--border);
+ background: var(--bg-2);
+ flex-shrink: 0;
+}
+.view-title h1 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: .02em; }
+.view-title .muted { font-size: 12px; }
+
+.btn {
+ background: var(--bg-3);
+ border: 1px solid var(--border-2);
+ color: var(--text);
+ font: inherit;
+ font-size: 12px;
+ padding: 6px 12px;
+ border-radius: 8px;
+ cursor: pointer;
+ transition: background .12s, border-color .12s;
+}
+.btn:hover { background: var(--bg-elev); border-color: var(--border-2); }
+.btn-primary {
+ background: var(--accent);
+ color: #06281a;
+ border-color: var(--accent);
+ font-weight: 600;
+}
+.btn-primary:hover { filter: brightness(1.08); }
+.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
+.btn-ghost { background: transparent; }
+.btn-sm { padding: 4px 8px; font-size: 11px; }
+
+.view { display: none; flex: 1; overflow: hidden; }
+.view.active { display: flex; flex-direction: column; min-height: 0; }
+
+/* ── Chat ────────────────────────────────────────────────── */
+.chat-view { padding: 0; }
+
+.messages {
+ flex: 1;
+ overflow-y: auto;
+ padding: 20px 24px 8px;
+ display: flex;
+ flex-direction: column;
+ gap: 14px;
+}
+
+.msg {
+ max-width: 820px;
+ width: 100%;
+ margin: 0;
+ animation: fade .25s ease;
+}
+@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }
+
+.msg .who {
+ font-size: 11px;
+ font-weight: 600;
+ letter-spacing: .08em;
+ text-transform: uppercase;
+ margin-bottom: 6px;
+ color: var(--muted);
+}
+.msg.user .who { color: var(--cyan); }
+.msg.assistant .who { color: var(--accent); }
+.msg.system .who { color: var(--amber); }
+
+.msg .body {
+ white-space: pre-wrap;
+ word-break: break-word;
+ line-height: 1.55;
+ font-size: 14px;
+}
+.msg .body p { margin: 0 0 8px; }
+.msg .body p:last-child { margin-bottom: 0; }
+.msg .body code {
+ font-family: var(--mono);
+ font-size: 12.5px;
+ background: var(--bg-3);
+ padding: 1px 5px;
+ border-radius: 4px;
+}
+.msg .body pre {
+ background: var(--bg-3);
+ border: 1px solid var(--border);
+ border-radius: 8px;
+ padding: 10px 12px;
+ overflow-x: auto;
+ margin: 8px 0;
+}
+.msg .body pre code { background: none; padding: 0; }
+
+/* Markdown-ish tables */
+.msg .body table {
+ border-collapse: collapse;
+ margin: 8px 0;
+ font-size: 13px;
+}
+.msg .body th, .msg .body td {
+ border: 1px solid var(--border-2);
+ padding: 5px 10px;
+ text-align: left;
+}
+.msg .body th { background: var(--bg-3); }
+
+/* Tool card */
+.tool-card {
+ background: var(--bg-2);
+ border: 1px solid var(--border);
+ border-left: 3px solid var(--amber);
+ border-radius: 8px;
+ padding: 10px 12px;
+ margin: 6px 0;
+ font-size: 13px;
+}
+.tool-card .tool-head {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ color: var(--amber);
+ font-weight: 600;
+}
+.tool-card .tool-head .tool-name { font-family: var(--mono); font-size: 12px; }
+.tool-card .tool-args { color: var(--text-2); margin-top: 4px; font-family: var(--mono); font-size: 11.5px; white-space: pre-wrap; word-break: break-word; }
+.tool-card .tool-result { margin-top: 6px; color: var(--text-2); font-family: var(--mono); font-size: 11.5px; white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow: auto; }
+.tool-card .tool-tag { font-size: 10px; opacity: .7; text-transform: uppercase; letter-spacing: .06em; }
+.tool-card.error { border-left-color: var(--red); }
+.tool-card.error .tool-head { color: var(--red); }
+.tool-card.running { border-left-color: var(--cyan); }
+.tool-card.running .tool-head { color: var(--cyan); }
+
+.cursor::after {
+ content: "▍";
+ color: var(--accent);
+ animation: blink 1s steps(2, start) infinite;
+ font-family: var(--mono);
+}
+@keyframes blink { 50% { opacity: 0; } }
+
+/* Composer */
+.composer {
+ display: flex;
+ gap: 10px;
+ align-items: flex-end;
+ padding: 12px 20px 16px;
+ border-top: 1px solid var(--border);
+ background: var(--bg-2);
+ flex-shrink: 0;
+}
+.composer textarea {
+ flex: 1;
+ resize: none;
+ max-height: 200px;
+ min-height: 44px;
+ background: var(--bg-3);
+ border: 1px solid var(--border-2);
+ border-radius: 10px;
+ color: var(--text);
+ font: inherit;
+ font-size: 14px;
+ padding: 11px 14px;
+ line-height: 1.5;
+ outline: none;
+ transition: border-color .12s, box-shadow .12s;
+}
+.composer textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
+
+/* ── Files ───────────────────────────────────────────────── */
+.file-browser {
+ display: grid;
+ grid-template-columns: 280px 1fr;
+ height: 100%;
+ overflow: hidden;
+}
+.file-tree {
+ overflow-y: auto;
+ padding: 12px;
+ border-right: 1px solid var(--border);
+ font-family: var(--mono);
+ font-size: 12.5px;
+}
+.file-tree .tree-item {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ padding: 3px 6px;
+ border-radius: 5px;
+ cursor: pointer;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+.file-tree .tree-item:hover { background: var(--bg-3); }
+.file-tree .tree-item.active { background: var(--accent-glow); color: var(--accent); }
+.file-tree .tree-item .indent { width: 14px; display: inline-block; }
+.file-tree .tree-item .f-icon { width: 16px; text-align: center; color: var(--muted); }
+
+.file-viewer {
+ display: flex;
+ flex-direction: column;
+ min-width: 0;
+ overflow: hidden;
+}
+.file-viewer-head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 10px 14px;
+ border-bottom: 1px solid var(--border);
+ background: var(--bg-2);
+ font-family: var(--mono);
+ font-size: 12px;
+ flex-shrink: 0;
+}
+.file-content {
+ flex: 1;
+ margin: 0;
+ padding: 14px;
+ overflow: auto;
+ background: var(--bg);
+ color: var(--text-2);
+ font-family: var(--mono);
+ font-size: 12.5px;
+ line-height: 1.6;
+ white-space: pre;
+ tab-size: 4;
+}
+
+/* ── Tools ───────────────────────────────────────────────── */
+.tools-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
+ gap: 12px;
+ padding: 16px 20px;
+ align-content: start;
+}
+.tool-chip {
+ background: var(--bg-2);
+ border: 1px solid var(--border);
+ border-radius: var(--radius);
+ padding: 12px 14px;
+ cursor: pointer;
+ transition: border-color .12s, transform .12s;
+}
+.tool-chip:hover { border-color: var(--border-2); transform: translateY(-1px); }
+.tool-chip .tool-chip-name {
+ font-family: var(--mono);
+ font-size: 13px;
+ color: var(--accent);
+ font-weight: 600;
+}
+.tool-chip .tool-chip-desc {
+ color: var(--text-2);
+ font-size: 12px;
+ margin-top: 4px;
+ line-height: 1.45;
+}
+
+/* ── Checkpoints / sessions ──────────────────────────────── */
+.checkpoints, .sessions {
+ overflow-y: auto;
+ padding: 16px 20px;
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+}
+.cp-card, .sess-card {
+ background: var(--bg-2);
+ border: 1px solid var(--border);
+ border-radius: var(--radius);
+ padding: 12px 14px;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 12px;
+}
+.cp-card .cp-meta, .sess-card .sess-meta { display: flex; flex-direction: column; gap: 2px; }
+.cp-card .cp-id, .sess-card .sess-id { font-family: var(--mono); font-size: 12px; color: var(--accent); }
+.cp-card .cp-desc, .sess-card .sess-title { font-size: 13px; }
+.cp-card .cp-time, .sess-card .sess-time { font-size: 11px; color: var(--muted); }
+.cp-card .cp-files { font-size: 11px; color: var(--muted); }
+
+.empty {
+ color: var(--muted);
+ text-align: center;
+ padding: 40px 20px;
+ font-size: 13px;
+}
+
+/* Scrollbar */
+::-webkit-scrollbar { width: 9px; height: 9px; }
+::-webkit-scrollbar-track { background: transparent; }
+::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 5px; }
+::-webkit-scrollbar-thumb:hover { background: var(--border); }
+
+@media (max-width: 720px) {
+ .app { grid-template-columns: 1fr; }
+ .sidebar { display: none; }
+ .file-browser { grid-template-columns: 1fr; }
+} \ No newline at end of file