web: add chat model picker, agent badges and a preloaded brief

Show the current model under the chat title with an OpenCode-backed picker,
put an agent mark on the right of every chat row, simplify the tool summary to
'N tools', and give the reasoning and tool controls one symmetric hover box.
New chats preload an editable behavior brief, and the activity spinner remains
the turn's single live progress indicator.
This commit is contained in:
2026-10-20 14:58:26 +01:00
parent 6bfe4c8921
commit 4b20be6ea3
7 changed files with 397 additions and 49 deletions
+6 -2
View File
@@ -16,6 +16,7 @@ import {
CHAT_CREATE_BACK_LABEL,
CHAT_CREATE_CANCEL,
CHAT_CREATE_CONFIRM,
DEFAULT_CHAT_INSTRUCTIONS,
CHAT_CREATE_LOADING,
CHAT_CREATE_MODEL_NOTE,
CHAT_CREATE_PROMPT,
@@ -245,8 +246,8 @@ test("partRendering classifies text, reasoning, other text and empty parts", ()
});
test("toolCallsLabel never pluralises a count of one", () => {
assert.equal(toolCallsLabel(1), "1 tool called");
assert.equal(toolCallsLabel(4), "4 tools called");
assert.equal(toolCallsLabel(1), "1 tool");
assert.equal(toolCallsLabel(4), "4 tools");
});
test("reasoningLabel is Thinking/Reasoning with the step count and streaming word", () => {
@@ -1773,6 +1774,7 @@ test("newChatCreateState starts on home, not sending, with the caller's operatio
assert.deepEqual(newChatCreateState("web-chat-op"), {
directory: HOME_DIRECTORY,
backend: "opencode",
instructions: DEFAULT_CHAT_INSTRUCTIONS,
operationId: "web-chat-op",
creating: false,
error: "",
@@ -1785,6 +1787,7 @@ test("selectChatDirectory sends the chosen value and clears a previous refusal",
assert.deepEqual(selectChatDirectory(state, recent), {
directory: "/repo/a",
backend: "opencode",
instructions: DEFAULT_CHAT_INSTRUCTIONS,
operationId: "op",
creating: false,
error: "",
@@ -1798,6 +1801,7 @@ test("chatCreateFailed keeps the pane open with the server's message; success st
assert.deepEqual(chatCreateFailed(creating, "the directory is not available"), {
directory: "~",
backend: "opencode",
instructions: DEFAULT_CHAT_INSTRUCTIONS,
operationId: "op",
creating: false,
error: "the directory is not available",
+1 -1
View File
@@ -5177,7 +5177,7 @@ try {
if (!chipInfo) throw new Error("C6: no tool-call chip rendered in the live transcript");
const parsedCount = Number(/(\d+)/.exec(chipInfo.text)?.[1] ?? NaN);
const toolCount = Number.isFinite(parsedCount) ? parsedCount : chipInfo.rows;
const toolLabel = toolCount === 1 ? "1 tool called" : `${toolCount} tools called`;
const toolLabel = toolCount === 1 ? "1 tool" : `${toolCount} tools`;
const toolAria =
toolCount === 1 ? "1 tool call, expand for details" : `${toolCount} tool calls, expand for details`;
if (!chipInfo.text.includes(toolLabel)) {