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.3
Permissions in 0.2.3
Files
views/upkeep.ts5.7 KB
// The update row in the sidebar's footer and the list it opens above
// itself on hover. The row is there only while something is behind; each item in
// the list says what changes and what its button does, and the list ends
// with putting everything off until tomorrow or updating it all.
// HTM whitespace is significant; keep these templates out of Prettier's HTML formatter.
import { html as htm } from "divergence";
import * as kit from "divergence";
import type { Element } from "divergence";
import type { EffectViewContext } from "divergence/effect";
import { versionLine } from "../upkeep.ts";
import type { Job, Upkeep, UpdateItem } from "../upkeep.ts";
import { column, fill, row } from "./layout.ts";
const RAISED = kit.RAISED ?? { elevation: "raised" };
// The skip button shows only while the pointer is on its item.
const REVEAL = { visibility: "hidden", groupHover: { group: "update", visibility: "visible" } };
function mark(item: UpdateItem): Element {
if (item.id === "app") return htm`<icon name="app-window" small tone="muted" />`;
if (item.id === "plugins") return htm`<icon name="blocks" small tone="muted" />`;
return htm`<icon name="bot" small tone="muted" svg=${item.icon ?? undefined} />`;
}
// The second line: the versions, or what is happening to them.
function detail(item: UpdateItem, job: Job | undefined): { text: string; tone: "muted" | "danger" } {
if (job?.state === "failed") return { text: job.message, tone: "danger" };
if (job?.state === "waiting")
return { text: item.agentId ? `Updates when ${item.name} is idle` : "Updates when every chat is idle", tone: "muted" };
if (job?.state === "updating") return { text: item.id === "app" ? "Downloading…" : "Updating…", tone: "muted" };
if (job?.state === "terminal") return { text: "Running in the terminal", tone: "muted" };
if (item.action === "manual") return { text: `${versionLine(item)} · update it the way you installed it`, tone: "muted" };
return { text: versionLine(item), tone: "muted" };
}
function control(ctx: EffectViewContext<object>, upkeep: Upkeep, item: UpdateItem, job: Job | undefined) {
if (item.action === "manual") return null;
if (job?.state === "waiting")
return htm`<button id=${`update-cancel-${item.id}`} label="Cancel" small variant="ghost" onClick=${() => ctx.run(upkeep.cancel(item))} />`;
const label =
job?.state === "failed"
? "Retry"
: item.action === "terminal"
? job?.state === "terminal"
? "Run again"
: "Run in terminal"
: item.action === "restart"
? "Restart"
: "Update";
return htm`<button id=${`update-${item.id}`} label=${label} small variant="outline"
loading=${job?.state === "updating"} disabled=${job?.state === "updating"}
onClick=${() => ctx.run(upkeep.request(item))} />`;
}
function itemRow(ctx: EffectViewContext<object>, upkeep: Upkeep, item: UpdateItem) {
const job = upkeep.state.jobs[item.id];
const line = detail(item, job);
const skippable = !job || job.state === "failed" || job.state === "terminal";
return htm`
<div ...${row} group="update" gap="medium" padding="small" paddingX=${6}>
${mark(item)}
<div ...${column} ...${fill} gap=${1}>
<text style="body" size="sm" weight=${500} truncate>${item.name}</text>
<text style="body" size="xs" tone=${line.tone} truncate=${line.tone !== "danger"}>${line.text}</text>
</div>
${
skippable
? htm`<div ...${REVEAL}><button id=${`update-skip-${item.id}`} icon="x" small variant="ghost" tooltip=${`Skip ${item.to}`} onClick=${() => ctx.run(upkeep.skip(item))} /></div>`
: null
}
${control(ctx, upkeep, item, job)}
</div>`;
}
export function renderUpdatesRow(ctx: EffectViewContext<object>, upkeep: Upkeep): Element | null {
const items = upkeep.shown();
// Empty rather than null: the sidebar keeps an embedded view that drew
// nothing at the height it last had, which held the rows above it up.
if (!items.length) return htm`<div />`;
const { jobs, open } = upkeep.state;
const working = items.find((item) => jobs[item.id]?.state === "updating");
const failed = items.some((item) => jobs[item.id]?.state === "failed");
const [first] = items;
const label = working
? `Updating ${working.name}…`
: items.length === 1 && first
? `Update ${first.name}`
: `${items.length} updates`;
// One press for everything that installs here, when that is more than one.
const all = items.filter((item) => item.action === "update" && !jobs[item.id]).length > 1;
const hover = (on: "row" | "list") => ({
onPointerEnter: () => ctx.run(upkeep.hover(on, true)),
onPointerLeave: () => ctx.run(upkeep.hover(on, false)),
});
return htm`
<popover id="updates" open=${open} align="start" width=${300} onDismiss=${() => upkeep.setOpen(false)}>
<div id="updates-row" ...${column} ...${hover("row")}>
<item id="sidebar-updates" icon=${failed ? "circle-alert" : "circle-arrow-up"} iconTone=${failed ? "danger" : undefined}
label=${label} busy=${!!working} onPress=${() => upkeep.setOpen(true)} />
</div>
<div id="updates-list" ...${column} ...${hover("list")} gap=${2} padding="small" background="card/40" backdrop=${{ blur: 6 }} borderRadius="md" ...${RAISED}>
${items.map((item) => itemRow(ctx, upkeep, item))}
<div ...${row} gap="small" padding="small" paddingTop="medium">
<button id="updates-snooze" label="Remind me tomorrow" small variant="ghost" onClick=${() => ctx.run(upkeep.snooze())} />
<spacer />
${all ? htm`<button id="updates-all" label="Update all" small variant="primary" onClick=${() => ctx.run(upkeep.requestAll())} />` : null}
</div>
</div>
</popover>`;
}Versions
| Version | Published | Plugin API | Size | Permissions | Status |
|---|---|---|---|---|---|
| 0.2.8latest | Nov 21, 2026 | >=5 <6 | 68.5 KB | 7 permissions | Listed |
| 0.2.7 | Nov 18, 2026 | >=5 <6 | 68 KB | 7 permissions | Listed |
| 0.2.6 | Nov 16, 2026 | >=5 <6 | 66.3 KB | 7 permissions | Listed |
| 0.2.5 | Nov 11, 2026 | >=5 <6 | 63.6 KB | 7 permissions | Listed |
| 0.2.4 | Nov 9, 2026 | >=5 <6 | 61.6 KB | 7 permissions | Listed |
| 0.2.3 | Oct 27, 2026 | >=2 <4 | 46.8 KB | 7 permissions | Listed |
No comments yet.