Files
雷电芽衣 1656a94811 sdks/python: mirror Elydora-Python-SDK 2.0.2
Rebuilt from the standalone 54e65eb tree (durable transactions, Kiro IDE
adapter, hook retry with a bounded chain lock, version 2.0.2) with the
Open-Source API trims re-applied: no token rotation, token issuance, or
agent integration updates, and the mirror's registration contract and
OpenCode plugin tests kept.

Claude-Session: https://claude.ai/code/session_01QoUjdc7HGKTsgj5GhG8HvF
2026-09-02 10:48:33 -04:00

51 lines
1.2 KiB
Python

"""Abstract base class for agent plugins."""
from __future__ import annotations
import sys
from abc import ABC, abstractmethod
if sys.version_info >= (3, 11):
from typing import TypedDict
else:
from typing_extensions import TypedDict
class InstallConfig(TypedDict, total=False):
org_id: str
agent_id: str
agent_name: str
private_key: str
kid: str
token: str
base_url: str
guard_script_path: str
class PluginStatus(TypedDict):
installed: bool
agent: str
details: str
class AgentPlugin(ABC):
"""Base class for all agent plugins."""
manages_guard_runtime = False
manages_runtime_directories = False
manages_runtime_removal = False
def preflight_install(self, config: InstallConfig) -> None:
"""Validate provider sources before the CLI creates runtime files."""
@abstractmethod
def install(self, config: InstallConfig) -> None:
"""Install the Elydora hook for this agent."""
@abstractmethod
def uninstall(self, agent_id: str = "") -> None:
"""Remove the Elydora hook for this agent."""
@abstractmethod
def status(self) -> PluginStatus:
"""Check whether the Elydora hook is installed for this agent."""