erosolar-cli
Version:
Unified AI agent framework for the command line - Multi-provider support with schema-driven tools, code intelligence, and transparent reasoning
114 lines • 2.64 kB
JavaScript
/**
* Plugin System - Root Index
*
* Aggregates all plugin functionality for easy import.
*
* Principal Investigator: Bo Shang
* Framework: erosolar-cli
*/
// Re-export tool plugin system
export { registerToolPlugin, unregisterToolPlugin, listRegisteredToolPlugins, instantiateToolPlugins, } from './tools/index.js';
export { registerDefaultNodeToolPlugins } from './tools/nodeDefaults.js';
// Track loaded plugins
const loadedPlugins = new Map();
/**
* Register a plugin as loaded
*/
export function markPluginLoaded(plugin) {
loadedPlugins.set(plugin.id, plugin);
}
/**
* Get a loaded plugin by ID
*/
export function getLoadedPlugin(id) {
return loadedPlugins.get(id);
}
/**
* List all loaded plugins
*/
export function listLoadedPlugins() {
return Array.from(loadedPlugins.values());
}
/**
* List available plugins (combines loaded + builtin)
*/
export function listAvailablePlugins() {
const available = new Set();
for (const id of BUILTIN_PLUGINS) {
available.add(id);
}
for (const id of loadedPlugins.keys()) {
available.add(id);
}
return Array.from(available);
}
/**
* Get all plugin tool suites
*/
export function getAllPluginToolSuites() {
return listLoadedPlugins().filter((p) => p.enabled);
}
/**
* Load a plugin by ID
*/
export async function loadPlugin(id) {
// Check if already loaded
const existing = loadedPlugins.get(id);
if (existing) {
return existing;
}
// Check if it's a builtin plugin
if (!BUILTIN_PLUGINS.includes(id)) {
return null;
}
// Create a loaded plugin entry
const plugin = {
id,
name: id.replace(/-/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase()),
version: '1.0.0',
enabled: true,
};
loadedPlugins.set(id, plugin);
return plugin;
}
/**
* Get plugin IDs from command line flags
*/
export function getPluginIdsFromFlags(flags) {
const ids = [];
for (const [flag, enabled] of Object.entries(flags)) {
if (enabled && BUILTIN_PLUGINS.includes(flag)) {
ids.push(flag);
}
}
return ids;
}
/**
* Builtin plugin identifiers
*/
export const BUILTIN_PLUGINS = [
'local-filesystem',
'local-bash',
'local-search',
'edit',
'glob',
'web',
'mcp',
'code-analysis',
'code-quality',
'dependency',
'development',
'enhanced-git',
'interaction',
'notebook',
'planning',
'refactoring',
'skills',
'task-management',
'testing',
'agent-spawning',
'local-repo-checks',
'cloud',
'email',
];
//# sourceMappingURL=index.js.map