Plugin Helpers
Generated from crates/node/dist/plugin.d.ts.
Import from nemo-relay-node/plugin.
Plugin configuration, validation, activation, and registration helpers.
Interfaces
ConfigPolicy
Handling for unknown or unsupported plugin configuration.
ComponentConfigs
OpenComponentSpec
Component created by ComponentSpec for a kind registered with registerPlugin.
PluginConfig
Plugin configuration document.
Plugin
Callbacks a plugin kind provides.
Functions
defaultConfig
Creates an empty plugin configuration.
The document has version 1 and no components. Add components to it, then pass it to validate or initialize.
Returns
A plugin configuration with no components.
Remarks
Editing the returned object changes nothing until it is passed to initialize.
ComponentSpec function
Creates one component entry for PluginConfig.components.
For a built-in kind, config is checked against that kind’s config type. For a kind registered with register, config is any JSON object.
Parameters
kind: Plugin kind name.config: Config handed to the plugin’s hooks.options:enabledcontrols whether the component activates.
Returns
A component entry for a plugin configuration.
Remarks
With enabled false, initialize validates the component but does not activate it.
ComponentSpec function
initialize
Initializes the plugin host and activates the configured plugins.
The system and user plugins.toml files are merged first and config is applied on top of them.
Parameters
config: Programmatic configuration. Its values override the files.additionalPluginsToml: Path of one moreplugins.tomlto merge. If the file is missing, the report carries aplugin.configuration_file_missingwarning.
Returns
The activation, which holds the host report.
Remarks
Plugin callbacks run only while the activation is alive. End it with close() or await using.
validate
Validates the plugin host configuration without loading plugin code.
The files and config are merged exactly as initialize merges them, and the merged result is checked.
Parameters
config: Programmatic configuration. Its values override the files.additionalPluginsToml: Path of one moreplugins.tomlto merge. If the file is missing, the report carries aplugin.configuration_file_missingwarning.
Returns
The report for static components and dynamic plugins.
Remarks
Nothing is activated and no host lease is taken.
validateExact
Validates one plugin configuration document by itself.
No plugins.toml file is read or merged, so config must be the whole document.
Parameters
config: Complete plugin configuration.
Returns
The report for the static components in config.
Remarks
Host-only diagnostics settings are rejected here. Use validate to check them.
listKinds
Lists the plugin kinds in the registry.
A plugin configuration can reference any of these kinds.
Returns
The registered plugin kind names.
Remarks
A registered kind is not necessarily active in the current configuration.
register
Registers a plugin kind implemented in JavaScript.
plugin.validate runs when a configuration is validated. plugin.register runs when initialize activates a component of this kind.
Parameters
pluginKind: Unique plugin kind name.plugin: Thevalidateandregisterhooks.
Returns
Nothing.
Remarks
Without plugin.validate, any config for this kind passes validation.
deregister
Removes a plugin kind from the registry.
Configurations validated or initialized after this call cannot reference the kind.
Parameters
pluginKind: Name the kind was registered under.
Returns
true if the kind was registered, false if it was not.
Remarks
Components of this kind that are already active keep running until their activation closes.
Type Aliases
UnsupportedBehavior
How unsupported configuration is handled.
ComponentKind
KnownComponentSpec
OpenComponentConfig
Config returned by ComponentSpec for a kind registered with registerPlugin.
ComponentSpecFor
ComponentSpec type alias
One plugin component.
Re-exports
ConfigDiagnosticConfigReportDynamicPluginCheckStateDynamicPluginFailureDynamicPluginKindDynamicPluginValidationReportDynamicPluginValidationStatusEventMetadataEventMetadataScalarEventMetadataValueLlmApplicationExecutionContextLlmCodecIdentityLlmExecutionContextLlmOptimizationContributionLlmOptimizationDataSchemaLlmOptimizationModelLlmOptimizationModelTransitionLlmOptimizationTokenImpactLlmOptimizationTokensLlmRequestContextLlmRequestInterceptOutcomeLlmResponseContextLlmSanitizeRequestContextLlmSanitizeResponseContextPluginContextPluginHostActivationPluginHostReportRuntimeDiagnosticToolExecutionInterceptOutcome