@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.
- package/CHANGELOG.md +74 -181
- package/dist/{chunk-RYDEG77L.mjs → chunk-7LKXEJXM.mjs} +19 -6
- package/dist/chunk-7LKXEJXM.mjs.map +1 -0
- package/dist/{chunk-XACBOJF5.mjs → chunk-K4HZL7SA.mjs} +1 -1
- package/dist/chunk-K4HZL7SA.mjs.map +1 -0
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +18 -5
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +12 -12
- package/dist/hooks/use-coagent.d.ts +4 -4
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +2 -2
- package/dist/hooks/use-copilot-action.d.ts +124 -1
- package/dist/hooks/use-copilot-action.js +18 -5
- package/dist/hooks/use-copilot-action.js.map +1 -1
- package/dist/hooks/use-copilot-action.mjs +1 -1
- package/dist/hooks/use-copilot-chat.mjs +1 -1
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -12
- package/dist/types/frontend-action.d.ts +15 -2
- package/dist/types/frontend-action.js.map +1 -1
- package/package.json +5 -5
- package/src/hooks/use-coagent.ts +4 -4
- package/src/hooks/use-copilot-action.ts +114 -43
- package/src/types/frontend-action.ts +17 -2
- package/dist/chunk-RYDEG77L.mjs.map +0 -1
- package/dist/chunk-XACBOJF5.mjs.map +0 -1
|
@@ -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
|
-
|
|
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) {
|