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.6
Permissions in 0.1.6
Files
search.ts2.6 KB
// The Browse tab's reads: the categories and the search. Only the newest
// search writes the list, so answers that arrive out of order never mix.
import * as Effect from "effect/Effect";
import { Host, parse } from "divergence/effect";
import { MarketState } from "./state.ts";
import { messageOf } from "./logic.ts";
import { categoriesSchema, searchAnswerSchema } from "./remote.ts";
export const browseReads = Effect.fn("Market.browseReads")(function* (redraw: () => void) {
const state = yield* MarketState;
const host = yield* Host;
const loadCategories = Effect.fn("Market.loadCategories")(function* () {
const raw = yield* host.call("host/market.categories", {}).pipe(Effect.catch(() => Effect.succeed(null)));
if (raw === null) {
// An older or unreachable registry: the built-in list stays.
console.warn("market: the categories could not be read: the registry did not answer");
} else {
const parsed = categoriesSchema.safeParse(raw);
if (parsed.success && parsed.data.categories.length) state.categories = parsed.data.categories;
else console.warn("market: the categories could not be read: the answer did not parse");
}
redraw();
});
// More pages ask for the words of the list on screen, not what the field
// holds now. Only the newest search writes its answer: one answered
// after a later search started is dropped.
let searchGeneration = 0;
const search = Effect.fn("Market.search")(function* (more = false) {
const generation = ++searchGeneration;
const query = more ? state.searched : state.query.trim();
state.searching = true;
state.searchError = null;
redraw();
const page = more ? state.pageNo + 1 : 1;
yield* host
.call("host/market.search", {
query,
category: state.category ?? undefined,
sort: state.sort || undefined,
page,
})
.pipe(
Effect.flatMap((raw) => parse("market search", searchAnswerSchema, raw)),
Effect.tap((answer) =>
Effect.sync(() => {
if (generation !== searchGeneration) return;
state.results = more ? [...(state.results ?? []), ...(answer.results ?? [])] : (answer.results ?? []);
state.total = answer.total ?? state.results.length;
state.pageNo = page;
state.searched = query;
}),
),
Effect.catch((error) =>
Effect.sync(() => {
if (generation === searchGeneration) state.searchError = messageOf(error);
}),
),
);
if (generation !== searchGeneration) return;
state.searching = false;
redraw();
});
return { loadCategories, search };
});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.