major agent refactoring: wiki knowledge base, no RAG, no Qdrant, no Ollama
This commit is contained in:
@@ -22,7 +22,7 @@ export interface AgentToolConfig {
|
||||
/** Platform tool names to include */
|
||||
platformTools: string[];
|
||||
|
||||
/** MCP tool patterns/names to include (supports wildcards like 'python_*') */
|
||||
/** MCP tool patterns/names to include (supports wildcards like 'Python*') */
|
||||
mcpTools: string[];
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ export class ToolRegistry {
|
||||
let tool: DynamicStructuredTool | null = null;
|
||||
|
||||
switch (toolName) {
|
||||
case 'symbol_lookup': {
|
||||
case 'SymbolLookup': {
|
||||
const symbolIndexService = this.resolveService(this.platformServices.symbolIndexService);
|
||||
if (symbolIndexService) {
|
||||
tool = createSymbolLookupTool({
|
||||
@@ -160,12 +160,12 @@ export class ToolRegistry {
|
||||
logger: this.logger,
|
||||
});
|
||||
} else {
|
||||
this.logger.warn('SymbolIndexService not available for symbol_lookup tool');
|
||||
this.logger.warn('SymbolIndexService not available for SymbolLookup tool');
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'get_chart_data': {
|
||||
case 'GetChartData': {
|
||||
const ohlcService = this.resolveService(this.platformServices.ohlcService);
|
||||
// Use session workspace manager if provided, otherwise try global
|
||||
const workspaceManager = sessionWorkspaceManager ||
|
||||
@@ -179,27 +179,27 @@ export class ToolRegistry {
|
||||
} else {
|
||||
this.logger.warn(
|
||||
{ hasOHLC: !!ohlcService, hasWorkspace: !!workspaceManager },
|
||||
'OHLCService or WorkspaceManager not available for get_chart_data tool'
|
||||
'OHLCService or WorkspaceManager not available for GetChartData tool'
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'web_search': {
|
||||
case 'WebSearch': {
|
||||
if (this.platformServices.tavilyApiKey) {
|
||||
tool = createWebSearchTool({ apiKey: this.platformServices.tavilyApiKey, logger: this.logger });
|
||||
} else {
|
||||
this.logger.warn('TAVILY_API_KEY not configured — web_search tool unavailable');
|
||||
this.logger.warn('TAVILY_API_KEY not configured — WebSearch tool unavailable');
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'fetch_page': {
|
||||
case 'FetchPage': {
|
||||
tool = createFetchPageTool({ logger: this.logger });
|
||||
break;
|
||||
}
|
||||
|
||||
case 'arxiv_search': {
|
||||
case 'ArxivSearch': {
|
||||
tool = createArxivSearchTool({ logger: this.logger });
|
||||
break;
|
||||
}
|
||||
@@ -226,7 +226,7 @@ export class ToolRegistry {
|
||||
|
||||
/**
|
||||
* Filter MCP tools based on patterns/names
|
||||
* Supports wildcards like 'python_*' or exact names like 'execute_research'
|
||||
* Supports wildcards like 'Python*' or exact names like 'ExecuteResearch'
|
||||
*/
|
||||
private filterMCPTools(availableTools: MCPToolInfo[], patterns: string[]): MCPToolInfo[] {
|
||||
if (patterns.length === 0) {
|
||||
@@ -245,7 +245,7 @@ export class ToolRegistry {
|
||||
|
||||
/**
|
||||
* Check if a tool name matches a pattern
|
||||
* Supports wildcards: 'python_*' matches 'python_write', 'python_read', etc.
|
||||
* Supports wildcards: 'Python*' matches 'PythonWrite', 'PythonRead', etc.
|
||||
*/
|
||||
private matchesPattern(toolName: string, pattern: string): boolean {
|
||||
if (pattern === toolName) {
|
||||
@@ -264,6 +264,40 @@ export class ToolRegistry {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve tools directly from explicit platform tool names and MCP patterns,
|
||||
* without requiring a pre-registered agent config.
|
||||
* Used by SpawnService to build tool lists from wiki frontmatter at spawn time.
|
||||
*/
|
||||
async resolveTools(
|
||||
platformTools: string[],
|
||||
mcpPatterns: string[],
|
||||
mcpClient?: MCPClientConnector,
|
||||
availableMCPTools?: MCPToolInfo[],
|
||||
workspaceManager?: WorkspaceManager,
|
||||
onImage?: (image: { data: string; mimeType: string }) => void,
|
||||
onWorkspaceMutation?: (storeName: string, newState: unknown) => void
|
||||
): Promise<DynamicStructuredTool[]> {
|
||||
const tools: DynamicStructuredTool[] = [];
|
||||
|
||||
for (const toolName of platformTools) {
|
||||
const tool = await this.getPlatformTool(toolName, workspaceManager);
|
||||
if (tool) {
|
||||
tools.push(tool);
|
||||
} else {
|
||||
this.logger.warn({ tool: toolName }, 'resolveTools: platform tool not found');
|
||||
}
|
||||
}
|
||||
|
||||
if (mcpClient && availableMCPTools && availableMCPTools.length > 0 && mcpPatterns.length > 0) {
|
||||
const filteredMCPTools = this.filterMCPTools(availableMCPTools, mcpPatterns);
|
||||
const mcpToolInstances = createMCPToolWrappers(filteredMCPTools, mcpClient, this.logger, onImage, onWorkspaceMutation);
|
||||
tools.push(...mcpToolInstances);
|
||||
}
|
||||
|
||||
return tools;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all registered agent names
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user