@emblemvault/hustle-react 1.4.0 → 1.4.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.
@@ -15124,6 +15124,7 @@ function HustleChat({
15124
15124
  const messagesEndRef = useRef(null);
15125
15125
  const fileInputRef = useRef(null);
15126
15126
  const messagesRef = useRef(messages);
15127
+ const pendingAutoContinueRef = useRef(false);
15127
15128
  useEffect(() => {
15128
15129
  if (initialSystemPrompt && !systemPrompt) {
15129
15130
  setSystemPrompt(initialSystemPrompt);
@@ -15230,22 +15231,27 @@ function HustleChat({
15230
15231
  useEffect(() => {
15231
15232
  if (!client) return;
15232
15233
  const unsubMaxTools = client.on("max_tools_reached", (event) => {
15233
- console.log(`[AUTO_CONTINUE] Max tools reached (${event.toolsExecuted}/${event.maxSteps}), auto-continuing...`);
15234
- setTimeout(() => {
15235
- sendContinue();
15236
- }, 100);
15234
+ console.log(`[AUTO_CONTINUE] Max tools reached (${event.toolsExecuted}/${event.maxSteps}), queuing auto-continue...`);
15235
+ pendingAutoContinueRef.current = true;
15237
15236
  });
15238
15237
  const unsubTimeout = client.on("timeout", (event) => {
15239
- console.log(`[AUTO_CONTINUE] Timeout: ${event.message}, auto-continuing...`);
15240
- setTimeout(() => {
15241
- sendContinue();
15242
- }, 100);
15238
+ console.log(`[AUTO_CONTINUE] Timeout: ${event.message}, queuing auto-continue...`);
15239
+ pendingAutoContinueRef.current = true;
15243
15240
  });
15244
15241
  return () => {
15245
15242
  unsubMaxTools();
15246
15243
  unsubTimeout();
15247
15244
  };
15248
- }, [client, sendContinue]);
15245
+ }, [client]);
15246
+ useEffect(() => {
15247
+ if (!isStreaming && pendingAutoContinueRef.current && isReady) {
15248
+ console.log("[AUTO_CONTINUE] Streaming ended, triggering continue...");
15249
+ pendingAutoContinueRef.current = false;
15250
+ setTimeout(() => {
15251
+ sendContinue();
15252
+ }, 50);
15253
+ }
15254
+ }, [isStreaming, isReady, sendContinue]);
15249
15255
  const sendMessage = useCallback(async () => {
15250
15256
  const content = inputValue.trim();
15251
15257
  if (!content || isStreaming || !isReady) return;