bs-agent 0.0.21 → 0.0.23

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.
@@ -478,7 +478,25 @@ function handleTextDelta(event, setMessages, syncSessionRef, modifier, fullTextM
478
478
  }
479
479
  function handleClientToolCall(event, setMessages, syncSessionRef, toolContext, agentId) {
480
480
  const tool = toolContext?.getTool(agentId, event.data.toolName);
481
- if (!tool?.render && !event.data.paused) return;
481
+ console.log(
482
+ "[DEBUG] handleClientToolCall:",
483
+ event.data.toolName,
484
+ "paused:",
485
+ event.data.paused,
486
+ "toolFound:",
487
+ !!tool,
488
+ "hasRender:",
489
+ !!tool?.render
490
+ );
491
+ if (!tool?.render && !event.data.paused) {
492
+ console.log("[DEBUG] handleClientToolCall: SKIPPING part creation \u2014 not paused and no render");
493
+ return;
494
+ }
495
+ console.log(
496
+ "[DEBUG] handleClientToolCall: CREATING widget part for",
497
+ event.data.toolName,
498
+ event.data.callId
499
+ );
482
500
  setMessages((prev) => {
483
501
  const lastMessage = prev[prev.length - 1];
484
502
  const newPart = {
@@ -766,19 +784,34 @@ function useAgent(agent, options) {
766
784
  sessionUtils.syncSessionRef.current(messagesRef.current);
767
785
  }
768
786
  }, [sessionUtils.syncSessionRef]);
769
- return {
770
- inProgress,
771
- messages,
772
- handleSend,
773
- resumeTool,
774
- addOptimisticMessage,
775
- abort,
776
- sessionId: currentSessionId,
777
- switchSession: sessionUtils.switchSession,
778
- deleteSession: sessionUtils.deleteSession,
779
- sessions: sessionUtils.sessionsList,
780
- debugData
781
- };
787
+ return useMemo2(
788
+ () => ({
789
+ inProgress,
790
+ messages,
791
+ handleSend,
792
+ resumeTool,
793
+ addOptimisticMessage,
794
+ abort,
795
+ sessionId: currentSessionId,
796
+ switchSession: sessionUtils.switchSession,
797
+ deleteSession: sessionUtils.deleteSession,
798
+ sessions: sessionUtils.sessionsList,
799
+ debugData
800
+ }),
801
+ [
802
+ inProgress,
803
+ messages,
804
+ handleSend,
805
+ resumeTool,
806
+ addOptimisticMessage,
807
+ abort,
808
+ currentSessionId,
809
+ sessionUtils.switchSession,
810
+ sessionUtils.deleteSession,
811
+ sessionUtils.sessionsList,
812
+ debugData
813
+ ]
814
+ );
782
815
  }
783
816
 
784
817
  // src/core/stream.ts
@@ -1597,6 +1630,19 @@ function ToolRenderer({ agentId, part }) {
1597
1630
  throw new Error("ToolRenderer must be used within <AgentContextProvider>");
1598
1631
  }
1599
1632
  const tool = context.getTool(agentId, part.toolName);
1633
+ console.log(
1634
+ "[DEBUG] ToolRenderer:",
1635
+ part.toolName,
1636
+ part.callId,
1637
+ "toolFound:",
1638
+ !!tool,
1639
+ "hasRender:",
1640
+ !!tool?.render,
1641
+ "paused:",
1642
+ part.paused,
1643
+ "status:",
1644
+ localStatus
1645
+ );
1600
1646
  const handleSubmit = useCallback6(
1601
1647
  (result) => {
1602
1648
  if (localStatus === "submitted") return;