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
Files
message-text.ts2.3 KB
import type { ContentBlock } from "divergence";
import type { Controller } from "./controller.ts";
import { deriveSegments, filePaths, pillLook, 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}\``);
/// A sent message's text as its bubble draws it: the command, skills,
/// agents and files it really named are pills as they were in the prompt
/// box, a file's 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. The kernel draws a link
/// titled `divergence:pill:<icon>` as a pill; one that does not know the
/// title draws the link.
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 look = pillLook(segment.kind, word, known.mentions);
// Only a file opens: a folder, a command, a skill or an agent has no link.
const link = look.file ? word.slice(1) : "";
out += `${text.slice(at, segment.start)}[${code(look.label)}](<${link}> "divergence:pill:${look.file ? "file" : look.icon}")`;
at = segment.end;
}
return out + text.slice(at);
}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.