godot ai 更新

This commit is contained in:
2026-10-23 16:56:35 +08:00
parent 5c0adb3a96
commit e2491bc4e1
26 changed files with 1800 additions and 127 deletions
+29
View File
@@ -19,10 +19,16 @@ static func configure(
var resolution := client.resolved_config_path_details()
var path := str(resolution.get("path", ""))
var path_error := str(resolution.get("error", ""))
if path_error.is_empty() and not path.is_empty():
path_error = McpClient.unshared_flatpak_config_error(client.display_name, path)
if not path_error.is_empty():
return {"status": "error", "message": path_error}
if path.is_empty():
return {"status": "error", "message": "Could not resolve config path for %s on this OS" % client.display_name}
## Set only while no candidate file exists, so this never blocks an update.
var create_error := str(resolution.get("create_error", ""))
if not create_error.is_empty():
return {"status": "error", "message": create_error}
var seed_path := str(resolution.get("seed_path", ""))
var read_path := seed_path if not FileAccess.file_exists(path) and not seed_path.is_empty() else path
@@ -59,6 +65,9 @@ static func _configure_merged(
launch: Dictionary,
project_roots: PackedStringArray,
) -> Dictionary:
var write_error := _merge_write_error(client)
if not write_error.is_empty():
return {"status": "error", "message": write_error}
var launch_error := command_launch_error(client, launch)
if not launch_error.is_empty():
return {"status": "error", "message": launch_error}
@@ -259,6 +268,8 @@ static func remove(
var resolution := client.resolved_config_path_details()
var path := str(resolution.get("path", ""))
var path_error := str(resolution.get("error", ""))
if path_error.is_empty() and not path.is_empty():
path_error = McpClient.unshared_flatpak_config_error(client.display_name, path)
if not path_error.is_empty():
return {"status": "error", "message": path_error}
if path.is_empty() or not FileAccess.file_exists(path):
@@ -284,6 +295,9 @@ static func remove(
static func _remove_merged(
client: McpClient, server_name: String, project_roots: PackedStringArray
) -> Dictionary:
var write_error := _merge_write_error(client)
if not write_error.is_empty():
return {"status": "error", "message": write_error}
## Scope ambiguity (omp named profiles) blocks Remove too: clearing the
## default files while a profile reads its own would report a success the
## running client never observes (#1085).
@@ -750,6 +764,21 @@ static func _merge_paths(client: McpClient) -> PackedStringArray:
return result
## The Flatpak write check `configure` and `remove` make on their one path,
## made here on every tier. Any tier this sandbox does not share with the host
## refuses the whole Configure or Remove: an unseen tier may hold the
## definition the client actually uses. Status reads past it, as it does for
## an ordinary client.
static func _merge_write_error(client: McpClient) -> String:
for path in _merge_paths(client):
if not path.is_absolute_path():
continue
var write_error := McpClient.unshared_flatpak_config_error(client.display_name, path)
if not write_error.is_empty():
return write_error
return ""
## Pi's project tiers are relative to Pi's process cwd, not Godot's. Inspect
## plausible roots only to detect overrides; callers fail closed rather than
## mutating both guesses.