@@ -654,6 +654,7 @@ function normalizeModelLeaderboardRow(raw: unknown): ModelLeaderboardRow | null
654654 }
655655
656656 const rawTopNodeIds = Array . isArray ( item . top_node_ids ) ? item . top_node_ids : [ ] ;
657+ const rawScoreAdjustments = Array . isArray ( item . score_adjustments ) ? item . score_adjustments : [ ] ;
657658
658659 return {
659660 generator_model : item . generator_model ,
@@ -667,12 +668,24 @@ function normalizeModelLeaderboardRow(raw: unknown): ModelLeaderboardRow | null
667668 typeof item . scored_idea_count === "number"
668669 ? item . scored_idea_count
669670 : Number ( item . scored_idea_count ?? 0 ) ,
671+ raw_model_total_score :
672+ typeof item . raw_model_total_score === "number"
673+ ? item . raw_model_total_score
674+ : item . raw_model_total_score == null
675+ ? null
676+ : Number ( item . raw_model_total_score ) ,
670677 model_total_score :
671678 typeof item . model_total_score === "number"
672679 ? item . model_total_score
673680 : item . model_total_score == null
674681 ? null
675682 : Number ( item . model_total_score ) ,
683+ raw_model_idea_gen_score :
684+ typeof item . raw_model_idea_gen_score === "number"
685+ ? item . raw_model_idea_gen_score
686+ : item . raw_model_idea_gen_score == null
687+ ? null
688+ : Number ( item . raw_model_idea_gen_score ) ,
676689 model_idea_gen_score :
677690 typeof item . model_idea_gen_score === "number"
678691 ? item . model_idea_gen_score
@@ -702,6 +715,26 @@ function normalizeModelLeaderboardRow(raw: unknown): ModelLeaderboardRow | null
702715 typeof item . last_generated_at === "string" && item . last_generated_at . trim ( )
703716 ? item . last_generated_at
704717 : null ,
718+ score_adjustments : rawScoreAdjustments
719+ . filter ( ( value ) : value is Record < string , unknown > => Boolean ( value && typeof value === "object" ) )
720+ . map ( ( value ) => ( {
721+ target :
722+ typeof value . target === "string" && value . target . trim ( )
723+ ? value . target
724+ : "node_agent_score" ,
725+ delta :
726+ typeof value . delta === "number"
727+ ? value . delta
728+ : Number ( value . delta ?? 0 ) ,
729+ reason :
730+ typeof value . reason === "string" && value . reason . trim ( )
731+ ? value . reason
732+ : null ,
733+ scope :
734+ typeof value . scope === "string" && value . scope . trim ( )
735+ ? value . scope
736+ : null ,
737+ } ) ) ,
705738 } ;
706739}
707740
@@ -715,6 +748,7 @@ function normalizeNodeLeaderboardRow(raw: unknown): NodeLeaderboardRow | null {
715748 ? item . linked_seevomap_node_id
716749 : null ;
717750 const detailNodeId = linkedNodeId || ( ! item . node_id . includes ( ":" ) ? item . node_id : null ) ;
751+ const rawScoreAdjustments = Array . isArray ( item . score_adjustments ) ? item . score_adjustments : [ ] ;
718752
719753 return {
720754 node_id : item . node_id ,
@@ -730,12 +764,24 @@ function normalizeNodeLeaderboardRow(raw: unknown): NodeLeaderboardRow | null {
730764 typeof item . field === "string" && item . field . trim ( )
731765 ? item . field
732766 : null ,
767+ raw_node_total_score :
768+ typeof item . raw_node_total_score === "number"
769+ ? item . raw_node_total_score
770+ : item . raw_node_total_score == null
771+ ? null
772+ : Number ( item . raw_node_total_score ) ,
733773 node_total_score :
734774 typeof item . node_total_score === "number"
735775 ? item . node_total_score
736776 : item . node_total_score == null
737777 ? null
738778 : Number ( item . node_total_score ) ,
779+ raw_node_agent_score :
780+ typeof item . raw_node_agent_score === "number"
781+ ? item . raw_node_agent_score
782+ : item . raw_node_agent_score == null
783+ ? null
784+ : Number ( item . raw_node_agent_score ) ,
739785 node_agent_score :
740786 typeof item . node_agent_score === "number"
741787 ? item . node_agent_score
@@ -756,6 +802,26 @@ function normalizeNodeLeaderboardRow(raw: unknown): NodeLeaderboardRow | null {
756802 : Number ( item . node_usage_score ) ,
757803 linked_seevomap_node_id : linkedNodeId ,
758804 detail_node_id : detailNodeId ,
805+ score_adjustments : rawScoreAdjustments
806+ . filter ( ( value ) : value is Record < string , unknown > => Boolean ( value && typeof value === "object" ) )
807+ . map ( ( value ) => ( {
808+ target :
809+ typeof value . target === "string" && value . target . trim ( )
810+ ? value . target
811+ : "node_agent_score" ,
812+ delta :
813+ typeof value . delta === "number"
814+ ? value . delta
815+ : Number ( value . delta ?? 0 ) ,
816+ reason :
817+ typeof value . reason === "string" && value . reason . trim ( )
818+ ? value . reason
819+ : null ,
820+ scope :
821+ typeof value . scope === "string" && value . scope . trim ( )
822+ ? value . scope
823+ : null ,
824+ } ) ) ,
759825 } ;
760826}
761827
0 commit comments