Official
market
The plugin marketplace: browse, install through an agent's scan, update and publish plugins, and the marketplace tools of agents in the Plugins workspace.
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/market@0.1.6
Permissions in 0.1.6
Files
parts.tsx4.1 KB
// What the marketplace's views share: layout shortcuts, the badge, and the
// agent, model and effort menus that the install row, the Updates tab and
// the bug report form all show.
import * as kit from "divergence";
import type { Element, ValueEvent } from "divergence";
import type { EffectViewContext } from "divergence/effect";
import { effortChoices, optionOf } from "./logic.ts";
import type { Menus } from "./state.ts";
import type { Controller } from "./controller.ts";
// Layout for the templates: a flex column, a row that centres its children
// across, a child that takes the free space, the whole parent, a centred
// reading column, and something clickable.
export const column = { display: "flex", flexDirection: "column" } as const;
export const row = { display: "flex", flexDirection: "row", alignItems: "center" } as const;
export const fill = { flexGrow: 1, flexShrink: 1, flexBasis: "0%", minWidth: 0, minHeight: 0 } as const;
export const full = { width: "100%", height: "100%" } as const;
export const reading = { maxWidth: 880, width: "100%", marginX: "auto" } as const;
export const clickable = { group: "hover" } as const;
// The fine outline that keeps a picture's edge on a surface of its tone
// (DESIGN.md §3); an older runtime has no constant.
export const EDGED = kit.EDGED ?? { elevation: "edge" };
export type Ctx = EffectViewContext<object>;
export function badge(text: string, variant: "default" | "info" | "success" | "warning" | "danger"): Element {
return <badge variant={variant}>{text}</badge>;
}
export function menus(ctx: Ctx, market: Controller): Element | null {
const m: Menus | null = market.state.menus;
if (!m)
return <div {...row} gap="small"><spinner /><text style="body" size="xs" tone="muted">Loading agents…</text></div>;
if (!m.agents.length)
return <text style="body" size="xs" tone="warning">{m.error ?? "Enable an agent in Settings > Agents to scan plugins."}</text>;
const models = optionOf(m.options, "model");
const efforts = effortChoices(m.options, m.choice.model);
const pick = (
id: string,
value: string | null,
options: readonly { readonly value: string; readonly label: string; readonly svg?: string }[],
onChange: (value: string) => void,
width: number,
): Element =>
(
<div {...row} maxWidth={width}>
<select id={id} value={value ?? ""} small options={options} onChange={(e: ValueEvent<string>) => onChange(e.value)} />
</div>
);
const picks = (
<div {...row} gap="small" flexWrap="wrap">
{pick(
"market-agent",
m.choice.agentId,
m.agents.map((a) => ({ value: a.id, label: a.name, svg: a.icon })),
(value) => ctx.run(market.chooseAgent(value)),
190,
)}
{models?.choices?.length
? pick(
"market-model",
m.choice.model,
models.choices.map((c) => ({ value: c.value, label: c.name, svg: c.icon })),
(value) => market.chooseModel(value),
220,
)
: null}
{efforts.length
? pick(
"market-effort",
m.choice.effort,
efforts.map((c) => ({ value: c.value, label: c.name })),
(value) => market.chooseEffort(value),
130,
)
: null}
</div>
);
if (!m.error) return picks;
return <div {...column} gap={4}>{picks}<text style="body" size="xs" tone="warning">{m.error}</text></div>;
}
// A quiet text link (a mark and a label) whose mark sits on the edge it
// starts from: its hover fill reaches into the gutter instead of pushing
// the mark in, as a ghost button's padding would.
export function textLink(id: string, icon: string, label: string, onClick: () => unknown, tooltip?: string): Element {
return (
<div id={id} role="button" {...row} {...clickable} cursor="pointer" gap={6} height={24} paddingX={6} marginX={-6} borderRadius="sm" hover={{ background: "hover" }} tooltip={tooltip} onClick={onClick}>
<icon name={icon} small tone="muted" />
<text style="body" size="xs" tone="muted">{label}</text>
</div>
);
}Versions
| Version | Published | Plugin API | Size | Permissions | Status |
|---|---|---|---|---|---|
| 0.1.6latest | Nov 21, 2026 | >=5 <6 | 71.9 KB | 6 permissions | Listed |
| 0.1.5 | Nov 18, 2026 | >=5 <6 | 71.4 KB | 6 permissions | Listed |
| 0.1.4 | Nov 16, 2026 | >=5 <6 | 70.5 KB | 6 permissions | Listed |
| 0.1.3 | Nov 11, 2026 | >=5 <6 | 62.7 KB | 6 permissions | Listed |
| 0.1.2 | Nov 9, 2026 | >=5 <6 | 57.5 KB | 6 permissions | Listed |
| 0.1.1 | Oct 27, 2026 | >=2 <4 | 46.2 KB | 6 permissions | Listed |
No comments yet.