UNPKG

@mastra/core

Version:

The core foundation of the Mastra framework, providing essential components and interfaces for building AI-powered applications.

43 lines (41 loc) 931 B
import { WritableStream } from 'stream/web'; // src/tools/stream.ts var ToolStream = class extends WritableStream { constructor({ prefix, callId, name, runId }, originalStream) { super({ async write(chunk) { const writer = originalStream?.getWriter(); try { await writer?.write({ type: `${prefix}-output`, runId, from: "USER", payload: { output: chunk, [`${prefix}CallId`]: callId, [`${prefix}Name`]: name } }); } finally { writer?.releaseLock(); } } }); } async write(data) { const writer = this.getWriter(); try { await writer.write(data); } finally { writer.releaseLock(); } } }; export { ToolStream }; //# sourceMappingURL=chunk-YW7UILPE.js.map //# sourceMappingURL=chunk-YW7UILPE.js.map