# Kernel Plugins URL: /runtime/api/kernels Each kernel package exports a toolkit factory, its `plugin` alias for mechanical loading, and a role factory. ## Types [#types] **`KernelPlugin`** — Plugin registration for a CAD kernel. Returned by factory functions like `replicadKernel()`, `opencascadeKernel()`. The actual type includes a phantom generic for compile-time export schema type safety, which is omitted here for documentation clarity. - **`id`** (`string`, required) — Unique identifier for this kernel - **`extensions`** (`readonly string[]`, required) — File extensions this kernel handles (e.g., ['scad'], ['ts', 'js']). '*' is a catch-all. - **`detectImport`** (`RegExp | Readonly<{ source: string; flags: string; }> | undefined`, optional) — Regex to match against file content for kernel selection - **`builtinModuleNames`** (`string[] | undefined`, optional) — Bare-specifier module names this kernel provides for bundler-assisted detection - **`options`** (`Record | undefined`, optional) — Kernel-specific options passed to initialize() **`ReplicadOptions`** — Configuration for the Replicad kernel, controlling WASM variant, OC tracing, and edge rendering. - **`wasm`** (`"auto" | "single" | "multi" | ReplicadWasmConfig | undefined`, optional, default `'auto'`) — WASM build variant or custom build configuration. - `'auto'` (default) -- pick `'multi'` when `SharedArrayBuffer` is usable (Node 22+, or browsers with `crossOriginIsolated=true`); fall back to `'single'` otherwise. - `'single'` -- pthread-free build; works without COOP/COEP headers. - `'multi'` -- pthread-enabled build; requires SAB + cross-origin isolation. - `ReplicadWasmConfig` -- custom WASM/JS URLs for runtime injection (Node tooling). - **`ocTracing`** (`"off" | "summary" | "per-call" | undefined`, optional) — OC API call tracing mode. 'summary' (default) emits aggregated stats, 'per-call' emits individual spans. - **`libraryTracing`** (`KernelLibraryTraceMode | undefined`, optional) — Replicad library call tracing mode for user code. Defaults to `off`. - **`tessellationInstancing`** (`boolean | undefined`, optional, default `true`) — Reuse prototype tessellation for repeated transformed Replicad shapes. Temporary diagnostic flag. Set to `false` to force the legacy one-shape-one-tessellation path for benchmarks and regression isolation. - **`withSourceMapping`** (`boolean | undefined`, optional) — Load library source maps for enriched error stack traces. Adds ~50ms to init. Defaults to `false`. **`OpenCascadeOptions`** — Configuration options for the OpenCascade kernel plugin. - **`wasm`** (`"auto" | "multi" | "full" | OpenCascadeWasmConfig | undefined`, optional, default `'full'`) — WASM build variant or custom build configuration. - `'full'` (default) -- single-threaded, exceptions-enabled full libcascade build. - `'multi'` -- pthread-enabled full build; requires `SharedArrayBuffer` + cross-origin isolation (Node 22+, or browsers with `crossOriginIsolated=true`). Loads bindings from the `libcascade/multi` subpath and activates OCCT global parallelism after init. - `'auto'` -- pick `'multi'` when `SharedArrayBuffer` is usable, otherwise fall back to `'full'`. - `OpenCascadeWasmConfig` -- custom WASM/JS URLs for runtime injection. Defaults to `'full'`. Built-in variants resolve libcascade's exported WASM assets through `new URL(import.meta.resolve(...))`. Custom config keeps the explicit `wasmUrl` override path. - **`ocTracing`** (`"off" | "summary" | "per-call" | undefined`, optional) — OC API call tracing mode. `'summary'` (default) emits aggregated stats, `'per-call'` emits individual spans. **`ManifoldOptions`** — Configuration for the Manifold kernel, allowing custom WASM builds for benchmarking or CI. - **`wasmUrl`** (`string | undefined`, optional) — Override the default Manifold WASM URL for custom builds or benchmarking. **`ZooOptions`** — Zoo (KCL) kernel options. - **`baseUrl`** (`string | undefined`, optional) — WebSocket URL for the Zoo engine connection. - **`closeErrors`** (`Record | undefined`, optional) — Consumer-defined messages for private WebSocket close codes. - **`token`** (`string | undefined`, optional) — Zoo API token for direct connections. Browser-embedded tokens are visible to the browser environment. ## Packages [#packages] | Package | Kernel ID | Extensions | Role factory | | ---------------------------- | -------------------- | ------------------------------------ | ------------------------- | | `@taucad/replicad` | `replicad` | `ts`, `js` | `replicadKernel` | | `@taucad/opencascade` | `opencascade` | `ts`, `js` | `opencascadeKernel` | | `@taucad/manifold` | `manifold` | `ts`, `js` | `manifoldKernel` | | `@taucad/jscad` | `jscad` | `ts`, `js` | `jscadKernel` | | `@taucad/openrscad` | `openrscad` | `scad` | `openrscadKernel` | | `@taucad/zoo` | `zoo` | `kcl` | `zooKernel` | | `@taucad/gltf` | `gltf` | `glb`, `gltf` | `gltfKernel` | | `@taucad/brep` | `brep` | `step`, `stp`, `iges`, `igs`, `brep` | `brepKernel` | | `@taucad/rhino` | `rhino` | `3dm` | `rhinoKernel` | | `@taucad/assimp` | `assimp` | Explicit mesh/scene formats | `assimpKernel` | | `@taucad/opencascade-native` | `opencascade-native` | `ts`, `js` | `opencascadeNativeKernel` | | `@taucad/build123d` | `build123d` | `py` | `build123dKernel` | | `@taucad/picogk` | `picogk` | `cs` | `picogkKernel` | | `@taucad/picovoxel` | `picovoxel` | `ts`, `js` | `picovoxelKernel` | | `@taucad/tscircuit` | `tscircuit` | `tsx`, `jsx` | `tscircuitKernel` | No first-party kernel uses `'*'`. `@taucad/opencascade-native` targets Node hosts. `@taucad/openrscad` needs no twin: its engine binds the N-API addon or WebAssembly build by export condition, and `backend` says which. Build123d additionally requires an explicit packaged interpreter/resource manifest and a host-owned project trust marker; it never falls back to system Python. tscircuit offers separate board, schematic, and PCB views; see [tscircuit](/runtime/reference/tscircuit). ## Toolkit composition [#toolkit-composition] ```typescript import { defineRuntime } from '@taucad/runtime/worker'; import { esbuild } from '@taucad/esbuild'; import { replicad } from '@taucad/replicad'; export const runtime = defineRuntime({ plugins: [esbuild(), replicad()] }); ``` ## Configured composition [#configured-composition] Configure packaged kernels through their toolkits; use direct buckets for app-local capabilities, isolated tests, or whole-role ordering: ```typescript import { defineRuntime } from '@taucad/runtime/worker'; import { esbuild } from '@taucad/esbuild'; import { replicad } from '@taucad/replicad'; export const runtime = defineRuntime({ plugins: [esbuild(), replicad({ kernels: { default: { wasm: 'auto' } } })], }); ``` Backends load in the selected kernel's `initialize()` and live in its context. Kernels declare keyed `views` and `exports`, and `evaluate` returns the IDs currently offered. `render` projects a selected view from the retained handle; `export` produces files for a selected export. Toolkit namespaces never rewrite flat capability IDs. `@taucad/runtime/kernel` exports `createKernelError` for structured failures and `createKernelSuccess` for successes. ## Related [#related] * [Choose a Kernel](/runtime/guides/choosing-a-kernel) * [Plugin System](/runtime/concepts/plugin-system) * [Create a Custom Kernel](/runtime/guides/custom-kernel)