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
quote.test.ts2.7 KB
// A reply to a selection in an agent's message: the selection goes into the
// prompt box as a quote, with separation from existing text and the caret below it.
import assert from "node:assert/strict";
import test from "node:test";
import * as Effect from "effect/Effect";
import { withQuote } from "./composer.ts";
import { renderAssistant } from "./views/rows.tsx";
import { chat, harness, item, nodes } from "./ui-for-tests.test.ts";
test("a quote starts immediately in an empty prompt and separates existing text", () => {
const line = "We can also update the UI to match this change";
assert.equal(withQuote("", line), `> ${line}\n`);
assert.equal(withQuote(" \n ", line), `> ${line}\n`);
assert.equal(withQuote("Thanks.", line), `Thanks.\n\n> ${line}\n`);
// Trailing space and lines typed before it do not widen the gap.
assert.equal(withQuote("Thanks. \n\n\n", line), `Thanks.\n\n> ${line}\n`);
// Every line is quoted, an empty one too, so paragraphs stay one quote.
assert.equal(withQuote("", "First **bold**\n\nSecond"), "> First **bold**\n>\n> Second\n");
});
for (const typed of ["", "Looks good."]) test(`replying to a selection ${typed ? "after existing text" : "in an empty prompt"} fills the prompt box and gives it the keyboard`, async () => {
const h = harness();
const c = chat({ id: "c1" });
h.controller.state.chats.c1 = c;
h.controller.composer("c1").text = typed;
const reply = item({ id: "a1", role: "assistant", text: "We can also update the UI to match this change" });
const markdown = nodes(renderAssistant(h.v, c, reply as Parameters<typeof renderAssistant>[2])).find(
(node) => node.type === "markdown",
);
assert.ok(markdown, "the reply is markdown");
(markdown.onQuote as (event: { text: string }) => void)({ text: "update the UI" });
await h.settle();
assert.equal(h.controller.composer("c1").text, `${typed ? `${typed}\n\n` : ""}> update the UI\n`);
assert.deepEqual(h.focused, ["prompt-c1"]);
await h.close();
});
test("a reply to code in a tab goes to the open chat's prompt box, and needs a chat open", async () => {
const h = harness();
h.controller.state.chats.c1 = chat({ id: "c1" });
h.controller.composer("c1").text = "Why?";
const quote = "`src/a.rs` lines 2–3:\n```rust\nlet a = 1;\nlet b = 2;\n```";
const none = await Effect.runPromise(Effect.flip(h.controller.quoteInOpenChat(quote)));
assert.equal(none._tag, "NoOpenChat");
await Effect.runPromise(h.controller.app.select("c1", "w1"));
await Effect.runPromise(h.controller.quoteInOpenChat(quote));
await h.settle();
assert.equal(
h.controller.composer("c1").text,
"Why?\n\n> `src/a.rs` lines 2–3:\n> ```rust\n> let a = 1;\n> let b = 2;\n> ```\n",
);
assert.deepEqual(h.focused, ["prompt-c1"]);
await h.close();
});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.