@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.umd.js CHANGED
@@ -602,7 +602,7 @@ react_markdown = __toESM(react_markdown);
602
602
 
603
603
  //#endregion
604
604
  //#region package.json
605
- var version = "1.77.0";
605
+ var version = "1.77.1";
606
606
 
607
607
  //#endregion
608
608
  //#region src/v2/components/CopilotKitInspector.tsx
@@ -2231,7 +2231,6 @@ react_markdown = __toESM(react_markdown);
2231
2231
  - Use CSS Grid or Flexbox for layout. Ensure the UI looks good at any width.
2232
2232
  - Minimal transitions (150ms) for hover/focus states only. No decorative animations.
2233
2233
  - Keep the UI focused and dense — avoid excessive padding. Use compact spacing (8–12px gaps, 10–14px padding in controls).`;
2234
- const GENERATE_SANDBOXED_UI_DESCRIPTION = "Generate sandboxed UI. IMPORTANT: The generated code runs in a sandboxed iframe WITHOUT same-origin access. Do NOT use localStorage, sessionStorage, document.cookie, IndexedDB, or fetch/XMLHttpRequest to same-origin URLs. To communicate with the host application, use Websandbox.connection.remote.<functionName>(args) which returns a Promise.\n\nYou CAN use external libraries from CDNs by including <script> or <link> tags in the HTML <head> (e.g., Chart.js, D3, Three.js, x-data-spreadsheet, etc.). CDN resources load normally inside the sandbox.\n\nPARAMETER ORDER IS CRITICAL — generate parameters in exactly this order:\n1. initialHeight + placeholderMessages (shown to user while generating)\n2. css (all styles FIRST — the user sees a placeholder until CSS is complete)\n3. html (streams in live — the user watches the UI build as HTML is generated)\n4. jsFunctions (reusable helper functions)\n5. jsExpressions (applied one-by-one — the user sees each expression take effect)";
2235
2234
  function useStableArrayProp(prop, warningMessage, isMeaningfulChange) {
2236
2235
  const empty = (0, react.useMemo)(() => [], []);
2237
2236
  const value = prop ?? empty;
@@ -2424,7 +2423,7 @@ react_markdown = __toESM(react_markdown);
2424
2423
  if (!openGenUIActive) return [];
2425
2424
  return [{
2426
2425
  name: "generateSandboxedUi",
2427
- description: GENERATE_SANDBOXED_UI_DESCRIPTION,
2426
+ description: _copilotkit_shared.GENERATE_SANDBOXED_UI_DESCRIPTION,
2428
2427
  parameters: GenerateSandboxedUiArgsSchema,
2429
2428
  handler: async () => "UI generated",
2430
2429
  followUp: true,
@@ -7110,7 +7109,7 @@ react_markdown = __toESM(react_markdown);
7110
7109
  * running, // A boolean indicating if the agent is currently running.
7111
7110
  * start, // A function to start the agent.
7112
7111
  * stop, // A function to stop the agent.
7113
- * run, // A function to (re-)run the agent. Maps to the v2 agent's `runAgent()`.
7112
+ * run, // A function to (re-)run the agent through the v2 core (`copilotkit.runAgent`).
7114
7113
  * } = agent;
7115
7114
  * ```
7116
7115
  *
@@ -7221,6 +7220,17 @@ react_markdown = __toESM(react_markdown);
7221
7220
  handleStateUpdate,
7222
7221
  hasStateValues
7223
7222
  ]);
7223
+ const runAgent = (0, react.useCallback)(async (parameters) => {
7224
+ if (!agent) return void 0;
7225
+ return copilotkit.runAgent({
7226
+ agent,
7227
+ forwardedProps: parameters?.forwardedProps,
7228
+ runId: parameters?.runId
7229
+ });
7230
+ }, [agent, copilotkit]);
7231
+ const stopAgent = (0, react.useCallback)(() => {
7232
+ if (agent) copilotkit.stopAgent({ agent });
7233
+ }, [agent, copilotkit]);
7224
7234
  return (0, react.useMemo)(() => {
7225
7235
  if (!agent) {
7226
7236
  const noop = () => {};
@@ -7245,15 +7255,14 @@ react_markdown = __toESM(react_markdown);
7245
7255
  running: agent.isRunning,
7246
7256
  state: agent.state,
7247
7257
  setState: handleStateUpdate,
7248
- start: agent.runAgent,
7249
- stop: agent.abortRun,
7250
- run: agent.runAgent
7258
+ start: runAgent,
7259
+ stop: stopAgent,
7260
+ run: runAgent
7251
7261
  };
7252
7262
  }, [
7253
7263
  agent?.state,
7254
- agent?.runAgent,
7255
- agent?.abortRun,
7256
- agent?.runAgent,
7264
+ runAgent,
7265
+ stopAgent,
7257
7266
  agent?.threadId,
7258
7267
  agent?.isRunning,
7259
7268
  agent?.agentId,