Official

settings

Built-in settings 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/settings@0.2.6

Permissions in 0.2.6

  • Manage plugins plugins.manageOfficial onlyReloads and enables plugins. Only official plugins can have it.List, enable, disable and reload plugins, install updates, and quit to finish an update
  • Change app settings settings.writeHighChanges the app settings.Change the settings and the theme
  • Manage agents agents.manageHighEnables, disables and signs in agents, and changes their settings.Turn agents on and off, sign in to them and update them
  • Control chats chats.controlHighCreates chats, sends prompts and cancels runs.Add project folders, and open the first chat and the changes saved in the first-run guide
  • Read chats chats.readMediumReads your transcripts and chat lists.Hold an agent's update until its chats stop running
  • Read app settings settings.readLowReads the app settings.Show the settings, and the tools and rules of every plugin
  • Show panels ui.slotsAlways grantedShows views in the listed parts of the window.Draw settings, its list of sections in the sidebar's place, and the first-run guideSlots: centerleft

Files

views/agents.tsx9.2 KB
// The Agents section: every agent the host serves, with its account state,
// plan usage and one-click updates. Registry agents collapse behind one row.
// HTM whitespace is significant; keep these templates out of Prettier's HTML formatter.
import type * as Effect from "effect/Effect";
import type { EffectViewContext } from "divergence/effect";
import type { AgentEntry, PageError, SettingsPage } from "../controller.ts";
import type { Job } from "../upkeep.ts";
import { TITLE_LINE, besideTitle, card, limit, listRow, section, setting, column, fill, row } from "./layout.tsx";

type AgentActions = {
  state: { agents: readonly AgentEntry[]; showRegistry: boolean; pending?: string | null };
  setAgentEnabled(agent: AgentEntry, enabled: boolean): Effect.Effect<unknown, PageError>;
  signIn(agent: AgentEntry, method: { readonly id: string }): Effect.Effect<unknown, PageError>;
  updateAgent(agent: AgentEntry): Effect.Effect<unknown, PageError>;
  /// Settings' updates are the update row's jobs; onboarding runs its own.
  upkeep?: { readonly state: { readonly jobs: Readonly<Record<string, Job>> } };
};

// An older host leaves the settings out; it runs 20 agent processes and
// stops an idle one after 10 minutes. `null` is no limit.
const DEFAULT_PROCESS_LIMIT = 20;
const DEFAULT_IDLE_MINUTES = 10;

// How much of the account's plan is used, once it is worth saying.
function usageRow(a: AgentEntry) {
  const windows = a.usageLimits?.windows ?? [];
  if (!a.enabled || !windows.length) return null;
  const shown = windows.filter((w) => w.usedPercent >= 1 || w.blocked);
  if (!shown.length) return null;
  return (
    <div {...row} gap="medium" padding="small" flexWrap="wrap">
      {shown.map((w) => {
                const tone = w.blocked ? "danger" : w.usedPercent >= 90 ? "warning" : "muted";
                const resets = w.resetsAt
                  ? ` · resets ${new Date(w.resetsAt).toLocaleString([], { month: "short", day: "numeric", hour: "numeric", minute: "2-digit" })}`
                  : "";
                return <text style="body" size="xs" tone={tone}>{`${w.label} ${Math.round(w.usedPercent)}%${resets}`}</text>;
              })}
    </div>
  );
}

const behind = (a: AgentEntry) =>
  Boolean(a.enabled && a.maintenance?.latestVersion && a.maintenance.latestVersion !== a.maintenance.installedVersion);

// The version, and a one-click upgrade only when the installer that owns
// the binary could be proven. Anything else stays manual.
function maintenanceNote(a: AgentEntry, job: Job | undefined) {
  const m = a.maintenance;
  if (!m || !behind(a)) return null;
  if (job?.state === "waiting") return <text style="body" size="xs" tone="muted">{`Updates when ${a.name} is idle.`}</text>;
  const how = m.canUpdate ? "" : " Update it the way you installed it.";
  return <text style="body" size="xs" tone="warning">{`${m.latestVersion} is available.${how}`}</text>;
}

function maintenanceAction(ctx: EffectViewContext<object>, actions: AgentActions, a: AgentEntry, job: Job | undefined) {
  const m = a.maintenance;
  if (!m?.canUpdate || !behind(a)) return null;
  const updating = actions.state.pending === `update:${a.id}` || job?.state === "updating";
  return <button id={`update-${a.id}`} label={`Update with ${m.manager}`} small variant="outline" disabled={Boolean(actions.state.pending) || updating || job?.state === "waiting"} loading={updating} onClick={() => ctx.run(actions.updateAgent(a))} />;
}

function agentRow(ctx: EffectViewContext<object>, actions: AgentActions, a: AgentEntry) {
  const status = a.status?.state;
  const job = actions.upkeep?.state.jobs[a.id];
  const badge =
    status === "ready"
      ? <badge variant="success">Ready</badge>
      : status === "starting" && a.enabled
        ? <badge>Checking…</badge>
      : status === "auth_required" && a.enabled
        ? <badge variant="warning">Sign in needed</badge>
        : a.enabled
          ? <badge variant="danger">Unavailable</badge>
          : null;
  const statusMessage = a.status !== undefined && "message" in a.status ? a.status.message : null;
  const detail = status !== "ready" && a.enabled && statusMessage ? statusMessage : a.description;
  const methods = a.authMethods ?? [];
  const actions$ = [
    ...(a.enabled && status !== "ready" && status !== "starting" && methods.length
      ? methods.map(
          (m) =>
            <button id={`auth-${a.id}-${m.id}`} label={m.name} small variant="primary" disabled={Boolean(actions.state.pending)} loading={actions.state.pending === `auth:${a.id}`} onClick={() => ctx.run(actions.signIn(a, m))} />,
        )
      : []),
    maintenanceAction(ctx, actions, a, job),
  ].filter(Boolean);
  // One left edge under the title, the switch centred on the title line.
  return listRow(
    besideTitle(
      <switch id={`agent-${a.id}`} label="" checked={a.enabled} disabled={Boolean(actions.state.pending)} onChange={(e: { value: boolean }) => ctx.run(actions.setAgentEnabled(a, e.value))} />,
      36,
    ),
    (
      <div {...column} {...fill} gap={4}>
        <div {...row} gap="small" height={TITLE_LINE}>
              <icon name="bot" small tone="muted" svg={a.icon} />
              <text style="body" size="sm" bold>{a.name}</text>
              {a.version ? <text style="body" size="xs" tone="faint">{a.version}</text> : null}
              <spacer />
              {badge}
            </div>
        {detail ? <text style="body" size="xs" tone="muted">{detail}</text> : null}
        {usageRow(a)}
        {maintenanceNote(a, job)}
        {actions$.length ? <div {...row} gap="small" flexWrap="wrap">{actions$}</div> : null}
      </div>
    ),
  );
}

export function renderAgents(ctx: EffectViewContext<object>, actions: SettingsPage["Service"]) {
  const settings = actions.state.data.settings;
  return (
    <div {...column} gap="large" padding="small">
      {section(
                "Processes",
                null,
                card([
                  setting({
                    title: "Agent processes",
                    description: "Past this many running at once, the least recently used idle agent stops. A chat that is working is never stopped.",
                    control: limit(
                      "agent-process-limit",
                      settings?.agentProcessLimit === undefined ? DEFAULT_PROCESS_LIMIT : settings.agentProcessLimit,
                      [5, 10, 20, 40],
                      (count) => `${count} processes`,
                      "No limit",
                      (value) => ctx.run(actions.updateSettings({ agentProcessLimit: value })),
                    ),
                  }),
                  setting({
                    title: "Stop idle agents after",
                    description: "An idle agent stops after this time and resumes when its chat is shown or sent to.",
                    control: limit(
                      "agent-idle-minutes",
                      settings?.agentIdleMinutes === undefined ? DEFAULT_IDLE_MINUTES : settings.agentIdleMinutes,
                      [5, 10, 30, 60],
                      (minutes) => `${minutes} minutes`,
                      "Never",
                      (value) => ctx.run(actions.updateSettings({ agentIdleMinutes: value })),
                    ),
                  }),
                ]),
              )}
      {renderAgentChoices(ctx, actions)}
    </div>
  );
}

// Whether an agent came from an agent registry, as its provider says.
export function fromRegistry(agent: AgentEntry): boolean {
  return agent.registry === true;
}

// The agent list, with live sign-in and installation status.
export function renderAgentChoices(ctx: EffectViewContext<object>, actions: AgentActions) {
  const state = actions.state;
  const direct = state.agents.filter((a) => !fromRegistry(a));
  const registry = state.agents.filter(fromRegistry);
  const enabledRegistry = registry.filter((a) => a.enabled);
  const others = registry.filter((a) => !a.enabled);
  return (
    <div {...column} gap="large">
      {section("Your agents", "Enabled agents appear in the chat picker.", card(direct.map((a) => agentRow(ctx, actions, a))))}
      {registry.length
                  ? section(
                      "More agents",
                      "Connect another coding agent using its own account.",
                      (
                        <div {...column} gap="small">
                          {enabledRegistry.length ? card(enabledRegistry.map((a) => agentRow(ctx, actions, a))) : null}
                          {others.length
                            ? (
                              <div {...row}>
                                <button id="registry-agents" label={state.showRegistry ? `Hide the other ${others.length}` : `Show the other ${others.length}`} icon={state.showRegistry ? "chevron-down" : "chevron-right"} small variant="ghost" onClick={() => {
                                    state.showRegistry = !state.showRegistry;
                                    ctx.update();
                                  }} />
                              </div>
                            )
                            : null}
                          {state.showRegistry && others.length ? card(others.map((a) => agentRow(ctx, actions, a))) : null}
                        </div>
                      ),
                    )
                  : null}
    </div>
  );
}

Versions

VersionPublishedPlugin APISizePermissionsStatus
0.2.8latestNov 21, 2026>=5 <668.5 KB7 permissionsListed
0.2.7Nov 18, 2026>=5 <668 KB7 permissionsListed
0.2.6Nov 16, 2026>=5 <666.3 KB7 permissionsListed
0.2.5Nov 11, 2026>=5 <663.6 KB7 permissionsListed
0.2.4Nov 9, 2026>=5 <661.6 KB7 permissionsListed
0.2.3Oct 27, 2026>=2 <446.8 KB7 permissionsListed

Reviews and comments

0 threads · 0 reviews

No comments yet.