@copilotkitnext/angular 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/.turbo/turbo-build.log +39 -0
  2. package/.turbo/turbo-check-types.log +0 -0
  3. package/.turbo/turbo-test.log +71 -0
  4. package/LICENSE +10 -0
  5. package/README-agent-context.md +310 -0
  6. package/dist/LICENSE +10 -0
  7. package/dist/components/chat/copilot-chat-assistant-message-buttons.component.d.ts +75 -0
  8. package/dist/components/chat/copilot-chat-assistant-message-renderer.component.d.ts +31 -0
  9. package/dist/components/chat/copilot-chat-assistant-message-toolbar.component.d.ts +8 -0
  10. package/dist/components/chat/copilot-chat-assistant-message.component.d.ts +131 -0
  11. package/dist/components/chat/copilot-chat-assistant-message.types.d.ts +31 -0
  12. package/dist/components/chat/copilot-chat-audio-recorder.component.d.ts +40 -0
  13. package/dist/components/chat/copilot-chat-buttons.component.d.ts +66 -0
  14. package/dist/components/chat/copilot-chat-input-defaults.d.ts +37 -0
  15. package/dist/components/chat/copilot-chat-input.component.d.ts +133 -0
  16. package/dist/components/chat/copilot-chat-input.types.d.ts +129 -0
  17. package/dist/components/chat/copilot-chat-message-view-cursor.component.d.ts +15 -0
  18. package/dist/components/chat/copilot-chat-message-view.component.d.ts +293 -0
  19. package/dist/components/chat/copilot-chat-message-view.types.d.ts +24 -0
  20. package/dist/components/chat/copilot-chat-textarea.component.d.ts +45 -0
  21. package/dist/components/chat/copilot-chat-tool-calls-view.component.d.ts +35 -0
  22. package/dist/components/chat/copilot-chat-toolbar.component.d.ts +8 -0
  23. package/dist/components/chat/copilot-chat-tools-menu.component.d.ts +20 -0
  24. package/dist/components/chat/copilot-chat-user-message-branch-navigation.component.d.ts +23 -0
  25. package/dist/components/chat/copilot-chat-user-message-buttons.component.d.ts +39 -0
  26. package/dist/components/chat/copilot-chat-user-message-renderer.component.d.ts +9 -0
  27. package/dist/components/chat/copilot-chat-user-message-toolbar.component.d.ts +8 -0
  28. package/dist/components/chat/copilot-chat-user-message.component.d.ts +55 -0
  29. package/dist/components/chat/copilot-chat-user-message.types.d.ts +33 -0
  30. package/dist/components/chat/copilot-chat-view-disclaimer.component.d.ts +15 -0
  31. package/dist/components/chat/copilot-chat-view-feather.component.d.ts +15 -0
  32. package/dist/components/chat/copilot-chat-view-handlers.service.d.ts +11 -0
  33. package/dist/components/chat/copilot-chat-view-input-container.component.d.ts +23 -0
  34. package/dist/components/chat/copilot-chat-view-scroll-to-bottom-button.component.d.ts +17 -0
  35. package/dist/components/chat/copilot-chat-view-scroll-view.component.d.ts +84 -0
  36. package/dist/components/chat/copilot-chat-view.component.d.ts +205 -0
  37. package/dist/components/chat/copilot-chat-view.types.d.ts +42 -0
  38. package/dist/components/chat/copilot-chat.component.d.ts +37 -0
  39. package/dist/components/copilotkit-tool-render.component.d.ts +25 -0
  40. package/dist/core/chat-configuration/chat-configuration.providers.d.ts +54 -0
  41. package/dist/core/chat-configuration/chat-configuration.service.d.ts +75 -0
  42. package/dist/core/chat-configuration/chat-configuration.types.d.ts +27 -0
  43. package/dist/core/copilotkit.providers.d.ts +13 -0
  44. package/dist/core/copilotkit.service.d.ts +119 -0
  45. package/dist/core/copilotkit.types.d.ts +83 -0
  46. package/dist/directives/copilotkit-agent-context.directive.d.ts +68 -0
  47. package/dist/directives/copilotkit-agent.directive.d.ts +106 -0
  48. package/dist/directives/copilotkit-chat-config.directive.d.ts +84 -0
  49. package/dist/directives/copilotkit-config.directive.d.ts +44 -0
  50. package/dist/directives/copilotkit-frontend-tool.directive.d.ts +25 -0
  51. package/dist/directives/copilotkit-human-in-the-loop.directive.d.ts +124 -0
  52. package/dist/directives/stick-to-bottom.directive.d.ts +62 -0
  53. package/dist/fesm2022/copilotkitnext-angular.mjs +9314 -0
  54. package/dist/fesm2022/copilotkitnext-angular.mjs.map +1 -0
  55. package/dist/index.d.ts +55 -0
  56. package/dist/lib/directives/tooltip.directive.d.ts +33 -0
  57. package/dist/lib/slots/copilot-slot.component.d.ts +34 -0
  58. package/dist/lib/slots/slot.types.d.ts +55 -0
  59. package/dist/lib/slots/slot.utils.d.ts +108 -0
  60. package/dist/lib/utils.d.ts +6 -0
  61. package/dist/services/resize-observer.service.d.ts +44 -0
  62. package/dist/services/scroll-position.service.d.ts +50 -0
  63. package/dist/styles.css +1963 -0
  64. package/dist/types/frontend-tool.d.ts +37 -0
  65. package/dist/types/human-in-the-loop.d.ts +44 -0
  66. package/dist/utils/agent-context.utils.d.ts +75 -0
  67. package/dist/utils/agent.utils.d.ts +99 -0
  68. package/dist/utils/chat-config.utils.d.ts +166 -0
  69. package/dist/utils/copilotkit.utils.d.ts +16 -0
  70. package/dist/utils/frontend-tool.utils.d.ts +119 -0
  71. package/dist/utils/human-in-the-loop.utils.d.ts +92 -0
  72. package/eslint.config.mjs +20 -0
  73. package/ng-package.json +19 -0
  74. package/package.json +96 -0
  75. package/slots.md +331 -0
  76. package/src/components/chat/__tests__/copilot-chat-assistant-message.component.spec.ts +282 -0
  77. package/src/components/chat/__tests__/copilot-chat-input.component.spec.ts +419 -0
  78. package/src/components/chat/__tests__/copilot-chat-message-view.component.spec.ts +372 -0
  79. package/src/components/chat/__tests__/copilot-chat-user-message.component.spec.ts +249 -0
  80. package/src/components/chat/copilot-chat-assistant-message-buttons.component.ts +292 -0
  81. package/src/components/chat/copilot-chat-assistant-message-renderer.component.ts +472 -0
  82. package/src/components/chat/copilot-chat-assistant-message-toolbar.component.ts +29 -0
  83. package/src/components/chat/copilot-chat-assistant-message.component.ts +463 -0
  84. package/src/components/chat/copilot-chat-assistant-message.types.ts +50 -0
  85. package/src/components/chat/copilot-chat-audio-recorder.component.ts +241 -0
  86. package/src/components/chat/copilot-chat-buttons.component.ts +308 -0
  87. package/src/components/chat/copilot-chat-buttons.component.ts.bak +471 -0
  88. package/src/components/chat/copilot-chat-input-defaults.ts +47 -0
  89. package/src/components/chat/copilot-chat-input.component.ts +512 -0
  90. package/src/components/chat/copilot-chat-input.types.ts +148 -0
  91. package/src/components/chat/copilot-chat-message-view-cursor.component.ts +51 -0
  92. package/src/components/chat/copilot-chat-message-view.component.ts +233 -0
  93. package/src/components/chat/copilot-chat-message-view.types.ts +39 -0
  94. package/src/components/chat/copilot-chat-textarea.component.ts +220 -0
  95. package/src/components/chat/copilot-chat-tool-calls-view.component.ts +261 -0
  96. package/src/components/chat/copilot-chat-toolbar.component.ts +35 -0
  97. package/src/components/chat/copilot-chat-tools-menu.component.ts +185 -0
  98. package/src/components/chat/copilot-chat-user-message-branch-navigation.component.ts +121 -0
  99. package/src/components/chat/copilot-chat-user-message-buttons.component.ts +170 -0
  100. package/src/components/chat/copilot-chat-user-message-renderer.component.ts +37 -0
  101. package/src/components/chat/copilot-chat-user-message-toolbar.component.ts +37 -0
  102. package/src/components/chat/copilot-chat-user-message.component.ts +247 -0
  103. package/src/components/chat/copilot-chat-user-message.types.ts +42 -0
  104. package/src/components/chat/copilot-chat-view-disclaimer.component.ts +51 -0
  105. package/src/components/chat/copilot-chat-view-feather.component.ts +47 -0
  106. package/src/components/chat/copilot-chat-view-handlers.service.ts +14 -0
  107. package/src/components/chat/copilot-chat-view-input-container.component.ts +87 -0
  108. package/src/components/chat/copilot-chat-view-scroll-to-bottom-button.component.ts +79 -0
  109. package/src/components/chat/copilot-chat-view-scroll-view.component.ts +322 -0
  110. package/src/components/chat/copilot-chat-view.component.ts +420 -0
  111. package/src/components/chat/copilot-chat-view.types.ts +52 -0
  112. package/src/components/chat/copilot-chat.component.ts +232 -0
  113. package/src/components/copilotkit-tool-render.component.ts +169 -0
  114. package/src/core/__tests__/copilotkit.service.spec.ts +1051 -0
  115. package/src/core/__tests__/copilotkit.service.wildcard.spec.ts +316 -0
  116. package/src/core/chat-configuration/__tests__/chat-configuration.service.spec.ts +287 -0
  117. package/src/core/chat-configuration/chat-configuration.providers.ts +71 -0
  118. package/src/core/chat-configuration/chat-configuration.service.ts +162 -0
  119. package/src/core/chat-configuration/chat-configuration.types.ts +57 -0
  120. package/src/core/copilotkit.providers.ts +59 -0
  121. package/src/core/copilotkit.service.ts +542 -0
  122. package/src/core/copilotkit.types.ts +132 -0
  123. package/src/directives/__tests__/copilotkit-agent-context.directive.spec.ts +384 -0
  124. package/src/directives/__tests__/copilotkit-agent.directive.spec.ts +253 -0
  125. package/src/directives/__tests__/copilotkit-chat-config.directive.spec.ts +385 -0
  126. package/src/directives/__tests__/copilotkit-config.directive.spec.ts +69 -0
  127. package/src/directives/__tests__/copilotkit-frontend-tool-simple.directive.spec.ts +60 -0
  128. package/src/directives/__tests__/copilotkit-frontend-tool.directive.spec.ts +108 -0
  129. package/src/directives/__tests__/copilotkit-human-in-the-loop.directive.spec.ts +452 -0
  130. package/src/directives/copilotkit-agent-context.directive.ts +138 -0
  131. package/src/directives/copilotkit-agent.directive.ts +225 -0
  132. package/src/directives/copilotkit-chat-config.directive.ts +241 -0
  133. package/src/directives/copilotkit-config.directive.ts +81 -0
  134. package/src/directives/copilotkit-frontend-tool.directive.ts +145 -0
  135. package/src/directives/copilotkit-human-in-the-loop.directive.ts +281 -0
  136. package/src/directives/stick-to-bottom.directive.ts +204 -0
  137. package/src/index.ts +105 -0
  138. package/src/lib/directives/tooltip.directive.ts +292 -0
  139. package/src/lib/slots/__tests__/slot.utils.spec.ts +377 -0
  140. package/src/lib/slots/copilot-slot.component.ts +135 -0
  141. package/src/lib/slots/index.ts +3 -0
  142. package/src/lib/slots/slot.types.ts +64 -0
  143. package/src/lib/slots/slot.utils.ts +289 -0
  144. package/src/lib/utils.ts +10 -0
  145. package/src/public-api.ts +1 -0
  146. package/src/services/resize-observer.service.ts +181 -0
  147. package/src/services/scroll-position.service.ts +169 -0
  148. package/src/styles/globals.css +266 -0
  149. package/src/styles/index.css +3 -0
  150. package/src/test-setup.ts +15 -0
  151. package/src/testing/index.ts +3 -0
  152. package/src/testing/testing.utils.ts +248 -0
  153. package/src/types/frontend-tool.ts +44 -0
  154. package/src/types/human-in-the-loop.ts +52 -0
  155. package/src/utils/__tests__/agent.utils.spec.ts +234 -0
  156. package/src/utils/__tests__/chat-config.utils.spec.ts +306 -0
  157. package/src/utils/__tests__/frontend-tool-inject.spec.ts +350 -0
  158. package/src/utils/__tests__/frontend-tool-integration.spec.ts +199 -0
  159. package/src/utils/__tests__/frontend-tool.utils.spec.ts +272 -0
  160. package/src/utils/__tests__/human-in-the-loop.utils.spec.ts +365 -0
  161. package/src/utils/agent-context.utils.ts +133 -0
  162. package/src/utils/agent.utils.ts +239 -0
  163. package/src/utils/chat-config.utils.ts +221 -0
  164. package/src/utils/copilotkit.utils.ts +20 -0
  165. package/src/utils/frontend-tool.utils.ts +266 -0
  166. package/src/utils/human-in-the-loop.utils.ts +359 -0
  167. package/tsconfig.json +33 -0
  168. package/tsconfig.spec.json +12 -0
  169. package/vitest.config.mts +34 -0
@@ -0,0 +1,39 @@
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
@@ -0,0 +1,71 @@
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/LICENSE ADDED
@@ -0,0 +1,10 @@
1
+ Proprietary License
2
+
3
+ Copyright 2025 Tawkit Inc.
4
+
5
+ All rights reserved.
6
+
7
+ This software is proprietary and confidential.
8
+ Unauthorized copying, modification, distribution, or use of this software,
9
+ via any medium, is strictly prohibited without prior written permission
10
+ from the copyright holder.
@@ -0,0 +1,310 @@
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/dist/LICENSE ADDED
@@ -0,0 +1,10 @@
1
+ Proprietary License
2
+
3
+ Copyright 2025 Tawkit Inc.
4
+
5
+ All rights reserved.
6
+
7
+ This software is proprietary and confidential.
8
+ Unauthorized copying, modification, distribution, or use of this software,
9
+ via any medium, is strictly prohibited without prior written permission
10
+ from the copyright holder.
@@ -0,0 +1,75 @@
1
+ import { EventEmitter } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ import * as i1 from "../../lib/directives/tooltip.directive";
4
+ export declare class CopilotChatAssistantMessageToolbarButtonComponent {
5
+ title: string;
6
+ disabled: boolean;
7
+ set inputClass(value: string | undefined);
8
+ private customClass;
9
+ computedClass: import("@angular/core").Signal<string>;
10
+ static ɵfac: i0.ɵɵFactoryDeclaration<CopilotChatAssistantMessageToolbarButtonComponent, never>;
11
+ static ɵcmp: i0.ɵɵComponentDeclaration<CopilotChatAssistantMessageToolbarButtonComponent, "button[copilotChatAssistantMessageToolbarButton]", never, { "title": { "alias": "title"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "inputClass": { "alias": "inputClass"; "required": false; }; }, {}, never, ["*"], true, [{ directive: typeof i1.CopilotTooltipDirective; inputs: { "copilotTooltip": "title"; "tooltipPosition": "tooltipPosition"; "tooltipDelay": "tooltipDelay"; }; outputs: {}; }]>;
12
+ }
13
+ export declare class CopilotChatAssistantMessageCopyButtonComponent {
14
+ title?: string;
15
+ disabled: boolean;
16
+ inputClass?: string;
17
+ content?: string;
18
+ clicked: EventEmitter<void>;
19
+ readonly CopyIcon: import("lucide-angular").LucideIconData;
20
+ readonly CheckIcon: import("lucide-angular").LucideIconData;
21
+ copied: import("@angular/core").WritableSignal<boolean>;
22
+ private chatConfig;
23
+ get labels(): import("@copilotkitnext/angular").CopilotChatLabels;
24
+ handleCopy(event?: Event): void;
25
+ static ɵfac: i0.ɵɵFactoryDeclaration<CopilotChatAssistantMessageCopyButtonComponent, never>;
26
+ static ɵcmp: i0.ɵɵComponentDeclaration<CopilotChatAssistantMessageCopyButtonComponent, "copilot-chat-assistant-message-copy-button", never, { "title": { "alias": "title"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "inputClass": { "alias": "inputClass"; "required": false; }; "content": { "alias": "content"; "required": false; }; }, { "clicked": "clicked"; }, never, never, true, never>;
27
+ }
28
+ export declare class CopilotChatAssistantMessageThumbsUpButtonComponent {
29
+ title?: string;
30
+ disabled: boolean;
31
+ inputClass?: string;
32
+ clicked: EventEmitter<void>;
33
+ readonly ThumbsUpIcon: import("lucide-angular").LucideIconData;
34
+ private chatConfig;
35
+ get labels(): import("@copilotkitnext/angular").CopilotChatLabels;
36
+ handleClick(event?: Event): void;
37
+ static ɵfac: i0.ɵɵFactoryDeclaration<CopilotChatAssistantMessageThumbsUpButtonComponent, never>;
38
+ static ɵcmp: i0.ɵɵComponentDeclaration<CopilotChatAssistantMessageThumbsUpButtonComponent, "copilot-chat-assistant-message-thumbs-up-button", never, { "title": { "alias": "title"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "inputClass": { "alias": "inputClass"; "required": false; }; }, { "clicked": "clicked"; }, never, never, true, never>;
39
+ }
40
+ export declare class CopilotChatAssistantMessageThumbsDownButtonComponent {
41
+ title?: string;
42
+ disabled: boolean;
43
+ inputClass?: string;
44
+ clicked: EventEmitter<void>;
45
+ readonly ThumbsDownIcon: import("lucide-angular").LucideIconData;
46
+ private chatConfig;
47
+ get labels(): import("@copilotkitnext/angular").CopilotChatLabels;
48
+ handleClick(event?: Event): void;
49
+ static ɵfac: i0.ɵɵFactoryDeclaration<CopilotChatAssistantMessageThumbsDownButtonComponent, never>;
50
+ static ɵcmp: i0.ɵɵComponentDeclaration<CopilotChatAssistantMessageThumbsDownButtonComponent, "copilot-chat-assistant-message-thumbs-down-button", never, { "title": { "alias": "title"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "inputClass": { "alias": "inputClass"; "required": false; }; }, { "clicked": "clicked"; }, never, never, true, never>;
51
+ }
52
+ export declare class CopilotChatAssistantMessageReadAloudButtonComponent {
53
+ title?: string;
54
+ disabled: boolean;
55
+ inputClass?: string;
56
+ clicked: EventEmitter<void>;
57
+ readonly Volume2Icon: import("lucide-angular").LucideIconData;
58
+ private chatConfig;
59
+ get labels(): import("@copilotkitnext/angular").CopilotChatLabels;
60
+ handleClick(event?: Event): void;
61
+ static ɵfac: i0.ɵɵFactoryDeclaration<CopilotChatAssistantMessageReadAloudButtonComponent, never>;
62
+ static ɵcmp: i0.ɵɵComponentDeclaration<CopilotChatAssistantMessageReadAloudButtonComponent, "copilot-chat-assistant-message-read-aloud-button", never, { "title": { "alias": "title"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "inputClass": { "alias": "inputClass"; "required": false; }; }, { "clicked": "clicked"; }, never, never, true, never>;
63
+ }
64
+ export declare class CopilotChatAssistantMessageRegenerateButtonComponent {
65
+ title?: string;
66
+ disabled: boolean;
67
+ inputClass?: string;
68
+ clicked: EventEmitter<void>;
69
+ readonly RefreshCwIcon: import("lucide-angular").LucideIconData;
70
+ private chatConfig;
71
+ get labels(): import("@copilotkitnext/angular").CopilotChatLabels;
72
+ handleClick(event?: Event): void;
73
+ static ɵfac: i0.ɵɵFactoryDeclaration<CopilotChatAssistantMessageRegenerateButtonComponent, never>;
74
+ static ɵcmp: i0.ɵɵComponentDeclaration<CopilotChatAssistantMessageRegenerateButtonComponent, "copilot-chat-assistant-message-regenerate-button", never, { "title": { "alias": "title"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "inputClass": { "alias": "inputClass"; "required": false; }; }, { "clicked": "clicked"; }, never, never, true, never>;
75
+ }
@@ -0,0 +1,31 @@
1
+ import { OnChanges, SimpleChanges, ElementRef, AfterViewInit } from "@angular/core";
2
+ import * as i0 from "@angular/core";
3
+ export declare class CopilotChatAssistantMessageRendererComponent implements OnChanges, AfterViewInit {
4
+ private _content;
5
+ set content(value: string);
6
+ get content(): string;
7
+ inputClass?: string;
8
+ private contentSignal;
9
+ markdownContainer?: ElementRef<HTMLDivElement>;
10
+ private chatConfig;
11
+ private elementRef;
12
+ private copyStates;
13
+ private copyStateSignal;
14
+ renderedHtml: import("@angular/core").Signal<string>;
15
+ get labels(): import("@copilotkitnext/angular").CopilotChatLabels;
16
+ ngOnChanges(changes: SimpleChanges): void;
17
+ ngAfterViewInit(): void;
18
+ private updateContent;
19
+ private codeBlocksMap;
20
+ private markedInstance;
21
+ private initializeMarked;
22
+ private renderMarkdown;
23
+ private processMathEquations;
24
+ private renderMathEquations;
25
+ handleClick(event: MouseEvent): void;
26
+ private copyCodeBlock;
27
+ private generateBlockId;
28
+ private escapeHtml;
29
+ static ɵfac: i0.ɵɵFactoryDeclaration<CopilotChatAssistantMessageRendererComponent, never>;
30
+ static ɵcmp: i0.ɵɵComponentDeclaration<CopilotChatAssistantMessageRendererComponent, "copilot-chat-assistant-message-renderer", never, { "content": { "alias": "content"; "required": false; }; "inputClass": { "alias": "inputClass"; "required": false; }; }, {}, never, never, true, never>;
31
+ }
@@ -0,0 +1,8 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class CopilotChatAssistantMessageToolbarComponent {
3
+ set inputClass(value: string | undefined);
4
+ private customClass;
5
+ computedClass: import("@angular/core").Signal<string>;
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<CopilotChatAssistantMessageToolbarComponent, never>;
7
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CopilotChatAssistantMessageToolbarComponent, "[copilotChatAssistantMessageToolbar]", never, { "inputClass": { "alias": "inputClass"; "required": false; }; }, {}, never, never, true, never>;
8
+ }