MCPcopy Create free account
hub / github.com/apache/maka / transform

Function transform

packages/runtime/src/model-factory.ts:288–303  ·  view source on GitHub ↗
(chunk, controller)

Source from the content-addressed store, hash-verified

286 const stream = result.stream.pipeThrough(
287 new TransformStream({
288 transform(chunk, controller) {
289 if (chunk.type === 'tool-call') {
290 pendingToolCalls.push(chunk);
291 return;
292 }
293 if (chunk.type === 'finish') {
294 const details = reasoningDetailsFromMetadata(chunk.providerMetadata);
295 for (const toolCall of pendingToolCalls) {
296 controller.enqueue(
297 details ? withReasoningDetails([toolCall], details)[0] : toolCall,
298 );
299 }
300 pendingToolCalls = [];
301 }
302 controller.enqueue(chunk);
303 },
304 flush(controller) {
305 for (const toolCall of pendingToolCalls) controller.enqueue(toolCall);
306 },

Callers

nothing calls this directly

Calls 4

withReasoningDetailsFunction · 0.85
pushMethod · 0.65
enqueueMethod · 0.45

Tested by

no test coverage detected