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

Permissions in 0.2.7

  • 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

views/styles.tsx6.5 KB
// Shared template metrics and tones preserve the existing chat surface.
// Chat disables embedded HTML formatting: template spaces become real UI nodes.
import * as kit from "divergence";
import type { ComboMark, Workspace } from "divergence";
import type { AnchorProps } from "../state.ts";
// The reading column at its widest, its 8 px sides included: lines of 835 px.
export const READING_WIDTH = 851;
export const FIELD_INSET_X = 10;
export const PILL_INSET_X = 5;
export const column = { display: "flex", flexDirection: "column" } as const;
export const row = { display: "flex", flexDirection: "row", alignItems: "center" } as const;
export const fill = { flexGrow: 1, flexShrink: 1, flexBasis: "0%", minWidth: 0, minHeight: 0 } as const;
export const full = { width: "100%", height: "100%" } as const;
export const HOVER = { background: "hover" } as const;
export const clickable = { group: "hover" } as const;
export const revealOnHover = { visibility: "hidden", groupHover: { group: "hover", visibility: "visible" } } as const;
export const centred = { width: "100%", marginX: "auto" } as const;
export const BORDER = { width: 1, color: "border" } as const;
// The width of the edge the kernel draws for `elevation` ("edge" or
// "raised"), inside the box.
export const EDGE_WIDTH = 0.75;
// The shared surface looks from the runtime; an older runtime without them
// gets the same `elevation`, which its kernel already draws.
export const RAISED = kit.RAISED ?? { elevation: "raised" };
export const EDGED = kit.EDGED ?? { elevation: "edge" };
export const FLAT = kit.FLAT ?? { elevation: "none" };
// The runtime with the shared looks ships with a kernel that resolves every
// corner name, `field` and named image corners included; an older one gets
// the default theme's pixels.
export const corner = (name: "field" | "xl", pixels: number) => (kit.RAISED ? name : pixels);
// The corner of a box around an inner corner `gap` inside its edge: the two
// share a centre.
export const around = (inner: number, gap: number) => inner + gap + EDGE_WIDTH;
export const TINT: Record<string, string> = {
  foreground: "foreground",
  muted: "mutedForeground",
  faint: "faint",
  primary: "primary",
  info: "info",
  success: "success",
  warning: "warning",
  danger: "danger",
};
export const tint = (tone: string | undefined) => TINT[tone ?? "muted"];
export const ROW_TEXT = { size: "xs", weight: 560, lineHeight: 14.6 } as const;
export const TOOL_ICONS = {
  read: "file-text",
  edit: "file-pen-line",
  delete: "delete",
  move: "arrow-right",
  search: "search",
  execute: "square-terminal",
  think: "brain",
  fetch: "globe",
  task: "layout-dashboard",
  switch_mode: "toggle-left",
  other: "cpu",
};
export const TOOL_LABELS = {
  read: "Read",
  edit: "Edit",
  delete: "Delete",
  move: "Move",
  search: "Search",
  execute: "Run",
  think: "Think",
  fetch: "Fetch",
  task: "Task",
  switch_mode: "Mode",
  other: "",
};
export const CARD_SPACE = 8;
export const PHASE_MARK = {
  done: { icon: "circle-check", tone: "success" },
  failed: { icon: "circle-x", tone: "danger" },
  waiting: { icon: "circle-pause", tone: "warning" },
  queued: { icon: "circle-dashed", tone: "muted" },
  pending: { icon: "circle-dashed", tone: "faint" },
  stopped: { icon: "circle-stop", tone: "muted" },
};
export const AGENT_MARK = {
  completed: { icon: "circle-check", tone: "success" },
  idle: { icon: "circle-check", tone: "success" },
  failed: { icon: "circle-x", tone: "danger" },
  waiting: { icon: "circle-pause", tone: "warning" },
  queued: { icon: "circle-dashed", tone: "faint" },
  cancelled: { icon: "circle-stop", tone: "muted" },
};
// A workspace's mark: its project icon, else the icon the app gives it
// (the Divergence logo on the Plugins workspace), else a folder in its colour; the coloured folder
// too when the user chose it over the icon.
export const markOf = (w: Workspace | undefined): ComboMark => {
  if (w?.icon && !w.useColor) return { image: w.icon };
  if (w?.mark && !w.useColor) return { icon: w.mark };
  return w?.color ? { icon: "folder-solid", color: w.color } : { icon: "folder" };
};
export const markIcon = (mark: ComboMark, size: number, small = false) =>
  mark.image
    ? <image path={mark.image} width={size} height={size} radius={3} />
    : <icon name={mark.icon ?? "folder"} color={mark.color} small={small} tone="muted" />;
// The triggers of the workspace picker; the kernel's combobox around them
// opens the list on the press.
export const headlineAnchor =
  (headline: { fontSize: string; bold: boolean }) =>
  ({ name, mark, can }: AnchorProps) =>
    (
      <div {...row} {...can ? clickable : null} gap={6} padding="small" paddingX={6} paddingLeft={5} paddingY={2} borderRadius="md" hover={can ? HOVER : undefined}>
        {markIcon(mark, 20)}
        <text style="body" {...headline}>{name}</text>
        {can ? <icon name="chevron-down" small tone="muted" /> : null}
      </div>
    );
/** The height of every control at the right of the title strip. */
export const TITLE_CONTROL = 30;
export const chipAnchor = ({ name, mark, can }: AnchorProps, small = true) =>
  (
    <div {...row} {...can ? clickable : null} gap={5} padding="small" paddingX={8} paddingY={2} height={small ? undefined : TITLE_CONTROL} maxWidth={220} background="subtle" borderRadius={11} hover={can ? HOVER : undefined}>
      {markIcon(mark, small ? 12 : 14, small)}
      <text style="body" size="xs" tone="muted" truncate>{name}</text>
      {can ? <icon name="chevron-down" small={small} tone="faint" /> : null}
    </div>
  );
export const titleChipAnchor = (props: AnchorProps) => chipAnchor(props, false);
/** The workspace in the title strip's lead, after the sidebar toggle: its mark centred in a title control's square, and
 * its name after it while the room the kernel gives the lead holds more than the mark. The name's box clips its
 * padding with it, so with no room the control is just the square. */
export const leadAnchor = ({ name, mark, can }: AnchorProps) => (
  <div {...row} {...(can ? clickable : null)} height={TITLE_CONTROL} minWidth={TITLE_CONTROL} flexShrink={1} borderRadius="md" hover={can ? HOVER : undefined} tooltip={can ? `${name}: move this draft to another workspace` : name}>
    <div {...row} justifyContent="center" width={TITLE_CONTROL} height={TITLE_CONTROL} flexShrink={0}>{markIcon(mark, 16)}</div>
    <div {...row} minWidth={0} flexShrink={1} overflow="hidden">
      <div {...row} minWidth={0} paddingRight={8}><text style="body" size="sm" weight={500} tone="muted" truncate>{name}</text></div>
    </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.