QVAC Logo

definePlugin( )

Helper function to define a plugin with full type inference.

function definePlugin<T extends QvacPlugin>(plugin: T): T;

Parameters

NameTypeRequired?Description
pluginQvacPluginThe plugin definition

QvacPlugin

FieldTypeRequired?Description
modelTypestringUnique identifier for the model type this plugin handles
displayNamestringHuman-readable name for the plugin
addonPackagestringThe npm package name of the addon this plugin wraps
createModel(params: CreateModelParams) => PluginModelResultFactory function that creates a model instance
handlersRecord<string, PluginHandlerDefinition>Map of handler names to handler definitions
loggingPluginLoggingOptional logging configuration

CreateModelParams

FieldTypeRequired?Description
modelIdstringThe model identifier
modelPathstringPath to the model file
modelConfigRecord<string, unknown>Model-specific configuration
modelNamestringHuman-readable model name
artifactsRecord<string, string>Additional file paths (e.g., projectionModelPath, vadModelPath, ttsConfigModelPath)

PluginModelResult

FieldTypeDescription
modelPluginModelThe model instance
loaderunknownEngine-specific loader reference

PluginModel

MethodSignatureRequired?Description
load(force?: boolean) => Promise<void>Loads the model into memory
unload() => void | Promise<void>Releases model resources

PluginLogging

FieldTypeRequired?Description
moduleunknownThe addon logging module
namespacestringLogger namespace

Returns

T — The same plugin object, with full type inference applied. This is an identity function used for type checking.

Note

See the Write a custom plugin guide for a full walkthrough.

On this page