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.9

Permissions in 0.2.9

  • 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

shortcuts.test.ts7.9 KB
// The keys beside controls are the keys bound now, written as the host
// writes them for the platform, and a command with no key shows none.
import assert from "node:assert/strict";
import test from "node:test";
import * as Effect from "effect/Effect";
import type { ChatView } from "./controller.ts";
import { shortcutsOf } from "./shortcuts.ts";
import { InputLedger, withController } from "./testing.ts";
import { renderCenter, renderPane } from "./views/panes.tsx";
import { renderTitle } from "./views/title.tsx";
import type { Layout } from "divergence/protocol";
import { noteTask } from "./layout.ts";
import { chat, harness, nodes } from "./ui-for-tests.test.ts";

const MAC = [
  { id: "sidebar.newChat", labels: ["⌘N"] },
  { id: "chat.cancel", labels: ["⇧⌘C", "⌃C"] },
  { id: "chat.equalizeSplits", labels: [] },
];
const ELSEWHERE = [
  { id: "sidebar.newChat", labels: ["Ctrl+N"] },
  { id: "chat.cancel", labels: ["Ctrl+Shift+C"] },
];

test("each command's first key is kept as the host wrote it, and its symbols say macOS", () => {
  assert.deepEqual(shortcutsOf(MAC), { keys: { "sidebar.newChat": "⌘N", "chat.cancel": "⇧⌘C" }, mac: true });
  assert.deepEqual(shortcutsOf(ELSEWHERE), {
    keys: { "sidebar.newChat": "Ctrl+N", "chat.cancel": "Ctrl+Shift+C" },
    mac: false,
  });
});

test("the title's New chat and the composer's buttons name the keys bound now", async () => {
  await withController(new InputLedger(), (c) =>
    Effect.sync(() => {
      const view: ChatView = {
        controller: c,
        ctx: { state: {}, set: () => {}, app: { route: "chat", chatId: "c1" }, plugin: "chat", update() {}, run() {} },
      };
      const tooltip = (all: ReturnType<typeof nodes>, id: string) => all.find((node) => node.id === id)?.tooltip;
      c.state.shortcuts = shortcutsOf(MAC);
      assert.equal(tooltip(nodes(renderTitle(view)), "title-new-chat"), "New chat (⌘N)");
      assert.equal(tooltip(nodes(renderPane(view, "c1")), "send-c1"), "Send (↩)");
      c.state.chats.c1 = { ...c.state.chats.c1!, status: "running" };
      assert.equal(
        tooltip(nodes(renderPane(view, "c1")), "stop-c1"),
        "Stop the run and pause the queued prompts (⇧⌘C)",
      );
      c.state.shortcuts = shortcutsOf(ELSEWHERE);
      assert.equal(
        tooltip(nodes(renderPane(view, "c1")), "stop-c1"),
        "Stop the run and pause the queued prompts (Ctrl+Shift+C)",
      );
      c.state.chats.c1 = { ...c.state.chats.c1!, status: "idle" };
      c.composer("c1").text = "Next";
      assert.equal(tooltip(nodes(renderPane(view, "c1")), "send-c1"), "Send (Enter)");
      // The user took the key off New chat.
      c.state.shortcuts = shortcutsOf([{ id: "chat.cancel", labels: ["Ctrl+Shift+C"] }]);
      assert.equal(tooltip(nodes(renderTitle(view)), "title-new-chat"), "New chat");
    }),
  );
});

test("with no chat selected the center offers New chat with its key", async () => {
  const h = harness();
  const center = () => nodes(renderCenter({ ...h.v, ctx: { ...h.v.ctx, app: { route: "chat" } } }));
  h.controller.state.shortcuts = shortcutsOf(MAC);
  const all = center();
  assert.ok(all.some((node) => node.id === "center-empty"));
  assert.ok(all.some((node) => node.type === "text" && node.style === "heading" && node.text === "No chat open"));
  assert.ok(all.some((node) => node.type === "text" && node.keys === true && node.text === "⌘N"));
  const action = all.find((node) => node.id === "center-new-chat");
  assert.equal(action?.label, "New chat");
  action?.onClick();
  await h.settle();
  assert.deepEqual(
    h.calls.filter((call) => call.method === "run_command"),
    [{ method: "run_command", params: { id: "sidebar.newChat" } }],
    "it runs the same command as the key",
  );
  h.controller.state.shortcuts = shortcutsOf([]);
  assert.ok(!center().some((node) => node.type === "text" && node.keys === true), "no key, no key caps");
  await h.close();
});

test("a task's strips and a tab's menu name the keys bound now", async () => {
  const h = harness();
  const tabOf = (chatId: string) => ({ kind: "chat" as const, chatId });
  const pane = (id: string, ...chats: string[]): Layout => ({ kind: "pane", id, tabs: chats.map(tabOf), active: tabOf(chats[0]!) });
  const root: Layout = {
    kind: "split",
    id: "s1",
    direction: "row",
    children: [
      { share: 0.5, layout: pane("p1", "a", "a2") },
      { share: 0.5, layout: pane("p2", "b") },
    ],
  };
  noteTask(h.controller.state.layouts, { id: "t", layout: { root, focused: "p1" }, createdAt: "", updatedAt: "" });
  for (const id of ["a", "a2", "b"]) h.controller.state.chats[id] = chat({ id });
  h.controller.state.shortcuts = shortcutsOf([
    { id: "chat.newTab", labels: ["⌘T"] },
    { id: "chat.splitRight", labels: ["⌘D"] },
    { id: "chat.splitDown", labels: ["⇧⌘D"] },
    { id: "chat.closeTab", labels: ["⌘W"] },
    { id: "chat.closeOtherTabs", labels: ["⌥⌘W"] },
  ]);
  h.controller.state.layouts.menu = { tab: tabOf("a"), paneId: "p1", at: null, entries: [] };
  const all = nodes(renderTitle({ ...h.v, ctx: { ...h.v.ctx, app: { route: "chat", chatId: "a" } } }));
  const tooltip = (id: string) => all.find((node) => node.id === id)?.tooltip;
  // The + lists what can open in the pane, each with the key bound now; a step with no key bound shows none.
  const plus = all.find((node) => node.id === "strip-new-p1")?.options as { value: string; detail?: string }[];
  assert.deepEqual(
    plus.map((option) => [option.value, option.detail]),
    [
      ["chat", "⌘T"],
      ["terminal", undefined],
      ["changes", undefined],
      ["files", undefined],
      ["chats", undefined],
      ["split-right", "⌘D"],
      ["split-down", "⇧⌘D"],
    ],
  );
  assert.ok(!all.some((node) => typeof node.id === "string" && node.id.startsWith("strip-split")), "the strip has no split buttons");
  assert.equal(tooltip("tab-close-chat-a"), "Close tab (⌘W)");
  const menu = all.find((node) => node.id === "tab-menu")?.options as { value: string; detail?: string }[];
  assert.deepEqual(
    menu.map((option) => [option.value, option.detail]),
    [
      ["close", "⌘W"],
      ["close-others", "⌥⌘W"],
      ["split-right", "⌘D"],
      ["split-down", "⇧⌘D"],
    ],
  );
  await h.settle();
  await h.close();
});

/// Taking a chat out of its task meant closing its tab, which also sent it to Complete, or
/// dragging it into the sidebar's list; the tab's menu says it plainly.
test("a tab's menu separates its chat from a task of several, and only there", async () => {
  const h = harness();
  const tabOf = (chatId: string) => ({ kind: "chat" as const, chatId });
  const task = (...chats: string[]) => ({
    id: "t",
    layout: { root: { kind: "pane" as const, id: "p1", tabs: chats.map(tabOf), active: tabOf(chats[0]!) }, focused: "p1" },
    createdAt: "",
    updatedAt: "",
  });
  const menu = (chatId: string) => {
    h.controller.state.layouts.menu = { tab: tabOf(chatId), paneId: "p1", at: null, entries: [] };
    const all = nodes(renderTitle({ ...h.v, ctx: { ...h.v.ctx, app: { route: "chat", chatId: "c1" } } }));
    return all.find((node) => node.id === "tab-menu") as unknown as { options: { value: string; label: string }[]; onChange: (e: { value: string }) => void };
  };
  for (const id of ["c1", "c2"]) h.controller.state.chats[id] = chat({ id });
  Effect.runSync(h.controller.app.update({ route: "chat", chatId: "c1" }));
  noteTask(h.controller.state.layouts, task("c1", "c2"));
  const options = menu("c2");
  assert.equal(options.options.find((o) => o.value === "separate")?.label, "Separate from Task");
  options.onChange({ value: "separate" });
  await h.settle();
  assert.deepEqual(
    h.calls.filter((call) => call.method === "host/layouts.place").map((call) => call.params),
    [{ tab: tabOf("c2"), target: { kind: "alone" }, onScreen: "t" }],
  );
  noteTask(h.controller.state.layouts, task("c1"));
  assert.ok(!menu("c1").options.some((o) => o.value === "separate"), "a task's last chat has nothing to leave");
  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.