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