fix(agent-runner): validate clean marketplace onboarding

This commit is contained in:
huanghuoguoguo
2026-07-15 07:52:43 +08:00
parent 99d9c227f9
commit 32216a82f5
10 changed files with 461 additions and 41 deletions
+22 -1
View File
@@ -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