All files / src/mcp-runtime component-scope.ts

100% Statements 2/2
100% Branches 0/0
100% Functions 0/0
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38                                              1x                         1x  
/**
 * Curated, context-free presentational components exposed to agent JSX in the
 * GenUX runtime (#1268). Kept in its own module (no `main()` side effect) so the
 * built-in catalog drift test can import the scope without booting the runtime.
 *
 * Phase 0 keeps this a small, safe set — components that need router or
 * `useGrackle()` context are excluded. The discoverable catalog of these lives in
 * `@grackle-ai/common` `BUILTIN_COMPONENTS` (#1271); a test asserts that catalog
 * stays a subset of these names.
 */
// Import the curated components from their direct module files (NOT the package
// barrel `../index.js`): the barrel transitively pulls DagView -> @dagrejs/dagre,
// whose ESM entry vitest can't resolve, which broke this module's test. Direct
// imports keep the runtime scope (and its drift test) dependency-light.
import { Button } from "../components/display/Button.js";
import { SplitButton } from "../components/display/SplitButton.js";
import { Spinner } from "../components/display/Spinner.js";
import { Skeleton, SkeletonText, SkeletonCard } from "../components/display/Skeleton.js";
import { Tooltip } from "../components/display/Tooltip.js";
import { CopyButton } from "../components/display/CopyButton.js";
import { Callout } from "../components/notifications/Callout.js";
 
/** Component name → component, injected into the react-live evaluation scope. */
export const COMPONENT_SCOPE: Readonly<Record<string, unknown>> = {
  Button,
  SplitButton,
  Callout,
  Spinner,
  Skeleton,
  SkeletonText,
  SkeletonCard,
  Tooltip,
  CopyButton,
};
 
/** Names of the curated components available to agent JSX (the catalog must stay a subset). */
export const CURATED_COMPONENT_NAMES: readonly string[] = Object.keys(COMPONENT_SCOPE);