@rodrigocoliveira/agno-react 1.1.5 → 1.2.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/README.md +0 -3
- package/dist/hooks/useAgnoSessionState.d.ts +28 -0
- package/dist/hooks/useAgnoSessionState.d.ts.map +1 -0
- package/dist/hooks/useAgnoToolExecution.d.ts +3 -1
- package/dist/hooks/useAgnoToolExecution.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +92 -47
- package/dist/index.js.map +5 -4
- package/dist/index.mjs +92 -47
- package/dist/index.mjs.map +5 -4
- package/dist/ui/composed/AgnoMessageItem.d.ts +4 -1
- package/dist/ui/composed/AgnoMessageItem.d.ts.map +1 -1
- package/dist/ui/composed/agno-chat/agno-chat.d.ts +3 -1
- package/dist/ui/composed/agno-chat/agno-chat.d.ts.map +1 -1
- package/dist/ui/composed/agno-chat/context.d.ts +3 -1
- package/dist/ui/composed/agno-chat/context.d.ts.map +1 -1
- package/dist/ui/composed/agno-chat/index.d.ts +0 -4
- package/dist/ui/composed/agno-chat/index.d.ts.map +1 -1
- package/dist/ui/composed/agno-chat/messages.d.ts +4 -1
- package/dist/ui/composed/agno-chat/messages.d.ts.map +1 -1
- package/dist/ui/composed/index.d.ts +2 -2
- package/dist/ui/composed/index.d.ts.map +1 -1
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui.js +39 -85
- package/dist/ui.js.map +8 -9
- package/dist/ui.mjs +39 -85
- package/dist/ui.mjs.map +8 -9
- package/package.json +3 -3
- package/dist/ui/composed/agno-chat/tool-status.d.ts +0 -5
- package/dist/ui/composed/agno-chat/tool-status.d.ts.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -161,7 +161,7 @@ function processToolResult(result, _tool) {
|
|
|
161
161
|
uiComponent: undefined
|
|
162
162
|
};
|
|
163
163
|
}
|
|
164
|
-
function useAgnoToolExecution(handlers = {}, autoExecute = true) {
|
|
164
|
+
function useAgnoToolExecution(handlers = {}, autoExecute = true, options) {
|
|
165
165
|
const client = useAgnoClient();
|
|
166
166
|
const toolHandlerContext = useToolHandlers();
|
|
167
167
|
const isTeamMode = client.getConfig().mode === "team";
|
|
@@ -260,7 +260,7 @@ function useAgnoToolExecution(handlers = {}, autoExecute = true) {
|
|
|
260
260
|
for (const tool of message.tool_calls) {
|
|
261
261
|
if (tool.ui_component)
|
|
262
262
|
continue;
|
|
263
|
-
if (tool.
|
|
263
|
+
if (options?.skipHydration?.includes(tool.tool_name))
|
|
264
264
|
continue;
|
|
265
265
|
const handler = mergedHandlers[tool.tool_name];
|
|
266
266
|
if (!handler)
|
|
@@ -305,13 +305,13 @@ function useAgnoToolExecution(handlers = {}, autoExecute = true) {
|
|
|
305
305
|
}
|
|
306
306
|
}));
|
|
307
307
|
}, [mergedHandlers]);
|
|
308
|
-
const continueWithResults = useCallback2(async (tools,
|
|
308
|
+
const continueWithResults = useCallback2(async (tools, options2) => {
|
|
309
309
|
if (!isPaused) {
|
|
310
310
|
throw new Error("No paused run to continue");
|
|
311
311
|
}
|
|
312
312
|
setIsExecuting(true);
|
|
313
313
|
try {
|
|
314
|
-
await client.continueRun(tools,
|
|
314
|
+
await client.continueRun(tools, options2);
|
|
315
315
|
} catch (error) {
|
|
316
316
|
setIsExecuting(false);
|
|
317
317
|
throw error;
|
|
@@ -1253,15 +1253,59 @@ function useAgnoMemory() {
|
|
|
1253
1253
|
deleteMultipleMemories
|
|
1254
1254
|
};
|
|
1255
1255
|
}
|
|
1256
|
+
// src/hooks/useAgnoSessionState.ts
|
|
1257
|
+
import { useCallback as useCallback8, useEffect as useEffect7, useState as useState8 } from "react";
|
|
1258
|
+
function useAgnoSessionState() {
|
|
1259
|
+
const client = useAgnoClient();
|
|
1260
|
+
const [sessionState, setLocalSessionState] = useState8(() => client.getSessionState());
|
|
1261
|
+
const [isRefreshing, setIsRefreshing] = useState8(() => client.getState().isSessionStateRefreshing ?? false);
|
|
1262
|
+
useEffect7(() => {
|
|
1263
|
+
const handleStateChange = (state) => {
|
|
1264
|
+
setLocalSessionState(state);
|
|
1265
|
+
};
|
|
1266
|
+
const handleRefreshStart = () => setIsRefreshing(true);
|
|
1267
|
+
const handleRefreshEnd = () => setIsRefreshing(false);
|
|
1268
|
+
client.on("session-state:change", handleStateChange);
|
|
1269
|
+
client.on("session-state:refresh:start", handleRefreshStart);
|
|
1270
|
+
client.on("session-state:refresh:end", handleRefreshEnd);
|
|
1271
|
+
setLocalSessionState(client.getSessionState());
|
|
1272
|
+
setIsRefreshing(client.getState().isSessionStateRefreshing ?? false);
|
|
1273
|
+
return () => {
|
|
1274
|
+
client.off("session-state:change", handleStateChange);
|
|
1275
|
+
client.off("session-state:refresh:start", handleRefreshStart);
|
|
1276
|
+
client.off("session-state:refresh:end", handleRefreshEnd);
|
|
1277
|
+
};
|
|
1278
|
+
}, [client]);
|
|
1279
|
+
const setSessionState = useCallback8(async (next) => {
|
|
1280
|
+
const resolved = typeof next === "function" ? next(client.getSessionState()) : next;
|
|
1281
|
+
await client.setSessionState(resolved);
|
|
1282
|
+
}, [client]);
|
|
1283
|
+
const mergeSessionState = useCallback8(async (partial) => {
|
|
1284
|
+
const current = client.getSessionState() ?? {};
|
|
1285
|
+
const merged = { ...current, ...partial };
|
|
1286
|
+
await client.setSessionState(merged);
|
|
1287
|
+
}, [client]);
|
|
1288
|
+
const refreshSessionState = useCallback8(async () => {
|
|
1289
|
+
const result = await client.refreshSessionState();
|
|
1290
|
+
return result ?? null;
|
|
1291
|
+
}, [client]);
|
|
1292
|
+
return {
|
|
1293
|
+
sessionState,
|
|
1294
|
+
isRefreshing,
|
|
1295
|
+
setSessionState,
|
|
1296
|
+
mergeSessionState,
|
|
1297
|
+
refreshSessionState
|
|
1298
|
+
};
|
|
1299
|
+
}
|
|
1256
1300
|
// src/hooks/useAgnoKnowledge.ts
|
|
1257
|
-
import { useState as
|
|
1301
|
+
import { useState as useState9, useCallback as useCallback9 } from "react";
|
|
1258
1302
|
function useAgnoKnowledge() {
|
|
1259
1303
|
const client = useAgnoClient();
|
|
1260
|
-
const [isLoading, setIsLoading] =
|
|
1261
|
-
const [error, setError] =
|
|
1262
|
-
const [config, setConfig] =
|
|
1263
|
-
const [content, setContent] =
|
|
1264
|
-
const getConfig =
|
|
1304
|
+
const [isLoading, setIsLoading] = useState9(false);
|
|
1305
|
+
const [error, setError] = useState9();
|
|
1306
|
+
const [config, setConfig] = useState9();
|
|
1307
|
+
const [content, setContent] = useState9([]);
|
|
1308
|
+
const getConfig = useCallback9(async (options) => {
|
|
1265
1309
|
setIsLoading(true);
|
|
1266
1310
|
setError(undefined);
|
|
1267
1311
|
try {
|
|
@@ -1276,7 +1320,7 @@ function useAgnoKnowledge() {
|
|
|
1276
1320
|
setIsLoading(false);
|
|
1277
1321
|
}
|
|
1278
1322
|
}, [client]);
|
|
1279
|
-
const listContent =
|
|
1323
|
+
const listContent = useCallback9(async (listOptions, options) => {
|
|
1280
1324
|
setIsLoading(true);
|
|
1281
1325
|
setError(undefined);
|
|
1282
1326
|
try {
|
|
@@ -1291,7 +1335,7 @@ function useAgnoKnowledge() {
|
|
|
1291
1335
|
setIsLoading(false);
|
|
1292
1336
|
}
|
|
1293
1337
|
}, [client]);
|
|
1294
|
-
const getContent =
|
|
1338
|
+
const getContent = useCallback9(async (contentId, options) => {
|
|
1295
1339
|
setIsLoading(true);
|
|
1296
1340
|
setError(undefined);
|
|
1297
1341
|
try {
|
|
@@ -1304,7 +1348,7 @@ function useAgnoKnowledge() {
|
|
|
1304
1348
|
setIsLoading(false);
|
|
1305
1349
|
}
|
|
1306
1350
|
}, [client]);
|
|
1307
|
-
const getContentStatus =
|
|
1351
|
+
const getContentStatus = useCallback9(async (contentId, options) => {
|
|
1308
1352
|
setIsLoading(true);
|
|
1309
1353
|
setError(undefined);
|
|
1310
1354
|
try {
|
|
@@ -1317,7 +1361,7 @@ function useAgnoKnowledge() {
|
|
|
1317
1361
|
setIsLoading(false);
|
|
1318
1362
|
}
|
|
1319
1363
|
}, [client]);
|
|
1320
|
-
const search =
|
|
1364
|
+
const search = useCallback9(async (request, options) => {
|
|
1321
1365
|
setIsLoading(true);
|
|
1322
1366
|
setError(undefined);
|
|
1323
1367
|
try {
|
|
@@ -1330,7 +1374,7 @@ function useAgnoKnowledge() {
|
|
|
1330
1374
|
setIsLoading(false);
|
|
1331
1375
|
}
|
|
1332
1376
|
}, [client]);
|
|
1333
|
-
const uploadContent =
|
|
1377
|
+
const uploadContent = useCallback9(async (data, options) => {
|
|
1334
1378
|
setIsLoading(true);
|
|
1335
1379
|
setError(undefined);
|
|
1336
1380
|
try {
|
|
@@ -1345,7 +1389,7 @@ function useAgnoKnowledge() {
|
|
|
1345
1389
|
setIsLoading(false);
|
|
1346
1390
|
}
|
|
1347
1391
|
}, [client]);
|
|
1348
|
-
const updateContent =
|
|
1392
|
+
const updateContent = useCallback9(async (contentId, request, options) => {
|
|
1349
1393
|
setIsLoading(true);
|
|
1350
1394
|
setError(undefined);
|
|
1351
1395
|
try {
|
|
@@ -1360,7 +1404,7 @@ function useAgnoKnowledge() {
|
|
|
1360
1404
|
setIsLoading(false);
|
|
1361
1405
|
}
|
|
1362
1406
|
}, [client]);
|
|
1363
|
-
const deleteAllContent =
|
|
1407
|
+
const deleteAllContent = useCallback9(async (options) => {
|
|
1364
1408
|
setIsLoading(true);
|
|
1365
1409
|
setError(undefined);
|
|
1366
1410
|
try {
|
|
@@ -1374,7 +1418,7 @@ function useAgnoKnowledge() {
|
|
|
1374
1418
|
setIsLoading(false);
|
|
1375
1419
|
}
|
|
1376
1420
|
}, [client]);
|
|
1377
|
-
const deleteContent =
|
|
1421
|
+
const deleteContent = useCallback9(async (contentId, options) => {
|
|
1378
1422
|
setIsLoading(true);
|
|
1379
1423
|
setError(undefined);
|
|
1380
1424
|
try {
|
|
@@ -1406,14 +1450,14 @@ function useAgnoKnowledge() {
|
|
|
1406
1450
|
};
|
|
1407
1451
|
}
|
|
1408
1452
|
// src/hooks/useAgnoMetrics.ts
|
|
1409
|
-
import { useState as
|
|
1453
|
+
import { useState as useState10, useCallback as useCallback10 } from "react";
|
|
1410
1454
|
function useAgnoMetrics() {
|
|
1411
1455
|
const client = useAgnoClient();
|
|
1412
|
-
const [isLoading, setIsLoading] =
|
|
1413
|
-
const [isRefreshing, setIsRefreshing] =
|
|
1414
|
-
const [error, setError] =
|
|
1415
|
-
const [metrics, setMetrics] =
|
|
1416
|
-
const fetchMetrics =
|
|
1456
|
+
const [isLoading, setIsLoading] = useState10(false);
|
|
1457
|
+
const [isRefreshing, setIsRefreshing] = useState10(false);
|
|
1458
|
+
const [error, setError] = useState10();
|
|
1459
|
+
const [metrics, setMetrics] = useState10();
|
|
1460
|
+
const fetchMetrics = useCallback10(async (options) => {
|
|
1417
1461
|
setIsLoading(true);
|
|
1418
1462
|
setError(undefined);
|
|
1419
1463
|
try {
|
|
@@ -1428,7 +1472,7 @@ function useAgnoMetrics() {
|
|
|
1428
1472
|
setIsLoading(false);
|
|
1429
1473
|
}
|
|
1430
1474
|
}, [client]);
|
|
1431
|
-
const refreshMetrics =
|
|
1475
|
+
const refreshMetrics = useCallback10(async (options) => {
|
|
1432
1476
|
setIsRefreshing(true);
|
|
1433
1477
|
setError(undefined);
|
|
1434
1478
|
try {
|
|
@@ -1442,7 +1486,7 @@ function useAgnoMetrics() {
|
|
|
1442
1486
|
setIsRefreshing(false);
|
|
1443
1487
|
}
|
|
1444
1488
|
}, [client]);
|
|
1445
|
-
const clearMetrics =
|
|
1489
|
+
const clearMetrics = useCallback10(() => {
|
|
1446
1490
|
setMetrics(undefined);
|
|
1447
1491
|
setError(undefined);
|
|
1448
1492
|
}, []);
|
|
@@ -1457,14 +1501,14 @@ function useAgnoMetrics() {
|
|
|
1457
1501
|
};
|
|
1458
1502
|
}
|
|
1459
1503
|
// src/hooks/useAgnoEvals.ts
|
|
1460
|
-
import { useState as
|
|
1504
|
+
import { useState as useState11, useCallback as useCallback11 } from "react";
|
|
1461
1505
|
function useAgnoEvals() {
|
|
1462
1506
|
const client = useAgnoClient();
|
|
1463
|
-
const [evalRuns, setEvalRuns] =
|
|
1464
|
-
const [pagination, setPagination] =
|
|
1465
|
-
const [isLoading, setIsLoading] =
|
|
1466
|
-
const [error, setError] =
|
|
1467
|
-
const listEvalRuns =
|
|
1507
|
+
const [evalRuns, setEvalRuns] = useState11([]);
|
|
1508
|
+
const [pagination, setPagination] = useState11();
|
|
1509
|
+
const [isLoading, setIsLoading] = useState11(false);
|
|
1510
|
+
const [error, setError] = useState11();
|
|
1511
|
+
const listEvalRuns = useCallback11(async (listParams = {}, options) => {
|
|
1468
1512
|
setIsLoading(true);
|
|
1469
1513
|
setError(undefined);
|
|
1470
1514
|
try {
|
|
@@ -1480,7 +1524,7 @@ function useAgnoEvals() {
|
|
|
1480
1524
|
setIsLoading(false);
|
|
1481
1525
|
}
|
|
1482
1526
|
}, [client]);
|
|
1483
|
-
const getEvalRun =
|
|
1527
|
+
const getEvalRun = useCallback11(async (evalRunId, options) => {
|
|
1484
1528
|
setIsLoading(true);
|
|
1485
1529
|
setError(undefined);
|
|
1486
1530
|
try {
|
|
@@ -1493,7 +1537,7 @@ function useAgnoEvals() {
|
|
|
1493
1537
|
setIsLoading(false);
|
|
1494
1538
|
}
|
|
1495
1539
|
}, [client]);
|
|
1496
|
-
const executeEval =
|
|
1540
|
+
const executeEval = useCallback11(async (request, options) => {
|
|
1497
1541
|
setIsLoading(true);
|
|
1498
1542
|
setError(undefined);
|
|
1499
1543
|
try {
|
|
@@ -1508,7 +1552,7 @@ function useAgnoEvals() {
|
|
|
1508
1552
|
setIsLoading(false);
|
|
1509
1553
|
}
|
|
1510
1554
|
}, [client]);
|
|
1511
|
-
const updateEvalRun =
|
|
1555
|
+
const updateEvalRun = useCallback11(async (evalRunId, request, options) => {
|
|
1512
1556
|
setIsLoading(true);
|
|
1513
1557
|
setError(undefined);
|
|
1514
1558
|
try {
|
|
@@ -1523,7 +1567,7 @@ function useAgnoEvals() {
|
|
|
1523
1567
|
setIsLoading(false);
|
|
1524
1568
|
}
|
|
1525
1569
|
}, [client]);
|
|
1526
|
-
const deleteEvalRuns =
|
|
1570
|
+
const deleteEvalRuns = useCallback11(async (evalRunIds, options) => {
|
|
1527
1571
|
setIsLoading(true);
|
|
1528
1572
|
setError(undefined);
|
|
1529
1573
|
try {
|
|
@@ -1538,7 +1582,7 @@ function useAgnoEvals() {
|
|
|
1538
1582
|
setIsLoading(false);
|
|
1539
1583
|
}
|
|
1540
1584
|
}, [client]);
|
|
1541
|
-
const renameEvalRun =
|
|
1585
|
+
const renameEvalRun = useCallback11(async (evalRunId, newName, options) => {
|
|
1542
1586
|
return updateEvalRun(evalRunId, { name: newName }, options);
|
|
1543
1587
|
}, [updateEvalRun]);
|
|
1544
1588
|
return {
|
|
@@ -1555,14 +1599,14 @@ function useAgnoEvals() {
|
|
|
1555
1599
|
};
|
|
1556
1600
|
}
|
|
1557
1601
|
// src/hooks/useAgnoTraces.ts
|
|
1558
|
-
import { useState as
|
|
1602
|
+
import { useState as useState12, useEffect as useEffect8, useCallback as useCallback12 } from "react";
|
|
1559
1603
|
function useAgnoTraces() {
|
|
1560
1604
|
const client = useAgnoClient();
|
|
1561
|
-
const [traces, setTraces] =
|
|
1562
|
-
const [traceSessionStats, setTraceSessionStats] =
|
|
1563
|
-
const [isLoading, setIsLoading] =
|
|
1564
|
-
const [error, setError] =
|
|
1565
|
-
|
|
1605
|
+
const [traces, setTraces] = useState12([]);
|
|
1606
|
+
const [traceSessionStats, setTraceSessionStats] = useState12([]);
|
|
1607
|
+
const [isLoading, setIsLoading] = useState12(false);
|
|
1608
|
+
const [error, setError] = useState12();
|
|
1609
|
+
useEffect8(() => {
|
|
1566
1610
|
const handleStateChange = () => {
|
|
1567
1611
|
const state2 = client.getState();
|
|
1568
1612
|
setTraces(state2.traces);
|
|
@@ -1576,7 +1620,7 @@ function useAgnoTraces() {
|
|
|
1576
1620
|
client.off("state:change", handleStateChange);
|
|
1577
1621
|
};
|
|
1578
1622
|
}, [client]);
|
|
1579
|
-
const fetchTraces =
|
|
1623
|
+
const fetchTraces = useCallback12(async (options = {}, requestOptions) => {
|
|
1580
1624
|
setIsLoading(true);
|
|
1581
1625
|
setError(undefined);
|
|
1582
1626
|
try {
|
|
@@ -1591,7 +1635,7 @@ function useAgnoTraces() {
|
|
|
1591
1635
|
setIsLoading(false);
|
|
1592
1636
|
}
|
|
1593
1637
|
}, [client]);
|
|
1594
|
-
const getTraceDetail =
|
|
1638
|
+
const getTraceDetail = useCallback12(async (traceId, options = {}, requestOptions) => {
|
|
1595
1639
|
setIsLoading(true);
|
|
1596
1640
|
setError(undefined);
|
|
1597
1641
|
try {
|
|
@@ -1604,7 +1648,7 @@ function useAgnoTraces() {
|
|
|
1604
1648
|
setIsLoading(false);
|
|
1605
1649
|
}
|
|
1606
1650
|
}, [client]);
|
|
1607
|
-
const fetchTraceSessionStats =
|
|
1651
|
+
const fetchTraceSessionStats = useCallback12(async (options = {}, requestOptions) => {
|
|
1608
1652
|
setIsLoading(true);
|
|
1609
1653
|
setError(undefined);
|
|
1610
1654
|
try {
|
|
@@ -1633,6 +1677,7 @@ export {
|
|
|
1633
1677
|
useToolHandlers,
|
|
1634
1678
|
useAgnoTraces,
|
|
1635
1679
|
useAgnoToolExecution,
|
|
1680
|
+
useAgnoSessionState,
|
|
1636
1681
|
useAgnoSession,
|
|
1637
1682
|
useAgnoMetrics,
|
|
1638
1683
|
useAgnoMemory,
|
|
@@ -1668,4 +1713,4 @@ export {
|
|
|
1668
1713
|
AgnoProvider
|
|
1669
1714
|
};
|
|
1670
1715
|
|
|
1671
|
-
//# debugId=
|
|
1716
|
+
//# debugId=FC02FFA7A567A9E164756E2164756E21
|