Manta Developers
GitHub
Menu

Mount the app's screens

Add the agents app's own screens to your app, from Today and Goals to the signup, the way the agents app mounts them.

The agents app’s own screens ship in @manta-eu/react as screen subpaths (@manta-eu/react/screens/*): Today, Goals, Governance, a new desk, the signup with its Getting started, and the operator dashboard. An app on the SDK’s layout mounts them the way the agents app does. The screens link to one another, so you mount them in the sets below rather than one by one.

They are application subpaths, so the root barrel does not export them. Import each from its own path.

What every screen needs

  • The Manta agent server. The screens call it at mantaBaseUrl: GraphQL for memories, plans, invitations and provisioning, SPARQL for what reading a website found, and the endpoints below. Your app talks to it the way the agents app does, with the session or a token the client provider sends.
  • The providers. Providers from @manta-eu/react/providers (the API client, the query cache, the active datastore and its router), and AuthContext with the signed-in user, as for the SDK’s own routes.
  • A place in the routes. A datastore screen is a route factory you pass to getDatastoreRoutes; a screen outside any datastore is a component you render yourself or pass to getGlobalRoutes.
  • The SDK pages they link to. Today links to Action plans and the activity log, and Today and Getting started to Integrations. Give getDatastoreRoutes a Plans element (PlansScreen from @manta-eu/react/screens/plans), an Activity element (ActivityScreen from @manta-eu/react/screens/activity) and your own Integrations page.

Which screens go together

A screen links to the pages it names, so a set is complete only when every page it links to is mounted:

Screen Links to Mount it with
Today Goals, a new desk Goals, a new desk
Goals a new desk a new desk
A new desk Today, with the desk’s first-run strip Today
Governance nothing nothing
Getting started Today Today and everything Today needs
Operator dashboard Today, in the client’s datastore it opens Today and everything Today needs

So Today, Goals and a new desk are one set: mount all three, or none. Governance, Getting started and the operator dashboard each add to that set.

The datastore screens

Each subpath exports a route factory and, for the pages people start from, the sidebar entries to pass to NavExtrasProvider.

Subpath Route factory Sidebar entries Page
@manta-eu/react/screens/today todayDatastoreRoutes() todayNavExtras() /today
@manta-eu/react/screens/goals goalsDatastoreRoutes() goalsNavExtras() /goals
@manta-eu/react/screens/governance governanceDatastoreRoutes() governanceNavExtras() /governance
@manta-eu/react/screens/new-desk newDeskDatastoreRoutes() /new-desk
@manta-eu/react/screens/join gettingStartedDatastoreRoutes() /getting-started
import { getDatastoreRoutes } from "@manta-eu/react/datastore-routes";
import { ActivityScreen } from "@manta-eu/react/screens/activity";
import { goalsDatastoreRoutes } from "@manta-eu/react/screens/goals";
import { newDeskDatastoreRoutes } from "@manta-eu/react/screens/new-desk";
import { PlansScreen } from "@manta-eu/react/screens/plans";
import { todayDatastoreRoutes } from "@manta-eu/react/screens/today";

getDatastoreRoutes(
  { ...routeElements, Plans: <PlansScreen />, Activity: <ActivityScreen />, Integrations: <YourIntegrations /> },
  <>
    {todayDatastoreRoutes()}
    {goalsDatastoreRoutes()}
    {newDeskDatastoreRoutes()}
  </>,
);

Desks and workspaces

A desk is one part of the business inside one datastore, such as marketing or creative: a desk memory (m:DeskMemory, keyed by deskKey), the goals that name it (goalDesk) and its auto-pilot rule (autonomyDesk). It can hold several goals; screens present its lead goal, the one with the earliest target, and list any others after it. A plan belongs to a desk through its goal: the plan names a goal measure, and that goal names its desk. The new-desk screen saves the desk, its first goal and its auto-pilot rule in the current datastore, resuming an interrupted save without saving any memory twice, and creates no datastore.

A workspace is a datastore nested in another one, in its organization. WorkspaceDatastoresProvider (@manta-eu/react/screens/new-desk) tells the SDK’s pages about the workspaces around the current datastore, and its open enters one. The agents app provides it with the datastore tree. With v1_groupedSidebar on, the SDK’s sidebar can list them from the same provider.

The desks, goals and autonomy rules these screens read are typed memories. @manta-eu/react/hooks/typed-memories exports the hooks that read and write them (useDesks, useGoals, useGoalMilestones, useAutonomyRules and their create and update hooks), for a page of your own. Its shapes may still change.

How a plan names its goal

Goals lists each goal’s action plans, and a goal’s page shows them, waiting ones first. A plan reaches a goal through :movesGoalMeasure, the goal’s measure key (the goal memory’s goalMeasure) on the plan in the plan’s own graph. useActionPlans returns it as goalMeasure and takes goalMeasure to list one goal’s plans. Core’s plan-goal.dlog writes it in one of two ways:

  • Stated. A plan’s own rules derive :statedGoalMeasure on the plan’s graph IRI. A stated goal always wins.
  • Inferred. Otherwise the plan’s graph is read for the KPI it works on (:planKpi): a campaign’s current or previous ROAS, or spend returning nothing, mean ROAS. The ontology graph maps each KPI to the goal measure keys that measure it (:roas :kpiGoalMeasure "roas", in core’s plan-goal-terms.ttl). When exactly one goal in the datastore has one of those keys, the plan works toward it. When two goals could claim the plan, it stays unlinked rather than guessed.

To link more plans, add the KPI facts a plan’s graph carries as a :planKpi rule, and the KPI’s measure keys as :kpiGoalMeasure data. A plan that names no goal belongs to none; a goal’s page then falls back to its workspace’s plans when the workspace holds that one goal.

Governance and members

Governance sets how far the workspace’s plans run on their own, so the agents app shows it only to people who manage shared memories: an operator, or a member with canManageSharedMemories. For everyone else it filters the entry whose id is governanceNavId out of the sidebar. The page stays mounted, and its trust ladder is read-only for them.

Paths without the screens

@manta-eu/react/screens/paths exports every screen’s path and its helpers (todayPath, goalsPath, newDeskPath, governanceNavId, isJoinPath, operatorPath and the rest) and none of the screens. Import it where you only compare or build addresses, such as a test, a worker or a sidebar filter, so they do not load the screens.

The signup and Getting started

Where people sign up on their own, someone with no organization gets the signup, JoinRoute from @manta-eu/react/screens/join. It saves the draft as they go and creates their workspace at the end. JoinAwaiting picks a signup back up after a reload, and shows its fallback when there is none. selfServeSignup() says whether the current realm signs people up this way.

import { JoinAwaiting, JoinRoute, selfServeSignup } from "@manta-eu/react/screens/join";

if (selfServeSignup()) return <JoinRoute userId={user.id} email={user.email} onSignOut={signOut} />;

// Signed in to an organization whose workspace is not ready yet:
<JoinAwaiting userId={user.id} email={user.email} onSignOut={signOut} fallback={<StillSettingUp />} />;

The signup calls these endpoints of the agent server, besides GraphQL:

  • /api/onboarding/draft: reads and saves the draft, and the new workspace’s follow-up work;
  • /api/website-check: checks the website address someone types;
  • /api/website-scrape and /api/website-analysis: read the website, for its name, colors and fonts.

Once the workspace opens, gettingStartedDatastoreRoutes() adds Getting started, which follows that follow-up work (invitations, goals, reading the website) and proposes a first action. Wrap the datastore routes in OnboardingReadinessProvider, keyed by the datastore, so Getting started and Today’s setup panel can read it:

import { OnboardingReadinessProvider } from "@manta-eu/react/screens/join";

<OnboardingReadinessProvider key={datastoreId}>{datastoreRoutes}</OnboardingReadinessProvider>;

Fit the signup to your app

SignupProvider sets what the signup and Getting started show. Mount it once, above both, with any of these props:

  • catalog: your integration catalog, keyed by provider as the Integrations page’s catalog is. The signup offers five sources (Google Ads, Meta, Google Analytics, LinkedIn and Shopify) and shows each with its entry’s name, description and logo. Without it, a source shows its name beside a badge of its first two letters.
  • renderBackdrop: draws behind the building screen and Getting started’s reasoning screen. It receives the draft, the sources it picked with their names, descriptions and logos (sources), what reading the website found (findings, websiteRead), the build’s progress (lines), the website’s host and whether the person asked for reduced motion. The agents app draws the knowledge graph on a globe there. Without it, the screens show no backdrop.
  • legalLinks: the terms and dataProcessing addresses the signup asks people to accept before it creates their workspace. Without it, they are Manta’s own: https://www.hiremanta.com/terms and https://www.hiremanta.com/dpa.
import { SignupProvider, type SignupBackdropProps } from "@manta-eu/react/screens/join";

function renderBackdrop(props: SignupBackdropProps) {
  return <GraphPicture draft={props.draft} sources={props.sources} still={props.reducedMotion} />;
}

<SignupProvider
  catalog={providerCatalog}
  renderBackdrop={renderBackdrop}
  legalLinks={{ terms: "https://example.com/terms", dataProcessing: "https://example.com/dpa" }}
>
  {app}
</SignupProvider>;

A backdrop that pulls in a large library, as the globe does with three.js, belongs in a chunk of its own: render a lazy component inside Suspense with no fallback, so people who never sign up never load it.

The operator dashboard

@manta-eu/react/screens/operator exports the dashboard across every client’s datastore. OperatorOverviewRoute is the page, at operatorPath, outside any datastore; OperatorHomeHost wraps the app so the picker and the sidebar know it; operatorLanding says whether an operator signing in lands on it. It calls /api/switch-datastore to move the session back to the realm’s own datastore. Opening a client lands on its Today, so mount the dashboard with Today’s set. Operator dashboard and workspace picker describes the providers underneath.

OperatorHomeHost gives the dashboard its own menu: Overview, Ask Manta at operatorChatPath, Datastores when datastore management is on, and for an operator who manages them, Users at operatorTeamPath (every organization’s people, outside any datastore) and Custom apps at operatorCustomAppsPath (every organization’s apps). Mount those pages with your global routes as the dashboard is. Inside a datastore, the grouped sidebar’s Under the hood lists Custom apps, which opens the apps page narrowed to that datastore’s organization.

import { getGlobalRoutes } from "@manta-eu/react/datastore-routes";
import { OperatorHomeHost, OperatorOverviewRoute, operatorPath } from "@manta-eu/react/screens/operator";
import { Route } from "react-router";

<OperatorHomeHost>
  {getGlobalRoutes(routeElements, <Route path={operatorPath} element={<OperatorOverviewRoute />} />)}
</OperatorHomeHost>;