mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-05 05:16:03 +00:00
feat: plugin installation
This commit is contained in:
@@ -17,6 +17,8 @@ from langbot_plugin.api.entities import context
|
||||
import langbot_plugin.runtime.io.connection as base_connection
|
||||
from langbot_plugin.api.definition.components.manifest import ComponentManifest
|
||||
from langbot_plugin.api.entities.builtin.command import context as command_context
|
||||
from langbot_plugin.runtime.plugin.mgr import PluginInstallSource
|
||||
from ..core import taskmgr
|
||||
|
||||
|
||||
class PluginRuntimeConnector:
|
||||
@@ -97,6 +99,14 @@ class PluginRuntimeConnector:
|
||||
async def initialize_plugins(self):
|
||||
pass
|
||||
|
||||
async def install_plugin(
|
||||
self,
|
||||
install_source: PluginInstallSource,
|
||||
install_info: dict[str, Any],
|
||||
task_context: taskmgr.TaskContext | None = None,
|
||||
):
|
||||
return await self.handler.install_plugin(install_source.value, install_info)
|
||||
|
||||
async def list_plugins(self) -> list[dict[str, Any]]:
|
||||
return await self.handler.list_plugins()
|
||||
|
||||
|
||||
@@ -373,6 +373,17 @@ class RuntimeConnectionHandler(handler.Handler):
|
||||
timeout=10,
|
||||
)
|
||||
|
||||
async def install_plugin(self, install_source: str, install_info: dict[str, Any]) -> dict[str, Any]:
|
||||
"""Install plugin"""
|
||||
return await self.call_action(
|
||||
LangBotToRuntimeAction.INSTALL_PLUGIN,
|
||||
{
|
||||
'install_source': install_source,
|
||||
'install_info': install_info,
|
||||
},
|
||||
timeout=10,
|
||||
)
|
||||
|
||||
async def list_plugins(self) -> list[dict[str, Any]]:
|
||||
"""List plugins"""
|
||||
result = await self.call_action(
|
||||
|
||||
Reference in New Issue
Block a user