UNPKG

@mastra/core

Version:

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

45 lines (42 loc) 950 B
'use strict'; var web = require('stream/web'); // src/tools/stream.ts var ToolStream = class extends web.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(); } } }; exports.ToolStream = ToolStream; //# sourceMappingURL=chunk-S6MAHT7F.cjs.map //# sourceMappingURL=chunk-S6MAHT7F.cjs.map