Spaces:
Paused
Paused
frdel commited on
Commit ·
41772bf
1
Parent(s): 5cb4b4d
0.9.4 polishing
Browse files
python/helpers/fasta2a_server.py
CHANGED
|
@@ -351,6 +351,21 @@ class DynamicA2AProxy:
|
|
| 351 |
})
|
| 352 |
return
|
| 353 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 354 |
# Check if reconfiguration is needed
|
| 355 |
if self._reconfigure_needed:
|
| 356 |
try:
|
|
@@ -410,11 +425,15 @@ class DynamicA2AProxy:
|
|
| 410 |
path = path[4:] # Remove '/a2a' prefix
|
| 411 |
|
| 412 |
# Check if path matches token pattern /t-{token}/
|
| 413 |
-
if path.startswith('/t-')
|
| 414 |
# Extract token from path
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 418 |
|
| 419 |
# Validate token
|
| 420 |
cfg = settings.get_settings()
|
|
|
|
| 351 |
})
|
| 352 |
return
|
| 353 |
|
| 354 |
+
from python.helpers import settings
|
| 355 |
+
cfg = settings.get_settings()
|
| 356 |
+
if not cfg["a2a_server_enabled"]:
|
| 357 |
+
response = b'HTTP/1.1 403 Forbidden\r\n\r\nA2A server is disabled'
|
| 358 |
+
await send({
|
| 359 |
+
'type': 'http.response.start',
|
| 360 |
+
'status': 403,
|
| 361 |
+
'headers': [[b'content-type', b'text/plain']],
|
| 362 |
+
})
|
| 363 |
+
await send({
|
| 364 |
+
'type': 'http.response.body',
|
| 365 |
+
'body': response,
|
| 366 |
+
})
|
| 367 |
+
return
|
| 368 |
+
|
| 369 |
# Check if reconfiguration is needed
|
| 370 |
if self._reconfigure_needed:
|
| 371 |
try:
|
|
|
|
| 425 |
path = path[4:] # Remove '/a2a' prefix
|
| 426 |
|
| 427 |
# Check if path matches token pattern /t-{token}/
|
| 428 |
+
if path.startswith('/t-'):
|
| 429 |
# Extract token from path
|
| 430 |
+
if '/' in path[3:]:
|
| 431 |
+
path_parts = path[3:].split('/', 1) # Remove '/t-' prefix
|
| 432 |
+
request_token = path_parts[0]
|
| 433 |
+
remaining_path = '/' + path_parts[1] if len(path_parts) > 1 else '/'
|
| 434 |
+
else:
|
| 435 |
+
request_token = path[3:]
|
| 436 |
+
remaining_path = '/'
|
| 437 |
|
| 438 |
# Validate token
|
| 439 |
cfg = settings.get_settings()
|
python/helpers/settings.py
CHANGED
|
@@ -97,6 +97,9 @@ class Settings(TypedDict):
|
|
| 97 |
mcp_server_enabled: bool
|
| 98 |
mcp_server_token: str
|
| 99 |
|
|
|
|
|
|
|
|
|
|
| 100 |
|
| 101 |
class PartialSettings(Settings, total=False):
|
| 102 |
pass
|
|
@@ -532,25 +535,6 @@ def convert_out(settings: Settings) -> SettingsOutput:
|
|
| 532 |
}
|
| 533 |
)
|
| 534 |
|
| 535 |
-
# -------- A2A Section --------
|
| 536 |
-
a2a_fields: list[SettingsField] = [
|
| 537 |
-
{
|
| 538 |
-
"id": "show_a2a_connection",
|
| 539 |
-
"title": "Show A2A connection info",
|
| 540 |
-
"description": "Display the URL (including token) other agents can use to connect via FastA2A.",
|
| 541 |
-
"type": "button",
|
| 542 |
-
"value": "Show",
|
| 543 |
-
}
|
| 544 |
-
]
|
| 545 |
-
|
| 546 |
-
a2a_section: SettingsSection = {
|
| 547 |
-
"id": "a2a_server",
|
| 548 |
-
"title": "A2A Connection",
|
| 549 |
-
"description": "Share this connection string with other agents.",
|
| 550 |
-
"fields": a2a_fields,
|
| 551 |
-
"tab": "external",
|
| 552 |
-
}
|
| 553 |
-
|
| 554 |
if runtime.is_dockerized():
|
| 555 |
auth_fields.append(
|
| 556 |
{
|
|
@@ -1055,7 +1039,7 @@ def convert_out(settings: Settings) -> SettingsOutput:
|
|
| 1055 |
{
|
| 1056 |
"id": "mcp_server_enabled",
|
| 1057 |
"title": "Enable A0 MCP Server",
|
| 1058 |
-
"description": "Expose Agent Zero as an SSE MCP server. This will make this A0 instance available to MCP clients.",
|
| 1059 |
"type": "switch",
|
| 1060 |
"value": settings["mcp_server_enabled"],
|
| 1061 |
}
|
|
@@ -1080,6 +1064,28 @@ def convert_out(settings: Settings) -> SettingsOutput:
|
|
| 1080 |
"tab": "mcp",
|
| 1081 |
}
|
| 1082 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1083 |
# External API section
|
| 1084 |
external_api_fields: list[SettingsField] = []
|
| 1085 |
|
|
@@ -1148,9 +1154,9 @@ def convert_out(settings: Settings) -> SettingsOutput:
|
|
| 1148 |
speech_section,
|
| 1149 |
api_keys_section,
|
| 1150 |
auth_section,
|
| 1151 |
-
a2a_section,
|
| 1152 |
mcp_client_section,
|
| 1153 |
mcp_server_section,
|
|
|
|
| 1154 |
external_api_section,
|
| 1155 |
backup_section,
|
| 1156 |
dev_section,
|
|
@@ -1302,7 +1308,7 @@ def get_default_settings() -> Settings:
|
|
| 1302 |
return Settings(
|
| 1303 |
version=_get_version(),
|
| 1304 |
chat_model_provider="openrouter",
|
| 1305 |
-
chat_model_name="openai/gpt-
|
| 1306 |
chat_model_api_base="",
|
| 1307 |
chat_model_kwargs={"temperature": "0"},
|
| 1308 |
chat_model_ctx_length=100000,
|
|
@@ -1312,7 +1318,7 @@ def get_default_settings() -> Settings:
|
|
| 1312 |
chat_model_rl_input=0,
|
| 1313 |
chat_model_rl_output=0,
|
| 1314 |
util_model_provider="openrouter",
|
| 1315 |
-
util_model_name="openai/gpt-
|
| 1316 |
util_model_api_base="",
|
| 1317 |
util_model_ctx_length=100000,
|
| 1318 |
util_model_ctx_input=0.7,
|
|
@@ -1327,7 +1333,7 @@ def get_default_settings() -> Settings:
|
|
| 1327 |
embed_model_rl_requests=0,
|
| 1328 |
embed_model_rl_input=0,
|
| 1329 |
browser_model_provider="openrouter",
|
| 1330 |
-
browser_model_name="openai/gpt-
|
| 1331 |
browser_model_api_base="",
|
| 1332 |
browser_model_vision=True,
|
| 1333 |
browser_model_rl_requests=0,
|
|
@@ -1370,6 +1376,7 @@ def get_default_settings() -> Settings:
|
|
| 1370 |
mcp_client_tool_timeout=120,
|
| 1371 |
mcp_server_enabled=False,
|
| 1372 |
mcp_server_token=create_auth_token(),
|
|
|
|
| 1373 |
)
|
| 1374 |
|
| 1375 |
|
|
|
|
| 97 |
mcp_server_enabled: bool
|
| 98 |
mcp_server_token: str
|
| 99 |
|
| 100 |
+
a2a_server_enabled: bool
|
| 101 |
+
|
| 102 |
+
|
| 103 |
|
| 104 |
class PartialSettings(Settings, total=False):
|
| 105 |
pass
|
|
|
|
| 535 |
}
|
| 536 |
)
|
| 537 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 538 |
if runtime.is_dockerized():
|
| 539 |
auth_fields.append(
|
| 540 |
{
|
|
|
|
| 1039 |
{
|
| 1040 |
"id": "mcp_server_enabled",
|
| 1041 |
"title": "Enable A0 MCP Server",
|
| 1042 |
+
"description": "Expose Agent Zero as an SSE/HTTP MCP server. This will make this A0 instance available to MCP clients.",
|
| 1043 |
"type": "switch",
|
| 1044 |
"value": settings["mcp_server_enabled"],
|
| 1045 |
}
|
|
|
|
| 1064 |
"tab": "mcp",
|
| 1065 |
}
|
| 1066 |
|
| 1067 |
+
# -------- A2A Section --------
|
| 1068 |
+
a2a_fields: list[SettingsField] = []
|
| 1069 |
+
|
| 1070 |
+
a2a_fields.append(
|
| 1071 |
+
{
|
| 1072 |
+
"id": "a2a_server_enabled",
|
| 1073 |
+
"title": "Enable A2A server",
|
| 1074 |
+
"description": "Expose Agent Zero as A2A server. This allows other agents to connect to A0 via A2A protocol.",
|
| 1075 |
+
"type": "switch",
|
| 1076 |
+
"value": settings["a2a_server_enabled"],
|
| 1077 |
+
}
|
| 1078 |
+
)
|
| 1079 |
+
|
| 1080 |
+
a2a_section: SettingsSection = {
|
| 1081 |
+
"id": "a2a_server",
|
| 1082 |
+
"title": "A0 A2A Server",
|
| 1083 |
+
"description": "Agent Zero can be exposed as an A2A server. See <a href=\"javascript:openModal('settings/a2a/a2a-connection.html')\">connection example</a>.",
|
| 1084 |
+
"fields": a2a_fields,
|
| 1085 |
+
"tab": "mcp",
|
| 1086 |
+
}
|
| 1087 |
+
|
| 1088 |
+
|
| 1089 |
# External API section
|
| 1090 |
external_api_fields: list[SettingsField] = []
|
| 1091 |
|
|
|
|
| 1154 |
speech_section,
|
| 1155 |
api_keys_section,
|
| 1156 |
auth_section,
|
|
|
|
| 1157 |
mcp_client_section,
|
| 1158 |
mcp_server_section,
|
| 1159 |
+
a2a_section,
|
| 1160 |
external_api_section,
|
| 1161 |
backup_section,
|
| 1162 |
dev_section,
|
|
|
|
| 1308 |
return Settings(
|
| 1309 |
version=_get_version(),
|
| 1310 |
chat_model_provider="openrouter",
|
| 1311 |
+
chat_model_name="openai/gpt-5",
|
| 1312 |
chat_model_api_base="",
|
| 1313 |
chat_model_kwargs={"temperature": "0"},
|
| 1314 |
chat_model_ctx_length=100000,
|
|
|
|
| 1318 |
chat_model_rl_input=0,
|
| 1319 |
chat_model_rl_output=0,
|
| 1320 |
util_model_provider="openrouter",
|
| 1321 |
+
util_model_name="openai/gpt-5-mini",
|
| 1322 |
util_model_api_base="",
|
| 1323 |
util_model_ctx_length=100000,
|
| 1324 |
util_model_ctx_input=0.7,
|
|
|
|
| 1333 |
embed_model_rl_requests=0,
|
| 1334 |
embed_model_rl_input=0,
|
| 1335 |
browser_model_provider="openrouter",
|
| 1336 |
+
browser_model_name="openai/gpt-5",
|
| 1337 |
browser_model_api_base="",
|
| 1338 |
browser_model_vision=True,
|
| 1339 |
browser_model_rl_requests=0,
|
|
|
|
| 1376 |
mcp_client_tool_timeout=120,
|
| 1377 |
mcp_server_enabled=False,
|
| 1378 |
mcp_server_token=create_auth_token(),
|
| 1379 |
+
a2a_server_enabled=False,
|
| 1380 |
)
|
| 1381 |
|
| 1382 |
|
webui/components/settings/{external → a2a}/a2a-connection.html
RENAMED
|
File without changes
|
webui/index.html
CHANGED
|
@@ -551,7 +551,7 @@
|
|
| 551 |
<div class="settings-tab"
|
| 552 |
:class="{'active': activeTab === 'mcp'}"
|
| 553 |
@click="switchTab('mcp')"
|
| 554 |
-
title="MCP">MCP</div>
|
| 555 |
<div class="settings-tab"
|
| 556 |
:class="{'active': activeTab === 'developer'}"
|
| 557 |
@click="switchTab('developer')"
|
|
|
|
| 551 |
<div class="settings-tab"
|
| 552 |
:class="{'active': activeTab === 'mcp'}"
|
| 553 |
@click="switchTab('mcp')"
|
| 554 |
+
title="MCP">MCP/A2A</div>
|
| 555 |
<div class="settings-tab"
|
| 556 |
:class="{'active': activeTab === 'developer'}"
|
| 557 |
@click="switchTab('developer')"
|
webui/public/a2a_server.svg
CHANGED
|
|
|
|
webui/public/external_api.svg
CHANGED
|
|
|
|