@copilotkit/react-core 1.50.1-next.3 → 1.50.2-next.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/{chunk-3FHX5RLS.mjs → chunk-3V5TOYKW.mjs} +2 -2
  3. package/dist/chunk-3V5TOYKW.mjs.map +1 -0
  4. package/dist/{chunk-RB2TXKFP.mjs → chunk-4YZA2BZC.mjs} +13 -13
  5. package/dist/{chunk-IZGUA5WC.mjs → chunk-53K6WNJG.mjs} +2 -2
  6. package/dist/{chunk-F62YUR4R.mjs → chunk-FQFXYAV7.mjs} +2 -2
  7. package/dist/{chunk-INPM7YKW.mjs → chunk-HE22TZMF.mjs} +4 -4
  8. package/dist/{chunk-SNON4QA6.mjs → chunk-LHERIF3L.mjs} +4 -4
  9. package/dist/{chunk-CGKXLHL3.mjs → chunk-LSHFN2Y5.mjs} +4 -4
  10. package/dist/{chunk-3MHWEKFN.mjs → chunk-YCG6SNAU.mjs} +4 -4
  11. package/dist/components/copilot-provider/copilot-messages.mjs +2 -2
  12. package/dist/components/copilot-provider/copilotkit.mjs +8 -8
  13. package/dist/components/copilot-provider/index.mjs +8 -8
  14. package/dist/components/dev-console/console-trigger.mjs +2 -2
  15. package/dist/components/dev-console/developer-console-modal.mjs +2 -2
  16. package/dist/components/error-boundary/error-boundary.mjs +2 -2
  17. package/dist/components/index.mjs +8 -8
  18. package/dist/context/index.mjs +4 -4
  19. package/dist/hooks/index.mjs +19 -19
  20. package/dist/hooks/use-coagent-state-render-bridge.mjs +1 -1
  21. package/dist/hooks/use-configure-chat-suggestions.d.ts +36 -0
  22. package/dist/hooks/use-configure-chat-suggestions.js +79 -0
  23. package/dist/hooks/use-configure-chat-suggestions.js.map +1 -0
  24. package/dist/hooks/use-configure-chat-suggestions.mjs +47 -0
  25. package/dist/hooks/use-configure-chat-suggestions.mjs.map +1 -0
  26. package/dist/hooks/use-copilot-chat-headless_c.mjs +6 -6
  27. package/dist/hooks/use-copilot-chat.mjs +6 -6
  28. package/dist/hooks/use-copilot-chat_internal.mjs +5 -5
  29. package/dist/hooks/use-langgraph-interrupt-render.mjs +1 -1
  30. package/dist/index.js.map +1 -1
  31. package/dist/index.mjs +43 -43
  32. package/dist/lib/copilot-task.d.ts +1 -1
  33. package/dist/lib/copilot-task.js.map +1 -1
  34. package/dist/lib/copilot-task.mjs +9 -9
  35. package/dist/lib/index.js.map +1 -1
  36. package/dist/lib/index.mjs +9 -9
  37. package/package.json +3 -3
  38. package/src/hooks/use-configure-chat-suggestions.tsx +86 -0
  39. package/src/lib/copilot-task.ts +1 -1
  40. package/tsup.config.ts +1 -1
  41. package/dist/chunk-3FHX5RLS.mjs.map +0 -1
  42. /package/dist/{chunk-RB2TXKFP.mjs.map → chunk-4YZA2BZC.mjs.map} +0 -0
  43. /package/dist/{chunk-IZGUA5WC.mjs.map → chunk-53K6WNJG.mjs.map} +0 -0
  44. /package/dist/{chunk-F62YUR4R.mjs.map → chunk-FQFXYAV7.mjs.map} +0 -0
  45. /package/dist/{chunk-INPM7YKW.mjs.map → chunk-HE22TZMF.mjs.map} +0 -0
  46. /package/dist/{chunk-SNON4QA6.mjs.map → chunk-LHERIF3L.mjs.map} +0 -0
  47. /package/dist/{chunk-CGKXLHL3.mjs.map → chunk-LSHFN2Y5.mjs.map} +0 -0
  48. /package/dist/{chunk-3MHWEKFN.mjs.map → chunk-YCG6SNAU.mjs.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # ui
2
2
 
3
+ ## 1.50.2-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - @copilotkit/runtime-client-gql@1.50.2-next.0
8
+ - @copilotkit/shared@1.50.2-next.0
9
+
10
+ ## 1.50.1
11
+
12
+ ### Patch Changes
13
+
14
+ - bdc7a8f: - fix: restore message callbacks
15
+ - 80dffec: Updated the default model and API version for the Google GenAI adapter
16
+ - cfa4185: - fix: fix stale state in handler
17
+ - eac8b20: - fix: use latest vnext
18
+ - Updated dependencies [80dffec]
19
+ - @copilotkit/runtime-client-gql@1.50.1
20
+ - @copilotkit/shared@1.50.1
21
+
3
22
  ## 1.50.1-next.3
4
23
 
5
24
  ### Patch Changes
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-4CEQJ2X6.mjs";
4
4
  import {
5
5
  defaultCopilotContextCategories
6
- } from "./chunk-RB2TXKFP.mjs";
6
+ } from "./chunk-4YZA2BZC.mjs";
7
7
  import {
8
8
  __async,
9
9
  __spreadValues
@@ -117,4 +117,4 @@ ${instructions}
117
117
  export {
118
118
  CopilotTask
119
119
  };
120
- //# sourceMappingURL=chunk-3FHX5RLS.mjs.map
120
+ //# sourceMappingURL=chunk-3V5TOYKW.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/copilot-task.ts"],"sourcesContent":["/**\n * This class is used to execute one-off tasks, for example on button press. It can use the context available via [useCopilotReadable](/reference/hooks/useCopilotReadable) and the actions provided by [useCopilotAction](/reference/hooks/useCopilotAction), or you can provide your own context and actions.\n *\n * ## Example\n * In the simplest case, use CopilotTask in the context of your app by giving it instructions on what to do.\n *\n * ```tsx\n * import { CopilotTask, useCopilotContext } from \"@copilotkit/react-core\";\n *\n * export function MyComponent() {\n * const context = useCopilotContext();\n *\n * const task = new CopilotTask({\n * instructions: \"Set a random message\",\n * actions: [\n * {\n * name: \"setMessage\",\n * description: \"Set the message.\",\n * argumentAnnotations: [\n * {\n * name: \"message\",\n * type: \"string\",\n * description:\n * \"A message to display.\",\n * required: true,\n * },\n * ],\n * }\n * ]\n * });\n *\n * const executeTask = async () => {\n * await task.run(context, action);\n * }\n *\n * return (\n * <>\n * <button onClick={executeTask}>\n * Execute task\n * </button>\n * </>\n * )\n * }\n * ```\n *\n * Have a look at the [Presentation Example App](https://github.com/CopilotKit/CopilotKit/blob/main/src/v1.x/examples/next-openai/src/app/presentation/page.tsx) for a more complete example.\n */\n\nimport {\n ActionExecutionMessage,\n CopilotRuntimeClient,\n Message,\n Role,\n TextMessage,\n convertGqlOutputToMessages,\n convertMessagesToGqlInput,\n filterAgentStateMessages,\n CopilotRequestType,\n ForwardedParametersInput,\n} from \"@copilotkit/runtime-client-gql\";\nimport { FrontendAction, processActionsForRuntimeRequest } from \"../types/frontend-action\";\nimport { CopilotContextParams } from \"../context\";\nimport { defaultCopilotContextCategories } from \"../components\";\n\nexport interface CopilotTaskConfig {\n /**\n * The instructions to be given to the assistant.\n */\n instructions: string;\n /**\n * An array of action definitions that can be called.\n */\n actions?: FrontendAction<any>[];\n /**\n * Whether to include the copilot readable context in the task.\n */\n includeCopilotReadable?: boolean;\n\n /**\n * Whether to include actions defined via useCopilotAction in the task.\n */\n includeCopilotActions?: boolean;\n\n /**\n * The forwarded parameters to use for the task.\n */\n forwardedParameters?: ForwardedParametersInput;\n}\n\nexport class CopilotTask<T = any> {\n private instructions: string;\n private actions: FrontendAction<any>[];\n private includeCopilotReadable: boolean;\n private includeCopilotActions: boolean;\n private forwardedParameters?: ForwardedParametersInput;\n constructor(config: CopilotTaskConfig) {\n this.instructions = config.instructions;\n this.actions = config.actions || [];\n this.includeCopilotReadable = config.includeCopilotReadable !== false;\n this.includeCopilotActions = config.includeCopilotActions !== false;\n this.forwardedParameters = config.forwardedParameters;\n }\n\n /**\n * Run the task.\n * @param context The CopilotContext to use for the task. Use `useCopilotContext` to obtain the current context.\n * @param data The data to use for the task.\n */\n async run(context: CopilotContextParams, data?: T): Promise<void> {\n const actions = this.includeCopilotActions ? Object.assign({}, context.actions) : {};\n\n // merge functions into entry points\n for (const fn of this.actions) {\n actions[fn.name] = fn;\n }\n\n let contextString = \"\";\n\n if (data) {\n contextString = (typeof data === \"string\" ? data : JSON.stringify(data)) + \"\\n\\n\";\n }\n\n if (this.includeCopilotReadable) {\n contextString += context.getContextString([], defaultCopilotContextCategories);\n }\n\n const systemMessage = new TextMessage({\n content: taskSystemMessage(contextString, this.instructions),\n role: Role.System,\n });\n\n const messages: Message[] = [systemMessage];\n\n const runtimeClient = new CopilotRuntimeClient({\n url: context.copilotApiConfig.chatApiEndpoint,\n publicApiKey: context.copilotApiConfig.publicApiKey,\n headers: context.copilotApiConfig.headers,\n credentials: context.copilotApiConfig.credentials,\n });\n\n const response = await runtimeClient\n .generateCopilotResponse({\n data: {\n frontend: {\n actions: processActionsForRuntimeRequest(Object.values(actions)),\n url: window.location.href,\n },\n messages: convertMessagesToGqlInput(filterAgentStateMessages(messages)),\n metadata: {\n requestType: CopilotRequestType.Task,\n },\n forwardedParameters: {\n // if forwardedParameters is provided, use it\n toolChoice: \"required\",\n ...(this.forwardedParameters ?? {}),\n },\n },\n properties: context.copilotApiConfig.properties,\n })\n .toPromise();\n\n const functionCallHandler = context.getFunctionCallHandler(actions);\n const functionCalls = convertGqlOutputToMessages(\n response.data?.generateCopilotResponse?.messages || [],\n ).filter((m): m is ActionExecutionMessage => m.isActionExecutionMessage());\n\n for (const functionCall of functionCalls) {\n await functionCallHandler({\n messages,\n name: functionCall.name,\n args: functionCall.arguments,\n });\n }\n }\n}\n\nfunction taskSystemMessage(contextString: string, instructions: string): string {\n return `\nPlease act as an efficient, competent, conscientious, and industrious professional assistant.\n\nHelp the user achieve their goals, and you do so in a way that is as efficient as possible, without unnecessary fluff, but also without sacrificing professionalism.\nAlways be polite and respectful, and prefer brevity over verbosity.\n\nThe user has provided you with the following context:\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n\nThey have also provided you with functions you can call to initiate actions on their behalf.\n\nPlease assist them as best you can.\n\nThis is not a conversation, so please do not ask questions. Just call a function without saying anything else.\n\nThe user has given you the following task to complete:\n\n\\`\\`\\`\n${instructions}\n\\`\\`\\`\n`;\n}\n"],"mappings":";;;;;;;;;;;;AAgDA;AAAA,EAEE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AA8BA,IAAM,cAAN,MAA2B;AAAA,EAMhC,YAAY,QAA2B;AACrC,SAAK,eAAe,OAAO;AAC3B,SAAK,UAAU,OAAO,WAAW,CAAC;AAClC,SAAK,yBAAyB,OAAO,2BAA2B;AAChE,SAAK,wBAAwB,OAAO,0BAA0B;AAC9D,SAAK,sBAAsB,OAAO;AAAA,EACpC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOM,IAAI,SAA+B,MAAyB;AAAA;AA5GpE;AA6GI,YAAM,UAAU,KAAK,wBAAwB,OAAO,OAAO,CAAC,GAAG,QAAQ,OAAO,IAAI,CAAC;AAGnF,iBAAW,MAAM,KAAK,SAAS;AAC7B,gBAAQ,GAAG,IAAI,IAAI;AAAA,MACrB;AAEA,UAAI,gBAAgB;AAEpB,UAAI,MAAM;AACR,yBAAiB,OAAO,SAAS,WAAW,OAAO,KAAK,UAAU,IAAI,KAAK;AAAA,MAC7E;AAEA,UAAI,KAAK,wBAAwB;AAC/B,yBAAiB,QAAQ,iBAAiB,CAAC,GAAG,+BAA+B;AAAA,MAC/E;AAEA,YAAM,gBAAgB,IAAI,YAAY;AAAA,QACpC,SAAS,kBAAkB,eAAe,KAAK,YAAY;AAAA,QAC3D,MAAM,KAAK;AAAA,MACb,CAAC;AAED,YAAM,WAAsB,CAAC,aAAa;AAE1C,YAAM,gBAAgB,IAAI,qBAAqB;AAAA,QAC7C,KAAK,QAAQ,iBAAiB;AAAA,QAC9B,cAAc,QAAQ,iBAAiB;AAAA,QACvC,SAAS,QAAQ,iBAAiB;AAAA,QAClC,aAAa,QAAQ,iBAAiB;AAAA,MACxC,CAAC;AAED,YAAM,WAAW,MAAM,cACpB,wBAAwB;AAAA,QACvB,MAAM;AAAA,UACJ,UAAU;AAAA,YACR,SAAS,gCAAgC,OAAO,OAAO,OAAO,CAAC;AAAA,YAC/D,KAAK,OAAO,SAAS;AAAA,UACvB;AAAA,UACA,UAAU,0BAA0B,yBAAyB,QAAQ,CAAC;AAAA,UACtE,UAAU;AAAA,YACR,aAAa,mBAAmB;AAAA,UAClC;AAAA,UACA,qBAAqB;AAAA;AAAA,YAEnB,YAAY;AAAA,cACR,UAAK,wBAAL,YAA4B,CAAC;AAAA,QAErC;AAAA,QACA,YAAY,QAAQ,iBAAiB;AAAA,MACvC,CAAC,EACA,UAAU;AAEb,YAAM,sBAAsB,QAAQ,uBAAuB,OAAO;AAClE,YAAM,gBAAgB;AAAA,UACpB,oBAAS,SAAT,mBAAe,4BAAf,mBAAwC,aAAY,CAAC;AAAA,MACvD,EAAE,OAAO,CAAC,MAAmC,EAAE,yBAAyB,CAAC;AAEzE,iBAAW,gBAAgB,eAAe;AACxC,cAAM,oBAAoB;AAAA,UACxB;AAAA,UACA,MAAM,aAAa;AAAA,UACnB,MAAM,aAAa;AAAA,QACrB,CAAC;AAAA,MACH;AAAA,IACF;AAAA;AACF;AAEA,SAAS,kBAAkB,eAAuB,cAA8B;AAC9E,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA;AAAA;AAAA;AAGF;","names":[]}
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  CopilotErrorBoundary
3
- } from "./chunk-SNON4QA6.mjs";
3
+ } from "./chunk-LHERIF3L.mjs";
4
4
  import {
5
5
  CopilotMessages,
6
6
  MessagesTapProvider
7
- } from "./chunk-INPM7YKW.mjs";
7
+ } from "./chunk-HE22TZMF.mjs";
8
8
  import {
9
9
  shouldShowDevConsole
10
10
  } from "./chunk-ICIK2BSB.mjs";
@@ -14,16 +14,6 @@ import {
14
14
  import {
15
15
  use_flat_category_store_default
16
16
  } from "./chunk-YYN33GSG.mjs";
17
- import {
18
- CopilotListeners
19
- } from "./chunk-WF65O6HX.mjs";
20
- import {
21
- UsageBanner,
22
- getErrorActions
23
- } from "./chunk-6ZLPNY7X.mjs";
24
- import {
25
- ToastProvider
26
- } from "./chunk-EFL5OBKN.mjs";
27
17
  import {
28
18
  CoAgentStateRenderBridge
29
19
  } from "./chunk-QNUAXSDP.mjs";
@@ -31,6 +21,16 @@ import {
31
21
  ThreadsProvider,
32
22
  useThreads
33
23
  } from "./chunk-F555TVE4.mjs";
24
+ import {
25
+ CopilotListeners
26
+ } from "./chunk-WF65O6HX.mjs";
27
+ import {
28
+ ToastProvider
29
+ } from "./chunk-EFL5OBKN.mjs";
30
+ import {
31
+ UsageBanner,
32
+ getErrorActions
33
+ } from "./chunk-6ZLPNY7X.mjs";
34
34
  import {
35
35
  CoAgentStateRendersProvider
36
36
  } from "./chunk-FDOMAPJY.mjs";
@@ -548,4 +548,4 @@ export {
548
548
  CopilotKitInternal,
549
549
  defaultCopilotContextCategories
550
550
  };
551
- //# sourceMappingURL=chunk-RB2TXKFP.mjs.map
551
+ //# sourceMappingURL=chunk-4YZA2BZC.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useCopilotChatInternal
3
- } from "./chunk-CGKXLHL3.mjs";
3
+ } from "./chunk-LSHFN2Y5.mjs";
4
4
 
5
5
  // src/hooks/use-copilot-chat.ts
6
6
  function useCopilotChat(options = {}) {
@@ -33,4 +33,4 @@ function useCopilotChat(options = {}) {
33
33
  export {
34
34
  useCopilotChat
35
35
  };
36
- //# sourceMappingURL=chunk-IZGUA5WC.mjs.map
36
+ //# sourceMappingURL=chunk-53K6WNJG.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useCopilotChatInternal
3
- } from "./chunk-CGKXLHL3.mjs";
3
+ } from "./chunk-LSHFN2Y5.mjs";
4
4
  import {
5
5
  useCopilotContext
6
6
  } from "./chunk-AFNWX62Q.mjs";
@@ -83,4 +83,4 @@ function useCopilotChatHeadless_c(options = {}) {
83
83
  export {
84
84
  useCopilotChatHeadless_c
85
85
  };
86
- //# sourceMappingURL=chunk-F62YUR4R.mjs.map
86
+ //# sourceMappingURL=chunk-FQFXYAV7.mjs.map
@@ -4,12 +4,12 @@ import {
4
4
  import {
5
5
  useToast
6
6
  } from "./chunk-EFL5OBKN.mjs";
7
- import {
8
- CopilotMessagesContext
9
- } from "./chunk-DMLQZG75.mjs";
10
7
  import {
11
8
  useCopilotContext
12
9
  } from "./chunk-AFNWX62Q.mjs";
10
+ import {
11
+ CopilotMessagesContext
12
+ } from "./chunk-DMLQZG75.mjs";
13
13
  import {
14
14
  __async
15
15
  } from "./chunk-SKC7AJIV.mjs";
@@ -183,4 +183,4 @@ export {
183
183
  MessagesTapProvider,
184
184
  CopilotMessages
185
185
  };
186
- //# sourceMappingURL=chunk-INPM7YKW.mjs.map
186
+ //# sourceMappingURL=chunk-HE22TZMF.mjs.map
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  StatusChecker
3
3
  } from "./chunk-PMAFHQ7P.mjs";
4
+ import {
5
+ useErrorToast
6
+ } from "./chunk-6PUNP7CD.mjs";
4
7
  import {
5
8
  UsageBanner,
6
9
  getErrorActions
7
10
  } from "./chunk-6ZLPNY7X.mjs";
8
- import {
9
- useErrorToast
10
- } from "./chunk-6PUNP7CD.mjs";
11
11
 
12
12
  // src/components/error-boundary/error-boundary.tsx
13
13
  import React, { useEffect } from "react";
@@ -80,4 +80,4 @@ export {
80
80
  CopilotErrorBoundary,
81
81
  ErrorToast
82
82
  };
83
- //# sourceMappingURL=chunk-SNON4QA6.mjs.map
83
+ //# sourceMappingURL=chunk-LHERIF3L.mjs.map
@@ -1,9 +1,9 @@
1
- import {
2
- useLazyToolRenderer
3
- } from "./chunk-ZVF5Q6IH.mjs";
4
1
  import {
5
2
  useLangGraphInterruptRender
6
3
  } from "./chunk-VV56AVPB.mjs";
4
+ import {
5
+ useLazyToolRenderer
6
+ } from "./chunk-ZVF5Q6IH.mjs";
7
7
  import {
8
8
  useAsyncCallback
9
9
  } from "./chunk-6PUNP7CD.mjs";
@@ -346,4 +346,4 @@ export {
346
346
  useCopilotChatInternal,
347
347
  defaultSystemMessage
348
348
  };
349
- //# sourceMappingURL=chunk-CGKXLHL3.mjs.map
349
+ //# sourceMappingURL=chunk-LSHFN2Y5.mjs.map
@@ -3,12 +3,12 @@ import {
3
3
  CopilotKitIcon,
4
4
  ExclamationMarkTriangleIcon
5
5
  } from "./chunk-PIF5KJYI.mjs";
6
- import {
7
- useCopilotMessagesContext
8
- } from "./chunk-DMLQZG75.mjs";
9
6
  import {
10
7
  useCopilotContext
11
8
  } from "./chunk-AFNWX62Q.mjs";
9
+ import {
10
+ useCopilotMessagesContext
11
+ } from "./chunk-DMLQZG75.mjs";
12
12
 
13
13
  // src/components/dev-console/developer-console-modal.tsx
14
14
  import { COPILOTKIT_VERSION } from "@copilotkit/shared";
@@ -756,4 +756,4 @@ function ContextTab({ context }) {
756
756
  export {
757
757
  DeveloperConsoleModal
758
758
  };
759
- //# sourceMappingURL=chunk-3MHWEKFN.mjs.map
759
+ //# sourceMappingURL=chunk-YCG6SNAU.mjs.map
@@ -2,11 +2,11 @@ import {
2
2
  CopilotMessages,
3
3
  MessagesTapProvider,
4
4
  useMessagesTap
5
- } from "../../chunk-INPM7YKW.mjs";
5
+ } from "../../chunk-HE22TZMF.mjs";
6
6
  import "../../chunk-ICIK2BSB.mjs";
7
7
  import "../../chunk-EFL5OBKN.mjs";
8
- import "../../chunk-DMLQZG75.mjs";
9
8
  import "../../chunk-AFNWX62Q.mjs";
9
+ import "../../chunk-DMLQZG75.mjs";
10
10
  import "../../chunk-SKC7AJIV.mjs";
11
11
  export {
12
12
  CopilotMessages,
@@ -2,26 +2,26 @@ import {
2
2
  CopilotKit,
3
3
  CopilotKitInternal,
4
4
  defaultCopilotContextCategories
5
- } from "../../chunk-RB2TXKFP.mjs";
6
- import "../../chunk-SNON4QA6.mjs";
7
- import "../../chunk-INPM7YKW.mjs";
5
+ } from "../../chunk-4YZA2BZC.mjs";
6
+ import "../../chunk-LHERIF3L.mjs";
8
7
  import "../../chunk-CYDWEPFL.mjs";
9
8
  import "../../chunk-2IDV5OHF.mjs";
9
+ import "../../chunk-HE22TZMF.mjs";
10
10
  import "../../chunk-ICIK2BSB.mjs";
11
- import "../../chunk-PMAFHQ7P.mjs";
12
11
  import "../../chunk-RKTVJRK7.mjs";
12
+ import "../../chunk-PMAFHQ7P.mjs";
13
13
  import "../../chunk-YYN33GSG.mjs";
14
- import "../../chunk-WF65O6HX.mjs";
15
- import "../../chunk-6ZLPNY7X.mjs";
16
14
  import "../../chunk-6PUNP7CD.mjs";
17
15
  import "../../chunk-O7ARI5CV.mjs";
18
- import "../../chunk-EFL5OBKN.mjs";
19
16
  import "../../chunk-QNUAXSDP.mjs";
20
17
  import "../../chunk-NB2FKV2V.mjs";
21
18
  import "../../chunk-F555TVE4.mjs";
22
- import "../../chunk-DMLQZG75.mjs";
19
+ import "../../chunk-WF65O6HX.mjs";
20
+ import "../../chunk-EFL5OBKN.mjs";
21
+ import "../../chunk-6ZLPNY7X.mjs";
23
22
  import "../../chunk-FDOMAPJY.mjs";
24
23
  import "../../chunk-AFNWX62Q.mjs";
24
+ import "../../chunk-DMLQZG75.mjs";
25
25
  import "../../chunk-SKC7AJIV.mjs";
26
26
  export {
27
27
  CopilotKit,
@@ -2,26 +2,26 @@ import "../../chunk-SPCZTZCY.mjs";
2
2
  import {
3
3
  CopilotKit,
4
4
  defaultCopilotContextCategories
5
- } from "../../chunk-RB2TXKFP.mjs";
6
- import "../../chunk-SNON4QA6.mjs";
7
- import "../../chunk-INPM7YKW.mjs";
5
+ } from "../../chunk-4YZA2BZC.mjs";
6
+ import "../../chunk-LHERIF3L.mjs";
8
7
  import "../../chunk-CYDWEPFL.mjs";
9
8
  import "../../chunk-2IDV5OHF.mjs";
9
+ import "../../chunk-HE22TZMF.mjs";
10
10
  import "../../chunk-ICIK2BSB.mjs";
11
- import "../../chunk-PMAFHQ7P.mjs";
12
11
  import "../../chunk-RKTVJRK7.mjs";
12
+ import "../../chunk-PMAFHQ7P.mjs";
13
13
  import "../../chunk-YYN33GSG.mjs";
14
- import "../../chunk-WF65O6HX.mjs";
15
- import "../../chunk-6ZLPNY7X.mjs";
16
14
  import "../../chunk-6PUNP7CD.mjs";
17
15
  import "../../chunk-O7ARI5CV.mjs";
18
- import "../../chunk-EFL5OBKN.mjs";
19
16
  import "../../chunk-QNUAXSDP.mjs";
20
17
  import "../../chunk-NB2FKV2V.mjs";
21
18
  import "../../chunk-F555TVE4.mjs";
22
- import "../../chunk-DMLQZG75.mjs";
19
+ import "../../chunk-WF65O6HX.mjs";
20
+ import "../../chunk-EFL5OBKN.mjs";
21
+ import "../../chunk-6ZLPNY7X.mjs";
23
22
  import "../../chunk-FDOMAPJY.mjs";
24
23
  import "../../chunk-AFNWX62Q.mjs";
24
+ import "../../chunk-DMLQZG75.mjs";
25
25
  import "../../chunk-SKC7AJIV.mjs";
26
26
  export {
27
27
  CopilotKit,
@@ -1,14 +1,14 @@
1
1
  "use client";
2
2
  import {
3
3
  DeveloperConsoleModal
4
- } from "../../chunk-3MHWEKFN.mjs";
4
+ } from "../../chunk-YCG6SNAU.mjs";
5
5
  import {
6
6
  CopilotKitIcon
7
7
  } from "../../chunk-PIF5KJYI.mjs";
8
- import "../../chunk-DMLQZG75.mjs";
9
8
  import {
10
9
  useCopilotContext
11
10
  } from "../../chunk-AFNWX62Q.mjs";
11
+ import "../../chunk-DMLQZG75.mjs";
12
12
  import "../../chunk-SKC7AJIV.mjs";
13
13
 
14
14
  // src/components/dev-console/console-trigger.tsx
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import {
3
3
  DeveloperConsoleModal
4
- } from "../../chunk-3MHWEKFN.mjs";
4
+ } from "../../chunk-YCG6SNAU.mjs";
5
5
  import "../../chunk-PIF5KJYI.mjs";
6
- import "../../chunk-DMLQZG75.mjs";
7
6
  import "../../chunk-AFNWX62Q.mjs";
7
+ import "../../chunk-DMLQZG75.mjs";
8
8
  import "../../chunk-SKC7AJIV.mjs";
9
9
  export {
10
10
  DeveloperConsoleModal
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  CopilotErrorBoundary,
3
3
  ErrorToast
4
- } from "../../chunk-SNON4QA6.mjs";
4
+ } from "../../chunk-LHERIF3L.mjs";
5
5
  import "../../chunk-PMAFHQ7P.mjs";
6
- import "../../chunk-6ZLPNY7X.mjs";
7
6
  import "../../chunk-6PUNP7CD.mjs";
8
7
  import "../../chunk-O7ARI5CV.mjs";
9
8
  import "../../chunk-EFL5OBKN.mjs";
9
+ import "../../chunk-6ZLPNY7X.mjs";
10
10
  import "../../chunk-SKC7AJIV.mjs";
11
11
  export {
12
12
  CopilotErrorBoundary,
@@ -3,26 +3,26 @@ import "../chunk-SPCZTZCY.mjs";
3
3
  import {
4
4
  CopilotKit,
5
5
  defaultCopilotContextCategories
6
- } from "../chunk-RB2TXKFP.mjs";
7
- import "../chunk-SNON4QA6.mjs";
8
- import "../chunk-INPM7YKW.mjs";
6
+ } from "../chunk-4YZA2BZC.mjs";
7
+ import "../chunk-LHERIF3L.mjs";
9
8
  import "../chunk-CYDWEPFL.mjs";
10
9
  import "../chunk-2IDV5OHF.mjs";
10
+ import "../chunk-HE22TZMF.mjs";
11
11
  import "../chunk-ICIK2BSB.mjs";
12
- import "../chunk-PMAFHQ7P.mjs";
13
12
  import "../chunk-RKTVJRK7.mjs";
13
+ import "../chunk-PMAFHQ7P.mjs";
14
14
  import "../chunk-YYN33GSG.mjs";
15
- import "../chunk-WF65O6HX.mjs";
16
- import "../chunk-6ZLPNY7X.mjs";
17
15
  import "../chunk-6PUNP7CD.mjs";
18
16
  import "../chunk-O7ARI5CV.mjs";
19
- import "../chunk-EFL5OBKN.mjs";
20
17
  import "../chunk-QNUAXSDP.mjs";
21
18
  import "../chunk-NB2FKV2V.mjs";
22
19
  import "../chunk-F555TVE4.mjs";
23
- import "../chunk-DMLQZG75.mjs";
20
+ import "../chunk-WF65O6HX.mjs";
21
+ import "../chunk-EFL5OBKN.mjs";
22
+ import "../chunk-6ZLPNY7X.mjs";
24
23
  import "../chunk-FDOMAPJY.mjs";
25
24
  import "../chunk-AFNWX62Q.mjs";
25
+ import "../chunk-DMLQZG75.mjs";
26
26
  import "../chunk-SKC7AJIV.mjs";
27
27
  export {
28
28
  CopilotKit,
@@ -4,10 +4,6 @@ import {
4
4
  ThreadsProvider,
5
5
  useThreads
6
6
  } from "../chunk-F555TVE4.mjs";
7
- import {
8
- CopilotMessagesContext,
9
- useCopilotMessagesContext
10
- } from "../chunk-DMLQZG75.mjs";
11
7
  import {
12
8
  CoAgentStateRendersContext,
13
9
  CoAgentStateRendersProvider,
@@ -17,6 +13,10 @@ import {
17
13
  CopilotContext,
18
14
  useCopilotContext
19
15
  } from "../chunk-AFNWX62Q.mjs";
16
+ import {
17
+ CopilotMessagesContext,
18
+ useCopilotMessagesContext
19
+ } from "../chunk-DMLQZG75.mjs";
20
20
  import "../chunk-SKC7AJIV.mjs";
21
21
  export {
22
22
  CoAgentStateRendersContext,
@@ -1,13 +1,7 @@
1
1
  import "../chunk-A6NKSGH3.mjs";
2
- import {
3
- useLangGraphInterrupt
4
- } from "../chunk-4RRMC7L2.mjs";
5
2
  import {
6
3
  useMakeCopilotDocumentReadable
7
4
  } from "../chunk-7IBF6RBW.mjs";
8
- import {
9
- useCopilotReadable
10
- } from "../chunk-Z6JV2LRY.mjs";
11
5
  import {
12
6
  useCopilotRuntimeClient
13
7
  } from "../chunk-6ESSSQ7Q.mjs";
@@ -15,11 +9,8 @@ import {
15
9
  useDefaultTool
16
10
  } from "../chunk-BUSWSDYO.mjs";
17
11
  import {
18
- useCoAgentStateRender
19
- } from "../chunk-YTQHRJUA.mjs";
20
- import {
21
- useCoAgent
22
- } from "../chunk-ZYTXB6HH.mjs";
12
+ useLangGraphInterrupt
13
+ } from "../chunk-4RRMC7L2.mjs";
23
14
  import {
24
15
  useCopilotAdditionalInstructions
25
16
  } from "../chunk-ABWT4DRT.mjs";
@@ -40,32 +31,41 @@ import {
40
31
  } from "../chunk-7DTB7S5V.mjs";
41
32
  import {
42
33
  useCopilotChatHeadless_c
43
- } from "../chunk-F62YUR4R.mjs";
34
+ } from "../chunk-FQFXYAV7.mjs";
44
35
  import {
45
36
  useCopilotChatSuggestions
46
37
  } from "../chunk-XDFVCQD3.mjs";
47
38
  import {
48
39
  useCopilotChat
49
- } from "../chunk-IZGUA5WC.mjs";
40
+ } from "../chunk-53K6WNJG.mjs";
50
41
  import {
51
42
  useCopilotChatInternal
52
- } from "../chunk-CGKXLHL3.mjs";
43
+ } from "../chunk-LSHFN2Y5.mjs";
44
+ import {
45
+ useLangGraphInterruptRender
46
+ } from "../chunk-VV56AVPB.mjs";
53
47
  import {
54
48
  useLazyToolRenderer
55
49
  } from "../chunk-ZVF5Q6IH.mjs";
56
50
  import {
57
- useLangGraphInterruptRender
58
- } from "../chunk-VV56AVPB.mjs";
51
+ useCopilotReadable
52
+ } from "../chunk-Z6JV2LRY.mjs";
53
+ import {
54
+ useCoAgentStateRender
55
+ } from "../chunk-YTQHRJUA.mjs";
56
+ import {
57
+ useCoAgent
58
+ } from "../chunk-ZYTXB6HH.mjs";
59
+ import "../chunk-I76HKHPJ.mjs";
59
60
  import "../chunk-6PUNP7CD.mjs";
60
61
  import "../chunk-O7ARI5CV.mjs";
61
- import "../chunk-EFL5OBKN.mjs";
62
- import "../chunk-I76HKHPJ.mjs";
63
62
  import "../chunk-QNUAXSDP.mjs";
64
63
  import "../chunk-NB2FKV2V.mjs";
65
64
  import "../chunk-F555TVE4.mjs";
66
- import "../chunk-DMLQZG75.mjs";
65
+ import "../chunk-EFL5OBKN.mjs";
67
66
  import "../chunk-FDOMAPJY.mjs";
68
67
  import "../chunk-AFNWX62Q.mjs";
68
+ import "../chunk-DMLQZG75.mjs";
69
69
  import "../chunk-SKC7AJIV.mjs";
70
70
  export {
71
71
  useCoAgent,
@@ -4,9 +4,9 @@ import {
4
4
  } from "../chunk-QNUAXSDP.mjs";
5
5
  import "../chunk-NB2FKV2V.mjs";
6
6
  import "../chunk-F555TVE4.mjs";
7
- import "../chunk-DMLQZG75.mjs";
8
7
  import "../chunk-FDOMAPJY.mjs";
9
8
  import "../chunk-AFNWX62Q.mjs";
9
+ import "../chunk-DMLQZG75.mjs";
10
10
  import "../chunk-SKC7AJIV.mjs";
11
11
  export {
12
12
  CoAgentStateRenderBridge,
@@ -0,0 +1,36 @@
1
+ import { useSuggestions } from '@copilotkitnext/react';
2
+ import { StaticSuggestionsConfig, Suggestion } from '@copilotkitnext/core';
3
+
4
+ type StaticSuggestionInput = Omit<Suggestion, "isLoading"> & Partial<Pick<Suggestion, "isLoading">>;
5
+ type StaticSuggestionsConfigInput = Omit<StaticSuggestionsConfig, "suggestions"> & {
6
+ suggestions: StaticSuggestionInput[];
7
+ };
8
+ type DynamicSuggestionsConfigInput = {
9
+ /**
10
+ * A prompt or instructions for the GPT to generate suggestions.
11
+ */
12
+ instructions: string;
13
+ /**
14
+ * The minimum number of suggestions to generate. Defaults to `1`.
15
+ * @default 1
16
+ */
17
+ minSuggestions?: number;
18
+ /**
19
+ * The maximum number of suggestions to generate. Defaults to `3`.
20
+ * @default 1
21
+ */
22
+ maxSuggestions?: number;
23
+ /**
24
+ * Whether the suggestions are available. Defaults to `enabled`.
25
+ * @default enabled
26
+ */
27
+ available?: "enabled" | "disabled" | "always" | "before-first-message" | "after-first-message";
28
+ /**
29
+ * An optional class name to apply to the suggestions.
30
+ */
31
+ className?: string;
32
+ };
33
+ type UseCopilotChatSuggestionsConfiguration = DynamicSuggestionsConfigInput | StaticSuggestionsConfigInput;
34
+ declare function useConfigureChatSuggestions(config: UseCopilotChatSuggestionsConfiguration, dependencies?: any[]): ReturnType<typeof useSuggestions>;
35
+
36
+ export { UseCopilotChatSuggestionsConfiguration, useConfigureChatSuggestions };
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {}))
13
+ if (__hasOwnProp.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols)
16
+ for (var prop of __getOwnPropSymbols(b)) {
17
+ if (__propIsEnum.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ return a;
21
+ };
22
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
+ var __export = (target, all) => {
24
+ for (var name in all)
25
+ __defProp(target, name, { get: all[name], enumerable: true });
26
+ };
27
+ var __copyProps = (to, from, except, desc) => {
28
+ if (from && typeof from === "object" || typeof from === "function") {
29
+ for (let key of __getOwnPropNames(from))
30
+ if (!__hasOwnProp.call(to, key) && key !== except)
31
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
32
+ }
33
+ return to;
34
+ };
35
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
+
37
+ // src/hooks/use-configure-chat-suggestions.tsx
38
+ var use_configure_chat_suggestions_exports = {};
39
+ __export(use_configure_chat_suggestions_exports, {
40
+ useConfigureChatSuggestions: () => useConfigureChatSuggestions
41
+ });
42
+ module.exports = __toCommonJS(use_configure_chat_suggestions_exports);
43
+ var import_react = require("@copilotkitnext/react");
44
+ var import_react2 = require("react");
45
+ function useConfigureChatSuggestions(config, dependencies = []) {
46
+ var _a;
47
+ const existingConfig = (0, import_react.useCopilotChatConfiguration)();
48
+ const resolvedAgentId = (_a = existingConfig == null ? void 0 : existingConfig.agentId) != null ? _a : "default";
49
+ const { copilotkit } = (0, import_react.useCopilotKit)();
50
+ const available = config.available === "enabled" ? "always" : config.available;
51
+ const finalSuggestionConfig = __spreadProps(__spreadValues({}, config), {
52
+ available,
53
+ consumerAgentId: resolvedAgentId
54
+ // Use chatConfig.agentId here
55
+ });
56
+ (0, import_react.useConfigureSuggestions)(finalSuggestionConfig, dependencies);
57
+ const result = (0, import_react.useSuggestions)({ agentId: resolvedAgentId });
58
+ (0, import_react2.useEffect)(() => {
59
+ if (finalSuggestionConfig.available === "disabled")
60
+ return;
61
+ const subscription = copilotkit.subscribe({
62
+ onAgentsChanged: () => {
63
+ const agent = copilotkit.getAgent(resolvedAgentId);
64
+ if (agent && !agent.isRunning && !result.suggestions.length) {
65
+ copilotkit.reloadSuggestions(resolvedAgentId);
66
+ }
67
+ }
68
+ });
69
+ return () => {
70
+ subscription.unsubscribe();
71
+ };
72
+ }, [resolvedAgentId]);
73
+ return result;
74
+ }
75
+ // Annotate the CommonJS export names for ESM import in node:
76
+ 0 && (module.exports = {
77
+ useConfigureChatSuggestions
78
+ });
79
+ //# sourceMappingURL=use-configure-chat-suggestions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/hooks/use-configure-chat-suggestions.tsx"],"sourcesContent":["import {\n useConfigureSuggestions,\n useCopilotChatConfiguration,\n useCopilotKit,\n useSuggestions,\n} from \"@copilotkitnext/react\";\nimport { StaticSuggestionsConfig, Suggestion } from \"@copilotkitnext/core\";\nimport { useCopilotContext } from \"../context\";\nimport { useEffect, useMemo } from \"react\";\n\ntype StaticSuggestionInput = Omit<Suggestion, \"isLoading\"> & Partial<Pick<Suggestion, \"isLoading\">>;\n\ntype StaticSuggestionsConfigInput = Omit<StaticSuggestionsConfig, \"suggestions\"> & {\n suggestions: StaticSuggestionInput[];\n};\n\ntype DynamicSuggestionsConfigInput = {\n /**\n * A prompt or instructions for the GPT to generate suggestions.\n */\n instructions: string;\n /**\n * The minimum number of suggestions to generate. Defaults to `1`.\n * @default 1\n */\n minSuggestions?: number;\n /**\n * The maximum number of suggestions to generate. Defaults to `3`.\n * @default 1\n */\n maxSuggestions?: number;\n\n /**\n * Whether the suggestions are available. Defaults to `enabled`.\n * @default enabled\n */\n available?: \"enabled\" | \"disabled\" | \"always\" | \"before-first-message\" | \"after-first-message\";\n\n /**\n * An optional class name to apply to the suggestions.\n */\n className?: string;\n};\n\nexport type UseCopilotChatSuggestionsConfiguration =\n | DynamicSuggestionsConfigInput\n | StaticSuggestionsConfigInput;\n\nexport function useConfigureChatSuggestions(\n config: UseCopilotChatSuggestionsConfiguration,\n dependencies: any[] = [],\n): ReturnType<typeof useSuggestions> {\n const existingConfig = useCopilotChatConfiguration();\n const resolvedAgentId = existingConfig?.agentId ?? \"default\";\n const { copilotkit } = useCopilotKit();\n\n const available = config.available === \"enabled\" ? \"always\" : config.available;\n\n const finalSuggestionConfig = {\n ...config,\n available,\n consumerAgentId: resolvedAgentId, // Use chatConfig.agentId here\n };\n useConfigureSuggestions(finalSuggestionConfig, dependencies);\n\n const result = useSuggestions({ agentId: resolvedAgentId });\n\n useEffect(() => {\n if (finalSuggestionConfig.available === \"disabled\") return;\n const subscription = copilotkit.subscribe({\n onAgentsChanged: () => {\n // When agents change, check if our target agent now exists and reload\n const agent = copilotkit.getAgent(resolvedAgentId);\n if (agent && !agent.isRunning && !result.suggestions.length) {\n copilotkit.reloadSuggestions(resolvedAgentId);\n }\n },\n });\n\n return () => {\n subscription.unsubscribe();\n };\n }, [resolvedAgentId]);\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAKO;AAGP,IAAAA,gBAAmC;AAwC5B,SAAS,4BACd,QACA,eAAsB,CAAC,GACY;AAnDrC;AAoDE,QAAM,qBAAiB,0CAA4B;AACnD,QAAM,mBAAkB,sDAAgB,YAAhB,YAA2B;AACnD,QAAM,EAAE,WAAW,QAAI,4BAAc;AAErC,QAAM,YAAY,OAAO,cAAc,YAAY,WAAW,OAAO;AAErE,QAAM,wBAAwB,iCACzB,SADyB;AAAA,IAE5B;AAAA,IACA,iBAAiB;AAAA;AAAA,EACnB;AACA,4CAAwB,uBAAuB,YAAY;AAE3D,QAAM,aAAS,6BAAe,EAAE,SAAS,gBAAgB,CAAC;AAE1D,+BAAU,MAAM;AACd,QAAI,sBAAsB,cAAc;AAAY;AACpD,UAAM,eAAe,WAAW,UAAU;AAAA,MACxC,iBAAiB,MAAM;AAErB,cAAM,QAAQ,WAAW,SAAS,eAAe;AACjD,YAAI,SAAS,CAAC,MAAM,aAAa,CAAC,OAAO,YAAY,QAAQ;AAC3D,qBAAW,kBAAkB,eAAe;AAAA,QAC9C;AAAA,MACF;AAAA,IACF,CAAC;AAED,WAAO,MAAM;AACX,mBAAa,YAAY;AAAA,IAC3B;AAAA,EACF,GAAG,CAAC,eAAe,CAAC;AAEpB,SAAO;AACT;","names":["import_react"]}