chore(webui): delete the chat modules orphaned by the Preact refactor

Five files survived the Preact chat cutover with no production consumer:

- ui/src/chat/chat-view.jsx, chat-catalog.jsx, chat-panels.jsx: zero importers
  anywhere in ui/src or ui/test.
- ui/src/chat/chat.html: referenced only by chat-view.jsx, itself orphaned.
- ui/src/chat/chat-stream.jsx: imported only by ui/test/chat-markdown.test.js.
  Its updateStreamingReply helper swaps a rendered Markdown node into the DOM --
  the imperative hyperscript pattern the Preact port replaced.

Corroborating evidence that these were already outside the build graph: a full
"task ui" rebuild after deleting them produced NO change to the committed
ui/dist bundle, so tree-shaking had already excluded all five.

ui/test/chat-markdown.test.js loses only the case that exercised the deleted
module. Its two renderMarkdown cases stay, because renderMarkdown is live --
ui/src/chat/chat-render.jsx and chat.jsx both call it.

Not touched: chat.jsx, chat-render.jsx, chat-retry.jsx, chat-state.jsx,
chat-tools.jsx, chat-update-status.jsx, markdown.jsx -- each still has at least
one importer, so none of them is an orphan.
This commit is contained in:
sam committed 2026-09-19 02:30:51 +10:00
1 parent 8d3925a844
commit bcef1766a8
6 files changed
-191

No files matched your search

-51
View File
@@ -1,51 +0,0 @@
import { el } from "../base/dom.jsx";
import { sessionTitle } from "./chat-render.jsx";
export function renderSessions({ sessionList, sessionTools, sessions, currentSession, onSelect }) {
sessionList.replaceChildren();
sessionTools.hidden = !currentSession;
if (!sessions.length) {
sessionList.append(el("div.chat-empty", "Your conversations will appear here."));
return;
}
for (const session of sessions) {
sessionList.append(el(
"button.chat-session",
{ class: currentSession === session.session_id ? "active" : "", onclick: () => onSelect(session.session_id) },
el("strong", sessionTitle(session)),
el("span", new Date(session.last_active_at).toLocaleString()),
));
}
}
export function renderSelectors(refs, data, onDangerous) {
refs.persona.replaceChildren(el("option", { value: "" }, "Personality"));
for (const name of data.personas || []) refs.persona.append(el("option", { value: name }, name));
refs.persona.value = data.active_persona || "";
const providers = data.providers || [];
refs.provider.hidden = providers.length === 0;
refs.provider.replaceChildren(el("option", { value: "" }, "Provider"));
for (const name of providers) refs.provider.append(el("option", { value: name }, name));
refs.provider.value = data.active_provider || providers[0] || "";
renderModels(refs, data, refs.provider.value);
refs.restart.hidden = !data.restart_available;
refs.dangerousPanel.hidden = !data.dangerous_available;
if (data.dangerous_available) onDangerous();
}
export function renderModels(refs, data, providerName) {
const grouped = data.models_by_provider || {};
const names = providerName && grouped[providerName] ? grouped[providerName] : data.models || [];
refs.model.replaceChildren(el("option", { value: "" }, "Model"));
for (const name of names) refs.model.append(el("option", { value: name }, name));
refs.model.value = data.active_model || "";
}
export function renderCommands(commandHelp, commands) {
const specs = (commands || []).map((item) => typeof item === "string" ? { command: item, usage: item, description: "" } : item);
const list = el("div.chat-command-list");
if (!specs.length) list.append(el("span", "Send a message to begin."));
for (const spec of specs) list.append(el("div.chat-command-item", el("code", spec.usage || spec.command), el("span", spec.description || "")));
commandHelp.replaceChildren(el("summary", `Available commands (${specs.length})`), list);
return specs;
}
-47
View File
@@ -1,47 +0,0 @@
import { el } from "../base/dom.jsx";
export function renderUpdate(panel, data, { onDefer, onInstall }) {
panel.replaceChildren();
const snapshot = data?.snapshot || null;
const available = data?.available || [];
if (!available.length) {
panel.append(el("span", snapshot?.deferred ? "Update deferred." : "Archie is up to date."));
return;
}
panel.append(
el("div", el("strong", "Update available"), el("span", available.map((component) => `${component.Label || component.label}: ${component.Available || component.available}`).join(" · "))),
el("div.chat-update-actions",
el("button.btn", { onclick: onDefer }, "Defer"),
data.can_install ? el("button.btn.btn-primary", { onclick: onInstall }, "Install update") : null,
),
);
}
export function renderDangerous(panel, data, { onRequest, onDecision }) {
panel.replaceChildren();
const checkpoints = data?.checkpoints || [];
const pending = data?.pending || [];
const checkpoint = el("select.chat-select", { "aria-label": "Checkpoint" },
el("option", { value: "" }, "Select checkpoint"),
...checkpoints.map((item) => el("option", { value: item.Number ?? item.number }, `${item.Number ?? item.number} — ${item.Label ?? item.label ?? "checkpoint"}`)),
);
const stopSpec = el("input.chat-dangerous-input", { placeholder: "Process name or id", "aria-label": "Process name or id" });
const request = (kind, spec) => () => onRequest(kind, String(spec.value || spec).trim());
const decisionButton = (id, decision, label) => el("button.btn", { onclick: () => onDecision(id, decision) }, label);
const pendingRows = pending.length ? pending.map((action) => el("div.chat-dangerous-pending",
el("span", action.description),
el("div.chat-update-actions",
decisionButton(action.id, "approve", "Approve"),
decisionButton(action.id, "permanent", "Approve for 24h"),
decisionButton(action.id, "deny", "Deny"),
),
)) : [el("span.chat-hint", "No pending dangerous actions.")];
panel.append(
el("div.chat-dangerous-head", el("strong", "Dangerous actions"), el("span.chat-hint", "Every action requires approval.")),
el("div.chat-dangerous-controls",
el("div", checkpoint, el("button.btn", { onclick: request("rollback", checkpoint) }, "Request rollback")),
el("div", stopSpec, el("button.btn", { onclick: request("stop", stopSpec) }, "Request stop")),
),
el("div.chat-dangerous-pending-list", ...pendingRows),
);
}
-8
View File
@@ -1,8 +0,0 @@
import { renderMarkdown } from "./markdown.jsx";
export function updateStreamingReply(current, text) {
const next = renderMarkdown(text);
if (typeof current?.replaceWith === "function") current.replaceWith(next);
else if (current?.parentNode) current.parentNode.replaceChild(next, current);
return next;
}
-10
View File
@@ -1,10 +0,0 @@
import template from "./chat.html?raw";
export function createChatView() {
const holder = document.createElement("template");
holder.innerHTML = template.trim();
const root = holder.content.firstElementChild;
const refs = {};
for (const node of root.querySelectorAll("[data-chat-ref]")) refs[node.dataset.chatRef] = node;
return { root, refs };
}
-65
View File
@@ -1,65 +0,0 @@
<div class="chat-page">
<div class="chat-page-content">
<header class="chat-topbar">
<div><span class="chat-kicker">ARCHIE WORKSPACE</span><h1 class="page-title">Chat</h1></div>
<div class="chat-topbar-actions">
<span class="chat-status" data-chat-ref="status">Ready</span>
<button class="btn" data-chat-ref="restart" hidden>Reload Telegram</button>
<button class="btn" data-chat-ref="checkUpdates">Check updates</button>
<select class="chat-select" data-chat-ref="persona" aria-label="Personality"><option value="">Personality</option></select>
<select class="chat-select" data-chat-ref="provider" aria-label="Provider" hidden><option value="">Provider</option></select>
<select class="chat-select" data-chat-ref="model" aria-label="Model"><option value="">Model</option></select>
</div>
</header>
<div class="chat-update-panel" data-chat-ref="updatePanel"></div>
<div class="chat-dangerous-panel" data-chat-ref="dangerousPanel" hidden></div>
<div class="chat-layout">
<aside class="chat-sidebar">
<div class="chat-sidebar-head">
<strong>Conversations</strong>
<button class="btn btn-primary" data-chat-ref="newChat" type="button">+ New chat</button>
</div>
<div class="chat-session-list" data-chat-ref="sessionList"></div>
</aside>
<section class="chat-workspace">
<div class="chat-workspace-head">
<span class="chat-workspace-label">PERSONAL ASSISTANT</span>
<details class="chat-command-help" data-chat-ref="commandHelp"></details>
<details class="chat-session-tools" data-chat-ref="sessionTools">
<summary>Session actions</summary>
<div class="chat-session-tool-list">
<button class="btn" data-chat-action="retry" type="button">Retry</button>
<button class="btn" data-chat-action="undo" type="button">Undo</button>
<button class="btn" data-chat-action="title" type="button">Rename</button>
<button class="btn" data-chat-action="branch" type="button">Branch</button>
<button class="btn" data-chat-action="compress" type="button">Preview compression</button>
</div>
</details>
</div>
<div class="chat-transcript" data-chat-ref="transcript">
<div class="chat-empty-state" data-chat-ref="emptyState">
<span class="chat-empty-mark">A</span>
<h2>What are we working on?</h2>
<p>Ask Archie anything, or start with one of these prompts.</p>
<div class="chat-prompt-grid">
<button class="chat-prompt" data-chat-prompt="Summarise active tasks" type="button">Summarise active tasks</button>
<button class="chat-prompt" data-chat-prompt="Show running agents" type="button">Show running agents</button>
<button class="chat-prompt" data-chat-prompt="Check system status" type="button">Check system status</button>
</div>
</div>
</div>
<div class="chat-compose">
<div class="chat-composer-shell">
<textarea class="chat-composer" data-chat-ref="composer" rows="3" placeholder="Message Archie… (commands like /status and /new work here)" aria-label="Message Archie"></textarea>
<div class="chat-command-menu" data-chat-ref="commandMenu" hidden role="listbox" aria-label="Commands"></div>
<div class="chat-compose-actions">
<span class="chat-hint">Enter to send · Shift+Enter for a new line</span>
<button class="btn" data-chat-ref="stop" type="button" disabled>Stop</button>
<button class="btn btn-primary" data-chat-ref="send" type="button">Send</button>
</div>
</div>
</div>
</section>
</div>
</div>
</div>
-10
View File
@@ -2,7 +2,6 @@ import { test } from "node:test";
import assert from "node:assert/strict";
import "./shim.js";
import { renderMarkdown } from "../src/chat/markdown.js";
import { updateStreamingReply } from "../src/chat/chat-stream.js";
test("chat Markdown renders Telegram-style rich blocks as semantic HTML", () => {
const rendered = renderMarkdown(
@@ -21,15 +20,6 @@ test("chat Markdown renders Telegram-style rich blocks as semantic HTML", () =>
assert.equal(rendered.querySelector("table").querySelector("td").textContent, "Archie");
});
test("streaming assistant replies keep rich Markdown in the live bubble", () => {
const bubble = renderMarkdown("draft");
const updated = updateStreamingReply(bubble, "# Live\n\n**bold**");
assert.equal(updated.querySelector("h1").textContent, "Live");
assert.equal(updated.querySelector("strong").textContent, "bold");
assert.equal(updated.className, "chat-bubble-text");
});
test("chat Markdown renders images as img elements with src and alt", () => {
const rendered = renderMarkdown("Here is the generated image: ![generated preview](https://example.com/image.png)");
const img = rendered.querySelector("img");