@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/dist/index.mjs CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  } from "./chunk-42N5VKIX.mjs";
14
14
  import {
15
15
  useCopilotAction
16
- } from "./chunk-ALR5W5JK.mjs";
16
+ } from "./chunk-EUU6NNYU.mjs";
17
17
  import {
18
18
  useCopilotChat
19
19
  } from "./chunk-BT6WK2JZ.mjs";
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "publishConfig": {
10
10
  "access": "public"
11
11
  },
12
- "version": "1.5.0-coagents-v0-3.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-coagents-v0-3.0",
46
- "@copilotkit/shared": "1.5.0-coagents-v0-3.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: props.status,
201
+ status,
196
202
  args: props.args,
197
203
  result: props.result,
198
- handler: props.status === "executing" ? renderAndWaitRef.current!.resolve : undefined,
199
- respond: props.status === "executing" ? renderAndWaitRef.current!.resolve : undefined,
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