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

  • Control chats chats.controlHighCreates chats, sends prompts and cancels runs.Send prompts, answer agent questions, and create, change, fork, revert, stop and group chats
  • Run other plugins' commands commands.runHighRuns commands of other plugins.Run the sidebar's New chat command from the title bar, and its Close Chat and Reopen Closed Chat for Cmd+W and Cmd+Shift+T on a chat's only tab
  • Read chats chats.readMediumReads your transcripts and chat lists.Show workspaces, tasks, chats and transcripts, and follow them as agents work
  • Read files fs.readMediumReads files in the listed places.Suggest workspace files for @ mentionsPlaces: the open workspace
  • Show panels ui.slotsAlways grantedShows views in the listed parts of the window.Draw the chat grid, the title bar, and the Session panel with its rail buttonSlots: centertitlerailright

Files

messages.test.ts5.4 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, fromSession?: string): TranscriptItem => ({
  id,
  role: "user",
  blocks: [{ type: "text", text }],
  from: "nexus-a1",
  ...(fromSession && { fromSession }),
});
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 from a session that is a chat here names that chat and opens it", async () => {
  const h = harness();
  h.controller.api.toolRenderers = () => [];
  const chats = h.controller.state.chats;
  chats.a = chat({ id: "a", sessionId: "s" });
  chats.b = chat({ id: "b", workspaceId: "w2", sessionId: "s-b", title: "Kernel fix" });
  chats.c = chat({ id: "c", agentId: "other", sessionId: "s-c", title: "Another agent's chat" });
  const t = h.controller.transcript("a");
  t.items = [received("c1", "ping", "s-b"), received("c2", "pong", "s-c")];
  t.snapshot = { kind: "ready" };
  const shown = nodes(renderTranscript(h.v, chats.a));
  assert.ok(shown.some((node) => node.type === "text" && node.text === "From Kernel fix"));
  assert.ok(shown.some((node) => node.type === "text" && node.text === "From nexus-a1"), "another agent's session is not this one's");
  assert.ok(!shown.some((node) => node.id === "from-c2"));
  shown.find((node) => node.id === "from-c1")?.onClick?.();
  await h.settle();
  assert.equal(h.controller.api.app.state().chatId, "b");
  assert.equal(h.controller.api.app.state().workspaceId, "w2");
});

test("a message sent to another session shows what it sent, in the group with the calls around it", () => {
  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"],
  );
});

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

VersionPublishedPlugin APISizePermissionsStatus
0.2.9latestNov 21, 2026>=5 <6349 KB5 permissionsListed
0.2.8Nov 16, 2026>=5 <6348.6 KB5 permissionsListed
0.2.7Nov 11, 2026>=5 <6314.3 KB5 permissionsListed
0.2.6Nov 9, 2026>=5 <6306.2 KB5 permissionsListed
0.2.5Oct 27, 2026>=2 <4178.6 KB5 permissionsListed

Reviews and comments

0 threads · 0 reviews

No comments yet.