Skip to main content

Module native_plugin

Module native_plugin 

Source
Expand description

Native Plugin System for VT Code Skills

This module provides support for loading native code plugins as skills using libloading. Native plugins offer high-performance, pre-compiled skill logic that can be discovered and loaded dynamically at runtime.

§Safety

Loading native code plugins requires careful security considerations:

  • Plugins are loaded from canonicalized trusted locations only
  • Plugin signatures can be verified (future enhancement)
  • Plugin execution is sandboxed where possible
  • VT Code serializes plugin FFI calls for ABI v1
  • All plugin operations go through VT Code’s tool system

§Plugin Structure

A native plugin skill consists of:

  • plugin.json - Metadata (name, description, version, author)
  • lib<name>.dylib (macOS) or lib<name>.so (Linux) or <name>.dll (Windows)
  • Optional: README.md, scripts/, templates/

§Plugin ABI

Plugins must export the following C-compatible symbols:

  • vtcode_plugin_version() - Returns ABI version
  • vtcode_plugin_metadata() - Returns plugin metadata JSON
  • vtcode_plugin_execute() - Main execution entry point

§Example

use vtcode_core::skills::native_plugin::{NativePlugin, PluginLoader};

let mut loader = PluginLoader::new();
let plugin = loader.load_plugin("/path/to/plugin").unwrap();
let result = plugin.execute(&input).unwrap();

Structs§

NativePlugin
A loaded native plugin
PluginContext
Plugin execution context passed to plugin functions
PluginLoader
Plugin loader responsible for discovering and loading native plugins
PluginMetadata
Plugin metadata structure
PluginMetadataFFI
C-compatible plugin metadata for FFI
PluginResult
Plugin execution result
PluginResultFFI
C-compatible plugin result for FFI

Constants§

PLUGIN_ABI_VERSION
Current plugin ABI version Increment this when breaking changes are made to the plugin interface

Traits§

NativePluginTrait
Native plugin trait for type-erased plugin operations

Functions§

validate_plugin_structure
Validate a plugin directory structure