feat(tools): add ToolRegistry, ToolSearchTool and ExpertTool to support on-demand tool visibility, discovery, activation, and expert/subagent tooling; extend DualAgentOrchestrator API and interfaces to manage tool lifecycle

This commit is contained in:
2026-01-20 14:39:34 +00:00
parent 5ca0c80ea9
commit 5aa69cc998
10 changed files with 924 additions and 37 deletions

View File

@@ -1,5 +1,65 @@
import * as plugins from './plugins.js';
// ================================
// Tool Visibility & Registry Types
// ================================
/**
* Tool visibility mode
* - 'initial': Conveyed to model in system prompt AND discoverable via search
* - 'on-demand': Only discoverable via search, must be activated before use
*/
export type TToolVisibility = 'initial' | 'on-demand';
/**
* Tool metadata for discovery and management
*/
export interface IToolMetadata {
name: string;
description: string;
actions: IToolAction[];
visibility: TToolVisibility;
isActivated: boolean;
isInitialized: boolean;
tags?: string[];
category?: string;
}
/**
* Options when registering a tool
*/
export interface IToolRegistrationOptions {
visibility?: TToolVisibility;
tags?: string[];
category?: string;
}
/**
* Configuration for creating an Expert (SubAgent)
*/
export interface IExpertConfig {
/** Unique name for the expert */
name: string;
/** Description of the expert's capabilities */
description: string;
/** System message defining expert behavior */
systemMessage: string;
/** Guardian policy for the expert's inner agent */
guardianPolicy: string;
/** AI provider (defaults to parent's provider) */
provider?: plugins.smartai.TProvider;
/** Tools available to this expert */
tools?: IAgentToolWrapper[];
/** Max iterations for expert tasks (default: 10) */
maxIterations?: number;
/** Visibility mode (default: 'initial') */
visibility?: TToolVisibility;
/** Searchable tags */
tags?: string[];
/** Category for grouping */
category?: string;
}
// ================================
// Task Run Options
// ================================