mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-17 01:46:07 +00:00
fix(agent-runner): validate clean marketplace onboarding
This commit is contained in:
@@ -9,6 +9,7 @@ from typing import Any
|
||||
import typing
|
||||
import os
|
||||
import sys
|
||||
from urllib.parse import urlparse
|
||||
import httpx
|
||||
import sqlalchemy
|
||||
import yaml
|
||||
@@ -172,9 +173,20 @@ class PluginRuntimeConnector(ManagedRuntimeConnector):
|
||||
# cmd: lbp rt -s
|
||||
python_path = sys.executable
|
||||
env = os.environ.copy()
|
||||
debug_url = self.ap.instance_config.data.get('plugin', {}).get(
|
||||
'display_plugin_debug_url', 'ws://localhost:5401/plugin/debug/ws'
|
||||
)
|
||||
debug_port = self._runtime_debug_port_from_url(debug_url)
|
||||
self.ctrl = stdio_client_controller.StdioClientController(
|
||||
command=python_path,
|
||||
args=['-m', 'langbot_plugin.cli.__init__', 'rt', '-s'],
|
||||
args=[
|
||||
'-m',
|
||||
'langbot_plugin.cli.__init__',
|
||||
'rt',
|
||||
'-s',
|
||||
'--ws-debug-port',
|
||||
str(debug_port),
|
||||
],
|
||||
env=env,
|
||||
)
|
||||
task = self.ctrl.run(new_connection_callback)
|
||||
@@ -184,6 +196,15 @@ class PluginRuntimeConnector(ManagedRuntimeConnector):
|
||||
|
||||
asyncio.create_task(task)
|
||||
|
||||
@staticmethod
|
||||
def _runtime_debug_port_from_url(debug_url: str) -> int:
|
||||
"""Extract the local plugin runtime debug port from its display URL."""
|
||||
try:
|
||||
parsed = urlparse(debug_url if '://' in debug_url else f'//{debug_url}')
|
||||
return parsed.port or 5401
|
||||
except (TypeError, ValueError):
|
||||
return 5401
|
||||
|
||||
async def initialize_plugins(self):
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user