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.4
Permissions in 0.2.4
Files
agents-view.test.ts3.3 KB
// The Agents section's process pool pickers: they show the host's defaults
// until the user picks, and save through the settings update.
import assert from "node:assert/strict";
import test from "node:test";
import * as Effect from "effect/Effect";
import type { EffectViewContext } from "divergence/effect";
import type { SettingsPage } from "./controller.ts";
import { renderAgentChoices, renderAgents } from "./views/agents.tsx";
type Node = { id?: string; value?: string; options?: { value: string; label: string }[]; onChange?: (e: { value: string }) => void; children?: unknown };
const find = (node: unknown, id: string, out: Node[] = []): Node[] => {
if (!node || typeof node !== "object") return out;
if (Array.isArray(node)) {
for (const child of node) find(child, id, out);
return out;
}
const value = node as Node;
if (value.id === id) out.push(value);
find(value.children, id, out);
return out;
};
function render(settings: Record<string, unknown>) {
const patches: unknown[] = [];
const actions = {
state: { agents: [], data: { status: "ready", settings, plugins: [] }, showRegistry: false },
updateSettings: (patch: unknown) => Effect.sync(() => void patches.push(patch)),
} as unknown as SettingsPage["Service"];
const ctx = { run: (effect: Effect.Effect<unknown>) => Effect.runSync(effect), update() {} } as unknown as EffectViewContext<object>;
return { tree: renderAgents(ctx, actions), patches };
}
test("the process pickers show the host defaults when nothing is saved", () => {
const { tree } = render({});
const [limit] = find(tree, "agent-process-limit");
const [idle] = find(tree, "agent-idle-minutes");
assert.equal(limit?.value, "20");
assert.deepEqual(limit?.options?.map((o) => o.value), ["5", "10", "20", "40"]);
assert.equal(idle?.value, "10");
assert.deepEqual(idle?.options?.map((o) => o.value), ["5", "10", "30", "60"]);
});
test("a saved value outside the presets stays listed, and a pick is saved as a setting", () => {
const { tree, patches } = render({ agentProcessLimit: 12, agentIdleMinutes: 30 });
const [limit] = find(tree, "agent-process-limit");
assert.equal(limit?.value, "12");
assert.deepEqual(limit?.options?.map((o) => o.value), ["5", "10", "12", "20", "40"]);
limit?.onChange?.({ value: "40" });
find(tree, "agent-idle-minutes")[0]?.onChange?.({ value: "5" });
assert.deepEqual(patches, [{ agentProcessLimit: 40 }, { agentIdleMinutes: 5 }]);
});
test("agents split on the provider's registry flag", () => {
const agent = (id: string, registry?: boolean) => ({ id, name: id, enabled: false, ...(registry === undefined ? {} : { registry }) });
const actions = {
state: { agents: [agent("codex"), agent("acp:gemini", false), agent("goose", true), agent("acp:old", true)], showRegistry: false },
} as unknown as SettingsPage["Service"];
const ctx = { run() {}, update() {} } as unknown as EffectViewContext<object>;
const tree = renderAgentChoices(ctx, actions);
assert.equal(find(tree, "agent-codex").length, 1);
assert.equal(find(tree, "agent-acp:gemini").length, 1, "a provider that says it is not from a registry is listed");
assert.equal(find(tree, "agent-goose").length, 0);
assert.equal(find(tree, "agent-acp:old").length, 0);
const [toggle] = find(tree, "registry-agents") as { label?: string }[];
assert.equal(toggle?.label, "Show the other 2");
});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.