mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-01 01:44:25 +00:00
feat(plugin): report deferred response delivery failures
This commit is contained in:
@@ -26,6 +26,15 @@ from ..core import app
|
||||
from ..utils import constants
|
||||
|
||||
|
||||
class _RawAction:
|
||||
def __init__(self, value: str):
|
||||
self.value = value
|
||||
|
||||
|
||||
def _langbot_to_runtime_action(enum_name: str, fallback_value: str) -> Any:
|
||||
return getattr(LangBotToRuntimeAction, enum_name, _RawAction(fallback_value))
|
||||
|
||||
|
||||
def _make_rag_error_response(error: Exception, error_type: str, **extra_context) -> handler.ActionResponse:
|
||||
"""Create a clean error response for RAG operations.
|
||||
|
||||
@@ -923,6 +932,18 @@ class RuntimeConnectionHandler(handler.Handler):
|
||||
|
||||
return result
|
||||
|
||||
async def notify_plugin_diagnostic(self, diagnostic: dict[str, Any]) -> dict[str, Any]:
|
||||
"""Notify the plugin runtime about a best-effort plugin diagnostic.
|
||||
|
||||
This intentionally uses the raw protocol string instead of a SDK enum so
|
||||
LangBot can keep running with older langbot-plugin versions.
|
||||
"""
|
||||
return await self.call_action(
|
||||
_langbot_to_runtime_action('PLUGIN_DIAGNOSTIC', 'plugin_diagnostic'),
|
||||
diagnostic,
|
||||
timeout=5,
|
||||
)
|
||||
|
||||
async def list_tools(self, include_plugins: list[str] | None = None) -> list[dict[str, Any]]:
|
||||
"""List tools"""
|
||||
result = await self.call_action(
|
||||
|
||||
Reference in New Issue
Block a user