File size: 1,149 Bytes
68d7816 | 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 34 35 36 | import { createDecorator, type ServiceIdentifier } from '#/_base/di/instantiation';
import type { ContextMessage } from '#/agent/contextMemory/types';
import type { ToolDescription as Tool } from '#human/llm/message';
import type { ToolInfo } from '#/tool/toolContract';
export const SELECT_TOOLS_TOOL_NAME = 'select_tools';
export interface ShapedToolEntry extends ToolInfo {
readonly deferred?: true;
}
export interface LoadToolsResult {
readonly toLoad: readonly string[];
readonly alreadyAvailable: readonly string[];
readonly unknown: readonly string[];
}
export interface IAgentToolSelectService {
readonly _serviceBrand: undefined;
enabled(): boolean;
shapeTools(entries: readonly ToolInfo[]): readonly ShapedToolEntry[];
shapeHistory(messages: readonly ContextMessage[]): readonly ContextMessage[];
load(names: readonly string[]): LoadToolsResult;
drainPendingToolSchemas(): readonly Tool[] | undefined;
loadableToolsAnnouncement(): string | undefined;
}
export const IAgentToolSelectService: ServiceIdentifier<IAgentToolSelectService> =
createDecorator<IAgentToolSelectService>('agentToolSelectService');
|