@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/index.cjs CHANGED
@@ -6032,10 +6032,7 @@ function createExecuteLlmStage(dependencies) {
6032
6032
  const promptBudget = ctx.promptBudget;
6033
6033
  const promptUsageMeasurementPolicy = ctx.promptUsageMeasurementPolicy;
6034
6034
  const streamEventHandler = ctx.input.stream && ctx.eventHandler ? (event) => {
6035
- const processedEvent = processStreamEvent(event, ctx.outputProcessor);
6036
- if (processedEvent) {
6037
- ctx.eventHandler?.(processedEvent);
6038
- }
6035
+ ctx.eventHandler?.(processStreamEvent(event, ctx.outputProcessor));
6039
6036
  } : void 0;
6040
6037
  const llmCallStartedAt = Date.now();
6041
6038
  let llmResp;
@@ -6191,9 +6188,6 @@ function processStreamEvent(event, outputProcessor) {
6191
6188
  return event;
6192
6189
  }
6193
6190
  const processedContent = outputProcessor.processStreamChunk(event.content);
6194
- if (processedContent.length === 0) {
6195
- return null;
6196
- }
6197
6191
  return {
6198
6192
  ...event,
6199
6193
  content: processedContent
@@ -7764,9 +7758,7 @@ function mapToolProgressToRuntime(toolEvent, context, options, id, timestamp) {
7764
7758
  return event;
7765
7759
  }
7766
7760
  function mapStreamChunkToRuntime(streamEvent, context, id, timestamp) {
7767
- const text = streamEvent.content ?? "";
7768
- if (!text) return null;
7769
- const chunkEvent = createFinalAnswerChunkEvent(id, context.conversationId, context.turnId, streamEvent.answer_id, streamEvent.seq, text, {
7761
+ const chunkEvent = createFinalAnswerChunkEvent(id, context.conversationId, context.turnId, streamEvent.answer_id, streamEvent.seq, streamEvent.content, {
7770
7762
  timestamp,
7771
7763
  is_last: streamEvent.is_last === true
7772
7764
  });
@@ -9730,6 +9722,14 @@ var ToolNode = class {
9730
9722
  error.name = "AbortError";
9731
9723
  throw error;
9732
9724
  }
9725
+ if (result.kind === "interrupted") {
9726
+ await commitToolBoundary(state, {
9727
+ kind: "route",
9728
+ nextNodeId: "llm",
9729
+ events: result.events
9730
+ });
9731
+ throw result.error;
9732
+ }
9733
9733
  await commitToolBoundary(state, result);
9734
9734
  if (Array.isArray(result.events) && result.events.length > 0) {
9735
9735
  events.push(...result.events);
@@ -10170,7 +10170,11 @@ var ToolNode = class {
10170
10170
  nextProtocolErrorCount: fuse.nextCount
10171
10171
  });
10172
10172
  if (fuse.shouldFuse && remainingCalls.length === 0) {
10173
- throw createToolProtocolFuseError(fuse.nextCount, context.exec.error);
10173
+ return {
10174
+ kind: "interrupted",
10175
+ error: createToolProtocolFuseError(fuse.nextCount, context.exec.error),
10176
+ events: context.bridge.getRuntimeEvents()
10177
+ };
10174
10178
  }
10175
10179
  if (remainingCalls.length === 0 && context.local.toolBatchCompletionMode === "yield_after_batch") {
10176
10180
  return { kind: "yield", events: context.bridge.getRuntimeEvents() };