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.9
Permissions in 0.2.9
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
| Version | Published | Plugin API | Size | Permissions | Status |
|---|---|---|---|---|---|
| 0.2.9latest | Nov 21, 2026 | >=5 <6 | 349 KB | 5 permissions | Listed |
| 0.2.8 | Nov 16, 2026 | >=5 <6 | 348.6 KB | 5 permissions | Listed |
| 0.2.7 | Nov 11, 2026 | >=5 <6 | 314.3 KB | 5 permissions | Listed |
| 0.2.6 | Nov 9, 2026 | >=5 <6 | 306.2 KB | 5 permissions | Listed |
| 0.2.5 | Oct 27, 2026 | >=2 <4 | 178.6 KB | 5 permissions | Listed |
No comments yet.