@copilotkit/react-core 1.57.0 → 1.57.1-canary.1778272612

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 (86) hide show
  1. package/dist/{copilotkit-CPe2-340.mjs → copilotkit-3XTEoVQO.mjs} +1367 -1200
  2. package/dist/copilotkit-3XTEoVQO.mjs.map +1 -0
  3. package/dist/{copilotkit-DFaI4j2r.d.mts → copilotkit-BCJ2yvV6.d.mts} +68 -8
  4. package/dist/copilotkit-BCJ2yvV6.d.mts.map +1 -0
  5. package/dist/{copilotkit-Dg4r4Gi_.d.cts → copilotkit-CBbSvze0.d.cts} +68 -8
  6. package/dist/copilotkit-CBbSvze0.d.cts.map +1 -0
  7. package/dist/{copilotkit-DGbvw8n2.cjs → copilotkit-Dnj9pi4m.cjs} +1369 -1196
  8. package/dist/copilotkit-Dnj9pi4m.cjs.map +1 -0
  9. package/dist/index.cjs +2 -5
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +1 -1
  12. package/dist/index.d.mts +1 -1
  13. package/dist/index.mjs +2 -5
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/index.umd.js +733 -610
  16. package/dist/index.umd.js.map +1 -1
  17. package/dist/v2/context.cjs +135 -0
  18. package/dist/v2/context.cjs.map +1 -0
  19. package/dist/v2/context.d.cts +148 -0
  20. package/dist/v2/context.d.cts.map +1 -0
  21. package/dist/v2/context.d.mts +148 -0
  22. package/dist/v2/context.d.mts.map +1 -0
  23. package/dist/v2/context.mjs +129 -0
  24. package/dist/v2/context.mjs.map +1 -0
  25. package/dist/v2/headless.cjs +1043 -0
  26. package/dist/v2/headless.cjs.map +1 -0
  27. package/dist/v2/headless.d.cts +605 -0
  28. package/dist/v2/headless.d.cts.map +1 -0
  29. package/dist/v2/headless.d.mts +512 -0
  30. package/dist/v2/headless.d.mts.map +1 -0
  31. package/dist/v2/headless.mjs +997 -0
  32. package/dist/v2/headless.mjs.map +1 -0
  33. package/dist/v2/index.cjs +2 -1
  34. package/dist/v2/index.css +1 -1
  35. package/dist/v2/index.d.cts +2 -2
  36. package/dist/v2/index.d.mts +2 -2
  37. package/dist/v2/index.mjs +2 -2
  38. package/dist/v2/index.umd.js +1385 -1204
  39. package/dist/v2/index.umd.js.map +1 -1
  40. package/package.json +14 -6
  41. package/src/hooks/__tests__/use-copilot-chat-internal-connect.test.tsx +5 -6
  42. package/src/hooks/use-copilot-chat_internal.ts +0 -1
  43. package/src/v2/components/chat/CopilotChat.tsx +2 -1
  44. package/src/v2/components/chat/CopilotChatMessageView.tsx +24 -9
  45. package/src/v2/components/chat/CopilotChatView.tsx +2 -2
  46. package/src/v2/components/chat/CopilotSidebar.tsx +5 -1
  47. package/src/v2/components/chat/CopilotSidebarView.tsx +24 -10
  48. package/src/v2/components/chat/__tests__/CopilotChat.welcomeGate.test.tsx +1 -3
  49. package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.tsx +29 -25
  50. package/src/v2/components/chat/__tests__/CopilotSidebarView.position.test.tsx +159 -0
  51. package/src/v2/components/chat/__tests__/MCPAppsUiMessage.e2e.test.tsx +5 -60
  52. package/src/v2/components/index.ts +1 -0
  53. package/src/v2/components/intelligence-indicator/IntelligenceIndicator.tsx +286 -0
  54. package/src/v2/components/intelligence-indicator/__tests__/IntelligenceIndicator.e2e.test.tsx +464 -0
  55. package/src/v2/components/intelligence-indicator/index.ts +2 -0
  56. package/src/v2/context.ts +62 -0
  57. package/src/v2/headless.ts +42 -0
  58. package/src/v2/hooks/__tests__/standard-schema.test.tsx +2 -2
  59. package/src/v2/hooks/__tests__/use-agent-context.test.tsx +3 -3
  60. package/src/v2/hooks/__tests__/use-agent-stability.test.tsx +3 -3
  61. package/src/v2/hooks/__tests__/use-agent-throttle.test.tsx +85 -85
  62. package/src/v2/hooks/__tests__/use-interrupt.test.tsx +2 -2
  63. package/src/v2/hooks/__tests__/use-render-tool.test.tsx +2 -2
  64. package/src/v2/hooks/__tests__/use-threads.test.tsx +2 -2
  65. package/src/v2/hooks/__tests__/zod-regression.test.tsx +2 -2
  66. package/src/v2/hooks/use-agent-context.tsx +1 -1
  67. package/src/v2/hooks/use-agent.tsx +9 -118
  68. package/src/v2/hooks/use-configure-suggestions.tsx +1 -1
  69. package/src/v2/hooks/use-default-render-tool.tsx +18 -1
  70. package/src/v2/hooks/use-frontend-tool.tsx +2 -2
  71. package/src/v2/hooks/use-human-in-the-loop.tsx +1 -1
  72. package/src/v2/hooks/use-interrupt.tsx +1 -1
  73. package/src/v2/hooks/use-render-activity-message.tsx +3 -11
  74. package/src/v2/hooks/use-render-custom-messages.tsx +1 -6
  75. package/src/v2/hooks/use-render-tool-call.tsx +36 -6
  76. package/src/v2/hooks/use-render-tool.tsx +2 -2
  77. package/src/v2/hooks/use-suggestions.tsx +1 -1
  78. package/src/v2/hooks/use-threads.tsx +1 -1
  79. package/src/v2/providers/CopilotKitProvider.tsx +19 -59
  80. package/src/v2/styles/globals.css +118 -0
  81. package/tsdown.config.ts +75 -0
  82. package/dist/copilotkit-CPe2-340.mjs.map +0 -1
  83. package/dist/copilotkit-DFaI4j2r.d.mts.map +0 -1
  84. package/dist/copilotkit-DGbvw8n2.cjs.map +0 -1
  85. package/dist/copilotkit-Dg4r4Gi_.d.cts.map +0 -1
  86. package/src/v2/hooks/__tests__/use-agent-thread-isolation.test.tsx +0 -333
@@ -229,3 +229,121 @@
229
229
  background-repeat: no-repeat;
230
230
  background-size: 100% 100%;
231
231
  }
232
+ /*
233
+ * IntelligenceIndicator pill — visual styles ported from
234
+ * CopilotKit/Intelligence #155.
235
+ *
236
+ * Violet/indigo glassmorphism — text #5B21B6, icon #7C3AED, border
237
+ * #9599E0, gradient stop #EEE6FE, soft shadow #5E64AD.
238
+ */
239
+ .cpk-intelligence-pill {
240
+ display: inline-flex;
241
+ /* Opt out of the parent flex-column's default `align-items: stretch`
242
+ (the auto-mount lives inside `CopilotChatMessageView`'s
243
+ `cpk:flex cpk:flex-col` container). Without this the pill would
244
+ stretch to the full chat width even though `inline-flex` is
245
+ supposed to shrink to its content. */
246
+ align-self: flex-start;
247
+ align-items: center;
248
+ gap: 0.55rem;
249
+ margin: 0.4rem 0;
250
+ padding: 0.4rem 0.85rem;
251
+ border: 1px solid rgb(149 153 224 / 0.32);
252
+ border-radius: 999px;
253
+ background: linear-gradient(
254
+ 135deg,
255
+ rgb(255 255 255 / 0.55) 0%,
256
+ rgb(238 230 254 / 0.55) 100%
257
+ );
258
+ -webkit-backdrop-filter: blur(14px) saturate(160%);
259
+ backdrop-filter: blur(14px) saturate(160%);
260
+ color: rgb(91 33 182 / 0.92);
261
+ font-size: 0.78rem;
262
+ font-weight: 500;
263
+ letter-spacing: 0.01em;
264
+ white-space: nowrap;
265
+ box-shadow:
266
+ 0 1px 2px rgb(94 100 173 / 0.06),
267
+ 0 8px 24px rgb(149 153 224 / 0.08),
268
+ inset 0 1px 0 rgb(255 255 255 / 0.6);
269
+ opacity: 0;
270
+ transform: translateY(2px);
271
+ animation: cpk-intelligence-pill-fade-in 280ms ease-out forwards;
272
+ }
273
+
274
+ .cpk-intelligence-pill--fading {
275
+ /* Switching the `animation` property cancels the in-flight fade-in
276
+ and replaces the held final-value (opacity:1 from `forwards`) with
277
+ this fade-out keyframe set. Plain `opacity: 0` declarations would
278
+ otherwise lose to the animation's held value. */
279
+ animation: cpk-intelligence-pill-fade-out 480ms ease-out forwards;
280
+ pointer-events: none;
281
+ }
282
+
283
+ .cpk-intelligence-pill__icon {
284
+ display: block;
285
+ flex-shrink: 0;
286
+ color: rgb(124 58 237);
287
+ }
288
+
289
+ .cpk-intelligence-pill__ring {
290
+ stroke: currentColor;
291
+ stroke-dasharray: 40 16.55;
292
+ stroke-dashoffset: 0;
293
+ transform-origin: 12px 12px;
294
+ animation: cpk-intelligence-pill-spin 0.9s linear infinite;
295
+ transition: stroke-dasharray 320ms ease-out;
296
+ }
297
+
298
+ .cpk-intelligence-pill__ring--done {
299
+ stroke-dasharray: 56.55 0;
300
+ animation: none;
301
+ }
302
+
303
+ .cpk-intelligence-pill__check {
304
+ stroke: currentColor;
305
+ stroke-dasharray: 12;
306
+ stroke-dashoffset: 12;
307
+ /* Opacity zero hides the rounded `stroke-linecap` end-cap that would
308
+ otherwise leak through as a stationary dot at path end (16, 9.5)
309
+ during spinner phase. The `dasharray + dashoffset` zeroes the
310
+ visible stroke length, but the cap is drawn at the dash boundary
311
+ regardless, so we need opacity to fully hide it. */
312
+ opacity: 0;
313
+ transition:
314
+ stroke-dashoffset 320ms ease-out 200ms,
315
+ opacity 200ms ease-out 200ms;
316
+ }
317
+
318
+ .cpk-intelligence-pill__check--shown {
319
+ stroke-dashoffset: 0;
320
+ opacity: 1;
321
+ }
322
+
323
+ @keyframes cpk-intelligence-pill-fade-in {
324
+ from {
325
+ opacity: 0;
326
+ transform: translateY(2px);
327
+ }
328
+ to {
329
+ opacity: 1;
330
+ transform: translateY(0);
331
+ }
332
+ }
333
+
334
+ @keyframes cpk-intelligence-pill-fade-out {
335
+ from {
336
+ opacity: 1;
337
+ transform: translateY(0);
338
+ }
339
+ to {
340
+ opacity: 0;
341
+ transform: translateY(-2px);
342
+ }
343
+ }
344
+
345
+ @keyframes cpk-intelligence-pill-spin {
346
+ to {
347
+ transform: rotate(360deg);
348
+ }
349
+ }
package/tsdown.config.ts CHANGED
@@ -1,4 +1,10 @@
1
1
  import { defineConfig } from "tsdown";
2
+ import path from "path";
3
+
4
+ // Resolved path to src/v2/context.ts — used to redirect the headless build's
5
+ // relative ../context imports to the external @copilotkit/react-core/v2/context
6
+ // package path, ensuring a shared React context instance at runtime.
7
+ const contextModulePath = path.resolve(import.meta.dirname, "src/v2/context");
2
8
 
3
9
  export default defineConfig([
4
10
  {
@@ -21,10 +27,79 @@ export default defineConfig([
21
27
  exports: {
22
28
  customExports: (exports) => ({
23
29
  ...exports,
30
+ "./v2/context": {
31
+ import: "./dist/v2/context.mjs",
32
+ require: "./dist/v2/context.cjs",
33
+ },
34
+ "./v2/headless": {
35
+ import: "./dist/v2/headless.mjs",
36
+ require: "./dist/v2/headless.cjs",
37
+ },
24
38
  "./v2/styles.css": "./dist/v2/index.css",
25
39
  }),
26
40
  },
27
41
  },
42
+ // v2/context is built separately into dist/v2/ so it produces a standalone
43
+ // file instead of being absorbed into shared chunks.
44
+ {
45
+ entry: {
46
+ context: "src/v2/context.ts",
47
+ },
48
+ format: ["esm", "cjs"],
49
+ dts: true,
50
+ sourcemap: true,
51
+ target: "es2022",
52
+ outDir: "dist/v2",
53
+ external: ["react", "@copilotkit/core", "@copilotkit/shared"],
54
+ },
55
+ // v2/headless: platform-agnostic hooks + CopilotKitCoreReact, used by
56
+ // @copilotkit/react-native. All @copilotkit/* deps are external — they
57
+ // contain no Node-only code that would break Metro. Keeping them external
58
+ // (rather than inlining) ensures the CopilotKitCoreReact class is the same
59
+ // nominal type as the one in v2/context, avoiding unsafe `as unknown as` casts.
60
+ {
61
+ entry: {
62
+ headless: "src/v2/headless.ts",
63
+ },
64
+ format: ["esm", "cjs"],
65
+ dts: true,
66
+ sourcemap: true,
67
+ target: "es2022",
68
+ outDir: "dist/v2",
69
+ plugins: [
70
+ {
71
+ name: "externalize-context",
72
+ resolveId(source, importer) {
73
+ // When any file imports ../context or ./context, redirect to
74
+ // the external package path so the context singleton is shared.
75
+ if (importer && /context(\.ts)?$/.test(source)) {
76
+ const resolved = path.resolve(path.dirname(importer), source);
77
+ if (
78
+ resolved === contextModulePath ||
79
+ resolved === contextModulePath + ".ts"
80
+ ) {
81
+ return {
82
+ id: "@copilotkit/react-core/v2/context",
83
+ external: true,
84
+ };
85
+ }
86
+ }
87
+ return null;
88
+ },
89
+ },
90
+ ],
91
+ external: [
92
+ "react",
93
+ "@ag-ui/client",
94
+ "@ag-ui/core",
95
+ "@copilotkit/core",
96
+ "@copilotkit/shared",
97
+ "@copilotkit/react-core/v2/context",
98
+ "uuid",
99
+ "zod",
100
+ "rxjs",
101
+ ],
102
+ },
28
103
  {
29
104
  entry: ["src/index.tsx"],
30
105
  format: ["umd"],