Dominevo
Develop

Add a capability

When a new *.cap.ts is justified, codegen, method auth tiers, and what must ship in @dominevo/server.

Authoritative checklist: server skill add-capability.

Do you need a new cap?

Prefer existing surfaces:

  • List providers → addons.listCapabilityProviders
  • Integration or connection configuration → an integration-instances record. See Build an integration
  • Enable/disable a provider → addons.setCapabilityProviderEnabled
  • Additive field on an existing method → redeploy the providing addon only

A new capability is a framework change: codegen + a published @dominevo/server before production nodes see the router.

Define it

packages/types/src/capabilities/<name>.cap.ts — name, scope (system | device), mode (singleton | collection), methods with Zod I/O and auth / kind.

The existing device capabilities, with their methods, state and events, are listed in Device capabilities.

Then:

npm run codegen

Wire the provider with registerNativeCap / the addon registration path your kind uses. Export from the types barrel if codegen does not already.

A device cap with a derived UI

A device capability of the camera-settings kind declares a deviceConfig block and implements only getOptions, getStatus and the set* methods. The framework derives the device-page section and the save routing, so you never write getDeviceSettingsContribution, getDeviceLiveContribution or applyDeviceSettingsPatch.

export const dayNightCapability = {
  name: 'day-night',
  scope: 'device',
  mode: 'singleton',
  deviceTypes: [DeviceType.Camera],
  deviceConfig: {
    ui: { kind: 'derived-form', builderId: 'day-night', tab: 'image' },
  },
  // getOptions (what THIS camera supports), setSettings (a partial patch) …
}

ui is either a derived-form (a generated form from a registered pure builder) or a widget (one embedded component that saves through the cap's own mutations). getOptions must be honest, probed from the device: the UI shows only what you declare. deviceConfig and exposesDeviceSettings are mutually exclusive.

Auth and tiers

Method auth is pinned in CI (check-method-tiers). Device actuation is usually protected (device grant), not admin-only. Do not invent a parallel permission model in the addon.

Then