@copilotkit/react-core 1.55.0-next.9 → 1.55.1-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 (81) hide show
  1. package/CHANGELOG.md +46 -6
  2. package/dist/{copilotkit-DeOzjPsb.mjs → copilotkit-BY5S1-0P.mjs} +2402 -552
  3. package/dist/copilotkit-BY5S1-0P.mjs.map +1 -0
  4. package/dist/{copilotkit-BqcyhQjT.d.mts → copilotkit-BuhSUZHb.d.mts} +228 -17
  5. package/dist/copilotkit-BuhSUZHb.d.mts.map +1 -0
  6. package/dist/{copilotkit-BDNjFNmk.cjs → copilotkit-Bz5-ImDl.cjs} +2421 -541
  7. package/dist/copilotkit-Bz5-ImDl.cjs.map +1 -0
  8. package/dist/{copilotkit-l-IBF4Xp.d.cts → copilotkit-dwDWYpya.d.cts} +228 -17
  9. package/dist/copilotkit-dwDWYpya.d.cts.map +1 -0
  10. package/dist/index.cjs +1 -1
  11. package/dist/index.d.cts +1 -1
  12. package/dist/index.d.mts +1 -1
  13. package/dist/index.mjs +1 -1
  14. package/dist/index.umd.js +1400 -238
  15. package/dist/index.umd.js.map +1 -1
  16. package/dist/v2/index.cjs +13 -1
  17. package/dist/v2/index.css +1 -1
  18. package/dist/v2/index.d.cts +3 -3
  19. package/dist/v2/index.d.mts +3 -3
  20. package/dist/v2/index.mjs +3 -2
  21. package/dist/v2/index.umd.js +2442 -552
  22. package/dist/v2/index.umd.js.map +1 -1
  23. package/package.json +62 -54
  24. package/scripts/scope-preflight.mjs +1 -2
  25. package/src/components/CopilotListeners.tsx +41 -8
  26. package/src/components/copilot-provider/copilotkit-props.tsx +4 -2
  27. package/src/components/toast/toast-provider.tsx +269 -194
  28. package/src/v2/__tests__/A2UIMessageRenderer.test.tsx +86 -22
  29. package/src/v2/__tests__/utils/test-helpers.tsx +67 -0
  30. package/src/v2/a2ui/A2UICatalogContext.tsx +79 -0
  31. package/src/v2/a2ui/A2UIMessageRenderer.tsx +125 -37
  32. package/src/v2/a2ui/A2UIToolCallRenderer.tsx +290 -0
  33. package/src/v2/components/CopilotKitInspector.tsx +2 -0
  34. package/src/v2/components/OpenGenerativeUIRenderer.tsx +598 -0
  35. package/src/v2/components/__tests__/OpenGenerativeUIRenderer.test.tsx +665 -0
  36. package/src/v2/components/chat/CopilotChat.tsx +193 -50
  37. package/src/v2/components/chat/CopilotChatAssistantMessage.tsx +17 -2
  38. package/src/v2/components/chat/CopilotChatAttachmentQueue.tsx +481 -0
  39. package/src/v2/components/chat/CopilotChatAttachmentRenderer.tsx +139 -0
  40. package/src/v2/components/chat/CopilotChatInput.tsx +146 -77
  41. package/src/v2/components/chat/CopilotChatMessageView.tsx +253 -149
  42. package/src/v2/components/chat/CopilotChatSuggestionView.tsx +1 -0
  43. package/src/v2/components/chat/CopilotChatUserMessage.tsx +54 -0
  44. package/src/v2/components/chat/CopilotChatView.tsx +179 -66
  45. package/src/v2/components/chat/__tests__/CopilotChat.attachments.test.tsx +168 -0
  46. package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.tsx +63 -2
  47. package/src/v2/components/chat/__tests__/CopilotChatInput.test.tsx +544 -1
  48. package/src/v2/components/chat/__tests__/CopilotChatPerf.e2e.test.tsx +268 -0
  49. package/src/v2/components/chat/__tests__/CopilotChatPropsRerender.e2e.test.tsx +249 -0
  50. package/src/v2/components/chat/__tests__/MCPAppsActivityRenderer.e2e.test.tsx +43 -2
  51. package/src/v2/components/chat/__tests__/copilot-chat-throttle.test.tsx +138 -0
  52. package/src/v2/components/chat/index.ts +9 -0
  53. package/src/v2/components/chat/scroll-element-context.ts +13 -0
  54. package/src/v2/hooks/__tests__/use-agent-throttle.test.tsx +1003 -0
  55. package/src/v2/hooks/__tests__/use-attachments.test.tsx +169 -0
  56. package/src/v2/hooks/__tests__/use-threads.test.tsx +54 -0
  57. package/src/v2/hooks/index.ts +5 -0
  58. package/src/v2/hooks/use-agent.tsx +95 -10
  59. package/src/v2/hooks/use-attachments.tsx +269 -0
  60. package/src/v2/hooks/use-frontend-tool.tsx +5 -2
  61. package/src/v2/hooks/use-render-activity-message.tsx +9 -2
  62. package/src/v2/hooks/use-threads.tsx +35 -15
  63. package/src/v2/index.ts +5 -1
  64. package/src/v2/lib/__tests__/processPartialHtml.test.ts +112 -0
  65. package/src/v2/lib/__tests__/slots.test.ts +56 -0
  66. package/src/v2/lib/processPartialHtml.ts +45 -0
  67. package/src/v2/lib/slots.tsx +42 -1
  68. package/src/v2/providers/CopilotChatConfigurationProvider.tsx +9 -3
  69. package/src/v2/providers/CopilotKitProvider.tsx +268 -32
  70. package/src/v2/providers/SandboxFunctionsContext.ts +10 -0
  71. package/src/v2/providers/__tests__/CopilotKitProvider.sandboxFunctions.test.tsx +198 -0
  72. package/src/v2/providers/__tests__/CopilotKitProvider.test.tsx +71 -0
  73. package/src/v2/providers/index.ts +7 -0
  74. package/src/v2/styles/globals.css +2 -1
  75. package/src/v2/types/index.ts +1 -0
  76. package/src/v2/types/sandbox-function.ts +11 -0
  77. package/dist/copilotkit-BDNjFNmk.cjs.map +0 -1
  78. package/dist/copilotkit-BqcyhQjT.d.mts.map +0 -1
  79. package/dist/copilotkit-DeOzjPsb.mjs.map +0 -1
  80. package/dist/copilotkit-l-IBF4Xp.d.cts.map +0 -1
  81. package/src/v2/components/__tests__/license-warning-banner.test.tsx +0 -46
package/package.json CHANGED
@@ -1,21 +1,41 @@
1
1
  {
2
2
  "name": "@copilotkit/react-core",
3
+ "version": "1.55.1-next.0",
3
4
  "private": false,
5
+ "keywords": [
6
+ "ai",
7
+ "assistant",
8
+ "automation",
9
+ "copilot",
10
+ "copilotkit",
11
+ "javascript",
12
+ "nextjs",
13
+ "nodejs",
14
+ "react",
15
+ "textarea"
16
+ ],
4
17
  "homepage": "https://github.com/CopilotKit/CopilotKit",
18
+ "license": "MIT",
5
19
  "repository": {
6
20
  "type": "git",
7
21
  "url": "https://github.com/CopilotKit/CopilotKit.git"
8
22
  },
9
23
  "type": "module",
10
- "publishConfig": {
11
- "access": "public"
12
- },
13
- "version": "1.55.0-next.9",
14
24
  "sideEffects": [
15
25
  "**/*.css"
16
26
  ],
17
27
  "main": "./dist/index.cjs",
18
28
  "module": "./dist/index.mjs",
29
+ "types": "./dist/index.d.cts",
30
+ "typesVersions": {
31
+ "*": {
32
+ "v2": [
33
+ "./dist/v2/index.d.cts"
34
+ ]
35
+ }
36
+ },
37
+ "unpkg": "./dist/index.umd.js",
38
+ "jsdelivr": "./dist/index.umd.js",
19
39
  "exports": {
20
40
  ".": {
21
41
  "import": "./dist/index.mjs",
@@ -28,28 +48,49 @@
28
48
  "./package.json": "./package.json",
29
49
  "./v2/styles.css": "./dist/v2/index.css"
30
50
  },
31
- "unpkg": "./dist/index.umd.js",
32
- "jsdelivr": "./dist/index.umd.js",
33
- "types": "./dist/index.d.cts",
34
- "license": "MIT",
35
- "peerDependencies": {
36
- "react": "^18 || ^19 || ^19.0.0-rc",
37
- "react-dom": "^18 || ^19 || ^19.0.0-rc",
38
- "zod": ">=3.0.0"
51
+ "publishConfig": {
52
+ "access": "public"
53
+ },
54
+ "dependencies": {
55
+ "@ag-ui/client": "0.0.52",
56
+ "@ag-ui/core": "0.0.52",
57
+ "@jetbrains/websandbox": "^1.1.3",
58
+ "@lit-labs/react": "^2.0.2",
59
+ "@radix-ui/react-dropdown-menu": "^2.1.15",
60
+ "@radix-ui/react-slot": "^1.2.3",
61
+ "@radix-ui/react-tooltip": "^1.2.7",
62
+ "@scarf/scarf": "^1.3.0",
63
+ "@tanstack/react-virtual": "^3.13.0",
64
+ "class-variance-authority": "^0.7.1",
65
+ "clsx": "^2.1.1",
66
+ "katex": "^0.16.22",
67
+ "lucide-react": "^0.525.0",
68
+ "react-markdown": "^8.0.7",
69
+ "rxjs": "7.8.1",
70
+ "streamdown": "^1.3.0",
71
+ "tailwind-merge": "^3.3.1",
72
+ "tw-animate-css": "^1.3.5",
73
+ "untruncate-json": "^0.0.1",
74
+ "use-stick-to-bottom": "^1.1.1",
75
+ "zod-to-json-schema": "^3.24.5",
76
+ "@copilotkit/a2ui-renderer": "1.55.1-next.0",
77
+ "@copilotkit/core": "1.55.1-next.0",
78
+ "@copilotkit/runtime-client-gql": "1.55.1-next.0",
79
+ "@copilotkit/shared": "1.55.1-next.0",
80
+ "@copilotkit/web-inspector": "1.55.1-next.0"
39
81
  },
40
82
  "devDependencies": {
41
83
  "@tailwindcss/cli": "^4.1.11",
42
84
  "@tailwindcss/postcss": "^4.1.11",
43
85
  "@tailwindcss/typography": "^0.5.16",
44
- "@valibot/to-json-schema": "^1.5.0",
45
- "tailwindcss": "^4.0.8",
46
86
  "@testing-library/jest-dom": "^6.0.0",
47
87
  "@testing-library/react": "^16.3.0",
48
88
  "@testing-library/react-hooks": "^8.0.1",
49
89
  "@testing-library/user-event": "^14.0.0",
50
- "arktype": "^2.1.29",
51
90
  "@types/react": "^19.1.0",
52
91
  "@types/react-dom": "^19.0.2",
92
+ "@valibot/to-json-schema": "^1.5.0",
93
+ "arktype": "^2.1.29",
53
94
  "autoprefixer": "^10.4.20",
54
95
  "concurrently": "^9.1.0",
55
96
  "eslint": "^8.56.0",
@@ -58,52 +99,19 @@
58
99
  "postcss": "^8.5.6",
59
100
  "react": "^19.1.0",
60
101
  "react-dom": "^19.2.0",
61
- "vitest": "^3.2.4",
102
+ "tailwindcss": "^4.0.8",
62
103
  "tsdown": "^0.20.3",
63
104
  "typescript": "^5.2.3",
64
105
  "valibot": "^1.2.0",
106
+ "vitest": "^3.2.4",
65
107
  "zod": ">=3.0.0",
66
- "eslint-config-custom": "1.4.12",
67
108
  "tsconfig": "1.4.12"
68
109
  },
69
- "dependencies": {
70
- "@ag-ui/client": "^0.0.48",
71
- "@ag-ui/core": "0.0.48",
72
- "@lit-labs/react": "^2.0.2",
73
- "@radix-ui/react-dropdown-menu": "^2.1.15",
74
- "@radix-ui/react-slot": "^1.2.3",
75
- "@radix-ui/react-tooltip": "^1.2.7",
76
- "@scarf/scarf": "^1.3.0",
77
- "class-variance-authority": "^0.7.1",
78
- "clsx": "^2.1.1",
79
- "katex": "^0.16.22",
80
- "lucide-react": "^0.525.0",
81
- "react-markdown": "^8.0.7",
82
- "streamdown": "^1.3.0",
83
- "tailwind-merge": "^3.3.1",
84
- "ts-deepmerge": "^7.0.3",
85
- "tw-animate-css": "^1.3.5",
86
- "untruncate-json": "^0.0.1",
87
- "use-stick-to-bottom": "^1.1.1",
88
- "rxjs": "7.8.1",
89
- "@copilotkit/a2ui-renderer": "1.55.0-next.9",
90
- "@copilotkit/core": "1.55.0-next.9",
91
- "@copilotkit/runtime-client-gql": "1.55.0-next.9",
92
- "@copilotkit/shared": "1.55.0-next.9",
93
- "@copilotkit/web-inspector": "1.55.0-next.9"
110
+ "peerDependencies": {
111
+ "react": "^18 || ^19 || ^19.0.0-rc",
112
+ "react-dom": "^18 || ^19 || ^19.0.0-rc",
113
+ "zod": ">=3.0.0"
94
114
  },
95
- "keywords": [
96
- "copilotkit",
97
- "copilot",
98
- "react",
99
- "nextjs",
100
- "nodejs",
101
- "ai",
102
- "assistant",
103
- "javascript",
104
- "automation",
105
- "textarea"
106
- ],
107
115
  "scripts": {
108
116
  "build:css": "tailwindcss -i ./src/v2/styles/globals.css -o ./dist/v2/index.css -m && node scripts/scope-preflight.mjs ./dist/v2/index.css",
109
117
  "build": "tsdown && pnpm run build:css",
@@ -19,8 +19,7 @@ if (!file) {
19
19
  /** Selectors that are already scoped and should be left alone. */
20
20
  function isAlreadyScoped(selector) {
21
21
  return (
22
- selector.includes("[data-copilot") ||
23
- selector.includes("[data-sidebar")
22
+ selector.includes("[data-copilot") || selector.includes("[data-sidebar")
24
23
  );
25
24
  }
26
25
 
@@ -72,14 +72,47 @@ export function CopilotListeners() {
72
72
 
73
73
  useEffect(() => {
74
74
  const subscriber: CopilotKitCoreSubscriber = {
75
- onError: ({ error }) => {
76
- setBannerError(
77
- new CopilotKitLowLevelError({
78
- error,
79
- message: error.message,
80
- url: typeof window !== "undefined" ? window.location.href : "",
81
- }),
82
- );
75
+ onError: ({ error, code, context }) => {
76
+ // Silently ignore abort errors (e.g. from navigation during active requests)
77
+ if (
78
+ error.name === "AbortError" ||
79
+ error.message === "Fetch is aborted" ||
80
+ error.message === "signal is aborted without reason" ||
81
+ error.message === "component unmounted" ||
82
+ !error.message
83
+ ) {
84
+ return;
85
+ }
86
+
87
+ // Always log full error details in development
88
+ if (process.env.NODE_ENV === "development") {
89
+ console.error(
90
+ "[CopilotKit] Agent error:",
91
+ error.message,
92
+ "\n Code:",
93
+ code,
94
+ "\n Context:",
95
+ context,
96
+ "\n Stack:",
97
+ error.stack,
98
+ );
99
+ }
100
+
101
+ const ckError = new CopilotKitLowLevelError({
102
+ error,
103
+ message: error.message,
104
+ url: typeof window !== "undefined" ? window.location.href : "",
105
+ });
106
+
107
+ // Attach original error details for the banner to display
108
+ (ckError as any).details = {
109
+ code,
110
+ context,
111
+ stack: error.stack,
112
+ originalMessage: error.message,
113
+ };
114
+
115
+ setBannerError(ckError);
83
116
  },
84
117
  };
85
118
  const subscription = copilotkit.subscribe(subscriber);
@@ -129,9 +129,11 @@ export interface CopilotKitProps extends Omit<
129
129
  credentials?: RequestCredentials;
130
130
 
131
131
  /**
132
- * Whether to show the dev console.
132
+ * Whether to show the dev console (error banners and toasts).
133
133
  *
134
- * Set to `true` to show error banners and toasts, `false` to hide all error UI.
134
+ * @deprecated Use `enableInspector` to control the AG-UI inspector,
135
+ * which is what most users want. `showDevConsole` only controls
136
+ * error toasts/banners, not the inspector button.
135
137
  * Defaults to `false` for production safety.
136
138
  */
137
139
  showDevConsole?: boolean;