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

message-text.ts2.1 KB
import type { ContentBlock } from "divergence";
import type { Controller } from "./controller.ts";
import { deriveSegments, filePaths, type Known } from "./segments.ts";

/// The commands, skills and agents a chat's messages can name: what the
/// prompt box draws as pills.
export function knownTokens(c: Controller, chatId: string): Known {
  const composer = c.composer(chatId);
  return { mentions: c.api.mentions.list(), skills: composer.skills, commands: c.commandList(composer) };
}

/// The names in `known`, for telling whether a kept row must draw again.
export function knownKey(known: Known): string {
  const names = (list: readonly { name: string }[]) => list.map((entry) => entry.name).join(" ");
  return [names(known.commands), names(known.skills), known.mentions?.map((mention) => mention.token).join(" ") ?? ""].join("\n");
}

const code = (word: string) => (word.includes("`") ? word : `\`${word}\``);
const baseName = (path: string) => path.slice(path.lastIndexOf("/") + 1) || path;

/// A sent message's text as its bubble draws it: the command, skills,
/// agents and files it really named stand out as they did in the prompt
/// box, a file as a link that opens it, while a slash or at sign that named
/// nothing stays as it was typed. A file counts only when the message
/// carries it, and a skill when it went as one.
export function markedMessage(text: string, blocks: readonly ContentBlock[], known: Known): string {
  const paths = filePaths(blocks),
    files = new Set(paths);
  const sent = blocks.flatMap((block) => (block.type === "skill" ? [{ name: block.name }] : []));
  const segments = deriveSegments(text, { ...known, skills: [...known.skills, ...sent] }, paths).filter(
    (segment) => segment.kind !== "file" || files.has(text.slice(segment.start + 1, segment.end)),
  );
  let out = "",
    at = 0;
  for (const segment of segments) {
    const word = text.slice(segment.start, segment.end);
    const path = word.slice(1);
    out += text.slice(at, segment.start) + (segment.kind === "file" ? `[${code(baseName(path))}](<${path}>)` : code(word));
    at = segment.end;
  }
  return out + text.slice(at);
}

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.