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
views/page.tsx5.5 KB
// The settings page. Settings takes the window: its list of sections is
// drawn in the sidebar's place, the open section in the main pane.
// HTM whitespace is significant; keep these templates out of Prettier's HTML formatter.
import * as kit from "divergence";
import type { EffectViewContext } from "divergence/effect";
import type { SettingsPage } from "../controller.ts";
import { APP_SECTIONS, pluginSections } from "../model.ts";
import { renderGeneral } from "./general.tsx";
import { renderAgents } from "./agents.tsx";
import { renderWorkspaces } from "./workspaces.tsx";
import { renderArchived } from "./archived.tsx";
import { renderPlugins } from "./plugins.tsx";
import { renderTools } from "./tools.tsx";
import { renderKeys } from "./keys.tsx";
import { renderUpdates } from "./updates.tsx";
import { renderPluginSection } from "./pluginSection.tsx";
import { column, fill, full, reading } from "./layout.tsx";
const RAISED = kit.RAISED ?? { elevation: "raised" };
const FLAT = kit.FLAT ?? { elevation: "none" };
// Opening Settings fades the list in, and the open section fades in each
// time it changes; the kernel runs both at the window's present, without
// drawing the views again, and jumps under reduced motion.
const FADE_IN = { opacity: 0, motion: { to: { opacity: 1 }, duration: 180, easing: "easeOut" } };
const SECTION_IN = { opacity: 0, motion: { to: { opacity: 1 }, duration: 140, easing: "easeOut" } };
// Settings takes the window: this list of sections stands in the sidebar's
// place while the route is `settings`. Its rows sit on the sidebar's side
// inset, and Back to chat sits at its foot where the chat sidebar has its
// Settings row, so the two rows trade places.
export function renderSettingsSidebar(ctx: EffectViewContext<object>, actions: SettingsPage["Service"]) {
if (ctx.app.route !== "settings") return null;
const state = actions.state;
const entry = (item: { id: string; label: string; icon?: string; plugin?: string; enabled?: boolean }) => {
const chosen = state.section === item.id;
const label =
item.id === "updates" && (state.updates?.appUpdate || state.updates?.pluginUpdate)
? `${item.label} •`
: item.label;
// A turned-off plugin's mark is faint. The chosen row's fill is the
// one box below that glides from row to row.
return <item key={item.id} id={`nav-${item.id}`} icon={item.icon ?? "puzzle"} iconTone={item.enabled === false ? "faint" : undefined} label={label} selected={chosen} {...FLAT} background={chosen ? "transparent" : undefined} onClick={() => ctx.run(actions.openSection(item.id, item.plugin))} />;
};
const plugins = pluginSections(state.data.plugins);
return (
<div id="settings-sidebar" {...column} {...fill} {...full} padding="small" paddingTop={0} {...FADE_IN}>
<div {...column} {...fill} gap={2} padding="small" paddingTop={2} overflowY="scroll">
<div id="settings-selection" follows={`nav-${state.section}`} width="100%" height="100%" background="accent" borderRadius="sm" {...RAISED} layoutMotion />
<item heading label="Settings" />
{APP_SECTIONS.map(entry)}
{plugins.length
? <item heading label="Plugins" />
: null}
{plugins.map(entry)}
</div>
<div {...column} padding="small" paddingY="small">
<item id="settings-back" icon="arrow-left" label="Back to chat" onClick={() => ctx.run(actions.route("chat"))} />
</div>
</div>
);
}
function body(ctx: EffectViewContext<object>, actions: SettingsPage["Service"]) {
const plugin = actions.sectionPlugin();
if (plugin) return renderPluginSection(ctx, actions, plugin);
switch (actions.state.section) {
case "agents":
return renderAgents(ctx, actions);
case "workspaces":
return renderWorkspaces(ctx, actions);
case "archived":
return renderArchived(ctx, actions);
case "plugins":
return renderPlugins(ctx, actions);
case "tools":
return renderTools(ctx, actions);
case "keys":
return renderKeys(ctx, actions);
case "updates":
return renderUpdates(ctx, actions);
default:
return renderGeneral(ctx, actions);
}
}
// The open section, at the reading width in the main pane. The page's data
// loads when the plugin starts, so Settings opens on its section at once.
export function renderSettings(ctx: EffectViewContext<object>, actions: SettingsPage["Service"]) {
const state = actions.state;
if (ctx.app.route !== "settings") return null;
// A load that failed is tried again on the next draw.
if (state.data.status === "pending") ctx.run(actions.load());
// A plugin's section that is gone (the plugin was removed) falls back.
const open = actions.sectionPlugin();
if (open && state.data.status === "ready" && !state.data.plugins.some((p) => p.name === open && p.settings))
state.section = "general";
// The chat plugin's film grain covers this page too.
const grain = state.sections.chat?.properties.some((p) => p.key === "transcriptGrain" && p.value === true) ?? false;
return (
<div id="settings-page" {...column} {...fill} {...full} padding="small" grain={grain}>
<div {...column} {...fill} height="100%" padding="small" overflowY="scroll">
{state.data.status === "ready"
? <div key={state.section} id={`settings-section-${state.section}`} {...column} {...reading} gap="large" padding="small" paddingX="large" paddingY="large" {...SECTION_IN}>{body(ctx, actions)}</div>
: null}
</div>
</div>
);
}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.