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

peek.ts3.4 KB
// The latest model activity for a chat's live line: the end of the chat,
// read once and only for chats a row actually showed, never the whole
// transcript (an older host without `chats.peek` gives the whole one). Any
// other failure of the peek is shown once, not once per row, and the row
// shows its status until the chat changes and is read again.
import * as Effect from "effect/Effect";
import { Host, Notify } from "divergence/effect";
import type { HostError } from "divergence/effect";
import { createPreview, transcriptPreview } from "./preview.ts";
import type { SidebarState } from "./sections.ts";

const describe = (error: unknown): string => (error instanceof Error && error.message ? error.message : "unknown error");

// A host that does not know a method answers it with JSON-RPC's
// method-not-found code, or, before it had one for host methods, with an
// internal error that names the method as unknown.
export const isUnknownMethod = (error: HostError): boolean =>
  error._tag === "HostCallFailed" && (error.code === -32601 || error.message.startsWith("unknown host method"));

export const makePeek = Effect.fn("Sidebar.peeking")(function* (state: SidebarState, redrawSoon: () => void) {
  const host = yield* Host;
  const notify = yield* Notify;
  let previewNotice = false;
  return Effect.fn("Sidebar.ensurePreview")(function* (chatId: string) {
    const preview = (state.previews[chatId] ??= createPreview());
    if (preview.loading || preview.revision) return;
    preview.loading = true;
    yield* host.call("host/chats.peek", { chatId, limit: 20 }).pipe(
      Effect.catchIf(isUnknownMethod, () => host.call("host/chats.transcript", { chatId })),
      Effect.tap((result) => Effect.gen(function* () {
        // Streaming activity or a reset since this read takes precedence.
        previewNotice = false;
        if (state.previews[chatId] !== preview) return;
        const saved = transcriptPreview(result.items);
        if (!preview.revision) Object.assign(preview, saved, { loading: true });
        else if (!preview.assistantLine) preview.assistantLine = saved.assistantLine;
        redrawSoon();
        // A bounded peek can end in many tool rows. Look further back for the
        // last reply only for a settled chat and only while this read still owns the preview.
        if (preview.assistantLine || result.items.length < 20 || state.chats.find((chat) => chat.id === chatId)?.status === "running") return;
        let before: number | undefined;
        while (state.previews[chatId] === preview) {
          const revision = preview.revision;
          const page = yield* host.call("host/chats.transcript", { chatId, limit: 100, before });
          if (state.previews[chatId] !== preview || preview.revision !== revision) return;
          const line = transcriptPreview(page.items).assistantLine;
          if (line) { preview.assistantLine = line; redrawSoon(); return; }
          if (!page.start) return;
          before = page.start;
        }
      })),
      Effect.catch((error: unknown) => {
        // A reset, a removal or streamed activity since this read began
        // made it moot.
        if (state.previews[chatId] !== preview || preview.revision) return Effect.void;
        preview.failed = true;
        if (previewNotice) return Effect.void;
        previewNotice = true;
        return notify.error(`Chat preview unavailable: ${describe(error)}`);
      }),
    );
  });
});

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.