@copilotkit/shared 1.10.0-next.3 → 1.10.0-next.5

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 (37) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/{chunk-H55CHWLX.mjs → chunk-KW3365WI.mjs} +2 -2
  3. package/dist/{chunk-H55CHWLX.mjs.map → chunk-KW3365WI.mjs.map} +1 -1
  4. package/dist/{chunk-77XMRBK7.mjs → chunk-RW3UTSZO.mjs} +2 -2
  5. package/dist/{chunk-DCBWR34Z.mjs → chunk-US5LPX5F.mjs} +2 -2
  6. package/dist/{chunk-DCBWR34Z.mjs.map → chunk-US5LPX5F.mjs.map} +1 -1
  7. package/dist/chunk-UTYBH3TE.mjs +88 -0
  8. package/dist/chunk-UTYBH3TE.mjs.map +1 -0
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.js +92 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/index.mjs +17 -3
  13. package/dist/telemetry/index.js +1 -1
  14. package/dist/telemetry/index.js.map +1 -1
  15. package/dist/telemetry/index.mjs +2 -2
  16. package/dist/telemetry/scarf-client.js +1 -1
  17. package/dist/telemetry/scarf-client.js.map +1 -1
  18. package/dist/telemetry/scarf-client.mjs +1 -1
  19. package/dist/telemetry/telemetry-client.js +1 -1
  20. package/dist/telemetry/telemetry-client.js.map +1 -1
  21. package/dist/telemetry/telemetry-client.mjs +2 -2
  22. package/dist/utils/console-styling.d.ts +84 -0
  23. package/dist/utils/console-styling.js +117 -0
  24. package/dist/utils/console-styling.js.map +1 -0
  25. package/dist/utils/console-styling.mjs +17 -0
  26. package/dist/utils/console-styling.mjs.map +1 -0
  27. package/dist/utils/errors.js +1 -1
  28. package/dist/utils/errors.js.map +1 -1
  29. package/dist/utils/errors.mjs +4 -3
  30. package/dist/utils/index.d.ts +1 -0
  31. package/dist/utils/index.js +92 -1
  32. package/dist/utils/index.js.map +1 -1
  33. package/dist/utils/index.mjs +17 -3
  34. package/package.json +1 -1
  35. package/src/utils/console-styling.ts +118 -0
  36. package/src/utils/index.ts +1 -0
  37. /package/dist/{chunk-77XMRBK7.mjs.map → chunk-RW3UTSZO.mjs.map} +0 -0
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Console styling utilities for CopilotKit branded messages
3
+ * Provides consistent, readable colors across light and dark console themes
4
+ */
5
+ /**
6
+ * Color palette optimized for console readability
7
+ */
8
+ declare const ConsoleColors: {
9
+ /** Primary brand blue - for titles and links */
10
+ readonly primary: "#007acc";
11
+ /** Success green - for positive messaging */
12
+ readonly success: "#22c55e";
13
+ /** Purple - for feature highlights */
14
+ readonly feature: "#a855f7";
15
+ /** Red - for calls-to-action */
16
+ readonly cta: "#ef4444";
17
+ /** Cyan - for closing statements */
18
+ readonly info: "#06b6d4";
19
+ /** Inherit console default - for body text */
20
+ readonly inherit: "inherit";
21
+ /** Warning style */
22
+ readonly warning: "#f59e0b";
23
+ };
24
+ /**
25
+ * Console style templates for common patterns
26
+ */
27
+ declare const ConsoleStyles: {
28
+ /** Large header style */
29
+ readonly header: "color: #f59e0b; font-weight: bold; font-size: 16px;";
30
+ /** Section header style */
31
+ readonly section: "color: #22c55e; font-weight: bold;";
32
+ /** Feature highlight style */
33
+ readonly highlight: "color: #a855f7; font-weight: bold;";
34
+ /** Call-to-action style */
35
+ readonly cta: "color: #22c55e; font-weight: bold;";
36
+ /** Info style */
37
+ readonly info: "color: #06b6d4; font-weight: bold;";
38
+ /** Link style */
39
+ readonly link: "color: #007acc; text-decoration: underline;";
40
+ /** Body text - inherits console theme */
41
+ readonly body: "color: inherit;";
42
+ /** Warning style */
43
+ readonly warning: "color: #ef4444; font-weight: bold;";
44
+ };
45
+ /**
46
+ * Styled console message for CopilotKit Platform promotion
47
+ * Displays a beautiful, branded advertisement in the console
48
+ */
49
+ declare function logCopilotKitPlatformMessage(): void;
50
+ declare function publicApiKeyRequired(feature: string): void;
51
+ /**
52
+ * Create a styled console message with custom content
53
+ *
54
+ * @param template - Template string with %c placeholders
55
+ * @param styles - Array of style strings matching the %c placeholders
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * logStyled(
60
+ * '%cCopilotKit%c Welcome to the platform!',
61
+ * [ConsoleStyles.header, ConsoleStyles.body]
62
+ * );
63
+ * ```
64
+ */
65
+ declare function logStyled(template: string, styles: string[]): void;
66
+ /**
67
+ * Quick styled console methods for common use cases
68
+ */
69
+ declare const styledConsole: {
70
+ /** Log a success message */
71
+ readonly success: (message: string) => void;
72
+ /** Log an info message */
73
+ readonly info: (message: string) => void;
74
+ /** Log a feature highlight */
75
+ readonly feature: (message: string) => void;
76
+ /** Log a call-to-action */
77
+ readonly cta: (message: string) => void;
78
+ /** Log the CopilotKit platform promotion */
79
+ readonly logCopilotKitPlatformMessage: typeof logCopilotKitPlatformMessage;
80
+ /** Log a `publicApiKeyRequired` warning */
81
+ readonly publicApiKeyRequired: typeof publicApiKeyRequired;
82
+ };
83
+
84
+ export { ConsoleColors, ConsoleStyles, logCopilotKitPlatformMessage, logStyled, publicApiKeyRequired, styledConsole };
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/utils/console-styling.ts
21
+ var console_styling_exports = {};
22
+ __export(console_styling_exports, {
23
+ ConsoleColors: () => ConsoleColors,
24
+ ConsoleStyles: () => ConsoleStyles,
25
+ logCopilotKitPlatformMessage: () => logCopilotKitPlatformMessage,
26
+ logStyled: () => logStyled,
27
+ publicApiKeyRequired: () => publicApiKeyRequired,
28
+ styledConsole: () => styledConsole
29
+ });
30
+ module.exports = __toCommonJS(console_styling_exports);
31
+ var ConsoleColors = {
32
+ /** Primary brand blue - for titles and links */
33
+ primary: "#007acc",
34
+ /** Success green - for positive messaging */
35
+ success: "#22c55e",
36
+ /** Purple - for feature highlights */
37
+ feature: "#a855f7",
38
+ /** Red - for calls-to-action */
39
+ cta: "#ef4444",
40
+ /** Cyan - for closing statements */
41
+ info: "#06b6d4",
42
+ /** Inherit console default - for body text */
43
+ inherit: "inherit",
44
+ /** Warning style */
45
+ warning: "#f59e0b"
46
+ };
47
+ var ConsoleStyles = {
48
+ /** Large header style */
49
+ header: `color: ${ConsoleColors.warning}; font-weight: bold; font-size: 16px;`,
50
+ /** Section header style */
51
+ section: `color: ${ConsoleColors.success}; font-weight: bold;`,
52
+ /** Feature highlight style */
53
+ highlight: `color: ${ConsoleColors.feature}; font-weight: bold;`,
54
+ /** Call-to-action style */
55
+ cta: `color: ${ConsoleColors.success}; font-weight: bold;`,
56
+ /** Info style */
57
+ info: `color: ${ConsoleColors.info}; font-weight: bold;`,
58
+ /** Link style */
59
+ link: `color: ${ConsoleColors.primary}; text-decoration: underline;`,
60
+ /** Body text - inherits console theme */
61
+ body: `color: ${ConsoleColors.inherit};`,
62
+ /** Warning style */
63
+ warning: `color: ${ConsoleColors.cta}; font-weight: bold;`
64
+ };
65
+ function logCopilotKitPlatformMessage() {
66
+ console.log(
67
+ `%cCopilotKit Warning%c
68
+
69
+ As of version 1.10.0, useCopilotChat has gained full compatibility with CopilotKit's newly released Headless UI feature set. %cAdd your CopilotKit API key, available for free at cloud.copilotkit.ai, to enable these features.%c
70
+
71
+ Alternatively, useCopilotChatLight is available for basic programmatic messaging, and does not require an API key. The differences between useCopilotChat and useCopilotChatLight are documented here: %chttps://docs.copilotkit.ai/reference/hooks/useCopilotChatLight%c`,
72
+ ConsoleStyles.header,
73
+ ConsoleStyles.body,
74
+ ConsoleStyles.cta,
75
+ ConsoleStyles.body,
76
+ ConsoleStyles.link,
77
+ ConsoleStyles.body
78
+ );
79
+ }
80
+ function publicApiKeyRequired(feature) {
81
+ console.log(
82
+ `
83
+ %cCopilotKit Warning%c
84
+
85
+ In order to use ${feature}, you need to add your CopilotKit API key, available for free at https://cloud.copilotkit.ai.
86
+ `.trim(),
87
+ ConsoleStyles.header,
88
+ ConsoleStyles.body
89
+ );
90
+ }
91
+ function logStyled(template, styles) {
92
+ console.log(template, ...styles);
93
+ }
94
+ var styledConsole = {
95
+ /** Log a success message */
96
+ success: (message) => logStyled(`%c\u2705 ${message}`, [ConsoleStyles.section]),
97
+ /** Log an info message */
98
+ info: (message) => logStyled(`%c\u2139\uFE0F ${message}`, [ConsoleStyles.info]),
99
+ /** Log a feature highlight */
100
+ feature: (message) => logStyled(`%c\u2728 ${message}`, [ConsoleStyles.highlight]),
101
+ /** Log a call-to-action */
102
+ cta: (message) => logStyled(`%c\u{1F680} ${message}`, [ConsoleStyles.cta]),
103
+ /** Log the CopilotKit platform promotion */
104
+ logCopilotKitPlatformMessage,
105
+ /** Log a `publicApiKeyRequired` warning */
106
+ publicApiKeyRequired
107
+ };
108
+ // Annotate the CommonJS export names for ESM import in node:
109
+ 0 && (module.exports = {
110
+ ConsoleColors,
111
+ ConsoleStyles,
112
+ logCopilotKitPlatformMessage,
113
+ logStyled,
114
+ publicApiKeyRequired,
115
+ styledConsole
116
+ });
117
+ //# sourceMappingURL=console-styling.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/console-styling.ts"],"sourcesContent":["/**\n * Console styling utilities for CopilotKit branded messages\n * Provides consistent, readable colors across light and dark console themes\n */\n\n/**\n * Color palette optimized for console readability\n */\nexport const ConsoleColors = {\n /** Primary brand blue - for titles and links */\n primary: \"#007acc\",\n /** Success green - for positive messaging */\n success: \"#22c55e\",\n /** Purple - for feature highlights */\n feature: \"#a855f7\",\n /** Red - for calls-to-action */\n cta: \"#ef4444\",\n /** Cyan - for closing statements */\n info: \"#06b6d4\",\n /** Inherit console default - for body text */\n inherit: \"inherit\",\n /** Warning style */\n warning: \"#f59e0b\",\n} as const;\n\n/**\n * Console style templates for common patterns\n */\nexport const ConsoleStyles = {\n /** Large header style */\n header: `color: ${ConsoleColors.warning}; font-weight: bold; font-size: 16px;`,\n /** Section header style */\n section: `color: ${ConsoleColors.success}; font-weight: bold;`,\n /** Feature highlight style */\n highlight: `color: ${ConsoleColors.feature}; font-weight: bold;`,\n /** Call-to-action style */\n cta: `color: ${ConsoleColors.success}; font-weight: bold;`,\n /** Info style */\n info: `color: ${ConsoleColors.info}; font-weight: bold;`,\n /** Link style */\n link: `color: ${ConsoleColors.primary}; text-decoration: underline;`,\n /** Body text - inherits console theme */\n body: `color: ${ConsoleColors.inherit};`,\n /** Warning style */\n warning: `color: ${ConsoleColors.cta}; font-weight: bold;`,\n} as const;\n\n/**\n * Styled console message for CopilotKit Platform promotion\n * Displays a beautiful, branded advertisement in the console\n */\nexport function logCopilotKitPlatformMessage() {\n console.log(\n `%cCopilotKit Warning%c\n\nAs of version 1.10.0, useCopilotChat has gained full compatibility with CopilotKit's newly released Headless UI feature set. %cAdd your CopilotKit API key, available for free at cloud.copilotkit.ai, to enable these features.%c\n\nAlternatively, useCopilotChatLight is available for basic programmatic messaging, and does not require an API key. The differences between useCopilotChat and useCopilotChatLight are documented here: %chttps://docs.copilotkit.ai/reference/hooks/useCopilotChatLight%c`,\n ConsoleStyles.header,\n ConsoleStyles.body,\n ConsoleStyles.cta,\n ConsoleStyles.body,\n ConsoleStyles.link,\n ConsoleStyles.body,\n );\n}\n\nexport function publicApiKeyRequired(feature: string) {\n console.log(\n `\n%cCopilotKit Warning%c \\n\nIn order to use ${feature}, you need to add your CopilotKit API key, available for free at https://cloud.copilotkit.ai.\n `.trim(),\n ConsoleStyles.header,\n ConsoleStyles.body,\n );\n}\n\n/**\n * Create a styled console message with custom content\n *\n * @param template - Template string with %c placeholders\n * @param styles - Array of style strings matching the %c placeholders\n *\n * @example\n * ```typescript\n * logStyled(\n * '%cCopilotKit%c Welcome to the platform!',\n * [ConsoleStyles.header, ConsoleStyles.body]\n * );\n * ```\n */\nexport function logStyled(template: string, styles: string[]) {\n console.log(template, ...styles);\n}\n\n/**\n * Quick styled console methods for common use cases\n */\nexport const styledConsole = {\n /** Log a success message */\n success: (message: string) => logStyled(`%c✅ ${message}`, [ConsoleStyles.section]),\n\n /** Log an info message */\n info: (message: string) => logStyled(`%cℹ️ ${message}`, [ConsoleStyles.info]),\n\n /** Log a feature highlight */\n feature: (message: string) => logStyled(`%c✨ ${message}`, [ConsoleStyles.highlight]),\n\n /** Log a call-to-action */\n cta: (message: string) => logStyled(`%c🚀 ${message}`, [ConsoleStyles.cta]),\n\n /** Log the CopilotKit platform promotion */\n logCopilotKitPlatformMessage: logCopilotKitPlatformMessage,\n\n /** Log a `publicApiKeyRequired` warning */\n publicApiKeyRequired: publicApiKeyRequired,\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQO,IAAM,gBAAgB;AAAA;AAAA,EAE3B,SAAS;AAAA;AAAA,EAET,SAAS;AAAA;AAAA,EAET,SAAS;AAAA;AAAA,EAET,KAAK;AAAA;AAAA,EAEL,MAAM;AAAA;AAAA,EAEN,SAAS;AAAA;AAAA,EAET,SAAS;AACX;AAKO,IAAM,gBAAgB;AAAA;AAAA,EAE3B,QAAQ,UAAU,cAAc;AAAA;AAAA,EAEhC,SAAS,UAAU,cAAc;AAAA;AAAA,EAEjC,WAAW,UAAU,cAAc;AAAA;AAAA,EAEnC,KAAK,UAAU,cAAc;AAAA;AAAA,EAE7B,MAAM,UAAU,cAAc;AAAA;AAAA,EAE9B,MAAM,UAAU,cAAc;AAAA;AAAA,EAE9B,MAAM,UAAU,cAAc;AAAA;AAAA,EAE9B,SAAS,UAAU,cAAc;AACnC;AAMO,SAAS,+BAA+B;AAC7C,UAAQ;AAAA,IACN;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA,cAAc;AAAA,IACd,cAAc;AAAA,IACd,cAAc;AAAA,IACd,cAAc;AAAA,IACd,cAAc;AAAA,IACd,cAAc;AAAA,EAChB;AACF;AAEO,SAAS,qBAAqB,SAAiB;AACpD,UAAQ;AAAA,IACN;AAAA;AAAA;AAAA,kBAEc;AAAA,MACZ,KAAK;AAAA,IACP,cAAc;AAAA,IACd,cAAc;AAAA,EAChB;AACF;AAgBO,SAAS,UAAU,UAAkB,QAAkB;AAC5D,UAAQ,IAAI,UAAU,GAAG,MAAM;AACjC;AAKO,IAAM,gBAAgB;AAAA;AAAA,EAE3B,SAAS,CAAC,YAAoB,UAAU,YAAO,WAAW,CAAC,cAAc,OAAO,CAAC;AAAA;AAAA,EAGjF,MAAM,CAAC,YAAoB,UAAU,kBAAQ,WAAW,CAAC,cAAc,IAAI,CAAC;AAAA;AAAA,EAG5E,SAAS,CAAC,YAAoB,UAAU,YAAO,WAAW,CAAC,cAAc,SAAS,CAAC;AAAA;AAAA,EAGnF,KAAK,CAAC,YAAoB,UAAU,eAAQ,WAAW,CAAC,cAAc,GAAG,CAAC;AAAA;AAAA,EAG1E;AAAA;AAAA,EAGA;AACF;","names":[]}
@@ -0,0 +1,17 @@
1
+ import {
2
+ ConsoleColors,
3
+ ConsoleStyles,
4
+ logCopilotKitPlatformMessage,
5
+ logStyled,
6
+ publicApiKeyRequired,
7
+ styledConsole
8
+ } from "../chunk-UTYBH3TE.mjs";
9
+ export {
10
+ ConsoleColors,
11
+ ConsoleStyles,
12
+ logCopilotKitPlatformMessage,
13
+ logStyled,
14
+ publicApiKeyRequired,
15
+ styledConsole
16
+ };
17
+ //# sourceMappingURL=console-styling.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -46,7 +46,7 @@ module.exports = __toCommonJS(errors_exports);
46
46
  var import_graphql = require("graphql");
47
47
 
48
48
  // package.json
49
- var version = "1.10.0-next.3";
49
+ var version = "1.10.0-next.5";
50
50
 
51
51
  // src/index.ts
52
52
  var COPILOTKIT_VERSION = version;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/errors.ts","../../package.json","../../src/index.ts"],"sourcesContent":["import { GraphQLError } from \"graphql\";\nimport { COPILOTKIT_VERSION } from \"../index\";\n\nexport enum Severity {\n CRITICAL = \"critical\", // Critical errors that block core functionality\n WARNING = \"warning\", // Configuration/setup issues that need attention\n INFO = \"info\", // General errors and network issues\n}\n\nexport enum ErrorVisibility {\n BANNER = \"banner\", // Critical errors shown as fixed banners\n TOAST = \"toast\", // Regular errors shown as dismissible toasts\n SILENT = \"silent\", // Errors logged but not shown to user\n DEV_ONLY = \"dev_only\", // Errors only shown in development mode\n}\n\nexport const ERROR_NAMES = {\n COPILOT_ERROR: \"CopilotError\",\n COPILOT_API_DISCOVERY_ERROR: \"CopilotApiDiscoveryError\",\n COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR: \"CopilotKitRemoteEndpointDiscoveryError\",\n COPILOT_KIT_AGENT_DISCOVERY_ERROR: \"CopilotKitAgentDiscoveryError\",\n COPILOT_KIT_LOW_LEVEL_ERROR: \"CopilotKitLowLevelError\",\n COPILOT_KIT_VERSION_MISMATCH_ERROR: \"CopilotKitVersionMismatchError\",\n RESOLVED_COPILOT_KIT_ERROR: \"ResolvedCopilotKitError\",\n CONFIGURATION_ERROR: \"ConfigurationError\",\n MISSING_PUBLIC_API_KEY_ERROR: \"MissingPublicApiKeyError\",\n UPGRADE_REQUIRED_ERROR: \"UpgradeRequiredError\",\n} as const;\n\n// Banner errors - critical configuration/discovery issues\nexport const BANNER_ERROR_NAMES = [\n ERROR_NAMES.CONFIGURATION_ERROR,\n ERROR_NAMES.MISSING_PUBLIC_API_KEY_ERROR,\n ERROR_NAMES.UPGRADE_REQUIRED_ERROR,\n ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR,\n ERROR_NAMES.COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR,\n ERROR_NAMES.COPILOT_KIT_AGENT_DISCOVERY_ERROR,\n];\n\n// Legacy cloud error names for backward compatibility\nexport const COPILOT_CLOUD_ERROR_NAMES = BANNER_ERROR_NAMES;\n\nexport enum CopilotKitErrorCode {\n NETWORK_ERROR = \"NETWORK_ERROR\",\n NOT_FOUND = \"NOT_FOUND\",\n AGENT_NOT_FOUND = \"AGENT_NOT_FOUND\",\n API_NOT_FOUND = \"API_NOT_FOUND\",\n REMOTE_ENDPOINT_NOT_FOUND = \"REMOTE_ENDPOINT_NOT_FOUND\",\n AUTHENTICATION_ERROR = \"AUTHENTICATION_ERROR\",\n MISUSE = \"MISUSE\",\n UNKNOWN = \"UNKNOWN\",\n VERSION_MISMATCH = \"VERSION_MISMATCH\",\n CONFIGURATION_ERROR = \"CONFIGURATION_ERROR\",\n MISSING_PUBLIC_API_KEY_ERROR = \"MISSING_PUBLIC_API_KEY_ERROR\",\n UPGRADE_REQUIRED_ERROR = \"UPGRADE_REQUIRED_ERROR\",\n}\n\nconst BASE_URL = \"https://docs.copilotkit.ai\";\n\nconst getSeeMoreMarkdown = (link: string) => `See more: [${link}](${link})`;\n\nexport const ERROR_CONFIG = {\n [CopilotKitErrorCode.NETWORK_ERROR]: {\n statusCode: 503,\n troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found`,\n visibility: ErrorVisibility.BANNER,\n severity: Severity.CRITICAL,\n },\n [CopilotKitErrorCode.NOT_FOUND]: {\n statusCode: 404,\n troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found`,\n visibility: ErrorVisibility.BANNER,\n severity: Severity.CRITICAL,\n },\n [CopilotKitErrorCode.AGENT_NOT_FOUND]: {\n statusCode: 500,\n troubleshootingUrl: `${BASE_URL}/coagents/troubleshooting/common-issues#i-am-getting-agent-not-found-error`,\n visibility: ErrorVisibility.BANNER,\n severity: Severity.CRITICAL,\n },\n [CopilotKitErrorCode.API_NOT_FOUND]: {\n statusCode: 404,\n troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found`,\n visibility: ErrorVisibility.BANNER,\n severity: Severity.CRITICAL,\n },\n [CopilotKitErrorCode.REMOTE_ENDPOINT_NOT_FOUND]: {\n statusCode: 404,\n troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-copilotkits-remote-endpoint-not-found-error`,\n visibility: ErrorVisibility.BANNER,\n severity: Severity.CRITICAL,\n },\n [CopilotKitErrorCode.AUTHENTICATION_ERROR]: {\n statusCode: 401,\n troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#authentication-errors`,\n visibility: ErrorVisibility.BANNER,\n severity: Severity.CRITICAL,\n },\n [CopilotKitErrorCode.MISUSE]: {\n statusCode: 400,\n troubleshootingUrl: null,\n visibility: ErrorVisibility.DEV_ONLY,\n severity: Severity.WARNING,\n },\n [CopilotKitErrorCode.UNKNOWN]: {\n statusCode: 500,\n visibility: ErrorVisibility.TOAST,\n severity: Severity.CRITICAL,\n },\n [CopilotKitErrorCode.CONFIGURATION_ERROR]: {\n statusCode: 400,\n troubleshootingUrl: null,\n severity: Severity.WARNING,\n visibility: ErrorVisibility.BANNER,\n },\n [CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR]: {\n statusCode: 400,\n troubleshootingUrl: null,\n severity: Severity.CRITICAL,\n visibility: ErrorVisibility.BANNER,\n },\n [CopilotKitErrorCode.UPGRADE_REQUIRED_ERROR]: {\n statusCode: 402,\n troubleshootingUrl: null,\n severity: Severity.WARNING,\n visibility: ErrorVisibility.BANNER,\n },\n [CopilotKitErrorCode.VERSION_MISMATCH]: {\n statusCode: 400,\n troubleshootingUrl: null,\n visibility: ErrorVisibility.DEV_ONLY,\n severity: Severity.INFO,\n },\n};\n\nexport class CopilotKitError extends GraphQLError {\n code: CopilotKitErrorCode;\n statusCode: number;\n severity?: Severity;\n visibility: ErrorVisibility;\n\n constructor({\n message = \"Unknown error occurred\",\n code,\n severity,\n visibility,\n }: {\n message?: string;\n code: CopilotKitErrorCode;\n severity?: Severity;\n visibility?: ErrorVisibility;\n }) {\n const name = ERROR_NAMES.COPILOT_ERROR;\n const config = ERROR_CONFIG[code];\n const { statusCode } = config;\n const resolvedVisibility = visibility ?? config.visibility ?? ErrorVisibility.TOAST;\n const resolvedSeverity = severity ?? (\"severity\" in config ? config.severity : undefined);\n\n super(message, {\n extensions: {\n name,\n statusCode,\n code,\n visibility: resolvedVisibility,\n severity: resolvedSeverity,\n troubleshootingUrl: \"troubleshootingUrl\" in config ? config.troubleshootingUrl : null,\n originalError: {\n message,\n stack: new Error().stack,\n },\n },\n });\n\n this.code = code;\n this.name = name;\n this.statusCode = statusCode;\n this.severity = resolvedSeverity;\n this.visibility = resolvedVisibility;\n }\n}\n\n/**\n * Error thrown when we can identify wrong usage of our components.\n * This helps us notify the developer before real errors can happen\n *\n * @extends CopilotKitError\n */\nexport class CopilotKitMisuseError extends CopilotKitError {\n constructor({\n message,\n code = CopilotKitErrorCode.MISUSE,\n }: {\n message: string;\n code?: CopilotKitErrorCode;\n }) {\n const docsLink =\n \"troubleshootingUrl\" in ERROR_CONFIG[code] && ERROR_CONFIG[code].troubleshootingUrl\n ? getSeeMoreMarkdown(ERROR_CONFIG[code].troubleshootingUrl as string)\n : null;\n const finalMessage = docsLink ? `${message}.\\n\\n${docsLink}` : message;\n super({ message: finalMessage, code });\n this.name = ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR;\n }\n}\n\nconst getVersionMismatchErrorMessage = ({\n reactCoreVersion,\n runtimeVersion,\n runtimeClientGqlVersion,\n}: VersionMismatchResponse) =>\n `Version mismatch detected: @copilotkit/runtime@${runtimeVersion ?? \"\"} is not compatible with @copilotkit/react-core@${reactCoreVersion} and @copilotkit/runtime-client-gql@${runtimeClientGqlVersion}. Please ensure all installed copilotkit packages are on the same version.`;\n/**\n * Error thrown when CPK versions does not match\n *\n * @extends CopilotKitError\n */\nexport class CopilotKitVersionMismatchError extends CopilotKitError {\n constructor({\n reactCoreVersion,\n runtimeVersion,\n runtimeClientGqlVersion,\n }: VersionMismatchResponse) {\n const code = CopilotKitErrorCode.VERSION_MISMATCH;\n super({\n message: getVersionMismatchErrorMessage({\n reactCoreVersion,\n runtimeVersion,\n runtimeClientGqlVersion,\n }),\n code,\n });\n this.name = ERROR_NAMES.COPILOT_KIT_VERSION_MISMATCH_ERROR;\n }\n}\n\n/**\n * Error thrown when the CopilotKit API endpoint cannot be discovered or accessed.\n * This typically occurs when:\n * - The API endpoint URL is invalid or misconfigured\n * - The API service is not running at the expected location\n * - There are network/firewall issues preventing access\n *\n * @extends CopilotKitError\n */\nexport class CopilotKitApiDiscoveryError extends CopilotKitError {\n constructor(\n params: {\n message?: string;\n code?: CopilotKitErrorCode.API_NOT_FOUND | CopilotKitErrorCode.REMOTE_ENDPOINT_NOT_FOUND;\n url?: string;\n } = {},\n ) {\n const url = params.url ?? \"\";\n let operationSuffix = \"\";\n if (url?.includes(\"/info\")) operationSuffix = `when fetching CopilotKit info`;\n else if (url.includes(\"/actions/execute\"))\n operationSuffix = `when attempting to execute actions.`;\n else if (url.includes(\"/agents/state\")) operationSuffix = `when attempting to get agent state.`;\n else if (url.includes(\"/agents/execute\"))\n operationSuffix = `when attempting to execute agent(s).`;\n const message =\n params.message ??\n (params.url\n ? `Failed to find CopilotKit API endpoint at url ${params.url} ${operationSuffix}`\n : `Failed to find CopilotKit API endpoint.`);\n const code = params.code ?? CopilotKitErrorCode.API_NOT_FOUND;\n const errorMessage = `${message}.\\n\\n${getSeeMoreMarkdown(ERROR_CONFIG[code].troubleshootingUrl)}`;\n super({ message: errorMessage, code });\n this.name = ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR;\n }\n}\n\n/**\n * This error is used for endpoints specified in runtime's remote endpoints. If they cannot be contacted\n * This typically occurs when:\n * - The API endpoint URL is invalid or misconfigured\n * - The API service is not running at the expected location\n *\n * @extends CopilotKitApiDiscoveryError\n */\nexport class CopilotKitRemoteEndpointDiscoveryError extends CopilotKitApiDiscoveryError {\n constructor(params?: { message?: string; url?: string }) {\n const message =\n params?.message ??\n (params?.url\n ? `Failed to find or contact remote endpoint at url ${params.url}`\n : \"Failed to find or contact remote endpoint\");\n const code = CopilotKitErrorCode.REMOTE_ENDPOINT_NOT_FOUND;\n super({ message, code });\n this.name = ERROR_NAMES.COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR;\n }\n}\n\n/**\n * Error thrown when a LangGraph agent cannot be found or accessed.\n * This typically occurs when:\n * - The specified agent name does not exist in the deployment\n * - The agent configuration is invalid or missing\n * - The agent service is not properly deployed or initialized\n *\n * @extends CopilotKitError\n */\nexport class CopilotKitAgentDiscoveryError extends CopilotKitError {\n constructor(params: { agentName?: string; availableAgents: { name: string; id: string }[] }) {\n const { agentName, availableAgents } = params;\n const code = CopilotKitErrorCode.AGENT_NOT_FOUND;\n\n const seeMore = getSeeMoreMarkdown(ERROR_CONFIG[code].troubleshootingUrl);\n let message;\n\n if (availableAgents.length) {\n const agentList = availableAgents.map((agent) => agent.name).join(\", \");\n\n if (agentName) {\n message = `Agent '${agentName}' was not found. Available agents are: ${agentList}. Please verify the agent name in your configuration and ensure it matches one of the available agents.\\n\\n${seeMore}`;\n } else {\n message = `The requested agent was not found. Available agents are: ${agentList}. Please verify the agent name in your configuration and ensure it matches one of the available agents.\\n\\n${seeMore}`;\n }\n } else {\n message = `${agentName ? `Agent '${agentName}'` : \"The requested agent\"} was not found. Please set up at least one agent before proceeding. ${seeMore}`;\n }\n\n super({ message, code });\n this.name = ERROR_NAMES.COPILOT_KIT_AGENT_DISCOVERY_ERROR;\n }\n}\n\n/**\n * Handles low-level networking errors that occur before a request reaches the server.\n * These errors arise from issues in the underlying communication infrastructure rather than\n * application-level logic or server responses. Typically used to handle \"fetch failed\" errors\n * where no HTTP status code is available.\n *\n * Common scenarios include:\n * - Connection failures (ECONNREFUSED) when server is down/unreachable\n * - DNS resolution failures (ENOTFOUND) when domain can't be resolved\n * - Timeouts (ETIMEDOUT) when request takes too long\n * - Protocol/transport layer errors like SSL/TLS issues\n */\nexport class CopilotKitLowLevelError extends CopilotKitError {\n constructor({ error, url, message }: { error: Error; url: string; message?: string }) {\n let code = CopilotKitErrorCode.NETWORK_ERROR;\n\n // @ts-expect-error -- code may exist\n const errorCode = error.code as string;\n const errorMessage = message ?? resolveLowLevelErrorMessage({ errorCode, url });\n\n super({ message: errorMessage, code });\n\n this.name = ERROR_NAMES.COPILOT_KIT_LOW_LEVEL_ERROR;\n }\n}\n\n/**\n * Generic catch-all error handler for HTTP responses from the CopilotKit API where a status code is available.\n * Used when we receive an HTTP error status and wish to handle broad range of them\n *\n * This differs from CopilotKitLowLevelError in that:\n * - ResolvedCopilotKitError: Server was reached and returned an HTTP status\n * - CopilotKitLowLevelError: Error occurred before reaching server (e.g. network failure)\n *\n * @param status - The HTTP status code received from the API response\n * @param message - Optional error message to include\n * @param code - Optional specific CopilotKitErrorCode to override default behavior\n *\n * Default behavior:\n * - 400 Bad Request: Maps to CopilotKitApiDiscoveryError\n * - All other status codes: Maps to UNKNOWN error code if no specific code provided\n */\nexport class ResolvedCopilotKitError extends CopilotKitError {\n constructor({\n status,\n message,\n code,\n isRemoteEndpoint,\n url,\n }: {\n status: number;\n message?: string;\n code?: CopilotKitErrorCode;\n isRemoteEndpoint?: boolean;\n url?: string;\n }) {\n let resolvedCode = code;\n if (!resolvedCode) {\n switch (status) {\n case 400:\n throw new CopilotKitApiDiscoveryError({ message, url });\n case 404:\n throw isRemoteEndpoint\n ? new CopilotKitRemoteEndpointDiscoveryError({ message, url })\n : new CopilotKitApiDiscoveryError({ message, url });\n default:\n resolvedCode = CopilotKitErrorCode.UNKNOWN;\n break;\n }\n }\n\n super({ message, code: resolvedCode });\n this.name = ERROR_NAMES.RESOLVED_COPILOT_KIT_ERROR;\n }\n}\n\nexport class ConfigurationError extends CopilotKitError {\n constructor(message: string) {\n super({ message, code: CopilotKitErrorCode.CONFIGURATION_ERROR });\n this.name = ERROR_NAMES.CONFIGURATION_ERROR;\n this.severity = Severity.WARNING;\n }\n}\n\nexport class MissingPublicApiKeyError extends ConfigurationError {\n constructor(message: string) {\n super(message);\n this.name = ERROR_NAMES.MISSING_PUBLIC_API_KEY_ERROR;\n this.severity = Severity.CRITICAL;\n }\n}\n\nexport class UpgradeRequiredError extends ConfigurationError {\n constructor(message: string) {\n super(message);\n this.name = ERROR_NAMES.UPGRADE_REQUIRED_ERROR;\n this.severity = Severity.WARNING;\n }\n}\n\n/**\n * Checks if an error is already a structured CopilotKit error.\n * This utility centralizes the logic for detecting structured errors across the codebase.\n *\n * @param error - The error to check\n * @returns true if the error is already structured, false otherwise\n */\nexport function isStructuredCopilotKitError(error: any): boolean {\n return (\n error instanceof CopilotKitError ||\n error instanceof CopilotKitLowLevelError ||\n (error?.name && error.name.includes(\"CopilotKit\")) ||\n error?.extensions?.code !== undefined // Check if it has our structured error properties\n );\n}\n\n/**\n * Returns the error as-is if it's already structured, otherwise converts it using the provided converter function.\n * This utility centralizes the pattern of preserving structured errors while converting unstructured ones.\n *\n * @param error - The error to process\n * @param converter - Function to convert unstructured errors to structured ones\n * @returns The structured error\n */\nexport function ensureStructuredError<T extends CopilotKitError>(\n error: any,\n converter: (error: any) => T,\n): T | any {\n return isStructuredCopilotKitError(error) ? error : converter(error);\n}\n\ninterface VersionMismatchResponse {\n runtimeVersion?: string;\n runtimeClientGqlVersion: string;\n reactCoreVersion: string;\n}\n\nexport async function getPossibleVersionMismatch({\n runtimeVersion,\n runtimeClientGqlVersion,\n}: {\n runtimeVersion?: string;\n runtimeClientGqlVersion: string;\n}) {\n if (!runtimeVersion || runtimeVersion === \"\" || !runtimeClientGqlVersion) return;\n if (\n COPILOTKIT_VERSION !== runtimeVersion ||\n COPILOTKIT_VERSION !== runtimeClientGqlVersion ||\n runtimeVersion !== runtimeClientGqlVersion\n ) {\n return {\n runtimeVersion,\n runtimeClientGqlVersion,\n reactCoreVersion: COPILOTKIT_VERSION,\n message: getVersionMismatchErrorMessage({\n runtimeVersion,\n runtimeClientGqlVersion,\n reactCoreVersion: COPILOTKIT_VERSION,\n }),\n };\n }\n\n return;\n}\n\nconst resolveLowLevelErrorMessage = ({ errorCode, url }: { errorCode?: string; url: string }) => {\n const troubleshootingLink = ERROR_CONFIG[CopilotKitErrorCode.NETWORK_ERROR].troubleshootingUrl;\n const genericMessage = (description = `Failed to fetch from url ${url}.`) => `${description}.\n\nPossible reasons:\n- -The server may have an error preventing it from returning a response (Check the server logs for more info).\n- -The server might be down or unreachable\n- -There might be a network issue (e.g., DNS failure, connection timeout) \n- -The URL might be incorrect\n- -The server is not running on the specified port\n\n${getSeeMoreMarkdown(troubleshootingLink)}`;\n\n if (url.includes(\"/info\"))\n return genericMessage(`Failed to fetch CopilotKit agents/action information from url ${url}.`);\n if (url.includes(\"/actions/execute\"))\n return genericMessage(`Fetch call to ${url} to execute actions failed.`);\n if (url.includes(\"/agents/state\"))\n return genericMessage(`Fetch call to ${url} to get agent state failed.`);\n if (url.includes(\"/agents/execute\"))\n return genericMessage(`Fetch call to ${url} to execute agent(s) failed.`);\n\n switch (errorCode) {\n case \"ECONNREFUSED\":\n return `Connection to ${url} was refused. Ensure the server is running and accessible.\\n\\n${getSeeMoreMarkdown(troubleshootingLink)}`;\n case \"ENOTFOUND\":\n return `The server on ${url} could not be found. Check the URL or your network configuration.\\n\\n${getSeeMoreMarkdown(ERROR_CONFIG[CopilotKitErrorCode.NOT_FOUND].troubleshootingUrl)}`;\n case \"ETIMEDOUT\":\n return `The connection to ${url} timed out. The server might be overloaded or taking too long to respond.\\n\\n${getSeeMoreMarkdown(troubleshootingLink)}`;\n default:\n return;\n }\n};\n","{\n \"name\": \"@copilotkit/shared\",\n \"private\": false,\n \"homepage\": \"https://github.com/CopilotKit/CopilotKit\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/CopilotKit/CopilotKit.git\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"version\": \"1.10.0-next.3\",\n \"sideEffects\": false,\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\"\n }\n },\n \"types\": \"./dist/index.d.ts\",\n \"license\": \"MIT\",\n \"scripts\": {\n \"build\": \"tsup --clean\",\n \"dev\": \"tsup --watch --no-splitting\",\n \"test\": \"jest --passWithNoTests\",\n \"check-types\": \"tsc --noEmit\",\n \"clean\": \"rm -rf .turbo && rm -rf node_modules && rm -rf dist && rm -rf .next\",\n \"link:global\": \"pnpm link --global\",\n \"unlink:global\": \"pnpm unlink --global\"\n },\n \"devDependencies\": {\n \"@types/jest\": \"^29.5.4\",\n \"@types/uuid\": \"^10.0.0\",\n \"eslint\": \"^8.56.0\",\n \"eslint-config-custom\": \"workspace:*\",\n \"jest\": \"^29.6.4\",\n \"ts-jest\": \"^29.1.1\",\n \"tsconfig\": \"workspace:*\",\n \"tsup\": \"^6.7.0\",\n \"typescript\": \"^5.2.3\"\n },\n \"dependencies\": {\n \"@ag-ui/core\": \"^0.0.30\",\n \"@segment/analytics-node\": \"^2.1.2\",\n \"chalk\": \"4.1.2\",\n \"graphql\": \"^16.8.1\",\n \"uuid\": \"^10.0.0\",\n \"zod\": \"^3.23.3\",\n \"zod-to-json-schema\": \"^3.23.5\"\n },\n \"keywords\": [\n \"copilotkit\",\n \"copilot\",\n \"react\",\n \"nextjs\",\n \"nodejs\",\n \"ai\",\n \"assistant\",\n \"javascript\",\n \"automation\",\n \"textarea\"\n ]\n}\n","export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\nexport * from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kBAAkB;AAAA,MACpB,CAAC;AAAA,IACH;AAAA,EACF;AAEA;AACF;AAEA,IAAM,8BAA8B,CAAC,EAAE,WAAW,IAAI,MAA2C;AAC/F,QAAM,sBAAsB,aAAa,mCAAiC,EAAE;AAC5E,QAAM,iBAAiB,CAAC,cAAc,4BAA4B,WAAW,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAShF,mBAAmB,mBAAmB;AAEtC,MAAI,IAAI,SAAS,OAAO;AACtB,WAAO,eAAe,iEAAiE,MAAM;AAC/F,MAAI,IAAI,SAAS,kBAAkB;AACjC,WAAO,eAAe,iBAAiB,gCAAgC;AACzE,MAAI,IAAI,SAAS,eAAe;AAC9B,WAAO,eAAe,iBAAiB,gCAAgC;AACzE,MAAI,IAAI,SAAS,iBAAiB;AAChC,WAAO,eAAe,iBAAiB,iCAAiC;AAE1E,UAAQ,WAAW;AAAA,IACjB,KAAK;AACH,aAAO,iBAAiB;AAAA;AAAA,EAAoE,mBAAmB,mBAAmB;AAAA,IACpI,KAAK;AACH,aAAO,iBAAiB;AAAA;AAAA,EAA2E,mBAAmB,aAAa,2BAA6B,EAAE,kBAAkB;AAAA,IACtL,KAAK;AACH,aAAO,qBAAqB;AAAA;AAAA,EAAmF,mBAAmB,mBAAmB;AAAA,IACvJ;AACE;AAAA,EACJ;AACF;","names":["Severity","ErrorVisibility","CopilotKitErrorCode"]}
1
+ {"version":3,"sources":["../../src/utils/errors.ts","../../package.json","../../src/index.ts"],"sourcesContent":["import { GraphQLError } from \"graphql\";\nimport { COPILOTKIT_VERSION } from \"../index\";\n\nexport enum Severity {\n CRITICAL = \"critical\", // Critical errors that block core functionality\n WARNING = \"warning\", // Configuration/setup issues that need attention\n INFO = \"info\", // General errors and network issues\n}\n\nexport enum ErrorVisibility {\n BANNER = \"banner\", // Critical errors shown as fixed banners\n TOAST = \"toast\", // Regular errors shown as dismissible toasts\n SILENT = \"silent\", // Errors logged but not shown to user\n DEV_ONLY = \"dev_only\", // Errors only shown in development mode\n}\n\nexport const ERROR_NAMES = {\n COPILOT_ERROR: \"CopilotError\",\n COPILOT_API_DISCOVERY_ERROR: \"CopilotApiDiscoveryError\",\n COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR: \"CopilotKitRemoteEndpointDiscoveryError\",\n COPILOT_KIT_AGENT_DISCOVERY_ERROR: \"CopilotKitAgentDiscoveryError\",\n COPILOT_KIT_LOW_LEVEL_ERROR: \"CopilotKitLowLevelError\",\n COPILOT_KIT_VERSION_MISMATCH_ERROR: \"CopilotKitVersionMismatchError\",\n RESOLVED_COPILOT_KIT_ERROR: \"ResolvedCopilotKitError\",\n CONFIGURATION_ERROR: \"ConfigurationError\",\n MISSING_PUBLIC_API_KEY_ERROR: \"MissingPublicApiKeyError\",\n UPGRADE_REQUIRED_ERROR: \"UpgradeRequiredError\",\n} as const;\n\n// Banner errors - critical configuration/discovery issues\nexport const BANNER_ERROR_NAMES = [\n ERROR_NAMES.CONFIGURATION_ERROR,\n ERROR_NAMES.MISSING_PUBLIC_API_KEY_ERROR,\n ERROR_NAMES.UPGRADE_REQUIRED_ERROR,\n ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR,\n ERROR_NAMES.COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR,\n ERROR_NAMES.COPILOT_KIT_AGENT_DISCOVERY_ERROR,\n];\n\n// Legacy cloud error names for backward compatibility\nexport const COPILOT_CLOUD_ERROR_NAMES = BANNER_ERROR_NAMES;\n\nexport enum CopilotKitErrorCode {\n NETWORK_ERROR = \"NETWORK_ERROR\",\n NOT_FOUND = \"NOT_FOUND\",\n AGENT_NOT_FOUND = \"AGENT_NOT_FOUND\",\n API_NOT_FOUND = \"API_NOT_FOUND\",\n REMOTE_ENDPOINT_NOT_FOUND = \"REMOTE_ENDPOINT_NOT_FOUND\",\n AUTHENTICATION_ERROR = \"AUTHENTICATION_ERROR\",\n MISUSE = \"MISUSE\",\n UNKNOWN = \"UNKNOWN\",\n VERSION_MISMATCH = \"VERSION_MISMATCH\",\n CONFIGURATION_ERROR = \"CONFIGURATION_ERROR\",\n MISSING_PUBLIC_API_KEY_ERROR = \"MISSING_PUBLIC_API_KEY_ERROR\",\n UPGRADE_REQUIRED_ERROR = \"UPGRADE_REQUIRED_ERROR\",\n}\n\nconst BASE_URL = \"https://docs.copilotkit.ai\";\n\nconst getSeeMoreMarkdown = (link: string) => `See more: [${link}](${link})`;\n\nexport const ERROR_CONFIG = {\n [CopilotKitErrorCode.NETWORK_ERROR]: {\n statusCode: 503,\n troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found`,\n visibility: ErrorVisibility.BANNER,\n severity: Severity.CRITICAL,\n },\n [CopilotKitErrorCode.NOT_FOUND]: {\n statusCode: 404,\n troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found`,\n visibility: ErrorVisibility.BANNER,\n severity: Severity.CRITICAL,\n },\n [CopilotKitErrorCode.AGENT_NOT_FOUND]: {\n statusCode: 500,\n troubleshootingUrl: `${BASE_URL}/coagents/troubleshooting/common-issues#i-am-getting-agent-not-found-error`,\n visibility: ErrorVisibility.BANNER,\n severity: Severity.CRITICAL,\n },\n [CopilotKitErrorCode.API_NOT_FOUND]: {\n statusCode: 404,\n troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found`,\n visibility: ErrorVisibility.BANNER,\n severity: Severity.CRITICAL,\n },\n [CopilotKitErrorCode.REMOTE_ENDPOINT_NOT_FOUND]: {\n statusCode: 404,\n troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-copilotkits-remote-endpoint-not-found-error`,\n visibility: ErrorVisibility.BANNER,\n severity: Severity.CRITICAL,\n },\n [CopilotKitErrorCode.AUTHENTICATION_ERROR]: {\n statusCode: 401,\n troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#authentication-errors`,\n visibility: ErrorVisibility.BANNER,\n severity: Severity.CRITICAL,\n },\n [CopilotKitErrorCode.MISUSE]: {\n statusCode: 400,\n troubleshootingUrl: null,\n visibility: ErrorVisibility.DEV_ONLY,\n severity: Severity.WARNING,\n },\n [CopilotKitErrorCode.UNKNOWN]: {\n statusCode: 500,\n visibility: ErrorVisibility.TOAST,\n severity: Severity.CRITICAL,\n },\n [CopilotKitErrorCode.CONFIGURATION_ERROR]: {\n statusCode: 400,\n troubleshootingUrl: null,\n severity: Severity.WARNING,\n visibility: ErrorVisibility.BANNER,\n },\n [CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR]: {\n statusCode: 400,\n troubleshootingUrl: null,\n severity: Severity.CRITICAL,\n visibility: ErrorVisibility.BANNER,\n },\n [CopilotKitErrorCode.UPGRADE_REQUIRED_ERROR]: {\n statusCode: 402,\n troubleshootingUrl: null,\n severity: Severity.WARNING,\n visibility: ErrorVisibility.BANNER,\n },\n [CopilotKitErrorCode.VERSION_MISMATCH]: {\n statusCode: 400,\n troubleshootingUrl: null,\n visibility: ErrorVisibility.DEV_ONLY,\n severity: Severity.INFO,\n },\n};\n\nexport class CopilotKitError extends GraphQLError {\n code: CopilotKitErrorCode;\n statusCode: number;\n severity?: Severity;\n visibility: ErrorVisibility;\n\n constructor({\n message = \"Unknown error occurred\",\n code,\n severity,\n visibility,\n }: {\n message?: string;\n code: CopilotKitErrorCode;\n severity?: Severity;\n visibility?: ErrorVisibility;\n }) {\n const name = ERROR_NAMES.COPILOT_ERROR;\n const config = ERROR_CONFIG[code];\n const { statusCode } = config;\n const resolvedVisibility = visibility ?? config.visibility ?? ErrorVisibility.TOAST;\n const resolvedSeverity = severity ?? (\"severity\" in config ? config.severity : undefined);\n\n super(message, {\n extensions: {\n name,\n statusCode,\n code,\n visibility: resolvedVisibility,\n severity: resolvedSeverity,\n troubleshootingUrl: \"troubleshootingUrl\" in config ? config.troubleshootingUrl : null,\n originalError: {\n message,\n stack: new Error().stack,\n },\n },\n });\n\n this.code = code;\n this.name = name;\n this.statusCode = statusCode;\n this.severity = resolvedSeverity;\n this.visibility = resolvedVisibility;\n }\n}\n\n/**\n * Error thrown when we can identify wrong usage of our components.\n * This helps us notify the developer before real errors can happen\n *\n * @extends CopilotKitError\n */\nexport class CopilotKitMisuseError extends CopilotKitError {\n constructor({\n message,\n code = CopilotKitErrorCode.MISUSE,\n }: {\n message: string;\n code?: CopilotKitErrorCode;\n }) {\n const docsLink =\n \"troubleshootingUrl\" in ERROR_CONFIG[code] && ERROR_CONFIG[code].troubleshootingUrl\n ? getSeeMoreMarkdown(ERROR_CONFIG[code].troubleshootingUrl as string)\n : null;\n const finalMessage = docsLink ? `${message}.\\n\\n${docsLink}` : message;\n super({ message: finalMessage, code });\n this.name = ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR;\n }\n}\n\nconst getVersionMismatchErrorMessage = ({\n reactCoreVersion,\n runtimeVersion,\n runtimeClientGqlVersion,\n}: VersionMismatchResponse) =>\n `Version mismatch detected: @copilotkit/runtime@${runtimeVersion ?? \"\"} is not compatible with @copilotkit/react-core@${reactCoreVersion} and @copilotkit/runtime-client-gql@${runtimeClientGqlVersion}. Please ensure all installed copilotkit packages are on the same version.`;\n/**\n * Error thrown when CPK versions does not match\n *\n * @extends CopilotKitError\n */\nexport class CopilotKitVersionMismatchError extends CopilotKitError {\n constructor({\n reactCoreVersion,\n runtimeVersion,\n runtimeClientGqlVersion,\n }: VersionMismatchResponse) {\n const code = CopilotKitErrorCode.VERSION_MISMATCH;\n super({\n message: getVersionMismatchErrorMessage({\n reactCoreVersion,\n runtimeVersion,\n runtimeClientGqlVersion,\n }),\n code,\n });\n this.name = ERROR_NAMES.COPILOT_KIT_VERSION_MISMATCH_ERROR;\n }\n}\n\n/**\n * Error thrown when the CopilotKit API endpoint cannot be discovered or accessed.\n * This typically occurs when:\n * - The API endpoint URL is invalid or misconfigured\n * - The API service is not running at the expected location\n * - There are network/firewall issues preventing access\n *\n * @extends CopilotKitError\n */\nexport class CopilotKitApiDiscoveryError extends CopilotKitError {\n constructor(\n params: {\n message?: string;\n code?: CopilotKitErrorCode.API_NOT_FOUND | CopilotKitErrorCode.REMOTE_ENDPOINT_NOT_FOUND;\n url?: string;\n } = {},\n ) {\n const url = params.url ?? \"\";\n let operationSuffix = \"\";\n if (url?.includes(\"/info\")) operationSuffix = `when fetching CopilotKit info`;\n else if (url.includes(\"/actions/execute\"))\n operationSuffix = `when attempting to execute actions.`;\n else if (url.includes(\"/agents/state\")) operationSuffix = `when attempting to get agent state.`;\n else if (url.includes(\"/agents/execute\"))\n operationSuffix = `when attempting to execute agent(s).`;\n const message =\n params.message ??\n (params.url\n ? `Failed to find CopilotKit API endpoint at url ${params.url} ${operationSuffix}`\n : `Failed to find CopilotKit API endpoint.`);\n const code = params.code ?? CopilotKitErrorCode.API_NOT_FOUND;\n const errorMessage = `${message}.\\n\\n${getSeeMoreMarkdown(ERROR_CONFIG[code].troubleshootingUrl)}`;\n super({ message: errorMessage, code });\n this.name = ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR;\n }\n}\n\n/**\n * This error is used for endpoints specified in runtime's remote endpoints. If they cannot be contacted\n * This typically occurs when:\n * - The API endpoint URL is invalid or misconfigured\n * - The API service is not running at the expected location\n *\n * @extends CopilotKitApiDiscoveryError\n */\nexport class CopilotKitRemoteEndpointDiscoveryError extends CopilotKitApiDiscoveryError {\n constructor(params?: { message?: string; url?: string }) {\n const message =\n params?.message ??\n (params?.url\n ? `Failed to find or contact remote endpoint at url ${params.url}`\n : \"Failed to find or contact remote endpoint\");\n const code = CopilotKitErrorCode.REMOTE_ENDPOINT_NOT_FOUND;\n super({ message, code });\n this.name = ERROR_NAMES.COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR;\n }\n}\n\n/**\n * Error thrown when a LangGraph agent cannot be found or accessed.\n * This typically occurs when:\n * - The specified agent name does not exist in the deployment\n * - The agent configuration is invalid or missing\n * - The agent service is not properly deployed or initialized\n *\n * @extends CopilotKitError\n */\nexport class CopilotKitAgentDiscoveryError extends CopilotKitError {\n constructor(params: { agentName?: string; availableAgents: { name: string; id: string }[] }) {\n const { agentName, availableAgents } = params;\n const code = CopilotKitErrorCode.AGENT_NOT_FOUND;\n\n const seeMore = getSeeMoreMarkdown(ERROR_CONFIG[code].troubleshootingUrl);\n let message;\n\n if (availableAgents.length) {\n const agentList = availableAgents.map((agent) => agent.name).join(\", \");\n\n if (agentName) {\n message = `Agent '${agentName}' was not found. Available agents are: ${agentList}. Please verify the agent name in your configuration and ensure it matches one of the available agents.\\n\\n${seeMore}`;\n } else {\n message = `The requested agent was not found. Available agents are: ${agentList}. Please verify the agent name in your configuration and ensure it matches one of the available agents.\\n\\n${seeMore}`;\n }\n } else {\n message = `${agentName ? `Agent '${agentName}'` : \"The requested agent\"} was not found. Please set up at least one agent before proceeding. ${seeMore}`;\n }\n\n super({ message, code });\n this.name = ERROR_NAMES.COPILOT_KIT_AGENT_DISCOVERY_ERROR;\n }\n}\n\n/**\n * Handles low-level networking errors that occur before a request reaches the server.\n * These errors arise from issues in the underlying communication infrastructure rather than\n * application-level logic or server responses. Typically used to handle \"fetch failed\" errors\n * where no HTTP status code is available.\n *\n * Common scenarios include:\n * - Connection failures (ECONNREFUSED) when server is down/unreachable\n * - DNS resolution failures (ENOTFOUND) when domain can't be resolved\n * - Timeouts (ETIMEDOUT) when request takes too long\n * - Protocol/transport layer errors like SSL/TLS issues\n */\nexport class CopilotKitLowLevelError extends CopilotKitError {\n constructor({ error, url, message }: { error: Error; url: string; message?: string }) {\n let code = CopilotKitErrorCode.NETWORK_ERROR;\n\n // @ts-expect-error -- code may exist\n const errorCode = error.code as string;\n const errorMessage = message ?? resolveLowLevelErrorMessage({ errorCode, url });\n\n super({ message: errorMessage, code });\n\n this.name = ERROR_NAMES.COPILOT_KIT_LOW_LEVEL_ERROR;\n }\n}\n\n/**\n * Generic catch-all error handler for HTTP responses from the CopilotKit API where a status code is available.\n * Used when we receive an HTTP error status and wish to handle broad range of them\n *\n * This differs from CopilotKitLowLevelError in that:\n * - ResolvedCopilotKitError: Server was reached and returned an HTTP status\n * - CopilotKitLowLevelError: Error occurred before reaching server (e.g. network failure)\n *\n * @param status - The HTTP status code received from the API response\n * @param message - Optional error message to include\n * @param code - Optional specific CopilotKitErrorCode to override default behavior\n *\n * Default behavior:\n * - 400 Bad Request: Maps to CopilotKitApiDiscoveryError\n * - All other status codes: Maps to UNKNOWN error code if no specific code provided\n */\nexport class ResolvedCopilotKitError extends CopilotKitError {\n constructor({\n status,\n message,\n code,\n isRemoteEndpoint,\n url,\n }: {\n status: number;\n message?: string;\n code?: CopilotKitErrorCode;\n isRemoteEndpoint?: boolean;\n url?: string;\n }) {\n let resolvedCode = code;\n if (!resolvedCode) {\n switch (status) {\n case 400:\n throw new CopilotKitApiDiscoveryError({ message, url });\n case 404:\n throw isRemoteEndpoint\n ? new CopilotKitRemoteEndpointDiscoveryError({ message, url })\n : new CopilotKitApiDiscoveryError({ message, url });\n default:\n resolvedCode = CopilotKitErrorCode.UNKNOWN;\n break;\n }\n }\n\n super({ message, code: resolvedCode });\n this.name = ERROR_NAMES.RESOLVED_COPILOT_KIT_ERROR;\n }\n}\n\nexport class ConfigurationError extends CopilotKitError {\n constructor(message: string) {\n super({ message, code: CopilotKitErrorCode.CONFIGURATION_ERROR });\n this.name = ERROR_NAMES.CONFIGURATION_ERROR;\n this.severity = Severity.WARNING;\n }\n}\n\nexport class MissingPublicApiKeyError extends ConfigurationError {\n constructor(message: string) {\n super(message);\n this.name = ERROR_NAMES.MISSING_PUBLIC_API_KEY_ERROR;\n this.severity = Severity.CRITICAL;\n }\n}\n\nexport class UpgradeRequiredError extends ConfigurationError {\n constructor(message: string) {\n super(message);\n this.name = ERROR_NAMES.UPGRADE_REQUIRED_ERROR;\n this.severity = Severity.WARNING;\n }\n}\n\n/**\n * Checks if an error is already a structured CopilotKit error.\n * This utility centralizes the logic for detecting structured errors across the codebase.\n *\n * @param error - The error to check\n * @returns true if the error is already structured, false otherwise\n */\nexport function isStructuredCopilotKitError(error: any): boolean {\n return (\n error instanceof CopilotKitError ||\n error instanceof CopilotKitLowLevelError ||\n (error?.name && error.name.includes(\"CopilotKit\")) ||\n error?.extensions?.code !== undefined // Check if it has our structured error properties\n );\n}\n\n/**\n * Returns the error as-is if it's already structured, otherwise converts it using the provided converter function.\n * This utility centralizes the pattern of preserving structured errors while converting unstructured ones.\n *\n * @param error - The error to process\n * @param converter - Function to convert unstructured errors to structured ones\n * @returns The structured error\n */\nexport function ensureStructuredError<T extends CopilotKitError>(\n error: any,\n converter: (error: any) => T,\n): T | any {\n return isStructuredCopilotKitError(error) ? error : converter(error);\n}\n\ninterface VersionMismatchResponse {\n runtimeVersion?: string;\n runtimeClientGqlVersion: string;\n reactCoreVersion: string;\n}\n\nexport async function getPossibleVersionMismatch({\n runtimeVersion,\n runtimeClientGqlVersion,\n}: {\n runtimeVersion?: string;\n runtimeClientGqlVersion: string;\n}) {\n if (!runtimeVersion || runtimeVersion === \"\" || !runtimeClientGqlVersion) return;\n if (\n COPILOTKIT_VERSION !== runtimeVersion ||\n COPILOTKIT_VERSION !== runtimeClientGqlVersion ||\n runtimeVersion !== runtimeClientGqlVersion\n ) {\n return {\n runtimeVersion,\n runtimeClientGqlVersion,\n reactCoreVersion: COPILOTKIT_VERSION,\n message: getVersionMismatchErrorMessage({\n runtimeVersion,\n runtimeClientGqlVersion,\n reactCoreVersion: COPILOTKIT_VERSION,\n }),\n };\n }\n\n return;\n}\n\nconst resolveLowLevelErrorMessage = ({ errorCode, url }: { errorCode?: string; url: string }) => {\n const troubleshootingLink = ERROR_CONFIG[CopilotKitErrorCode.NETWORK_ERROR].troubleshootingUrl;\n const genericMessage = (description = `Failed to fetch from url ${url}.`) => `${description}.\n\nPossible reasons:\n- -The server may have an error preventing it from returning a response (Check the server logs for more info).\n- -The server might be down or unreachable\n- -There might be a network issue (e.g., DNS failure, connection timeout) \n- -The URL might be incorrect\n- -The server is not running on the specified port\n\n${getSeeMoreMarkdown(troubleshootingLink)}`;\n\n if (url.includes(\"/info\"))\n return genericMessage(`Failed to fetch CopilotKit agents/action information from url ${url}.`);\n if (url.includes(\"/actions/execute\"))\n return genericMessage(`Fetch call to ${url} to execute actions failed.`);\n if (url.includes(\"/agents/state\"))\n return genericMessage(`Fetch call to ${url} to get agent state failed.`);\n if (url.includes(\"/agents/execute\"))\n return genericMessage(`Fetch call to ${url} to execute agent(s) failed.`);\n\n switch (errorCode) {\n case \"ECONNREFUSED\":\n return `Connection to ${url} was refused. Ensure the server is running and accessible.\\n\\n${getSeeMoreMarkdown(troubleshootingLink)}`;\n case \"ENOTFOUND\":\n return `The server on ${url} could not be found. Check the URL or your network configuration.\\n\\n${getSeeMoreMarkdown(ERROR_CONFIG[CopilotKitErrorCode.NOT_FOUND].troubleshootingUrl)}`;\n case \"ETIMEDOUT\":\n return `The connection to ${url} timed out. The server might be overloaded or taking too long to respond.\\n\\n${getSeeMoreMarkdown(troubleshootingLink)}`;\n default:\n return;\n }\n};\n","{\n \"name\": \"@copilotkit/shared\",\n \"private\": false,\n \"homepage\": \"https://github.com/CopilotKit/CopilotKit\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/CopilotKit/CopilotKit.git\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"version\": \"1.10.0-next.5\",\n \"sideEffects\": false,\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\"\n }\n },\n \"types\": \"./dist/index.d.ts\",\n \"license\": \"MIT\",\n \"scripts\": {\n \"build\": \"tsup --clean\",\n \"dev\": \"tsup --watch --no-splitting\",\n \"test\": \"jest --passWithNoTests\",\n \"check-types\": \"tsc --noEmit\",\n \"clean\": \"rm -rf .turbo && rm -rf node_modules && rm -rf dist && rm -rf .next\",\n \"link:global\": \"pnpm link --global\",\n \"unlink:global\": \"pnpm unlink --global\"\n },\n \"devDependencies\": {\n \"@types/jest\": \"^29.5.4\",\n \"@types/uuid\": \"^10.0.0\",\n \"eslint\": \"^8.56.0\",\n \"eslint-config-custom\": \"workspace:*\",\n \"jest\": \"^29.6.4\",\n \"ts-jest\": \"^29.1.1\",\n \"tsconfig\": \"workspace:*\",\n \"tsup\": \"^6.7.0\",\n \"typescript\": \"^5.2.3\"\n },\n \"dependencies\": {\n \"@ag-ui/core\": \"^0.0.30\",\n \"@segment/analytics-node\": \"^2.1.2\",\n \"chalk\": \"4.1.2\",\n \"graphql\": \"^16.8.1\",\n \"uuid\": \"^10.0.0\",\n \"zod\": \"^3.23.3\",\n \"zod-to-json-schema\": \"^3.23.5\"\n },\n \"keywords\": [\n \"copilotkit\",\n \"copilot\",\n \"react\",\n \"nextjs\",\n \"nodejs\",\n \"ai\",\n \"assistant\",\n \"javascript\",\n \"automation\",\n \"textarea\"\n ]\n}\n","export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\nexport * from \"./telemetry\";\n\nimport * as packageJson from \"../package.json\";\nexport const COPILOTKIT_VERSION = packageJson.version;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA6B;;;ACW3B,cAAW;;;ACLN,IAAM,qBAAiC;;;AFHvC,IAAK,WAAL,kBAAKA,cAAL;AACL,EAAAA,UAAA,cAAW;AACX,EAAAA,UAAA,aAAU;AACV,EAAAA,UAAA,UAAO;AAHG,SAAAA;AAAA,GAAA;AAML,IAAK,kBAAL,kBAAKC,qBAAL;AACL,EAAAA,iBAAA,YAAS;AACT,EAAAA,iBAAA,WAAQ;AACR,EAAAA,iBAAA,YAAS;AACT,EAAAA,iBAAA,cAAW;AAJD,SAAAA;AAAA,GAAA;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BAAiB;AAAA;AAAA,EAAoE,mBAAmB,mBAAmB;AAAA,IACpI,KAAK;AACH,aAAO,iBAAiB;AAAA;AAAA,EAA2E,mBAAmB,aAAa,2BAA6B,EAAE,kBAAkB;AAAA,IACtL,KAAK;AACH,aAAO,qBAAqB;AAAA;AAAA,EAAmF,mBAAmB,mBAAmB;AAAA,IACvJ;AACE;AAAA,EACJ;AACF;","names":["Severity","ErrorVisibility","CopilotKitErrorCode"]}
@@ -20,7 +20,8 @@ import {
20
20
  ensureStructuredError,
21
21
  getPossibleVersionMismatch,
22
22
  isStructuredCopilotKitError
23
- } from "../chunk-DCBWR34Z.mjs";
23
+ } from "../chunk-US5LPX5F.mjs";
24
+ import "../chunk-UTYBH3TE.mjs";
24
25
  import "../chunk-2KQ6HEWZ.mjs";
25
26
  import "../chunk-VNNKZIFB.mjs";
26
27
  import "../chunk-N5EP5OD5.mjs";
@@ -33,8 +34,8 @@ import "../chunk-FCCOSO5L.mjs";
33
34
  import "../chunk-PL5WNHFZ.mjs";
34
35
  import "../chunk-GYZIHHE6.mjs";
35
36
  import "../chunk-P7STFMPO.mjs";
36
- import "../chunk-77XMRBK7.mjs";
37
- import "../chunk-H55CHWLX.mjs";
37
+ import "../chunk-RW3UTSZO.mjs";
38
+ import "../chunk-KW3365WI.mjs";
38
39
  import "../chunk-6QGXWNS5.mjs";
39
40
  export {
40
41
  BANNER_ERROR_NAMES,
@@ -1,4 +1,5 @@
1
1
  export { BaseCondition, ComparisonCondition, ComparisonRule, Condition, ExistenceCondition, ExistenceRule, LogicalCondition, LogicalRule, Rule, executeConditions } from './conditions.js';
2
+ export { ConsoleColors, ConsoleStyles, logCopilotKitPlatformMessage, logStyled, publicApiKeyRequired, styledConsole } from './console-styling.js';
2
3
  export { BANNER_ERROR_NAMES, COPILOT_CLOUD_ERROR_NAMES, ConfigurationError, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, MissingPublicApiKeyError, ResolvedCopilotKitError, Severity, UpgradeRequiredError, ensureStructuredError, getPossibleVersionMismatch, isStructuredCopilotKitError } from './errors.js';
3
4
  export { JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, jsonSchemaToActionParameters } from './json-schema.js';
4
5
  export { dataToUUID, isValidUUID, randomId, randomUUID } from './random-id.js';
@@ -23,6 +23,8 @@ __export(utils_exports, {
23
23
  BANNER_ERROR_NAMES: () => BANNER_ERROR_NAMES,
24
24
  COPILOT_CLOUD_ERROR_NAMES: () => COPILOT_CLOUD_ERROR_NAMES,
25
25
  ConfigurationError: () => ConfigurationError,
26
+ ConsoleColors: () => ConsoleColors,
27
+ ConsoleStyles: () => ConsoleStyles,
26
28
  CopilotKitAgentDiscoveryError: () => CopilotKitAgentDiscoveryError,
27
29
  CopilotKitApiDiscoveryError: () => CopilotKitApiDiscoveryError,
28
30
  CopilotKitError: () => CopilotKitError,
@@ -48,9 +50,13 @@ __export(utils_exports, {
48
50
  isStructuredCopilotKitError: () => isStructuredCopilotKitError,
49
51
  isValidUUID: () => isValidUUID,
50
52
  jsonSchemaToActionParameters: () => jsonSchemaToActionParameters,
53
+ logCopilotKitPlatformMessage: () => logCopilotKitPlatformMessage,
54
+ logStyled: () => logStyled,
51
55
  parseJson: () => parseJson,
56
+ publicApiKeyRequired: () => publicApiKeyRequired,
52
57
  randomId: () => randomId,
53
58
  randomUUID: () => randomUUID,
59
+ styledConsole: () => styledConsole,
54
60
  tryMap: () => tryMap
55
61
  });
56
62
  module.exports = __toCommonJS(utils_exports);
@@ -101,11 +107,90 @@ function getValueFromPath(obj, path) {
101
107
  return path.split(".").reduce((acc, part) => acc == null ? void 0 : acc[part], obj);
102
108
  }
103
109
 
110
+ // src/utils/console-styling.ts
111
+ var ConsoleColors = {
112
+ /** Primary brand blue - for titles and links */
113
+ primary: "#007acc",
114
+ /** Success green - for positive messaging */
115
+ success: "#22c55e",
116
+ /** Purple - for feature highlights */
117
+ feature: "#a855f7",
118
+ /** Red - for calls-to-action */
119
+ cta: "#ef4444",
120
+ /** Cyan - for closing statements */
121
+ info: "#06b6d4",
122
+ /** Inherit console default - for body text */
123
+ inherit: "inherit",
124
+ /** Warning style */
125
+ warning: "#f59e0b"
126
+ };
127
+ var ConsoleStyles = {
128
+ /** Large header style */
129
+ header: `color: ${ConsoleColors.warning}; font-weight: bold; font-size: 16px;`,
130
+ /** Section header style */
131
+ section: `color: ${ConsoleColors.success}; font-weight: bold;`,
132
+ /** Feature highlight style */
133
+ highlight: `color: ${ConsoleColors.feature}; font-weight: bold;`,
134
+ /** Call-to-action style */
135
+ cta: `color: ${ConsoleColors.success}; font-weight: bold;`,
136
+ /** Info style */
137
+ info: `color: ${ConsoleColors.info}; font-weight: bold;`,
138
+ /** Link style */
139
+ link: `color: ${ConsoleColors.primary}; text-decoration: underline;`,
140
+ /** Body text - inherits console theme */
141
+ body: `color: ${ConsoleColors.inherit};`,
142
+ /** Warning style */
143
+ warning: `color: ${ConsoleColors.cta}; font-weight: bold;`
144
+ };
145
+ function logCopilotKitPlatformMessage() {
146
+ console.log(
147
+ `%cCopilotKit Warning%c
148
+
149
+ As of version 1.10.0, useCopilotChat has gained full compatibility with CopilotKit's newly released Headless UI feature set. %cAdd your CopilotKit API key, available for free at cloud.copilotkit.ai, to enable these features.%c
150
+
151
+ Alternatively, useCopilotChatLight is available for basic programmatic messaging, and does not require an API key. The differences between useCopilotChat and useCopilotChatLight are documented here: %chttps://docs.copilotkit.ai/reference/hooks/useCopilotChatLight%c`,
152
+ ConsoleStyles.header,
153
+ ConsoleStyles.body,
154
+ ConsoleStyles.cta,
155
+ ConsoleStyles.body,
156
+ ConsoleStyles.link,
157
+ ConsoleStyles.body
158
+ );
159
+ }
160
+ function publicApiKeyRequired(feature) {
161
+ console.log(
162
+ `
163
+ %cCopilotKit Warning%c
164
+
165
+ In order to use ${feature}, you need to add your CopilotKit API key, available for free at https://cloud.copilotkit.ai.
166
+ `.trim(),
167
+ ConsoleStyles.header,
168
+ ConsoleStyles.body
169
+ );
170
+ }
171
+ function logStyled(template, styles) {
172
+ console.log(template, ...styles);
173
+ }
174
+ var styledConsole = {
175
+ /** Log a success message */
176
+ success: (message) => logStyled(`%c\u2705 ${message}`, [ConsoleStyles.section]),
177
+ /** Log an info message */
178
+ info: (message) => logStyled(`%c\u2139\uFE0F ${message}`, [ConsoleStyles.info]),
179
+ /** Log a feature highlight */
180
+ feature: (message) => logStyled(`%c\u2728 ${message}`, [ConsoleStyles.highlight]),
181
+ /** Log a call-to-action */
182
+ cta: (message) => logStyled(`%c\u{1F680} ${message}`, [ConsoleStyles.cta]),
183
+ /** Log the CopilotKit platform promotion */
184
+ logCopilotKitPlatformMessage,
185
+ /** Log a `publicApiKeyRequired` warning */
186
+ publicApiKeyRequired
187
+ };
188
+
104
189
  // src/utils/errors.ts
105
190
  var import_graphql = require("graphql");
106
191
 
107
192
  // package.json
108
- var version = "1.10.0-next.3";
193
+ var version = "1.10.0-next.5";
109
194
 
110
195
  // src/index.ts
111
196
  var COPILOTKIT_VERSION = version;
@@ -707,6 +792,8 @@ function isMacOS() {
707
792
  BANNER_ERROR_NAMES,
708
793
  COPILOT_CLOUD_ERROR_NAMES,
709
794
  ConfigurationError,
795
+ ConsoleColors,
796
+ ConsoleStyles,
710
797
  CopilotKitAgentDiscoveryError,
711
798
  CopilotKitApiDiscoveryError,
712
799
  CopilotKitError,
@@ -732,9 +819,13 @@ function isMacOS() {
732
819
  isStructuredCopilotKitError,
733
820
  isValidUUID,
734
821
  jsonSchemaToActionParameters,
822
+ logCopilotKitPlatformMessage,
823
+ logStyled,
735
824
  parseJson,
825
+ publicApiKeyRequired,
736
826
  randomId,
737
827
  randomUUID,
828
+ styledConsole,
738
829
  tryMap
739
830
  });
740
831
  //# sourceMappingURL=index.js.map