develop feature/agent-framework-poc fix/editor-text-visibility-chrome main Services / IdeExecuteCommandArgs.cs csharp deeb25a21 using System .Text .Json ;2 3 namespace CascadeIDE .Services ;4 5 /// <summary>Общий разбор <c>execute_command</c> / моста веб-портала: merge вложенного <c>args</c> с верхним уровнем (как <see cref= "IdeMcpServer" />).</summary>6 public static class IdeExecuteCommandArgs 7 { 8 /// <summary> 9 /// Клиенты шлют <c>{ "command_id" : "…" , "args" : { "workspace_path" : "…" } }</c> — сливаем вложенный объект с верхним уровнем (верх при конфликте важнее). 10 /// </summary> 11 public static IReadOnlyDictionary <string , JsonElement >? MergeNestedArgs (IReadOnlyDictionary <string , JsonElement >? args) 12 { 13 if (args is null || !args.TryGetValue ("args" , out var nested) || nested.ValueKind != JsonValueKind .Object ) 14 return args; 15 var merged = new Dictionary <string , JsonElement >(StringComparer .Ordinal ); 16 foreach (var prop in nested.EnumerateObject ()) 17 merged[prop.Name ] = prop.Value ; 18 foreach (var kv in args) 19 { 20 if (string .Equals (kv.Key , "args" , StringComparison .Ordinal )) 21 continue ; 22 merged[kv.Key ] = kv.Value ; 23 } 24 return merged; 25 } 26 } 27
View only · write via MCP/CIDE