@flamingo-stack/openframe-frontend-core 0.0.206 → 0.0.207

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.
@@ -39815,10 +39815,12 @@ function useRealtimeChunkProcessor(options) {
39815
39815
  callbacks.onEscalatedApproval?.(requestId, data);
39816
39816
  });
39817
39817
  }
39818
+ hasEverStreamedRef.current = true;
39818
39819
  hasInitializedWithData.current = true;
39819
39820
  }
39820
39821
  }, [initialState, callbacks]);
39821
39822
  const isInStreamRef = useRef48(false);
39823
+ const hasEverStreamedRef = useRef48(false);
39822
39824
  const pendingEscalatedRef = useRef48(/* @__PURE__ */ new Map());
39823
39825
  const processChunk = useCallback36(
39824
39826
  (chunk) => {
@@ -39831,6 +39833,7 @@ function useRealtimeChunkProcessor(options) {
39831
39833
  switch (action.action) {
39832
39834
  case "message_start":
39833
39835
  isInStreamRef.current = true;
39836
+ hasEverStreamedRef.current = true;
39834
39837
  callbacks.onStreamStart?.();
39835
39838
  accumulator.resetSegments();
39836
39839
  break;
@@ -39844,15 +39847,27 @@ function useRealtimeChunkProcessor(options) {
39844
39847
  break;
39845
39848
  case "text": {
39846
39849
  const segments = accumulator.appendText(action.text);
39847
- callbacks.onSegmentsUpdate?.(segments);
39850
+ if (isInStreamRef.current || !hasEverStreamedRef.current) {
39851
+ callbacks.onSegmentsUpdate?.(segments);
39852
+ } else {
39853
+ callbacks.onSegmentsUpdate?.([{ type: "text", text: action.text }], { append: true });
39854
+ }
39848
39855
  break;
39849
39856
  }
39850
39857
  case "thinking": {
39851
39858
  const segments = accumulator.appendThinking(action.text);
39852
- callbacks.onSegmentsUpdate?.(segments);
39859
+ if (isInStreamRef.current || !hasEverStreamedRef.current) {
39860
+ callbacks.onSegmentsUpdate?.(segments);
39861
+ } else {
39862
+ callbacks.onSegmentsUpdate?.([{ type: "thinking", text: action.text }], { append: true });
39863
+ }
39853
39864
  break;
39854
39865
  }
39855
39866
  case "tool_execution": {
39867
+ if (!isInStreamRef.current && callbacks.onToolExecuted) {
39868
+ callbacks.onToolExecuted(action.segment);
39869
+ break;
39870
+ }
39856
39871
  const segments = accumulator.addToolExecution(action.segment);
39857
39872
  callbacks.onSegmentsUpdate?.(segments);
39858
39873
  break;
@@ -39958,10 +39973,12 @@ function useRealtimeChunkProcessor(options) {
39958
39973
  callbacks.onSegmentsUpdate?.(segments);
39959
39974
  }
39960
39975
  } else {
39961
- const segments = accumulator.updateApprovalStatus(requestId, status);
39962
- callbacks.onSegmentsUpdate?.(segments);
39976
+ accumulator.updateApprovalStatus(requestId, status);
39977
+ if (!callbacks.onApprovalResolved) {
39978
+ callbacks.onSegmentsUpdate?.(accumulator.getSegments());
39979
+ }
39963
39980
  }
39964
- void approvalType;
39981
+ callbacks.onApprovalResolved?.(requestId, status, approvalType);
39965
39982
  break;
39966
39983
  }
39967
39984
  case "error": {
@@ -43690,4 +43707,4 @@ export {
43690
43707
  TMCG_SOCIAL_PLATFORMS,
43691
43708
  assets
43692
43709
  };
43693
- //# sourceMappingURL=chunk-OLTGB32E.js.map
43710
+ //# sourceMappingURL=chunk-Z3GQGR5E.js.map