@eko-ai/eko 4.0.7 → 4.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -38057,6 +38057,11 @@ async function callWithReAct(rlm, request, toolCallsOrCallback, streamCallback,
38057
38057
  let loopNum = 0;
38058
38058
  let assistantParts = null;
38059
38059
  while (true) {
38060
+ await streamCallback?.({
38061
+ type: "loop_start",
38062
+ request,
38063
+ loopNum,
38064
+ });
38060
38065
  assistantParts = await callLLM(rlm, request, streamCallback, errorHandler, finishHandler);
38061
38066
  if (assistantParts.length > 0) {
38062
38067
  request.messages.push({
@@ -38066,6 +38071,12 @@ async function callWithReAct(rlm, request, toolCallsOrCallback, streamCallback,
38066
38071
  }
38067
38072
  const continueLoop = await loopControl(request, assistantParts, loopNum);
38068
38073
  if (!continueLoop) {
38074
+ await streamCallback?.({
38075
+ type: "loop_end",
38076
+ request,
38077
+ loopNum,
38078
+ continueLoop,
38079
+ });
38069
38080
  break;
38070
38081
  }
38071
38082
  const toolUses = assistantParts.filter((s) => s.type == "tool-call");
@@ -38096,6 +38107,12 @@ async function callWithReAct(rlm, request, toolCallsOrCallback, streamCallback,
38096
38107
  })),
38097
38108
  });
38098
38109
  }
38110
+ await streamCallback?.({
38111
+ type: "loop_end",
38112
+ request,
38113
+ loopNum,
38114
+ continueLoop,
38115
+ });
38099
38116
  loopNum++;
38100
38117
  }
38101
38118
  return assistantParts;
@@ -38134,6 +38151,7 @@ async function callLLM(rlm, request, streamCallback, errorHandler, finishHandler
38134
38151
  streamId: textStreamId,
38135
38152
  streamDone: false,
38136
38153
  text: streamText,
38154
+ newTextLength: chunk.delta?.length || 0,
38137
38155
  });
38138
38156
  if (toolPart) {
38139
38157
  await streamCallback?.({
@@ -38155,6 +38173,7 @@ async function callLLM(rlm, request, streamCallback, errorHandler, finishHandler
38155
38173
  streamId: textStreamId,
38156
38174
  streamDone: true,
38157
38175
  text: streamText,
38176
+ newTextLength: 0,
38158
38177
  providerMetadata: chunk.providerMetadata,
38159
38178
  });
38160
38179
  }
@@ -38171,6 +38190,7 @@ async function callLLM(rlm, request, streamCallback, errorHandler, finishHandler
38171
38190
  streamId: thinkStreamId,
38172
38191
  streamDone: false,
38173
38192
  text: thinkText,
38193
+ newTextLength: chunk.delta?.length || 0,
38174
38194
  });
38175
38195
  break;
38176
38196
  }
@@ -38181,6 +38201,7 @@ async function callLLM(rlm, request, streamCallback, errorHandler, finishHandler
38181
38201
  streamId: thinkStreamId,
38182
38202
  streamDone: true,
38183
38203
  text: thinkText,
38204
+ newTextLength: 0,
38184
38205
  });
38185
38206
  }
38186
38207
  break;
@@ -38218,6 +38239,7 @@ async function callLLM(rlm, request, streamCallback, errorHandler, finishHandler
38218
38239
  streamId: textStreamId,
38219
38240
  streamDone: true,
38220
38241
  text: streamText,
38242
+ newTextLength: 0,
38221
38243
  });
38222
38244
  }
38223
38245
  toolArgsText += chunk.delta || "";
@@ -38226,6 +38248,7 @@ async function callLLM(rlm, request, streamCallback, errorHandler, finishHandler
38226
38248
  toolCallId: chunk.id,
38227
38249
  toolName: toolPart?.toolName || "",
38228
38250
  paramsText: toolArgsText,
38251
+ newTextLength: chunk.delta?.length || 0,
38229
38252
  });
38230
38253
  break;
38231
38254
  }
@@ -38271,6 +38294,13 @@ async function callLLM(rlm, request, streamCallback, errorHandler, finishHandler
38271
38294
  });
38272
38295
  break;
38273
38296
  }
38297
+ case "raw": {
38298
+ await streamCallback?.({
38299
+ type: "raw",
38300
+ rawValue: chunk.rawValue,
38301
+ });
38302
+ break;
38303
+ }
38274
38304
  case "error": {
38275
38305
  Log.error(`chatLLM error: `, chunk);
38276
38306
  await streamCallback?.({
@@ -38287,6 +38317,7 @@ async function callLLM(rlm, request, streamCallback, errorHandler, finishHandler
38287
38317
  streamId: textStreamId,
38288
38318
  streamDone: true,
38289
38319
  text: streamText,
38320
+ newTextLength: 0,
38290
38321
  });
38291
38322
  }
38292
38323
  if (toolPart) {