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

  • 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
  • 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

terminal.test.ts5.5 KB
import test from "node:test";
import assert from "node:assert/strict";
import * as Effect from "effect/Effect";
import { ansiLines, terminalOutput } from "./terminal.tsx";
import { applyEvent } from "./transcript.ts";
import { openSubagent } from "./panes.ts";
import { renderSubagentPane, renderTask } from "./views/tasks.tsx";
import { chat, harness, nodes, taskEvent } from "./ui-for-tests.test.ts";

test("captured output keeps ANSI colours and whitespace while discarding control sequences", () => {
  assert.deepEqual(ansiLines("\x1b[31;1mred\x1b[0m  plain\n\x1b[38;2;1;2;3mrgb"), [
    [{ text: "red", color: "danger", bold: true }, { text: "  plain" }],
    [{ text: "rgb", color: "#010203" }],
  ]);
  assert.deepEqual(ansiLines("10%\r20%\x1b]0;title\x07\r\nend"), [[{ text: "20%" }], [{ text: "end" }]]);
});

test("opening a terminal opens its tab without reading subagent history", async () => {
  const h = harness(),
    c = chat();
  h.controller.state.chats[c.id] = c;
  const t = h.controller.transcript(c.id);
  t.snapshot = { kind: "ready" };
  applyEvent(
    t,
    taskEvent({
      id: "build",
      kind: "terminal",
      command: "cargo build",
      title: "Build",
      output: "\x1b[32m  done\x1b[0m\n",
      status: "running",
    }),
  );
  await Effect.runPromise(openSubagent(h.controller, c, "build"));
  assert.deepEqual(
    (h.controller.api as unknown as { layouts: { opened: unknown[] } }).layouts.opened,
    [{ kind: "subagent", key: "build", chatId: c.id }],
  );
  assert.equal(
    h.calls.some((call) => call.method === "host/chats.load_task"),
    false,
  );
  const output = nodes(renderSubagentPane(h.v, c.id, "build"));
  assert.ok(output.some((node) => node.text === "$ cargo build"));
  assert.ok(output.some((node) => node.text === "  done" && node.color === "success"));
  // Lines wrap at the pane's edge instead of scrolling sideways one by one.
  assert.ok(!output.some((node) => node.overflowX === "scroll" || node.whiteSpace === "nowrap"));
  applyEvent(t, taskEvent({ id: "build", kind: "terminal", title: "Build", outputDelta: "more\n", status: "running" }));
  assert.ok(nodes(renderSubagentPane(h.v, c.id, "build")).some((node) => node.text === "more"));
  applyEvent(
    t,
    taskEvent({
      id: "build",
      kind: "terminal",
      command: "cargo build",
      title: "Build",
      output: "done\n",
      status: "completed",
    }),
  );
  // Like a terminal, the pane is the command and its output, with no status header.
  const done = nodes(renderSubagentPane(h.v, c.id, "build"));
  assert.ok(done.some((node) => node.text === "done"));
  assert.ok(!done.some((node) => node.text === "Completed" || node.text === "Running"));
  await h.close();
});

test("a line of several styles wraps between its runs; a plain line is one text", () => {
  const [plain, mixed] = terminalOutput("one long plain line\n\x1b[31merror\x1b[0m: details\n");
  assert.equal(plain?.type, "text");
  assert.equal(nodes(mixed)[0]?.flexWrap, "wrap");
  assert.deepEqual(
    nodes(mixed)
      .filter((node) => node.type === "text")
      .map((node) => node.text),
    ["error", ": details"],
  );
});

test("a background command shows the terminal's mark in the chat and reads like a terminal pane in its tab", () => {
  const h = harness(),
    c = chat();
  h.controller.state.chats[c.id] = c;
  const t = h.controller.transcript(c.id);
  t.snapshot = { kind: "ready" };
  applyEvent(t, taskEvent({ id: "serve", kind: "terminal", command: "pnpm dev", title: "Dev server", output: "ready\n", status: "running" }));
  const item = t.items.find((entry) => entry.id === "serve" || (entry as { task?: { id: string } }).task?.id === "serve");
  assert.ok(item, "the command is in the transcript");
  const rowNodes = nodes(renderTask(h.v, c, t, item as never));
  assert.ok(rowNodes.some((node) => node.type === "icon" && node.name === "square-terminal"), "its row has the terminal mark");
  assert.ok(!rowNodes.some((node) => node.type === "icon" && node.name === "bot"), "not the agent's");
  const pane = nodes(renderSubagentPane(h.v, c.id, "serve"));
  const prompt = pane.find((node) => node.text === "$ pnpm dev");
  assert.ok(prompt && prompt.tone === undefined, "the command reads as typed, not as a muted label");
  assert.ok(!pane.some((node) => node.paddingX === "medium"), "the tab keeps a terminal pane's small inset");
});

test("a command left running after the turn keeps the transcript's working row, counted as a command", async () => {
  const { tree } = await import("./ui-for-tests.test.ts");
  const { renderTranscript } = await import("./views/rows.tsx");
  const h = harness(),
    c = chat();
  h.controller.state.chats[c.id] = c;
  const t = h.controller.transcript(c.id);
  t.snapshot = { kind: "ready" };
  applyEvent(t, taskEvent({ id: "serve", kind: "terminal", command: "pnpm dev", title: "Dev server", status: "running" }));
  t.running = false;
  const working = () => nodes(tree(renderTranscript(h.v, c))).find((node) => node.type === "text" && /running|working/.test(String(node.text)))?.text;
  assert.equal(working(), "1 command running", "an older host's transcript is counted by kind");
  assert.equal(nodes(tree(renderTranscript(h.v, { ...c, working: { agents: 1, commands: 2 } }))).some((node) => node.text === "1 agent and 2 commands working"), true, "the host's count wins");
  assert.equal(nodes(tree(renderTranscript(h.v, { ...c, working: { agents: 0, commands: 0 } }))).some((node) => /running|working/.test(String(node.text))), false, "and none means the turn is over");
  await h.close();
});

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.