@copilotkit/react-core 1.4.0-pre.16 → 1.4.1-pre.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.
@@ -2,13 +2,13 @@ import {
2
2
  defaultSystemMessage,
3
3
  useCopilotChat
4
4
  } from "../chunk-MX2OYLRS.mjs";
5
+ import "../chunk-YPSGKPDA.mjs";
5
6
  import "../chunk-JD7BAH7U.mjs";
6
7
  import "../chunk-SPCZTZCY.mjs";
7
8
  import "../chunk-6YEMNWKE.mjs";
8
9
  import "../chunk-XXR4QFAQ.mjs";
9
10
  import "../chunk-5FHSUKQL.mjs";
10
11
  import "../chunk-6U3UH3KO.mjs";
11
- import "../chunk-YPSGKPDA.mjs";
12
12
  import "../chunk-DCTJZ742.mjs";
13
13
  import "../chunk-G2K6T2QU.mjs";
14
14
  import "../chunk-2MPUQRAY.mjs";
package/dist/index.js CHANGED
@@ -1017,16 +1017,17 @@ ${additionalInstructions}` : "");
1017
1017
  }
1018
1018
 
1019
1019
  // src/hooks/use-copilot-action.ts
1020
- var import_react9 = require("react");
1021
1020
  var import_shared5 = require("@copilotkit/shared");
1021
+ var import_react9 = require("react");
1022
1022
  function useCopilotAction(action, dependencies) {
1023
1023
  const { setAction, removeAction, actions, chatComponentsCache } = useCopilotContext();
1024
1024
  const idRef = (0, import_react9.useRef)((0, import_shared5.randomId)());
1025
1025
  const renderAndWaitRef = (0, import_react9.useRef)(null);
1026
1026
  action = __spreadValues({}, action);
1027
- if (action.renderAndWait) {
1028
- const renderAndWait = action.renderAndWait;
1027
+ if (action.renderAndWait || action.renderAndWaitForResponse) {
1028
+ const renderAndWait = action.renderAndWait || action.renderAndWaitForResponse;
1029
1029
  action.renderAndWait = void 0;
1030
+ action.renderAndWaitForResponse = void 0;
1030
1031
  action.handler = () => __async(this, null, function* () {
1031
1032
  let resolve;
1032
1033
  let reject;
@@ -1042,9 +1043,21 @@ function useCopilotAction(action, dependencies) {
1042
1043
  status: props.status,
1043
1044
  args: props.args,
1044
1045
  result: props.result,
1045
- handler: props.status === "executing" ? renderAndWaitRef.current.resolve : void 0
1046
+ handler: props.status === "executing" ? renderAndWaitRef.current.resolve : void 0,
1047
+ respond: props.status === "executing" ? renderAndWaitRef.current.resolve : void 0
1048
+ };
1049
+ const isNoArgsRenderWait = (_fn) => {
1050
+ var _a;
1051
+ return ((_a = action.parameters) == null ? void 0 : _a.length) === 0;
1046
1052
  };
1047
- return renderAndWait(waitProps);
1053
+ if (renderAndWait) {
1054
+ if (isNoArgsRenderWait(renderAndWait)) {
1055
+ return renderAndWait(waitProps);
1056
+ } else {
1057
+ return renderAndWait(waitProps);
1058
+ }
1059
+ }
1060
+ return (0, import_react9.createElement)(import_react9.Fragment);
1048
1061
  };
1049
1062
  }
1050
1063
  if (dependencies === void 0) {