import type { Span } from '@opentelemetry/api'; import type { AgentInternalTool } from '../AgentTool/types'; import type { AgentLLMIntegrationOutput } from '../Integrations/types'; import type { IMCPClient } from '../interfaces.mcp'; import type { OtelInfoType } from '../types'; import type { AgentMessage, AgentServiceContract, AgentToolCallContent, AgentToolDefinition } from './types.js'; /** * Transforms a map of Arvo Service Contracts into LLM-compatible Tool Definitions. * * This function extracts the `accepts` schema from the contract, strips out internal * Arvo fields (like `parentSubject$$`), and formats it for the LLM's context window. */ export declare const generateServiceToolDefinitions: >(services: TServiceContract) => { [K in keyof TServiceContract]: AgentToolDefinition; }; /** * Fetches available tools from a connected MCP Client and adapts them to the Agent's internal format. * * This runs at runtime during the Agent execution loop to ensure the tool list is current. */ export declare const generateMcpToolDefinitions: (mcp: IMCPClient | null, config: { otelInfo: OtelInfoType; }) => Promise>>; /** * Converts local `AgentInternalTool` definitions (Zod schemas) into JSON Schema for the LLM. * Uses `zod-to-json-schema` for the conversion. */ export declare const generateAgentInternalToolDefinitions: >(tools: Record) => { [K in keyof TTools]: AgentToolDefinition; }; /** Helper utility to truncate long strings (e.g. Base64 images) in logs/traces. */ export declare const clampStr: (s: string, len: number) => string; /** * Populates the OpenTelemetry Span with all LLM Input data using OpenInference Semantic Conventions. * * This records: * 1. The LLM Config (Provider, Model, System Prompt). * 2. The full Conversation History (mapped from Arvo format to OpenInference format). * 3. Tool Definitions (so traces show what tools were available). * 4. Multi-modal content (Image/File placeholders). */ export declare const setOpenInferenceInputAttr: (param: { llm: { provider: string; system: string; model: string; invocationParam: Record; }; messages: AgentMessage[]; system: string | null; tools: AgentToolDefinition[]; }, span: Span) => void; /** * Records the LLM's generated Tool Calls to the OpenTelemetry Span. * Adds attributes for Function Name and JSON Arguments. */ export declare const setOpenInferenceToolCallOutputAttr: (param: { toolCalls: Omit[]; }, span: Span) => void; /** * Records Token Usage metrics (Prompt, Completion, Total) to the OpenTelemetry Span. */ export declare const setOpenInferenceUsageOutputAttr: (param: AgentLLMIntegrationOutput["usage"], span: Span) => void; /** * Records the LLM's final textual response to the OpenTelemetry Span. */ export declare const setOpenInferenceResponseOutputAttr: (param: { response: string; }, span: Span) => void; /** Safe wrapper around JSON.parse that returns null instead of throwing. */ export declare const tryParseJson: (str: string) => Record | null; /** * Implements the Priority-Based Execution logic. * * Takes a list of requested tool calls, groups them by their configured priority, * and returns **only** the batch with the highest priority. All lower priority * calls are discarded. */ export declare const prioritizeToolCalls: (toolCalls: Omit[], nameToToolMap: Record) => Omit[]; /** * Apply the enablement on the available tools. By default * all the tools are enabled. Tools are removed only when they * are explicitly marked as false */ export declare const applyToolEnablement: (tools: AgentToolDefinition[], toolEnablementMap: Record) => AgentToolDefinition[]; //# sourceMappingURL=utils.d.ts.map