@copilotkit/react-core 1.4.0-pre.16 → 1.4.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 CHANGED
@@ -1,213 +1,97 @@
1
1
  # ui
2
2
 
3
- ## 1.4.0-pre.16
3
+ ## 1.4.0
4
4
 
5
5
  ### Minor Changes
6
6
 
7
- - lgc and lgjs alpha
7
+ CopilotKit Core:
8
8
 
9
- ### Patch Changes
10
-
11
- - Updated dependencies
12
- - @copilotkit/runtime-client-gql@1.4.0-pre.16
13
- - @copilotkit/shared@1.4.0-pre.16
14
-
15
- ## 1.4.0-pre.15
16
-
17
- ### Patch Changes
9
+ - Improved error messages and overall logs
10
+ - `useCopilotAction.renderAndAwait` renamed to `.renderAndAwaitForResponse` (backwards compatible, will be deprecated in the future)
11
+ - Improved scrolling behavior. It is now possible to scroll up during LLM response generation
12
+ - Added Azure OpenAI integration
13
+ - Updated interfaces for better developer ergonomics
18
14
 
19
- - No changes
20
- - Updated dependencies
21
- - @copilotkit/runtime-client-gql@1.4.0-pre.15
22
- - @copilotkit/shared@1.4.0-pre.15
15
+ CoAgents:
23
16
 
24
- ## 1.4.0-pre-1-4-0.14
17
+ - Renamed `remoteActions` to `remoteEndpoints` (backwards compatible, will be deprecated in the future)
18
+ - Support for LangGraph Platform in Remote Endpoints
19
+ - LangGraph JS Support for CoAgents (locally via `langgraph dev`, `langgraph up` or deployed to LangGraph Platform)
20
+ - Improved LangSmith integration - requests made through CoAgents will now surface in LangSmith
21
+ - Enhanced state management and message handling
25
22
 
26
- ### Minor Changes
23
+ CopilotKid Back-end SDK:
27
24
 
28
- - lgc & lgjs alpha release
25
+ - Released a whole-new `@copilotkit/sdk-js` for building agents with LangGraph JS Support
29
26
 
30
27
  ### Patch Changes
31
28
 
29
+ - f6fab28: update tsup config
30
+ - f6fab28: update entry
31
+ - f6fab28: export langchain module
32
+ - 8a77944: Improve LangSmith support
33
+ - f6fab28: Ensure intermediate state config is sent as snake case
34
+ - f6fab28: update entry in tsup config
35
+ - 8a77944: Ensure the last message is sent to LangSmith
32
36
  - a5efccd: Revert rxjs changes
33
- - Updated dependencies [a5efccd]
34
- - Updated dependencies
35
- - @copilotkit/runtime-client-gql@1.4.0-pre-1-4-0.14
36
- - @copilotkit/shared@1.4.0-pre-1-4-0.14
37
-
38
- ## 1.4.0-pre-1-4-0.13
39
-
40
- ### Minor Changes
41
-
42
- - lgc & lgjs alpha
43
-
44
- ### Patch Changes
45
-
37
+ - f6fab28: update entry
38
+ - f6fab28: Update exports
39
+ - f6fab28: Update exports
40
+ - 332d744: Add support for Azure OpenAI
41
+ - f6fab28: Export LangGraph functions
42
+ - f6fab28: Update lockfile
43
+ - Updated dependencies [f6fab28]
44
+ - Updated dependencies [f6fab28]
46
45
  - Updated dependencies
47
- - @copilotkit/runtime-client-gql@1.4.0-pre-1-4-0.13
48
- - @copilotkit/shared@1.4.0-pre-1-4-0.13
49
-
50
- ## 1.4.0-pre-1-4-0.12
51
-
52
- ### Minor Changes
46
+ - Updated dependencies [f6fab28]
47
+ - Updated dependencies [8a77944]
48
+ - Updated dependencies [f6fab28]
49
+ - Updated dependencies [f6fab28]
50
+ - Updated dependencies [8a77944]
51
+ - Updated dependencies [a5efccd]
52
+ - Updated dependencies [f6fab28]
53
+ - Updated dependencies [f6fab28]
54
+ - Updated dependencies [f6fab28]
55
+ - Updated dependencies [332d744]
56
+ - Updated dependencies [f6fab28]
57
+ - Updated dependencies [f6fab28]
58
+ - @copilotkit/runtime-client-gql@1.4.0
59
+ - @copilotkit/shared@1.4.0
53
60
 
54
- - c6b489d: LangGraph Platform and LangGraph JS support
55
- - 7cc6cc8: LangGraph Cloud and LangGraphJS alpha release
56
- - prerelease lgc and lgjs
57
- - Add LangGraph Platform and LangGraph JS support
58
- - b318b18: Add LangGraph Cloud support
61
+ ## 1.3.16-mme-revert-rxjs-changes.10
59
62
 
60
63
  ### Patch Changes
61
64
 
62
- - 9ea9db1: update tsup config
63
- - d52c1f9: update entry
64
- - e71d469: export langchain module
65
+ - f6fab28: update tsup config
66
+ - f6fab28: update entry
67
+ - f6fab28: export langchain module
65
68
  - 8a77944: Improve LangSmith support
66
- - 3caa5d5: Ensure intermediate state config is sent as snake case
67
- - cf3a787: update entry in tsup config
69
+ - f6fab28: Ensure intermediate state config is sent as snake case
70
+ - f6fab28: update entry in tsup config
68
71
  - 8a77944: Ensure the last message is sent to LangSmith
69
- - 264a693: update entry
70
- - dd99f00: Update exports
71
- - a28fb90: Update exports
72
+ - Revert rxjs changes
73
+ - f6fab28: update entry
74
+ - f6fab28: Update exports
75
+ - f6fab28: Update exports
72
76
  - 332d744: Add support for Azure OpenAI
73
- - 1f8032e: Export LangGraph functions
74
- - c3576f6: Update lockfile
75
- - Updated dependencies [9ea9db1]
76
- - Updated dependencies [d52c1f9]
77
- - Updated dependencies [c6b489d]
78
- - Updated dependencies [7cc6cc8]
79
- - Updated dependencies [e71d469]
77
+ - f6fab28: Export LangGraph functions
78
+ - f6fab28: Update lockfile
79
+ - Updated dependencies [f6fab28]
80
+ - Updated dependencies [f6fab28]
81
+ - Updated dependencies [f6fab28]
80
82
  - Updated dependencies [8a77944]
81
- - Updated dependencies [3caa5d5]
82
- - Updated dependencies [cf3a787]
83
- - Updated dependencies
84
- - Updated dependencies
83
+ - Updated dependencies [f6fab28]
84
+ - Updated dependencies [f6fab28]
85
85
  - Updated dependencies [8a77944]
86
- - Updated dependencies [264a693]
87
- - Updated dependencies [dd99f00]
88
- - Updated dependencies [a28fb90]
89
- - Updated dependencies [332d744]
90
- - Updated dependencies [b318b18]
91
- - Updated dependencies [1f8032e]
92
- - Updated dependencies [c3576f6]
93
- - @copilotkit/runtime-client-gql@1.4.0-pre-1-4-0.12
94
- - @copilotkit/shared@1.4.0-pre-1-4-0.12
95
-
96
- ## 1.4.0-pre-1-4-0.11
97
-
98
- ### Minor Changes
99
-
100
- - LangGraph Platform and LangGraph JS support
101
-
102
- ### Patch Changes
103
-
104
- - Updated dependencies
105
- - @copilotkit/runtime-client-gql@1.4.0-pre-1-4-0.11
106
- - @copilotkit/shared@1.4.0-pre-1-4-0.11
107
-
108
- ## 1.4.0-pre-1-4-0.10
109
-
110
- ### Minor Changes
111
-
112
- - LangGraph Cloud and LangGraphJS alpha release
113
- - b318b18: Add LangGraph Cloud support
114
-
115
- ### Patch Changes
116
-
117
- - Updated dependencies
118
- - Updated dependencies [b318b18]
119
- - @copilotkit/runtime-client-gql@1.4.0-pre-1-4-0.10
120
- - @copilotkit/shared@1.4.0-pre-1-4-0.10
121
-
122
- ## 1.3.16-mme-lgc-langgraph-package.9
123
-
124
- ### Patch Changes
125
-
126
- - update entry
127
- - Updated dependencies
128
- - @copilotkit/runtime-client-gql@1.3.16-mme-lgc-langgraph-package.9
129
- - @copilotkit/shared@1.3.16-mme-lgc-langgraph-package.9
130
-
131
- ## 1.3.16-mme-lgc-langgraph-package.8
132
-
133
- ### Patch Changes
134
-
135
- - update entry
136
- - Updated dependencies
137
- - @copilotkit/runtime-client-gql@1.3.16-mme-lgc-langgraph-package.8
138
- - @copilotkit/shared@1.3.16-mme-lgc-langgraph-package.8
139
-
140
- ## 1.3.16-mme-lgc-langgraph-package.7
141
-
142
- ### Patch Changes
143
-
144
- - update entry in tsup config
145
- - Updated dependencies
146
- - @copilotkit/runtime-client-gql@1.3.16-mme-lgc-langgraph-package.7
147
- - @copilotkit/shared@1.3.16-mme-lgc-langgraph-package.7
148
-
149
- ## 1.3.16-mme-lgc-langgraph-package.6
150
-
151
- ### Patch Changes
152
-
153
- - Update exports
154
- - Updated dependencies
155
- - @copilotkit/runtime-client-gql@1.3.16-mme-lgc-langgraph-package.6
156
- - @copilotkit/shared@1.3.16-mme-lgc-langgraph-package.6
157
-
158
- ## 1.3.16-mme-lgc-langgraph-package.5
159
-
160
- ### Patch Changes
161
-
162
- - update tsup config
163
- - Updated dependencies
164
- - @copilotkit/runtime-client-gql@1.3.16-mme-lgc-langgraph-package.5
165
- - @copilotkit/shared@1.3.16-mme-lgc-langgraph-package.5
166
-
167
- ## 1.3.16-mme-lgc-langgraph-package.4
168
-
169
- ### Patch Changes
170
-
171
- - Update exports
172
- - Updated dependencies
173
- - @copilotkit/runtime-client-gql@1.3.16-mme-lgc-langgraph-package.4
174
- - @copilotkit/shared@1.3.16-mme-lgc-langgraph-package.4
175
-
176
- ## 1.3.16-mme-lgc-langgraph-package.3
177
-
178
- ### Patch Changes
179
-
180
- - export langchain module
181
- - Updated dependencies
182
- - @copilotkit/runtime-client-gql@1.3.16-mme-lgc-langgraph-package.3
183
- - @copilotkit/shared@1.3.16-mme-lgc-langgraph-package.3
184
-
185
- ## 1.3.16-mme-sdk-js.2
186
-
187
- ### Patch Changes
188
-
189
- - Ensure intermediate state config is sent as snake case
190
- - Updated dependencies
191
- - @copilotkit/runtime-client-gql@1.3.16-mme-sdk-js.2
192
- - @copilotkit/shared@1.3.16-mme-sdk-js.2
193
-
194
- ## 1.3.16-mme-sdk-js.1
195
-
196
- ### Patch Changes
197
-
198
- - Update lockfile
199
86
  - Updated dependencies
200
- - @copilotkit/runtime-client-gql@1.3.16-mme-sdk-js.1
201
- - @copilotkit/shared@1.3.16-mme-sdk-js.1
202
-
203
- ## 1.3.16-mme-sdk-js.0
204
-
205
- ### Patch Changes
206
-
207
- - Export LangGraph functions
208
- - Updated dependencies
209
- - @copilotkit/runtime-client-gql@1.3.16-mme-sdk-js.0
210
- - @copilotkit/shared@1.3.16-mme-sdk-js.0
87
+ - Updated dependencies [f6fab28]
88
+ - Updated dependencies [f6fab28]
89
+ - Updated dependencies [f6fab28]
90
+ - Updated dependencies [332d744]
91
+ - Updated dependencies [f6fab28]
92
+ - Updated dependencies [f6fab28]
93
+ - @copilotkit/runtime-client-gql@1.3.16-mme-revert-rxjs-changes.10
94
+ - @copilotkit/shared@1.3.16-mme-revert-rxjs-changes.10
211
95
 
212
96
  ## 1.3.15
213
97
 
@@ -7,16 +7,17 @@ import {
7
7
  } from "./chunk-SKC7AJIV.mjs";
8
8
 
9
9
  // src/hooks/use-copilot-action.ts
10
- import { useRef, useEffect } from "react";
11
10
  import { randomId } from "@copilotkit/shared";
11
+ import { createElement, Fragment, useEffect, useRef } from "react";
12
12
  function useCopilotAction(action, dependencies) {
13
13
  const { setAction, removeAction, actions, chatComponentsCache } = useCopilotContext();
14
14
  const idRef = useRef(randomId());
15
15
  const renderAndWaitRef = useRef(null);
16
16
  action = __spreadValues({}, action);
17
- if (action.renderAndWait) {
18
- const renderAndWait = action.renderAndWait;
17
+ if (action.renderAndWait || action.renderAndWaitForResponse) {
18
+ const renderAndWait = action.renderAndWait || action.renderAndWaitForResponse;
19
19
  action.renderAndWait = void 0;
20
+ action.renderAndWaitForResponse = void 0;
20
21
  action.handler = () => __async(this, null, function* () {
21
22
  let resolve;
22
23
  let reject;
@@ -32,9 +33,21 @@ function useCopilotAction(action, dependencies) {
32
33
  status: props.status,
33
34
  args: props.args,
34
35
  result: props.result,
35
- handler: props.status === "executing" ? renderAndWaitRef.current.resolve : void 0
36
+ handler: props.status === "executing" ? renderAndWaitRef.current.resolve : void 0,
37
+ respond: props.status === "executing" ? renderAndWaitRef.current.resolve : void 0
36
38
  };
37
- return renderAndWait(waitProps);
39
+ const isNoArgsRenderWait = (_fn) => {
40
+ var _a;
41
+ return ((_a = action.parameters) == null ? void 0 : _a.length) === 0;
42
+ };
43
+ if (renderAndWait) {
44
+ if (isNoArgsRenderWait(renderAndWait)) {
45
+ return renderAndWait(waitProps);
46
+ } else {
47
+ return renderAndWait(waitProps);
48
+ }
49
+ }
50
+ return createElement(Fragment);
38
51
  };
39
52
  }
40
53
  if (dependencies === void 0) {
@@ -74,4 +87,4 @@ function useCopilotAction(action, dependencies) {
74
87
  export {
75
88
  useCopilotAction
76
89
  };
77
- //# sourceMappingURL=chunk-RYDEG77L.mjs.map
90
+ //# sourceMappingURL=chunk-7LKXEJXM.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hooks/use-copilot-action.ts"],"sourcesContent":["/**\n * Example usage of useCopilotAction with complex parameters:\n *\n * @example\n * useCopilotAction({\n * name: \"myAction\",\n * parameters: [\n * { name: \"arg1\", type: \"string\", enum: [\"option1\", \"option2\", \"option3\"], required: false },\n * { name: \"arg2\", type: \"number\" },\n * {\n * name: \"arg3\",\n * type: \"object\",\n * attributes: [\n * { name: \"nestedArg1\", type: \"boolean\" },\n * { name: \"xyz\", required: false },\n * ],\n * },\n * { name: \"arg4\", type: \"number[]\" },\n * ],\n * handler: ({ arg1, arg2, arg3, arg4 }) => {\n * const x = arg3.nestedArg1;\n * const z = arg3.xyz;\n * console.log(arg1, arg2, arg3);\n * },\n * });\n *\n * @example\n * // Simple action without parameters\n * useCopilotAction({\n * name: \"myAction\",\n * handler: () => {\n * console.log(\"No parameters provided.\");\n * },\n * });\n *\n * @example\n * // Interactive action with UI rendering and response handling\n * useCopilotAction({\n * name: \"handleMeeting\",\n * description: \"Handle a meeting by booking or canceling\",\n * parameters: [\n * {\n * name: \"meeting\",\n * type: \"string\",\n * description: \"The meeting to handle\",\n * required: true,\n * },\n * {\n * name: \"date\",\n * type: \"string\",\n * description: \"The date of the meeting\",\n * required: true,\n * },\n * {\n * name: \"title\",\n * type: \"string\",\n * description: \"The title of the meeting\",\n * required: true,\n * },\n * ],\n * renderAndWaitForResponse: ({ args, respond, status }) => {\n * const { meeting, date, title } = args;\n * return (\n * <MeetingConfirmationDialog\n * meeting={meeting}\n * date={date}\n * title={title}\n * onConfirm={() => respond('meeting confirmed')}\n * onCancel={() => respond('meeting canceled')}\n * />\n * );\n * },\n * });\n */\n\n/**\n * <img src=\"/images/use-copilot-action/useCopilotAction.gif\" width=\"500\" />\n * `useCopilotAction` is a React hook that you can use in your application to provide\n * custom actions that can be called by the AI. Essentially, it allows the Copilot to\n * execute these actions contextually during a chat, based on the user's interactions\n * and needs.\n *\n * Here's how it works:\n *\n * Use `useCopilotAction` to set up actions that the Copilot can call. To provide\n * more context to the Copilot, you can provide it with a `description` (for example to explain\n * what the action does, under which conditions it can be called, etc.).\n *\n * Then you define the parameters of the action, which can be simple, e.g. primitives like strings or numbers,\n * or complex, e.g. objects or arrays.\n *\n * Finally, you provide a `handler` function that receives the parameters and returns a result.\n * CopilotKit takes care of automatically inferring the parameter types, so you get type safety\n * and autocompletion for free.\n *\n * To render a custom UI for the action, you can provide a `render()` function. This function\n * lets you render a custom component or return a string to display.\n *\n * ## Usage\n *\n * ### Simple Usage\n *\n * ```tsx\n * useCopilotAction({\n * name: \"sayHello\",\n * description: \"Say hello to someone.\",\n * parameters: [\n * {\n * name: \"name\",\n * type: \"string\",\n * description: \"name of the person to say greet\",\n * },\n * ],\n * handler: async ({ name }) => {\n * alert(`Hello, ${name}!`);\n * },\n * });\n * ```\n *\n * ## Generative UI\n *\n * This hooks enables you to dynamically generate UI elements and render them in the copilot chat. For more information, check out the [Generative UI](/concepts/generative-ui) page.\n */\nimport { Parameter, randomId } from \"@copilotkit/shared\";\nimport { createElement, Fragment, useEffect, useRef } from \"react\";\nimport { useCopilotContext } from \"../context/copilot-context\";\nimport {\n ActionRenderProps,\n ActionRenderPropsNoArgsWait,\n ActionRenderPropsWait,\n FrontendAction,\n} from \"../types/frontend-action\";\n\n// We implement useCopilotAction dependency handling so that\n// the developer has the option to not provide any dependencies.\n// In this case, we assume they want to update the handler on each rerender.\n// To avoid getting stuck in an infinite loop, we update the handler directly,\n// skipping React state updates.\n// This is ok in this case, because the handler is not part of any UI that\n// needs to be updated.\n// useCallback, useMemo or other memoization techniques are not suitable here,\n// because they will cause a infinite rerender loop.\nexport function useCopilotAction<const T extends Parameter[] | [] = []>(\n action: FrontendAction<T>,\n dependencies?: any[],\n): void {\n const { setAction, removeAction, actions, chatComponentsCache } = useCopilotContext();\n const idRef = useRef<string>(randomId());\n const renderAndWaitRef = useRef<RenderAndWaitForResponse | null>(null);\n\n // clone the action to avoid mutating the original object\n action = { ...action };\n\n // If the developer provides a renderAndWait function, we transform the action\n // to use a promise internally, so that we can treat it like a normal action.\n if (action.renderAndWait || action.renderAndWaitForResponse) {\n const renderAndWait = action.renderAndWait || action.renderAndWaitForResponse;\n // remove the renderAndWait function from the action\n action.renderAndWait = undefined;\n action.renderAndWaitForResponse = undefined;\n // add a handler that will be called when the action is executed\n action.handler = (async () => {\n // we create a new promise when the handler is called\n let resolve: (result: any) => void;\n let reject: (error: any) => void;\n const promise = new Promise<any>((resolvePromise, rejectPromise) => {\n resolve = resolvePromise;\n reject = rejectPromise;\n });\n renderAndWaitRef.current = { promise, resolve: resolve!, reject: reject! };\n // then we await the promise (it will be resolved in the original renderAndWait function)\n return await promise;\n }) as any;\n\n // add a render function that will be called when the action is rendered\n action.render = ((props: ActionRenderProps<T>): React.ReactElement => {\n // Create type safe waitProps based on whether T extends empty array or not\n const waitProps = {\n status: props.status,\n args: props.args,\n result: props.result,\n handler: props.status === \"executing\" ? renderAndWaitRef.current!.resolve : undefined,\n respond: props.status === \"executing\" ? renderAndWaitRef.current!.resolve : undefined,\n } as T extends [] ? ActionRenderPropsNoArgsWait<T> : ActionRenderPropsWait<T>;\n\n // Type guard to check if renderAndWait is for no args case\n const isNoArgsRenderWait = (\n _fn:\n | ((props: ActionRenderPropsNoArgsWait<T>) => React.ReactElement)\n | ((props: ActionRenderPropsWait<T>) => React.ReactElement),\n ): _fn is (props: ActionRenderPropsNoArgsWait<T>) => React.ReactElement => {\n return action.parameters?.length === 0;\n };\n\n // Safely call renderAndWait with correct props type\n if (renderAndWait) {\n if (isNoArgsRenderWait(renderAndWait)) {\n return renderAndWait(waitProps as ActionRenderPropsNoArgsWait<T>);\n } else {\n return renderAndWait(waitProps as ActionRenderPropsWait<T>);\n }\n }\n\n // Return empty Fragment instead of null\n return createElement(Fragment);\n }) as any;\n }\n\n // If the developer doesn't provide dependencies, we assume they want to\n // update handler and render function when the action object changes.\n // This ensures that any captured variables in the handler are up to date.\n if (dependencies === undefined) {\n if (actions[idRef.current]) {\n actions[idRef.current].handler = action.handler as any;\n if (typeof action.render === \"function\") {\n if (chatComponentsCache.current !== null) {\n chatComponentsCache.current.actions[action.name] = action.render;\n }\n }\n }\n }\n\n useEffect(() => {\n setAction(idRef.current, action as any);\n if (chatComponentsCache.current !== null && action.render !== undefined) {\n chatComponentsCache.current.actions[action.name] = action.render;\n }\n return () => {\n // NOTE: For now, we don't remove the chatComponentsCache entry when the action is removed.\n // This is because we currently don't have access to the messages array in CopilotContext.\n removeAction(idRef.current);\n };\n }, [\n setAction,\n removeAction,\n action.description,\n action.name,\n action.disabled,\n // This should be faster than deep equality checking\n // In addition, all major JS engines guarantee the order of object keys\n JSON.stringify(action.parameters),\n // include render only if it's a string\n typeof action.render === \"string\" ? action.render : undefined,\n // dependencies set by the developer\n ...(dependencies || []),\n ]);\n}\n\ninterface RenderAndWaitForResponse {\n promise: Promise<any>;\n resolve: (result: any) => void;\n reject: (error: any) => void;\n}\n"],"mappings":";;;;;;;;;AA2HA,SAAoB,gBAAgB;AACpC,SAAS,eAAe,UAAU,WAAW,cAAc;AAkBpD,SAAS,iBACd,QACA,cACM;AACN,QAAM,EAAE,WAAW,cAAc,SAAS,oBAAoB,IAAI,kBAAkB;AACpF,QAAM,QAAQ,OAAe,SAAS,CAAC;AACvC,QAAM,mBAAmB,OAAwC,IAAI;AAGrE,WAAS,mBAAK;AAId,MAAI,OAAO,iBAAiB,OAAO,0BAA0B;AAC3D,UAAM,gBAAgB,OAAO,iBAAiB,OAAO;AAErD,WAAO,gBAAgB;AACvB,WAAO,2BAA2B;AAElC,WAAO,UAAW,MAAY;AAE5B,UAAI;AACJ,UAAI;AACJ,YAAM,UAAU,IAAI,QAAa,CAAC,gBAAgB,kBAAkB;AAClE,kBAAU;AACV,iBAAS;AAAA,MACX,CAAC;AACD,uBAAiB,UAAU,EAAE,SAAS,SAAmB,OAAgB;AAEzE,aAAO,MAAM;AAAA,IACf;AAGA,WAAO,SAAU,CAAC,UAAoD;AAEpE,YAAM,YAAY;AAAA,QAChB,QAAQ,MAAM;AAAA,QACd,MAAM,MAAM;AAAA,QACZ,QAAQ,MAAM;AAAA,QACd,SAAS,MAAM,WAAW,cAAc,iBAAiB,QAAS,UAAU;AAAA,QAC5E,SAAS,MAAM,WAAW,cAAc,iBAAiB,QAAS,UAAU;AAAA,MAC9E;AAGA,YAAM,qBAAqB,CACzB,QAGyE;AA9LjF;AA+LQ,iBAAO,YAAO,eAAP,mBAAmB,YAAW;AAAA,MACvC;AAGA,UAAI,eAAe;AACjB,YAAI,mBAAmB,aAAa,GAAG;AACrC,iBAAO,cAAc,SAA2C;AAAA,QAClE,OAAO;AACL,iBAAO,cAAc,SAAqC;AAAA,QAC5D;AAAA,MACF;AAGA,aAAO,cAAc,QAAQ;AAAA,IAC/B;AAAA,EACF;AAKA,MAAI,iBAAiB,QAAW;AAC9B,QAAI,QAAQ,MAAM,OAAO,GAAG;AAC1B,cAAQ,MAAM,OAAO,EAAE,UAAU,OAAO;AACxC,UAAI,OAAO,OAAO,WAAW,YAAY;AACvC,YAAI,oBAAoB,YAAY,MAAM;AACxC,8BAAoB,QAAQ,QAAQ,OAAO,IAAI,IAAI,OAAO;AAAA,QAC5D;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,YAAU,MAAM;AACd,cAAU,MAAM,SAAS,MAAa;AACtC,QAAI,oBAAoB,YAAY,QAAQ,OAAO,WAAW,QAAW;AACvE,0BAAoB,QAAQ,QAAQ,OAAO,IAAI,IAAI,OAAO;AAAA,IAC5D;AACA,WAAO,MAAM;AAGX,mBAAa,MAAM,OAAO;AAAA,IAC5B;AAAA,EACF,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,OAAO;AAAA,IACP,OAAO;AAAA;AAAA;AAAA,IAGP,KAAK,UAAU,OAAO,UAAU;AAAA;AAAA,IAEhC,OAAO,OAAO,WAAW,WAAW,OAAO,SAAS;AAAA;AAAA,IAEpD,GAAI,gBAAgB,CAAC;AAAA,EACvB,CAAC;AACH;","names":[]}
@@ -7,8 +7,8 @@ export { useCopilotReadable } from './use-copilot-readable.js';
7
7
  export { useCoAgent } from './use-coagent.js';
8
8
  import '@copilotkit/runtime-client-gql';
9
9
  import '../types/system-message.js';
10
- import '../types/frontend-action.js';
11
10
  import '@copilotkit/shared';
11
+ import '../types/frontend-action.js';
12
12
  import 'react';
13
13
  import '../types/coagent-action.js';
14
14
  import '../types/document-pointer.js';
@@ -570,16 +570,17 @@ ${additionalInstructions}` : "");
570
570
  }
571
571
 
572
572
  // src/hooks/use-copilot-action.ts
573
- var import_react6 = require("react");
574
573
  var import_shared3 = require("@copilotkit/shared");
574
+ var import_react6 = require("react");
575
575
  function useCopilotAction(action, dependencies) {
576
576
  const { setAction, removeAction, actions, chatComponentsCache } = useCopilotContext();
577
577
  const idRef = (0, import_react6.useRef)((0, import_shared3.randomId)());
578
578
  const renderAndWaitRef = (0, import_react6.useRef)(null);
579
579
  action = __spreadValues({}, action);
580
- if (action.renderAndWait) {
581
- const renderAndWait = action.renderAndWait;
580
+ if (action.renderAndWait || action.renderAndWaitForResponse) {
581
+ const renderAndWait = action.renderAndWait || action.renderAndWaitForResponse;
582
582
  action.renderAndWait = void 0;
583
+ action.renderAndWaitForResponse = void 0;
583
584
  action.handler = () => __async(this, null, function* () {
584
585
  let resolve;
585
586
  let reject;
@@ -595,9 +596,21 @@ function useCopilotAction(action, dependencies) {
595
596
  status: props.status,
596
597
  args: props.args,
597
598
  result: props.result,
598
- handler: props.status === "executing" ? renderAndWaitRef.current.resolve : void 0
599
+ handler: props.status === "executing" ? renderAndWaitRef.current.resolve : void 0,
600
+ respond: props.status === "executing" ? renderAndWaitRef.current.resolve : void 0
601
+ };
602
+ const isNoArgsRenderWait = (_fn) => {
603
+ var _a;
604
+ return ((_a = action.parameters) == null ? void 0 : _a.length) === 0;
599
605
  };
600
- return renderAndWait(waitProps);
606
+ if (renderAndWait) {
607
+ if (isNoArgsRenderWait(renderAndWait)) {
608
+ return renderAndWait(waitProps);
609
+ } else {
610
+ return renderAndWait(waitProps);
611
+ }
612
+ }
613
+ return (0, import_react6.createElement)(import_react6.Fragment);
601
614
  };
602
615
  }
603
616
  if (dependencies === void 0) {