@antipopp/agno-react 0.5.1 → 0.6.0
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/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +12 -1
- package/dist/index.mjs +12 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -37,6 +37,9 @@ interface ToolExecutionEvent {
|
|
|
37
37
|
/**
|
|
38
38
|
* Hook for handling frontend tool execution (HITL)
|
|
39
39
|
*
|
|
40
|
+
* **Note:** HITL (Human-in-the-Loop) frontend tool execution is only supported for agents.
|
|
41
|
+
* Teams do not support the continue endpoint. This hook will log a warning and no-op if used with team mode.
|
|
42
|
+
*
|
|
40
43
|
* @param handlers - Map of tool names to handler functions (local handlers)
|
|
41
44
|
* @param autoExecute - Whether to automatically execute tools when paused (default: true)
|
|
42
45
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -37,6 +37,9 @@ interface ToolExecutionEvent {
|
|
|
37
37
|
/**
|
|
38
38
|
* Hook for handling frontend tool execution (HITL)
|
|
39
39
|
*
|
|
40
|
+
* **Note:** HITL (Human-in-the-Loop) frontend tool execution is only supported for agents.
|
|
41
|
+
* Teams do not support the continue endpoint. This hook will log a warning and no-op if used with team mode.
|
|
42
|
+
*
|
|
40
43
|
* @param handlers - Map of tool names to handler functions (local handlers)
|
|
41
44
|
* @param autoExecute - Whether to automatically execute tools when paused (default: true)
|
|
42
45
|
*
|
package/dist/index.js
CHANGED
|
@@ -250,6 +250,14 @@ function processToolResult(result, _tool) {
|
|
|
250
250
|
function useAgnoToolExecution(handlers = {}, autoExecute = true) {
|
|
251
251
|
const client = useAgnoClient();
|
|
252
252
|
const toolHandlerContext = useToolHandlers();
|
|
253
|
+
const isTeamMode = client.getConfig().mode === "team";
|
|
254
|
+
(0, import_react3.useEffect)(() => {
|
|
255
|
+
if (isTeamMode) {
|
|
256
|
+
console.warn(
|
|
257
|
+
"[useAgnoToolExecution] HITL (Human-in-the-Loop) frontend tool execution is not supported for teams. Only agents support the continue endpoint. This hook will not function in team mode."
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
}, [isTeamMode]);
|
|
253
261
|
const mergedHandlers = (0, import_react3.useMemo)(() => {
|
|
254
262
|
const globalHandlers = toolHandlerContext?.handlers || {};
|
|
255
263
|
return { ...globalHandlers, ...handlers };
|
|
@@ -259,6 +267,9 @@ function useAgnoToolExecution(handlers = {}, autoExecute = true) {
|
|
|
259
267
|
const [isExecuting, setIsExecuting] = (0, import_react3.useState)(false);
|
|
260
268
|
const [executionError, setExecutionError] = (0, import_react3.useState)();
|
|
261
269
|
(0, import_react3.useEffect)(() => {
|
|
270
|
+
if (isTeamMode) {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
262
273
|
const handleRunPaused = (event) => {
|
|
263
274
|
setIsPaused(true);
|
|
264
275
|
setPendingTools(event.tools);
|
|
@@ -276,7 +287,7 @@ function useAgnoToolExecution(handlers = {}, autoExecute = true) {
|
|
|
276
287
|
client.off("run:paused", handleRunPaused);
|
|
277
288
|
client.off("run:continued", handleRunContinued);
|
|
278
289
|
};
|
|
279
|
-
}, [client]);
|
|
290
|
+
}, [client, isTeamMode]);
|
|
280
291
|
const executeAndContinue = (0, import_react3.useCallback)(async () => {
|
|
281
292
|
if (!isPaused || pendingTools.length === 0) {
|
|
282
293
|
console.warn("[useAgnoToolExecution] Cannot execute: no pending tools");
|
package/dist/index.mjs
CHANGED
|
@@ -185,6 +185,14 @@ function processToolResult(result, _tool) {
|
|
|
185
185
|
function useAgnoToolExecution(handlers = {}, autoExecute = true) {
|
|
186
186
|
const client = useAgnoClient();
|
|
187
187
|
const toolHandlerContext = useToolHandlers();
|
|
188
|
+
const isTeamMode = client.getConfig().mode === "team";
|
|
189
|
+
useEffect2(() => {
|
|
190
|
+
if (isTeamMode) {
|
|
191
|
+
console.warn(
|
|
192
|
+
"[useAgnoToolExecution] HITL (Human-in-the-Loop) frontend tool execution is not supported for teams. Only agents support the continue endpoint. This hook will not function in team mode."
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
}, [isTeamMode]);
|
|
188
196
|
const mergedHandlers = useMemo2(() => {
|
|
189
197
|
const globalHandlers = toolHandlerContext?.handlers || {};
|
|
190
198
|
return { ...globalHandlers, ...handlers };
|
|
@@ -194,6 +202,9 @@ function useAgnoToolExecution(handlers = {}, autoExecute = true) {
|
|
|
194
202
|
const [isExecuting, setIsExecuting] = useState2(false);
|
|
195
203
|
const [executionError, setExecutionError] = useState2();
|
|
196
204
|
useEffect2(() => {
|
|
205
|
+
if (isTeamMode) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
197
208
|
const handleRunPaused = (event) => {
|
|
198
209
|
setIsPaused(true);
|
|
199
210
|
setPendingTools(event.tools);
|
|
@@ -211,7 +222,7 @@ function useAgnoToolExecution(handlers = {}, autoExecute = true) {
|
|
|
211
222
|
client.off("run:paused", handleRunPaused);
|
|
212
223
|
client.off("run:continued", handleRunContinued);
|
|
213
224
|
};
|
|
214
|
-
}, [client]);
|
|
225
|
+
}, [client, isTeamMode]);
|
|
215
226
|
const executeAndContinue = useCallback2(async () => {
|
|
216
227
|
if (!isPaused || pendingTools.length === 0) {
|
|
217
228
|
console.warn("[useAgnoToolExecution] Cannot execute: no pending tools");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antipopp/agno-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "React hooks for Agno client with frontend tool execution (HITL) support",
|
|
5
5
|
"author": "antipopp",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"README.md"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@antipopp/agno-
|
|
38
|
-
"@antipopp/agno-
|
|
37
|
+
"@antipopp/agno-types": "0.6.0",
|
|
38
|
+
"@antipopp/agno-client": "0.6.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"react": "^18.0.0"
|