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

Permissions in 0.2.7

  • 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

title.test.ts6.4 KB
// Regression coverage for title using the real chat modules.
// Fixtures exercise the same behavior and assertions as the JavaScript tests.
import assert from "node:assert/strict";
import test from "node:test";
import * as Effect from "effect/Effect";
import { send } from "./composer.ts";
import { refreshHistory, syncDraftTitle } from "./data.ts";
import { InputLedger, withController } from "./testing.ts";
import { draftTitle } from "./title.ts";
import { renderTitle } from "./views/title.tsx";
import { chat, harness, nodes } from "./ui-for-tests.test.ts";

test("a draft is named like the host names a chat from its first prompt", () => {
  assert.equal(draftTitle("\n  Fix the bug\nmore"), "Fix the bug");
  assert.equal(draftTitle("   \n "), null);
  assert.equal(draftTitle(""), null);
  const long = draftTitle("x".repeat(100));
  assert.ok(long);
  assert.equal([...long].length, 61);
  assert.ok(long.endsWith("…"));
  assert.equal(draftTitle("é".repeat(60)), "é".repeat(60));
  assert.equal(draftTitle("\n\n"), null);
  assert.equal(draftTitle("a\n"), "a");
  assert.equal(draftTitle(`\n \n  first  \n${"later line\n".repeat(10_000)}`), "first");
});

test("the first prompt's title remains visible while delivery waits for the host title", async () => {
  const ledger = new InputLedger();
  await withController(ledger, (c) =>
    Effect.gen(function* () {
      const chat = (c.state.chats.c1 = { ...c.state.chats.c1, sessionId: undefined });
      c.transcript("c1").snapshot = { kind: "ready" };
      c.composer("c1").text = "Keep this submitted title";
      yield* syncDraftTitle(c, "c1");
      assert.equal(c.titleOf(chat), "Keep this submitted title");
      const observed: string[] = [];
      ledger.beforeEnqueue = async () => {
        observed.push(c.titleOf(chat));
        c.composer("c1").text = "A later draft must not rename this chat";
        await Effect.runPromise(syncDraftTitle(c, "c1"));
      };
      ledger.afterClaim = async () => {
        observed.push(c.titleOf(chat));
      };
      yield* send(c, "c1");
      assert.deepEqual(observed, ["Keep this submitted title", "Keep this submitted title"]);
      yield* syncDraftTitle(c, "c1");
      assert.equal(c.titleOf(chat), "Keep this submitted title", "no New Chat flash after delivery");
      c.state.chats.c1 = { ...chat, title: "Title supplied by the provider" };
      yield* syncDraftTitle(c, "c1");
      assert.equal(c.titleOf(c.state.chats.c1), "Title supplied by the provider", "host title replaces the fallback");
    }),
  );
});

test("clearing an unsent draft still restores New Chat", async () => {
  await withController(new InputLedger(), (c) =>
    Effect.gen(function* () {
      c.composer("c1").text = "Unsent temporary title";
      yield* syncDraftTitle(c, "c1");
      assert.equal(c.titleOf(c.state.chats.c1), "Unsent temporary title");
      c.composer("c1").text = "";
      yield* syncDraftTitle(c, "c1");
      assert.equal(c.titleOf(c.state.chats.c1), "New Chat");
    }),
  );
});

test("the first history sync of a chat with no composer yet ends with its composer loaded", async () => {
  const ledger = new InputLedger();
  await withController(ledger, (c) =>
    Effect.gen(function* () {
      // As at launch: the history read starts before the pane made a composer.
      delete c.state.composers.c1;
      yield* refreshHistory(c, "c1");
      for (let tries = 0; c.composer("c1").loading && tries < 100; tries++) yield* Effect.sleep(5);
      assert.equal(c.composer("c1").syncing, false);
      assert.equal(c.composer("c1").loading, false, "its options were loaded");
    }),
  );
});

test("a chat at work says Working beside its title", () => {
  const h = harness();
  h.controller.state.chats.c = chat({ status: "running" });
  const words = () =>
    nodes(renderTitle({ ...h.v, ctx: { ...h.v.ctx, app: { route: "chat", chatId: "c" } } }))
      .filter((node) => node.type === "text")
      .map((node) => node.text);
  assert.ok(words().includes("Working…"));
  assert.ok(!words().includes("Running…"));
  h.controller.state.chats.c = chat({ status: "waiting_question" });
  assert.ok(words().includes("Working…"), "a chat waiting on the user is still in its run");
  h.controller.state.chats.c = chat({ status: "idle" });
  assert.ok(!words().includes("Working…"));
});

test("a double click on the title opens the rename field, which saves through the same rename", async () => {
  const h = harness();
  h.controller.state.chats.c = chat({ title: "Parser fix" });
  const v = { ...h.v, ctx: { ...h.v.ctx, app: { route: "chat" as const, chatId: "c" } } };
  const title = nodes(renderTitle(v)).find((node) => node.id === "title-c");
  assert.equal(title?.stopPropagation, true, "the double click does not reach the strip, which would zoom the window");
  (title?.onDoubleClick as () => void)();
  await h.settle();
  assert.deepEqual(h.controller.state.renaming, { chatId: "c", text: "Parser fix" });
  assert.deepEqual(h.focused, ["title-rename-c"]);
  const field = nodes(renderTitle(v)).find((node) => node.id === "title-rename-c");
  assert.equal(field?.value, "Parser fix");
  (field?.onSubmit as (event: { value: string }) => void)({ value: "  Parser rewrite " });
  await h.settle();
  assert.deepEqual(
    h.calls.filter((call) => call.method === "host/chats.update"),
    [{ method: "host/chats.update", params: { chatId: "c", title: "Parser rewrite" } }],
  );
  assert.equal(h.controller.state.renaming, null);
});

test("the chat's workspace leads the title strip, after the sidebar toggle", async () => {
  const { renderTaskTitle } = await import("./views/layout.tsx");
  const h = harness();
  h.controller.state.chats.c = chat({ sessionId: "s" });
  h.controller.state.workspaces.w = { id: "w", name: "nexus", path: "/p/nexus" } as never;
  const task = {
    id: "t",
    layout: { root: { kind: "pane" as const, id: "p", tabs: [{ kind: "chat" as const, chatId: "c" }], active: { kind: "chat" as const, chatId: "c" } }, focused: "p" },
    createdAt: "",
    updatedAt: "",
  };
  const all = nodes(renderTaskTitle(h.v, task, null, "c", false));
  const lead = all.filter((node) => node.alignTo === "title-lead");
  assert.equal(lead.length, 1, "one lead, laid out by the kernel in the room before the panes");
  const inLead = nodes(lead[0]);
  assert.ok(inLead.some((node) => node.type === "text" && node.text === "nexus"), "the name follows the mark while there is room");
  assert.ok(inLead.some((node) => node.tooltip === "nexus"), "the name is the tooltip when only the mark fits");
});

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.