@@ -33,13 +33,7 @@ Focus on concrete observations from the data provided. Look for patterns such as
3333
3434Provide a concise, insightful analysis that helps developers understand agent behavior and improve the evaluation system.` ;
3535
36- const fallback = ( envName : string , defaultValue : string ) : string =>
37- process . env [ envName ] ?. trim ( ) || defaultValue ;
38-
39- const analyzerModelId = fallback (
40- "ANALYZER_MODEL" ,
41- "opencode/claude-sonnet-4-5" ,
42- ) ;
36+ const analyzerModelId = "opencode/claude-sonnet-4-5" ;
4337
4438function buildDynamicContext ( runs : EvaluationRunExport [ ] ) : string {
4539 const repo = runs [ 0 ] . evaluation . repo ;
@@ -99,25 +93,16 @@ function formatFallbackSummary(runs: EvaluationRunExport[]): string {
9993 return lines . join ( "\n" ) . trimEnd ( ) ;
10094}
10195
102- async function generateAnalysis (
103- runs : EvaluationRunExport [ ] ,
104- ) : Promise < string > {
96+ async function generateAnalysis ( runs : EvaluationRunExport [ ] ) : Promise < string > {
10597 const context = buildDynamicContext ( runs ) ;
10698
107- try {
108- const { text } = await generateText ( {
109- model : getZenLanguageModel ( analyzerModelId ) ,
110- system : AGENT_ANALYSIS_PROMPT ,
111- prompt : context ,
112- temperature : 0.3 ,
113- } ) ;
114- return text . trim ( ) ;
115- } catch ( error ) {
116- const message = error instanceof Error ? error . message : String ( error ) ;
117- return `Failed to generate AI analysis (${ message } ).\n\n${ formatFallbackSummary (
118- runs ,
119- ) } `;
120- }
99+ const { text } = await generateText ( {
100+ model : getZenLanguageModel ( analyzerModelId ) ,
101+ system : AGENT_ANALYSIS_PROMPT ,
102+ prompt : context ,
103+ temperature : 0.3 ,
104+ } ) ;
105+ return text . trim ( ) ;
121106}
122107
123108function usage ( ) : void {
@@ -137,33 +122,24 @@ async function main(): Promise<void> {
137122 }
138123
139124 const filePath = args [ 0 ] ;
140- let parsed : unknown ;
125+ let runs : EvaluationRunExport [ ] ;
141126
142127 try {
143128 const fileContent = readFileSync ( filePath , "utf-8" ) ;
144- parsed = JSON . parse ( fileContent ) as unknown ;
129+ runs = JSON . parse ( fileContent ) as EvaluationRunExport [ ] ;
145130 } catch ( error ) {
146131 console . error ( `Error reading file ${ filePath } :` , error ) ;
147132 process . exit ( 1 ) ;
148133 }
149134
150- const runs = ( Array . isArray ( parsed )
151- ? ( parsed as EvaluationRunExport [ ] )
152- : [ parsed as EvaluationRunExport ] ) . filter (
153- ( run ) : run is EvaluationRunExport =>
154- run != null && typeof run === "object" && "finalScore" in run ,
155- ) ;
156-
157135 if ( runs . length === 0 ) {
158136 console . error ( "No evaluation runs found in the provided file." ) ;
159137 process . exit ( 1 ) ;
160138 }
161139
162- const orderedRuns = [ ...runs ] . sort (
163- ( a , b ) => b . finalScore - a . finalScore ,
164- ) ;
140+ runs . sort ( ( a , b ) => b . finalScore - a . finalScore ) ;
165141
166- const output = await generateAnalysis ( orderedRuns ) ;
142+ const output = await generateAnalysis ( runs ) ;
167143 process . stdout . write ( `${ output . trimEnd ( ) } \n` ) ;
168144}
169145
0 commit comments