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

Permissions in 0.2.5

  • 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

terminal.ts3 KB
// A read-only log view for captured terminal bytes. The shell terminal node
// requires a kernel-owned PTY, so captured output uses monospace ANSI runs.
import { html } from "divergence";
import type { Element } from "divergence";

type Run = { text: string; color?: string; background?: string; bold?: boolean };
const palette = ["faint", "danger", "success", "warning", "info", "primary", "info", "foreground"];
const hex = (n: number) => Math.max(0, Math.min(255, n)).toString(16).padStart(2, "0");
function indexed(n: number): string | undefined {
  if (n < 16) return palette[n % 8];
  if (n >= 232) return `#${hex(8 + (n - 232) * 10).repeat(3)}`;
  const v = n - 16,
    channel = (i: number) => (i ? 55 + i * 40 : 0);
  return `#${[Math.floor(v / 36), Math.floor(v / 6) % 6, v % 6].map((i) => hex(channel(i))).join("")}`;
}
export function ansiLines(output: string): Run[][] {
  const lines: Run[][] = [[]];
  let style: Omit<Run, "text"> = {};
  const tokens = output.match(/\x1b\][\s\S]*?(?:\x07|\x1b\\)|\x1b\[[0-?]*[ -/]*[@-~]|[^\x1b]+/g) ?? [];
  for (const token of tokens) {
    if (token.startsWith("\x1b")) {
      if (!token.startsWith("\x1b[") || !token.endsWith("m")) continue;
      const codes = token.slice(2, -1).split(";").map(Number);
      for (let i = 0; i < codes.length; i++) {
        const c = codes[i]!;
        if (c === 0) style = {};
        else if (c === 1 || c === 22) style.bold = c === 1;
        else if (c === 39) delete style.color;
        else if (c === 49) delete style.background;
        else if ((c >= 30 && c <= 37) || (c >= 90 && c <= 97)) style.color = palette[c % 10];
        else if ((c >= 40 && c <= 47) || (c >= 100 && c <= 107)) style.background = palette[c % 10];
        else if (c === 38 || c === 48) {
          const key = c === 38 ? "color" : "background";
          if (codes[i + 1] === 5 && codes[i + 2] !== undefined) {
            style[key] = indexed(codes[i + 2]!);
            i += 2;
          } else if (codes[i + 1] === 2 && codes[i + 4] !== undefined) {
            style[key] = `#${codes
              .slice(i + 2, i + 5)
              .map(hex)
              .join("")}`;
            i += 4;
          }
        }
      }
      continue;
    }
    for (const piece of token.split(/(\r\n|\n|\r)/)) {
      if (piece === "\n" || piece === "\r\n") lines.push([]);
      else if (piece === "\r") lines[lines.length - 1] = [];
      else if (piece) lines[lines.length - 1]!.push({ text: piece.replace(/\x08/g, ""), ...style });
    }
  }
  return lines;
}
export function terminalOutput(output: string): Element[] {
  return ansiLines(output).map(
    (line) =>
      html`<div flexDirection="row" gap=${0} flexShrink=${0}>${
        line.length
          ? line.map(
              (run) =>
                html`<div background=${run.background} flexShrink=${0}><text style="mono" whiteSpace="nowrap" color=${run.color} bold=${run.bold} text=${run.text} /></div>`,
            )
          : html`<text style="mono" text=${" "} />`
      }</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.