@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
@@ -1,463 +0,0 @@
1
- import {
2
- Component,
3
- Input,
4
- Output,
5
- EventEmitter,
6
- TemplateRef,
7
- ContentChild,
8
- signal,
9
- computed,
10
- Type,
11
- ChangeDetectionStrategy,
12
- ViewEncapsulation,
13
- Optional,
14
- Inject
15
- } from '@angular/core';
16
- import { CommonModule } from '@angular/common';
17
- import { CopilotSlotComponent } from '../../lib/slots/copilot-slot.component';
18
- import { CopilotChatToolCallsViewComponent } from './copilot-chat-tool-calls-view.component';
19
- import type { Message } from '@ag-ui/core';
20
- import {
21
- type AssistantMessage,
22
- type CopilotChatAssistantMessageOnThumbsUpProps,
23
- type CopilotChatAssistantMessageOnThumbsDownProps,
24
- type CopilotChatAssistantMessageOnReadAloudProps,
25
- type CopilotChatAssistantMessageOnRegenerateProps,
26
- type AssistantMessageMarkdownRendererContext,
27
- type AssistantMessageCopyButtonContext,
28
- type ThumbsUpButtonContext,
29
- type ThumbsDownButtonContext,
30
- type ReadAloudButtonContext,
31
- type RegenerateButtonContext,
32
- type AssistantMessageToolbarContext
33
- } from './copilot-chat-assistant-message.types';
34
- import { CopilotChatAssistantMessageRendererComponent } from './copilot-chat-assistant-message-renderer.component';
35
- import {
36
- CopilotChatAssistantMessageCopyButtonComponent,
37
- CopilotChatAssistantMessageThumbsUpButtonComponent,
38
- CopilotChatAssistantMessageThumbsDownButtonComponent,
39
- CopilotChatAssistantMessageReadAloudButtonComponent,
40
- CopilotChatAssistantMessageRegenerateButtonComponent
41
- } from './copilot-chat-assistant-message-buttons.component';
42
- import { CopilotChatAssistantMessageToolbarComponent } from './copilot-chat-assistant-message-toolbar.component';
43
- import { cn } from '../../lib/utils';
44
- import { CopilotChatViewHandlersService } from './copilot-chat-view-handlers.service';
45
-
46
- @Component({
47
- selector: 'copilot-chat-assistant-message',
48
- standalone: true,
49
- imports: [
50
- CommonModule,
51
- CopilotSlotComponent,
52
- CopilotChatAssistantMessageRendererComponent,
53
- CopilotChatAssistantMessageCopyButtonComponent,
54
- CopilotChatAssistantMessageThumbsUpButtonComponent,
55
- CopilotChatAssistantMessageThumbsDownButtonComponent,
56
- CopilotChatAssistantMessageReadAloudButtonComponent,
57
- CopilotChatAssistantMessageRegenerateButtonComponent,
58
- CopilotChatAssistantMessageToolbarComponent,
59
- CopilotChatToolCallsViewComponent
60
- ],
61
- changeDetection: ChangeDetectionStrategy.OnPush,
62
- encapsulation: ViewEncapsulation.None,
63
- template: `
64
- <div
65
- [class]="computedClass()"
66
- [attr.data-message-id]="message?.id">
67
-
68
- <!-- Markdown Renderer -->
69
- @if (markdownRendererTemplate || markdownRendererComponent) {
70
- <copilot-slot
71
- [slot]="markdownRendererTemplate || markdownRendererComponent"
72
- [context]="markdownRendererContext()"
73
- [defaultComponent]="CopilotChatAssistantMessageRendererComponent"
74
- >
75
- </copilot-slot>
76
- } @else {
77
- <copilot-chat-assistant-message-renderer
78
- [content]="message?.content || ''"
79
- [inputClass]="markdownRendererClass">
80
- </copilot-chat-assistant-message-renderer>
81
- }
82
-
83
- <!-- Tool Calls View -->
84
- @if (toolCallsViewTemplate || toolCallsViewComponent) {
85
- <copilot-slot
86
- [slot]="toolCallsViewTemplate || toolCallsViewComponent"
87
- [context]="toolCallsViewContext()"
88
- [defaultComponent]="CopilotChatToolCallsViewComponent">
89
- </copilot-slot>
90
- } @else if (message?.toolCalls && message.toolCalls.length > 0) {
91
- <copilot-chat-tool-calls-view
92
- [message]="message"
93
- [messages]="messages"
94
- [isLoading]="isLoading">
95
- </copilot-chat-tool-calls-view>
96
- }
97
-
98
- <!-- Toolbar -->
99
- <ng-container *ngIf="toolbarVisible">
100
- @if (toolbarTemplate || toolbarComponent) {
101
- <copilot-slot
102
- [slot]="toolbarTemplate || toolbarComponent"
103
- [context]="toolbarContext()"
104
- [defaultComponent]="CopilotChatAssistantMessageToolbarComponent"
105
- >
106
- </copilot-slot>
107
- } @else {
108
- <div copilotChatAssistantMessageToolbar [inputClass]="toolbarClass">
109
- <div class="flex items-center gap-1">
110
- <!-- Copy button -->
111
- @if (copyButtonTemplate || copyButtonComponent) {
112
- <copilot-slot
113
- [slot]="copyButtonTemplate || copyButtonComponent"
114
- [context]="{ content: message?.content || '' }"
115
- [defaultComponent]="CopilotChatAssistantMessageCopyButtonComponent"
116
- [outputs]="copyButtonOutputs"
117
- >
118
- </copilot-slot>
119
- } @else {
120
- <copilot-chat-assistant-message-copy-button
121
- [content]="message?.content"
122
- [inputClass]="copyButtonClass"
123
- (clicked)="handleCopy()">
124
- </copilot-chat-assistant-message-copy-button>
125
- }
126
-
127
- <!-- Thumbs up button - show if custom slot provided OR if handler available at top level -->
128
- @if (thumbsUpButtonComponent || thumbsUpButtonTemplate || handlers.hasAssistantThumbsUpHandler()) {
129
- <copilot-slot
130
- [slot]="thumbsUpButtonTemplate || thumbsUpButtonComponent"
131
- [context]="{}"
132
- [defaultComponent]="defaultThumbsUpButtonComponent"
133
- [outputs]="thumbsUpButtonOutputs">
134
- </copilot-slot>
135
- }
136
-
137
- <!-- Thumbs down button - show if custom slot provided OR if handler available at top level -->
138
- @if (thumbsDownButtonComponent || thumbsDownButtonTemplate || handlers.hasAssistantThumbsDownHandler()) {
139
- <copilot-slot
140
- [slot]="thumbsDownButtonTemplate || thumbsDownButtonComponent"
141
- [context]="{}"
142
- [defaultComponent]="defaultThumbsDownButtonComponent"
143
- [outputs]="thumbsDownButtonOutputs">
144
- </copilot-slot>
145
- }
146
-
147
- <!-- Read aloud button - only show if custom slot provided -->
148
- @if (readAloudButtonComponent || readAloudButtonTemplate) {
149
- <copilot-slot
150
- [slot]="readAloudButtonTemplate || readAloudButtonComponent"
151
- [context]="{}"
152
- [outputs]="readAloudButtonOutputs"
153
- >
154
- </copilot-slot>
155
- }
156
-
157
- <!-- Regenerate button - only show if custom slot provided -->
158
- @if (regenerateButtonComponent || regenerateButtonTemplate) {
159
- <copilot-slot
160
- [slot]="regenerateButtonTemplate || regenerateButtonComponent"
161
- [context]="{}"
162
- [outputs]="regenerateButtonOutputs"
163
- >
164
- </copilot-slot>
165
- }
166
-
167
- <!-- Additional toolbar items -->
168
- @if (additionalToolbarItems) {
169
- <ng-container *ngTemplateOutlet="additionalToolbarItems"></ng-container>
170
- }
171
- </div>
172
- </div>
173
- }
174
- </ng-container>
175
- </div>
176
- `,
177
- styles: [`
178
- /* Import KaTeX styles */
179
- @import 'katex/dist/katex.min.css';
180
-
181
- :host {
182
- display: block;
183
- width: 100%;
184
- }
185
-
186
- /* Atom One Light theme for highlight.js */
187
- .hljs {
188
- color: rgb(56, 58, 66);
189
- background: transparent;
190
- }
191
-
192
- .hljs-comment,
193
- .hljs-quote {
194
- color: #a0a1a7;
195
- font-style: italic;
196
- }
197
-
198
- .hljs-doctag,
199
- .hljs-formula,
200
- .hljs-keyword {
201
- color: #a626a4;
202
- }
203
-
204
- .hljs-deletion,
205
- .hljs-name,
206
- .hljs-section,
207
- .hljs-selector-tag,
208
- .hljs-subst {
209
- color: #e45649;
210
- }
211
-
212
- .hljs-literal {
213
- color: #0184bb;
214
- }
215
-
216
- .hljs-addition,
217
- .hljs-attribute,
218
- .hljs-meta .hljs-string,
219
- .hljs-regexp,
220
- .hljs-string {
221
- color: #50a14f;
222
- }
223
-
224
- .hljs-attr,
225
- .hljs-number,
226
- .hljs-selector-attr,
227
- .hljs-selector-class,
228
- .hljs-selector-pseudo,
229
- .hljs-template-variable,
230
- .hljs-type,
231
- .hljs-variable {
232
- color: #986801;
233
- }
234
-
235
- .hljs-params {
236
- color: rgb(56, 58, 66);
237
- }
238
-
239
- .hljs-bullet,
240
- .hljs-link,
241
- .hljs-meta,
242
- .hljs-selector-id,
243
- .hljs-symbol,
244
- .hljs-title {
245
- color: #4078f2;
246
- }
247
-
248
- .hljs-built_in,
249
- .hljs-class .hljs-title,
250
- .hljs-title.class_ {
251
- color: #c18401;
252
- }
253
-
254
- .hljs-emphasis {
255
- font-style: italic;
256
- }
257
-
258
- .hljs-strong {
259
- font-weight: 700;
260
- }
261
-
262
- .hljs-link {
263
- text-decoration: underline;
264
- }
265
-
266
- /* Atom One Dark theme for highlight.js */
267
- .dark .hljs {
268
- color: #abb2bf;
269
- background: transparent;
270
- }
271
-
272
- .dark .hljs-comment,
273
- .dark .hljs-quote {
274
- color: #5c6370;
275
- font-style: italic;
276
- }
277
-
278
- .dark .hljs-doctag,
279
- .dark .hljs-formula,
280
- .dark .hljs-keyword {
281
- color: #c678dd;
282
- }
283
-
284
- .dark .hljs-deletion,
285
- .dark .hljs-name,
286
- .dark .hljs-section,
287
- .dark .hljs-selector-tag,
288
- .dark .hljs-subst {
289
- color: #e06c75;
290
- }
291
-
292
- .dark .hljs-literal {
293
- color: #56b6c2;
294
- }
295
-
296
- .dark .hljs-addition,
297
- .dark .hljs-attribute,
298
- .dark .hljs-meta .hljs-string,
299
- .dark .hljs-regexp,
300
- .dark .hljs-string {
301
- color: #98c379;
302
- }
303
-
304
- .dark .hljs-attr,
305
- .dark .hljs-number,
306
- .dark .hljs-selector-attr,
307
- .dark .hljs-selector-class,
308
- .dark .hljs-selector-pseudo,
309
- .dark .hljs-template-variable,
310
- .dark .hljs-type,
311
- .dark .hljs-variable {
312
- color: #d19a66;
313
- }
314
-
315
- .dark .hljs-bullet,
316
- .dark .hljs-link,
317
- .dark .hljs-meta,
318
- .dark .hljs-selector-id,
319
- .dark .hljs-symbol,
320
- .dark .hljs-title {
321
- color: #61aeee;
322
- }
323
-
324
- .dark .hljs-built_in,
325
- .dark .hljs-class .hljs-title,
326
- .dark .hljs-title.class_ {
327
- color: #e6c07b;
328
- }
329
-
330
- .dark .hljs-params {
331
- color: #abb2bf; /* same as regular text */
332
- }
333
-
334
- .dark .hljs-emphasis {
335
- font-style: italic;
336
- }
337
-
338
- .dark .hljs-strong {
339
- font-weight: 700;
340
- }
341
-
342
- .dark .hljs-link {
343
- text-decoration: underline;
344
- }
345
- `]
346
- })
347
- export class CopilotChatAssistantMessageComponent {
348
- // Capture templates from content projection
349
- @ContentChild('markdownRenderer', { read: TemplateRef }) markdownRendererTemplate?: TemplateRef<AssistantMessageMarkdownRendererContext>;
350
- @ContentChild('toolbar', { read: TemplateRef }) toolbarTemplate?: TemplateRef<AssistantMessageToolbarContext>;
351
- @ContentChild('copyButton', { read: TemplateRef }) copyButtonTemplate?: TemplateRef<AssistantMessageCopyButtonContext>;
352
- @ContentChild('thumbsUpButton', { read: TemplateRef }) thumbsUpButtonTemplate?: TemplateRef<ThumbsUpButtonContext>;
353
- @ContentChild('thumbsDownButton', { read: TemplateRef }) thumbsDownButtonTemplate?: TemplateRef<ThumbsDownButtonContext>;
354
- @ContentChild('readAloudButton', { read: TemplateRef }) readAloudButtonTemplate?: TemplateRef<ReadAloudButtonContext>;
355
- @ContentChild('regenerateButton', { read: TemplateRef }) regenerateButtonTemplate?: TemplateRef<RegenerateButtonContext>;
356
- @ContentChild('toolCallsView', { read: TemplateRef }) toolCallsViewTemplate?: TemplateRef<any>;
357
-
358
- // Class inputs for styling default components
359
- @Input() markdownRendererClass?: string;
360
- @Input() toolbarClass?: string;
361
- @Input() copyButtonClass?: string;
362
- @Input() thumbsUpButtonClass?: string;
363
- @Input() thumbsDownButtonClass?: string;
364
- @Input() readAloudButtonClass?: string;
365
- @Input() regenerateButtonClass?: string;
366
- @Input() toolCallsViewClass?: string;
367
-
368
- // Component inputs for overrides
369
- @Input() markdownRendererComponent?: Type<any>;
370
- @Input() toolbarComponent?: Type<any>;
371
- @Input() copyButtonComponent?: Type<any>;
372
- @Input() thumbsUpButtonComponent?: Type<any>;
373
- @Input() thumbsDownButtonComponent?: Type<any>;
374
- @Input() readAloudButtonComponent?: Type<any>;
375
- @Input() regenerateButtonComponent?: Type<any>;
376
- @Input() toolCallsViewComponent?: Type<any>;
377
-
378
- // Regular inputs
379
- @Input() message!: AssistantMessage;
380
- @Input() messages: Message[] = [];
381
- @Input() isLoading = false;
382
- @Input() additionalToolbarItems?: TemplateRef<any>;
383
- @Input() toolbarVisible = true;
384
- @Input() set inputClass(val: string | undefined) {
385
- this.customClass.set(val);
386
- }
387
-
388
- // DI service exposes handler availability scoped to CopilotChatView
389
- // Make it optional with a default fallback for testing
390
- handlers: CopilotChatViewHandlersService;
391
-
392
- constructor(@Optional() @Inject(CopilotChatViewHandlersService) handlers?: CopilotChatViewHandlersService | null) {
393
- this.handlers = handlers || new CopilotChatViewHandlersService();
394
- }
395
-
396
- // Output events
397
- @Output() thumbsUp = new EventEmitter<CopilotChatAssistantMessageOnThumbsUpProps>();
398
- @Output() thumbsDown = new EventEmitter<CopilotChatAssistantMessageOnThumbsDownProps>();
399
- @Output() readAloud = new EventEmitter<CopilotChatAssistantMessageOnReadAloudProps>();
400
- @Output() regenerate = new EventEmitter<CopilotChatAssistantMessageOnRegenerateProps>();
401
-
402
- // Signals
403
- customClass = signal<string | undefined>(undefined);
404
-
405
- // Computed values
406
- computedClass = computed(() => {
407
- return cn(
408
- "prose max-w-full break-words dark:prose-invert",
409
- this.customClass()
410
- );
411
- });
412
-
413
- // Default components
414
- protected readonly defaultThumbsUpButtonComponent = CopilotChatAssistantMessageThumbsUpButtonComponent;
415
- protected readonly defaultThumbsDownButtonComponent = CopilotChatAssistantMessageThumbsDownButtonComponent;
416
- protected readonly CopilotChatAssistantMessageRendererComponent = CopilotChatAssistantMessageRendererComponent;
417
- protected readonly CopilotChatAssistantMessageToolbarComponent = CopilotChatAssistantMessageToolbarComponent;
418
- protected readonly CopilotChatAssistantMessageCopyButtonComponent = CopilotChatAssistantMessageCopyButtonComponent;
419
- protected readonly CopilotChatToolCallsViewComponent = CopilotChatToolCallsViewComponent;
420
-
421
- // Context for slots (reactive via signals)
422
- markdownRendererContext = computed<AssistantMessageMarkdownRendererContext>(() => ({
423
- content: this.message?.content || ''
424
- }));
425
-
426
- // Output maps for slots
427
- copyButtonOutputs = { clicked: () => this.handleCopy() };
428
- thumbsUpButtonOutputs = { clicked: () => this.handleThumbsUp() };
429
- thumbsDownButtonOutputs = { clicked: () => this.handleThumbsDown() };
430
- readAloudButtonOutputs = { clicked: () => this.handleReadAloud() };
431
- regenerateButtonOutputs = { clicked: () => this.handleRegenerate() };
432
-
433
- toolbarContext = computed<AssistantMessageToolbarContext>(() => ({
434
- children: null // Will be populated by the toolbar content
435
- }));
436
-
437
- toolCallsViewContext = computed(() => ({
438
- message: this.message,
439
- messages: this.messages,
440
- isLoading: this.isLoading
441
- }));
442
-
443
- handleCopy(): void {
444
- // Copy is handled by the button component itself
445
- // This is just for any additional logic if needed
446
- }
447
-
448
- handleThumbsUp(): void {
449
- this.thumbsUp.emit({ message: this.message });
450
- }
451
-
452
- handleThumbsDown(): void {
453
- this.thumbsDown.emit({ message: this.message });
454
- }
455
-
456
- handleReadAloud(): void {
457
- this.readAloud.emit({ message: this.message });
458
- }
459
-
460
- handleRegenerate(): void {
461
- this.regenerate.emit({ message: this.message });
462
- }
463
- }
@@ -1,50 +0,0 @@
1
- import { AssistantMessage } from '@ag-ui/client';
2
-
3
- // Context interfaces for slots
4
- export interface AssistantMessageMarkdownRendererContext {
5
- content: string;
6
- }
7
-
8
- export interface AssistantMessageToolbarContext {
9
- children?: any;
10
- }
11
-
12
- export interface AssistantMessageCopyButtonContext {
13
- content?: string;
14
- }
15
-
16
- export interface ThumbsUpButtonContext {
17
- // Empty context - click handled via outputs map
18
- }
19
-
20
- export interface ThumbsDownButtonContext {
21
- // Empty context - click handled via outputs map
22
- }
23
-
24
- export interface ReadAloudButtonContext {
25
- // Empty context - click handled via outputs map
26
- }
27
-
28
- export interface RegenerateButtonContext {
29
- // Empty context - click handled via outputs map
30
- }
31
-
32
- // Event handler props
33
- export interface CopilotChatAssistantMessageOnThumbsUpProps {
34
- message: AssistantMessage;
35
- }
36
-
37
- export interface CopilotChatAssistantMessageOnThumbsDownProps {
38
- message: AssistantMessage;
39
- }
40
-
41
- export interface CopilotChatAssistantMessageOnReadAloudProps {
42
- message: AssistantMessage;
43
- }
44
-
45
- export interface CopilotChatAssistantMessageOnRegenerateProps {
46
- message: AssistantMessage;
47
- }
48
-
49
- // Re-export for convenience
50
- export type { AssistantMessage };