@@ -16,6 +16,13 @@ import { getUserRunsList } from './run_collection.js';
1616import { searchApifyDocsTool } from './search-apify-docs.js' ;
1717import { searchActors } from './store_collection.js' ;
1818
19+ /* list of tools that can be used without authentication */
20+ export const unauthEnabledTools : string [ ] = [
21+ // docs
22+ searchApifyDocsTool . name ,
23+ fetchApifyDocsTool . name ,
24+ ] ;
25+
1926export const toolCategories = {
2027 experimental : [
2128 addTool ,
@@ -49,11 +56,29 @@ export const toolCategories = {
4956 getHtmlSkeleton ,
5057 ] ,
5158} ;
59+
5260export const toolCategoriesEnabledByDefault : ToolCategory [ ] = [
5361 'actors' ,
5462 'docs' ,
5563] ;
5664
65+ /**
66+ * Builds the list of tool categories that are enabled for unauthenticated users.
67+ * A category is included if all tools in it are in the unauthEnabledTools list.
68+ */
69+ function buildUnauthEnabledToolCategories ( ) : ToolCategory [ ] {
70+ const unauthEnabledToolsSet = new Set ( unauthEnabledTools ) ;
71+
72+ return ( Object . entries ( toolCategories ) as [ ToolCategory , typeof toolCategories [ ToolCategory ] ] [ ] )
73+ . filter ( ( [ , tools ] ) => {
74+ // Include category only if all tools are in the unauthEnabledTools list
75+ return tools . every ( ( tool ) => unauthEnabledToolsSet . has ( tool . name ) ) ;
76+ } )
77+ . map ( ( [ category ] ) => category ) ;
78+ }
79+
80+ export const unauthEnabledToolCategories = buildUnauthEnabledToolCategories ( ) ;
81+
5782export const defaultTools = getExpectedToolsByCategories ( toolCategoriesEnabledByDefault ) ;
5883
5984// Export only the tools that are being used
0 commit comments