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

image-attachments.test.ts3.3 KB
import assert from "node:assert/strict";
import test from "node:test";
import * as Effect from "effect/Effect";
import type { ChatView } from "./controller.ts";
import type { ContentBlock } from "divergence";
import { reconcileOutgoing } from "./data.ts";
import { InputLedger, withController } from "./testing.ts";
import { nodes } from "./ui-for-tests.test.ts";
import { renderTranscript } from "./views/rows.tsx";

const stored: ContentBlock = {
  type: "image", mimeType: "image/png", data: "", path: "/data/images/picture.png", width: 20, height: 20,
};
const inline: ContentBlock = { type: "image", mimeType: "image/png", data: "persisted-image-bytes" };
const attachment = { id: "attached", name: "image.png", mimeType: "image/png", bytes: 100, width: 20, height: 20 };

for (const [name, blocks, paths] of [
  ["stored image", [stored], ["/data/images/picture.png"]],
  ["multiple stored images", [stored, { ...stored, path: "/data/images/second.png" }], ["/data/images/picture.png", "/data/images/second.png"]],
  ["older inline image", [inline], [undefined]],
  ["inline image without stored dimensions", [{ ...stored, width: undefined, data: "persisted-image-bytes" }], [undefined]],
  ["mixed stored and inline images", [stored, inline], [undefined, "/data/images/picture.png"]],
  ["stored image that also has inline bytes", [{ ...stored, data: "persisted-image-bytes" }], ["/data/images/picture.png"]],
] as const) {
  test(`acknowledging a prompt renders each ${name} once`, async () => {
    await withController(new InputLedger(), (c) =>
      Effect.gen(function* () {
        const chat = c.state.chats.c1;
        const transcript = c.transcript(chat.id);
        transcript.snapshot = { kind: "ready" };
        c.composer(chat.id).outgoing = {
          id: "picture",
          text: "Inspect these images",
          attachments: blocks.map((_, index) => ({ ...attachment, id: `attached-${index}` })),
          preview: true,
        };
        const view: ChatView = {
          controller: c,
          ctx: { state: {}, set: () => {}, app: { route: "chat", chatId: chat.id }, plugin: "chat", update() {}, run() {} },
        };
        const pictures = () => nodes(renderTranscript(view, chat)).filter((node) => node.type === "image");
        assert.equal(pictures().length, blocks.length);
        transcript.items = [{
          id: "picture", role: "user", blocks: [{ type: "text", text: "Inspect these images" }, ...blocks],
        }];
        reconcileOutgoing(c, chat.id);
        assert.equal(c.composer(chat.id).outgoing, undefined);
        assert.equal(c.state.itemImages.picture, undefined, "preview handles never become transcript sources");
        for (let read = 0; read < 2; read++) {
          yield* c.loadImages(chat.id);
          yield* Effect.yieldNow;
          assert.equal(pictures().length, blocks.length);
          assert.deepEqual(pictures().map((node) => node.path), paths);
          assert.ok(pictures().every((node) => node.path || node.id === "restored-image"));
        }
        // Reopening the pane also selects exactly one source for each image.
        delete c.state.itemImages.picture;
        yield* c.loadImages(chat.id);
        yield* Effect.yieldNow;
        assert.equal(pictures().length, blocks.length);
        assert.deepEqual(pictures().map((node) => node.path), paths);
      }),
    );
  });
}

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.