Leaf integration system
Every "linked thing" on an Open Register object — a meeting, a contact, a chat room, a wiki page — is a leaf. Each leaf implements the same provider contract on the backend and registers the same way on the frontend. The result: one sidebar tab pattern, one widget pattern, one admin page that lists every leaf with its health status. Apps install only the leaves they need; the rest stay hidden.
This page documents the system. Each leaf has its own page under Integrations.
What a leaf gives you
- A sidebar tab on every object detail page. One tab per registered leaf, filtered to the apps the user has installed.
- A dashboard widget in four surfaces: user-dashboard, app-dashboard, detail-page, single-entity. The same registration drives all four.
- A reference-property renderer. A schema property typed as
referenceType: '<leaf-id>'renders the linked entity inline inCnFormDialogandCnDetailGrid. - An admin row under Administration → Open Register → Integrations. Reports install state, auth status, storage strategy, and a deep-link to configure the upstream source.
- An OCS capability entry under
openregister.integrations.providers. Clients discover the registry surface without probing routes.
All of this for one provider class and one registry descriptor per leaf.
The 18 leaves Open Register ships
filesFiles attached to an object. Always available.
notesFree-form notes on an object. Always available.
tagsSystem tags on an object. Always available.
tasksTo-do items on an object. Always available.
audit-trailEvery change to an object. Read-only, always available.
sharesNC Share Manager-backed share visibility per object.
calendarCalDAV meetings linked to an object.
contactsvCard contacts linked to an object, with role.
emailLink existing NC Mail messages to an object.
talkTalk conversations linked to an object. Provider stub.
bookmarksNC Bookmarks linked to an object. Provider stub.
collectivesCollectives pages linked to an object. Provider stub.
mapsNC Maps locations linked to an object. Provider stub.
photosNC Photos linked to an object with EXIF metadata. Provider stub.
activityNC Activity events relevant to an object. Read-only stub.
analyticsNC Analytics reports linked to an object. Provider stub.
cospendNC Cospend projects/bills linked to an object. Provider stub.
deckNC Deck cards linked to or created from an object.
flowNC Flow rules scoped to a schema/object. Provider stub.
formsNC Forms responses linked to an object. Provider stub.
pollsNC Polls linked to an object. Provider stub.
time-trackerNC time tracking entries linked to an object. Provider stub.
xwikiXWiki pages linked to an object. Routed through OpenConnector.
openprojectOpenProject work packages. Routed through OpenConnector.
How a leaf is wired
Each leaf has three pieces. The provider is server-side; the registration is in @conduction/nextcloud-vue; the activation is in the consuming app's main.js. Every consuming app picks up every leaf automatically — there is no per-app glue.
1. PHP provider (openregister/lib/Service/Integration/Providers/)
class CalendarProvider extends AbstractIntegrationProvider
{
public function getId(): string { return 'calendar'; }
public function getLabel(): string { return $this->l10n->t('Meetings'); }
public function getIcon(): string { return 'Calendar'; }
public function getGroup(): ?string { return 'comms'; }
public function getRequiredApp(): ?string { return 'calendar'; }
public function getStorageStrategy(): string { return 'link-table'; }
public function isEnabled(): bool { return $this->appManager->isInstalled('calendar'); }
public function list(string $register, string $schema, string $objectId, array $filters=[]): array
{
return $this->calendarEventService->getEventsForObject(objectUuid: $objectId);
}
// get / create / update / delete as the storage strategy supports.
}
The provider is registered with the DI container in Application::register() and pushed onto the IntegrationRegistry in Application::boot(). Storage strategy is 'magic-column' | 'link-table' | 'external' | 'query-time' (AD-22).
2. Vue registration (@conduction/nextcloud-vue/src/integrations/builtin/leaves.js)
import CnIntegrationTab from '../../components/CnIntegrationTab/CnIntegrationTab.vue'
import CnIntegrationCard from '../../components/CnIntegrationCard/CnIntegrationCard.vue'
window.OCA.OpenRegister.integrations.register({
id: 'calendar',
label: t('myapp', 'Meetings'),
icon: 'Calendar',
group: 'comms',
requiredApp: 'calendar',
order: 20,
referenceType: 'calendar',
tab: CnIntegrationTab,
widget: CnIntegrationCard,
defaultSize: { w: 4, h: 3 },
})
The generic CnIntegrationTab + CnIntegrationCard drive every leaf until any individual leaf needs a bespoke component, at which point the registration's tab / widget is repointed at a dedicated Vue file (the xWiki leaf has its own CnXwikiTab / CnXwikiCard already).
3. App-side activation ({consuming-app}/src/main.js)
import {
installIntegrationRegistry,
registerBuiltinIntegrations,
registerLeafIntegrations,
} from '@conduction/nextcloud-vue'
installIntegrationRegistry()
registerBuiltinIntegrations() // 5 always-on (files, notes, tags, tasks, audit-trail)
registerLeafIntegrations() // 18 NC-app and external leaves
That's the full wiring. Three calls. Every leaf the user has the required NC app for shows up automatically.
Storage strategies
Leaves declare one of four storage strategies. The registry uses this to choose the dispatch path; the docs page for each leaf explains the specifics.
| Strategy | Where the link lives | Example leaves |
|---|---|---|
magic-column | A column on the object's table row. Cheapest. | Files |
link-table | A dedicated join table (openregister_{leaf}_links). | Notes, Tags, Tasks, Calendar, Contacts, Deck, Email |
external | Nowhere local. Routed through OpenConnector on every CRUD. | xWiki, OpenProject |
query-time | Nowhere local. Computed fresh on every list() call. | Audit trail, Activity, Shares |
'query-time' providers throw NotImplementedException on create() / update() / delete() per AD-22 — there is no local store to write to.
Required-app gating
Every NC-app-backed leaf declares its requiredApp. The registry filters in three stages (AD-5):
- PHP
isEnabled()— returns false when the required NC app isn't installed. The OCS capabilities response marks the leafenabled: false. - JS-side filter —
CnObjectSidebar :use-registryhonours the same gate. Disabled leaves don't render a tab. - Admin UI — the integrations page still lists disabled leaves so admins know what's available, with a "needs
<app>installed" message and an install hint.
Built-in leaves (files, notes, tags, tasks, audit-trail) and the shares core leaf return requiredApp: null — they ride on Open Register itself and are always available.
Collision policy (AD-13)
Re-registering an existing leaf id is a no-op in production (the first registration wins) and throws in development. So a consuming app can pre-register a leaf id with a bespoke tab / widget to override the generic pair without touching the library:
import CnMyAppCalendarTab from './components/CnMyAppCalendarTab.vue'
import CnMyAppCalendarCard from './components/CnMyAppCalendarCard.vue'
// Run this BEFORE registerLeafIntegrations() so the override wins.
window.OCA.OpenRegister.integrations.register({
id: 'calendar', // same id as the generic registration
label: t('myapp', 'Meetings'),
icon: 'Calendar',
group: 'comms',
requiredApp: 'calendar',
tab: CnMyAppCalendarTab, // bespoke
widget: CnMyAppCalendarCard, // bespoke
})
registerLeafIntegrations() // no-op on 'calendar' — first wins
This is how xWiki ships its richer CnXwikiTab (breadcrumbs, text-preview) on top of the same id: 'xwiki' slot.
Surfaces (AD-19)
Every leaf renders in up to four surfaces from the same registration. The widget component receives a surface prop and branches on it.
| Surface | Where it appears | Default behaviour |
|---|---|---|
detail-page | Object detail page | Full linked-list with row actions |
user-dashboard | Personal Open Register dashboard | Compact list, max 5 entries |
app-dashboard | Per-app dashboard widget | Compact list, scoped to the app |
single-entity | A schema property of type reference with referenceType: '<id>' | A chip resolved by id |
The registration descriptor can pass surface-specific overrides (widgetCompact, widgetExpanded, widgetEntity); absent overrides fall back to the main widget.
Cross-app leaf registration (sibling apps)
The 18 built-in leaves register inside Open Register's own boot(). A sibling
Nextcloud app contributes its own leaf through a typed collect-event —
RegisterLeafProvidersEvent — the same idiom Open Register already uses for MCP
tool providers and flow nodes (ADR-066). This is the umbrella "apps hook
themselves into Open Register" seam, and it is render-and-read only by
construction: a leaf can contribute a render surface and/or app-local data, but
never a command. Cross-app commands stay ADR-041 typed events.
A leaf has two faces, correlated by a shared id:
- Server declaration — a
LeafDescriptor(id, label, icon, requiredApp, group, surfaces, referenceType, requiresPermission, and a non-emptykindsset) plus, when the leaf offers data, anIntegrationProvider. The descriptor carries no Vue components. - JS registration —
registerIntegration({ id, tab, widget, … })from@conduction/nextcloud-vue, under the same id. The render components live in the app's own bundle.
The kinds set names each face independently:
| Kind | Meaning |
|---|---|
render-surface | The app mounts a tab + widget under the shared id (JS layer). |
data-provider | The app serves read/append data via an IntegrationProvider on the same registration. |
agent-runner | Reserved forward-reference (ADR-066); assigned no behaviour here — hermiq's change consumes it. |
The app-local storage strategy
Data leaves declare a new storage strategy — app-local — alongside the
existing magic-column / link-table / external / query-time. It means the
data lives in the contributing app's own store; Open Register persists none
of it and simply routes list() / optional create() to the provider, which
runs in the sibling app's DI context because the app's listener constructed it
there.
Worked example — a notes leaf
// In the sibling app's Application::register():
$context->registerEventListener(
RegisterLeafProvidersEvent::class,
AcmeLeafListener::class,
);
// AcmeLeafListener::handle(). `identity` and `kinds` are required;
// `availability` (requiredApp, requiresPermission) and `rendering` (surfaces,
// referenceType, renderMode, loadStrategy) default to always-available and an
// SFC render surface with no surfaces.
$event->registerLeaf(
new LeafDescriptor(
identity: new LeafIdentity(id: 'acme-notes', label: $this->l10n->t('Notes'), icon: 'NoteText'),
kinds: [LeafDescriptor::KIND_DATA_PROVIDER, LeafDescriptor::KIND_RENDER_SURFACE],
availability: new LeafAvailability(requiredApp: 'acme'),
rendering: new LeafRendering(surfaces: ['detail-page']),
),
// A provider whose getStorageStrategy() returns 'app-local'.
// list() reads the app's notes for the object; create() appends one.
// A read-only leaf omits create() and lets the base class throw
// NotImplementedException — exactly as query-time providers do.
$this->container->get(AcmeNotesProvider::class),
);
The leaf then appears in the OCS capabilities surface under
openregister.integrations.leaves (id, label, requiredApp, surfaces, kinds,
usability) so admin UI and manifest apps discover it without loading the app's
JS bundle. A throwing listener costs only its own leaf; duplicate ids follow
ADR-013 first-wins, which is why ids are namespaced (acme-notes, not notes).
See ADR-019 (registry render/link), ADR-041 (cross-app commands via events), ADR-013 (first-wins collision), and ADR-066 (cross-app leaf registration — the render-and-read boundary).
Leaf or IReferenceProvider?
Nextcloud ships its own cross-app read mechanism,
OCP\Collaboration\Reference\IReferenceProvider. The two coexist; they
answer different questions, so pick by the shape of what you are building:
| You are building… | Use |
|---|---|
| An object-scoped collection of your app's own items on an Open Register object ("all of app X's notes on this object"), optionally with an append, and/or a tab + widget on the object | a data-provider leaf |
| A read-only rich preview of a single URL or text token inside free text (Talk, Text, comments), with no Open Register object and no collection | an IReferenceProvider |
- Never use a data-provider leaf for a stateless URL or text preview: a
leaf keys on a register, schema and object id and returns a collection; a
bare URL preview has none of those. Reviewers redirect it to an
IReferenceProvider. - Never use an
IReferenceProviderto expose an object-scoped collection or any append:resolveReference()returns one read-onlyIReferenceand the contract has no write.
The one overlap — rendering a single read-only linked entity identified by a
URL or id — resolves by context. When it hangs off an Open Register object as
that object's linked-entity card (a schema property with a referenceType), it
is the leaf single-entity surface. When it is an inline preview of a bare URL in
text, it is an IReferenceProvider. Do not implement it twice for the same
surface. There is no adapter between the two mechanisms; a bridge that lets a
reference also render as the leaf single-entity surface is a possible future
option and does not exist today.
See the openspec change leaf-reference-provider-convergence for the full
capability comparison and rationale.
Render modes — component and mount
A render-surface leaf declares how it renders through renderMode on its
LeafRendering (LeafDescriptor::RENDER_MODE_COMPONENT or
LeafDescriptor::RENDER_MODE_MOUNT):
renderMode | The leaf ships | Use it when |
|---|---|---|
component (default) | an SFC tab + widget, interpreted by the host's Vue runtime | the leaf is built against the same Vue major as the host, or is a built-in |
mount | a mount(el, props) + unmount(el) pair; the host hands it a bare container element and the leaf renders into it with its own framework | the leaf is built against a different Vue major than the host (a Vue 3 app on a Vue 2.7 host page) |
An SFC compiled by one Vue major cannot be rendered by another, so a cross-major
leaf must use mount. The two functions travel as a pair: unmount(el) must
release the leaf's framework instance and listeners, because the host calls it
on hide, on teardown and before re-mounting when the object changes.
rendering: new LeafRendering(
surfaces: ['detail-page'],
renderMode: LeafDescriptor::RENDER_MODE_MOUNT,
),
The JS registration under the same id must declare the same renderMode. The
integration parity gate in @conduction/nextcloud-vue reads the JS side;
LeafRenderModeParity compares it with the server side: given the JS render
modes keyed by leaf id, mismatches() lists every render-surface leaf whose two
values differ, and violations() gives one report line per mismatch. A JS
registration that states no renderMode counts as component, and a leaf known
to one layer only is left to the tab/widget half of parity. An unknown renderMode is rejected
at registration and only that leaf is skipped. renderMode is reported per leaf
on openregister.integrations.leaves, so a manifest app or admin UI can see how
a leaf renders without loading its JS. A mount leaf is still render-and-read
only: it invokes no command in the host (ADR-041).
What to read next
- xWiki leaf — the worked external example (OpenConnector-backed).
- Calendar leaf — the worked NC-native example (CalDAV link-table).
- Pluggable integration registry reference — the full ADR-019 contract.
- Verification report — live status for all 24 advertised providers from the smoke harness.
- Build your own leaf —
scripts/scaffold-integration.sh <id>in the openregister repo generates the openspec change, PHP provider stub, and JS registration stub.
Pre-register an id before registerLeafIntegrations() and you can ship a bespoke Vue tab / widget for any leaf. The library never clobbers an existing registration.