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