Skip to content

Plugin System Detailed Guide

📋 Table of Contents


🌟 Plugin System Overview

Aiverything Plugin System is a powerful extension framework that allows users to enhance the search tool's functionality by installing plugins. The plugin system adopts a modular design, supports multiple technology stacks, and provides unlimited extension possibilities for users.

Core Features

  • 🔌 Modular Architecture - Plugins run independently without interfering with each other
  • 🎨 Flexible Interface - Supports both embedded and standalone window display modes
  • 🔧 Hot Swapping - Supports dynamic loading and unloading of plugins
  • 📦 Package Management - Complete plugin lifecycle management
  • 🛡️ Security Isolation - Plugins run in independent secure environments

Plugin System Advantages

  1. Functionality Extension: Implement personalized needs through plugins
  2. Easy to Use: Simple installation and management process
  3. Performance Optimization: Load on demand, does not affect main program performance
  4. Developer Friendly: Complete SDK and development documentation support

🔍 Plugin Management

Entering Plugin Mode

plugin mode

Operation Steps:

  1. Open Aiverything main interface
  2. Enter > symbol in the search box
  3. Enter plugin name or keywords to search
  4. System will automatically switch to plugin mode and display matching plugin list
> [Plugin name or keywords]

Examples:

>action          # Search for Action plugin
>terminal        # Search for Terminal plugin

Plugin Browse Interface

plugin info

View Plugin Information Steps:

  1. After entering plugin mode, browse the plugin list
  2. Each plugin item displays basic information: icon, name, description
  3. View plugin version number and compatibility information
  4. Click plugin item to view more detailed information

Plugin mode interface contains the following information:

  • Plugin Icon: Visual identifier of the plugin
  • Plugin Name: Display name of the plugin
  • Plugin Description: Brief description of plugin functionality
  • Version Information: Current plugin version number

📦 Plugin Installation and Usage

Plugin Installation Process

plugin market

Steps to Enter Plugin Marketplace:

  1. Click the "Plugin Marketplace" button at the bottom of the taskbar menu or plugin settings left sidebar
  2. Browse all available plugin category lists
  3. Use search function to quickly find target plugins

plugin market detail

Detailed Plugin Installation Steps:

  1. Find the desired plugin in the plugin marketplace
  2. Click the plugin card to view detailed information
  3. Read plugin description, version information, and user reviews
  4. Click the "Install" button to start downloading
  5. Wait for installation completion, system will display installation status
  6. After successful installation, the plugin will be automatically added to your plugin list

Plugin Usage Methods

plugin page

Detailed Steps to Use Plugins:

  1. Enter > in the search box to enter plugin mode
  2. Enter plugin name or keywords to search
  3. Select the plugin you want to use from search results
  4. Follow the plugin interface prompts for specific operations

Embedded Plugin Usage

Embedded plugins display directly within the search interface:

Standalone Window Plugin Usage

Standalone window plugins will open new windows:

>notepad            # Open notepad plugin

Plugin Management Operations

plugin settings

Detailed Plugin Management Steps:

  1. Click the settings button to enter plugin management interface
  2. View installed plugin list and status
  3. Specific plugin management operations:
    • Configuration Settings: Click settings icon to configure plugin parameters
    • Uninstall Plugin: Click delete button to remove unwanted plugins
    • Update Plugin: Check and install plugin updates

❓ Frequently Asked Questions

Plugin Installation Issues

Q: What to do if plugin installation fails?

A: Troubleshooting Steps

  1. Check Network Connection

    • Ensure network connection is normal
    • Check firewall settings
  2. Check System Requirements

    • Confirm plugin compatibility
    • Check if dependencies are met
  3. Clear Cache

    • Clear plugin download cache
    • Retry installation
  4. Permission Check

    • Ensure sufficient system permissions
    • Try running as administrator

Q: Plugin cannot start?

A: Solutions

  1. Check Java Environment (Java plugins)

    • Check Java version compatibility
  2. View Plugin Logs

    • Open plugin log files
    • Look for error information
  3. Reinstall Plugin

    • Uninstall problematic plugin
    • Re-download and install

Plugin Performance Issues

Q: Plugin running slowly?

A: Optimization Suggestions Resource Monitoring

  • Check plugin resource usage
  • Close unnecessary plugins

📞 Getting Help and Support

Official Support Channels

  1. Plugin Documentation: https://docs.aiverything.me/plugins/
  2. GitHub Issues: https://github.com/aiverything/plugins/issues
  3. QQ Developer Group: 893463594

Community Resources

  • Plugin Templates: Open source template projects on GitHub
  • Code Examples: Official example code repository

Technical Support

If you encounter problems during plugin development or usage:

  1. Check Documentation: First refer to official documentation and API descriptions
  2. Search Forums: Search for similar issues in developer forums
  3. Submit Issue: Create new issue reports on GitHub
  4. Contact Support: Contact technical support through official channels

Thank you for using the Aiverything Plugin System! We look forward to seeing you create more excellent plugins and provide better experiences for users.


🔧 Plugin Development Guide

Development Environment Setup

Prerequisites

  • Java Development Kit: JDK 21 or higher
  • Node.js: For web-based plugin development
  • Aiverything SDK: Development toolkit and APIs

1. Install SDK

bash
# For Java plugins
mvn dependency:add com.aiverything:plugin-sdk:1.0.0

# For web plugins
npm install @aiverything/plugin-sdk

2. Create Plugin Project

bash
# Using Aiverything CLI
npx @aiverything/cli create-plugin my-awesome-plugin
cd my-awesome-plugin

3. Project Structure

my-plugin/
├── plugin.json          # Plugin manifest
├── src/
│   ├── main/
│   │   ├── java/        # Java source files
│   │   └── resources/   # Resources and assets
│   └── web/             # Web UI components
├── docs/                # Plugin documentation
└── tests/               # Unit and integration tests

Basic Plugin Structure

Plugin Manifest (plugin.json)

json
{
  "id": "com.example.my-plugin",
  "name": "My Awesome Plugin",
  "version": "1.0.0",
  "description": "A plugin that does awesome things",
  "author": "Your Name",
  "website": "https://example.com",
  "main": "com.example.MyPlugin",
  "apiVersion": "1.0",
  "permissions": [
    "filesystem.read",
    "network.request",
    "ui.modify"
  ],
  "dependencies": {
    "aiverything-core": ">=2.0.0"
  },
  "categories": ["productivity", "search"],
  "keywords": ["search", "automation", "productivity"]
}

Java Plugin Example

java
package com.example;

import com.aiverything.plugin.Plugin;
import com.aiverything.plugin.PluginContext;
import com.aiverything.plugin.annotations.PluginMain;

@PluginMain
public class MyPlugin extends Plugin {
    
    @Override
    public void onEnable(PluginContext context) {
        // Plugin initialization
        getLogger().info("My Plugin enabled!");
        
        // Register search provider
        context.getSearchManager().registerProvider(
            new CustomSearchProvider()
        );
        
        // Register UI components
        context.getUIManager().addMenuItem(
            "My Plugin", this::showPluginDialog
        );
    }
    
    @Override
    public void onDisable() {
        // Cleanup when plugin is disabled
        getLogger().info("My Plugin disabled!");
    }
    
    private void showPluginDialog() {
        // Show plugin interface
    }
}

Web Plugin Example

javascript
import { Plugin, SearchProvider } from '@aiverything/plugin-sdk';

export default class MyWebPlugin extends Plugin {
    async onActivate(context) {
        console.log('Web plugin activated!');
        
        // Register custom search provider
        await context.search.registerProvider({
            name: 'my-search',
            search: this.customSearch.bind(this)
        });
        
        // Add UI components
        context.ui.addToolbarButton({
            icon: 'star',
            tooltip: 'My Plugin',
            onClick: this.showInterface.bind(this)
        });
    }
    
    async customSearch(query, options) {
        // Implement custom search logic
        return {
            results: [
                {
                    title: 'Custom Result',
                    path: '/path/to/file',
                    score: 0.95
                }
            ]
        };
    }
    
    showInterface() {
        // Show plugin UI
    }
}

Plugin APIs

Core APIs

File System API

java
// Java
FileSystemAPI fs = context.getFileSystem();
List<FileInfo> files = fs.searchFiles("*.txt");
String content = fs.readFile("/path/to/file.txt");

// JavaScript
const fs = context.filesystem;
const files = await fs.searchFiles("*.txt");
const content = await fs.readFile("/path/to/file.txt");

Search API

java
// Java
SearchAPI search = context.getSearch();
SearchResults results = search.query("my query");
search.registerProvider(new MySearchProvider());

// JavaScript
const search = context.search;
const results = await search.query("my query");
await search.registerProvider(new MySearchProvider());

UI API

java
// Java
UIAPI ui = context.getUI();
ui.showNotification("Hello from plugin!");
ui.addMenuItem("My Action", this::myAction);

// JavaScript
const ui = context.ui;
ui.showNotification("Hello from plugin!");
ui.addMenuItem("My Action", this.myAction);

Advanced APIs

Database API

javascript
const db = context.database;

// Store plugin data
await db.set('my-key', { data: 'value' });

// Retrieve plugin data
const data = await db.get('my-key');

// Query data
const results = await db.query({
    collection: 'my-collection',
    filter: { type: 'document' }
});

Network API

java
NetworkAPI network = context.getNetwork();

// Make HTTP request
HttpResponse response = network.get("https://api.example.com/data");

// Download file
network.downloadFile("https://example.com/file.zip", "/local/path");

AI API

javascript
const ai = context.ai;

// Generate text
const response = await ai.generateText({
    prompt: "Summarize this document",
    model: "llama2"
});

// Analyze content
const analysis = await ai.analyzeContent(fileContent, {
    tasks: ['summarize', 'extract-keywords']
});

Plugin Categories

1. Search Enhancement Plugins

  • Custom Search Providers: Add new search sources
  • Search Filters: Advanced filtering options
  • Result Processors: Modify and enhance search results

2. Content Analysis Plugins

  • File Analyzers: Extract metadata and content
  • Text Processors: Natural language processing
  • Image Analyzers: Computer vision capabilities

3. Integration Plugins

  • Cloud Storage: Google Drive, Dropbox, OneDrive
  • Productivity Tools: Notion, Obsidian, Roam Research
  • Development Tools: Git, IDE integrations

4. Automation Plugins

  • Workflow Automation: Automated file processing
  • Scheduled Tasks: Background operations
  • Event Handlers: React to file system changes

Plugin Distribution

Plugin Store

  • Official Store: Curated plugins from Aiverything team
  • Community Store: User-contributed plugins
  • Private Store: Enterprise plugin distribution

Installation Methods

  1. Store Installation: One-click install from plugin store
  2. Manual Installation: Install from .aip files
  3. Development Mode: Load plugins during development

Plugin Packaging

bash
# Build plugin
aiverything-cli build

# Package for distribution
aiverything-cli package

# Publish to store
aiverything-cli publish --store official

Security and Permissions

Permission System

Plugins must declare required permissions:

json
{
  "permissions": [
    "filesystem.read",      // Read files
    "filesystem.write",     // Write files
    "network.request",      // Make network requests
    "ui.modify",           // Modify user interface
    "system.execute",      // Execute system commands
    "database.access"      // Access plugin database
  ]
}

Security Sandbox

  • Isolated Execution: Plugins run in secure containers
  • Resource Limits: CPU, memory, and network limits
  • API Restrictions: Limited access to system APIs
  • Code Signing: Verified plugin authenticity

Testing and Debugging

Unit Testing

java
// Java JUnit example
@Test
public void testSearchProvider() {
    MySearchProvider provider = new MySearchProvider();
    SearchResults results = provider.search("test query");
    assertEquals(1, results.size());
}
javascript
// JavaScript Jest example
test('search provider returns results', async () => {
    const provider = new MySearchProvider();
    const results = await provider.search('test query');
    expect(results).toHaveLength(1);
});

Integration Testing

bash
# Run integration tests
aiverything-cli test --integration

# Test with different Aiverything versions
aiverything-cli test --version 2.0.0

Debugging

  • Debug Mode: Enable detailed logging
  • Plugin Inspector: Real-time plugin state inspection
  • Performance Profiler: Identify performance bottlenecks

Best Practices

Development Guidelines

  1. Follow Naming Conventions: Use clear, descriptive names
  2. Handle Errors Gracefully: Implement proper error handling
  3. Optimize Performance: Minimize resource usage
  4. Document Thoroughly: Provide comprehensive documentation
  5. Test Extensively: Write comprehensive tests

User Experience

  1. Intuitive Interface: Design user-friendly interfaces
  2. Clear Feedback: Provide status updates and progress indicators
  3. Configurable Options: Allow users to customize behavior
  4. Accessibility: Support keyboard navigation and screen readers

Security Considerations

  1. Minimal Permissions: Request only necessary permissions
  2. Input Validation: Validate all user inputs
  3. Secure Communication: Use HTTPS for network requests
  4. Data Protection: Encrypt sensitive data

Plugin Examples

Simple File Counter Plugin

java
@PluginMain
public class FileCounterPlugin extends Plugin {
    @Override
    public void onEnable(PluginContext context) {
        context.getUIManager().addMenuItem("Count Files", () -> {
            int count = context.getFileSystem().countFiles("*");
            context.getUIManager().showMessage("Total files: " + count);
        });
    }
}

Weather Integration Plugin

javascript
export default class WeatherPlugin extends Plugin {
    async onActivate(context) {
        context.ui.addWidget({
            name: 'weather',
            position: 'sidebar',
            render: this.renderWeather.bind(this)
        });
    }
    
    async renderWeather() {
        const weather = await this.fetchWeather();
        return `<div>Today: ${weather.temperature}°C</div>`;
    }
    
    async fetchWeather() {
        const response = await fetch('https://api.weather.com/current');
        return response.json();
    }
}

Community and Support

Resources

Community

  • Discord: Join our developer community
  • GitHub: Contribute to open-source plugins
  • Forums: Get help and share ideas

Support

  • Developer Support: Technical assistance for plugin developers
  • Plugin Review: Get your plugin reviewed before publishing
  • Certification Program: Become a certified plugin developer