@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/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-CFPkj9B9.cjs');
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. Maps to the v2 agent's `runAgent()`.
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: agent.runAgent,
1510
- stop: agent.abortRun,
1511
- run: agent.runAgent
1520
+ start: runAgent,
1521
+ stop: stopAgent,
1522
+ run: runAgent
1512
1523
  };
1513
1524
  }, [
1514
1525
  agent?.state,
1515
- agent?.runAgent,
1516
- agent?.abortRun,
1517
- agent?.runAgent,
1526
+ runAgent,
1527
+ stopAgent,
1518
1528
  agent?.threadId,
1519
1529
  agent?.isRunning,
1520
1530
  agent?.agentId,