@emblemvault/hustle-react 1.4.0 → 1.4.1
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/browser/hustle-react.js +16 -9
- package/dist/browser/hustle-react.js.map +1 -1
- package/dist/components/index.cjs +15 -9
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +15 -9
- package/dist/components/index.js.map +1 -1
- package/dist/index.cjs +15 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { createContext, useState, useEffect, useCallback, useRef, useMemo, useContext } from 'react';
|
|
2
3
|
import { HustleIncognitoClient } from 'hustle-incognito';
|
|
3
4
|
import { useEmblemAuthOptional } from '@emblemvault/emblem-auth-react';
|
|
@@ -15124,6 +15125,7 @@ function HustleChat({
|
|
|
15124
15125
|
const messagesEndRef = useRef(null);
|
|
15125
15126
|
const fileInputRef = useRef(null);
|
|
15126
15127
|
const messagesRef = useRef(messages);
|
|
15128
|
+
const pendingAutoContinueRef = useRef(false);
|
|
15127
15129
|
useEffect(() => {
|
|
15128
15130
|
if (initialSystemPrompt && !systemPrompt) {
|
|
15129
15131
|
setSystemPrompt(initialSystemPrompt);
|
|
@@ -15230,22 +15232,27 @@ function HustleChat({
|
|
|
15230
15232
|
useEffect(() => {
|
|
15231
15233
|
if (!client) return;
|
|
15232
15234
|
const unsubMaxTools = client.on("max_tools_reached", (event) => {
|
|
15233
|
-
console.log(`[AUTO_CONTINUE] Max tools reached (${event.toolsExecuted}/${event.maxSteps}), auto-
|
|
15234
|
-
|
|
15235
|
-
sendContinue();
|
|
15236
|
-
}, 100);
|
|
15235
|
+
console.log(`[AUTO_CONTINUE] Max tools reached (${event.toolsExecuted}/${event.maxSteps}), queuing auto-continue...`);
|
|
15236
|
+
pendingAutoContinueRef.current = true;
|
|
15237
15237
|
});
|
|
15238
15238
|
const unsubTimeout = client.on("timeout", (event) => {
|
|
15239
|
-
console.log(`[AUTO_CONTINUE] Timeout: ${event.message}, auto-
|
|
15240
|
-
|
|
15241
|
-
sendContinue();
|
|
15242
|
-
}, 100);
|
|
15239
|
+
console.log(`[AUTO_CONTINUE] Timeout: ${event.message}, queuing auto-continue...`);
|
|
15240
|
+
pendingAutoContinueRef.current = true;
|
|
15243
15241
|
});
|
|
15244
15242
|
return () => {
|
|
15245
15243
|
unsubMaxTools();
|
|
15246
15244
|
unsubTimeout();
|
|
15247
15245
|
};
|
|
15248
|
-
}, [client
|
|
15246
|
+
}, [client]);
|
|
15247
|
+
useEffect(() => {
|
|
15248
|
+
if (!isStreaming && pendingAutoContinueRef.current && isReady) {
|
|
15249
|
+
console.log("[AUTO_CONTINUE] Streaming ended, triggering continue...");
|
|
15250
|
+
pendingAutoContinueRef.current = false;
|
|
15251
|
+
setTimeout(() => {
|
|
15252
|
+
sendContinue();
|
|
15253
|
+
}, 50);
|
|
15254
|
+
}
|
|
15255
|
+
}, [isStreaming, isReady, sendContinue]);
|
|
15249
15256
|
const sendMessage = useCallback(async () => {
|
|
15250
15257
|
const content = inputValue.trim();
|
|
15251
15258
|
if (!content || isStreaming || !isReady) return;
|