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 convergence/chat@0.2.2
Permissions in 0.2.2
Files
options.test.ts7 KB
// A chat's settings belong to its agent: switching agents never leaves the
// last agent's model in the picker, even when the new one's fail to load,
// and a draft whose agent is gone says so.
import assert from "node:assert/strict";
import test from "node:test";
import * as Effect from "effect/Effect";
import { HostCallFailed } from "convergence/effect";
import type { AgentInfo } from "convergence";
import { loadOptions } from "./data.ts";
import { renderComposer } from "./views/composer.ts";
import { harness, chat, nodes } from "./ui-for-tests.test.ts";
test("a new agent's failed options leave none, not the last agent's", async () => {
const h = harness((method) =>
method === "host/chats.options" ? Effect.fail(new HostCallFailed({ method, code: -32603, message: "no catalog" })) : undefined,
);
h.controller.state.chats.c = chat({ id: "c", agentId: "codex" });
const composer = h.controller.composer("c");
composer.agentId = "codex";
composer.options = [
{ id: "model", name: "Model", kind: "select", category: "model", value: "gpt", choices: [{ value: "gpt", name: "GPT" }] },
];
h.controller.state.chats.c = chat({ id: "c", agentId: "opencode" });
await Effect.runPromise(loadOptions(h.controller, "c"));
assert.deepEqual(composer.options, []);
assert.equal(composer.agentId, "opencode");
assert.ok(h.notices.some((notice) => notice.includes("no catalog")), "the failure is said");
});
test("switching to an agent shows its own last options at once, never another agent's", async () => {
const model = (value: string) => [{ id: "model", name: "Model", kind: "select" as const, category: "model" as const, value, choices: [] }];
let release!: () => void;
const late = new Promise<void>((resolve) => (release = resolve));
const h = harness((method, params) => {
if (method !== "host/chats.options") return undefined;
const { chatId } = params as { chatId: string };
if (chatId === "a") return Effect.succeed({ options: model("gpt") });
if (chatId === "b") return Effect.succeed({ options: model("sonnet") });
return Effect.promise(() => late).pipe(Effect.as({ options: model("gpt-fresh") }));
});
h.controller.state.chats.a = chat({ id: "a", agentId: "codex" });
h.controller.state.chats.b = chat({ id: "b", agentId: "claude" });
await Effect.runPromise(loadOptions(h.controller, "a"));
await Effect.runPromise(loadOptions(h.controller, "b"));
// A Claude draft switches to Codex: Codex's last answer shows while the host reads it.
h.controller.state.chats.c = chat({ id: "c", agentId: "claude" });
const composer = h.controller.composer("c");
composer.agentId = "claude";
composer.options = model("sonnet");
h.controller.state.chats.c = chat({ id: "c", agentId: "codex" });
const loading = Effect.runPromise(loadOptions(h.controller, "c"));
assert.equal(composer.options[0]?.value, "gpt", "Codex's own list, not Claude's");
release();
await loading;
assert.equal(composer.options[0]?.value, "gpt-fresh", "the host's answer replaces it");
// An agent that never answered shows none, not the last agent's.
h.controller.state.chats.c = chat({ id: "c", agentId: "opencode" });
void Effect.runPromise(loadOptions(h.controller, "c"));
assert.deepEqual(composer.options, []);
});
test("a draft whose agent was turned off asks for another", () => {
const empty: Record<string, unknown> = {
"host/chats.options": { options: [] },
"host/chats.commands": { commands: [] },
"host/chats.skills": { skills: [] },
};
const h = harness((method) => (method in empty ? Effect.succeed(empty[method]) : undefined));
const draft = chat({ id: "d", agentId: "gone" });
h.controller.state.chats.d = draft;
h.controller.state.agentList = [{ id: "codex", name: "Codex", capabilities: {} } as AgentInfo];
const picker = nodes(renderComposer(h.v, draft)).find((node) => node.id === "agent-d");
assert.equal(picker?.placeholder, "Choose an agent");
});
test("an agent's options that arrive after a switch to another are dropped", async () => {
let release!: () => void;
const late = new Promise<void>((resolve) => (release = resolve));
const h = harness((method, params) =>
method === "host/chats.options" && (params as { chatId: string }).chatId === "c"
? Effect.promise(() => late).pipe(
Effect.as({ options: [{ id: "model", name: "Model", kind: "select", category: "model", value: "old", choices: [] }] }),
)
: undefined,
);
h.controller.state.chats.c = chat({ id: "c", agentId: "codex" });
const first = Effect.runPromise(loadOptions(h.controller, "c"));
// The user picks another agent before Codex answered.
h.controller.state.chats.c = chat({ id: "c", agentId: "opencode" });
h.controller.composer("c").agentId = "opencode";
h.controller.composer("c").loading = true;
release();
await first;
assert.deepEqual(h.controller.composer("c").options, [], "Codex's model is not OpenCode's");
assert.equal(h.controller.composer("c").loading, true, "OpenCode's own read is still on its way");
});
test("loading options draws the loading state at once and ends it with the answer", async () => {
// The kernel's spinner waits SPINNER_DELAY before it shows, so the plugin
// draws the loading state at once instead of waiting itself.
let release!: () => void;
const late = new Promise<void>((resolve) => (release = resolve));
const h = harness((method) =>
method === "host/chats.options"
? Effect.promise(() => late).pipe(
Effect.as({ options: [{ id: "model", name: "Model", kind: "select", category: "model", value: "a1", choices: [] }] }),
)
: undefined,
);
h.controller.state.chats.c = chat({ id: "c", agentId: "codex" });
const composer = h.controller.composer("c");
const shown: [boolean, number][] = [];
h.controller.view.update = () => void shown.push([composer.loading, composer.options.length]);
const loading = Effect.runPromise(loadOptions(h.controller, "c"));
assert.deepEqual(shown, [[true, 0]], "the loading state is drawn without a wait of the plugin's own");
release();
await loading;
assert.deepEqual(shown.at(-1), [false, 1]);
});
test("commands the agent is slow to list never hold the composer loading", async () => {
let release!: () => void;
const late = new Promise<void>((resolve) => (release = resolve));
const h = harness((method) => {
if (method === "host/chats.options") return Effect.succeed({ options: [] });
if (method === "host/chats.commands")
return Effect.promise(() => late).pipe(Effect.as({ commands: [{ name: "init", description: "" }] }));
return undefined;
});
h.controller.state.chats.c = chat({ id: "c", agentId: "codex" });
const composer = h.controller.composer("c");
await Effect.runPromise(loadOptions(h.controller, "c"));
assert.equal(composer.loading, false, "Send is not blocked while commands wait for the agent");
assert.deepEqual(composer.commands, []);
release();
await new Promise((resolve) => setTimeout(resolve, 20));
assert.equal(composer.commands.length, 1, "commands apply when they arrive");
});Versions
| Version | Published | Plugin API | Size | Permissions | Status |
|---|---|---|---|---|---|
| 0.2.5latest | Nov 21, 2026 | >=2 <4 | 174.6 KB | 5 permissions | Listed |
| 0.2.4 | Oct 25, 2026 | >=2 <4 | 174.2 KB | 5 permissions | Listed |
| 0.2.3 | Oct 24, 2026 | >=2 <4 | 165.4 KB | 5 permissions | Listed |
| 0.2.2 | Oct 23, 2026 | >=2 <4 | 165 KB | 5 permissions | Listed |
| 0.2.1 | Oct 6, 2026 | >=2 <3 | 111.8 KB | 5 permissions | Listed |
| 0.2.0 | Oct 5, 2026 | >=2 <3 | 105.1 KB | 5 permissions | Listed |
No comments yet.