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