QVAC Logo

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

Parameters

NameTypeRequired?Description
pluginTThe plugin definition object conforming to the QvacPlugin interface

Returns

T
FieldTypeDescription
addonPackagestringThe npm package name of the native addon this plugin wraps
createModel(params: CreateModelParams) => PluginModelResultFactory function called when a model is loaded. Receives resolved config and model path, returns the model instance and its capabilities
displayNamestringHuman-readable name shown in logs and UI
handlersRecordMap of handler names to PluginHandlerDefinition objects that define the plugin's RPC endpoints
loadConfigSchemaZodTypeZod schema used to validate and parse the modelConfig passed to loadModel()
loggingPluginLoggingConfiguration for plugin-level logging (log forwarding, verbosity)
modelTypestringThe 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.
skipPrimaryModelPathValidationbooleanWhen true, skips file-existence validation for modelPath. Use for plugins that derive paths from config.

On this page