npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@manta-eu/react

v0.25.0

Published

The Manta design system, knowledge-graph UI and agent components

Readme

@manta-eu/react

React components and design system for Manta apps, including the copilot chat.

Documentation: developers.manta.eu

Adding the copilot to a React app

Five steps, end to end. Steps 1–3 are setup you do once; step 4 generates the types your app queries the graph with; step 5 is the chat itself.

1. Install

pnpm add @manta-eu/react @manta-eu/codegen
pnpm add react react-dom next-themes
pnpm add -D tailwindcss @tailwindcss/postcss   # or @tailwindcss/vite, in a Vite app

The second line is this package's peer dependencies — the versions are yours to pick, so the package does not pin them for you. react and react-dom must satisfy ^19.0.0.

The third is Tailwind 4 and a build plugin for it. The package does not bring its own: the stylesheet it ships opens with @import "tailwindcss", so Tailwind has to resolve from your tree whatever you write in step 2.

2. Add the styles

The copilot is styled with Tailwind 4, so your app has to process the package's CSS. In your global stylesheet:

@import "tailwindcss";

/* Manta components – design tokens, base styles, utilities */
@import "@manta-eu/react/globals.css";

The stylesheet points Tailwind at the package's own compiled components, so you do not add an @source for it yourself.

3. Point the font variable at a real font

The design system reads --font-roobertpro. Set it to whatever you actually load:

@theme {
  --font-roobertpro: "RoobertPro", sans-serif;
}

:root {
  --font-roobertpro: "RoobertPro", sans-serif;
}

4. Generate the graph types

The copilot reads a datastore whose shapes are specific to your deployment, so the types come from that datastore rather than from this package. @manta-eu/codegen fetches them over HTTP:

pnpm manta-codegen generate --datastore your-datastore --out ./.ldkit

The run writes one file per namespace plus an index.ts that re-exports them. Re-run it whenever the shapes change. See @manta-eu/codegen for the device-login and service-account paths.

5. Mount the chat

EmbeddedChatProviders supplies the API client, query cache and graph state; EmbeddedChat is the copilot itself. Requests carry the session from mantaBaseUrl, so the user signs in there. It defaults to https://app.hiremanta.com.

import { EmbeddedChat } from "@manta-eu/react/components/embedded-chat";
import { EmbeddedChatProviders } from "@manta-eu/react/providers";
import "./globals.css";

export function Copilot() {
  return (
    <EmbeddedChatProviders datastoreId="your-datastore">
      <EmbeddedChat
        user={{ id: "…", email: "[email protected]", name: "You" }}
        isOperator={false}
        assistantName="Copilot"
      />
    </EmbeddedChatProviders>
  );
}

That is a working copilot. Everything below is optional.

Tailoring the chat

EmbeddedChat takes these, all optional unless marked:

| Prop | Type | What it does | | ----------------------------- | ------------------------------------- | ------------------------------------------------- | | user | { id, email, name? } — required | Who is talking | | isOperator | boolean — required | Unlocks operator-only affordances | | datastore | Datastore | The datastore to read; defaults to the provider's | | datastores | Datastore[] | Choices when canSwitchDatastore is set | | canSwitchDatastore | boolean | Lets an operator change datastore in the UI | | title | string | Header text | | assistantName | string | What the assistant calls itself | | assistantIcon | ComponentType<{ className? }> | Replaces the Manta mark in loading states | | welcomeSubtitle | string | Subtitle on the empty state | | initialPrompt | string | Sent as the first message of a new chat | | initialDraft | { id, text } | Prefills the composer; a new id re-seeds it | | mark | ReactNode | Your logo in the header | | allowedModels | MantaModelId[] | Restricts the model picker | | pageContext | PageContext | Tells the assistant what the user is looking at | | collapsible / isCollapsed | boolean | Collapsed presentation | | onClose / onLogout | () => void | Chrome callbacks | | onSelectPlan | (planIri: string) => void | Fires when a plan is opened | | renderMenuItems | (defaults) => ReactNode[] | Replaces the overflow menu | | onStartupTiming | (report: ChatStartupReport) => void | Startup timing once per mount, for your analytics |

Removing or renaming one of these is a breaking change, so they change rarely.

Building a whole app

A vertical such as a real estate app takes the frame every Manta app shares and brings only its own pages.

The worker

@manta-eu/react/worker is a Cloudflare worker that signs people in through the Manta agents worker and proxies the SDK's requests to it. The browser only ever talks to the app's own origin.

import { createAppWorker } from "@manta-eu/react/worker";

const app = createAppWorker({ cookiePrefix: "estate_session" });

app.get("/api/estate/health", (c) => c.json({ ok: true }));

export default app;

wrangler.jsonc sets MANTA_AGENTS_URL to the agents worker and binds the built app as ASSETS, with "run_worker_first": ["/*", "!/assets/*"] so hashed bundles skip the worker. MANTA_SESSION_SECRET (at least 32 characters) is a Worker secret that seals the session cookie. Binding the agents worker as AGENTS (a service binding) skips the public network. The app's origin must be in the agents worker's TRUSTED_ORIGINS.

  • /login, /auth/callback and /logout go to the agents worker. Its session cookies come back sealed (AES-GCM, @manta-eu/auth/sealed-cookies) inside the app's own HttpOnly cookies, named by cookiePrefix.
  • /api/login answers "signed out" without a round trip when there is no session.
  • The SDK's paths (/graphql, /sparql, /d/:datastoreId/sparql, chat, uploads) are proxied only from the app's own origin, only with a session, and only with the methods each path serves.
  • /sparql forwards reads only, as a POST of the query text: application/sparql-query, which is how LDKit sends them, text/plain, or no Content-Type. A write (application/sparql-update) is refused with 403, and anything else (GET, a form, other media types) with 405 or 415. Send a write from an app route through app.asPerson(c) or serviceFetch, below.
  • The Integrations page's sign-in paths (/oauth/:provider/start, /oauth/:provider/callback) are proxied too. The callback alone also takes a top-level page load from another site, because the provider sends the user back that way; the flow's state guards it.
  • /graphql forwards only named operations on an allowlist, each limited to its root fields. The allowlist is every operation the SDK ships (@manta-eu/client/operations) plus the ones an app adds with graphqlOperations. It refuses unknown operations, and the agents worker still decides what the signed-in user may do. An app adds its own paths with proxyRoutes.
  • Anything else falls through to ASSETS, so routes an app adds to the returned Hono app run first.

Signing in with the app's own custom app

By default people sign in through the agents worker, and Manta sees their own Manta session. With signIn: { customApp } the worker signs them in with the app's custom app instead (an ext- client with User access, made on the organization's Custom apps page), so every call carries a token Manta knows came from this app: it reaches only the datastores picked for the app, and SPARQL writes work once the app may write data.

const app = createAppWorker({
  cookiePrefix: "estate_session",
  signIn: { customApp: { datastoreId: "estate" } },
});
  • The worker needs KEYCLOAK_URL, MANTA_APP_CLIENT_ID and MANTA_APP_CLIENT_SECRET (a Worker secret), and VITE_KEYCLOAK_REALM off hiremanta.com; without them every request says which are missing. MANTA_SESSION_SECRET still seals the session, now holding the person's tokens. On https the session cookie is named __Host-<cookiePrefix>, so no other subdomain can set it.
  • /login, /auth/callback and /logout are answered by webLoginRoutes (@manta-eu/auth/web). Register <app>/auth/callback as a redirect URL of the custom app, and the app's address, with no trailing slash, as its Home URL; locally also http://localhost:<port>/auth/callback and http://localhost:<port>, where signing out returns to. A session that ended by itself skips Keycloak's sign-out prompt: /logout sends the person to /login, back to the page they were on.
  • KEYCLOAK_URL must be https, except http://localhost, http://127.0.0.1 and http://[::1], for a local stand-in.
  • The app's tokens carry no realm role, so an operator gets no more than anyone else: a person opens only the datastores the app was picked for and they are a member of. Someone with none sees "You don't have access to this app yet" (customApp: true in the worker's /api/login answer tells the shell), not Manta's invitations, which Manta refuses to a custom app's token. A membership reaches the person's token only when it renews, so while they wait the page asks every 15 seconds, and on "Check again", with an x-manta-renew-session: 1 header: the worker then renews a token at least 2 seconds old before forwarding the request.
  • /api/login is answered by the worker: Manta answers it for its own sessions only. The access token renews on any request that reads the session, and the renewed session goes back on that request's answer, refusals and an app's own asPerson routes included. When Keycloak cannot be reached for a renewal, the worker answers 503 from its app.onError; an app that sets its own onError replaces it, and can tell that case by SignInUnreachableError from @manta-eu/react/worker.
  • The proxied paths, the chat and its socket included, send the person's token as Authorization: Bearer and no cookies, so the browser never holds the token. An open chat checks POST /agents/chat-ticket every 30 seconds and swaps a newer token into its socket through a ticket. The answer's ETag names the token, and the worker answers a matching If-None-Match with 304 without asking Manta. Manta lets a custom app's token reach only some paths (see "Custom apps" on developers.manta.eu).
  • Every request names its datastore, so the worker answers /api/switch-datastore itself, with routeOnly: true, and the datastore picker only changes the route, as for the SDK's token hosts. Manta still checks each request against the datastores both the person and the app hold.
  • datastoreId pins the app to one datastore: /, /datastores and /g/... lead straight to it and the picker is hidden; /api/switch-datastore, every proxied path and asPerson refuse a request naming any other datastore, by path, x-manta-datastore or ?datastore=, with 403, and send one that names none to the pinned datastore. offlineAccess, signOutOfManta and idpHint pass through to webLoginRoutes.

app.asPerson(c), in either mode, gives an app's own routes a fetch to Manta as the person whose request it is (undefined when no one is signed in), without the proxy's GraphQL allowlist:

app.post("/d/:datastoreId/api/estate/notes", async (c) => {
  const send = await app.asPerson(c);

  if (!send) return c.json({ error: "Sign in first" }, 401);

  return send(`/d/${c.req.param("datastoreId")}/sparql`, {
    method: "POST",
    headers: { "content-type": "application/sparql-update" },
    body: await c.req.text(),
  });
});

serviceFetch(env, { datastoreId }) is the same for work no person is signed in for: a fetch to Manta as the app itself, the custom app's Machine access (KEYCLOAK_URL, MANTA_APP_CLIENT_ID, MANTA_APP_CLIENT_SECRET). Paths go to MANTA_AGENTS_URL, and a URL anywhere else is refused, since the app's token goes with every call. The token is kept until it nears expiry, renewed once on a 401 (a 401 that persists comes back as the answer, as from fetch), and picks up a rotated secret without a redeploy. A redirect comes back as the answer too, unfollowed, so the token never reaches its target. Writes go as the app, never with the deployment's SPARQL_UPDATE_PSK: they need the write-data permission and reach only the app's datastores and their default graph. Once an authorization names the app, each write must also fall within the acl:Append / acl:Write grants the app pushed.

import { serviceFetch } from "@manta-eu/react/worker";

const send = serviceFetch(env, { datastoreId: "estate" });
await send("/d/estate/sparql", {
  method: "POST",
  headers: { "content-type": "application/sparql-update" },
  body: update,
});

The Brand guidelines page (@manta-eu/react/routes/brand-guidelines) needs three more paths, which brandGuidelines turns on:

const app = createAppWorker({ cookiePrefix: "estate_session", brandGuidelines: {} });
  • /api/google-fonts lists the Google Fonts catalog. It needs GOOGLE_FONTS_API_KEY, a Worker secret; without it the route answers 503 and /api/google-fonts/status tells the page that Google Fonts are unavailable.
  • /api/adobe-fonts/:project reads a published Adobe Fonts project. It needs no key.
  • /d/:datastoreId/file-bytes?iri= streams a stored logo or font file under the app's origin, so the browser never talks to the file store. It asks Manta's /agents/uploads/file for the file, which a custom app's token reaches too. It follows only redirects to Cloudflare R2 or Amazon S3; a development file store is added by host name with brandGuidelines: { storageHosts: ["..."] }.

Approval emails

sendApprovalEmails(env, { datastoreId, from, emails }) sends the approval-request and manual-step emails the realm renders from its ApprovalRequestEmailTemplate and ManualStepEmailTemplate. It saves each template through /d/<datastoreId>/sparql, then starts all the emails as one plan. It signs in as the app's own custom app (an ext- client with machine access and the write-data permission, created on the organization's Custom apps page), so its writes stay inside that organization's datastores. Until the worker has KEYCLOAK_URL, VITE_KEYCLOAK_REALM, MANTA_APP_CLIENT_ID, MANTA_APP_CLIENT_SECRET and APP_ORIGIN, it sends nothing and logs the names of the missing ones. APP_ORIGIN only turns sending on: the links in an email point at the origin its caller gives approvalRequestEmail or manualStepEmail. One call sends at most maxGraphNodes (101) emails and refuses a larger batch before it saves any template, so a caller with more splits them. A deployment whose agents worker takes writes with a pre-shared key also sets SPARQL_UPDATE_PSK. Build the worker with VITE_KEYCLOAK_REALM set, so the template IRIs use the realm's vocabulary. The manual-step email names the app with the appName it is given.

With createAppWorker({ requestAssignmentEmails: { appName, from } }) the worker also takes POST /d/<datastoreId>/api/request-assignment-emails, which the Requests page calls after it assigns a request. As the person who assigned it, it reads the request, emails only the people now assigned to it, and looks their addresses up in the Team.

The shell

@manta-eu/react/components/app-shell is the React app around the SDK's screens, with the operator, group and datastore levels. The styles are the ones from step 2.

import "./styles.css";
import { AppShell } from "@manta-eu/react/components/app-shell";
import { createRoot } from "react-dom/client";

createRoot(document.getElementById("app")!).render(<AppShell />);
  • Operator: the SDK's global routes, and the datastore list for operators when the build sets VITE_ENABLE_DATASTORE_MANAGEMENT=true.
  • Group: /g/:group lists the datastores under a group.
  • Datastore: /d/:datastoreId/... mounts Plans, Chat, Activity, Explain, Memories, the Data Explorer and Data collection. Replace or add screens with routes, add routes inside a datastore with datastoreRoutes, and add sidebar entries with navItems.

Using the components on their own

The design system is usable without the chat:

import { Button } from "@manta-eu/react/button";
import "@manta-eu/react/globals.css";

export function App() {
  return <Button label="Click me" variant="primary" />;
}

Every component has its own subpath export — @manta-eu/react/button, /avatar, /badge and so on — so you only pull in what you render.

Themes

Three ship with the package: standard (default), manta (light) and manta-dark. Switch at runtime on the document root:

document.documentElement.dataset.theme = "manta";

License

MIT