@copilotkitnext/angular 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.
Files changed (168) hide show
  1. package/README.md +3 -3
  2. package/dist/README.md +3 -3
  3. package/dist/components/chat/copilot-chat-assistant-message.component.d.ts +10 -10
  4. package/dist/components/chat/copilot-chat-message-view.component.d.ts +42 -42
  5. package/dist/components/chat/copilot-chat-view.component.d.ts +14 -14
  6. package/dist/esm2022/components/chat/copilot-chat-assistant-message-buttons.component.mjs +384 -0
  7. package/dist/esm2022/components/chat/copilot-chat-assistant-message-renderer.component.mjs +286 -0
  8. package/dist/esm2022/components/chat/copilot-chat-assistant-message-toolbar.component.mjs +27 -0
  9. package/dist/esm2022/components/chat/copilot-chat-assistant-message.component.mjs +433 -0
  10. package/dist/esm2022/components/chat/copilot-chat-assistant-message.types.mjs +2 -0
  11. package/dist/esm2022/components/chat/copilot-chat-audio-recorder.component.mjs +202 -0
  12. package/dist/esm2022/components/chat/copilot-chat-buttons.component.mjs +321 -0
  13. package/dist/esm2022/components/chat/copilot-chat-input-defaults.mjs +38 -0
  14. package/dist/esm2022/components/chat/copilot-chat-input.component.mjs +666 -0
  15. package/dist/esm2022/components/chat/copilot-chat-input.types.mjs +10 -0
  16. package/dist/esm2022/components/chat/copilot-chat-message-view-cursor.component.mjs +45 -0
  17. package/dist/esm2022/components/chat/copilot-chat-message-view.component.mjs +296 -0
  18. package/dist/esm2022/components/chat/copilot-chat-message-view.types.mjs +2 -0
  19. package/dist/esm2022/components/chat/copilot-chat-textarea.component.mjs +188 -0
  20. package/dist/esm2022/components/chat/copilot-chat-tool-calls-view.component.mjs +216 -0
  21. package/dist/esm2022/components/chat/copilot-chat-toolbar.component.mjs +25 -0
  22. package/dist/esm2022/components/chat/copilot-chat-tools-menu.component.mjs +199 -0
  23. package/dist/esm2022/components/chat/copilot-chat-user-message-branch-navigation.component.mjs +137 -0
  24. package/dist/esm2022/components/chat/copilot-chat-user-message-buttons.component.mjs +207 -0
  25. package/dist/esm2022/components/chat/copilot-chat-user-message-renderer.component.mjs +35 -0
  26. package/dist/esm2022/components/chat/copilot-chat-user-message-toolbar.component.mjs +34 -0
  27. package/dist/esm2022/components/chat/copilot-chat-user-message.component.mjs +341 -0
  28. package/dist/esm2022/components/chat/copilot-chat-user-message.types.mjs +2 -0
  29. package/dist/esm2022/components/chat/copilot-chat-view-disclaimer.component.mjs +52 -0
  30. package/dist/esm2022/components/chat/copilot-chat-view-feather.component.mjs +55 -0
  31. package/dist/esm2022/components/chat/copilot-chat-view-handlers.service.mjs +19 -0
  32. package/dist/esm2022/components/chat/copilot-chat-view-input-container.component.mjs +110 -0
  33. package/dist/esm2022/components/chat/copilot-chat-view-scroll-to-bottom-button.component.mjs +93 -0
  34. package/dist/esm2022/components/chat/copilot-chat-view-scroll-view.component.mjs +443 -0
  35. package/dist/esm2022/components/chat/copilot-chat-view.component.mjs +479 -0
  36. package/dist/esm2022/components/chat/copilot-chat-view.types.mjs +2 -0
  37. package/dist/esm2022/components/chat/copilot-chat.component.mjs +214 -0
  38. package/dist/esm2022/components/copilotkit-tool-render.component.mjs +153 -0
  39. package/dist/esm2022/copilotkitnext-angular.mjs +5 -0
  40. package/dist/esm2022/core/chat-configuration/chat-configuration.providers.mjs +65 -0
  41. package/dist/esm2022/core/chat-configuration/chat-configuration.service.mjs +145 -0
  42. package/dist/esm2022/core/chat-configuration/chat-configuration.types.mjs +26 -0
  43. package/dist/esm2022/core/copilotkit.providers.mjs +34 -0
  44. package/dist/esm2022/core/copilotkit.service.mjs +430 -0
  45. package/dist/esm2022/core/copilotkit.types.mjs +12 -0
  46. package/dist/esm2022/directives/copilotkit-agent-context.directive.mjs +130 -0
  47. package/dist/esm2022/directives/copilotkit-agent.directive.mjs +217 -0
  48. package/dist/esm2022/directives/copilotkit-chat-config.directive.mjs +218 -0
  49. package/dist/esm2022/directives/copilotkit-config.directive.mjs +94 -0
  50. package/dist/esm2022/directives/copilotkit-frontend-tool.directive.mjs +130 -0
  51. package/dist/esm2022/directives/copilotkit-human-in-the-loop.directive.mjs +266 -0
  52. package/dist/esm2022/directives/stick-to-bottom.directive.mjs +181 -0
  53. package/dist/esm2022/index.mjs +70 -0
  54. package/dist/esm2022/lib/directives/tooltip.directive.mjs +211 -0
  55. package/dist/esm2022/lib/slots/copilot-slot.component.mjs +144 -0
  56. package/dist/esm2022/lib/slots/slot.types.mjs +6 -0
  57. package/dist/esm2022/lib/slots/slot.utils.mjs +222 -0
  58. package/dist/esm2022/lib/utils.mjs +10 -0
  59. package/dist/esm2022/services/resize-observer.service.mjs +152 -0
  60. package/dist/esm2022/services/scroll-position.service.mjs +124 -0
  61. package/dist/esm2022/types/frontend-tool.mjs +2 -0
  62. package/dist/esm2022/types/human-in-the-loop.mjs +2 -0
  63. package/dist/esm2022/utils/agent-context.utils.mjs +114 -0
  64. package/dist/esm2022/utils/agent.utils.mjs +204 -0
  65. package/dist/esm2022/utils/chat-config.utils.mjs +186 -0
  66. package/dist/esm2022/utils/copilotkit.utils.mjs +20 -0
  67. package/dist/esm2022/utils/frontend-tool.utils.mjs +228 -0
  68. package/dist/esm2022/utils/human-in-the-loop.utils.mjs +296 -0
  69. package/dist/fesm2022/copilotkitnext-angular.mjs +163 -164
  70. package/dist/fesm2022/copilotkitnext-angular.mjs.map +1 -1
  71. package/package.json +21 -18
  72. package/vitest.config.mts +32 -21
  73. package/.turbo/turbo-build.log +0 -38
  74. package/.turbo/turbo-check-types.log +0 -0
  75. package/.turbo/turbo-test.log +0 -71
  76. package/ng-package.json +0 -19
  77. package/src/components/chat/__tests__/copilot-chat-assistant-message.component.spec.ts +0 -282
  78. package/src/components/chat/__tests__/copilot-chat-input.component.spec.ts +0 -419
  79. package/src/components/chat/__tests__/copilot-chat-message-view.component.spec.ts +0 -372
  80. package/src/components/chat/__tests__/copilot-chat-user-message.component.spec.ts +0 -249
  81. package/src/components/chat/copilot-chat-assistant-message-buttons.component.ts +0 -292
  82. package/src/components/chat/copilot-chat-assistant-message-renderer.component.ts +0 -472
  83. package/src/components/chat/copilot-chat-assistant-message-toolbar.component.ts +0 -29
  84. package/src/components/chat/copilot-chat-assistant-message.component.ts +0 -463
  85. package/src/components/chat/copilot-chat-assistant-message.types.ts +0 -50
  86. package/src/components/chat/copilot-chat-audio-recorder.component.ts +0 -241
  87. package/src/components/chat/copilot-chat-buttons.component.ts +0 -308
  88. package/src/components/chat/copilot-chat-buttons.component.ts.bak +0 -471
  89. package/src/components/chat/copilot-chat-input-defaults.ts +0 -47
  90. package/src/components/chat/copilot-chat-input.component.ts +0 -512
  91. package/src/components/chat/copilot-chat-input.types.ts +0 -148
  92. package/src/components/chat/copilot-chat-message-view-cursor.component.ts +0 -51
  93. package/src/components/chat/copilot-chat-message-view.component.ts +0 -233
  94. package/src/components/chat/copilot-chat-message-view.types.ts +0 -39
  95. package/src/components/chat/copilot-chat-textarea.component.ts +0 -220
  96. package/src/components/chat/copilot-chat-tool-calls-view.component.ts +0 -261
  97. package/src/components/chat/copilot-chat-toolbar.component.ts +0 -35
  98. package/src/components/chat/copilot-chat-tools-menu.component.ts +0 -185
  99. package/src/components/chat/copilot-chat-user-message-branch-navigation.component.ts +0 -121
  100. package/src/components/chat/copilot-chat-user-message-buttons.component.ts +0 -170
  101. package/src/components/chat/copilot-chat-user-message-renderer.component.ts +0 -37
  102. package/src/components/chat/copilot-chat-user-message-toolbar.component.ts +0 -37
  103. package/src/components/chat/copilot-chat-user-message.component.ts +0 -247
  104. package/src/components/chat/copilot-chat-user-message.types.ts +0 -42
  105. package/src/components/chat/copilot-chat-view-disclaimer.component.ts +0 -51
  106. package/src/components/chat/copilot-chat-view-feather.component.ts +0 -47
  107. package/src/components/chat/copilot-chat-view-handlers.service.ts +0 -14
  108. package/src/components/chat/copilot-chat-view-input-container.component.ts +0 -87
  109. package/src/components/chat/copilot-chat-view-scroll-to-bottom-button.component.ts +0 -79
  110. package/src/components/chat/copilot-chat-view-scroll-view.component.ts +0 -322
  111. package/src/components/chat/copilot-chat-view.component.ts +0 -420
  112. package/src/components/chat/copilot-chat-view.types.ts +0 -52
  113. package/src/components/chat/copilot-chat.component.ts +0 -232
  114. package/src/components/copilotkit-tool-render.component.ts +0 -169
  115. package/src/core/__tests__/copilotkit.service.spec.ts +0 -1051
  116. package/src/core/__tests__/copilotkit.service.wildcard.spec.ts +0 -316
  117. package/src/core/chat-configuration/__tests__/chat-configuration.service.spec.ts +0 -287
  118. package/src/core/chat-configuration/chat-configuration.providers.ts +0 -71
  119. package/src/core/chat-configuration/chat-configuration.service.ts +0 -162
  120. package/src/core/chat-configuration/chat-configuration.types.ts +0 -57
  121. package/src/core/copilotkit.providers.ts +0 -59
  122. package/src/core/copilotkit.service.ts +0 -542
  123. package/src/core/copilotkit.types.ts +0 -132
  124. package/src/directives/__tests__/copilotkit-agent-context.directive.spec.ts +0 -384
  125. package/src/directives/__tests__/copilotkit-agent.directive.spec.ts +0 -253
  126. package/src/directives/__tests__/copilotkit-chat-config.directive.spec.ts +0 -385
  127. package/src/directives/__tests__/copilotkit-config.directive.spec.ts +0 -69
  128. package/src/directives/__tests__/copilotkit-frontend-tool-simple.directive.spec.ts +0 -60
  129. package/src/directives/__tests__/copilotkit-frontend-tool.directive.spec.ts +0 -108
  130. package/src/directives/__tests__/copilotkit-human-in-the-loop.directive.spec.ts +0 -452
  131. package/src/directives/copilotkit-agent-context.directive.ts +0 -138
  132. package/src/directives/copilotkit-agent.directive.ts +0 -225
  133. package/src/directives/copilotkit-chat-config.directive.ts +0 -241
  134. package/src/directives/copilotkit-config.directive.ts +0 -81
  135. package/src/directives/copilotkit-frontend-tool.directive.ts +0 -145
  136. package/src/directives/copilotkit-human-in-the-loop.directive.ts +0 -281
  137. package/src/directives/stick-to-bottom.directive.ts +0 -204
  138. package/src/index.ts +0 -105
  139. package/src/lib/directives/tooltip.directive.ts +0 -292
  140. package/src/lib/slots/__tests__/slot.utils.spec.ts +0 -377
  141. package/src/lib/slots/copilot-slot.component.ts +0 -135
  142. package/src/lib/slots/index.ts +0 -3
  143. package/src/lib/slots/slot.types.ts +0 -64
  144. package/src/lib/slots/slot.utils.ts +0 -289
  145. package/src/lib/utils.ts +0 -10
  146. package/src/public-api.ts +0 -1
  147. package/src/services/resize-observer.service.ts +0 -181
  148. package/src/services/scroll-position.service.ts +0 -169
  149. package/src/styles/globals.css +0 -266
  150. package/src/styles/index.css +0 -3
  151. package/src/test-setup.ts +0 -15
  152. package/src/testing/index.ts +0 -3
  153. package/src/testing/testing.utils.ts +0 -248
  154. package/src/types/frontend-tool.ts +0 -44
  155. package/src/types/human-in-the-loop.ts +0 -52
  156. package/src/utils/__tests__/agent.utils.spec.ts +0 -234
  157. package/src/utils/__tests__/chat-config.utils.spec.ts +0 -306
  158. package/src/utils/__tests__/frontend-tool-inject.spec.ts +0 -350
  159. package/src/utils/__tests__/frontend-tool-integration.spec.ts +0 -199
  160. package/src/utils/__tests__/frontend-tool.utils.spec.ts +0 -272
  161. package/src/utils/__tests__/human-in-the-loop.utils.spec.ts +0 -365
  162. package/src/utils/agent-context.utils.ts +0 -133
  163. package/src/utils/agent.utils.ts +0 -239
  164. package/src/utils/chat-config.utils.ts +0 -221
  165. package/src/utils/copilotkit.utils.ts +0 -20
  166. package/src/utils/frontend-tool.utils.ts +0 -266
  167. package/src/utils/human-in-the-loop.utils.ts +0 -359
  168. package/tsconfig.spec.json +0 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@copilotkitnext/angular",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "Angular library for CopilotKit",
5
5
  "main": "dist/fesm2022/copilotkitnext-angular.mjs",
6
6
  "module": "dist/fesm2022/copilotkitnext-angular.mjs",
@@ -21,30 +21,34 @@
21
21
  "dependencies": {
22
22
  "@ag-ui/client": "0.0.36-alpha.1",
23
23
  "@ag-ui/core": "0.0.36-alpha.1",
24
+ "clsx": "^2.1.1",
24
25
  "highlight.js": "^11.11.1",
25
26
  "katex": "^0.16.22",
26
27
  "lucide-angular": "^0.540.0",
27
28
  "marked": "^16.2.0",
28
29
  "rxjs": "^7.8.1",
30
+ "tailwind-merge": "^2.6.0",
29
31
  "zod": "^3.22.4",
30
- "@copilotkitnext/core": "0.0.2",
31
- "@copilotkitnext/shared": "0.0.2"
32
+ "@copilotkitnext/core": "0.0.4",
33
+ "@copilotkitnext/shared": "0.0.4"
32
34
  },
33
35
  "peerDependencies": {
34
- "@angular/cdk": "^19.0.0",
35
- "@angular/common": "^19.0.0",
36
- "@angular/core": "^19.0.0",
36
+ "@angular/cdk": "^18.0.0 || ^19.0.0",
37
+ "@angular/common": "^18.0.0 || ^19.0.0",
38
+ "@angular/core": "^18.0.0 || ^19.0.0",
37
39
  "rxjs": "^7.8.0",
38
40
  "tslib": "^2.6.0"
39
41
  },
40
42
  "devDependencies": {
41
- "@angular/cdk": "^19.0.0",
42
- "@angular/common": "^19.0.0",
43
- "@angular/compiler": "^19.0.0",
44
- "@angular/compiler-cli": "^19.0.0",
45
- "@angular/core": "^19.0.0",
46
- "@angular/platform-browser": "^19.0.0",
47
- "@angular/platform-browser-dynamic": "^19.0.0",
43
+ "@analogjs/vite-plugin-angular": "^1.20.2",
44
+ "@analogjs/vitest-angular": "^1.20.2",
45
+ "@angular/cdk": "^18.0.0",
46
+ "@angular/common": "^18.0.0",
47
+ "@angular/compiler": "^18.0.0",
48
+ "@angular/compiler-cli": "^18.0.0",
49
+ "@angular/core": "^18.0.0",
50
+ "@angular/platform-browser": "^18.0.0",
51
+ "@angular/platform-browser-dynamic": "^18.0.0",
48
52
  "@eslint/js": "^9.30.0",
49
53
  "@lucide/build-icons": "^1.1.0",
50
54
  "@tailwindcss/cli": "^4.1.11",
@@ -54,22 +58,21 @@
54
58
  "@types/node": "^22.5.1",
55
59
  "@vitest/ui": "^2.0.5",
56
60
  "autoprefixer": "^10.4.16",
57
- "clsx": "^2.1.1",
58
61
  "concurrently": "^9.1.0",
59
62
  "jsdom": "^24.0.0",
60
- "ng-packagr": "^19.0.0",
63
+ "ng-packagr": "^18.0.0",
61
64
  "postcss": "^8.4.31",
62
65
  "reflect-metadata": "^0.2.2",
63
66
  "rimraf": "^6.0.1",
64
67
  "rxjs": "^7.8.1",
65
- "tailwind-merge": "^2.6.0",
66
68
  "tailwindcss": "^4.0.8",
67
69
  "tslib": "^2.8.1",
68
70
  "tw-animate-css": "^1.3.5",
69
- "typescript": "~5.8.2",
71
+ "typescript": "~5.4.5",
70
72
  "typescript-eslint": "^8.35.0",
73
+ "vite": "^7.1.4",
71
74
  "vitest": "^2.0.5",
72
- "zone.js": "^0.15.0",
75
+ "zone.js": "^0.14.0",
73
76
  "@copilotkitnext/typescript-config": "0.0.0",
74
77
  "@copilotkitnext/eslint-config": "0.0.0"
75
78
  },
package/vitest.config.mts CHANGED
@@ -1,34 +1,45 @@
1
- import { defineConfig } from 'vitest/config';
2
- import { resolve } from 'path';
1
+ /// <reference types="vitest" />
2
+ import { defineConfig } from 'vite';
3
+ import angular from '@analogjs/vite-plugin-angular';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { dirname, resolve } from 'node:path';
3
6
 
4
- export default defineConfig({
5
- esbuild: {
6
- target: 'es2022',
7
- tsconfigRaw: {
8
- compilerOptions: {
9
- experimentalDecorators: true,
10
- emitDecoratorMetadata: true,
11
- useDefineForClassFields: false
12
- }
13
- }
7
+ const __dirname = dirname(fileURLToPath(import.meta.url));
8
+ const r = (...p: string[]) => resolve(__dirname, ...p);
9
+
10
+ export default defineConfig(({ mode }) => ({
11
+ plugins: [angular()],
12
+ resolve: {
13
+ dedupe: [
14
+ '@angular/core',
15
+ '@angular/common',
16
+ '@angular/platform-browser',
17
+ '@angular/platform-browser-dynamic',
18
+ '@angular/compiler',
19
+ '@angular/core/testing',
20
+ ],
14
21
  },
15
22
  test: {
16
23
  globals: true,
17
24
  environment: 'jsdom',
18
- setupFiles: ['./src/test-setup.ts'],
19
- include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
25
+ setupFiles: [r('src/test-setup.ts')], // Use absolute path
26
+ include: ['src/**/*.{spec,test}.{ts,tsx}'],
27
+ pool: 'threads',
28
+ poolOptions: { threads: { singleThread: true } },
20
29
  coverage: {
21
30
  provider: 'v8',
22
31
  reporter: ['text', 'json', 'html'],
23
32
  exclude: [
24
33
  'node_modules/',
25
34
  'dist/',
26
- '*.config.ts',
35
+ '*.config.*',
27
36
  'src/test-setup.ts',
28
- 'src/**/*.spec.ts',
29
37
  'src/index.ts',
30
- 'src/public-api.ts'
31
- ]
32
- }
33
- }
34
- });
38
+ 'src/public-api.ts',
39
+ ],
40
+ },
41
+ },
42
+ define: {
43
+ 'import.meta.vitest': mode !== 'production',
44
+ },
45
+ }));
@@ -1,38 +0,0 @@
1
-
2
- 
3
- > @copilotkitnext/angular@0.0.1 build /Users/mme/Code/vnext_experimental/packages/angular
4
- > ng-packagr -p ng-package.json && npm run build:css
5
-
6
- Building Angular Package
7
- 
8
- ------------------------------------------------------------------------------
9
- Building entry point '@copilotkitnext/angular'
10
- ------------------------------------------------------------------------------
11
- ⠋ Compiling with Angular sources in Ivy partial compilation mode.⠙ Compiling with Angular sources in Ivy partial compilation mode.⠹ Compiling with Angular sources in Ivy partial compilation mode.⠸ Compiling with Angular sources in Ivy partial compilation mode.
12
- ✔ Compiling with Angular sources in Ivy partial compilation mode.
13
- ⠋ Writing FESM bundles✔ Writing FESM bundles
14
- ⠋ Copying assets✔ Copying assets
15
- ⠋ Writing package manifestWARNING: Found a conflicting export condition for ".". The "types" condition would be overridden by ng-packagr. Please unset it.
16
- WARNING: Found a conflicting export condition for ".". The "default" condition would be overridden by ng-packagr. Please unset it.
17
- ⚠ 'tslib' is no longer recommended to be used as a 'peerDependencies'. Moving it to 'dependencies'.
18
- ℹ Removing scripts section in package.json as it's considered a potential security vulnerability.
19
- ℹ Removing devDependencies section in package.json.
20
- ✔ Writing package manifest
21
- ✔ Built @copilotkitnext/angular
22
- 
23
- ------------------------------------------------------------------------------
24
- Built Angular Package
25
-  - from: /Users/mme/Code/vnext_experimental/packages/angular
26
-  - to: /Users/mme/Code/vnext_experimental/packages/angular/dist
27
- ------------------------------------------------------------------------------
28
- 
29
- Build at: 2025-09-03T13:18:59.922Z - Time: 3451ms
30
- 
31
-
32
- > @copilotkitnext/angular@0.0.1 build:css
33
- > npx @tailwindcss/cli -i ./src/styles/globals.css -o ./dist/styles.css
34
-
35
- ⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦≈ tailwindcss v4.1.11
36
-
37
- Done in 110ms
38
- ⠙⠙
File without changes
@@ -1,71 +0,0 @@
1
-
2
- > @copilotkitnext/angular@0.0.2 test /Users/mme/Code/CopilotKit2/packages/angular
3
- > vitest run
4
-
5
-
6
- RUN v2.1.9 /Users/mme/Code/CopilotKit2/packages/angular
7
-
8
- ✓ src/utils/__tests__/chat-config.utils.spec.ts (17 tests) 63ms
9
- ✓ src/directives/__tests__/copilotkit-chat-config.directive.spec.ts (11 tests) 105ms
10
- ✓ src/directives/__tests__/copilotkit-agent-context.directive.spec.ts (15 tests) 128ms
11
- ✓ src/directives/__tests__/copilotkit-human-in-the-loop.directive.spec.ts (11 tests) 126ms
12
- ✓ src/utils/__tests__/human-in-the-loop.utils.spec.ts (13 tests) 96ms
13
- ✓ src/lib/slots/__tests__/slot.utils.spec.ts (23 tests) 172ms
14
- stderr | src/core/__tests__/copilotkit.service.spec.ts > CopilotKitService > Frontend Tools Support > should warn when frontend tools array changes
15
- frontendTools must be a stable array. To add/remove tools dynamically, use dynamic tool registration.
16
-
17
- stderr | src/core/__tests__/copilotkit.service.spec.ts > CopilotKitService > Human-in-the-Loop Support > should create placeholder handlers for human-in-the-loop tools
18
- Human-in-the-loop tool 'getUserInput' called but no interactive handler is set up.
19
-
20
- stderr | src/core/__tests__/copilotkit.service.spec.ts > CopilotKitService > Human-in-the-Loop Support > should warn when human-in-the-loop array changes
21
- humanInTheLoop must be a stable array. To add/remove human-in-the-loop tools dynamically, use dynamic tool registration.
22
-
23
- ✓ src/core/__tests__/copilotkit.service.spec.ts (40 tests | 1 skipped) 251ms
24
- stderr | src/components/chat/__tests__/copilot-chat-input.component.spec.ts > CopilotChatInputComponent > Mode Switching > should switch to audio recorder in transcribe mode
25
- Error: Not implemented: HTMLCanvasElement.prototype.getContext (without installing the canvas npm package)
26
- at module.exports (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/jsdom@24.1.3/node_modules/jsdom/lib/jsdom/browser/not-implemented.js:9:17)
27
- at HTMLCanvasElementImpl.getContext (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/jsdom@24.1.3/node_modules/jsdom/lib/jsdom/living/nodes/HTMLCanvasElement-impl.js:42:5)
28
- at HTMLCanvasElement.getContext (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/jsdom@24.1.3/node_modules/jsdom/lib/jsdom/living/generated/HTMLCanvasElement.js:131:58)
29
- at CopilotChatAudioRecorderComponent.startAnimation (/Users/mme/Code/CopilotKit2/packages/angular/src/components/chat/copilot-chat-audio-recorder.component.ts:150:24)
30
- at CopilotChatAudioRecorderComponent.ngAfterViewInit (/Users/mme/Code/CopilotKit2/packages/angular/src/components/chat/copilot-chat-audio-recorder.component.ts:76:10)
31
- at callHookInternal (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/core/src/render3/hooks.ts:290:10)
32
- at callHook (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/core/src/render3/hooks.ts:319:7)
33
- at callHooks (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/core/src/render3/hooks.ts:270:9)
34
- at executeInitAndCheckHooks (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/core/src/render3/hooks.ts:205:5)
35
- at refreshView (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/core/src/render3/instructions/change_detection.ts:326:11) undefined
36
-
37
- stderr | src/components/chat/__tests__/copilot-chat-input.component.spec.ts > CopilotChatInputComponent > Mode Switching > should switch back to textarea from transcribe mode
38
- Error: Not implemented: HTMLCanvasElement.prototype.getContext (without installing the canvas npm package)
39
- at module.exports (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/jsdom@24.1.3/node_modules/jsdom/lib/jsdom/browser/not-implemented.js:9:17)
40
- at HTMLCanvasElementImpl.getContext (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/jsdom@24.1.3/node_modules/jsdom/lib/jsdom/living/nodes/HTMLCanvasElement-impl.js:42:5)
41
- at HTMLCanvasElement.getContext (/Users/mme/Code/CopilotKit2/node_modules/.pnpm/jsdom@24.1.3/node_modules/jsdom/lib/jsdom/living/generated/HTMLCanvasElement.js:131:58)
42
- at CopilotChatAudioRecorderComponent.startAnimation (/Users/mme/Code/CopilotKit2/packages/angular/src/components/chat/copilot-chat-audio-recorder.component.ts:150:24)
43
- at CopilotChatAudioRecorderComponent.ngAfterViewInit (/Users/mme/Code/CopilotKit2/packages/angular/src/components/chat/copilot-chat-audio-recorder.component.ts:76:10)
44
- at callHookInternal (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/core/src/render3/hooks.ts:290:10)
45
- at callHook (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/core/src/render3/hooks.ts:319:7)
46
- at callHooks (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/core/src/render3/hooks.ts:270:9)
47
- at executeInitAndCheckHooks (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/core/src/render3/hooks.ts:205:5)
48
- at refreshView (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/core/src/render3/instructions/change_detection.ts:326:11) undefined
49
-
50
- ✓ src/components/chat/__tests__/copilot-chat-input.component.spec.ts (31 tests) 784ms
51
- ✓ src/core/chat-configuration/__tests__/chat-configuration.service.spec.ts (19 tests) 72ms
52
- ✓ src/utils/__tests__/frontend-tool-inject.spec.ts (10 tests) 168ms
53
- ✓ src/utils/__tests__/frontend-tool.utils.spec.ts (12 tests) 77ms
54
- ✓ src/utils/__tests__/agent.utils.spec.ts (11 tests) 122ms
55
- ✓ src/core/__tests__/copilotkit.service.wildcard.spec.ts (9 tests) 38ms
56
- ✓ src/components/chat/__tests__/copilot-chat-message-view.component.spec.ts (25 tests) 953ms
57
- ✓ CopilotChatMessageViewComponent > Performance > should handle large message lists efficiently 366ms
58
- ✓ src/components/chat/__tests__/copilot-chat-assistant-message.component.spec.ts (16 tests) 339ms
59
- ✓ src/directives/__tests__/copilotkit-agent.directive.spec.ts (7 tests) 94ms
60
- ↓ src/directives/__tests__/copilotkit-frontend-tool-simple.directive.spec.ts (5 tests | 5 skipped)
61
- ✓ src/utils/__tests__/frontend-tool-integration.spec.ts (10 tests) 36ms
62
- ✓ src/directives/__tests__/copilotkit-config.directive.spec.ts (2 tests) 43ms
63
- ✓ src/directives/__tests__/copilotkit-frontend-tool.directive.spec.ts (3 tests) 51ms
64
- ✓ src/components/chat/__tests__/copilot-chat-user-message.component.spec.ts (20 tests | 3 skipped) 2336ms
65
- ✓ CopilotChatUserMessageComponent > should copy message content to clipboard when copy button is clicked 2017ms
66
-
67
- Test Files 20 passed | 1 skipped (21)
68
- Tests 301 passed | 9 skipped (310)
69
- Start at 10:46:42
70
- Duration 5.25s (transform 1.09s, setup 7.16s, collect 3.73s, tests 6.06s, environment 9.62s, prepare 1.91s)
71
-
package/ng-package.json DELETED
@@ -1,19 +0,0 @@
1
- {
2
- "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
- "dest": "dist",
4
- "lib": {
5
- "entryFile": "src/index.ts"
6
- },
7
- "allowedNonPeerDependencies": [
8
- "@ag-ui/client",
9
- "@ag-ui/core",
10
- "@copilotkitnext/shared",
11
- "@copilotkitnext/core",
12
- "rxjs",
13
- "zod",
14
- "lucide-angular",
15
- "highlight.js",
16
- "katex",
17
- "marked"
18
- ]
19
- }
@@ -1,282 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
- import { Component } from '@angular/core';
3
- import { CommonModule } from '@angular/common';
4
- import { CopilotChatAssistantMessageComponent } from '../copilot-chat-assistant-message.component';
5
- import { CopilotChatAssistantMessageRendererComponent } from '../copilot-chat-assistant-message-renderer.component';
6
- import {
7
- CopilotChatAssistantMessageCopyButtonComponent,
8
- CopilotChatAssistantMessageThumbsUpButtonComponent,
9
- CopilotChatAssistantMessageThumbsDownButtonComponent,
10
- CopilotChatAssistantMessageReadAloudButtonComponent,
11
- CopilotChatAssistantMessageRegenerateButtonComponent
12
- } from '../copilot-chat-assistant-message-buttons.component';
13
- import { CopilotChatAssistantMessageToolbarComponent } from '../copilot-chat-assistant-message-toolbar.component';
14
- import { CopilotChatViewHandlersService } from '../copilot-chat-view-handlers.service';
15
- import { provideCopilotKit } from '../../../core/copilotkit.providers';
16
- import { provideCopilotChatConfiguration } from '../../../core/chat-configuration/chat-configuration.providers';
17
- import { AssistantMessage } from '@ag-ui/client';
18
-
19
- describe('CopilotChatAssistantMessageComponent', () => {
20
- let component: CopilotChatAssistantMessageComponent;
21
- let fixture: ComponentFixture<CopilotChatAssistantMessageComponent>;
22
-
23
- const mockMessage: AssistantMessage = {
24
- id: 'test-msg-1',
25
- role: 'assistant',
26
- content: 'Hello! This is a test message with **bold text** and *italic text*.',
27
- createdAt: new Date()
28
- };
29
-
30
- beforeEach(async () => {
31
- await TestBed.configureTestingModule({
32
- imports: [
33
- CommonModule,
34
- CopilotChatAssistantMessageComponent,
35
- CopilotChatAssistantMessageRendererComponent,
36
- CopilotChatAssistantMessageCopyButtonComponent,
37
- CopilotChatAssistantMessageThumbsUpButtonComponent,
38
- CopilotChatAssistantMessageThumbsDownButtonComponent,
39
- CopilotChatAssistantMessageReadAloudButtonComponent,
40
- CopilotChatAssistantMessageRegenerateButtonComponent,
41
- CopilotChatAssistantMessageToolbarComponent
42
- ],
43
- providers: [
44
- provideCopilotKit({}),
45
- provideCopilotChatConfiguration({
46
- labels: {
47
- assistantMessageToolbarCopyMessageLabel: 'Copy',
48
- assistantMessageToolbarThumbsUpLabel: 'Good',
49
- assistantMessageToolbarThumbsDownLabel: 'Bad',
50
- assistantMessageToolbarReadAloudLabel: 'Read',
51
- assistantMessageToolbarRegenerateLabel: 'Regenerate'
52
- }
53
- }),
54
- CopilotChatViewHandlersService
55
- ]
56
- }).compileComponents();
57
-
58
- fixture = TestBed.createComponent(CopilotChatAssistantMessageComponent);
59
- component = fixture.componentInstance;
60
- component.message = mockMessage;
61
- fixture.detectChanges();
62
- });
63
-
64
- it('should create', () => {
65
- expect(component).toBeTruthy();
66
- });
67
-
68
- it('should display the message content', () => {
69
- const element = fixture.nativeElement;
70
- expect(element.textContent).toContain('Hello! This is a test message');
71
- });
72
-
73
- it('should set data-message-id attribute', () => {
74
- const element = fixture.nativeElement.querySelector('[data-message-id]');
75
- expect(element).toBeTruthy();
76
- expect(element.getAttribute('data-message-id')).toBe('test-msg-1');
77
- });
78
-
79
- it('should show toolbar when toolbarVisible is true', () => {
80
- component.toolbarVisible = true;
81
- fixture.detectChanges();
82
- const toolbar = fixture.nativeElement.querySelector('[copilotChatAssistantMessageToolbar]');
83
- expect(toolbar).toBeTruthy();
84
- });
85
-
86
- it('should hide toolbar when toolbarVisible is false', () => {
87
- // Create a fresh instance with toolbarVisible set to false from the start
88
- TestBed.resetTestingModule();
89
- TestBed.configureTestingModule({
90
- imports: [
91
- CommonModule,
92
- CopilotChatAssistantMessageComponent,
93
- CopilotChatAssistantMessageRendererComponent,
94
- CopilotChatAssistantMessageToolbarComponent
95
- ],
96
- providers: [
97
- provideCopilotKit({}),
98
- provideCopilotChatConfiguration({})
99
- ]
100
- });
101
-
102
- const newFixture = TestBed.createComponent(CopilotChatAssistantMessageComponent);
103
- const newComponent = newFixture.componentInstance;
104
- newComponent.message = mockMessage;
105
- newComponent.toolbarVisible = false;
106
- newFixture.detectChanges();
107
-
108
- const toolbar = newFixture.nativeElement.querySelector('[copilotChatAssistantMessageToolbar]');
109
- expect(toolbar).toBeFalsy();
110
- });
111
-
112
- it('should emit thumbsUp event when button is clicked', () => {
113
- let emittedEvent: any;
114
- component.thumbsUp.subscribe((event) => {
115
- emittedEvent = event;
116
- });
117
-
118
- component.handleThumbsUp();
119
- expect(emittedEvent).toEqual({ message: mockMessage });
120
- });
121
-
122
- it('should emit thumbsDown event when button is clicked', () => {
123
- let emittedEvent: any;
124
- component.thumbsDown.subscribe((event) => {
125
- emittedEvent = event;
126
- });
127
-
128
- component.handleThumbsDown();
129
- expect(emittedEvent).toEqual({ message: mockMessage });
130
- });
131
-
132
- it('should emit readAloud event when button is clicked', () => {
133
- let emittedEvent: any;
134
- component.readAloud.subscribe((event) => {
135
- emittedEvent = event;
136
- });
137
-
138
- component.handleReadAloud();
139
- expect(emittedEvent).toEqual({ message: mockMessage });
140
- });
141
-
142
- it('should emit regenerate event when button is clicked', () => {
143
- let emittedEvent: any;
144
- component.regenerate.subscribe((event) => {
145
- emittedEvent = event;
146
- });
147
-
148
- component.handleRegenerate();
149
- expect(emittedEvent).toEqual({ message: mockMessage });
150
- });
151
-
152
- it('should handle empty message content', () => {
153
- component.message = {
154
- ...mockMessage,
155
- content: ''
156
- };
157
- fixture.detectChanges();
158
- expect(component).toBeTruthy();
159
- });
160
-
161
- it('should support custom CSS class', () => {
162
- const customClass = 'custom-test-class';
163
- component.inputClass = customClass;
164
- fixture.detectChanges();
165
-
166
- const element = fixture.nativeElement.querySelector('div');
167
- expect(element.className).toContain(customClass);
168
- });
169
- });
170
-
171
- describe('CopilotChatAssistantMessageComponent with code blocks', () => {
172
- let component: CopilotChatAssistantMessageComponent;
173
- let fixture: ComponentFixture<CopilotChatAssistantMessageComponent>;
174
-
175
- const codeMessage: AssistantMessage = {
176
- id: 'test-code-1',
177
- role: 'assistant',
178
- content: `Here's a code example:
179
- \`\`\`typescript
180
- function hello(name: string): string {
181
- return \`Hello, \${name}!\`;
182
- }
183
- \`\`\``,
184
- createdAt: new Date()
185
- };
186
-
187
- beforeEach(async () => {
188
- await TestBed.configureTestingModule({
189
- imports: [
190
- CommonModule,
191
- CopilotChatAssistantMessageComponent,
192
- CopilotChatAssistantMessageRendererComponent
193
- ],
194
- providers: [
195
- provideCopilotKit({}),
196
- provideCopilotChatConfiguration({})
197
- ]
198
- }).compileComponents();
199
-
200
- fixture = TestBed.createComponent(CopilotChatAssistantMessageComponent);
201
- component = fixture.componentInstance;
202
- component.message = codeMessage;
203
- fixture.detectChanges();
204
- });
205
-
206
- it('should render code blocks', () => {
207
- const element = fixture.nativeElement;
208
- const codeBlock = element.querySelector('.code-block-container');
209
- expect(codeBlock).toBeTruthy();
210
- });
211
-
212
- it('should display language label for code blocks', () => {
213
- const element = fixture.nativeElement;
214
- const languageLabel = element.querySelector('.code-block-language');
215
- expect(languageLabel).toBeTruthy();
216
- expect(languageLabel.textContent).toBe('typescript');
217
- });
218
-
219
- it('should have copy button for code blocks', () => {
220
- const element = fixture.nativeElement;
221
- const copyButton = element.querySelector('.code-block-copy-button');
222
- expect(copyButton).toBeTruthy();
223
- });
224
- });
225
-
226
- describe('CopilotChatAssistantMessageComponent with custom slots', () => {
227
- @Component({
228
- selector: 'test-host',
229
- template: `
230
- <copilot-chat-assistant-message [message]="message">
231
- <ng-template #markdownRenderer let-content="content">
232
- <div class="custom-renderer">{{ content }}</div>
233
- </ng-template>
234
-
235
- <ng-template #copyButton let-onClick="onClick">
236
- <button class="custom-copy-btn" (click)="onClick()">Custom Copy</button>
237
- </ng-template>
238
- </copilot-chat-assistant-message>
239
- `,
240
- standalone: true,
241
- imports: [CommonModule, CopilotChatAssistantMessageComponent]
242
- })
243
- class TestHostComponent {
244
- message: AssistantMessage = {
245
- id: 'test-custom-1',
246
- role: 'assistant',
247
- content: 'Custom slot test message',
248
- createdAt: new Date()
249
- };
250
- }
251
-
252
- let component: TestHostComponent;
253
- let fixture: ComponentFixture<TestHostComponent>;
254
-
255
- beforeEach(async () => {
256
- await TestBed.configureTestingModule({
257
- imports: [TestHostComponent],
258
- providers: [
259
- provideCopilotKit({}),
260
- provideCopilotChatConfiguration({})
261
- ]
262
- }).compileComponents();
263
-
264
- fixture = TestBed.createComponent(TestHostComponent);
265
- component = fixture.componentInstance;
266
- fixture.detectChanges();
267
- });
268
-
269
- it('should use custom markdown renderer slot', () => {
270
- const element = fixture.nativeElement;
271
- const customRenderer = element.querySelector('.custom-renderer');
272
- expect(customRenderer).toBeTruthy();
273
- expect(customRenderer.textContent).toBe('Custom slot test message');
274
- });
275
-
276
- it('should use custom copy button slot', () => {
277
- const element = fixture.nativeElement;
278
- const customCopyBtn = element.querySelector('.custom-copy-btn');
279
- expect(customCopyBtn).toBeTruthy();
280
- expect(customCopyBtn.textContent).toBe('Custom Copy');
281
- });
282
- });