/** * Copyright 2025 Vybestack LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Tool call fragment interface */ export interface ToolCallFragment { index: number; id?: string; name?: string; args?: string; timestamp: number; } /** * Tool call candidate interface */ export interface ToolCallCandidate { index: number; id?: string; name?: string; args?: string; fragments: ToolCallFragment[]; } /** * ToolCallCollector - Responsible for collecting and assembling tool call fragments * * Core functionality: * 1. Collect fragments from each streaming chunk * 2. Avoid collecting duplicate fragments * 3. Determine when collection is complete * 4. Assemble complete tool calls */ export declare class ToolCallCollector { private fragments; /** * Add tool call fragment */ addFragment(index: number, fragment: Partial): void; /** * Get all completed tool calls */ getCompleteCalls(): ToolCallCandidate[]; /** * Check if fragment is complete */ private isComplete; /** * Assemble complete tool call */ private assembleCall; /** * Check if two fragments are duplicates */ private isDuplicateFragment; /** * Get collector statistics */ getStats(): { totalCalls: number; completedCalls: number; pendingFragments: number; }; /** * Reset collector state */ reset(): void; }