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

Permissions in 0.2.6

  • 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

newtab.tsx3.7 KB
// The New tab page: what a strip's + opens, and what the side split shows when
// it is opened with nothing in it. It lists the useful next steps (a chat, a
// terminal, the changes to review, the files, another chat) with their keys;
// picking one that opens a tab takes this tab's place, as a browser's new tab
// gives way to the page it goes to.
import * as Effect from "effect/Effect";
import type { Element } from "divergence";
import type { Pane, Tab } from "divergence/protocol";
import type { Controller, ChatView } from "./controller.ts";
import { closeTab, newChatIn, panesOf, taskOnScreen } from "./layout.ts";
import { errorMessage } from "./data.ts";
import { column, fill, full } from "./views/styles.tsx";

/** The tab kind, as this plugin declares it. */
export const NEW_TAB = "new";

/** One step the page offers: the command whose key it shows, and whether it opens a tab in this one's place. */
interface Step {
  readonly id: string;
  readonly icon: string;
  readonly label: string;
  readonly command: string;
  readonly replaces: boolean;
}

const STEPS: readonly Step[] = [
  { id: "chat", icon: "message-square", label: "New chat", command: "chat.newTab", replaces: true },
  { id: "terminal", icon: "square-terminal", label: "New terminal", command: "terminal.new", replaces: true },
  { id: "changes", icon: "git-branch", label: "Review changes", command: "git.toggle", replaces: false },
  { id: "files", icon: "files", label: "Browse files", command: "files.toggle", replaces: false },
  { id: "chats", icon: "search", label: "Go to a chat", command: "palette.chats", replaces: false },
];

/** Where a New tab page is: its tab and the pane that holds it, in the task on screen or the side split. */
function placeOf(c: Controller, key: string): { tab: Tab; pane: Pane } | null {
  const roots = [taskOnScreen(c)?.layout.root, c.state.layouts.side?.layout?.root];
  for (const root of roots) {
    if (!root) continue;
    for (const pane of panesOf(root)) {
      const tab = pane.tabs.find((t) => t.kind === "item" && t.itemKind.endsWith(`.${NEW_TAB}`) && t.key === key);
      if (tab) return { tab, pane };
    }
  }
  return null;
}

/** Opens a New tab page: in a pane (a strip's +), in a new pane split off one (the side split's
 * split buttons), or in the side split (its toggle with nothing to show). */
export const openNewTab = Effect.fn("Chat.openNewTab")(function* (c: Controller, paneId?: string, split?: "right" | "down") {
  const chatId = c.api.app.state().chatId ?? undefined;
  const where = paneId ? { paneId, ...(split ? { split } : {}) } : "side";
  yield* Effect.tryPromise(() => c.api.layouts.open({ kind: NEW_TAB, key: crypto.randomUUID(), ...(chatId ? { chatId } : {}), where })).pipe(
    Effect.catch((error) => c.notify.error(`Could not open a new tab: ${errorMessage(error)}`)),
  );
});

const take = Effect.fn("Chat.takeNewTabStep")(function* (c: Controller, key: string, step: Step) {
  const place = placeOf(c, key);
  if (step.id === "chat" && place) yield* newChatIn(c, place.pane.id);
  else yield* c.kernel.call("run_command", { id: step.command });
  if (step.replaces && place) yield* closeTab(c, place.tab);
});

export function renderNewTab(v: ChatView, key: string): Element {
  const c = v.controller;
  const keys = c.state.shortcuts.keys;
  return (
    <div {...column} {...fill} {...full} id={`new-tab-${key}`} alignItems="center" justifyContent="center" padding="large">
      <div {...column} gap={2} width="100%" maxWidth={320}>
        {STEPS.map((step) => (
          <item id={`new-tab-${step.id}`} icon={step.icon} label={step.label} onClick={() => v.ctx.run(take(c, key, step))}>
            {keys[step.command] ? <text keys>{keys[step.command]}</text> : null}
          </item>
        ))}
      </div>
    </div>
  );
}

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.