Official
chat
Built-in chat UI (JavaScript UI plugin).
The app opens the listing; nothing installs until an agent in your Plugins workspace has read the files and you enable the plugin. In a terminal: dvg install divergence/chat@0.2.8
Permissions in 0.2.8
Files
split-chats.test.ts4 KB
import assert from "node:assert/strict";
import test from "node:test";
import * as Effect from "effect/Effect";
import type { Task } from "divergence/protocol";
import { focusPane, noteTask } from "./layout.ts";
import { chat, harness } from "./ui-for-tests.test.ts";
const a = { kind: "chat" as const, chatId: "a" };
const b = { kind: "chat" as const, chatId: "b" };
const task = (focused: string): Task => ({
id: "task",
layout: {
root: {
kind: "split",
id: "s",
direction: "row",
children: [
{ share: 0.5, layout: { kind: "pane", id: "p", tabs: [a], active: a } },
{ share: 0.5, layout: { kind: "pane", id: "q", tabs: [b], active: b } },
],
},
focused,
},
createdAt: "",
updatedAt: "",
});
// A pane's view is drawn again only when it changes, so it can hold the task from when it was
// itself focused. A press in it still selects its chat, which the sidebar shows as selected.
test("a press in a pane drawn while it was focused selects its chat after the focus moved away", async () => {
const h = harness();
h.controller.state.chats.a = chat({ id: "a" });
h.controller.state.chats.b = chat({ id: "b" });
const drawnWith = task("q");
noteTask(h.controller.state.layouts, task("p"));
await Effect.runPromise(h.controller.app.select("a", "w"));
const pane = (drawnWith.layout.root as { children: { layout: unknown }[] }).children[1]!.layout as never;
await Effect.runPromise(focusPane(h.controller, drawnWith, pane));
await h.settle();
assert.equal(h.controller.api.app.state().chatId, "b");
assert.deepEqual(h.calls.find((call) => call.method === "host/layouts.update")?.params, {
paneId: "q", active: b, focused: true, onScreen: "task",
});
await h.close();
});
// Chats of two workspaces side by side: each tab shows its workspace's mark, which a task of one
// workspace leaves out.
test("a chat's tab shows its workspace's mark while the task mixes workspaces", async () => {
const { renderTaskTitle } = await import("./views/layout.tsx");
const { nodes } = await import("./ui-for-tests.test.ts");
const h = harness();
h.controller.state.chats.a = chat({ id: "a", workspaceId: "w1" });
h.controller.state.chats.b = chat({ id: "b", workspaceId: "w1" });
const marks = () =>
nodes(renderTaskTitle(h.v, task("p"), null, "a", false))
.find((node) => node.id === "tab-chat-b")!
.children.flatMap((child) => nodes(child))
.filter((node) => node.type === "icon" && String(node.name).startsWith("folder"));
assert.equal(marks().length, 0, "one workspace: no mark");
h.controller.state.chats.b = chat({ id: "b", workspaceId: "w2" });
assert.equal(marks().length, 1, "two workspaces: the mark");
await h.close();
});
// A workspace's tab in the side split (a file, a terminal) shows beside a task with a chat of
// that workspace and stays out of the side split beside any other.
test("the side split shows a workspace's tabs only beside that workspace's chats", async () => {
const { sideOnScreen, sideHasTabs } = await import("./layout.ts");
const h = harness();
const file = { kind: "item" as const, id: "f", owner: "tabs", itemKind: "tabs.file", key: "file:w1:a.ts", title: "a.ts", workspaceId: "w1" };
const layouts = h.controller.state.layouts;
layouts.side = { open: true, width: 400, remembered: [], layout: { root: { kind: "pane", id: "s1", tabs: [file], active: file }, focused: "s1" } } as never;
const solo = (chatId: string): Task => ({
id: chatId,
layout: { root: { kind: "pane", id: `p-${chatId}`, tabs: [{ kind: "chat", chatId }], active: { kind: "chat", chatId } }, focused: `p-${chatId}` },
createdAt: "",
updatedAt: "",
});
const chats = { a: chat({ id: "a", workspaceId: "w1" }), b: chat({ id: "b", workspaceId: "w2" }) };
assert.ok(sideOnScreen(layouts, solo("a"), chats), "beside a chat of its workspace");
assert.equal(sideOnScreen(layouts, solo("b"), chats), null, "not beside a chat of another");
assert.equal(sideHasTabs(layouts, solo("b"), chats), false);
await h.close();
});Versions
| Version | Published | Plugin API | Size | Permissions | Status |
|---|---|---|---|---|---|
| 0.2.9latest | Nov 21, 2026 | >=5 <6 | 349 KB | 5 permissions | Listed |
| 0.2.8 | Nov 16, 2026 | >=5 <6 | 348.6 KB | 5 permissions | Listed |
| 0.2.7 | Nov 11, 2026 | >=5 <6 | 314.3 KB | 5 permissions | Listed |
| 0.2.6 | Nov 9, 2026 | >=5 <6 | 306.2 KB | 5 permissions | Listed |
| 0.2.5 | Oct 27, 2026 | >=2 <4 | 178.6 KB | 5 permissions | Listed |
No comments yet.