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.1
Permissions in 0.1.1
Files
main.ts3.1 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.ts";
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.slot("center", (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.slot("sidebar-item", (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());
yield* follow(app.changes, market.followApp);
yield* Effect.forkScoped(market.loadUpdates(), { startImmediately: true });
yield* market.followApp(yield* app.state);
});
export const activate = runPlugin(MarketState.layer, program);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.