Config-driven modules
How a module's list, record, create page and tabs come from one surface config, and what stays custom.
Most dashboard screens are drawn from a surface: one typed config per model, declared with defineSurface() in packages/types/src/surface/. The UVA host in the dashboard reads it and draws the list, the record page and the create page. Nobody writes a table or a form for a module that fits the config.
The config says what a screen contains. The host and the shared components decide how it looks, so every module gets the same toolbar, search, filters, record layout and spacing.
What one surface declares
| Part | What it drives |
|---|---|
fields | Types, labels, required / read-only, pickers (many2one, widget: "user", …), option labels |
list | Default and optional columns, default order, bulk row actions (rowActions), export, empty state |
form.groups | The record page. Groups with the same tab are titled sections on one tab |
form.buttons | Record-header buttons such as Suspend or Delete |
search | Quick-search fields, named filters, group-by. Ticked filters that share a field show either one's rows; filters on unrelated fields narrow. A set of filters whose union can't be written as one AND-domain fails filter-union.catalogue.test.ts, so give the surface one field that names the thing (stock.picking kind) |
newTarget | Where New goes: the generic form, a handwritten editor, or an action dialog |
menu | Launcher tile, top-bar tabs (sections), Config dropdown (config) |
permission, tool | The permission token for each door, and the @AgentTool names the Concierge uses |
The server side is one adapter per surface (ISurfaceAdapter: search, create, write, call) that calls the module's existing service. A surface that names a table gets a generated adapter instead.
Tabs inside a module
A module's top-bar tabs are its menu.sections. An entry is either a link or another surface embedded as a tab:
menu: {
module: "members",
label: "members.surface.model",
order: 10,
sections: [
{ label: "Members", href: "" },
{ label: "Teams", surface: "org.team", slug: "teams" },
],
},/dashboard/members/teams then lists teams, /teams/new creates one and /teams/<id> opens one, all from the org.team surface. config entries use the same shape and appear in the Config dropdown instead.
The launcher tile in apps/dashboard/lib/dashboard-modules.ts must carry navKey (or module) equal to the surface's moduleKey. Without it the top bar never reads the tabs.
Human-only surfaces
Some doors must never be an agent tool: sending invites, credentials, editing or deleting teams. Declare humanOnly: { reason } with the same text as the controller's @NotAgentTool, and bind HUMAN_ONLY_TOOL on create, write and every button. The UI keeps the doors; the Concierge never sees them. search may still bind a real read tool.
What stays custom
The config covers tables, forms, records, filters and tabs. A screen adds React only for what the config has no slot for, and composes it into the host rather than replacing it:
- List leftovers add a toolbar strip or a panel under the list.
- Record leftovers add slots into a named section (
sectionComposes), inline beside its fields or as a block, or above the tabs (banner). The member page uses this for Message, Log in as, the teams picker and "Works with". The task page uses it for the workflow, timesheets and comments.
Dashboards, boards, Gantt charts and wizards are custom pages declared as editor doors on the surface, so they are known routes, not orphans.
Worked example: Members
| Config | Page |
|---|---|
org-member.ts | /dashboard/members list and /dashboard/members/<id> record; tabs Members + Teams; New → invite |
org-team.ts (human-only) | Teams tab: list, New team, edit, delete |
org-invite.ts (human-only) | /dashboard/members/invite: one email field; saving sends the invite |
Adapters: apps/server/src/members/member-surface.adapter.ts, team-surface.adapter.ts, and apps/server/src/org-invites/invite-surface.adapter.ts. Each is registered against its token in surface-adapter-tokens.ts.
Adding or changing a surface
- Write or edit the file in
packages/types/src/surface/. Put its strings inen.jsonandit.json(or the surface'si18nblock). - Add the adapter and its token on the server, unless the surface names a
table. - Register the dashboard module in
apps/dashboard/src/modules/. - Build and check:
pnpm surfaces:generate
pnpm --filter @metanow-console/types build
pnpm --filter @metanow-console/uva build
pnpm verify:surfaceverify:surface fails on a missing tool, field, editor page or translation. Restart the API and dashboard dev servers afterwards; neither picks up rebuilt packages on its own.
If the surface adds a new permission token, the surface controller's pasted permission unions must be updated too. surface-doors.spec.ts fails until they are.