Skip to content

Frontend runtime API

Cove loads extension frontend bundles as ESM and provides a versioned set of host modules. Import from this runtime instead of bundling another copy of React or reaching into Cove’s internal source tree.

The current runtime contract is v1. Cove supplies that value in the aggregated UI manifest; UIManifestBuilder.WithRuntimeVersion does not select a different runtime. Treat every import not listed on this page as private implementation detail.

Use the @cove/runtime/* specifiers in extension source:

ModuleProvides
@cove/runtime/reactReact
@cove/runtime/react-domReact DOM
@cove/runtime/react-dom-clientReact DOM client APIs
@cove/runtime/react-jsx-runtimeProduction JSX runtime
@cove/runtime/react-jsx-dev-runtimeDevelopment JSX runtime
@cove/runtime/react-queryTanStack Query
@cove/runtime/lucide-reactLucide React icons
@cove/runtime/componentsCove’s public shared component and hook barrel
@cove/runtime/apiAuthenticated requests to Cove APIs

Cove still maps the corresponding bare third-party specifiers for older bundles, but new bundles should use the namespaced runtime imports. Configure the extension build to leave runtime modules external so Cove and the extension share the same React tree and host libraries.

Import extensionFetch from the API module:

import { extensionFetch } from "@cove/runtime/api";
export async function loadSummary() {
const response = await extensionFetch("/api/ext/com.example.reports/summary");
if (!response.ok) {
throw new Error(`Request failed with ${response.status}`);
}
return response.json();
}

Its signature is:

function extensionFetch(input: string, init?: RequestInit): Promise<Response>;

extensionFetch accepts only same-origin URLs whose path is /api or starts with /api/. Relative forms such as api/ext/... are normalized against the current Cove origin. Cross-origin URLs and non-API paths throw a TypeError before a request is sent.

The helper sends the current bearer or share credentials, uses Cove’s normal access-token refresh and single retry behavior, and returns the standard Response. It forces redirect: "error" so an API request cannot follow a redirect outside the allowed boundary.

Authentication transport does not grant access. Protect the extension endpoint with the appropriate server-side convention from Extension permissions, and handle expected 401, 403, and application errors in the component.

Import public UI building blocks from one barrel:

import {
MediaDetailLayout,
DetailListToolbar,
DetailListPagination,
RelatedEntityListView,
TagBadge,
} from "@cove/runtime/components";

The v1 barrel groups these exports:

AreaPublic exports
Detail and list compositionMediaDetailLayout, DetailListToolbar, DetailListPagination, ListPage, RelatedEntityListView, getRelatedEntityDisplayModes, FilterButton, FilterDialog, VIDEO_CRITERIA, BulkEditDialog, getDefaultFilter, Pager, VIDEO_SORT_OPTIONS
Entity display and mediaPopoverButton, VideoCardPopovers, PerformerTile, VideoCard, VideoTile, ImageTile, VideoPlayer, Lightbox
Forms and dialogsConfirmDialog, EditModal, Field, TextInput, TextArea, NumberInput, SelectInput, SaveButton, ImageInput
RatingsInteractiveRating, RatingBadge, RatingBanner, RatingField, getRatingBannerColor, convertToRatingFormat, convertFromRatingFormat, formatDisplayRating, getRatingMax, getRatingStep, getRatingInputLabel, normalizeRatingOptions, defaultRatingSystemOptions
Utilities and custom fieldsTagBadge, formatDuration, formatFileSize, formatDate, getResolutionLabel, CustomFieldsDisplay, CustomFieldsEditor
Host integrationopenTutorialStoryboard, registerManualContext, useManualContext, useMultiSelect, useKeySequence, useListUrlState, useAppConfig
TypesMediaDetailLayoutProps, MediaDetailTab, MediaDetailSectionProps, LightboxImage, DisplayMode, CriterionDefinition, TutorialOpenRequest, FindFilter

The table groups helper families for readability. Check the matching runtime type declarations when a helper has several arguments.

MediaDetailLayout gives extension pages the same responsive shell used by Cove detail pages. Its required title prop accepts a React node. Optional props cover:

  • navigation with backLabel and onGoBack
  • the media region, its aspect ratio and position, sticky behavior, and full-bleed rendering
  • a header image, actions, and engagement controls
  • sidebar or header tabs with an active key and change callback
  • keyboard shortcuts, loading state, errors, and child content

MediaDetailTab describes each tab with a stable key, label, and optional icon, count, disabled state, and manual contexts. MediaDetailSectionProps is the small typed wrapper contract for section children and an optional class name.

DetailListToolbar composes Cove’s result count, search, sorting, filter dialog, saved filters, selection controls, display modes, zoom, and paging controls around a FindFilter. Supply only the capabilities the embedded list supports; the required props are filter, onFilterChange, totalCount, and sortOptions.

Use DetailListPagination when the pager belongs below the results instead of inside the toolbar:

<DetailListPagination
filter={filter}
onFilterChange={setFilter}
totalCount={totalCount}
/>

It also accepts allowInfinitePageSize, infinitePageSizeOnly, showPagingControls, and className.

These primitives provide Cove’s current UI behavior, but the extension still owns its data query, empty and error states, and permission handling. Prefer host CSS variables and shared components over copying internal markup or Tailwind classes that are not part of this barrel.

Runtime modules are a host contract, not dependencies embedded in the extension archive. Set minCoveVersion to the oldest Cove release on which every imported runtime export has been tested. Adding an import introduced by a newer Cove release raises that practical compatibility floor even when the extension’s backend contract is unchanged.

Keep a package’s frontend imports and its declared compatibility floor in sync, then test installation and the rendered contribution on that minimum version. See Package an extension for how installers enforce minCoveVersion and UI extension points for where components can be mounted.