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

Permissions in 0.2.5

  • 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

complete-footer.test.ts4.5 KB
// Complete is pinned at the foot of the chat list: its heading, its three
// most recently completed chats and "Show more" float over the list's
// bottom in the scroller's footer. Shown whole, its chats end the list and
// scroll with it, and only "Show less" stays pinned.
import assert from "node:assert/strict";
import { test } from "node:test";
import type { AppState, Chat } from "divergence";
import type { EffectViewContext } from "divergence/effect";
import type { Sidebar } from "./controller.ts";
import { initialState, noteTask } from "./sections.ts";
import { renderSidebar } from "./views.tsx";

type Node = { type?: string; id?: string; name?: string; background?: string; backdrop?: unknown; onClick?: () => void; children?: Node[]; items?: Node[] };

const chat = (id: string, minute: number): Chat => ({
  id,
  workspaceId: "ws",
  agentId: "agent",
  title: id,
  sessionId: "s",
  createdAt: "2026-01-01T00:00:00.000Z",
  updatedAt: `2026-01-02T00:${String(minute).padStart(2, "0")}:00.000Z`,
  archived: false,
  options: {},
  status: "idle",
});

function setup() {
  const state = initialState();
  state.loaded = true;
  const done = Array.from({ length: 5 }, (_, i) => chat(`done-${i}`, i));
  state.chats = [chat("open-a", 30), chat("open-b", 31), ...done];
  // Completed one minute apart, done-4 last.
  done.forEach((c, i) =>
    noteTask(state, {
      id: c.id,
      layout: { root: { kind: "pane", id: `pane-${c.id}`, tabs: [{ kind: "chat", chatId: c.id }], active: { kind: "chat", chatId: c.id } }, focused: `pane-${c.id}` },
      completedAt: `2026-01-03T00:0${i}:00.000Z`,
      createdAt: c.createdAt,
      updatedAt: c.updatedAt,
    }),
  );
  const app: AppState = { route: "chat", chatId: "open-a" };
  const ctx = { app, state: {}, plugin: "sidebar", update() {}, run() {} } as unknown as EffectViewContext<{ cmd?: boolean }>;
  const list = () => {
    const find = (node: Node | null | undefined): Node | undefined => {
      if (!node) return undefined;
      if (node.type === "scroller") return node;
      for (const child of node.children ?? []) {
        const found = find(child);
        if (found) return found;
      }
      return undefined;
    };
    const scroller = find(renderSidebar(ctx, { state, ensurePreview() {} } as unknown as Sidebar["Service"]) as unknown as Node)!;
    const items = scroller.items ?? [];
    const last = items.at(-1);
    const pinned = last?.type === "slot" && last.name === "footer" ? last : undefined;
    return { items: pinned ? items.slice(0, -1) : items, pinned };
  };
  return { state, list };
}

const ids = (nodes: readonly Node[]) => nodes.map((node) => node.id);

test("collapsed, Complete's heading, its three latest chats and Show more are pinned at the foot of the list", () => {
  const { list } = setup();
  const { items, pinned } = list();
  assert.ok(pinned, "the scroller has a footer");
  const box = pinned.children![0]!;
  assert.equal(box.background, undefined, "no fill, so no box shows over the bare ground");
  assert.deepEqual(box.backdrop, { blur: 20 }, "only a blur, which takes the rows passing under it out of the way");
  assert.deepEqual(ids(box.children!), ["heading-settled", "row-done-4", "row-done-3", "row-done-2", "more-settled"]);
  assert.ok(!ids(items).some((id) => id === "heading-settled" || id?.startsWith("row-done-")), "Complete is not among the list's items");
  assert.deepEqual(ids(items).filter((id) => id?.startsWith("row-")), ["row-open-b", "row-open-a"]);
});

test("Show more puts every Complete chat at the end of the list, with Show less pinned, and Show less brings the page back", () => {
  const { state, list } = setup();
  list().pinned!.children![0]!.children!.find((node) => node.id === "more-settled")!.onClick!();
  assert.equal(state.showAll.settled, true);
  const { items, pinned } = list();
  assert.deepEqual(ids(items).slice(-6), ["heading-settled", "row-done-4", "row-done-3", "row-done-2", "row-done-1", "row-done-0"]);
  const less = pinned!.children![0]!.children!;
  assert.deepEqual(ids(less), ["less-settled"]);
  less[0]!.onClick!();
  assert.equal(state.showAll.settled, false);
  assert.deepEqual(ids(list().pinned!.children![0]!.children!).at(-1), "more-settled");
});

test("a folded Complete pins its heading alone, and without completed chats there is no footer", () => {
  const { state, list } = setup();
  state.collapsed.settled = true;
  assert.deepEqual(ids(list().pinned!.children![0]!.children!), ["heading-settled"]);
  state.collapsed.settled = false;
  state.chats = state.chats.filter((c) => c.id.startsWith("open-"));
  assert.equal(list().pinned, undefined);
});

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.