Official

sidebar

Built-in sidebar 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/sidebar@0.2.4

Permissions in 0.2.4

  • Control chats chats.controlHighCreates chats, sends prompts and cancels runs.Add and remove workspaces, and create, rename, check off and archive chats
  • Run other plugins' commands commands.runHighRuns commands of other plugins.Close the tab on screen with Cmd+W when its chat is part of a task
  • Read chats chats.readMediumReads your transcripts and chat lists.List workspaces and chats, and follow them as agents work
  • Show panels ui.slotsAlways grantedShows views in the listed parts of the window.Draw the sidebarSlots: left

Files

archive.test.ts11.6 KB
// Archiving a row and bringing it back with the notice's Undo, against the
// fake host in testing.ts.
import assert from "node:assert/strict";
import { afterEach, mock, test } from "node:test";
import activate from "./main.ts";
import { UNDO_MS } from "./archive.ts";
import { chatTab, fakeHost, type Pane } from "./testing.ts";

afterEach(() => mock.timers.reset());

const day = (n: number) => `2026-10-0${n}T00:00:00.000Z`;

test("an archived chat is offered back, and Undo puts it back where it was", async () => {
  const fake = fakeHost([
    { id: "c1", title: "First", at: day(3) },
    { id: "c2", title: "Second", at: day(2) },
    { id: "c3", title: "Third", at: day(1) },
  ]);
  const dispose = activate(fake.api);
  try {
    await fake.settle();
    assert.deepEqual(fake.list(), ["heading-open", "row-c1", "row-c2", "row-c3"]);
    assert.equal(fake.node("undo-archive"), undefined, "no notice before anything is archived");
    fake.action("row-c2", "Archive");
    await fake.settle();
    assert.deepEqual(fake.list(), ["heading-open", "row-c1", "row-c3"]);
    assert.equal(fake.node("undo-archive")?.label, "Archived “Second”");
    fake.click("undo-archive-button");
    await fake.settle();
    assert.deepEqual(fake.calls.at(-1), { method: "host/chats.update", params: { chatId: "c2", archived: false } });
    // Coming back made it the newest chat; it takes its old place all the same.
    assert.deepEqual(fake.list(), ["heading-open", "row-c1", "row-c2", "row-c3"]);
    assert.equal(fake.node("undo-archive"), undefined, "Undo takes the notice away");
  } finally {
    await dispose();
  }
});

test("a checked-off row comes back checked off, in its place in Complete", async () => {
  const fake = fakeHost([
    { id: "c1", title: "Open", at: day(3) },
    { id: "c2", title: "Done later", at: day(2), done: day(5) },
    { id: "c3", title: "Done first", at: day(1), done: day(4) },
  ]);
  const dispose = activate(fake.api);
  try {
    await fake.settle();
    assert.deepEqual(fake.list(), ["heading-open", "row-c1", "heading-settled", "row-c2", "row-c3"]);
    fake.action("row-c3", "Archive");
    await fake.settle();
    fake.click("undo-archive-button");
    await fake.settle();
    assert.deepEqual(fake.calls.at(-1), { method: "host/chats.update", params: { chatId: "c3", archived: false, completed: true } });
    assert.deepEqual(fake.list(), ["heading-open", "row-c1", "heading-settled", "row-c2", "row-c3"]);
  } finally {
    await dispose();
  }
});

test("a pinned chat comes back pinned", async () => {
  const fake = fakeHost([
    { id: "c1", title: "First", at: day(3) },
    { id: "c2", title: "Second", at: day(2) },
  ]);
  const dispose = activate(fake.api);
  try {
    await fake.settle();
    fake.action("row-c2", "Pin");
    await fake.settle();
    assert.deepEqual(fake.list(), ["heading-pinned", "row-c2", "heading-open", "row-c1"]);
    fake.action("row-c2", "Archive");
    await fake.settle();
    assert.deepEqual(fake.list(), ["heading-open", "row-c1"], "archiving forgets the pin");
    fake.click("undo-archive-button");
    await fake.settle();
    assert.deepEqual(fake.list(), ["heading-pinned", "row-c2", "heading-open", "row-c1"]);
  } finally {
    await dispose();
  }
});

test("a task row comes back whole, named as it was", async () => {
  const fake = fakeHost(
    [
      { id: "a", title: "Plan", at: day(3) },
      { id: "b", title: "Build", at: day(2) },
      { id: "c", title: "Other", at: day(1) },
    ],
    [{ id: "t-ab", chats: ["a", "b"], title: "Release" }],
  );
  const dispose = activate(fake.api);
  try {
    await fake.settle();
    assert.deepEqual(fake.list(), ["heading-open", "row-a", "row-c"]);
    fake.action("row-a", "Archive");
    await fake.settle();
    assert.deepEqual(fake.list(), ["heading-open", "row-c"]);
    assert.equal(fake.node("undo-archive")?.label, "Archived “Release”");
    fake.click("undo-archive-button");
    await fake.settle();
    const task = [...fake.tasks.values()].find((t) => (t.layout.root as Pane).tabs.length === 2)!;
    assert.deepEqual((task.layout.root as Pane).tabs, [chatTab("a"), chatTab("b")]);
    assert.equal(task.title, "Release");
    assert.deepEqual(fake.list(), ["heading-open", "row-a", "row-c"]);
    assert.equal(fake.node("row-a")?.label, "Release");
  } finally {
    await dispose();
  }
});

test("a chat archived out of a task goes back to its tab's place there", async () => {
  const fake = fakeHost(
    [
      { id: "a", title: "Plan", at: day(3) },
      { id: "b", title: "Build", at: day(2) },
      { id: "c", title: "Ship", at: day(1) },
    ],
    [{ id: "t-abc", chats: ["a", "b", "c"], title: "Release" }],
  );
  // With the task on screen its chats are listed under its row.
  fake.update({ chatId: "a", workspaceId: "w1" });
  const dispose = activate(fake.api);
  try {
    await fake.settle();
    assert.deepEqual(fake.list(), ["heading-open", "row-a", "child-a", "child-b", "child-c"]);
    fake.action("child-b", "Archive");
    await fake.settle();
    assert.deepEqual(fake.list(), ["heading-open", "row-a", "child-a", "child-c"]);
    assert.equal(fake.node("undo-archive")?.label, "Archived “Build”");
    fake.click("undo-archive-button");
    await fake.settle();
    assert.deepEqual(fake.calls.at(-1), {
      method: "host/layouts.place",
      params: { tab: chatTab("b"), target: { kind: "strip", paneId: "pane-t-abc", index: 1 }, onScreen: "t-abc" },
    });
    assert.deepEqual((fake.tasks.get("t-abc")!.layout.root as Pane).tabs, [chatTab("a"), chatTab("b"), chatTab("c")]);
    assert.deepEqual(fake.list(), ["heading-open", "row-a", "child-a", "child-b", "child-c"]);
  } finally {
    await dispose();
  }
});

/// A chat left its task only by closing its tab, which sent it to Complete, or by a drag into the
/// list; each chat listed under a task offers it in its menu, and only there.
test("a chat listed under its task separates into a row of its own from its menu", async () => {
  const fake = fakeHost(
    [
      { id: "a", title: "Plan", at: day(3) },
      { id: "b", title: "Build", at: day(2) },
      { id: "c", title: "Ship", at: day(1) },
    ],
    [{ id: "t-abc", chats: ["a", "b", "c"], title: "Release" }],
  );
  fake.update({ chatId: "a", workspaceId: "w1" });
  const dispose = activate(fake.api);
  try {
    await fake.settle();
    const actions = fake.node("child-b")?.actions as { tooltip: string }[];
    assert.deepEqual(actions.map((a) => a.tooltip), ["Rename", "Archive"], "separating is not a hover action");
    fake.click("child-b", "onSecondaryClick");
    await fake.settle();
    (fake.node("row-menu")?.onChange as (e: { value: string }) => void)({ value: "row-menu-separate" });
    await fake.settle();
    assert.deepEqual(fake.calls.at(-1), {
      method: "host/layouts.place",
      params: { tab: chatTab("b"), target: { kind: "alone" }, onScreen: "t-abc" },
    });
    assert.deepEqual(fake.list(), ["heading-open", "row-a", "child-a", "child-c", "row-b"]);
  } finally {
    await dispose();
  }
});

/// A chat's tab carried from the title strip is a chat like a child row: let go in the list it
/// leaves its task. The pane it came from never tells the sidebar the drag ended, so the list's
/// part of it ends when the pointer leaves the list.
test("a chat's tab dragged into the list becomes a row of its own", async () => {
  const fake = fakeHost(
    [
      { id: "a", title: "Plan", at: day(3) },
      { id: "b", title: "Build", at: day(2) },
      { id: "c", title: "Solo", at: day(1) },
    ],
    [{ id: "t-ab", chats: ["a", "b"], title: "Release" }],
  );
  fake.update({ chatId: "a", workspaceId: "w1" });
  const dispose = activate(fake.api);
  try {
    await fake.settle();
    const carried = (chatId: string, zone: string | null) => ({ type: "divergence/chat", data: { chatId }, zone });
    fake.listDrop().onOver(carried("c", "inside"));
    fake.listDrop().onOver(carried("c", null));
    await fake.settle();
    fake.listDrop().onOver(carried("a", "inside"));
    fake.listDrop().onDrop(carried("a", "inside"));
    await fake.settle();
    assert.deepEqual(fake.calls.at(-1), {
      method: "host/layouts.place",
      params: { tab: chatTab("a"), target: { kind: "alone" }, onScreen: "t-ab" },
    });
    assert.deepEqual(fake.list(), ["heading-open", "row-a", "row-b", "row-c"]);
  } finally {
    await dispose();
  }
});

/// Checking off belongs to a task's row, so a chat listed under it checks off by leaving it for
/// Complete, as closing its tab does. A draft under the task has nothing to check off.
test("a started chat listed under its task checks off on its own into Complete", async () => {
  const fake = fakeHost(
    [
      { id: "a", title: "Plan", at: day(3) },
      { id: "b", title: "Build", at: day(2) },
      { id: "c", title: "Ship", at: day(1) },
    ],
    [{ id: "t-abc", chats: ["a", "b", "c"], title: "Release" }],
  );
  fake.update({ chatId: "a", workspaceId: "w1" });
  const dispose = activate(fake.api);
  try {
    await fake.settle();
    fake.click("glyph-child-b");
    await fake.settle();
    assert.deepEqual(fake.calls.at(-1), { method: "host/layouts.close_tab", params: { tab: chatTab("b") } });
    assert.deepEqual(fake.list(), ["heading-open", "row-a", "child-a", "child-c", "heading-settled", "row-b"]);
  } finally {
    await dispose();
  }
});

test("the notice holds while the pointer is on it, adds what is archived next, and goes when its time is up", async () => {
  const fake = fakeHost([
    { id: "c1", title: "First", at: day(3) },
    { id: "c2", title: "Second", at: day(2) },
    { id: "c3", title: "Third", at: day(1) },
  ]);
  const dispose = activate(fake.api);
  try {
    await fake.settle();
    fake.action("row-c2", "Archive");
    await fake.settle();
    fake.action("row-c3", "Archive");
    await fake.settle();
    assert.equal(fake.node("undo-archive")?.label, "Archived 2 chats");
    fake.click("undo-archive", "onPointerEnter");
    mock.timers.tick(UNDO_MS * 2);
    await fake.settle();
    assert.ok(fake.node("undo-archive"), "the pointer on the notice holds it");
    fake.click("undo-archive", "onPointerLeave");
    mock.timers.tick(UNDO_MS);
    await fake.settle();
    assert.equal(fake.node("undo-archive"), undefined, "the notice goes once its time is up");
    assert.deepEqual(fake.list(), ["heading-open", "row-c1"], "and the chats stay archived");
  } finally {
    await dispose();
  }
});

test("Undo brings back every row the notice offers, and says which could not come back", async () => {
  const fake = fakeHost([
    { id: "c1", title: "First", at: day(3) },
    { id: "c2", title: "Second", at: day(2) },
  ]);
  const dispose = activate(fake.api);
  try {
    await fake.settle();
    fake.action("row-c1", "Archive");
    await fake.settle();
    fake.action("row-c2", "Archive");
    await fake.settle();
    fake.fail("host/chats.update", "the store is locked");
    fake.click("undo-archive-button");
    await fake.settle();
    assert.deepEqual(fake.notices, [
      "Could not restore “First”: the store is locked",
      "Could not restore “Second”: the store is locked",
    ]);
    assert.deepEqual(fake.list(), []);
  } finally {
    await dispose();
  }
});

test("a chat that could not be archived is not offered back", async () => {
  const fake = fakeHost([{ id: "c1", title: "First", at: day(3) }]);
  const dispose = activate(fake.api);
  try {
    await fake.settle();
    fake.fail("host/chats.update", "the store is locked");
    fake.action("row-c1", "Archive");
    await fake.settle();
    assert.deepEqual(fake.notices, ["Could not archive the chat: the store is locked"]);
    assert.equal(fake.node("undo-archive"), undefined);
    assert.deepEqual(fake.list(), ["heading-open", "row-c1"]);
  } finally {
    await dispose();
  }
});

Versions

VersionPublishedPlugin APISizePermissionsStatus
0.2.7latestNov 21, 2026>=5 <6100.9 KB4 permissionsListed
0.2.6Nov 16, 2026>=5 <6100.6 KB4 permissionsListed
0.2.5Nov 11, 2026>=5 <665.1 KB4 permissionsListed
0.2.4Nov 9, 2026>=5 <660.4 KB4 permissionsListed
0.2.3Oct 27, 2026>=2 <426.1 KB3 permissionsListed

Reviews and comments

0 threads · 0 reviews

No comments yet.