@copilotkitnext/react 0.0.1

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 (60) hide show
  1. package/.turbo/turbo-build$colon$css.log +9 -0
  2. package/.turbo/turbo-build.log +28 -0
  3. package/.turbo/turbo-check-types.log +0 -0
  4. package/.turbo/turbo-lint.log +78 -0
  5. package/.turbo/turbo-test.log +79 -0
  6. package/LICENSE +11 -0
  7. package/components.json +20 -0
  8. package/dist/index.d.mts +363 -0
  9. package/dist/index.d.ts +363 -0
  10. package/dist/index.js +2322 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/index.mjs +2291 -0
  13. package/dist/index.mjs.map +1 -0
  14. package/dist/styles.css +2 -0
  15. package/eslint.config.mjs +11 -0
  16. package/package.json +84 -0
  17. package/postcss.config.js +7 -0
  18. package/src/__tests__/setup.ts +2 -0
  19. package/src/components/chat/CopilotChat.tsx +90 -0
  20. package/src/components/chat/CopilotChatAssistantMessage.tsx +478 -0
  21. package/src/components/chat/CopilotChatAudioRecorder.tsx +157 -0
  22. package/src/components/chat/CopilotChatInput.tsx +596 -0
  23. package/src/components/chat/CopilotChatMessageView.tsx +85 -0
  24. package/src/components/chat/CopilotChatToolCallsView.tsx +43 -0
  25. package/src/components/chat/CopilotChatUserMessage.tsx +337 -0
  26. package/src/components/chat/CopilotChatView.tsx +385 -0
  27. package/src/components/chat/__tests__/CopilotChatAssistantMessage.test.tsx +684 -0
  28. package/src/components/chat/__tests__/CopilotChatInput.test.tsx +531 -0
  29. package/src/components/chat/__tests__/setup.ts +1 -0
  30. package/src/components/chat/index.ts +35 -0
  31. package/src/components/index.ts +4 -0
  32. package/src/components/ui/button.tsx +123 -0
  33. package/src/components/ui/dropdown-menu.tsx +257 -0
  34. package/src/components/ui/tooltip.tsx +59 -0
  35. package/src/hooks/index.ts +6 -0
  36. package/src/hooks/use-agent-context.tsx +17 -0
  37. package/src/hooks/use-agent.tsx +48 -0
  38. package/src/hooks/use-frontend-tool.tsx +46 -0
  39. package/src/hooks/use-human-in-the-loop.tsx +76 -0
  40. package/src/hooks/use-render-tool-call.tsx +81 -0
  41. package/src/index.ts +4 -0
  42. package/src/lib/__tests__/completePartialMarkdown.test.ts +495 -0
  43. package/src/lib/__tests__/renderSlot.test.tsx +610 -0
  44. package/src/lib/slots.tsx +55 -0
  45. package/src/lib/utils.ts +6 -0
  46. package/src/providers/CopilotChatConfigurationProvider.tsx +81 -0
  47. package/src/providers/CopilotKitProvider.tsx +269 -0
  48. package/src/providers/__tests__/CopilotKitProvider.test.tsx +487 -0
  49. package/src/providers/__tests__/CopilotKitProvider.wildcard.test.tsx +261 -0
  50. package/src/providers/index.ts +14 -0
  51. package/src/styles/globals.css +302 -0
  52. package/src/types/frontend-tool.ts +8 -0
  53. package/src/types/human-in-the-loop.ts +33 -0
  54. package/src/types/index.ts +3 -0
  55. package/src/types/react-tool-call-render.ts +29 -0
  56. package/tailwind.config.js +9 -0
  57. package/test.css +2355 -0
  58. package/tsconfig.json +23 -0
  59. package/tsup.config.ts +19 -0
  60. package/vitest.config.mjs +15 -0
@@ -0,0 +1,9 @@
1
+
2
+ 
3
+ > @copilotkit/react@0.0.0 build:css /Users/mme/Code/CopilotKit2/packages/react
4
+ > npx @tailwindcss/cli -i ./src/styles/globals.css -o ./dist/styles.css -m
5
+
6
+ ⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦≈ tailwindcss v4.1.11
7
+
8
+ Done in 117ms
9
+ ⠙
@@ -0,0 +1,28 @@
1
+
2
+ > @copilotkitnext/react@0.0.0 build /Users/mme/Code/CopilotKit2/packages/react
3
+ > tsup && npm run build:css
4
+
5
+ CLI Building entry: src/index.ts
6
+ CLI Using tsconfig: tsconfig.json
7
+ CLI tsup v8.5.0
8
+ CLI Using tsup config: /Users/mme/Code/CopilotKit2/packages/react/tsup.config.ts
9
+ CLI Target: es2022
10
+ CJS Build start
11
+ ESM Build start
12
+ ESM dist/index.mjs 72.83 KB
13
+ ESM dist/index.mjs.map 138.31 KB
14
+ ESM ⚡️ Build success in 23ms
15
+ CJS dist/index.js 80.60 KB
16
+ CJS dist/index.js.map 136.95 KB
17
+ CJS ⚡️ Build success in 23ms
18
+ DTS Build start
19
+ DTS ⚡️ Build success in 2683ms
20
+ DTS dist/index.d.ts 17.44 KB
21
+ DTS dist/index.d.mts 17.44 KB
22
+
23
+ > @copilotkitnext/react@0.0.0 build:css
24
+ > npx @tailwindcss/cli -i ./src/styles/globals.css -o ./dist/styles.css -m
25
+
26
+ ≈ tailwindcss v4.1.11
27
+
28
+ Done in 100ms
File without changes
@@ -0,0 +1,78 @@
1
+
2
+ > @copilotkit/react@0.0.0 lint /Users/mme/Code/CopilotKit2/packages/react
3
+ > eslint . --max-warnings 0
4
+
5
+
6
+ /Users/mme/Code/CopilotKit2/packages/react/src/components/chat/CopilotChatAudioRecorder.tsx
7
+ 16:3 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
8
+
9
+ /Users/mme/Code/CopilotKit2/packages/react/src/components/chat/CopilotChatInput.tsx
10
+ 538:10 warning React Hook useEffect has a missing dependency: 'adjustHeight'. Either include it or remove the dependency array react-hooks/exhaustive-deps
11
+
12
+ /Users/mme/Code/CopilotKit2/packages/react/src/components/chat/CopilotChatView.tsx
13
+ 165:8 warning ES2015 module syntax is preferred over namespaces @typescript-eslint/no-namespace
14
+
15
+ /Users/mme/Code/CopilotKit2/packages/react/src/hooks/use-agent-context.tsx
16
+ 16:6 warning React Hook useEffect has a missing dependency: 'context'. Either include it or remove the dependency array react-hooks/exhaustive-deps
17
+
18
+ /Users/mme/Code/CopilotKit2/packages/react/src/hooks/use-agent.tsx
19
+ 19:6 warning React Hook useMemo has a missing dependency: 'copilotkit'. Either include it or remove the dependency array react-hooks/exhaustive-deps
20
+ 23:25 warning 'params' is defined but never used @typescript-eslint/no-unused-vars
21
+ 26:22 warning 'params' is defined but never used @typescript-eslint/no-unused-vars
22
+ 29:24 warning 'params' is defined but never used @typescript-eslint/no-unused-vars
23
+ 32:22 warning 'params' is defined but never used @typescript-eslint/no-unused-vars
24
+ 35:19 warning 'params' is defined but never used @typescript-eslint/no-unused-vars
25
+
26
+ /Users/mme/Code/CopilotKit2/packages/react/src/hooks/use-frontend-tool.tsx
27
+ 6:56 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
28
+ 6:63 warning The `{}` ("empty object") type allows any non-nullish value, including literals like `0` and `""`.
29
+ - If that's what you want, disable this lint rule with an inline comment or configure the 'allowObjectTypes' rule option.
30
+ - If you want a type meaning "any object", you probably want `object` instead.
31
+ - If you want a type meaning "any value", you probably want `unknown` instead @typescript-eslint/no-empty-object-type
32
+ 11:58 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
33
+ 11:65 warning The `{}` ("empty object") type allows any non-nullish value, including literals like `0` and `""`.
34
+ - If that's what you want, disable this lint rule with an inline comment or configure the 'allowObjectTypes' rule option.
35
+ - If you want a type meaning "any object", you probably want `object` instead.
36
+ - If you want a type meaning "any value", you probably want `unknown` instead @typescript-eslint/no-empty-object-type
37
+ 40:6 warning React Hook useEffect has missing dependencies: 'renderToolCalls' and 'setCurrentRenderToolCalls'. Either include them or remove the dependency array react-hooks/exhaustive-deps
38
+
39
+ /Users/mme/Code/CopilotKit2/packages/react/src/hooks/use-human-in-the-loop.tsx
40
+ 7:58 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
41
+ 7:65 warning The `{}` ("empty object") type allows any non-nullish value, including literals like `0` and `""`.
42
+ - If that's what you want, disable this lint rule with an inline comment or configure the 'allowObjectTypes' rule option.
43
+ - If you want a type meaning "any object", you probably want `object` instead.
44
+ - If you want a type meaning "any value", you probably want `unknown` instead @typescript-eslint/no-empty-object-type
45
+ 39:60 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
46
+ 39:67 warning The `{}` ("empty object") type allows any non-nullish value, including literals like `0` and `""`.
47
+ - If that's what you want, disable this lint rule with an inline comment or configure the 'allowObjectTypes' rule option.
48
+ - If you want a type meaning "any object", you probably want `object` instead.
49
+ - If you want a type meaning "any value", you probably want `unknown` instead @typescript-eslint/no-empty-object-type
50
+ 55:38 warning 'args' is defined but never used @typescript-eslint/no-unused-vars
51
+ 88:58 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
52
+
53
+ /Users/mme/Code/CopilotKit2/packages/react/src/lib/__tests__/renderSlot.test.tsx
54
+ 222:27 warning Component definition is missing display name react/display-name
55
+ 372:50 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
56
+
57
+ /Users/mme/Code/CopilotKit2/packages/react/src/lib/slots.tsx
58
+ 10:53 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
59
+ 19:48 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
60
+ 20:10 warning The `{}` ("empty object") type allows any non-nullish value, including literals like `0` and `""`.
61
+ - If that's what you want, disable this lint rule with an inline comment or configure the 'allowObjectTypes' rule option.
62
+ - If you want a type meaning "any object", you probably want `object` instead.
63
+ - If you want a type meaning "any value", you probably want `unknown` instead @typescript-eslint/no-empty-object-type
64
+ 29:33 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
65
+
66
+ /Users/mme/Code/CopilotKit2/packages/react/src/providers/CopilotChatConfigurationProvider.tsx
67
+ 1:55 warning 'useState' is defined but never used @typescript-eslint/no-unused-vars
68
+
69
+ /Users/mme/Code/CopilotKit2/packages/react/src/providers/CopilotKitProvider.tsx
70
+ 52:65 warning React Hook useMemo has a missing dependency: 'renderToolCalls'. Either include it or remove the dependency array react-hooks/exhaustive-deps
71
+ 65:6 warning React Hook useEffect has a missing dependency: 'initialRenderToolCalls'. Either include it or remove the dependency array react-hooks/exhaustive-deps
72
+ 76:6 warning React Hook useMemo has missing dependencies: 'agents', 'headers', and 'properties'. Either include them or remove the dependency array react-hooks/exhaustive-deps
73
+ 83:6 warning React Hook useEffect has a missing dependency: 'copilotkit'. Either include it or remove the dependency array react-hooks/exhaustive-deps
74
+
75
+ ✖ 32 problems (0 errors, 32 warnings)
76
+
77
+ ESLint found too many warnings (maximum: 0).
78
+  ELIFECYCLE  Command failed with exit code 1.
@@ -0,0 +1,79 @@
1
+
2
+ > @copilotkitnext/react@0.0.0 test /Users/mme/Code/CopilotKit2/packages/react
3
+ > vitest run
4
+
5
+
6
+ RUN v3.2.4 /Users/mme/Code/CopilotKit2/packages/react
7
+
8
+ ✓ src/lib/__tests__/completePartialMarkdown.test.ts (68 tests) 9ms
9
+ stdout | src/lib/__tests__/renderSlot.test.tsx > renderSlot > Ref forwarding > forwards refs to custom component
10
+ stderr | src/lib/__tests__/renderSlot.test.tsx > renderSlot > Ref forwarding > forwards refs to custom component
11
+ BUG: Custom component was not used by renderSlot
12
+
13
+ Invalid values for props `$$typeof`, `render` on <input> tag. Either remove them from the element, or pass a string or number value to keep them in the DOM. For details, see https://react.dev/link/attribute-behavior
14
+ Invalid attribute name: `$$typeof`
15
+
16
+ stdout | src/lib/__tests__/renderSlot.test.tsx > renderSlot > Complex prop merging > handles undefined and null prop values
17
+ BUG: undefined slot props override base props
18
+
19
+ ✓ src/providers/__tests__/CopilotKitProvider.test.tsx (16 tests) 281ms
20
+ ✓ src/providers/__tests__/CopilotKitProvider.wildcard.test.tsx (9 tests) 49ms
21
+ stdout | src/lib/__tests__/renderSlot.test.tsx > renderSlot > Additional bug hunting > FINAL ANALYSIS: renderSlot function behavior
22
+
23
+ === RENDERSLOT FUNCTION ANALYSIS ===
24
+ ✅ String slots work correctly (become className)
25
+ ✅ Function slots work correctly (custom components used)
26
+ ✅ Object slots work correctly (props merged)
27
+ ✅ Undefined slots work correctly (default component used)
28
+ 📋 Undefined props in slot objects override base props (expected JS behavior)
29
+ 📋 Complex ref forwarding may have edge cases but core function works
30
+ 🎉 Overall: renderSlot function is working as designed!
31
+
32
+ ✓ src/lib/__tests__/renderSlot.test.tsx (32 tests) 420ms
33
+ stderr | src/components/chat/__tests__/CopilotChatInput.test.tsx > CopilotChatInput > shows cancel and finish buttons in transcribe mode
34
+ Error: Not implemented: HTMLCanvasElement.prototype.getContext (without installing the canvas npm package)
35
+ at module.exports (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/jsdom@26.1.0/node_modules/jsdom/lib/jsdom/browser/not-implemented.js:9:17)
36
+ at HTMLCanvasElementImpl.getContext (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/jsdom@26.1.0/node_modules/jsdom/lib/jsdom/living/nodes/HTMLCanvasElement-impl.js:42:5)
37
+ at HTMLCanvasElement.getContext (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/jsdom@26.1.0/node_modules/jsdom/lib/jsdom/living/generated/HTMLCanvasElement.js:131:58)
38
+ at /Users/mme/Code/CopilotKit2/packages/react/src/components/chat/CopilotChatAudioRecorder.tsx:59:24
39
+ at Object.react-stack-bottom-frame (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/react-dom@19.1.0_react@19.1.0/node_modules/react-dom/cjs/react-dom-client.development.js:23949:20)
40
+ at runWithFiberInDEV (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/react-dom@19.1.0_react@19.1.0/node_modules/react-dom/cjs/react-dom-client.development.js:1522:13)
41
+ at commitHookEffectListMount (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/react-dom@19.1.0_react@19.1.0/node_modules/react-dom/cjs/react-dom-client.development.js:11905:29)
42
+ at commitHookPassiveMountEffects (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/react-dom@19.1.0_react@19.1.0/node_modules/react-dom/cjs/react-dom-client.development.js:12028:11)
43
+ at commitPassiveMountOnFiber (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/react-dom@19.1.0_react@19.1.0/node_modules/react-dom/cjs/react-dom-client.development.js:13841:13)
44
+ at recursivelyTraversePassiveMountEffects (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/react-dom@19.1.0_react@19.1.0/node_modules/react-dom/cjs/react-dom-client.development.js:13815:11) undefined
45
+
46
+ stderr | src/components/chat/__tests__/CopilotChatInput.test.tsx > CopilotChatInput > disables add and tools buttons in transcribe mode
47
+ Error: Not implemented: HTMLCanvasElement.prototype.getContext (without installing the canvas npm package)
48
+ at module.exports (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/jsdom@26.1.0/node_modules/jsdom/lib/jsdom/browser/not-implemented.js:9:17)
49
+ at HTMLCanvasElementImpl.getContext (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/jsdom@26.1.0/node_modules/jsdom/lib/jsdom/living/nodes/HTMLCanvasElement-impl.js:42:5)
50
+ at HTMLCanvasElement.getContext (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/jsdom@26.1.0/node_modules/jsdom/lib/jsdom/living/generated/HTMLCanvasElement.js:131:58)
51
+ at /Users/mme/Code/CopilotKit2/packages/react/src/components/chat/CopilotChatAudioRecorder.tsx:59:24
52
+ at Object.react-stack-bottom-frame (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/react-dom@19.1.0_react@19.1.0/node_modules/react-dom/cjs/react-dom-client.development.js:23949:20)
53
+ at runWithFiberInDEV (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/react-dom@19.1.0_react@19.1.0/node_modules/react-dom/cjs/react-dom-client.development.js:1522:13)
54
+ at commitHookEffectListMount (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/react-dom@19.1.0_react@19.1.0/node_modules/react-dom/cjs/react-dom-client.development.js:11905:29)
55
+ at commitHookPassiveMountEffects (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/react-dom@19.1.0_react@19.1.0/node_modules/react-dom/cjs/react-dom-client.development.js:12028:11)
56
+ at commitPassiveMountOnFiber (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/react-dom@19.1.0_react@19.1.0/node_modules/react-dom/cjs/react-dom-client.development.js:13841:13)
57
+ at recursivelyTraversePassiveMountEffects (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/react-dom@19.1.0_react@19.1.0/node_modules/react-dom/cjs/react-dom-client.development.js:13815:11) undefined
58
+
59
+ stderr | src/components/chat/__tests__/CopilotChatInput.test.tsx > CopilotChatInput > shows recording indicator instead of textarea in transcribe mode
60
+ Error: Not implemented: HTMLCanvasElement.prototype.getContext (without installing the canvas npm package)
61
+ at module.exports (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/jsdom@26.1.0/node_modules/jsdom/lib/jsdom/browser/not-implemented.js:9:17)
62
+ at HTMLCanvasElementImpl.getContext (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/jsdom@26.1.0/node_modules/jsdom/lib/jsdom/living/nodes/HTMLCanvasElement-impl.js:42:5)
63
+ at HTMLCanvasElement.getContext (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/jsdom@26.1.0/node_modules/jsdom/lib/jsdom/living/generated/HTMLCanvasElement.js:131:58)
64
+ at /Users/mme/Code/CopilotKit2/packages/react/src/components/chat/CopilotChatAudioRecorder.tsx:59:24
65
+ at Object.react-stack-bottom-frame (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/react-dom@19.1.0_react@19.1.0/node_modules/react-dom/cjs/react-dom-client.development.js:23949:20)
66
+ at runWithFiberInDEV (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/react-dom@19.1.0_react@19.1.0/node_modules/react-dom/cjs/react-dom-client.development.js:1522:13)
67
+ at commitHookEffectListMount (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/react-dom@19.1.0_react@19.1.0/node_modules/react-dom/cjs/react-dom-client.development.js:11905:29)
68
+ at commitHookPassiveMountEffects (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/react-dom@19.1.0_react@19.1.0/node_modules/react-dom/cjs/react-dom-client.development.js:12028:11)
69
+ at commitPassiveMountOnFiber (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/react-dom@19.1.0_react@19.1.0/node_modules/react-dom/cjs/react-dom-client.development.js:13841:13)
70
+ at recursivelyTraversePassiveMountEffects (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/react-dom@19.1.0_react@19.1.0/node_modules/react-dom/cjs/react-dom-client.development.js:13815:11) undefined
71
+
72
+ ✓ src/components/chat/__tests__/CopilotChatInput.test.tsx (24 tests) 617ms
73
+ ✓ src/components/chat/__tests__/CopilotChatAssistantMessage.test.tsx (32 tests) 642ms
74
+
75
+ Test Files 6 passed (6)
76
+ Tests 181 passed (181)
77
+ Start at 10:38:15
78
+ Duration 4.23s (transform 708ms, setup 302ms, collect 3.84s, tests 2.02s, environment 5.08s, prepare 3.96s)
79
+
package/LICENSE ADDED
@@ -0,0 +1,11 @@
1
+ Note: This license does not apply to the whole project. Individual packages may contain their own licenses.
2
+
3
+ MIT License
4
+
5
+ Copyright 2025 Tawkit Inc.
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8
+
9
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10
+
11
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema.json",
3
+ "style": "new-york",
4
+ "rsc": true,
5
+ "tsx": true,
6
+ "tailwind": {
7
+ "config": "",
8
+ "css": "src/styles/globals.css",
9
+ "baseColor": "neutral",
10
+ "cssVariables": true
11
+ },
12
+ "aliases": {
13
+ "components": "@/components",
14
+ "utils": "@/lib/utils",
15
+ "ui": "@/components/ui",
16
+ "lib": "@/lib",
17
+ "hooks": "@/hooks"
18
+ },
19
+ "iconLibrary": "lucide"
20
+ }
@@ -0,0 +1,363 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React$1 from 'react';
3
+ import React__default, { ReactNode } from 'react';
4
+ import { AssistantMessage, Message, UserMessage, ToolCall, ToolMessage } from '@ag-ui/core';
5
+ import { ToolCallStatus, FrontendTool, CopilotKitCore } from '@copilotkitnext/core';
6
+ import { z } from 'zod';
7
+ import { AbstractAgent, Context } from '@ag-ui/client';
8
+
9
+ declare const CopilotChatDefaultLabels: {
10
+ chatInputPlaceholder: string;
11
+ chatInputToolbarStartTranscribeButtonLabel: string;
12
+ chatInputToolbarCancelTranscribeButtonLabel: string;
13
+ chatInputToolbarFinishTranscribeButtonLabel: string;
14
+ chatInputToolbarAddButtonLabel: string;
15
+ chatInputToolbarToolsButtonLabel: string;
16
+ assistantMessageToolbarCopyCodeLabel: string;
17
+ assistantMessageToolbarCopyCodeCopiedLabel: string;
18
+ assistantMessageToolbarCopyMessageLabel: string;
19
+ assistantMessageToolbarThumbsUpLabel: string;
20
+ assistantMessageToolbarThumbsDownLabel: string;
21
+ assistantMessageToolbarReadAloudLabel: string;
22
+ assistantMessageToolbarRegenerateLabel: string;
23
+ userMessageToolbarCopyMessageLabel: string;
24
+ userMessageToolbarEditMessageLabel: string;
25
+ chatDisclaimerText: string;
26
+ };
27
+ type CopilotChatLabels = typeof CopilotChatDefaultLabels;
28
+ interface CopilotChatConfigurationValue {
29
+ labels: CopilotChatLabels;
30
+ inputValue?: string;
31
+ onSubmitInput?: (value: string) => void;
32
+ onChangeInput?: (value: string) => void;
33
+ }
34
+ interface CopilotChatConfigurationProviderProps {
35
+ children: ReactNode;
36
+ labels?: Partial<CopilotChatLabels>;
37
+ inputValue?: string;
38
+ onSubmitInput?: (value: string) => void;
39
+ onChangeInput?: (value: string) => void;
40
+ }
41
+ declare const CopilotChatConfigurationProvider: React__default.FC<CopilotChatConfigurationProviderProps>;
42
+ declare const useCopilotChatConfiguration: () => CopilotChatConfigurationValue;
43
+
44
+ /** Finite-state machine for every recorder implementation */
45
+ type AudioRecorderState = "idle" | "recording" | "processing";
46
+ /** Error subclass so callers can `instanceof`-guard recorder failures */
47
+ declare class AudioRecorderError extends Error {
48
+ constructor(message: string);
49
+ }
50
+ declare const CopilotChatAudioRecorder: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<any>>;
51
+
52
+ /** Existing union (unchanged) */
53
+ type SlotValue<C extends React__default.ComponentType<any>> = C | string | Partial<React__default.ComponentProps<C>>;
54
+ /** Utility: concrete React elements for every slot */
55
+ type SlotElements<S> = {
56
+ [K in keyof S]: React__default.ReactElement;
57
+ };
58
+ type WithSlots<S extends Record<string, React__default.ComponentType<any>>, Rest = {}> = {
59
+ [K in keyof S]?: SlotValue<S[K]>;
60
+ } & {
61
+ children?: (props: SlotElements<S> & Rest) => React__default.ReactNode;
62
+ } & Omit<Rest, "children">;
63
+
64
+ type CopilotChatInputMode = "input" | "transcribe" | "processing";
65
+ type ToolsMenuItem = {
66
+ label: string;
67
+ } & ({
68
+ action: () => void;
69
+ items?: never;
70
+ } | {
71
+ action?: never;
72
+ items: (ToolsMenuItem | "-")[];
73
+ });
74
+ type CopilotChatInputProps = WithSlots<{
75
+ textArea: typeof CopilotChatInput.TextArea;
76
+ sendButton: typeof CopilotChatInput.SendButton;
77
+ startTranscribeButton: typeof CopilotChatInput.StartTranscribeButton;
78
+ cancelTranscribeButton: typeof CopilotChatInput.CancelTranscribeButton;
79
+ finishTranscribeButton: typeof CopilotChatInput.FinishTranscribeButton;
80
+ addFileButton: typeof CopilotChatInput.AddFileButton;
81
+ toolsButton: typeof CopilotChatInput.ToolsButton;
82
+ toolbar: typeof CopilotChatInput.Toolbar;
83
+ audioRecorder: typeof CopilotChatAudioRecorder;
84
+ }, {
85
+ mode?: CopilotChatInputMode;
86
+ toolsMenu?: (ToolsMenuItem | "-")[];
87
+ autoFocus?: boolean;
88
+ additionalToolbarItems?: React__default.ReactNode;
89
+ onSubmitMessage?: (value: string) => void;
90
+ onStartTranscribe?: () => void;
91
+ onCancelTranscribe?: () => void;
92
+ onFinishTranscribe?: () => void;
93
+ onAddFile?: () => void;
94
+ value?: string;
95
+ onChange?: (value: string) => void;
96
+ } & Omit<React__default.HTMLAttributes<HTMLDivElement>, "onChange">>;
97
+ declare function CopilotChatInput({ mode, onSubmitMessage, onStartTranscribe, onCancelTranscribe, onFinishTranscribe, onAddFile, onChange, value, toolsMenu, autoFocus, additionalToolbarItems, textArea, sendButton, startTranscribeButton, cancelTranscribeButton, finishTranscribeButton, addFileButton, toolsButton, toolbar, audioRecorder, children, className, ...props }: CopilotChatInputProps): react_jsx_runtime.JSX.Element;
98
+ declare namespace CopilotChatInput {
99
+ const SendButton: React__default.FC<React__default.ButtonHTMLAttributes<HTMLButtonElement>>;
100
+ const ToolbarButton: React__default.FC<React__default.ButtonHTMLAttributes<HTMLButtonElement> & {
101
+ icon: React__default.ReactNode;
102
+ labelKey: keyof CopilotChatLabels;
103
+ defaultClassName?: string;
104
+ }>;
105
+ const StartTranscribeButton: React__default.FC<React__default.ButtonHTMLAttributes<HTMLButtonElement>>;
106
+ const CancelTranscribeButton: React__default.FC<React__default.ButtonHTMLAttributes<HTMLButtonElement>>;
107
+ const FinishTranscribeButton: React__default.FC<React__default.ButtonHTMLAttributes<HTMLButtonElement>>;
108
+ const AddFileButton: React__default.FC<React__default.ButtonHTMLAttributes<HTMLButtonElement>>;
109
+ const ToolsButton: React__default.FC<React__default.ButtonHTMLAttributes<HTMLButtonElement> & {
110
+ toolsMenu?: (ToolsMenuItem | "-")[];
111
+ }>;
112
+ const Toolbar: React__default.FC<React__default.HTMLAttributes<HTMLDivElement>>;
113
+ interface TextAreaProps extends React__default.TextareaHTMLAttributes<HTMLTextAreaElement> {
114
+ maxRows?: number;
115
+ }
116
+ const TextArea: React__default.ForwardRefExoticComponent<TextAreaProps & React__default.RefAttributes<HTMLTextAreaElement>>;
117
+ const AudioRecorder: React__default.ForwardRefExoticComponent<React__default.HTMLAttributes<HTMLDivElement> & React__default.RefAttributes<any>>;
118
+ }
119
+
120
+ type CopilotChatToolCallsViewProps = {
121
+ message: AssistantMessage;
122
+ messages?: Message[];
123
+ isLoading?: boolean;
124
+ };
125
+ declare function CopilotChatToolCallsView({ message, messages, isLoading, }: CopilotChatToolCallsViewProps): react_jsx_runtime.JSX.Element | null;
126
+
127
+ type CopilotChatAssistantMessageProps = WithSlots<{
128
+ markdownRenderer: typeof CopilotChatAssistantMessage.MarkdownRenderer;
129
+ toolbar: typeof CopilotChatAssistantMessage.Toolbar;
130
+ copyButton: typeof CopilotChatAssistantMessage.CopyButton;
131
+ thumbsUpButton: typeof CopilotChatAssistantMessage.ThumbsUpButton;
132
+ thumbsDownButton: typeof CopilotChatAssistantMessage.ThumbsDownButton;
133
+ readAloudButton: typeof CopilotChatAssistantMessage.ReadAloudButton;
134
+ regenerateButton: typeof CopilotChatAssistantMessage.RegenerateButton;
135
+ toolCallsView: typeof CopilotChatToolCallsView;
136
+ }, {
137
+ onThumbsUp?: (message: AssistantMessage) => void;
138
+ onThumbsDown?: (message: AssistantMessage) => void;
139
+ onReadAloud?: (message: AssistantMessage) => void;
140
+ onRegenerate?: (message: AssistantMessage) => void;
141
+ message: AssistantMessage;
142
+ messages?: Message[];
143
+ isLoading?: boolean;
144
+ additionalToolbarItems?: React.ReactNode;
145
+ toolbarVisible?: boolean;
146
+ } & React.HTMLAttributes<HTMLDivElement>>;
147
+ declare function CopilotChatAssistantMessage({ message, messages, isLoading, onThumbsUp, onThumbsDown, onReadAloud, onRegenerate, additionalToolbarItems, toolbarVisible, markdownRenderer, toolbar, copyButton, thumbsUpButton, thumbsDownButton, readAloudButton, regenerateButton, toolCallsView, children, className, ...props }: CopilotChatAssistantMessageProps): react_jsx_runtime.JSX.Element;
148
+ declare namespace CopilotChatAssistantMessage {
149
+ const MarkdownRenderer: React.FC<React.HTMLAttributes<HTMLDivElement> & {
150
+ content: string;
151
+ }>;
152
+ const Toolbar: React.FC<React.HTMLAttributes<HTMLDivElement>>;
153
+ const ToolbarButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement> & {
154
+ title: string;
155
+ children: React.ReactNode;
156
+ }>;
157
+ const CopyButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>>;
158
+ const ThumbsUpButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>>;
159
+ const ThumbsDownButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>>;
160
+ const ReadAloudButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>>;
161
+ const RegenerateButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>>;
162
+ }
163
+
164
+ interface CopilotChatUserMessageOnEditMessageProps {
165
+ message: UserMessage;
166
+ }
167
+ interface CopilotChatUserMessageOnSwitchToBranchProps {
168
+ message: UserMessage;
169
+ branchIndex: number;
170
+ numberOfBranches: number;
171
+ }
172
+ type CopilotChatUserMessageProps = WithSlots<{
173
+ messageRenderer: typeof CopilotChatUserMessage.MessageRenderer;
174
+ toolbar: typeof CopilotChatUserMessage.Toolbar;
175
+ copyButton: typeof CopilotChatUserMessage.CopyButton;
176
+ editButton: typeof CopilotChatUserMessage.EditButton;
177
+ branchNavigation: typeof CopilotChatUserMessage.BranchNavigation;
178
+ }, {
179
+ onEditMessage?: (props: CopilotChatUserMessageOnEditMessageProps) => void;
180
+ onSwitchToBranch?: (props: CopilotChatUserMessageOnSwitchToBranchProps) => void;
181
+ message: UserMessage;
182
+ branchIndex?: number;
183
+ numberOfBranches?: number;
184
+ additionalToolbarItems?: React.ReactNode;
185
+ } & React.HTMLAttributes<HTMLDivElement>>;
186
+ declare function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfBranches, onSwitchToBranch, additionalToolbarItems, messageRenderer, toolbar, copyButton, editButton, branchNavigation, children, className, ...props }: CopilotChatUserMessageProps): react_jsx_runtime.JSX.Element;
187
+ declare namespace CopilotChatUserMessage {
188
+ const Container: React.FC<React.PropsWithChildren<React.HTMLAttributes<HTMLDivElement>>>;
189
+ const MessageRenderer: React.FC<{
190
+ content: string;
191
+ className?: string;
192
+ }>;
193
+ const Toolbar: React.FC<React.HTMLAttributes<HTMLDivElement>>;
194
+ const ToolbarButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement> & {
195
+ title: string;
196
+ children: React.ReactNode;
197
+ }>;
198
+ const CopyButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement> & {
199
+ copied?: boolean;
200
+ }>;
201
+ const EditButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>>;
202
+ const BranchNavigation: React.FC<React.HTMLAttributes<HTMLDivElement> & {
203
+ currentBranch?: number;
204
+ numberOfBranches?: number;
205
+ onSwitchToBranch?: (props: CopilotChatUserMessageOnSwitchToBranchProps) => void;
206
+ message: UserMessage;
207
+ }>;
208
+ }
209
+
210
+ type CopilotChatMessageViewProps = Omit<WithSlots<{
211
+ assistantMessage: typeof CopilotChatAssistantMessage;
212
+ userMessage: typeof CopilotChatUserMessage;
213
+ cursor: typeof CopilotChatMessageView.Cursor;
214
+ }, {
215
+ isLoading?: boolean;
216
+ messages?: Message[];
217
+ } & React.HTMLAttributes<HTMLDivElement>>, "children"> & {
218
+ children?: (props: {
219
+ isLoading: boolean;
220
+ messages: Message[];
221
+ messageElements: React.ReactElement[];
222
+ }) => React.ReactElement;
223
+ };
224
+ declare function CopilotChatMessageView({ messages, assistantMessage, userMessage, cursor, isLoading, children, className, ...props }: CopilotChatMessageViewProps): react_jsx_runtime.JSX.Element;
225
+ declare namespace CopilotChatMessageView {
226
+ var Cursor: ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => react_jsx_runtime.JSX.Element;
227
+ }
228
+
229
+ type CopilotChatViewProps = WithSlots<{
230
+ messageView: typeof CopilotChatMessageView;
231
+ scrollView: React__default.FC<React__default.HTMLAttributes<HTMLDivElement>>;
232
+ scrollToBottomButton: React__default.FC<React__default.ButtonHTMLAttributes<HTMLButtonElement>>;
233
+ input: typeof CopilotChatInput;
234
+ inputContainer: React__default.FC<React__default.HTMLAttributes<HTMLDivElement> & {
235
+ children: React__default.ReactNode;
236
+ }>;
237
+ feather: React__default.FC<React__default.HTMLAttributes<HTMLDivElement>>;
238
+ disclaimer: React__default.FC<React__default.HTMLAttributes<HTMLDivElement>>;
239
+ }, {
240
+ messages?: Message[];
241
+ autoScroll?: boolean;
242
+ } & React__default.HTMLAttributes<HTMLDivElement>>;
243
+ declare function CopilotChatView({ messageView, input, scrollView, scrollToBottomButton, feather, inputContainer, disclaimer, messages, autoScroll, children, className, ...props }: CopilotChatViewProps): string | number | bigint | boolean | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
244
+ declare namespace CopilotChatView {
245
+ const ScrollView: React__default.FC<React__default.HTMLAttributes<HTMLDivElement> & {
246
+ autoScroll?: boolean;
247
+ scrollToBottomButton?: React__default.FC<React__default.ButtonHTMLAttributes<HTMLButtonElement>>;
248
+ inputContainerHeight?: number;
249
+ isResizing?: boolean;
250
+ }>;
251
+ const ScrollToBottomButton: React__default.FC<React__default.ButtonHTMLAttributes<HTMLButtonElement>>;
252
+ const Feather: React__default.FC<React__default.HTMLAttributes<HTMLDivElement>>;
253
+ const InputContainer: React__default.ForwardRefExoticComponent<React__default.HTMLAttributes<HTMLDivElement> & {
254
+ children: React__default.ReactNode;
255
+ } & React__default.RefAttributes<HTMLDivElement>>;
256
+ const Disclaimer: React__default.FC<React__default.HTMLAttributes<HTMLDivElement>>;
257
+ }
258
+
259
+ type CopilotChatProps = Omit<CopilotChatViewProps, "messages"> & {
260
+ agentId?: string;
261
+ threadId?: string;
262
+ };
263
+ declare function CopilotChat({ agentId, threadId, ...props }: CopilotChatProps): react_jsx_runtime.JSX.Element;
264
+
265
+ interface UseRenderToolCallProps {
266
+ toolCall: ToolCall;
267
+ toolMessage?: ToolMessage;
268
+ isLoading: boolean;
269
+ }
270
+ /**
271
+ * Hook that returns a function to render tool calls based on the render functions
272
+ * defined in CopilotKitProvider.
273
+ *
274
+ * @returns A function that takes a tool call and optional tool message and returns the rendered component
275
+ */
276
+ declare function useRenderToolCall(): ({ toolCall, toolMessage, isLoading, }: UseRenderToolCallProps) => React__default.ReactElement | null;
277
+
278
+ interface ReactToolCallRender<T> {
279
+ name: string;
280
+ args: z.ZodSchema<T>;
281
+ /**
282
+ * Optional agent ID to constrain this tool render to a specific agent.
283
+ * If specified, this render will only be used for the specified agent.
284
+ */
285
+ agentId?: string;
286
+ render: React.ComponentType<{
287
+ args: Partial<T>;
288
+ status: ToolCallStatus.InProgress;
289
+ result: undefined;
290
+ } | {
291
+ args: T;
292
+ status: ToolCallStatus.Executing;
293
+ result: undefined;
294
+ } | {
295
+ args: T;
296
+ status: ToolCallStatus.Complete;
297
+ result: string;
298
+ }>;
299
+ }
300
+
301
+ type ReactFrontendTool<T extends Record<string, unknown> = Record<string, unknown>> = FrontendTool<T> & {
302
+ render?: ReactToolCallRender<T>["render"];
303
+ };
304
+
305
+ declare function useFrontendTool<T extends Record<string, unknown> = Record<string, unknown>>(tool: ReactFrontendTool<T>): void;
306
+
307
+ type ReactHumanInTheLoop<T extends Record<string, unknown> = Record<string, unknown>> = Omit<FrontendTool<T>, "handler"> & {
308
+ render: React__default.ComponentType<{
309
+ name: string;
310
+ description: string;
311
+ args: Partial<T>;
312
+ status: ToolCallStatus.InProgress;
313
+ result: undefined;
314
+ respond: undefined;
315
+ } | {
316
+ name: string;
317
+ description: string;
318
+ args: T;
319
+ status: ToolCallStatus.Executing;
320
+ result: undefined;
321
+ respond: (result: unknown) => Promise<void>;
322
+ } | {
323
+ name: string;
324
+ description: string;
325
+ args: T;
326
+ status: ToolCallStatus.Complete;
327
+ result: string;
328
+ respond: undefined;
329
+ }>;
330
+ };
331
+
332
+ declare function useHumanInTheLoop<T extends Record<string, unknown> = Record<string, unknown>>(tool: ReactHumanInTheLoop<T>): void;
333
+
334
+ interface UseAgentProps {
335
+ agentId?: string;
336
+ }
337
+ declare function useAgent({ agentId }?: UseAgentProps): {
338
+ agent: AbstractAgent | undefined;
339
+ isRunning: boolean;
340
+ };
341
+
342
+ declare function useAgentContext(context: Context): void;
343
+
344
+ interface CopilotKitContextValue {
345
+ copilotkit: CopilotKitCore;
346
+ renderToolCalls: ReactToolCallRender<unknown>[];
347
+ currentRenderToolCalls: ReactToolCallRender<unknown>[];
348
+ setCurrentRenderToolCalls: React__default.Dispatch<React__default.SetStateAction<ReactToolCallRender<unknown>[]>>;
349
+ }
350
+ interface CopilotKitProviderProps {
351
+ children: ReactNode;
352
+ runtimeUrl?: string;
353
+ headers?: Record<string, string>;
354
+ properties?: Record<string, unknown>;
355
+ agents?: Record<string, AbstractAgent>;
356
+ renderToolCalls?: ReactToolCallRender<unknown>[];
357
+ frontendTools?: ReactFrontendTool[];
358
+ humanInTheLoop?: ReactHumanInTheLoop[];
359
+ }
360
+ declare const CopilotKitProvider: React__default.FC<CopilotKitProviderProps>;
361
+ declare const useCopilotKit: () => CopilotKitContextValue;
362
+
363
+ export { AudioRecorderError, type AudioRecorderState, CopilotChat, CopilotChatAssistantMessage, type CopilotChatAssistantMessageProps, CopilotChatAudioRecorder, CopilotChatConfigurationProvider, type CopilotChatConfigurationProviderProps, type CopilotChatConfigurationValue, CopilotChatInput, type CopilotChatInputProps, type CopilotChatLabels, CopilotChatMessageView, type CopilotChatMessageViewProps, type CopilotChatProps, CopilotChatToolCallsView, type CopilotChatToolCallsViewProps, CopilotChatUserMessage, type CopilotChatUserMessageProps, CopilotChatView, type CopilotChatViewProps, type CopilotKitContextValue, CopilotKitProvider, type CopilotKitProviderProps, type ToolsMenuItem, useAgent, useAgentContext, useCopilotChatConfiguration, useCopilotKit, useFrontendTool, useHumanInTheLoop, useRenderToolCall };