@@ -67,11 +67,14 @@ export async function loadToolsFromInput(
6767 }
6868
6969 // Decide which Actors to load
70- const actorsFromField : string [ ] | undefined = input . actors === undefined
71- ? undefined
72- : Array . isArray ( input . actors )
73- ? input . actors
74- : [ input . actors ] ;
70+ let actorsFromField : string [ ] | undefined ;
71+ if ( input . actors === undefined ) {
72+ actorsFromField = undefined ;
73+ } else if ( Array . isArray ( input . actors ) ) {
74+ actorsFromField = input . actors ;
75+ } else {
76+ actorsFromField = [ input . actors ] ;
77+ }
7578
7679 let actorNamesToLoad : string [ ] = [ ] ;
7780 if ( actorsFromField !== undefined ) {
@@ -94,13 +97,11 @@ export async function loadToolsFromInput(
9497 const hasAddActor = result . some ( ( e ) => e . tool . name === addTool . tool . name ) ;
9598 if ( ! hasAddActor ) result . push ( addTool ) ;
9699 }
97- } else {
100+ } else if ( addActorEnabled && ! actorsExplicitlyEmpty ) {
98101 // No selectors: either expose only add-actor (when enabled), or default categories
99- if ( addActorEnabled && ! actorsExplicitlyEmpty ) {
100- result . push ( addTool ) ;
101- } else if ( ! actorsExplicitlyEmpty ) {
102- result . push ( ...getExpectedToolsByCategories ( toolCategoriesEnabledByDefault ) ) ;
103- }
102+ result . push ( addTool ) ;
103+ } else if ( ! actorsExplicitlyEmpty ) {
104+ result . push ( ...getExpectedToolsByCategories ( toolCategoriesEnabledByDefault ) ) ;
104105 }
105106
106107 // Actor tools (if any)
@@ -112,7 +113,7 @@ export async function loadToolsFromInput(
112113 // De-duplicate by tool name for safety
113114 const seen = new Set < string > ( ) ;
114115 const deduped = result . filter ( ( entry ) => {
115- const name = entry . tool . name ;
116+ const { name } = entry . tool ;
116117 if ( seen . has ( name ) ) return false ;
117118 seen . add ( name ) ;
118119 return true ;
0 commit comments