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

Permissions in 0.2.7

  • 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.Open the chat search from the search button, and 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 sidebar, and its top controls in the title strip after the sidebar toggleSlots: lefttitle

Files

section-order.test.ts7.3 KB
// Moving the sections by their headings: up and down the list, and into
// and out of the dock at its foot, 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 { ARRANGEMENT_KEY, COLLAPSED_KEY, DEFAULT_ARRANGEMENT } from "./sections.ts";
import { fakeHost } from "./testing.ts";

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

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

type Target = { onOver: (e: unknown) => void; onDrop: (e: unknown) => void };

// Two open chats and two checked-off ones: Open in the list, Complete docked.
function setup() {
  const fake = fakeHost([
    { id: "c1", title: "First", at: day(4) },
    { id: "c2", title: "Second", at: day(3) },
    { id: "c3", title: "Done", at: day(2), done: day(5) },
    { id: "c4", title: "Done too", at: day(1), done: day(6) },
  ]);
  // Complete unfolded, so its rows show.
  fake.storage.set(COLLAPSED_KEY, []);
  // The ids the scroller holds: its own rows, and the headings and rows docked in its footer.
  const parts = () => {
    type Node = { id?: string; type?: string; children?: unknown };
    const items = (fake.node("chat-list")?.items ?? []) as Node[];
    const footer = items.at(-1)?.type === "slot" ? items.at(-1)! : undefined;
    const docked = (value: unknown, out: string[] = []): string[] => {
      if (Array.isArray(value)) value.forEach((child) => docked(child, out));
      else if (value && typeof value === "object") {
        const node = value as Node;
        if (node.id && /^(heading|row)-/.test(node.id)) out.push(node.id);
        else docked(node.children, out);
      }
      return out;
    };
    // The selection's fill and the room above a heading are no sections' rows.
    const rows = items.filter((item) => item !== footer && !/^(gap-|chat-selection$)/.test(item.id ?? ""));
    return { list: rows.map((item) => item.id), dock: docked(footer?.children) };
  };
  // A heading carried over a target, as the kernel tells it.
  const heading = (id: string) => fake.node(`section-${id}`)?.drop as Target;
  const carry = (section: string, target: Target, zone: string | null) =>
    target.onOver({ type: SECTION, data: { sectionId: section }, zone });
  const drop = (section: string, target: Target) => target.onDrop({ type: SECTION, data: { sectionId: section }, zone: "before" });
  const end = (section: string) => (fake.node(`section-${section}`)?.drag as { onEnd: () => void }).onEnd();
  return { fake, parts, heading, carry, drop, end };
}

test("a heading carried into the dock docks its section, carried out undocks it, and the order is saved", async () => {
  const { fake, parts, heading, carry, drop } = setup();
  const dispose = activate(fake.api);
  try {
    await fake.settle();
    assert.deepEqual(parts(), { list: ["heading-open", "row-c1", "row-c2"], dock: ["heading-settled", "row-c4", "row-c3"] });
    // Picked up, Complete is its heading alone; over Open's heading's upper half it goes above Open.
    carry("settled", heading("settled"), "before");
    await fake.settle();
    assert.deepEqual(parts().dock, ["heading-settled"]);
    carry("settled", heading("open"), "before");
    await fake.settle();
    assert.deepEqual(parts().list, ["heading-settled", "heading-open", "row-c1", "row-c2"]);
    drop("settled", heading("open"));
    await fake.settle();
    assert.deepEqual(parts().list, ["heading-settled", "row-c4", "row-c3", "heading-open", "row-c1", "row-c2"]);
    assert.equal(fake.node("chat-list")?.items && parts().dock.length, 0, "nothing is docked");
    assert.equal(fake.node("more-settled"), undefined, "two chats need no Show more");
    assert.deepEqual(fake.storage.get(ARRANGEMENT_KEY), { list: ["drafts", "pinned", "queued", "needs-you", "finished", "settled", "open"], dock: ["running", "snoozed"] });
    // Over a row of Open, Complete goes after Open; and over the dock's room it docks again.
    carry("settled", heading("settled"), "before");
    await fake.settle();
    assert.ok(fake.node("dock-area"), "with nothing docked, a carried heading finds room under the list");
    (fake.node("row-c2")?.drop as Target).onOver({ type: SECTION, data: { sectionId: "settled" }, zone: "into" });
    await fake.settle();
    assert.deepEqual(parts().list, ["heading-open", "row-c1", "row-c2", "heading-settled"]);
    carry("settled", fake.node("dock-area")?.drop as Target, "after");
    await fake.settle();
    assert.deepEqual(parts(), { list: ["heading-open", "row-c1", "row-c2"], dock: ["heading-settled"] });
    drop("settled", fake.listDrop());
    await fake.settle();
    assert.deepEqual(parts(), { list: ["heading-open", "row-c1", "row-c2"], dock: ["heading-settled", "row-c4", "row-c3"] });
    assert.deepEqual(fake.storage.get(ARRANGEMENT_KEY), { list: ["drafts", "pinned", "queued", "needs-you", "finished", "open"], dock: ["running", "snoozed", "settled"] });
  } finally {
    await dispose();
  }
});

test("a heading let go off the sidebar leaves the sections where they were and saves nothing", async () => {
  const { fake, parts, heading, carry, end } = setup();
  const dispose = activate(fake.api);
  try {
    await fake.settle();
    carry("open", heading("open"), "after");
    carry("open", heading("settled"), "after");
    await fake.settle();
    assert.deepEqual(parts().dock, ["heading-settled", "row-c4", "row-c3", "heading-open"]);
    fake.listDrop().onOver({ type: SECTION, data: { sectionId: "open" }, zone: null });
    await fake.settle();
    assert.deepEqual(parts().list, ["heading-open"], "the pointer gone, Open is back in its place");
    end("open");
    await fake.settle();
    assert.deepEqual(parts(), { list: ["heading-open", "row-c1", "row-c2"], dock: ["heading-settled", "row-c4", "row-c3"] });
    assert.equal(fake.storage.get(ARRANGEMENT_KEY), undefined);
  } finally {
    await dispose();
  }
});

test("the saved order shows from the first draw after a restart", async () => {
  const fake = fakeHost([
    { id: "c1", title: "Busy", at: day(9) },
    ...[1, 2, 3, 4].map((n) => ({ id: `d${n}`, title: `Done ${n}`, at: day(n), done: day(n + 4) })),
  ]);
  fake.storage.set(ARRANGEMENT_KEY, { list: ["settled", "open", "bogus", "open"], dock: ["running"] });
  fake.storage.set(COLLAPSED_KEY, []);
  // The saved layout answers after the chats, as a slow read would.
  const answer = fake.hold("host/storage.get");
  const dispose = activate(fake.api);
  try {
    await fake.settle();
    answer();
    await fake.settle();
    const c1 = { id: "c1", workspaceId: "w1", agentId: "a", title: "Busy", sessionId: "s", createdAt: day(9), updatedAt: day(9), archived: false, options: {}, status: "running" };
    fake.emit({ event: "chat_changed", chat: c1 } as never);
    await fake.settle();
    assert.deepEqual(fake.list(), ["heading-settled", "row-d4", "row-d3", "row-d2", "row-d1", "heading-running", "row-c1"]);
    // The first list drawn already has Complete above Open, as it was saved, with nothing to glide into place.
    const first = fake.drawn().find((list) => list.length > 0)!;
    assert.ok(first.indexOf("heading-settled") < first.indexOf("heading-open"), `first drawn: ${first.join(", ")}`);
    assert.deepEqual(DEFAULT_ARRANGEMENT.dock, ["running", "snoozed", "settled"], "the default is untouched");
  } 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.