@copilotkitnext/react 0.0.2 → 0.0.4
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.
- package/package.json +5 -5
- package/.turbo/turbo-build$colon$css.log +0 -9
- package/.turbo/turbo-build.log +0 -30
- package/.turbo/turbo-check-types.log +0 -0
- package/.turbo/turbo-lint.log +0 -78
- package/.turbo/turbo-test.log +0 -79
- package/postcss.config.js +0 -7
- package/src/__tests__/setup.ts +0 -2
- package/src/components/chat/CopilotChat.tsx +0 -90
- package/src/components/chat/CopilotChatAssistantMessage.tsx +0 -478
- package/src/components/chat/CopilotChatAudioRecorder.tsx +0 -157
- package/src/components/chat/CopilotChatInput.tsx +0 -596
- package/src/components/chat/CopilotChatMessageView.tsx +0 -85
- package/src/components/chat/CopilotChatToolCallsView.tsx +0 -43
- package/src/components/chat/CopilotChatUserMessage.tsx +0 -337
- package/src/components/chat/CopilotChatView.tsx +0 -385
- package/src/components/chat/__tests__/CopilotChatAssistantMessage.test.tsx +0 -684
- package/src/components/chat/__tests__/CopilotChatInput.test.tsx +0 -531
- package/src/components/chat/__tests__/setup.ts +0 -1
- package/src/components/chat/index.ts +0 -35
- package/src/components/index.ts +0 -4
- package/src/components/ui/button.tsx +0 -123
- package/src/components/ui/dropdown-menu.tsx +0 -257
- package/src/components/ui/tooltip.tsx +0 -59
- package/src/hooks/index.ts +0 -6
- package/src/hooks/use-agent-context.tsx +0 -17
- package/src/hooks/use-agent.tsx +0 -48
- package/src/hooks/use-frontend-tool.tsx +0 -46
- package/src/hooks/use-human-in-the-loop.tsx +0 -76
- package/src/hooks/use-render-tool-call.tsx +0 -81
- package/src/index.ts +0 -4
- package/src/lib/__tests__/completePartialMarkdown.test.ts +0 -495
- package/src/lib/__tests__/renderSlot.test.tsx +0 -610
- package/src/lib/slots.tsx +0 -55
- package/src/lib/utils.ts +0 -6
- package/src/providers/CopilotChatConfigurationProvider.tsx +0 -81
- package/src/providers/CopilotKitProvider.tsx +0 -269
- package/src/providers/__tests__/CopilotKitProvider.test.tsx +0 -487
- package/src/providers/__tests__/CopilotKitProvider.wildcard.test.tsx +0 -261
- package/src/providers/index.ts +0 -14
- package/src/styles/globals.css +0 -302
- package/src/types/frontend-tool.ts +0 -8
- package/src/types/human-in-the-loop.ts +0 -33
- package/src/types/index.ts +0 -3
- package/src/types/react-tool-call-render.ts +0 -29
- package/tailwind.config.js +0 -9
- package/tsconfig.json +0 -23
- package/tsup.config.ts +0 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@copilotkitnext/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "React components for CopilotKit2",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"tsup": "^8.5.0",
|
|
35
35
|
"typescript": "5.8.2",
|
|
36
36
|
"vitest": "^3.2.4",
|
|
37
|
-
"@copilotkitnext/
|
|
38
|
-
"@copilotkitnext/
|
|
37
|
+
"@copilotkitnext/typescript-config": "0.0.0",
|
|
38
|
+
"@copilotkitnext/eslint-config": "0.0.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@ag-ui/client": "0.0.36-alpha.1",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"tw-animate-css": "^1.3.5",
|
|
59
59
|
"use-stick-to-bottom": "^1.1.1",
|
|
60
60
|
"zod": "^3.25.75",
|
|
61
|
-
"@copilotkitnext/core": "0.0.
|
|
62
|
-
"@copilotkitnext/shared": "0.0.
|
|
61
|
+
"@copilotkitnext/core": "0.0.4",
|
|
62
|
+
"@copilotkitnext/shared": "0.0.4"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"react": ">=16.8.0",
|
|
@@ -1,9 +0,0 @@
|
|
|
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
|
-
[1G[0K⠙[1G[0K⠹[1G[0K⠸[1G[0K⠼[1G[0K⠴[1G[0K⠦[1G[0K⠧[1G[0K⠇[1G[0K⠏[1G[0K⠋[1G[0K⠙[1G[0K⠹[1G[0K⠸[1G[0K⠼[1G[0K⠴[1G[0K⠦[1G[0K⠧[1G[0K⠇[1G[0K⠏[1G[0K⠋[1G[0K⠙[1G[0K⠹[1G[0K⠸[1G[0K⠼[1G[0K⠴[1G[0K⠦[1G[0K⠧[1G[0K⠇[1G[0K⠏[1G[0K⠋[1G[0K⠙[1G[0K⠹[1G[0K⠸[1G[0K⠼[1G[0K⠴[1G[0K⠦[1G[0K⠧[1G[0K⠇[1G[0K⠏[1G[0K⠋[1G[0K⠙[1G[0K⠹[1G[0K⠸[1G[0K⠼[1G[0K⠴[1G[0K⠦[1G[0K⠧[1G[0K⠇[1G[0K⠏[1G[0K⠋[1G[0K⠙[1G[0K⠹[1G[0K⠸[1G[0K⠼[1G[0K⠴[1G[0K⠦[1G[0K⠧[1G[0K⠇[1G[0K⠏[1G[0K⠋[1G[0K⠙[1G[0K⠹[1G[0K⠸[1G[0K⠼[1G[0K⠴[1G[0K⠦[1G[0K⠧[1G[0K⠇[1G[0K⠏[1G[0K⠋[1G[0K⠙[1G[0K⠹[1G[0K⠸[1G[0K⠼[1G[0K⠴[1G[0K⠦[1G[0K⠧[1G[0K⠇[1G[0K⠏[1G[0K⠋[1G[0K⠙[1G[0K⠹[1G[0K⠸[1G[0K⠼[1G[0K⠴[1G[0K⠦[1G[0K[3m[1m[34m≈[39m[22m[23m tailwindcss [34mv4.1.11[39m
|
|
7
|
-
|
|
8
|
-
Done in [34m117ms[39m
|
|
9
|
-
[1G[0K⠙[1G[0K
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
> @copilotkitnext/react@0.0.1 build /Users/mme/Code/vnext_experimental/packages/react
|
|
4
|
-
> tsup && npm run build:css
|
|
5
|
-
|
|
6
|
-
[34mCLI[39m Building entry: src/index.ts
|
|
7
|
-
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
8
|
-
[34mCLI[39m tsup v8.5.0
|
|
9
|
-
[34mCLI[39m Using tsup config: /Users/mme/Code/vnext_experimental/packages/react/tsup.config.ts
|
|
10
|
-
[34mCLI[39m Target: es2022
|
|
11
|
-
[34mCJS[39m Build start
|
|
12
|
-
[34mESM[39m Build start
|
|
13
|
-
[32mCJS[39m [1mdist/index.js [22m[32m80.60 KB[39m
|
|
14
|
-
[32mCJS[39m [1mdist/index.js.map [22m[32m136.95 KB[39m
|
|
15
|
-
[32mCJS[39m ⚡️ Build success in 27ms
|
|
16
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m72.83 KB[39m
|
|
17
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[32m138.31 KB[39m
|
|
18
|
-
[32mESM[39m ⚡️ Build success in 27ms
|
|
19
|
-
DTS Build start
|
|
20
|
-
DTS ⚡️ Build success in 2909ms
|
|
21
|
-
DTS dist/index.d.ts 17.44 KB
|
|
22
|
-
DTS dist/index.d.mts 17.44 KB
|
|
23
|
-
|
|
24
|
-
> @copilotkitnext/react@0.0.1 build:css
|
|
25
|
-
> npx @tailwindcss/cli -i ./src/styles/globals.css -o ./dist/styles.css -m
|
|
26
|
-
|
|
27
|
-
[1G[0K[1G[0K⠙[1G[0K⠹[1G[0K⠸[1G[0K⠼[1G[0K⠴[1G[0K⠦[1G[0K⠧[1G[0K⠇[1G[0K⠏[1G[0K⠋[1G[0K⠙[1G[0K⠹[1G[0K⠸[1G[0K⠼[1G[0K⠴[1G[0K⠦[1G[0K⠧[1G[0K⠇[1G[0K⠏[1G[0K⠋[1G[0K⠙[1G[0K⠹[1G[0K⠸[1G[0K⠼[1G[0K⠴[1G[0K⠦[1G[0K⠧[1G[0K⠇[1G[0K⠏[1G[0K⠋[1G[0K⠙[1G[0K⠹[1G[0K⠸[1G[0K⠼[1G[0K⠴[1G[0K⠦[1G[0K⠧[1G[0K⠇[1G[0K⠏[1G[0K⠋[1G[0K[3m[1m[34m≈[39m[22m[23m tailwindcss [34mv4.1.11[39m
|
|
28
|
-
|
|
29
|
-
Done in [34m115ms[39m
|
|
30
|
-
[1G[0K⠙[1G[0K[1G[0K⠙[1G[0K
|
|
File without changes
|
package/.turbo/turbo-lint.log
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
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.
|
package/.turbo/turbo-test.log
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
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) [90mundefined[39m
|
|
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) [90mundefined[39m
|
|
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) [90mundefined[39m
|
|
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/postcss.config.js
DELETED
package/src/__tests__/setup.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { useAgent } from "@/hooks/use-agent";
|
|
2
|
-
import { CopilotChatView, CopilotChatViewProps } from "./CopilotChatView";
|
|
3
|
-
import { CopilotChatConfigurationProvider } from "@/providers/CopilotChatConfigurationProvider";
|
|
4
|
-
import { DEFAULT_AGENT_ID, randomUUID } from "@copilotkitnext/shared";
|
|
5
|
-
import { useCallback, useState, useEffect, useMemo } from "react";
|
|
6
|
-
import { merge } from "ts-deepmerge";
|
|
7
|
-
|
|
8
|
-
export type CopilotChatProps = Omit<CopilotChatViewProps, "messages"> & {
|
|
9
|
-
agentId?: string;
|
|
10
|
-
threadId?: string;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export function CopilotChat({
|
|
14
|
-
agentId = DEFAULT_AGENT_ID,
|
|
15
|
-
threadId,
|
|
16
|
-
...props
|
|
17
|
-
}: CopilotChatProps) {
|
|
18
|
-
const { agent } = useAgent({ agentId });
|
|
19
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
20
|
-
threadId = threadId ?? useMemo(() => randomUUID(), []);
|
|
21
|
-
|
|
22
|
-
const subscriber = {
|
|
23
|
-
onTextMessageStartEvent: () => setIsLoading(false),
|
|
24
|
-
onToolCallStartEvent: () => setIsLoading(false),
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
const connect = async () => {
|
|
29
|
-
setIsLoading(true);
|
|
30
|
-
await agent?.runAgent(
|
|
31
|
-
{
|
|
32
|
-
forwardedProps: { __copilotkitConnect: true },
|
|
33
|
-
},
|
|
34
|
-
subscriber
|
|
35
|
-
);
|
|
36
|
-
setIsLoading(false);
|
|
37
|
-
};
|
|
38
|
-
if (agent) {
|
|
39
|
-
agent.threadId = threadId;
|
|
40
|
-
if ("isCopilotKitAgent" in agent) {
|
|
41
|
-
connect();
|
|
42
|
-
} else {
|
|
43
|
-
setIsLoading(false);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return () => {};
|
|
47
|
-
}, [threadId, agent]);
|
|
48
|
-
|
|
49
|
-
const [inputValue, setInputValue] = useState("");
|
|
50
|
-
const onSubmitInput = useCallback(
|
|
51
|
-
async (value: string) => {
|
|
52
|
-
setInputValue("");
|
|
53
|
-
agent?.addMessage({
|
|
54
|
-
id: randomUUID(),
|
|
55
|
-
role: "user",
|
|
56
|
-
content: value,
|
|
57
|
-
});
|
|
58
|
-
setIsLoading(true);
|
|
59
|
-
await agent?.runAgent({}, subscriber);
|
|
60
|
-
setIsLoading(false);
|
|
61
|
-
},
|
|
62
|
-
[agent]
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
const mergedProps = merge(
|
|
66
|
-
{
|
|
67
|
-
messageView: { isLoading },
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
...props,
|
|
71
|
-
...(typeof props.messageView === "string"
|
|
72
|
-
? { messageView: { className: props.messageView } }
|
|
73
|
-
: props.messageView !== undefined
|
|
74
|
-
? { messageView: props.messageView }
|
|
75
|
-
: {}),
|
|
76
|
-
}
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
return (
|
|
80
|
-
<CopilotChatConfigurationProvider
|
|
81
|
-
inputValue={inputValue}
|
|
82
|
-
onSubmitInput={onSubmitInput}
|
|
83
|
-
onChangeInput={setInputValue}
|
|
84
|
-
>
|
|
85
|
-
<CopilotChatView
|
|
86
|
-
{...{ messages: agent?.messages ?? [], ...mergedProps }}
|
|
87
|
-
/>
|
|
88
|
-
</CopilotChatConfigurationProvider>
|
|
89
|
-
);
|
|
90
|
-
}
|