@extenshi/mcp
Version:
Extenshi MCP server — bring the extension catalog (search, security, market research) and pre-publish scanning into your AI tools
74 lines • 4.12 kB
TypeScript
/**
* The build map page `extenshi map` serves (plan 2026-11-03-extension-build-map
* §4, §6.6). One self-contained HTML document — no network, no fonts to fetch —
* drawn from the static graph inlined here and the live snapshot the local
* server pushes over SSE (`/events`). Phase 1 is read-only, with three
* exceptions, all posted with the page token (build-map-server.ts):
* - a task only the author can do outside extenshi (`confirm` in the graph,
* such as a store account) gets a "Mark as done" button (/api/confirm);
* - the Modules step gets a switch per optional module, with where its
* value comes from and what it adds (/api/setting), and a confirm button
* that names the set: "Confirm: 4 modules, +9 steps";
* - a step the author can do themselves or skip (`manual` / `skip` in the
* graph) gets a form with what to give, and a skip button (/api/route).
* The store submits show what an upload by hand needs: the package on
* disk, the dashboard, the values to paste, the steps left to do there;
* - a step that spends credits (`credits` in the graph) shows what is left
* of its pool, and to an author with no account a sign-in for the free
* credits (/api/login) with the pairing code to check (phase 1g). Its own
* mark opens only once the free credits of that pool are spent.
* The header also offers an Update button while a newer @extenshi/cli is out
* (snap.update): it restarts the map on that release (/api/update), and the
* page reloads when the new server answers on the same port.
*
* The same page is the map in a chat (plan phase 4): the local MCP server
* (@extenshi/mcp, which keeps a byte-identical copy of this file) serves it as
* an MCP Apps resource with `app: true`. There it has no server to fetch from:
* it talks to the host over postMessage (JSON-RPC, MCP Apps 2026-01-26), reads
* the snapshot through the app-only tool `build_map_view` every few seconds,
* writes the author's answers through `build_map_answer` and loads variant
* thumbnails through `build_map_file`. Links open through the host. Sign-in
* stays on the browser map, which runs the pairing.
*
* Look and interaction follow the prototype in
* internal-docs/prototypes/extension-progress-map/index.html (catalog design
* tokens, both themes, pan/zoom, inspector), with two departures: the
* dependency lines are routed round the steps (buildMapEdges) instead of drawn
* straight through them, and they stay one neutral colour, so that the colour
* on the map belongs to the steps and their clusters. Everything the project
* or an agent wrote (extension name, fact sentences, log lines) reaches the DOM
* through textContent or `esc()`, never as markup.
*
* The client script is plain ES2017 inside a template literal: it must not
* contain backticks or `${`, so it concatenates strings.
*/
export type BuildMapEdge = {
from: string;
to: string;
/** SVG path data, in world units. */
d: string;
/** Steps the line still runs over (`id` for a body, `id:label` for a label); empty when it is clear. */
crosses: string[];
};
/** Every dependency of the graph as the line the page draws for it. The graph is static, so this runs once. */
export declare function buildMapEdges(): readonly BuildMapEdge[];
/**
* `token` authorises the page's writes (/api/confirm); without it, as in a
* saved copy, the page shows no write buttons. The token belongs to one server
* run, so `instance` names that run: when the page reconnects to a server
* restarted on the same port, the stream's hello carries another instance and
* the page reloads for the new token. `protocol` does the same when a newer
* server takes over the port.
*
* `app` makes it the map in a chat (see the top of this file): no token, no
* stream; the host and the MCP server's app-only tools stand in for both.
*/
export declare function buildMapPage(options: {
nonce: string;
token?: string;
instance?: string;
app?: {
version: string;
};
}): string;
//# sourceMappingURL=build-map-page.d.ts.map