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.6
Permissions in 0.2.6
Files
messages.test.ts4.2 KB
// Messages between agents: one another session sent this chat's agent, and
// one this chat's agent sent with a tool call.
import assert from "node:assert/strict";
import test from "node:test";
import type { ArchiveRecord, TranscriptItem } from "divergence";
import { foldItems } from "./grouping.ts";
import { transcriptContext } from "./context.ts";
import { renderTranscript, turnEnds } from "./views/rows.tsx";
import { chat, harness, item, nodes } from "./ui-for-tests.test.ts";
const received = (id: string, text: string): TranscriptItem => ({
id,
role: "user",
blocks: [{ type: "text", text }],
from: "nexus-a1",
});
const sent = (id: string) =>
item({
id,
role: "tool",
call: {
name: "SendMessage",
title: "Message to nexus-51: Heads-up",
input: { to: "nexus-51", message: "I am editing **render.rs**." },
message: { to: "nexus-51", text: "I am editing **render.rs**." },
},
});
function draw(items: TranscriptItem[], expanded: string[] = []) {
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 = items;
t.snapshot = { kind: "ready" };
for (const id of expanded) t.expanded.add(id);
return nodes(renderTranscript(h.v, h.controller.state.chats.a!));
}
test("a message from another session shows who sent it and cannot be edited", () => {
const shown = draw([
item({ id: "u1", role: "user", text: "start" }),
item({ id: "a1", role: "assistant", text: "ok" }),
received("c1", "Please avoid render.rs."),
]);
assert.ok(shown.some((node) => node.type === "text" && node.text === "From nexus-a1"));
assert.ok(shown.some((node) => node.type === "markdown" && node.text === "Please avoid render.rs."));
assert.ok(!shown.some((node) => node.id === "edit-c1" || node.id === "restore-c1"));
assert.ok(shown.some((node) => node.id === "copy-c1"));
});
test("a message sent to another session reads as a message, on its own row", () => {
const shown = draw([sent("s1")], ["s1"]);
assert.ok(shown.some((node) => node.type === "icon" && node.name === "send"));
assert.ok(shown.some((node) => node.type === "markdown" && node.text === "I am editing **render.rs**."));
assert.ok(!shown.some((node) => node.type === "code"), "no input dump in the body");
const items = [item({ id: "r", role: "tool", call: { kind: "read" } }), sent("s1"), item({ id: "e", role: "tool" })];
assert.deepEqual(
foldItems(items).map((entry) => (entry.kind === "item" ? entry.item.id : entry.id)),
["tools-r", "s1", "tools-e"],
);
});
test("a message from another session goes on with the turn", () => {
const items = [
item({ id: "u1", role: "user", text: "start" }),
item({ id: "a1", role: "assistant", text: "first" }),
received("c1", "ping"),
item({ id: "a2", role: "assistant", text: "second" }),
];
assert.deepEqual([...turnEnds(items, false)], [["a2", null]]);
});
test("a handoff does not pass another agent's message off as the user's", () => {
const record = (id: string, entry: Record<string, unknown>, position: number): ArchiveRecord => ({
id,
revisionId: `revision:${id}`,
attachmentId: "source",
agentId: "A",
nativeItemId: null,
position,
item: entry,
});
const { text } = transcriptContext([
record("u", { role: "user", blocks: [{ type: "text", text: "start" }] }, 0),
record("c", { role: "user", blocks: [{ type: "text", text: "ping" }], from: "nexus-a1" }, 1),
], { artifact: { id: "export", path: "/w/.divergence/export.txt", regenerateCommand: "dvg artifact regenerate" } });
assert.match(text, /User \("A"\):\nstart/);
assert.match(text, /Message to "A" from another agent, "nexus-a1":\nping/);
});
test("a received message with a blank sender never shows as the user's", () => {
const blank = { ...received("c1", "ping"), from: "" };
const shown = draw([item({ id: "u1", role: "user", text: "start" }), item({ id: "a1", role: "assistant", text: "ok" }), blank]);
assert.ok(!shown.some((node) => node.id === "edit-c1" || node.id === "restore-c1"));
assert.deepEqual([...turnEnds([...[item({ id: "a1", role: "assistant", text: "first" })], blank], false)], [["a1", null]]);
});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.