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

Permissions in 0.2.8

  • 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, and its Close Chat and Reopen Closed Chat for Cmd+W and Cmd+Shift+T on a chat's only tab
  • 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

commands.ts6.5 KB
// Commands retain their manifest ids and clear's same-agent, same-workspace behavior.
import * as Effect from "effect/Effect";
import { Commands, Slash } from "divergence/effect";
import type { Controller } from "./controller.ts";
import type { Tab } from "divergence/protocol";
import {
  closeFocusedTab,
  closeOtherTabs,
  equalizeSplits,
  focusedTarget,
  moveAcross,
  newChatIn,
  openTabMenu,
  reopenTab,
  splitPane,
  stepPane,
  showTabAt,
  stepTab,
  taskOnScreen,
  toggleSideSplit,
} from "./layout.ts";
import { startRename } from "./app-commands.ts";

const registerSwitcherCommands = Effect.fn("Chat.registerSwitcherCommands")(function* (c: Controller) {
  const commands = yield* Commands;
  const switchCommand = (delta: number) => (info: { readonly phase?: "press" | "release" | "cancel" }) => {
    if (info.phase === "release") return c.commitSwitcher();
    if (info.phase === "cancel") return Effect.sync(c.closeSwitcher);
    return Effect.sync(() => c.switchBy(delta, info.phase === "press" ? "native" : "overlay"));
  };
  yield* commands.register("chat.switchNext", switchCommand(1), {
    title: "Switch to the previous chat",
    keybinding: "ctrl-tab",
  });
  yield* commands.register("chat.switchPrevious", switchCommand(-1), {
    title: "Switch back through recent chats",
    keybinding: "ctrl-shift-tab",
  });
});

const registerChatCommands = Effect.fn("Chat.registerChatCommands")(function* (c: Controller) {
  const commands = yield* Commands;
  yield* commands.register(
    "chat.cancel",
    Effect.gen(function* () {
      const chatId = c.api.app.state().chatId;
      if (chatId) yield* c.scheduler.stop(chatId);
    }),
    { title: "Stop the current run", keybinding: "cmd-shift-c" },
  );
  yield* commands.register(
    "chat.toggleSession",
    Effect.suspend(() => c.toggleSession()),
    { title: "Show Session", keybinding: "cmd-shift-s" },
  );
});

const registerClearCommand = Effect.fn("Chat.registerClearCommand")(function* (c: Controller) {
  const slash = yield* Slash;
  yield* slash.register({
    name: "clear",
    description: "Start a new chat with the same agent and workspace",
    run: Effect.fn("Chat.clear")(function* (_input, context) {
      const chat = context.chatId ? c.state.chats[context.chatId] : null;
      if (chat) {
        const inUse = [...Object.keys(c.state.draftTitles), ...c.state.chatQueue.map((queued) => queued.chatId)];
        const next = yield* c.host.call("host/chats.create", {
          workspaceId: chat.workspaceId,
          agentId: chat.agentId,
          inUse,
        });
        yield* c.app.select(next.id, chat.workspaceId);
      }
      return { action: "none" };
    }),
  });
});

export const registerEarlyCommands = Effect.fn("Chat.registerCommands")(function* (c: Controller) {
  yield* registerSwitcherCommands(c);
  yield* registerChatCommands(c);
  const commands = yield* Commands;
  // Tabs and splits of the task on screen, acting on its focused pane.
  const inFocusedPane = (run: (paneId: string) => Effect.Effect<void, unknown>) =>
    Effect.suspend(() => {
      const target = focusedTarget(c);
      return target ? run(target.pane.id) : Effect.void;
    });
  yield* commands.register(
    "chat.newTab",
    inFocusedPane((paneId) => newChatIn(c, paneId)),
    { title: "New chat in this task", keybinding: "cmd-t" },
  );
  yield* commands.register(
    "chat.splitRight",
    inFocusedPane((paneId) => splitPane(c, paneId, "right")),
    { title: "Split right", keybinding: "cmd-d" },
  );
  yield* commands.register(
    "chat.splitDown",
    inFocusedPane((paneId) => splitPane(c, paneId, "down")),
    { title: "Split down", keybinding: "cmd-shift-d" },
  );
  yield* commands.register("chat.closeTab", Effect.suspend(() => closeFocusedTab(c)), { title: "Close tab", keybinding: "cmd-w" });
  yield* commands.register(
    "chat.equalizeSplits",
    Effect.suspend(() => equalizeSplits(c)),
    { title: "Equalize splits" },
  );
  // The tab menu's other entries, on the focused pane's tab.
  const onFocused = (run: (paneId: string, tab: Tab) => Effect.Effect<void, unknown>) =>
    Effect.suspend(() => {
      const target = focusedTarget(c);
      return target ? run(target.pane.id, target.pane.active).pipe(Effect.asVoid) : Effect.void;
    });
  yield* commands.register(
    "chat.closeOtherTabs",
    onFocused((paneId, tab) => closeOtherTabs(c, paneId, tab)),
    { title: "Close other tabs", keybinding: "cmd-alt-w" },
  );
  yield* commands.register(
    "chat.moveTab",
    onFocused((paneId, tab) => moveAcross(c, paneId, tab)),
    { title: "Move the tab to or from the side split", keybinding: "cmd-alt-b" },
  );
  yield* commands.register(
    "chat.rename",
    Effect.suspend(() => {
      const chatId = c.api.app.state().chatId;
      return chatId ? startRename(c, chatId) : Effect.void;
    }),
    { title: "Rename the chat", keybinding: "f2" },
  );
  // Shift+F10: the focused pane's active tab opens its menu, as a right-click on it does.
  yield* commands.register(
    "chat.openTabMenu",
    Effect.suspend(() => {
      const target = focusedTarget(c);
      return target ? openTabMenu(c, target.pane.id, target.pane.active) : Effect.void;
    }),
    { title: "Open the tab's menu", keybinding: "shift-f10" },
  );
  yield* commands.register(
    "chat.toggleSideSplit",
    Effect.suspend(() => toggleSideSplit(c)),
    { title: "Show or hide the side split", keybinding: "cmd-shift-b" },
  );
  yield* commands.register(
    "chat.reopenTab",
    Effect.suspend(() => reopenTab(c)),
    { title: "Reopen closed tab", keybinding: "cmd-shift-t" },
  );
  yield* commands.register(
    "chat.nextTab",
    Effect.suspend(() => stepTab(c, 1)),
    { title: "Next tab", keybinding: "cmd-shift-]" },
  );
  yield* commands.register(
    "chat.previousTab",
    Effect.suspend(() => stepTab(c, -1)),
    { title: "Previous tab", keybinding: "cmd-shift-[" },
  );
  for (let n = 1; n <= 9; n++)
    yield* commands.register(
      `chat.showTab${n}`,
      Effect.suspend(() => showTabAt(c, n === 9 ? "last" : n - 1)),
      { title: n === 9 ? "Show the last tab" : `Show tab ${n}`, keybinding: `alt-${n}` },
    );
  for (const [toward, key] of [
    ["left", "left"],
    ["right", "right"],
    ["up", "up"],
    ["down", "down"],
  ] as const)
    yield* commands.register(
      `chat.focus${toward[0]!.toUpperCase()}${toward.slice(1)}`,
      Effect.suspend(() => stepPane(c, toward)),
      {
        title: `Focus the pane ${toward === "up" ? "above" : toward === "down" ? "below" : `to the ${toward}`}`,
        keybinding: `cmd-alt-${key}`,
      },
    );
  yield* registerClearCommand(c);
});

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.