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

Permissions in 0.1.3

  • 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

main.ts3.3 KB
// The marketplace (divergence/market, MARKETPLACE.md §10.3): browse and
// search, a listing page with its files, permissions and comments, Install
// through a scan chat in the Plugins workspace, update notices, sign-in, and
// the tools agents in the Plugins workspace use.
//
// Nothing here enables, publishes or reports by itself. Those are native
// cards the app draws (the enable card, the publish row, the report card,
// the bug report's send card and the attach card); this plugin only asks
// for them.
import * as Effect from "effect/Effect";
import * as Stream from "effect/Stream";
import { App, Commands, Events, Views, runPlugin } from "divergence/effect";
import type { PluginServices } from "divergence/effect";
import { MarketState, ROUTE } from "./state.ts";
import { controller } from "./controller.ts";
import { registerMarketTools } from "./tools.ts";
import { SIDEBAR_ITEM, renderCenter, renderSidebarItem } from "./views.tsx";

export { ROUTE };

const follow = <E>(stream: Stream.Stream<E>, handle: (event: E) => Effect.Effect<void, unknown, PluginServices>) =>
  stream.pipe(Stream.mapEffect(handle, { concurrency: "unbounded" }), Stream.runDrain, Effect.forkScoped);

const program = Effect.gen(function* () {
  const market = yield* controller();
  const views = yield* Views;
  market.state.views.push(yield* views.add("center", { slot: "center", render: (ctx) => renderCenter(ctx, market), on: ["app_state"] }));
  // The Marketplace row above Settings in the sidebar: a view of our own,
  // which the sidebar draws by the id published under SIDEBAR_ITEM.
  const item = yield* views.add("sidebar-item", { slot: "sidebar-item", render: (ctx) => renderSidebarItem(ctx, market), on: ["app_state"] });
  market.state.views.push(item);
  const app = yield* App;
  yield* Effect.acquireRelease(app.update({ shared: { [SIDEBAR_ITEM]: item.id } }), () =>
    app.update({ shared: { [SIDEBAR_ITEM]: null } }),
  );
  const commands = yield* Commands;
  yield* commands.register("market.open", app.route(ROUTE));
  // "Report a bug" (§14.1): the palette lists it; Settings and the Help
  // menu reach the same form through `host/market.open_bug_form`.
  yield* commands.register("market.reportBug", market.openBugForm());
  yield* registerMarketTools();
  const events = yield* Events;
  yield* follow(events.stream("market_bug_form"), market.onBugForm);
  yield* follow(events.stream("market_bug_report"), market.onBugReport);
  yield* follow(events.stream("security_resolved"), (event) =>
    Effect.sync(() => market.onSecurityResolved(event.id, event.outcome)),
  );
  yield* follow(events.stream("market_changed"), (event) => Effect.sync(() => market.onMarketChanged(event.updates)));
  yield* follow(events.stream("market_account"), market.onMarketAccount);
  // A listing installed, enabled or removed: its Install row changes.
  yield* follow(events.stream("plugins_changed"), () => market.refreshListing());
  yield* follow(events.stream("access_changed"), () => market.refreshListing());
  // An agent turned on, off or signed in: the agent menus change.
  yield* follow(events.stream("agents_changed"), () => market.refreshMenus());
  yield* follow(app.changes, market.followApp);
  yield* Effect.forkScoped(market.loadUpdates(), { startImmediately: true });
  yield* market.followApp(yield* app.state);
});

export default runPlugin(MarketState.layer, program);

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.