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.4

Permissions in 0.1.4

  • Marketplace marketOfficial onlyUses the marketplace APIs. Only official plugins can have it.Search, read, install, update and publish marketplace plugins, and sign in to the marketplace
  • Manage plugins plugins.manageOfficial onlyReloads and enables plugins. Only official plugins can have it.Ask for the enable card of a plugin an agent installed
  • Control chats chats.controlHighCreates chats, sends prompts and cancels runs.Open the chat in the Plugins workspace where an agent scans, installs or updates a plugin
  • Provide agent tools tools.provideMediumGives tools to agents.Give agents in the Plugins workspace the marketplace tools
  • Read chats chats.readMediumReads your transcripts and chat lists.Find the agent, model and effort last used in the Plugins workspace
  • Show panels ui.slotsAlways grantedShows views in the listed parts of the window.Show the marketplace pageSlots: center

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

VersionPublishedPlugin APISizePermissionsStatus
0.1.6latestNov 21, 2026>=5 <671.9 KB6 permissionsListed
0.1.5Nov 18, 2026>=5 <671.4 KB6 permissionsListed
0.1.4Nov 16, 2026>=5 <670.5 KB6 permissionsListed
0.1.3Nov 11, 2026>=5 <662.7 KB6 permissionsListed
0.1.2Nov 9, 2026>=5 <657.5 KB6 permissionsListed
0.1.1Oct 27, 2026>=2 <446.2 KB6 permissionsListed

Reviews and comments

0 threads · 0 reviews

No comments yet.