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

pane-drop.test.ts6.1 KB
import assert from "node:assert/strict";
import test from "node:test";
import * as Effect from "effect/Effect";
import type { DragOverEvent, DropEvent } from "divergence";
import type { Task } from "divergence/protocol";
import { noteTask } from "./layout.ts";
import { renderTaskTitle } from "./views/layout.tsx";
import { renderCenterPresentation } from "./views/panes.tsx";
import { chat, harness, nodes } from "./ui-for-tests.test.ts";

test("a pane takes edge drops above its floating composer without intercepting clicks or files", async () => {
  const h = harness();
  h.controller.state.chats.a = chat({ id: "a" });
  h.controller.state.panes.a = { chatId: "a", view: { id: 20, update() {}, remove() {} }, drawn: true, ready: true };
  const tab = { kind: "chat" as const, chatId: "a" };
  noteTask(h.controller.state.layouts, {
    id: "task",
    layout: { root: { kind: "pane", id: "p", tabs: [tab], active: tab }, focused: "p" },
    createdAt: "",
    updatedAt: "",
  });
  const tree = nodes(renderCenterPresentation(h.v, "a"));
  const pane = tree.find((node) => node.id === "task-pane-p")!;
  const surface = pane.children.find((node) => node.id === "pane-drop-p")!;
  assert.ok(surface, "the drop surface is a direct child of its pane");
  assert.equal(pane.drop, undefined, "the occluded ancestor does not own the target");
  const body = pane.children.findIndex((node) => node.type === "view");
  assert.ok(body >= 0, "the retained chat content is present");
  assert.ok(pane.children.indexOf(surface) > body);
  assert.equal(surface.onClick, undefined);
  assert.equal(surface.onPointerDown, undefined);
  const drop = surface.drop as { types: string[]; files?: boolean; onDrop: (event: DropEvent) => void };
  assert.deepEqual(drop.types, ["divergence/chat", "divergence/item"]);
  assert.ok(!drop.files, "external files still belong to the composer");
  (surface.onResize as (size: { width: number; height: number }) => void)({ width: 600, height: 600 });
  drop.onDrop({ type: "divergence/chat", data: { chatId: "cold" }, zone: "bottom" });
  await h.settle();
  assert.deepEqual(h.calls.find((call) => call.method === "host/layouts.place")?.params, {
    tab: { kind: "chat", chatId: "cold" }, target: { kind: "edge", paneId: "p", edge: "bottom" }, onScreen: null,
  });
  await h.close();
});

/** Two panes: a and a2 in the first, b in the second, with a on screen. */
function twoPanes() {
  const h = harness((method) =>
    method === "host/chats.transcript"
      ? Effect.succeed({ items: [], start: 0, pendingApprovals: [], pendingQuestions: [], plan: null, running: false })
      : undefined,
  );
  for (const [index, id] of ["a", "a2", "b"].entries()) {
    h.controller.state.chats[id] = chat({ id });
    h.controller.state.panes[id] = { chatId: id, view: { id: 30 + index, update() {}, remove() {} }, drawn: true, ready: true };
  }
  const tab = (chatId: string) => ({ kind: "chat" as const, chatId });
  const task: Task = {
    id: "task",
    layout: {
      root: {
        kind: "split",
        id: "s",
        direction: "row",
        children: [
          { share: 0.5, layout: { kind: "pane", id: "p1", tabs: [tab("a"), tab("a2")], active: tab("a") } },
          { share: 0.5, layout: { kind: "pane", id: "p2", tabs: [tab("b")], active: tab("b") } },
        ],
      },
      focused: "p1",
    },
    createdAt: "",
    updatedAt: "",
  };
  noteTask(h.controller.state.layouts, task);
  Effect.runSync(h.controller.app.update({ route: "chat", chatId: "a", workspaceId: "w" }));
  const surface = (paneId: string) => {
    const node = nodes(renderCenterPresentation(h.v, "a")).find((n) => n.id === `pane-drop-${paneId}`)!;
    return node.drop as { onOver: (event: DragOverEvent) => void; onDrop: (event: DropEvent) => void };
  };
  const places = () => h.calls.filter((call) => call.method === "host/layouts.place").map((call) => call.params);
  return { h, task, surface, places };
}

test("a tab let go over the slot it opened in another pane's strip lands in that slot", async () => {
  const { h, task, places } = twoPanes();
  const title = nodes(renderTaskTitle(h.v, task, null, "a", false));
  const tabB = title.find((n) => n.id === "tab-chat-b")!;
  const strip = title.find((n) => n.children?.some((child) => child.id === "tab-chat-b"))!;
  const carried = { type: "divergence/chat", data: { chatId: "a2" } };
  (tabB.drop as { onOver: (event: DragOverEvent) => void }).onOver({ ...carried, zone: "before" });
  assert.deepEqual(h.controller.state.layouts.carried?.gap, { paneId: "p2", index: 0 }, "the slot opens before b");
  // The pointer is over the slot now, not over a tab: the strip behind it takes the drop.
  (strip.drop as { onDrop: (event: DropEvent) => void }).onDrop({ ...carried, zone: "into" });
  await h.settle();
  assert.deepEqual(places(), [{ tab: { kind: "chat", chatId: "a2" }, target: { kind: "strip", paneId: "p2", index: 0 }, onScreen: "task" }]);
  assert.equal(h.controller.state.layouts.carried, null);
  await h.close();
});

test("a pane's middle refuses its own tab and its edges its only tab, since neither would move it", async () => {
  const { h, surface, places } = twoPanes();
  surface("p1").onDrop({ type: "divergence/chat", data: { chatId: "a2" }, zone: "center" });
  surface("p2").onDrop({ type: "divergence/chat", data: { chatId: "b" }, zone: "right" });
  await h.settle();
  assert.deepEqual(places(), []);
  surface("p1").onDrop({ type: "divergence/chat", data: { chatId: "a2" }, zone: "right" });
  await h.settle();
  assert.deepEqual(places(), [{ tab: { kind: "chat", chatId: "a2" }, target: { kind: "edge", paneId: "p1", edge: "right" }, onScreen: "task" }], "a pane of two tabs splits off one of them");
  await h.close();
});

test("a chat dropped into another pane is selected there, where the host gives the focus", async () => {
  const { h, surface, places } = twoPanes();
  surface("p2").onDrop({ type: "divergence/chat", data: { chatId: "a2" }, zone: "center" });
  await h.settle();
  assert.deepEqual(places(), [{ tab: { kind: "chat", chatId: "a2" }, target: { kind: "strip", paneId: "p2", index: 1 }, onScreen: "task" }]);
  assert.equal(h.controller.api.app.state().chatId, "a2");
  assert.equal(h.focused.at(-1), "prompt-a2");
  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.