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.5
Permissions in 0.2.5
Files
rows.test.ts2.9 KB
// A transcript keeps the rows that did not change between renders, so the
// runtime skips them, and draws again every row whose inputs changed.
import assert from "node:assert/strict";
import test from "node:test";
import type { AgentEventKind } from "divergence";
import { applyEvent } from "./transcript.ts";
import { renderTranscript } from "./views/rows.ts";
import { chat, harness, item, nodes } from "./ui-for-tests.test.ts";
function setup() {
const h = harness();
h.controller.api.toolRenderers = () => [];
h.controller.state.chats.a = chat({ id: "a", sessionId: "s" });
const t = h.controller.transcript("a");
t.items = [
item({ id: "u1", role: "user", text: "first" }),
item({ id: "a1", role: "assistant", text: "reply one" }),
item({ id: "u2", role: "user", text: "second" }),
item({ id: "t1", role: "tool", call: { kind: "read", title: "Read a.ts", content: [{ type: "text", text: "x" }] } }),
item({ id: "a2", role: "assistant", text: "reply" }),
];
t.loaded = true;
// The rows of the scroller, by the id each row's column carries.
const rows = () => {
const scroller = nodes(renderTranscript(h.v, h.controller.state.chats.a!)).find((node) => node.type === "scroller");
return new Map((scroller?.items ?? []).map((row) => [String(row.id), row]));
};
return { h, t, rows };
}
test("rows that did not change are the same elements as last render", () => {
const { t, rows } = setup();
const before = rows();
const after = rows();
for (const [id, row] of before) assert.equal(after.get(id), row, id);
applyEvent(t, { event: "text_delta", itemId: "a2", text: " more" } as AgentEventKind);
const streamed = rows();
assert.notEqual(streamed.get("transcript-row-a2"), after.get("transcript-row-a2"), "the streamed reply draws again");
assert.equal(streamed.get("transcript-row-a1"), after.get("transcript-row-a1"), "the replies before it are kept");
assert.ok(nodes(streamed.get("transcript-row-a2")).some((node) => node.text === "reply more"));
});
test("a tool update, a toggle and the run starting draw the rows they change", () => {
const { t, rows } = setup();
const before = rows();
const fold = [...before.keys()].find((id) => id.includes("tools-t1"))!;
applyEvent(t, { event: "tool_call_updated", id: "t1", status: "failed" } as AgentEventKind);
const updated = rows();
assert.notEqual(updated.get(fold), before.get(fold), "the updated call's fold draws again");
assert.equal(updated.get("transcript-row-u1"), before.get("transcript-row-u1"));
t.folds.set("tools-t1", false);
const folded = rows();
assert.notEqual(folded.get(fold), updated.get(fold), "closing the fold draws it again");
// A user row offers its edit only while nothing runs: every one draws again.
t.running = true;
const running = rows();
assert.notEqual(running.get("transcript-row-u1"), folded.get("transcript-row-u1"));
assert.notEqual(running.get("transcript-row-u2"), folded.get("transcript-row-u2"));
});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.