@@ -495,8 +495,7 @@ export class StackOneToolSet {
495495
496496 // Sort by score, apply topK
497497 allResults . sort ( ( a , b ) => b . similarityScore - a . similarityScore ) ;
498- const topResults =
499- options ?. topK != null ? allResults . slice ( 0 , options . topK ) : allResults ;
498+ const topResults = options ?. topK != null ? allResults . slice ( 0 , options . topK ) : allResults ;
500499
501500 if ( topResults . length === 0 ) {
502501 return new Tools ( [ ] ) ;
@@ -507,9 +506,7 @@ export class StackOneToolSet {
507506 const matchedTools = allTools . toArray ( ) . filter ( ( t ) => actionNames . has ( t . name ) ) ;
508507
509508 // Sort matched tools by semantic search score order
510- const actionOrder = new Map (
511- topResults . map ( ( r , i ) => [ normalizeActionName ( r . actionName ) , i ] ) ,
512- ) ;
509+ const actionOrder = new Map ( topResults . map ( ( r , i ) => [ normalizeActionName ( r . actionName ) , i ] ) ) ;
513510 matchedTools . sort (
514511 ( a , b ) =>
515512 ( actionOrder . get ( a . name ) ?? Number . POSITIVE_INFINITY ) -
@@ -647,11 +644,7 @@ export class StackOneToolSet {
647644 }
648645
649646 const index = new ToolIndex ( allTools . toArray ( ) ) ;
650- const results = await index . search (
651- query ,
652- options ?. topK ?? 5 ,
653- options ?. minSimilarity ?? 0.0 ,
654- ) ;
647+ const results = await index . search ( query , options ?. topK ?? 5 , options ?. minSimilarity ?? 0.0 ) ;
655648
656649 const matchedNames = results . map ( ( r ) => r . name ) ;
657650 const toolMap = new Map ( allTools . toArray ( ) . map ( ( t ) => [ t . name , t ] ) ) ;
@@ -664,9 +657,7 @@ export class StackOneToolSet {
664657 . map ( ( name ) => toolMap . get ( name ) ! )
665658 . filter ( ( tool ) => tool . connector && filterConnectors . has ( tool . connector ) ) ;
666659
667- return new Tools (
668- options ?. topK != null ? matchedTools . slice ( 0 , options . topK ) : matchedTools ,
669- ) ;
660+ return new Tools ( options ?. topK != null ? matchedTools . slice ( 0 , options . topK ) : matchedTools ) ;
670661 }
671662
672663 /**
0 commit comments