Files
truetype eda22811ce Rename project: maxclaw → langcode
- Renamed all references from maxclaw to langcode across all files
- Renamed maxclaw.py → langcode.py
- Renamed completion scripts: maxclaw.bash/zsh → langcode.bash/zsh
- Updated Dockerfile, README, all Python files, HTML, JSON, YAML
- New Gitea repository: http://192.168.0.183:8085/truetype/langcode_agent.git
2026-03-21 08:36:35 +01:00

80 lines
1.9 KiB
Python

"""
Base plugin class for LangCode Agent
"""
from abc import ABC, abstractmethod
from typing import List, Dict, Any, Optional
from langchain.tools import Tool
class BasePlugin(ABC):
"""Base class for LangCode plugins"""
def __init__(self, name: str, version: str = "1.0.0", description: str = ""):
"""
Initialize plugin
Args:
name: Plugin name
version: Plugin version
description: Plugin description
"""
self.name = name
self.version = version
self.description = description
self.enabled = True
@abstractmethod
def get_tools(self) -> List[Tool]:
"""
Get tools provided by this plugin
Returns:
List of tools
"""
pass
@abstractmethod
def get_commands(self) -> Dict[str, callable]:
"""
Get commands provided by this plugin
Returns:
Dictionary mapping command names to functions
"""
pass
def on_load(self):
"""Called when plugin is loaded"""
pass
def on_unload(self):
"""Called when plugin is unloaded"""
pass
def get_info(self) -> Dict[str, Any]:
"""
Get plugin information
Returns:
Dictionary with plugin info
"""
return {
"name": self.name,
"version": self.version,
"description": self.description,
"enabled": self.enabled,
"tools_count": len(self.get_tools()),
"commands_count": len(self.get_commands())
}
def enable(self):
"""Enable the plugin"""
self.enabled = True
def disable(self):
"""Disable the plugin"""
self.enabled = False
def is_enabled(self) -> bool:
"""Check if plugin is enabled"""
return self.enabled