@juspay/neurolink
Version:
Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio
26 lines (25 loc) • 1.26 kB
TypeScript
/**
* toolEndEmitter — shared helper for emitting `tool:end` events from
* AI-SDK `onStepFinish` callbacks.
*
* Pipeline B (metrics aggregator) listens for `tool:end` on the NeuroLink
* EventEmitter. When tools are executed by the AI SDK internally (via
* `generateText` / `streamText`) the SDK calls `onStepFinish` with the
* completed tool results. Without this helper those results are silently
* stored but never surfaced as `tool:end` events, leaving Pipeline B with
* zero tool spans for AI-SDK-driven tool calls (gaps G5 and S2).
*
* @module utils/toolEndEmitter
*/
import type { NeuroLinkEvents, StepToolResult, TypedEventEmitter } from "../types/index.js";
/**
* Emit a `tool:end` event for every completed tool result in an
* `onStepFinish` callback.
*
* @param emitter - The NeuroLink event emitter (obtained via
* `neurolink.getEventEmitter()`). When `undefined` the function is a
* no-op so callers need not guard every call site.
* @param toolResults - The `toolResults` array from `onStepFinish`. When
* `undefined` or empty the function is a no-op.
*/
export declare function emitToolEndFromStepFinish(emitter: TypedEventEmitter<NeuroLinkEvents> | undefined, toolResults: StepToolResult[] | undefined): void;