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.7
Permissions in 0.2.7
Files
upkeep.test.ts7 KB
// The update list: what is behind, what each item's button does, what a
// skip or a snooze hides, and which runs an update waits for.
import assert from "node:assert/strict";
import { test } from "node:test";
import type { Chat, InputSnapshot, UpdateStatus } from "divergence";
import { blocked, blockers, holdsMessage, installsHere, shownItems, updateItems, versionLine, waitLine } from "./upkeep.ts";
import type { AgentEntry } from "./controller.ts";
const agent = (id: string, maintenance: AgentEntry["maintenance"], enabled = true): AgentEntry => ({
id,
name: id,
description: "",
capabilities: {},
authMethods: [],
status: { state: "ready" },
enabled,
maintenance,
});
const chat = (agentId: string, status: Chat["status"]) => ({ id: agentId, agentId, status }) as unknown as Chat;
const updates = {
enabled: true,
appVersion: "0.9.3",
appUpdate: { version: "0.9.4" },
plugins: { build: 41 },
pluginUpdate: { build: 42 },
} as unknown as UpdateStatus;
test("each item's button follows what can install it", () => {
const items = updateItems(
[
agent("npm", { installedVersion: "1.0.0", latestVersion: "1.1.0", canUpdate: true, manager: "npm" }),
agent("own", { installedVersion: "1.0.0", latestVersion: "1.1.0", canUpdate: false, command: "own update" }),
agent("curl", { installedVersion: "1.0.0", latestVersion: "1.1.0", canUpdate: false }),
agent("current", { installedVersion: "1.1.0", canUpdate: true }),
agent("off", { installedVersion: "1.0.0", latestVersion: "1.1.0", canUpdate: true }, false),
],
updates,
);
assert.deepEqual(
items.map((item) => [item.id, item.action, item.command]),
[
["npm", "update", null],
["own", "terminal", "own update"],
["curl", "manual", null],
["plugins", "update", null],
["app", "restart", null],
],
);
assert.equal(versionLine(items[0]!), "1.0.0 → 1.1.0");
assert.equal(versionLine(items[3]!), "build 41 → build 42");
// A copy that runs its plugins from a source tree has no releases.
assert.deepEqual(updateItems([], { ...updates, enabled: false }), []);
});
test("a skip hides one version, a snooze the row, and work under way shows through both", () => {
const items = updateItems(
[
agent("a", { installedVersion: "1.0.0", latestVersion: "1.1.0", canUpdate: true }),
agent("b", { installedVersion: "1.0.0", latestVersion: "2.0.0", canUpdate: true }),
],
null,
);
const now = 1_000;
const ids = (shown: { id: string }[]) => shown.map((item) => item.id);
assert.deepEqual(ids(shownItems(items, { skipped: { a: "1.1.0", b: "1.9.0" }, snoozedUntil: null }, {}, now)), ["b"]);
assert.deepEqual(ids(shownItems(items, { skipped: {}, snoozedUntil: now + 1 }, {}, now)), []);
assert.deepEqual(ids(shownItems(items, { skipped: {}, snoozedUntil: now + 1 }, { a: { state: "waiting" } }, now)), ["a"]);
assert.deepEqual(ids(shownItems(items, { skipped: {}, snoozedUntil: now }, {}, now)), ["a", "b"]);
});
test("an agent's update waits for its own runs, the app's and the plugins' for every run", () => {
const [codex, , app] = updateItems(
[agent("codex", { installedVersion: "1.0.0", latestVersion: "1.1.0", canUpdate: true })],
{ ...updates, pluginUpdate: null, appUpdate: { version: "0.9.4" } } as unknown as UpdateStatus,
).concat(updateItems([], { ...updates, pluginUpdate: null } as unknown as UpdateStatus));
assert.ok(codex && app);
assert.equal(blocked(codex, [chat("claude", "running")]), false);
assert.equal(blocked(codex, [chat("codex", "idle"), chat("codex", "failed")]), false);
assert.equal(blocked(codex, [chat("codex", "waiting_approval")]), true);
assert.equal(blocked(app, [chat("claude", "running")]), true);
assert.equal(blocked(app, [chat("claude", "idle")]), false);
});
const titled = (id: string, agentId: string, status: Chat["status"]) => ({ id, agentId, status, title: id.toUpperCase() }) as unknown as Chat;
test("the marketplace's plugin updates come before the app, and only plugins with agents wait for chats", () => {
const items = updateItems(
[],
updates,
[
{ id: "divergence/codex", folder: "codex", installed: "0.1.0", latest: "0.2.0", direct: true },
{ id: "pub/word-count", folder: "word-count", installed: null, latest: "1.0.0", direct: false },
],
new Set(["codex"]),
);
assert.deepEqual(
items.map((item) => [item.id, item.action, item.waits, installsHere(item)]),
[
["plugins", "update", true, true],
["plugin:codex", "update", true, true],
["plugin:word-count", "update", false, true],
["app", "restart", true, true],
],
);
assert.equal(versionLine(items[1]!), "0.1.0 → 0.2.0");
assert.equal(versionLine(items[2]!), "1.0.0");
const [, codexPlugin, wordCount] = items;
// A plugin that provides agents waits for every chat, as the app does; one without agents for none.
assert.equal(blocked(codexPlugin!, [titled("c1", "claude", "running")]), true);
assert.equal(blocked(wordCount!, [titled("c1", "claude", "running")], new Set(["c1"])), false);
});
test("messages waiting to be sent hold an update as a run does; a paused one does not", () => {
const snapshot = (...inputs: object[]) => ({ chatId: "c1", inputs }) as unknown as InputSnapshot;
assert.equal(holdsMessage(snapshot({ state: "held" })), true);
assert.equal(holdsMessage(snapshot({ state: "dispatching" })), true);
assert.equal(holdsMessage(snapshot({ state: "held", pauseReason: "interrupted by restart" })), false);
assert.equal(holdsMessage(snapshot({ state: "observed_consumed" }, { state: "delivery_unknown" })), false);
const [codex, app] = updateItems(
[agent("codex", { installedVersion: "1.0.0", latestVersion: "1.1.0", canUpdate: true })],
{ ...updates, pluginUpdate: null } as unknown as UpdateStatus,
);
const chats = [titled("c1", "codex", "idle"), titled("c2", "claude", "idle")];
assert.deepEqual(blockers(app!, chats, new Set(["c2"])).map((c) => c.id), ["c2"]);
// An agent waits only for its own chats' messages.
assert.deepEqual(blockers(codex!, chats, new Set(["c2"])), []);
assert.deepEqual(blockers(codex!, chats, new Set(["c1"])).map((c) => c.id), ["c1"]);
});
test("a waiting item says which chats it waits for and why", () => {
const [app] = updateItems([], { ...updates, pluginUpdate: null } as unknown as UpdateStatus);
const none = new Set<string>();
assert.equal(waitLine(app!, [titled("c1", "x", "running")], none), "Updates when “C1” finishes");
assert.equal(waitLine(app!, [titled("c1", "x", "running"), titled("c2", "x", "waiting_approval")], none), "Updates when 2 running chats finish");
assert.equal(waitLine(app!, [titled("c3", "x", "idle")], new Set(["c3"])), "Updates when “C3” sends its queued messages");
assert.equal(
waitLine(app!, [titled("c1", "x", "running"), titled("c3", "x", "idle"), titled("c4", "x", "idle")], new Set(["c1", "c3", "c4"])),
"Updates when “C1” finishes and 2 chats send their queued messages",
);
// Between a chat's end and the start it frees, nothing is named.
assert.equal(waitLine(app!, [], none), "Updates when every chat is idle");
});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.