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

  • 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

reads.ts4.7 KB
// The listing page's reads beyond the listing itself: its pictures, kept by
// the host and drawn from its cache, and its overview, read from the
// release. Each is asked for once; the views run the effects these return
// with `ctx.run`, as `settingsOf` in the controller does.
import * as Effect from "effect/Effect";
import { Host, Plugin, parse, promise } from "divergence/effect";
import type { PluginServices } from "divergence/effect";
import { MarketState } from "./state.ts";
import { additions, messageOf } from "./logic.ts";
import { manifestAddsSchema, mediaPathSchema, releaseFileSchema, releaseSchema } from "./remote.ts";
import type { Listing, ListingMedia } from "./remote.ts";

export const listingReads = Effect.fn("Market.listingReads")(function* (redraw: () => void) {
  const state = yield* MarketState;
  const host = yield* Host;
  const plugin = yield* Plugin;

  // A listing picture as a file the kernel draws, once `host/market.media`
  // kept it; each picture is asked for once per activation.
  const mediaOf = (
    media: ListingMedia,
    id: string,
  ): { path: string | null; error: string | null; fetch: Effect.Effect<void, unknown, PluginServices> | null } => {
    const known = state.media[media.sha256];
    if (known === "loading") return { path: null, error: null, fetch: null };
    if (known) return "path" in known ? { path: known.path, error: null, fetch: null } : { path: null, error: known.error, fetch: null };
    state.media = { ...state.media, [media.sha256]: "loading" };
    const fetch = host
      .call("host/market.media", { id, version: media.version, path: media.path, sha256: media.sha256 })
      .pipe(
        Effect.flatMap((raw) => parse("picture", mediaPathSchema, raw)),
        Effect.map(({ path }): { path: string } | { error: string } => ({ path })),
        Effect.catch((error) => Effect.succeed({ error: messageOf(error) })),
        Effect.tap((answer) =>
          Effect.sync(() => {
            state.media = { ...state.media, [media.sha256]: answer };
            redraw();
          }),
        ),
        Effect.asVoid,
      );
    return { path: null, error: null, fetch };
  };

  // The listing's overview: its README and what its plugin.json adds, read
  // from the chosen version's verified package (the host keeps the package,
  // so the Files tab reads it again at once). Read once per id and version.
  const overviewOf = (listing: Listing, permissions: unknown): Effect.Effect<void, unknown, PluginServices> | null => {
    const { listingId: id, version } = state;
    if (!id || !version) return null;
    const key = `${id}@${version}`;
    if (state.overview?.key === key) return null;
    state.overview = { key, kind: "loading" };
    return Effect.gen(function* () {
      const read = (path?: string) => host.call("host/market.read", { id, version, ...(path ? { path } : {}) });
      const release = yield* read().pipe(Effect.flatMap((raw) => parse("release", releaseSchema, raw)));
      const files = release.files ?? [];
      const readmePath = listing.listing?.readme ?? files.find((file) => /^readme\.md$/i.test(file.path))?.path ?? null;
      const [readme, manifest] = yield* Effect.all(
        [
          readmePath
            ? read(readmePath).pipe(Effect.flatMap((raw) => parse("README", releaseFileSchema, raw)))
            : Effect.succeed(null),
          read("plugin.json").pipe(
            Effect.flatMap((raw) => parse("plugin.json", releaseFileSchema, raw)),
            Effect.flatMap((file) => Effect.try({ try: () => JSON.parse(file.text ?? "{}") as unknown, catch: (error) => error })),
            Effect.map((json) => {
              const parsed = manifestAddsSchema.safeParse(json);
              return parsed.success ? parsed.data : null;
            }),
          ),
        ],
        { concurrency: 2 },
      );
      return {
        kind: "ready" as const,
        readme: readme && !readme.binary ? (readme.text ?? "") : null,
        readmeTruncated: readme?.truncated ?? false,
        adds: additions(manifest, permissions),
        files: files.length,
        bytes: files.reduce((sum, file) => sum + (file.size ?? 0), 0),
      };
    }).pipe(
      Effect.catch((error) => Effect.succeed({ kind: "failed" as const, error: messageOf(error) })),
      Effect.tap((overview) =>
        Effect.sync(() => {
          if (state.overview?.key !== key) return;
          state.overview = { key, ...overview };
          redraw();
        }),
      ),
      Effect.asVoid,
    );
  };

  const chooseShot = (shot: number): void => {
    state.shot = shot;
    redraw();
  };

  const openLink = Effect.fn("Market.openLink")(function* (url: string) {
    yield* promise("openUrl", () => plugin.api.openUrl(url));
  });

  return { mediaOf, overviewOf, chooseShot, openLink };
});

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.