@copilotkitnext/angular 0.0.1 → 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 (171) hide show
  1. package/README.md +248 -0
  2. package/dist/README.md +248 -0
  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/dist/styles.css +0 -27
  72. package/package.json +23 -20
  73. package/vitest.config.mts +32 -21
  74. package/.turbo/turbo-build.log +0 -39
  75. package/.turbo/turbo-check-types.log +0 -0
  76. package/.turbo/turbo-test.log +0 -71
  77. package/README-agent-context.md +0 -310
  78. package/ng-package.json +0 -19
  79. package/slots.md +0 -331
  80. package/src/components/chat/__tests__/copilot-chat-assistant-message.component.spec.ts +0 -282
  81. package/src/components/chat/__tests__/copilot-chat-input.component.spec.ts +0 -419
  82. package/src/components/chat/__tests__/copilot-chat-message-view.component.spec.ts +0 -372
  83. package/src/components/chat/__tests__/copilot-chat-user-message.component.spec.ts +0 -249
  84. package/src/components/chat/copilot-chat-assistant-message-buttons.component.ts +0 -292
  85. package/src/components/chat/copilot-chat-assistant-message-renderer.component.ts +0 -472
  86. package/src/components/chat/copilot-chat-assistant-message-toolbar.component.ts +0 -29
  87. package/src/components/chat/copilot-chat-assistant-message.component.ts +0 -463
  88. package/src/components/chat/copilot-chat-assistant-message.types.ts +0 -50
  89. package/src/components/chat/copilot-chat-audio-recorder.component.ts +0 -241
  90. package/src/components/chat/copilot-chat-buttons.component.ts +0 -308
  91. package/src/components/chat/copilot-chat-buttons.component.ts.bak +0 -471
  92. package/src/components/chat/copilot-chat-input-defaults.ts +0 -47
  93. package/src/components/chat/copilot-chat-input.component.ts +0 -512
  94. package/src/components/chat/copilot-chat-input.types.ts +0 -148
  95. package/src/components/chat/copilot-chat-message-view-cursor.component.ts +0 -51
  96. package/src/components/chat/copilot-chat-message-view.component.ts +0 -233
  97. package/src/components/chat/copilot-chat-message-view.types.ts +0 -39
  98. package/src/components/chat/copilot-chat-textarea.component.ts +0 -220
  99. package/src/components/chat/copilot-chat-tool-calls-view.component.ts +0 -261
  100. package/src/components/chat/copilot-chat-toolbar.component.ts +0 -35
  101. package/src/components/chat/copilot-chat-tools-menu.component.ts +0 -185
  102. package/src/components/chat/copilot-chat-user-message-branch-navigation.component.ts +0 -121
  103. package/src/components/chat/copilot-chat-user-message-buttons.component.ts +0 -170
  104. package/src/components/chat/copilot-chat-user-message-renderer.component.ts +0 -37
  105. package/src/components/chat/copilot-chat-user-message-toolbar.component.ts +0 -37
  106. package/src/components/chat/copilot-chat-user-message.component.ts +0 -247
  107. package/src/components/chat/copilot-chat-user-message.types.ts +0 -42
  108. package/src/components/chat/copilot-chat-view-disclaimer.component.ts +0 -51
  109. package/src/components/chat/copilot-chat-view-feather.component.ts +0 -47
  110. package/src/components/chat/copilot-chat-view-handlers.service.ts +0 -14
  111. package/src/components/chat/copilot-chat-view-input-container.component.ts +0 -87
  112. package/src/components/chat/copilot-chat-view-scroll-to-bottom-button.component.ts +0 -79
  113. package/src/components/chat/copilot-chat-view-scroll-view.component.ts +0 -322
  114. package/src/components/chat/copilot-chat-view.component.ts +0 -420
  115. package/src/components/chat/copilot-chat-view.types.ts +0 -52
  116. package/src/components/chat/copilot-chat.component.ts +0 -232
  117. package/src/components/copilotkit-tool-render.component.ts +0 -169
  118. package/src/core/__tests__/copilotkit.service.spec.ts +0 -1051
  119. package/src/core/__tests__/copilotkit.service.wildcard.spec.ts +0 -316
  120. package/src/core/chat-configuration/__tests__/chat-configuration.service.spec.ts +0 -287
  121. package/src/core/chat-configuration/chat-configuration.providers.ts +0 -71
  122. package/src/core/chat-configuration/chat-configuration.service.ts +0 -162
  123. package/src/core/chat-configuration/chat-configuration.types.ts +0 -57
  124. package/src/core/copilotkit.providers.ts +0 -59
  125. package/src/core/copilotkit.service.ts +0 -542
  126. package/src/core/copilotkit.types.ts +0 -132
  127. package/src/directives/__tests__/copilotkit-agent-context.directive.spec.ts +0 -384
  128. package/src/directives/__tests__/copilotkit-agent.directive.spec.ts +0 -253
  129. package/src/directives/__tests__/copilotkit-chat-config.directive.spec.ts +0 -385
  130. package/src/directives/__tests__/copilotkit-config.directive.spec.ts +0 -69
  131. package/src/directives/__tests__/copilotkit-frontend-tool-simple.directive.spec.ts +0 -60
  132. package/src/directives/__tests__/copilotkit-frontend-tool.directive.spec.ts +0 -108
  133. package/src/directives/__tests__/copilotkit-human-in-the-loop.directive.spec.ts +0 -452
  134. package/src/directives/copilotkit-agent-context.directive.ts +0 -138
  135. package/src/directives/copilotkit-agent.directive.ts +0 -225
  136. package/src/directives/copilotkit-chat-config.directive.ts +0 -241
  137. package/src/directives/copilotkit-config.directive.ts +0 -81
  138. package/src/directives/copilotkit-frontend-tool.directive.ts +0 -145
  139. package/src/directives/copilotkit-human-in-the-loop.directive.ts +0 -281
  140. package/src/directives/stick-to-bottom.directive.ts +0 -204
  141. package/src/index.ts +0 -105
  142. package/src/lib/directives/tooltip.directive.ts +0 -292
  143. package/src/lib/slots/__tests__/slot.utils.spec.ts +0 -377
  144. package/src/lib/slots/copilot-slot.component.ts +0 -135
  145. package/src/lib/slots/index.ts +0 -3
  146. package/src/lib/slots/slot.types.ts +0 -64
  147. package/src/lib/slots/slot.utils.ts +0 -289
  148. package/src/lib/utils.ts +0 -10
  149. package/src/public-api.ts +0 -1
  150. package/src/services/resize-observer.service.ts +0 -181
  151. package/src/services/scroll-position.service.ts +0 -169
  152. package/src/styles/globals.css +0 -266
  153. package/src/styles/index.css +0 -3
  154. package/src/test-setup.ts +0 -15
  155. package/src/testing/index.ts +0 -3
  156. package/src/testing/testing.utils.ts +0 -248
  157. package/src/types/frontend-tool.ts +0 -44
  158. package/src/types/human-in-the-loop.ts +0 -52
  159. package/src/utils/__tests__/agent.utils.spec.ts +0 -234
  160. package/src/utils/__tests__/chat-config.utils.spec.ts +0 -306
  161. package/src/utils/__tests__/frontend-tool-inject.spec.ts +0 -350
  162. package/src/utils/__tests__/frontend-tool-integration.spec.ts +0 -199
  163. package/src/utils/__tests__/frontend-tool.utils.spec.ts +0 -272
  164. package/src/utils/__tests__/human-in-the-loop.utils.spec.ts +0 -365
  165. package/src/utils/agent-context.utils.ts +0 -133
  166. package/src/utils/agent.utils.ts +0 -239
  167. package/src/utils/chat-config.utils.ts +0 -221
  168. package/src/utils/copilotkit.utils.ts +0 -20
  169. package/src/utils/frontend-tool.utils.ts +0 -266
  170. package/src/utils/human-in-the-loop.utils.ts +0 -359
  171. package/tsconfig.spec.json +0 -12
package/dist/styles.css CHANGED
@@ -7,11 +7,9 @@
7
7
  "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
8
8
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
9
9
  "Courier New", monospace;
10
- --color-blue-500: oklch(62.3% 0.214 259.815);
11
10
  --color-gray-50: oklch(98.5% 0.002 247.839);
12
11
  --color-gray-100: oklch(96.7% 0.003 264.542);
13
12
  --color-gray-200: oklch(92.8% 0.006 264.531);
14
- --color-gray-300: oklch(87.2% 0.01 258.338);
15
13
  --color-gray-600: oklch(44.6% 0.03 256.802);
16
14
  --color-gray-700: oklch(37.3% 0.034 259.733);
17
15
  --color-gray-800: oklch(27.8% 0.033 256.848);
@@ -20,7 +18,6 @@
20
18
  --color-white: #fff;
21
19
  --spacing: 0.25rem;
22
20
  --container-3xl: 48rem;
23
- --container-4xl: 56rem;
24
21
  --text-xs: 0.75rem;
25
22
  --text-xs--line-height: calc(1 / 0.75);
26
23
  --text-sm: 0.875rem;
@@ -188,9 +185,6 @@
188
185
  .invisible {
189
186
  visibility: hidden;
190
187
  }
191
- .visible {
192
- visibility: visible;
193
- }
194
188
  .absolute {
195
189
  position: absolute;
196
190
  }
@@ -768,9 +762,6 @@
768
762
  .max-w-3xl {
769
763
  max-width: var(--container-3xl);
770
764
  }
771
- .max-w-4xl {
772
- max-width: var(--container-4xl);
773
- }
774
765
  .max-w-\[80\%\] {
775
766
  max-width: 80%;
776
767
  }
@@ -856,10 +847,6 @@
856
847
  border-style: var(--tw-border-style);
857
848
  border-width: 1px;
858
849
  }
859
- .border-2 {
860
- border-style: var(--tw-border-style);
861
- border-width: 2px;
862
- }
863
850
  .border-none {
864
851
  --tw-border-style: none;
865
852
  border-style: none;
@@ -867,15 +854,9 @@
867
854
  .border-gray-200 {
868
855
  border-color: var(--color-gray-200);
869
856
  }
870
- .border-gray-300 {
871
- border-color: var(--color-gray-300);
872
- }
873
857
  .bg-black {
874
858
  background-color: var(--color-black);
875
859
  }
876
- .bg-blue-500 {
877
- background-color: var(--color-blue-500);
878
- }
879
860
  .bg-foreground {
880
861
  background-color: var(--foreground);
881
862
  }
@@ -917,9 +898,6 @@
917
898
  .p-1 {
918
899
  padding: calc(var(--spacing) * 1);
919
900
  }
920
- .p-4 {
921
- padding: calc(var(--spacing) * 4);
922
- }
923
901
  .p-5 {
924
902
  padding: calc(var(--spacing) * 5);
925
903
  }
@@ -1115,11 +1093,6 @@
1115
1093
  }
1116
1094
  }
1117
1095
  }
1118
- .focus\:border-blue-500 {
1119
- &:focus {
1120
- border-color: var(--color-blue-500);
1121
- }
1122
- }
1123
1096
  .focus\:ring-2 {
1124
1097
  &:focus {
1125
1098
  --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@copilotkitnext/angular",
3
- "version": "0.0.1",
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.1",
31
- "@copilotkitnext/shared": "0.0.1"
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,24 +58,23 @@
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",
73
- "@copilotkitnext/eslint-config": "0.0.0",
74
- "@copilotkitnext/typescript-config": "0.0.0"
75
+ "zone.js": "^0.14.0",
76
+ "@copilotkitnext/typescript-config": "0.0.0",
77
+ "@copilotkitnext/eslint-config": "0.0.0"
75
78
  },
76
79
  "publishConfig": {
77
80
  "access": "public"
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,39 +0,0 @@
1
-
2
- > @copilotkitnext/angular@0.0.2 build /Users/mme/Code/CopilotKit2/packages/angular
3
- > ng-packagr -p ng-package.json && npm run build:css
4
-
5
- Building Angular Package
6
-
7
- ------------------------------------------------------------------------------
8
- Building entry point '@copilotkitnext/angular'
9
- ------------------------------------------------------------------------------
10
- - Compiling with Angular sources in Ivy partial compilation mode.
11
-
12
- ✔ Compiling with Angular sources in Ivy partial compilation mode.
13
- ✔ Generating FESM bundles
14
- - Copying assets
15
- ✔ Copying assets
16
- - Writing package manifest
17
- WARNING: Found a conflicting export condition for ".". The "types" condition would be overridden by ng-packagr. Please unset it.
18
- WARNING: Found a conflicting export condition for ".". The "default" condition would be overridden by ng-packagr. Please unset it.
19
- ⚠ 'tslib' is no longer recommended to be used as a 'peerDependencies'. Moving it to 'dependencies'.
20
- ℹ Removing scripts section in package.json as it's considered a potential security vulnerability.
21
- ℹ Removing devDependencies section in package.json.
22
- ✔ Writing package manifest
23
- ✔ Built @copilotkitnext/angular
24
-
25
- ------------------------------------------------------------------------------
26
- Built Angular Package
27
- - from: /Users/mme/Code/CopilotKit2/packages/angular
28
- - to: /Users/mme/Code/CopilotKit2/packages/angular/dist
29
- ------------------------------------------------------------------------------
30
-
31
- Build at: 2025-09-03T08:46:48.296Z - Time: 5656ms
32
-
33
-
34
- > @copilotkitnext/angular@0.0.2 build:css
35
- > npx @tailwindcss/cli -i ./src/styles/globals.css -o ./dist/styles.css
36
-
37
- ≈ tailwindcss v4.1.11
38
-
39
- Done in 103ms
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
-
@@ -1,310 +0,0 @@
1
- # CopilotKit Angular - Agent Context
2
-
3
- This document demonstrates how to use agent context in the Angular version of CopilotKit.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- pnpm add @copilotkitnext/angular
9
- ```
10
-
11
- ## Usage
12
-
13
- ### 1. Directive Approach (Declarative)
14
-
15
- The directive approach is ideal for template-driven context management.
16
-
17
- #### Basic Usage
18
-
19
- ```typescript
20
- import { Component } from "@angular/core";
21
- import { CopilotKitAgentContextDirective } from "@copilotkitnext/angular";
22
-
23
- @Component({
24
- selector: "app-user-profile",
25
- template: `
26
- <div
27
- copilotkitAgentContext
28
- description="User profile data"
29
- [value]="userProfile"
30
- >
31
- <!-- Your component content -->
32
- </div>
33
- `,
34
- standalone: true,
35
- imports: [CopilotKitAgentContextDirective],
36
- })
37
- export class UserProfileComponent {
38
- userProfile = {
39
- id: 123,
40
- name: "John Doe",
41
- preferences: {
42
- theme: "dark",
43
- language: "en",
44
- },
45
- };
46
- }
47
- ```
48
-
49
- #### Dynamic Values with Signals
50
-
51
- ```typescript
52
- import { Component, signal, computed } from "@angular/core";
53
-
54
- @Component({
55
- selector: "app-counter",
56
- template: `
57
- <div
58
- copilotkitAgentContext
59
- description="Counter state"
60
- [value]="contextValue()"
61
- >
62
- <button (click)="increment()">Count: {{ count() }}</button>
63
- </div>
64
- `,
65
- })
66
- export class CounterComponent {
67
- count = signal(0);
68
-
69
- contextValue = computed(() => ({
70
- count: this.count(),
71
- doubled: this.count() * 2,
72
- timestamp: Date.now(),
73
- }));
74
-
75
- increment() {
76
- this.count.update((c) => c + 1);
77
- }
78
- }
79
- ```
80
-
81
- #### With Observables
82
-
83
- ```typescript
84
- import { Component } from "@angular/core";
85
- import { interval, map } from "rxjs";
86
- import { AsyncPipe } from "@angular/common";
87
-
88
- @Component({
89
- selector: "app-live-data",
90
- template: `
91
- <div
92
- copilotkitAgentContext
93
- description="Live data stream"
94
- [value]="liveData$ | async"
95
- >
96
- <!-- Component content -->
97
- </div>
98
- `,
99
- imports: [AsyncPipe, CopilotKitAgentContextDirective],
100
- })
101
- export class LiveDataComponent {
102
- liveData$ = interval(1000).pipe(
103
- map((tick) => ({
104
- iteration: tick,
105
- timestamp: new Date(),
106
- data: this.generateData(tick),
107
- }))
108
- );
109
- }
110
- ```
111
-
112
- #### Using Context Object
113
-
114
- ```typescript
115
- @Component({
116
- template: `
117
- <div [copilotkitAgentContext]="myContext">
118
- <!-- Content -->
119
- </div>
120
- `
121
- })
122
- export class MyComponent {
123
- myContext = {
124
- description: 'Application state',
125
- value: {
126
- route: '/dashboard',
127
- user: 'admin',
128
- settings: { ... }
129
- }
130
- };
131
- }
132
- ```
133
-
134
- ### 2. Programmatic Approach
135
-
136
- For services and components that need programmatic control.
137
-
138
- #### Basic Usage
139
-
140
- ```typescript
141
- import { Component, OnInit, OnDestroy } from '@angular/core';
142
- import { addAgentContext, injectCopilotKit } from '@copilotkitnext/angular';
143
-
144
- @Component({...})
145
- export class MyComponent implements OnInit, OnDestroy {
146
- private copilotkit = injectCopilotKit();
147
- private cleanupFns: Array<() => void> = [];
148
-
149
- ngOnInit() {
150
- // Add context and store cleanup function
151
- const cleanup = addAgentContext(this.copilotkit, {
152
- description: 'Component initialization data',
153
- value: this.initData
154
- });
155
-
156
- this.cleanupFns.push(cleanup);
157
- }
158
-
159
- ngOnDestroy() {
160
- // Clean up all contexts
161
- this.cleanupFns.forEach(fn => fn());
162
- }
163
- }
164
- ```
165
-
166
- #### Auto-cleanup with useAgentContext
167
-
168
- ```typescript
169
- import { Component, OnInit } from '@angular/core';
170
- import { useAgentContext } from '@copilotkitnext/angular';
171
-
172
- @Component({...})
173
- export class MyComponent implements OnInit {
174
- ngOnInit() {
175
- // Automatically cleaned up when component is destroyed
176
- const contextId = useAgentContext({
177
- description: 'Auto-managed context',
178
- value: this.data
179
- });
180
-
181
- console.log('Context added with ID:', contextId);
182
- }
183
- }
184
- ```
185
-
186
- #### Reactive Context
187
-
188
- ```typescript
189
- import { Component, signal, computed } from '@angular/core';
190
- import { createReactiveContext } from '@copilotkitnext/angular';
191
-
192
- @Component({...})
193
- export class ReactiveComponent {
194
- private settings = signal({ theme: 'light' });
195
-
196
- ngOnInit() {
197
- const context = createReactiveContext(
198
- 'User settings',
199
- computed(() => this.settings())
200
- );
201
-
202
- // Update context when needed
203
- this.settings.set({ theme: 'dark' });
204
- context.update(); // Manually trigger update if needed
205
- }
206
- }
207
- ```
208
-
209
- ### 3. Multiple Contexts
210
-
211
- You can have multiple contexts active at the same time:
212
-
213
- ```typescript
214
- @Component({
215
- template: `
216
- <div copilotkitAgentContext
217
- description="User data"
218
- [value]="userData">
219
-
220
- <div copilotkitAgentContext
221
- description="Form state"
222
- [value]="formData">
223
-
224
- <div copilotkitAgentContext
225
- description="UI state"
226
- [value]="uiState">
227
- <!-- All three contexts are active here -->
228
- </div>
229
- </div>
230
- </div>
231
- `
232
- })
233
- export class MultiContextComponent {
234
- userData = { ... };
235
- formData = { ... };
236
- uiState = { ... };
237
- }
238
- ```
239
-
240
- ### 4. Conditional Context
241
-
242
- Context can be conditionally added/removed:
243
-
244
- ```typescript
245
- @Component({
246
- template: `
247
- <div *ngIf="isLoggedIn"
248
- copilotkitAgentContext
249
- description="Authenticated user context"
250
- [value]="userContext">
251
- <!-- Only added when user is logged in -->
252
- </div>
253
- `
254
- })
255
- export class ConditionalContextComponent {
256
- isLoggedIn = false;
257
- userContext = { ... };
258
- }
259
- ```
260
-
261
- ## Best Practices
262
-
263
- 1. **Use descriptive names**: Make context descriptions clear and specific
264
- 2. **Keep values serializable**: Context values should be JSON-serializable
265
- 3. **Avoid sensitive data**: Don't include passwords, tokens, or PII in context
266
- 4. **Update responsibly**: Frequent updates may impact performance
267
- 5. **Clean up**: Always remove contexts when no longer needed
268
-
269
- ## Comparison with React
270
-
271
- | React | Angular |
272
- | ------------------------------- | ------------------------------------------------------------------ |
273
- | `useAgentContext(context)` hook | `copilotkitAgentContext` directive or `useAgentContext()` function |
274
- | Updates via useEffect deps | Updates via `OnChanges` lifecycle |
275
- | Cleanup in useEffect return | Cleanup in `OnDestroy` lifecycle |
276
- | Re-renders trigger updates | Signal/Observable changes trigger updates |
277
-
278
- ## TypeScript Support
279
-
280
- All functions and directives are fully typed:
281
-
282
- ```typescript
283
- import type { Context } from '@copilotkitnext/angular';
284
-
285
- const myContext: Context = {
286
- description: 'Typed context',
287
- value: {
288
- // Any serializable value
289
- id: 123,
290
- data: ['a', 'b', 'c'],
291
- nested: { ... }
292
- }
293
- };
294
- ```
295
-
296
- ## Testing
297
-
298
- The agent context directive and utilities are fully testable:
299
-
300
- ```typescript
301
- it("should add context on init", () => {
302
- const fixture = TestBed.createComponent(MyComponent);
303
- fixture.detectChanges();
304
-
305
- expect(mockCopilotKit.addContext).toHaveBeenCalledWith({
306
- description: "Test context",
307
- value: expectedValue,
308
- });
309
- });
310
- ```
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
- }