@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.
@@ -5030,10 +5030,7 @@ function createExecuteLlmStage(dependencies) {
5030
5030
  const promptBudget = ctx.promptBudget;
5031
5031
  const promptUsageMeasurementPolicy = ctx.promptUsageMeasurementPolicy;
5032
5032
  const streamEventHandler = ctx.input.stream && ctx.eventHandler ? (event) => {
5033
- const processedEvent = processStreamEvent(event, ctx.outputProcessor);
5034
- if (processedEvent) {
5035
- ctx.eventHandler?.(processedEvent);
5036
- }
5033
+ ctx.eventHandler?.(processStreamEvent(event, ctx.outputProcessor));
5037
5034
  } : void 0;
5038
5035
  const llmCallStartedAt = Date.now();
5039
5036
  let llmResp;
@@ -5189,9 +5186,6 @@ function processStreamEvent(event, outputProcessor) {
5189
5186
  return event;
5190
5187
  }
5191
5188
  const processedContent = outputProcessor.processStreamChunk(event.content);
5192
- if (processedContent.length === 0) {
5193
- return null;
5194
- }
5195
5189
  return {
5196
5190
  ...event,
5197
5191
  content: processedContent
@@ -6762,9 +6756,7 @@ function mapToolProgressToRuntime(toolEvent, context, options, id, timestamp) {
6762
6756
  return event;
6763
6757
  }
6764
6758
  function mapStreamChunkToRuntime(streamEvent, context, id, timestamp) {
6765
- const text = streamEvent.content ?? "";
6766
- if (!text) return null;
6767
- const chunkEvent = createFinalAnswerChunkEvent(id, context.conversationId, context.turnId, streamEvent.answer_id, streamEvent.seq, text, {
6759
+ const chunkEvent = createFinalAnswerChunkEvent(id, context.conversationId, context.turnId, streamEvent.answer_id, streamEvent.seq, streamEvent.content, {
6768
6760
  timestamp,
6769
6761
  is_last: streamEvent.is_last === true
6770
6762
  });
@@ -8721,6 +8713,14 @@ var ToolNode = class {
8721
8713
  error.name = "AbortError";
8722
8714
  throw error;
8723
8715
  }
8716
+ if (result.kind === "interrupted") {
8717
+ await commitToolBoundary(state, {
8718
+ kind: "route",
8719
+ nextNodeId: "llm",
8720
+ events: result.events
8721
+ });
8722
+ throw result.error;
8723
+ }
8724
8724
  await commitToolBoundary(state, result);
8725
8725
  if (Array.isArray(result.events) && result.events.length > 0) {
8726
8726
  events.push(...result.events);
@@ -9161,7 +9161,11 @@ var ToolNode = class {
9161
9161
  nextProtocolErrorCount: fuse.nextCount
9162
9162
  });
9163
9163
  if (fuse.shouldFuse && remainingCalls.length === 0) {
9164
- throw createToolProtocolFuseError(fuse.nextCount, context.exec.error);
9164
+ return {
9165
+ kind: "interrupted",
9166
+ error: createToolProtocolFuseError(fuse.nextCount, context.exec.error),
9167
+ events: context.bridge.getRuntimeEvents()
9168
+ };
9165
9169
  }
9166
9170
  if (remainingCalls.length === 0 && context.local.toolBatchCompletionMode === "yield_after_batch") {
9167
9171
  return { kind: "yield", events: context.bridge.getRuntimeEvents() };