Official

palette

Built-in command palette (⌘⇧P) and chat search (⌘P).

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/palette@0.2.4

Permissions in 0.2.4

  • Run other plugins' commands commands.runHighRuns commands of other plugins.Run the command you pick, whichever plugin it belongs to
  • Read chats chats.readMediumReads your transcripts and chat lists.Search your chats by title and workspace, and open the one you pick
  • Show panels ui.slotsAlways grantedShows views in the listed parts of the window.Hold the palette, which opens over the windowSlots: title

Files

chats.ts3.2 KB
// The chat search's chats: read when the plugin starts and again when the
// workspaces change (an import adds chats that way, and a removed workspace
// takes its chats away), and kept current by
// the chat events in between, so the search opens at once and lists what
// the host has now. Each chat's row shows its status, title, when it was
// last active and its workspace. A chat whose task the user checked off
// shows a check, as in the sidebar, so the tasks are read and followed too.
import * as Effect from "effect/Effect";
import type { Chat, Task } from "divergence";
import { App, Host } from "divergence/effect";
import type { Row } from "./controller.ts";
import { rankChats } from "./model.ts";
import { chatMarkOf } from "../sdk/ui/chat-row.ts";
import { PaletteState } from "./state.ts";
import { workspaceMarkOf } from "../sdk/ui/workspace.ts";

export const chats = Effect.fn("Palette.chats")(function* () {
  const state = yield* PaletteState;
  const host = yield* Host;
  const app = yield* App;
  const update = () => {
    state.chatsRevision++;
    if (state.open) state.view?.update();
  };
  // A chat whose event came while the read was on its way keeps the
  // event's copy unless the read's is newer.
  const load = Effect.fn("Palette.loadChats")(function* () {
    const [chats, workspaces, tasks] = yield* Effect.all(
      [host.call("host/chats.list", {}), host.call("host/workspaces.list", {}), host.call("host/tasks.list", {})],
      { concurrency: "unbounded" },
    );
    state.done = new Set(tasks.tasks.filter((task) => task.completedAt).map((task) => task.id));
    for (const chat of chats.chats) {
      const known = state.chats.get(chat.id);
      if (!known || known.updatedAt < chat.updatedAt) state.chats.set(chat.id, chat);
    }
    state.workspaces = Object.fromEntries(workspaces.workspaces.map((workspace) => [workspace.id, workspace]));
    // Removing a workspace deletes its chats with it, and the host reports
    // only the workspaces' change: they go here.
    for (const [id, chat] of state.chats) if (!state.workspaces[chat.workspaceId]) state.chats.delete(id);
    state.chatsLoaded = true;
    update();
  });
  const changed = (chat: Chat) => {
    state.chats.set(chat.id, chat);
    update();
  };
  const removed = (chatId: string) => {
    state.chats.delete(chatId);
    update();
  };
  const taskChanged = (task: Task) => {
    if (task.completedAt) state.done.add(task.id);
    else state.done.delete(task.id);
    update();
  };
  const taskRemoved = (taskId: string) => {
    state.done.delete(taskId);
    update();
  };
  const rows = (query: string): Row[] =>
    rankChats([...state.chats.values()], state.workspaces, query).map(({ chat, positions }) => {
      const workspace = state.workspaces[chat.workspaceId];
      return {
        kind: "chat",
        id: chat.id,
        title: chat.title || "New Chat",
        positions,
        key: null,
        detail: workspace?.name ?? "",
        chat: { status: chatMarkOf(chat, !!chat.task && state.done.has(chat.task)), updatedAt: chat.updatedAt, workspace: workspaceMarkOf(workspace) },
        run: app.select(chat.id, chat.workspaceId),
      };
    });
  return { load, changed, removed, taskChanged, taskRemoved, rows };
});

Versions

VersionPublishedPlugin APISizePermissionsStatus
0.2.5latestNov 21, 2026>=5 <618.4 KB3 permissionsListed
0.2.4Nov 16, 2026>=5 <618.1 KB3 permissionsListed
0.2.3Nov 11, 2026>=5 <613.5 KB3 permissionsListed
0.2.2Nov 9, 2026>=5 <611.5 KB3 permissionsListed
0.2.1Oct 27, 2026>=2 <411.4 KB3 permissionsListed

Reviews and comments

0 threads · 0 reviews

No comments yet.