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.
- package/dist/react/index.cjs +60 -14
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +60 -14
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.cjs
CHANGED
|
@@ -509,7 +509,25 @@ function handleTextDelta(event, setMessages, syncSessionRef, modifier, fullTextM
|
|
|
509
509
|
}
|
|
510
510
|
function handleClientToolCall(event, setMessages, syncSessionRef, toolContext, agentId) {
|
|
511
511
|
const tool = toolContext?.getTool(agentId, event.data.toolName);
|
|
512
|
-
|
|
512
|
+
console.log(
|
|
513
|
+
"[DEBUG] handleClientToolCall:",
|
|
514
|
+
event.data.toolName,
|
|
515
|
+
"paused:",
|
|
516
|
+
event.data.paused,
|
|
517
|
+
"toolFound:",
|
|
518
|
+
!!tool,
|
|
519
|
+
"hasRender:",
|
|
520
|
+
!!tool?.render
|
|
521
|
+
);
|
|
522
|
+
if (!tool?.render && !event.data.paused) {
|
|
523
|
+
console.log("[DEBUG] handleClientToolCall: SKIPPING part creation \u2014 not paused and no render");
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
console.log(
|
|
527
|
+
"[DEBUG] handleClientToolCall: CREATING widget part for",
|
|
528
|
+
event.data.toolName,
|
|
529
|
+
event.data.callId
|
|
530
|
+
);
|
|
513
531
|
setMessages((prev) => {
|
|
514
532
|
const lastMessage = prev[prev.length - 1];
|
|
515
533
|
const newPart = {
|
|
@@ -797,19 +815,34 @@ function useAgent(agent, options) {
|
|
|
797
815
|
sessionUtils.syncSessionRef.current(messagesRef.current);
|
|
798
816
|
}
|
|
799
817
|
}, [sessionUtils.syncSessionRef]);
|
|
800
|
-
return
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
818
|
+
return (0, import_react3.useMemo)(
|
|
819
|
+
() => ({
|
|
820
|
+
inProgress,
|
|
821
|
+
messages,
|
|
822
|
+
handleSend,
|
|
823
|
+
resumeTool,
|
|
824
|
+
addOptimisticMessage,
|
|
825
|
+
abort,
|
|
826
|
+
sessionId: currentSessionId,
|
|
827
|
+
switchSession: sessionUtils.switchSession,
|
|
828
|
+
deleteSession: sessionUtils.deleteSession,
|
|
829
|
+
sessions: sessionUtils.sessionsList,
|
|
830
|
+
debugData
|
|
831
|
+
}),
|
|
832
|
+
[
|
|
833
|
+
inProgress,
|
|
834
|
+
messages,
|
|
835
|
+
handleSend,
|
|
836
|
+
resumeTool,
|
|
837
|
+
addOptimisticMessage,
|
|
838
|
+
abort,
|
|
839
|
+
currentSessionId,
|
|
840
|
+
sessionUtils.switchSession,
|
|
841
|
+
sessionUtils.deleteSession,
|
|
842
|
+
sessionUtils.sessionsList,
|
|
843
|
+
debugData
|
|
844
|
+
]
|
|
845
|
+
);
|
|
813
846
|
}
|
|
814
847
|
|
|
815
848
|
// src/core/stream.ts
|
|
@@ -1628,6 +1661,19 @@ function ToolRenderer({ agentId, part }) {
|
|
|
1628
1661
|
throw new Error("ToolRenderer must be used within <AgentContextProvider>");
|
|
1629
1662
|
}
|
|
1630
1663
|
const tool = context.getTool(agentId, part.toolName);
|
|
1664
|
+
console.log(
|
|
1665
|
+
"[DEBUG] ToolRenderer:",
|
|
1666
|
+
part.toolName,
|
|
1667
|
+
part.callId,
|
|
1668
|
+
"toolFound:",
|
|
1669
|
+
!!tool,
|
|
1670
|
+
"hasRender:",
|
|
1671
|
+
!!tool?.render,
|
|
1672
|
+
"paused:",
|
|
1673
|
+
part.paused,
|
|
1674
|
+
"status:",
|
|
1675
|
+
localStatus
|
|
1676
|
+
);
|
|
1631
1677
|
const handleSubmit = (0, import_react6.useCallback)(
|
|
1632
1678
|
(result) => {
|
|
1633
1679
|
if (localStatus === "submitted") return;
|