@copilotkit/react-core 1.77.0 → 1.77.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/{copilotkit-CFPkj9B9.cjs → copilotkit-BG1d4-qU.cjs} +239 -91
- package/dist/copilotkit-BG1d4-qU.cjs.map +1 -0
- package/dist/{copilotkit-DGc2YiW9.d.cts → copilotkit-BGHjMw0d.d.cts} +59 -3
- package/dist/copilotkit-BGHjMw0d.d.cts.map +1 -0
- package/dist/{copilotkit-Cqa0TfEo.d.mts → copilotkit-BdH_CdBt.d.mts} +59 -3
- package/dist/copilotkit-BdH_CdBt.d.mts.map +1 -0
- package/dist/{copilotkit-CP9qPAqV.mjs → copilotkit-C_Sy6Cc7.mjs} +228 -92
- package/dist/copilotkit-C_Sy6Cc7.mjs.map +1 -0
- package/dist/index.cjs +18 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +8 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +18 -8
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +19 -10
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/index.cjs +3 -1
- package/dist/v2/index.d.cts +2 -2
- package/dist/v2/index.d.mts +2 -2
- package/dist/v2/index.mjs +2 -2
- package/dist/v2/index.umd.js +228 -90
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +22 -11
- package/dist/copilotkit-CFPkj9B9.cjs.map +0 -1
- package/dist/copilotkit-CP9qPAqV.mjs.map +0 -1
- package/dist/copilotkit-Cqa0TfEo.d.mts.map +0 -1
- package/dist/copilotkit-DGc2YiW9.d.cts.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const require_copilotkit = require('./copilotkit-
|
|
4
|
+
const require_copilotkit = require('./copilotkit-BG1d4-qU.cjs');
|
|
5
5
|
let react = require("react");
|
|
6
6
|
react = require_copilotkit.__toESM(react);
|
|
7
7
|
let _copilotkit_core = require("@copilotkit/core");
|
|
@@ -1371,7 +1371,7 @@ function useAgentNodeName(agentName) {
|
|
|
1371
1371
|
* running, // A boolean indicating if the agent is currently running.
|
|
1372
1372
|
* start, // A function to start the agent.
|
|
1373
1373
|
* stop, // A function to stop the agent.
|
|
1374
|
-
* run, // A function to (re-)run the agent
|
|
1374
|
+
* run, // A function to (re-)run the agent through the v2 core (`copilotkit.runAgent`).
|
|
1375
1375
|
* } = agent;
|
|
1376
1376
|
* ```
|
|
1377
1377
|
*
|
|
@@ -1482,6 +1482,17 @@ function useCoAgent(options) {
|
|
|
1482
1482
|
handleStateUpdate,
|
|
1483
1483
|
hasStateValues
|
|
1484
1484
|
]);
|
|
1485
|
+
const runAgent = (0, react.useCallback)(async (parameters) => {
|
|
1486
|
+
if (!agent) return void 0;
|
|
1487
|
+
return copilotkit.runAgent({
|
|
1488
|
+
agent,
|
|
1489
|
+
forwardedProps: parameters?.forwardedProps,
|
|
1490
|
+
runId: parameters?.runId
|
|
1491
|
+
});
|
|
1492
|
+
}, [agent, copilotkit]);
|
|
1493
|
+
const stopAgent = (0, react.useCallback)(() => {
|
|
1494
|
+
if (agent) copilotkit.stopAgent({ agent });
|
|
1495
|
+
}, [agent, copilotkit]);
|
|
1485
1496
|
return (0, react.useMemo)(() => {
|
|
1486
1497
|
if (!agent) {
|
|
1487
1498
|
const noop = () => {};
|
|
@@ -1506,15 +1517,14 @@ function useCoAgent(options) {
|
|
|
1506
1517
|
running: agent.isRunning,
|
|
1507
1518
|
state: agent.state,
|
|
1508
1519
|
setState: handleStateUpdate,
|
|
1509
|
-
start:
|
|
1510
|
-
stop:
|
|
1511
|
-
run:
|
|
1520
|
+
start: runAgent,
|
|
1521
|
+
stop: stopAgent,
|
|
1522
|
+
run: runAgent
|
|
1512
1523
|
};
|
|
1513
1524
|
}, [
|
|
1514
1525
|
agent?.state,
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
agent?.runAgent,
|
|
1526
|
+
runAgent,
|
|
1527
|
+
stopAgent,
|
|
1518
1528
|
agent?.threadId,
|
|
1519
1529
|
agent?.isRunning,
|
|
1520
1530
|
agent?.agentId,
|