definePlugin( )
Helper function to define a plugin with full type inference. This is an identity function that provides type checking.
function definePlugin(plugin: T): T
| Name | Type | Required? | Description |
|---|
plugin | T | ✓ | The plugin definition object conforming to the QvacPlugin interface |
| Field | Type | Description |
|---|
addonPackage | string | The npm package name of the native addon this plugin wraps |
createModel | (params: CreateModelParams) => PluginModelResult | Factory function called when a model is loaded. Receives resolved config and model path, returns the model instance and its capabilities |
displayName | string | Human-readable name shown in logs and UI |
handlers | Record | Map of handler names to PluginHandlerDefinition objects that define the plugin's RPC endpoints |
loadConfigSchema | ZodType | Zod schema used to validate and parse the modelConfig passed to loadModel() |
logging | PluginLogging | Configuration for plugin-level logging (log forwarding, verbosity) |
modelType | string | The model type identifier (e.g. "llm", "whisper", "tts") |
resolveConfig | (modelConfig: TConfig, ctx: ResolveContext) => Promise<ResolveResult<TConfig, TArtifactKeys>> | Optional hook to resolve model sources in modelConfig to local paths. |
| Called before createModel if the plugin needs to download/resolve artifacts. | | |
| Returns transformed config and optional artifact paths. | | |
skipPrimaryModelPathValidation | boolean | When true, skips file-existence validation for modelPath. Use for plugins that derive paths from config. |