@copilotkit/react-core 1.5.0-coagents-v0-3.0 → 1.5.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 +15 -0
- package/dist/{chunk-ALR5W5JK.mjs → chunk-EUU6NNYU.mjs} +8 -4
- package/dist/{chunk-ALR5W5JK.mjs.map → chunk-EUU6NNYU.mjs.map} +1 -1
- package/dist/hooks/index.js +7 -3
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/hooks/use-copilot-action.js +7 -3
- package/dist/hooks/use-copilot-action.js.map +1 -1
- package/dist/hooks/use-copilot-action.mjs +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
- package/src/hooks/use-copilot-action.ts +9 -3
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
|
-
"version": "1.5.0
|
|
12
|
+
"version": "1.5.0",
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"main": "./dist/index.js",
|
|
15
15
|
"module": "./dist/index.mjs",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@scarf/scarf": "^1.3.0",
|
|
44
44
|
"untruncate-json": "^0.0.1",
|
|
45
|
-
"@copilotkit/runtime-client-gql": "1.5.0
|
|
46
|
-
"@copilotkit/shared": "1.5.0
|
|
45
|
+
"@copilotkit/runtime-client-gql": "1.5.0",
|
|
46
|
+
"@copilotkit/shared": "1.5.0"
|
|
47
47
|
},
|
|
48
48
|
"keywords": [
|
|
49
49
|
"copilotkit",
|
|
@@ -190,13 +190,19 @@ export function useCopilotAction<const T extends Parameter[] | [] = []>(
|
|
|
190
190
|
|
|
191
191
|
// add a render function that will be called when the action is rendered
|
|
192
192
|
action.render = ((props: ActionRenderProps<T>): React.ReactElement => {
|
|
193
|
+
// Specifically for renderAndWaitForResponse the executing state is set too early, causing a race condition
|
|
194
|
+
// To fit it: we will wait for the handler to be ready
|
|
195
|
+
let status = props.status;
|
|
196
|
+
if (props.status === "executing" && !renderAndWaitRef.current) {
|
|
197
|
+
status = "inProgress";
|
|
198
|
+
}
|
|
193
199
|
// Create type safe waitProps based on whether T extends empty array or not
|
|
194
200
|
const waitProps = {
|
|
195
|
-
status
|
|
201
|
+
status,
|
|
196
202
|
args: props.args,
|
|
197
203
|
result: props.result,
|
|
198
|
-
handler:
|
|
199
|
-
respond:
|
|
204
|
+
handler: status === "executing" ? renderAndWaitRef.current!.resolve : undefined,
|
|
205
|
+
respond: status === "executing" ? renderAndWaitRef.current!.resolve : undefined,
|
|
200
206
|
} as T extends [] ? ActionRenderPropsNoArgsWait<T> : ActionRenderPropsWait<T>;
|
|
201
207
|
|
|
202
208
|
// Type guard to check if renderAndWait is for no args case
|