extractEngineFromAwInfo reads aw_info.json and returns the appropriate engine Handles cases where aw_info.json is a file or a directory containing the actual file
(infoFilePath string, verbose bool)
| 80 | // extractEngineFromAwInfo reads aw_info.json and returns the appropriate engine |
| 81 | // Handles cases where aw_info.json is a file or a directory containing the actual file |
| 82 | func extractEngineFromAwInfo(infoFilePath string, verbose bool) workflow.CodingAgentEngine { |
| 83 | logsParsingCoreLog.Printf("Extracting engine from aw_info.json: %s", infoFilePath) |
| 84 | info, err := parseAwInfo(infoFilePath, verbose) |
| 85 | if err != nil { |
| 86 | return nil |
| 87 | } |
| 88 | |
| 89 | if info.EngineID == "" { |
| 90 | logsParsingCoreLog.Print("No engine_id found in aw_info.json") |
| 91 | if verbose { |
| 92 | fmt.Fprintln(os.Stderr, console.FormatWarningMessage("No engine_id found in aw_info.json")) |
| 93 | } |
| 94 | return nil |
| 95 | } |
| 96 | |
| 97 | registry := workflow.GetGlobalEngineRegistry() |
| 98 | engine, err := registry.GetEngine(info.EngineID) |
| 99 | if err != nil { |
| 100 | logsParsingCoreLog.Printf("Unknown engine: %s", info.EngineID) |
| 101 | if verbose { |
| 102 | fmt.Fprintln(os.Stderr, console.FormatWarningMessage("Unknown engine in aw_info.json: "+info.EngineID)) |
| 103 | } |
| 104 | return nil |
| 105 | } |
| 106 | |
| 107 | logsParsingCoreLog.Printf("Successfully extracted engine: %s", engine.GetID()) |
| 108 | return engine |
| 109 | } |