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