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.5
Permissions in 0.1.5
Files
state.ts5.9 KB
// The marketplace page's state belongs to one activation; the controller
// mutates it and the views read it. The view handles let asynchronous host
// answers request a render.
import * as Context from "effect/Context";
import * as Layer from "effect/Layer";
import type { AgentInfo, ViewHandle } from "divergence";
import type { AgentChoice, AgentOption } from "./logic.ts";
import { CATEGORIES } from "./logic.ts";
import type { ProfileEdits } from "./logic.ts";
import type {
BugDraft,
BugPreview,
Listing,
MarketAccount,
MarketComments,
MarketRelease,
MarketReleaseFile,
MarketUpdateItem,
SentReport,
} from "./remote.ts";
export const ROUTE = "market";
// The shared key under which the sidebar finds the view it draws in its Options circle.
export const PICTURE_ITEM = "sidebarPicture";
export type Page = "browse" | "listing" | "updates" | "bugs" | "profile";
export interface Menus {
readonly agents: readonly AgentInfo[];
readonly options: readonly AgentOption[];
readonly choice: AgentChoice;
readonly error?: string;
}
export interface AccountState {
readonly signedIn: boolean;
readonly registry?: string;
readonly error?: string;
readonly expired?: boolean;
}
export interface SignIn {
readonly code: string;
readonly url: string;
}
/** The release file the listing's Files tab shows, by what reading it gave. */
export type OpenFile = { readonly path: string } & (
| { readonly kind: "loading" }
| { readonly kind: "failed"; readonly error: string }
| { readonly kind: "binary"; readonly size?: number }
| { readonly kind: "text"; readonly text: string; readonly truncated: boolean }
);
export type CommentsState = MarketComments | "loading" | { readonly error: string };
/** A listing picture by what fetching it gave: the file to draw, or why there is none. */
export type MediaState = { readonly path: string } | "loading" | { readonly error: string };
/** One thing a release adds to the app, for the overview's list. */
export interface Addition {
readonly kind: string;
readonly label: string;
readonly detail?: string;
}
/** A listing's overview, read from its release: the README and what its plugin.json adds. */
export type Overview = { readonly key: string } & (
| { readonly kind: "loading" }
| { readonly kind: "failed"; readonly error: string }
| {
readonly kind: "ready";
readonly readme: string | null;
readonly readmeTruncated: boolean;
readonly adds: readonly Addition[];
readonly files: number;
readonly bytes: number;
}
);
export interface ReportDraft {
reason: string;
files: string;
/** The report card the draft waits on; the draft goes once it is sent. */
requestId?: string;
}
// The bug report form (§14.1) and the request waiting on its send card.
export interface BugState {
/** The chat the form was opened from, whose last turn suggests plugins. */
chatId: string | null;
loading: boolean;
error: string | null;
draft: BugDraft | null;
chosen: Set<string>;
fullSource: Set<string>;
screenshots: string[];
text: string;
email: string;
preview: BugPreview | null;
previewing: boolean;
previewError: string | null;
unchecked: Set<string>;
open: Set<string>;
previewKey?: string;
seen?: Set<string>;
requestId: string | null;
fixAfter: boolean;
sent: SentReport | null;
}
export interface State {
loaded: boolean;
page: Page;
query: string;
/** The words of the list on screen, which More pages ask for again. */
searched: string;
category: string | null;
sort: string;
results: readonly Listing[] | null;
total: number;
pageNo: number;
searching: boolean;
searchError: string | null;
categories: readonly { readonly id: string | null; readonly title: string }[];
listing: Listing | null;
listingId: string | null;
listingError: string | null;
version: string | null;
tab: string;
/** The screenshot the listing's gallery shows. */
shot: number;
overview: Overview | null;
/** Listing pictures by their hash. */
media: Record<string, MediaState>;
tree: MarketRelease | "loading" | null;
treeError: string | null;
file: OpenFile | null;
comments: CommentsState | null;
report: ReportDraft | null;
updates: readonly MarketUpdateItem[];
updatesGeneration: number;
busy: Record<string, boolean>;
menus: Menus | null;
direct: boolean;
/** Why the Install directly setting could not be read, if it could not. */
directError: string | null;
account: MarketAccount | AccountState | null;
signIn: SignIn | null;
linkNonce: unknown;
bug: BugState | null;
reports: readonly SentReport[];
/** Why the sent reports could not be listed, if they could not. */
reportsError: string | null;
settingsSchema: { key: string; settings: unknown; error?: string } | null;
views: ViewHandle[];
/** The view drawn in the sidebar's Options circle, published only while the account has a picture. */
pictureView: number | null;
profileEdits: ProfileEdits;
/** The username typed on the profile page of an account that has none. */
claimName: string;
}
export const initialState = (): State => ({
loaded: false,
page: "browse",
query: "",
searched: "",
category: null,
sort: "",
results: null,
total: 0,
pageNo: 1,
searching: false,
searchError: null,
categories: CATEGORIES,
listing: null,
listingId: null,
listingError: null,
version: null,
tab: "overview",
shot: 0,
overview: null,
media: {},
tree: null,
treeError: null,
file: null,
comments: null,
report: null,
updates: [],
updatesGeneration: 0,
busy: {},
menus: null,
direct: false,
directError: null,
account: null,
signIn: null,
linkNonce: null,
bug: null,
reports: [],
reportsError: null,
settingsSchema: null,
views: [],
pictureView: null,
profileEdits: {},
claimName: "",
});
export class MarketState extends Context.Service<MarketState, State>()("market/State") {
static readonly layer = Layer.sync(MarketState, initialState);
}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.