@antipopp/agno-react 0.5.0 → 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 +15 -1
- package/dist/index.mjs +15 -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
|
@@ -70,6 +70,9 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
70
70
|
var AgnoContext = (0, import_react.createContext)(null);
|
|
71
71
|
function AgnoProvider({ config, children }) {
|
|
72
72
|
const client = (0, import_react.useMemo)(() => new import_agno_client.AgnoClient(config), []);
|
|
73
|
+
(0, import_react.useEffect)(() => {
|
|
74
|
+
client.updateConfig(config);
|
|
75
|
+
}, [client, config]);
|
|
73
76
|
(0, import_react.useEffect)(() => {
|
|
74
77
|
return () => {
|
|
75
78
|
client.removeAllListeners();
|
|
@@ -247,6 +250,14 @@ function processToolResult(result, _tool) {
|
|
|
247
250
|
function useAgnoToolExecution(handlers = {}, autoExecute = true) {
|
|
248
251
|
const client = useAgnoClient();
|
|
249
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]);
|
|
250
261
|
const mergedHandlers = (0, import_react3.useMemo)(() => {
|
|
251
262
|
const globalHandlers = toolHandlerContext?.handlers || {};
|
|
252
263
|
return { ...globalHandlers, ...handlers };
|
|
@@ -256,6 +267,9 @@ function useAgnoToolExecution(handlers = {}, autoExecute = true) {
|
|
|
256
267
|
const [isExecuting, setIsExecuting] = (0, import_react3.useState)(false);
|
|
257
268
|
const [executionError, setExecutionError] = (0, import_react3.useState)();
|
|
258
269
|
(0, import_react3.useEffect)(() => {
|
|
270
|
+
if (isTeamMode) {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
259
273
|
const handleRunPaused = (event) => {
|
|
260
274
|
setIsPaused(true);
|
|
261
275
|
setPendingTools(event.tools);
|
|
@@ -273,7 +287,7 @@ function useAgnoToolExecution(handlers = {}, autoExecute = true) {
|
|
|
273
287
|
client.off("run:paused", handleRunPaused);
|
|
274
288
|
client.off("run:continued", handleRunContinued);
|
|
275
289
|
};
|
|
276
|
-
}, [client]);
|
|
290
|
+
}, [client, isTeamMode]);
|
|
277
291
|
const executeAndContinue = (0, import_react3.useCallback)(async () => {
|
|
278
292
|
if (!isPaused || pendingTools.length === 0) {
|
|
279
293
|
console.warn("[useAgnoToolExecution] Cannot execute: no pending tools");
|
package/dist/index.mjs
CHANGED
|
@@ -5,6 +5,9 @@ import { jsx } from "react/jsx-runtime";
|
|
|
5
5
|
var AgnoContext = createContext(null);
|
|
6
6
|
function AgnoProvider({ config, children }) {
|
|
7
7
|
const client = useMemo(() => new AgnoClient(config), []);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
client.updateConfig(config);
|
|
10
|
+
}, [client, config]);
|
|
8
11
|
useEffect(() => {
|
|
9
12
|
return () => {
|
|
10
13
|
client.removeAllListeners();
|
|
@@ -182,6 +185,14 @@ function processToolResult(result, _tool) {
|
|
|
182
185
|
function useAgnoToolExecution(handlers = {}, autoExecute = true) {
|
|
183
186
|
const client = useAgnoClient();
|
|
184
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]);
|
|
185
196
|
const mergedHandlers = useMemo2(() => {
|
|
186
197
|
const globalHandlers = toolHandlerContext?.handlers || {};
|
|
187
198
|
return { ...globalHandlers, ...handlers };
|
|
@@ -191,6 +202,9 @@ function useAgnoToolExecution(handlers = {}, autoExecute = true) {
|
|
|
191
202
|
const [isExecuting, setIsExecuting] = useState2(false);
|
|
192
203
|
const [executionError, setExecutionError] = useState2();
|
|
193
204
|
useEffect2(() => {
|
|
205
|
+
if (isTeamMode) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
194
208
|
const handleRunPaused = (event) => {
|
|
195
209
|
setIsPaused(true);
|
|
196
210
|
setPendingTools(event.tools);
|
|
@@ -208,7 +222,7 @@ function useAgnoToolExecution(handlers = {}, autoExecute = true) {
|
|
|
208
222
|
client.off("run:paused", handleRunPaused);
|
|
209
223
|
client.off("run:continued", handleRunContinued);
|
|
210
224
|
};
|
|
211
|
-
}, [client]);
|
|
225
|
+
}, [client, isTeamMode]);
|
|
212
226
|
const executeAndContinue = useCallback2(async () => {
|
|
213
227
|
if (!isPaused || pendingTools.length === 0) {
|
|
214
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"
|