@genesislcap/ai-assistant 14.403.0-ai-assistant.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 (244) hide show
  1. package/api-extractor.json +4 -0
  2. package/dist/ai-assistant.api.json +4028 -0
  3. package/dist/ai-assistant.d.ts +396 -0
  4. package/dist/dts/channel/ai-activity-channel.d.ts +32 -0
  5. package/dist/dts/channel/ai-activity-channel.d.ts.map +1 -0
  6. package/dist/dts/components/activity-halo/activity-halo.d.ts +31 -0
  7. package/dist/dts/components/activity-halo/activity-halo.d.ts.map +1 -0
  8. package/dist/dts/components/chat-bubble/chat-bubble.d.ts +52 -0
  9. package/dist/dts/components/chat-bubble/chat-bubble.d.ts.map +1 -0
  10. package/dist/dts/components/chat-bubble/chat-bubble.styles.d.ts +2 -0
  11. package/dist/dts/components/chat-bubble/chat-bubble.styles.d.ts.map +1 -0
  12. package/dist/dts/components/chat-bubble/chat-bubble.template.d.ts +4 -0
  13. package/dist/dts/components/chat-bubble/chat-bubble.template.d.ts.map +1 -0
  14. package/dist/dts/components/chat-bubble/index.d.ts +2 -0
  15. package/dist/dts/components/chat-bubble/index.d.ts.map +1 -0
  16. package/dist/dts/components/chat-driver/chat-driver.d.ts +49 -0
  17. package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -0
  18. package/dist/dts/components/chat-driver/index.d.ts +2 -0
  19. package/dist/dts/components/chat-driver/index.d.ts.map +1 -0
  20. package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.d.ts +19 -0
  21. package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.d.ts.map +1 -0
  22. package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.styles.d.ts +2 -0
  23. package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.styles.d.ts.map +1 -0
  24. package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.template.d.ts +3 -0
  25. package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.template.d.ts.map +1 -0
  26. package/dist/dts/components/chat-interaction-wrapper/index.d.ts +4 -0
  27. package/dist/dts/components/chat-interaction-wrapper/index.d.ts.map +1 -0
  28. package/dist/dts/components/chat-markdown/chat-markdown.d.ts +6 -0
  29. package/dist/dts/components/chat-markdown/chat-markdown.d.ts.map +1 -0
  30. package/dist/dts/components/chat-markdown/index.d.ts +2 -0
  31. package/dist/dts/components/chat-markdown/index.d.ts.map +1 -0
  32. package/dist/dts/components/halo-overlay.d.ts +25 -0
  33. package/dist/dts/components/halo-overlay.d.ts.map +1 -0
  34. package/dist/dts/config/config.d.ts +51 -0
  35. package/dist/dts/config/config.d.ts.map +1 -0
  36. package/dist/dts/config/configure.d.ts +1 -0
  37. package/dist/dts/config/configure.d.ts.map +1 -0
  38. package/dist/dts/config/index.d.ts +2 -0
  39. package/dist/dts/config/index.d.ts.map +1 -0
  40. package/dist/dts/index.d.ts +10 -0
  41. package/dist/dts/index.d.ts.map +1 -0
  42. package/dist/dts/main/index.d.ts +5 -0
  43. package/dist/dts/main/index.d.ts.map +1 -0
  44. package/dist/dts/main/main.d.ts +103 -0
  45. package/dist/dts/main/main.d.ts.map +1 -0
  46. package/dist/dts/main/main.styles.d.ts +2 -0
  47. package/dist/dts/main/main.styles.d.ts.map +1 -0
  48. package/dist/dts/main/main.template.d.ts +4 -0
  49. package/dist/dts/main/main.template.d.ts.map +1 -0
  50. package/dist/dts/main/main.types.d.ts +54 -0
  51. package/dist/dts/main/main.types.d.ts.map +1 -0
  52. package/dist/dts/styles/index.d.ts +2 -0
  53. package/dist/dts/styles/index.d.ts.map +1 -0
  54. package/dist/dts/styles/styles.d.ts +5 -0
  55. package/dist/dts/styles/styles.d.ts.map +1 -0
  56. package/dist/dts/tags/index.d.ts +1 -0
  57. package/dist/dts/tags/index.d.ts.map +1 -0
  58. package/dist/dts/types/ai-chat-widget.d.ts +12 -0
  59. package/dist/dts/types/ai-chat-widget.d.ts.map +1 -0
  60. package/dist/dts/utils/index.d.ts +2 -0
  61. package/dist/dts/utils/index.d.ts.map +1 -0
  62. package/dist/dts/utils/logger.d.ts +2 -0
  63. package/dist/dts/utils/logger.d.ts.map +1 -0
  64. package/dist/esm/channel/ai-activity-channel.js +2 -0
  65. package/dist/esm/components/activity-halo/activity-halo.js +119 -0
  66. package/dist/esm/components/chat-bubble/chat-bubble.js +381 -0
  67. package/dist/esm/components/chat-bubble/chat-bubble.styles.js +193 -0
  68. package/dist/esm/components/chat-bubble/chat-bubble.template.js +50 -0
  69. package/dist/esm/components/chat-bubble/index.js +1 -0
  70. package/dist/esm/components/chat-driver/chat-driver.js +209 -0
  71. package/dist/esm/components/chat-driver/index.js +1 -0
  72. package/dist/esm/components/chat-interaction-wrapper/chat-interaction-wrapper.js +90 -0
  73. package/dist/esm/components/chat-interaction-wrapper/chat-interaction-wrapper.styles.js +6 -0
  74. package/dist/esm/components/chat-interaction-wrapper/chat-interaction-wrapper.template.js +4 -0
  75. package/dist/esm/components/chat-interaction-wrapper/index.js +3 -0
  76. package/dist/esm/components/chat-markdown/chat-markdown.js +95 -0
  77. package/dist/esm/components/chat-markdown/index.js +1 -0
  78. package/dist/esm/components/halo-overlay.js +118 -0
  79. package/dist/esm/config/config.js +16 -0
  80. package/dist/esm/config/configure.js +0 -0
  81. package/dist/esm/config/index.js +1 -0
  82. package/dist/esm/index.js +8 -0
  83. package/dist/esm/main/index.js +4 -0
  84. package/dist/esm/main/main.js +491 -0
  85. package/dist/esm/main/main.styles.js +356 -0
  86. package/dist/esm/main/main.template.js +272 -0
  87. package/dist/esm/main/main.types.js +22 -0
  88. package/dist/esm/styles/index.js +1 -0
  89. package/dist/esm/styles/styles.js +237 -0
  90. package/dist/esm/tags/index.js +0 -0
  91. package/dist/esm/types/ai-chat-widget.js +1 -0
  92. package/dist/esm/utils/index.js +1 -0
  93. package/dist/esm/utils/logger.js +2 -0
  94. package/dist/tsconfig.tsbuildinfo +1 -0
  95. package/dist/tsdoc-metadata.json +11 -0
  96. package/docs/.gitattributes +2 -0
  97. package/docs/api/ai-assistant.ai_activity_channel_name.md +11 -0
  98. package/docs/api/ai-assistant.aiactivityevents.md +24 -0
  99. package/docs/api/ai-assistant.aiactivityhalo.channelname.md +16 -0
  100. package/docs/api/ai-assistant.aiactivityhalo.connectedcallback.md +18 -0
  101. package/docs/api/ai-assistant.aiactivityhalo.disconnectedcallback.md +18 -0
  102. package/docs/api/ai-assistant.aiactivityhalo.haloactive.md +14 -0
  103. package/docs/api/ai-assistant.aiactivityhalo.md +176 -0
  104. package/docs/api/ai-assistant.aiactivityhalo.minshowtime.md +16 -0
  105. package/docs/api/ai-assistant.aiactivityhalo.tools.md +16 -0
  106. package/docs/api/ai-assistant.aiassistantanimation.md +18 -0
  107. package/docs/api/ai-assistant.aiassistantanimationdef.label.md +16 -0
  108. package/docs/api/ai-assistant.aiassistantanimationdef.md +80 -0
  109. package/docs/api/ai-assistant.aiassistantanimationdef.tooltip.md +16 -0
  110. package/docs/api/ai-assistant.aiassistantconfig.chatconfig.md +16 -0
  111. package/docs/api/ai-assistant.aiassistantconfig.debugstatefactory.md +16 -0
  112. package/docs/api/ai-assistant.aiassistantconfig.headertitle.md +16 -0
  113. package/docs/api/ai-assistant.aiassistantconfig.md +157 -0
  114. package/docs/api/ai-assistant.aiassistantconfig.systemprompt.md +16 -0
  115. package/docs/api/ai-assistant.aiassistantconfig.tooldefinitions.md +16 -0
  116. package/docs/api/ai-assistant.aiassistantconfig.toolhandlers.md +16 -0
  117. package/docs/api/ai-assistant.aiassistantserializedstate.enabledanimations.md +14 -0
  118. package/docs/api/ai-assistant.aiassistantserializedstate.md +118 -0
  119. package/docs/api/ai-assistant.aiassistantserializedstate.messages.md +14 -0
  120. package/docs/api/ai-assistant.aiassistantserializedstate.showthinkingsteps.md +14 -0
  121. package/docs/api/ai-assistant.aiassistantserializedstate.showtoolcalls.md +14 -0
  122. package/docs/api/ai-assistant.aiassistantstate.md +16 -0
  123. package/docs/api/ai-assistant.aichatbubble.bubbleleft.md +11 -0
  124. package/docs/api/ai-assistant.aichatbubble.bubbletop.md +11 -0
  125. package/docs/api/ai-assistant.aichatbubble.channelname.md +11 -0
  126. package/docs/api/ai-assistant.aichatbubble.connectedcallback.md +15 -0
  127. package/docs/api/ai-assistant.aichatbubble.designsystemprefix.md +11 -0
  128. package/docs/api/ai-assistant.aichatbubble.dialogcontent.md +11 -0
  129. package/docs/api/ai-assistant.aichatbubble.dialogcontentchanged.md +64 -0
  130. package/docs/api/ai-assistant.aichatbubble.dialogheight.md +11 -0
  131. package/docs/api/ai-assistant.aichatbubble.dialogleft.md +11 -0
  132. package/docs/api/ai-assistant.aichatbubble.dialogopen.md +11 -0
  133. package/docs/api/ai-assistant.aichatbubble.dialogopenchanged.md +64 -0
  134. package/docs/api/ai-assistant.aichatbubble.dialogtop.md +11 -0
  135. package/docs/api/ai-assistant.aichatbubble.dialogwidth.md +11 -0
  136. package/docs/api/ai-assistant.aichatbubble.disconnectedcallback.md +15 -0
  137. package/docs/api/ai-assistant.aichatbubble.hovered.md +11 -0
  138. package/docs/api/ai-assistant.aichatbubble.imagesrc.md +11 -0
  139. package/docs/api/ai-assistant.aichatbubble.md +396 -0
  140. package/docs/api/ai-assistant.aichatbubble.onbubblemousedown.md +50 -0
  141. package/docs/api/ai-assistant.aichatbubble.onclosedialog.md +15 -0
  142. package/docs/api/ai-assistant.aichatbubble.ondialogheadermousedown.md +53 -0
  143. package/docs/api/ai-assistant.aichatbubble.onpopout.md +15 -0
  144. package/docs/api/ai-assistant.aichatbubble.title.md +11 -0
  145. package/docs/api/ai-assistant.aichatbubble.tooltipstyle.md +11 -0
  146. package/docs/api/ai-assistant.aichatwidget.data.md +14 -0
  147. package/docs/api/ai-assistant.aichatwidget.md +80 -0
  148. package/docs/api/ai-assistant.aichatwidget.resolved.md +16 -0
  149. package/docs/api/ai-assistant.animation_defs.md +25 -0
  150. package/docs/api/ai-assistant.chatdriver._constructor_.md +99 -0
  151. package/docs/api/ai-assistant.chatdriver.gethistory.md +18 -0
  152. package/docs/api/ai-assistant.chatdriver.isbusy.md +18 -0
  153. package/docs/api/ai-assistant.chatdriver.loadhistory.md +55 -0
  154. package/docs/api/ai-assistant.chatdriver.md +158 -0
  155. package/docs/api/ai-assistant.chatdriver.requestinteraction.md +73 -0
  156. package/docs/api/ai-assistant.chatdriver.resolveinteraction.md +69 -0
  157. package/docs/api/ai-assistant.chatdriver.sendmessage.md +69 -0
  158. package/docs/api/ai-assistant.chathistoryupdatedevent.md +16 -0
  159. package/docs/api/ai-assistant.defaultaiassistantconfig.md +16 -0
  160. package/docs/api/ai-assistant.foundationaiassistant.aiprovider.md +14 -0
  161. package/docs/api/ai-assistant.foundationaiassistant.applystate.md +55 -0
  162. package/docs/api/ai-assistant.foundationaiassistant.attachmenterrors.md +14 -0
  163. package/docs/api/ai-assistant.foundationaiassistant.attachments.md +14 -0
  164. package/docs/api/ai-assistant.foundationaiassistant.channelname.md +14 -0
  165. package/docs/api/ai-assistant.foundationaiassistant.chatconfig.md +14 -0
  166. package/docs/api/ai-assistant.foundationaiassistant.connectedcallback.md +18 -0
  167. package/docs/api/ai-assistant.foundationaiassistant.debugstatefactory.md +14 -0
  168. package/docs/api/ai-assistant.foundationaiassistant.designsystemprefix.md +14 -0
  169. package/docs/api/ai-assistant.foundationaiassistant.disconnectedcallback.md +18 -0
  170. package/docs/api/ai-assistant.foundationaiassistant.downloadhistory.md +18 -0
  171. package/docs/api/ai-assistant.foundationaiassistant.enabledanimations.md +16 -0
  172. package/docs/api/ai-assistant.foundationaiassistant.handlefileselect.md +53 -0
  173. package/docs/api/ai-assistant.foundationaiassistant.handleinteractioncompleted.md +53 -0
  174. package/docs/api/ai-assistant.foundationaiassistant.handlepopout.md +20 -0
  175. package/docs/api/ai-assistant.foundationaiassistant.handlesendclick.md +18 -0
  176. package/docs/api/ai-assistant.foundationaiassistant.hasactivependinginteraction.md +16 -0
  177. package/docs/api/ai-assistant.foundationaiassistant.headertitle.md +14 -0
  178. package/docs/api/ai-assistant.foundationaiassistant.imagesrc.md +14 -0
  179. package/docs/api/ai-assistant.foundationaiassistant.inputvalue.md +14 -0
  180. package/docs/api/ai-assistant.foundationaiassistant.md +826 -0
  181. package/docs/api/ai-assistant.foundationaiassistant.messages.md +14 -0
  182. package/docs/api/ai-assistant.foundationaiassistant.messageschanged.md +18 -0
  183. package/docs/api/ai-assistant.foundationaiassistant.onchatheadermousedown.md +53 -0
  184. package/docs/api/ai-assistant.foundationaiassistant.placeholder.md +14 -0
  185. package/docs/api/ai-assistant.foundationaiassistant.popoutmode.md +16 -0
  186. package/docs/api/ai-assistant.foundationaiassistant.removeattachment.md +53 -0
  187. package/docs/api/ai-assistant.foundationaiassistant.removeattachmenterror.md +53 -0
  188. package/docs/api/ai-assistant.foundationaiassistant.setenabledanimations.md +53 -0
  189. package/docs/api/ai-assistant.foundationaiassistant.settingsopen.md +16 -0
  190. package/docs/api/ai-assistant.foundationaiassistant.showhalo.md +16 -0
  191. package/docs/api/ai-assistant.foundationaiassistant.showhalochanged.md +18 -0
  192. package/docs/api/ai-assistant.foundationaiassistant.showloadingindicator.md +16 -0
  193. package/docs/api/ai-assistant.foundationaiassistant.showloadingindicatorchanged.md +18 -0
  194. package/docs/api/ai-assistant.foundationaiassistant.showthinkingsteps.md +16 -0
  195. package/docs/api/ai-assistant.foundationaiassistant.showtoolcalls.md +16 -0
  196. package/docs/api/ai-assistant.foundationaiassistant.state.md +14 -0
  197. package/docs/api/ai-assistant.foundationaiassistant.statechanged.md +18 -0
  198. package/docs/api/ai-assistant.foundationaiassistant.systemprompt.md +14 -0
  199. package/docs/api/ai-assistant.foundationaiassistant.togglesettings.md +18 -0
  200. package/docs/api/ai-assistant.foundationaiassistant.toggleshowthinkingsteps.md +18 -0
  201. package/docs/api/ai-assistant.foundationaiassistant.toggleshowtoolcalls.md +18 -0
  202. package/docs/api/ai-assistant.foundationaiassistant.tooldefinitions.md +14 -0
  203. package/docs/api/ai-assistant.foundationaiassistant.toolhandlers.md +14 -0
  204. package/docs/api/ai-assistant.foundationaiassistant.triggerfileinput.md +18 -0
  205. package/docs/api/ai-assistant.foundationaiassistant.visiblemessages.md +16 -0
  206. package/docs/api/ai-assistant.foundationaiassistanttemplate.md +50 -0
  207. package/docs/api/ai-assistant.md +262 -0
  208. package/docs/api/ai-assistant.popoutmode.md +16 -0
  209. package/docs/api/index.md +30 -0
  210. package/docs/api-report.md.api.md +280 -0
  211. package/license.txt +46 -0
  212. package/package.json +92 -0
  213. package/src/channel/ai-activity-channel.ts +30 -0
  214. package/src/components/activity-halo/activity-halo.ts +113 -0
  215. package/src/components/chat-bubble/chat-bubble.styles.ts +194 -0
  216. package/src/components/chat-bubble/chat-bubble.template.ts +63 -0
  217. package/src/components/chat-bubble/chat-bubble.ts +389 -0
  218. package/src/components/chat-bubble/index.ts +1 -0
  219. package/src/components/chat-driver/chat-driver.ts +254 -0
  220. package/src/components/chat-driver/index.ts +1 -0
  221. package/src/components/chat-interaction-wrapper/chat-interaction-wrapper.styles.ts +7 -0
  222. package/src/components/chat-interaction-wrapper/chat-interaction-wrapper.template.ts +6 -0
  223. package/src/components/chat-interaction-wrapper/chat-interaction-wrapper.ts +89 -0
  224. package/src/components/chat-interaction-wrapper/index.ts +3 -0
  225. package/src/components/chat-markdown/chat-markdown.ts +87 -0
  226. package/src/components/chat-markdown/index.ts +1 -0
  227. package/src/components/halo-overlay.ts +115 -0
  228. package/src/config/config.ts +59 -0
  229. package/src/config/configure.ts +0 -0
  230. package/src/config/index.ts +1 -0
  231. package/src/index.ts +9 -0
  232. package/src/main/index.ts +4 -0
  233. package/src/main/main.styles.ts +357 -0
  234. package/src/main/main.template.ts +364 -0
  235. package/src/main/main.ts +474 -0
  236. package/src/main/main.types.ts +58 -0
  237. package/src/styles/index.ts +1 -0
  238. package/src/styles/styles.ts +238 -0
  239. package/src/tags/index.ts +0 -0
  240. package/src/types/ai-chat-widget.ts +11 -0
  241. package/src/utils/index.ts +1 -0
  242. package/src/utils/logger.ts +3 -0
  243. package/temp/api-report.md.api.md +280 -0
  244. package/tsconfig.json +11 -0
@@ -0,0 +1,89 @@
1
+ import { InteractionResult } from '@genesislcap/foundation-ai';
2
+ import { customElement, GenesisElement, observable } from '@genesislcap/web-core';
3
+ import { logger } from '../../utils/logger';
4
+ import { AiChatInteractionWrapperStyles } from './chat-interaction-wrapper.styles';
5
+ import { AiChatInteractionWrapperTemplate } from './chat-interaction-wrapper.template';
6
+
7
+ export type ChatInteractionEventsMap = {
8
+ 'interaction-completed': InteractionResult<unknown> & { interactionId: string };
9
+ };
10
+
11
+ @customElement({
12
+ name: 'ai-chat-interaction-wrapper',
13
+ template: AiChatInteractionWrapperTemplate,
14
+ styles: AiChatInteractionWrapperStyles,
15
+ })
16
+ export class AiChatInteractionWrapper extends GenesisElement {
17
+ @observable componentName: string = '';
18
+ @observable data: any;
19
+ @observable interactionId: string = '';
20
+ /** When true, the interaction has already been resolved. Forwarded to the rendered component. */
21
+ @observable resolved: boolean = false;
22
+
23
+ connectedCallback() {
24
+ super.connectedCallback();
25
+ this.renderComponent();
26
+ }
27
+
28
+ componentNameChanged() {
29
+ this.renderComponent();
30
+ }
31
+
32
+ resolvedChanged() {
33
+ // TODO: switch to FAST ref() or slotted children directives instead of querying the container
34
+ // imperatively — this would allow property bindings to flow naturally through the template.
35
+ const container = this.shadowRoot?.querySelector('.container');
36
+ const element = container?.firstElementChild as any;
37
+ if (element) {
38
+ element.resolved = this.resolved;
39
+ }
40
+ }
41
+
42
+ private renderComponent() {
43
+ const container = this.shadowRoot?.querySelector('.container');
44
+ if (!container || !this.componentName) return;
45
+
46
+ // Clear children without using innerHTML
47
+ container.replaceChildren();
48
+
49
+ if (!customElements.get(this.componentName)) {
50
+ logger.warn(
51
+ `Interactive component "\${this.componentName}" is not registered in the customElements registry.`,
52
+ );
53
+ const errorDiv = document.createElement('div');
54
+ errorDiv.textContent = `Error: Component "\${this.componentName}" is not available in this application.`;
55
+ container.appendChild(errorDiv);
56
+ return;
57
+ }
58
+
59
+ try {
60
+ const element = document.createElement(this.componentName) as any;
61
+
62
+ // Pass data and resolved state to the component
63
+ if (this.data) {
64
+ element.data = this.data;
65
+ }
66
+ element.resolved = this.resolved;
67
+
68
+ // Handle completion from the inner component.
69
+ // Guard against re-emission if the interaction was already resolved
70
+ // (e.g. auto-resolve components fire on connectedCallback when rendering history).
71
+ element.addEventListener('interaction-completed', (e: CustomEvent) => {
72
+ e.stopPropagation();
73
+ if (this.resolved) return;
74
+
75
+ this.$emit('interaction-completed', {
76
+ interactionId: this.interactionId,
77
+ ...e.detail,
78
+ });
79
+ });
80
+
81
+ container.appendChild(element);
82
+ } catch (e) {
83
+ logger.error(`Failed to create interactive component: \${this.componentName}`, e);
84
+ const errorDiv = document.createElement('div');
85
+ errorDiv.textContent = `Error: Could not load component \${this.componentName}`;
86
+ container.appendChild(errorDiv);
87
+ }
88
+ }
89
+ }
@@ -0,0 +1,3 @@
1
+ export * from './chat-interaction-wrapper';
2
+ export * from './chat-interaction-wrapper.styles';
3
+ export * from './chat-interaction-wrapper.template';
@@ -0,0 +1,87 @@
1
+ import { css, customElement, GenesisElement, html, observable } from '@genesislcap/web-core';
2
+ import DOMPurify from 'dompurify';
3
+ import { marked } from 'marked';
4
+
5
+ const styles = css`
6
+ :host {
7
+ display: block;
8
+ font-size: var(--type-ramp-base-font-size);
9
+ line-height: var(--type-ramp-base-line-height);
10
+ }
11
+
12
+ p {
13
+ margin: 0 0 calc(var(--design-unit, 4) * 2px);
14
+ }
15
+
16
+ p:last-child {
17
+ margin-bottom: 0;
18
+ }
19
+
20
+ ul,
21
+ ol {
22
+ margin: 0 0 calc(var(--design-unit, 4) * 2px);
23
+ padding-left: calc(var(--design-unit, 4) * 5px);
24
+ }
25
+
26
+ code {
27
+ background-color: var(--neutral-fill-rest);
28
+ padding: 2px 4px;
29
+ border-radius: calc(var(--design-unit, 4) * 0.5px);
30
+ font-family: monospace;
31
+ }
32
+
33
+ pre {
34
+ background-color: var(--neutral-fill-rest);
35
+ padding: calc(var(--design-unit, 4) * 2px);
36
+ border-radius: calc(var(--design-unit, 4) * 1px);
37
+ overflow-x: auto;
38
+ border: 1px solid var(--neutral-stroke-rest);
39
+ margin: calc(var(--design-unit, 4) * 2px) 0;
40
+ }
41
+
42
+ pre code {
43
+ background-color: transparent;
44
+ padding: 0;
45
+ border-radius: 0;
46
+ border: none;
47
+ font-family: inherit;
48
+ color: inherit;
49
+ }
50
+
51
+ table {
52
+ display: block;
53
+ overflow-x: auto;
54
+ border-collapse: collapse;
55
+ max-width: 100%;
56
+ margin: calc(var(--design-unit, 4) * 2px) 0;
57
+ }
58
+
59
+ th,
60
+ td {
61
+ border: 1px solid var(--neutral-stroke-rest);
62
+ padding: calc(var(--design-unit, 4) * 1px) calc(var(--design-unit, 4) * 2.5px);
63
+ white-space: nowrap;
64
+ }
65
+
66
+ th {
67
+ background-color: var(--neutral-fill-stealth-rest);
68
+ font-weight: 600;
69
+ }
70
+ `;
71
+
72
+ @customElement({
73
+ name: 'ai-chat-markdown',
74
+ template: html<AiChatMarkdown>`
75
+ <div :innerHTML="${(x) => x.renderMarkdown()}"></div>
76
+ `,
77
+ styles,
78
+ })
79
+ export class AiChatMarkdown extends GenesisElement {
80
+ @observable content: string = '';
81
+
82
+ renderMarkdown() {
83
+ if (!this.content) return '';
84
+ const rawHtml = marked.parse(this.content) as string;
85
+ return DOMPurify.sanitize(rawHtml);
86
+ }
87
+ }
@@ -0,0 +1 @@
1
+ export * from './chat-markdown';
@@ -0,0 +1,115 @@
1
+ import { attr, css, customElement, GenesisElement, html } from '@genesislcap/web-core';
2
+
3
+ /**
4
+ * Animated halo overlay — rotating conic-gradient border with an inward glow.
5
+ *
6
+ * Drop inside any `position: relative; overflow: hidden` container and toggle
7
+ * the `active` attribute to show/hide the effect.
8
+ *
9
+ * @example
10
+ * ```html
11
+ * <ai-halo-overlay ?active="${(x) => x.isLoading}"></ai-halo-overlay>
12
+ * ```
13
+ *
14
+ * @beta
15
+ */
16
+ @customElement({
17
+ name: 'ai-halo-overlay',
18
+ template: html`
19
+ <slot></slot>
20
+ `,
21
+ styles: css`
22
+ :host {
23
+ display: block;
24
+ position: absolute;
25
+ inset: 0;
26
+ border-radius: inherit;
27
+ pointer-events: none;
28
+ z-index: 1000;
29
+ opacity: 0;
30
+ transition: opacity 0.4s ease;
31
+ }
32
+
33
+ :host([active]) {
34
+ opacity: 1;
35
+ }
36
+
37
+ /* Rotating solid border */
38
+ :host::before {
39
+ content: '';
40
+ position: absolute;
41
+ inset: 0;
42
+ border-radius: inherit;
43
+ padding: 3px;
44
+ background: repeating-conic-gradient(
45
+ from var(--halo-angle, 0deg),
46
+ #feb60a,
47
+ #ff0062,
48
+ #00dbf9,
49
+ #da00f7,
50
+ #feb60a
51
+ );
52
+ -webkit-mask:
53
+ linear-gradient(#000 0 0) content-box,
54
+ linear-gradient(#000 0 0);
55
+ mask:
56
+ linear-gradient(#000 0 0) content-box,
57
+ linear-gradient(#000 0 0);
58
+ -webkit-mask-composite: destination-out;
59
+ mask-composite: exclude;
60
+ }
61
+
62
+ /* Inward glow — radial mask makes centre transparent, edges coloured */
63
+ :host::after {
64
+ content: '';
65
+ position: absolute;
66
+ inset: 0;
67
+ border-radius: inherit;
68
+ background: repeating-conic-gradient(
69
+ from var(--halo-angle, 0deg),
70
+ #feb60a,
71
+ #ff0062,
72
+ #00dbf9,
73
+ #da00f7,
74
+ #feb60a
75
+ );
76
+ opacity: 0.35;
77
+ -webkit-mask-image: radial-gradient(ellipse at center, transparent 70%, black 100%);
78
+ mask-image: radial-gradient(ellipse at center, transparent 70%, black 100%);
79
+ }
80
+ `,
81
+ })
82
+ export class AiHaloOverlay extends GenesisElement {
83
+ @attr({ mode: 'boolean' }) active: boolean = false;
84
+
85
+ // TODO: The rAF loop is fine for demos but has two drawbacks vs a pure CSS @property animation:
86
+ // 1. It runs on the main thread, so heavy JS work can cause the animation to stutter.
87
+ // 2. The loop ticks even when `active` is false (idle cost is negligible but non-zero).
88
+ // Once @property inside Shadow DOM has solid cross-browser support, consider switching back
89
+ // to a CSS @keyframes approach and removing connectedCallback/disconnectedCallback/tick().
90
+
91
+ // 1.5° per frame @ 60 fps ≈ 4 s per full revolution
92
+ private static readonly DEG_PER_FRAME = 1.5;
93
+ private static readonly FULL_ROTATION_DEG = 360;
94
+
95
+ private angle = 0;
96
+ private animFrame?: number;
97
+
98
+ connectedCallback() {
99
+ super.connectedCallback();
100
+ this.tick();
101
+ }
102
+
103
+ disconnectedCallback() {
104
+ super.disconnectedCallback();
105
+ if (this.animFrame !== undefined) {
106
+ cancelAnimationFrame(this.animFrame);
107
+ }
108
+ }
109
+
110
+ private tick() {
111
+ this.angle = (this.angle + AiHaloOverlay.DEG_PER_FRAME) % AiHaloOverlay.FULL_ROTATION_DEG;
112
+ this.style.setProperty('--halo-angle', `${this.angle}deg`);
113
+ this.animFrame = requestAnimationFrame(() => this.tick());
114
+ }
115
+ }
@@ -0,0 +1,59 @@
1
+ import type { ChatConfig, ChatToolDefinition, ChatToolHandlers } from '@genesislcap/foundation-ai';
2
+ import { DI, PartialGenesisElementDefinition } from '@genesislcap/web-core';
3
+
4
+ /**
5
+ * Do not reference any ../main files here. We must avoid ../tags being referenced and
6
+ * therefore set up pre-configuration.
7
+ */
8
+
9
+ /**
10
+ * AiAssistantConfig DI interface.
11
+ *
12
+ * @beta
13
+ */
14
+ export interface AiAssistantConfig extends PartialGenesisElementDefinition {
15
+ /**
16
+ * Display title shown in the chat header (e.g. 'Trades Assistant').
17
+ */
18
+ headerTitle?: string;
19
+ /**
20
+ * Chat display and behaviour configuration.
21
+ */
22
+ chatConfig: ChatConfig;
23
+ /**
24
+ * Tool handlers injected per-app at configure() time.
25
+ */
26
+ toolHandlers?: ChatToolHandlers;
27
+ /**
28
+ * Tool definitions (JSON Schema) passed to the AI provider.
29
+ */
30
+ toolDefinitions?: ChatToolDefinition[];
31
+ /**
32
+ * System prompt injected into every conversation.
33
+ */
34
+ systemPrompt?: string;
35
+ /**
36
+ * Optional factory called at download time to include extra app-specific debug state
37
+ * alongside the message history. Only used when `chatConfig.allowDebugDownload` is `true`.
38
+ */
39
+ debugStateFactory?: () => unknown;
40
+ }
41
+
42
+ /**
43
+ * Default AiAssistantConfig DI implementation.
44
+ *
45
+ * @beta
46
+ */
47
+ export const defaultAiAssistantConfig: AiAssistantConfig = {
48
+ name: 'foundation-ai-assistant',
49
+ chatConfig: {},
50
+ };
51
+
52
+ /**
53
+ * AiAssistantConfig DI key.
54
+ *
55
+ * @internal
56
+ */
57
+ export const AiAssistantConfig = DI.createInterface<AiAssistantConfig>((x) =>
58
+ x.instance(defaultAiAssistantConfig),
59
+ );
File without changes
@@ -0,0 +1 @@
1
+ export * from './config';
package/src/index.ts ADDED
@@ -0,0 +1,9 @@
1
+ export * from './main/main';
2
+ export * from './main/main.types';
3
+ export * from './main/main.template';
4
+ export * from './components/chat-bubble';
5
+ export * from './components/chat-driver';
6
+ export * from './components/activity-halo/activity-halo';
7
+ export * from './channel/ai-activity-channel';
8
+ export * from './config/config';
9
+ export type { AiChatWidget } from './types/ai-chat-widget';
@@ -0,0 +1,4 @@
1
+ export * from './main.template';
2
+ export * from '../styles';
3
+ export * from './main';
4
+ export * from './main.types';