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

Permissions in 0.2.7

  • 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

window.test.ts5.8 KB
// The window of a long transcript: which entries it draws and how it moves.
import assert from "node:assert/strict";
import test from "node:test";

import type { FoldEntry } from "./grouping.ts";
import type { Transcript } from "./state.ts";
import { entryId, LONG, SIDE, STEP, moveWindow, noteWindows, shownRange, windowRequests, windows } from "./window.ts";
import type { Unsent } from "./window.ts";

const entries = (count: number, from = 0): FoldEntry[] =>
  Array.from({ length: count }, (_, i) => ({ kind: "item", item: { id: `e${from + i}`, role: "assistant", text: "" } }) as FoldEntry);
const transcript = () => ({}) as Transcript;

test("without a kernel that draws windows every entry is drawn", () => {
  assert.equal(windows(), false);
  assert.deepEqual(shownRange(transcript(), entries(5000), entryId), [0, 5000]);
  assert.equal(noteWindows(), true, "the first report says so");
  assert.equal(noteWindows(), false);
});

test("a short transcript is drawn whole, a long one from its end", () => {
  noteWindows();
  assert.deepEqual(shownRange(transcript(), entries(LONG), entryId), [0, LONG]);
  const [lo, hi] = shownRange(transcript(), entries(5000), entryId);
  assert.equal(hi, 5000);
  assert.ok(5000 - lo < LONG, "only the rows around the end");
});

test("the window follows the reader up a few entries at a time and keeps ahead", () => {
  noteWindows();
  const t = transcript();
  const all = entries(5000);
  let [lo, hi] = shownRange(t, all, entryId);
  // The reader scrolls up: the kernel reports the top each time it comes
  // within its margin of the first entry sent.
  for (let first = hi - 40; first > 3000; first -= 25) {
    if (first - lo >= 150) continue;
    moveWindow(t, all, first, entryId);
    const [next, nextHi] = shownRange(t, all, entryId);
    assert.ok(first - next >= 150 || lo - next === 30, "the window gets a margin ahead of the reader");
    assert.ok(lo - next <= 30, "a few entries at a time");
    assert.ok(nextHi <= first + 40 + SIDE, "the entries far below go");
    [lo, hi] = [next, nextHi];
  }
  assert.ok(lo < 3000 && lo > 2700, `the window is around the reader: ${lo}`);
  assert.ok(hi < 5000, "it left the end");
});

test("a reader faster than the window is caught up over a few trees", () => {
  noteWindows();
  const t = transcript();
  const all = entries(5000);
  moveWindow(t, all, 4900, entryId);
  for (let i = 0; i < 20; i++) moveWindow(t, all, 4900, entryId);
  // A hundred entries up before the next report: the kernel reports again
  // after each tree while the top is near the first entry sent.
  let trees = 0;
  for (let [lo] = shownRange(t, all, entryId); 4800 - lo < 150; [lo] = shownRange(t, all, entryId)) {
    moveWindow(t, all, 4800, entryId);
    trees++;
  }
  assert.ok(trees <= 4, `caught up in ${trees} trees`);
});

test("a jump far away starts at the screen and grows toward its sides", () => {
  noteWindows();
  const t = transcript();
  const all = entries(5000);
  moveWindow(t, all, 1000, entryId);
  const [lo, hi] = shownRange(t, all, entryId);
  assert.ok(lo <= 1000 && hi >= 1040, "the screen is drawn");
  assert.ok(hi - lo <= 40 + 2 * STEP, "and little more at first");
  for (let i = 0; i < 30; i++) moveWindow(t, all, 1000, entryId);
  assert.deepEqual(shownRange(t, all, entryId), [1000 - SIDE, 1040 + SIDE], "then the whole window, a step at a time");
});

test("older entries put before the window keep it on the same entries", () => {
  noteWindows();
  const t = transcript();
  let all = entries(5000, 3000);
  for (let i = 0; i < 30; i++) moveWindow(t, all, 1000, entryId);
  const before = shownRange(t, all, entryId).map((i) => all[i]!);
  all = [...entries(3000), ...all];
  const [lo, hi] = shownRange(t, all, entryId);
  assert.equal(all[lo], before[0], "the same first entry");
  assert.equal(all[hi], before[1], "and the same end");
});

test("a window at the end takes the entries that come", () => {
  noteWindows();
  const t = transcript();
  const all = entries(5000);
  moveWindow(t, all, 4990, entryId);
  const grown = [...all, ...entries(10, 5000)];
  assert.equal(shownRange(t, grown, entryId)[1], 5010);
});

test("requests outside the window are counted with the rows it leaves out", () => {
  const all = entries(1000);
  const unsent: Unsent = { before: 0, after: 0, end: true };
  const requests = [{ afterItemId: "e10" }, { afterItemId: "e500" }, { afterItemId: "e900" }, {}];
  const drawn = windowRequests(all, [400, 600], requests, unsent);
  assert.deepEqual(drawn, [{ afterItemId: "e500" }]);
  assert.deepEqual(unsent, { before: 401, after: 400 + 2, end: false });
  const end: Unsent = { before: 0, after: 0, end: true };
  assert.deepEqual(windowRequests(all, [800, 1000], requests, end), [{ afterItemId: "e900" }, {}], "the end draws the last request");
  assert.deepEqual(end, { before: 802, after: 0, end: true });
});

test("each keyed list has independent anchors and resetting a short list preserves the others", () => {
  noteWindows();
  const t = transcript(), all = entries(5000);
  const items = Array.from({ length: 5000 }, (_, i) => ({ id: `item${i}` }));
  const id = (item: { id: string }) => item.id;
  for (let i = 0; i < 30; i++) {
    moveWindow(t, all, 1000, entryId);
    moveWindow(t, items, 2000, id, "parent");
    moveWindow(t, items, 3000, id, "nested");
  }
  const outer = shownRange(t, all, entryId), parent = shownRange(t, items, id, "parent"), nested = shownRange(t, items, id, "nested");
  assert.deepEqual(parent, [1800, 2240]);
  assert.deepEqual(nested, [2800, 3240]);
  assert.deepEqual(shownRange(t, items.map((item) => ({ ...item })), id, "parent"), parent);
  assert.deepEqual(shownRange(t, items.slice(0, LONG), id, "parent"), [0, LONG]);
  assert.deepEqual(shownRange(t, all, entryId), outer);
  assert.deepEqual(shownRange(t, items, id, "nested"), nested);
  assert.deepEqual(shownRange(t, items, id, "parent"), [4760, 5000], "only the short list lost its old anchors");
});

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.