-
Notifications
You must be signed in to change notification settings - Fork 137
Expand file tree
/
Copy pathindex.ts
More file actions
33 lines (28 loc) · 1.53 KB
/
index.ts
File metadata and controls
33 lines (28 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { HelperTools } from '../const.js';
import type { ToolCategory } from '../types.js';
import { getExpectedToolsByCategories } from '../utils/tool-categories-helpers.js';
import { callActorGetDataset, getActorsAsTools } from './actor.js';
import { buildCategories, CATEGORY_NAMES, toolCategories, toolCategoriesEnabledByDefault } from './categories.js';
// Use string constants instead of importing tool objects to avoid circular dependency
export const unauthEnabledTools: string[] = [
HelperTools.DOCS_SEARCH,
HelperTools.DOCS_FETCH,
HelperTools.STORE_SEARCH,
];
// Re-export from categories.ts
// This is actually needed to avoid circular dependency issues
export { buildCategories, CATEGORY_NAMES, toolCategories, toolCategoriesEnabledByDefault };
// Computed here (not in helper file) to avoid module initialization issues
export const defaultTools = getExpectedToolsByCategories(toolCategoriesEnabledByDefault);
/**
* Returns the list of tool categories that are enabled for unauthenticated users.
* A category is included only if all tools in it are in the unauthEnabledTools list.
*/
export function getUnauthEnabledToolCategories(): ToolCategory[] {
const unauthEnabledToolsSet = new Set(unauthEnabledTools);
return (Object.entries(toolCategories) as [ToolCategory, typeof toolCategories[ToolCategory]][])
.filter(([, tools]) => tools.every((tool) => unauthEnabledToolsSet.has(tool.name)))
.map(([category]) => category);
}
// Export actor-related tools
export { callActorGetDataset, getActorsAsTools };