@linnlabs/linnkit 0.37.0 → 0.37.2

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/testkit.js CHANGED
@@ -5218,10 +5218,7 @@ function createExecuteLlmStage(dependencies) {
5218
5218
  const promptBudget = ctx.promptBudget;
5219
5219
  const promptUsageMeasurementPolicy = ctx.promptUsageMeasurementPolicy;
5220
5220
  const streamEventHandler = ctx.input.stream && ctx.eventHandler ? (event) => {
5221
- const processedEvent = processStreamEvent(event, ctx.outputProcessor);
5222
- if (processedEvent) {
5223
- ctx.eventHandler?.(processedEvent);
5224
- }
5221
+ ctx.eventHandler?.(processStreamEvent(event, ctx.outputProcessor));
5225
5222
  } : void 0;
5226
5223
  const llmCallStartedAt = Date.now();
5227
5224
  let llmResp;
@@ -5377,9 +5374,6 @@ function processStreamEvent(event, outputProcessor) {
5377
5374
  return event;
5378
5375
  }
5379
5376
  const processedContent = outputProcessor.processStreamChunk(event.content);
5380
- if (processedContent.length === 0) {
5381
- return null;
5382
- }
5383
5377
  return {
5384
5378
  ...event,
5385
5379
  content: processedContent
@@ -6950,9 +6944,7 @@ function mapToolProgressToRuntime(toolEvent, context, options, id, timestamp) {
6950
6944
  return event;
6951
6945
  }
6952
6946
  function mapStreamChunkToRuntime(streamEvent, context, id, timestamp) {
6953
- const text = streamEvent.content ?? "";
6954
- if (!text) return null;
6955
- const chunkEvent = createFinalAnswerChunkEvent(id, context.conversationId, context.turnId, streamEvent.answer_id, streamEvent.seq, text, {
6947
+ const chunkEvent = createFinalAnswerChunkEvent(id, context.conversationId, context.turnId, streamEvent.answer_id, streamEvent.seq, streamEvent.content, {
6956
6948
  timestamp,
6957
6949
  is_last: streamEvent.is_last === true
6958
6950
  });
@@ -8909,6 +8901,14 @@ var ToolNode = class {
8909
8901
  error.name = "AbortError";
8910
8902
  throw error;
8911
8903
  }
8904
+ if (result.kind === "interrupted") {
8905
+ await commitToolBoundary(state, {
8906
+ kind: "route",
8907
+ nextNodeId: "llm",
8908
+ events: result.events
8909
+ });
8910
+ throw result.error;
8911
+ }
8912
8912
  await commitToolBoundary(state, result);
8913
8913
  if (Array.isArray(result.events) && result.events.length > 0) {
8914
8914
  events.push(...result.events);
@@ -9349,7 +9349,11 @@ var ToolNode = class {
9349
9349
  nextProtocolErrorCount: fuse.nextCount
9350
9350
  });
9351
9351
  if (fuse.shouldFuse && remainingCalls.length === 0) {
9352
- throw createToolProtocolFuseError(fuse.nextCount, context.exec.error);
9352
+ return {
9353
+ kind: "interrupted",
9354
+ error: createToolProtocolFuseError(fuse.nextCount, context.exec.error),
9355
+ events: context.bridge.getRuntimeEvents()
9356
+ };
9353
9357
  }
9354
9358
  if (remainingCalls.length === 0 && context.local.toolBatchCompletionMode === "yield_after_batch") {
9355
9359
  return { kind: "yield", events: context.bridge.getRuntimeEvents() };