@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.
- package/api-extractor.json +4 -0
- package/dist/ai-assistant.api.json +4028 -0
- package/dist/ai-assistant.d.ts +396 -0
- package/dist/dts/channel/ai-activity-channel.d.ts +32 -0
- package/dist/dts/channel/ai-activity-channel.d.ts.map +1 -0
- package/dist/dts/components/activity-halo/activity-halo.d.ts +31 -0
- package/dist/dts/components/activity-halo/activity-halo.d.ts.map +1 -0
- package/dist/dts/components/chat-bubble/chat-bubble.d.ts +52 -0
- package/dist/dts/components/chat-bubble/chat-bubble.d.ts.map +1 -0
- package/dist/dts/components/chat-bubble/chat-bubble.styles.d.ts +2 -0
- package/dist/dts/components/chat-bubble/chat-bubble.styles.d.ts.map +1 -0
- package/dist/dts/components/chat-bubble/chat-bubble.template.d.ts +4 -0
- package/dist/dts/components/chat-bubble/chat-bubble.template.d.ts.map +1 -0
- package/dist/dts/components/chat-bubble/index.d.ts +2 -0
- package/dist/dts/components/chat-bubble/index.d.ts.map +1 -0
- package/dist/dts/components/chat-driver/chat-driver.d.ts +49 -0
- package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -0
- package/dist/dts/components/chat-driver/index.d.ts +2 -0
- package/dist/dts/components/chat-driver/index.d.ts.map +1 -0
- package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.d.ts +19 -0
- package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.d.ts.map +1 -0
- package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.styles.d.ts +2 -0
- package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.styles.d.ts.map +1 -0
- package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.template.d.ts +3 -0
- package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.template.d.ts.map +1 -0
- package/dist/dts/components/chat-interaction-wrapper/index.d.ts +4 -0
- package/dist/dts/components/chat-interaction-wrapper/index.d.ts.map +1 -0
- package/dist/dts/components/chat-markdown/chat-markdown.d.ts +6 -0
- package/dist/dts/components/chat-markdown/chat-markdown.d.ts.map +1 -0
- package/dist/dts/components/chat-markdown/index.d.ts +2 -0
- package/dist/dts/components/chat-markdown/index.d.ts.map +1 -0
- package/dist/dts/components/halo-overlay.d.ts +25 -0
- package/dist/dts/components/halo-overlay.d.ts.map +1 -0
- package/dist/dts/config/config.d.ts +51 -0
- package/dist/dts/config/config.d.ts.map +1 -0
- package/dist/dts/config/configure.d.ts +1 -0
- package/dist/dts/config/configure.d.ts.map +1 -0
- package/dist/dts/config/index.d.ts +2 -0
- package/dist/dts/config/index.d.ts.map +1 -0
- package/dist/dts/index.d.ts +10 -0
- package/dist/dts/index.d.ts.map +1 -0
- package/dist/dts/main/index.d.ts +5 -0
- package/dist/dts/main/index.d.ts.map +1 -0
- package/dist/dts/main/main.d.ts +103 -0
- package/dist/dts/main/main.d.ts.map +1 -0
- package/dist/dts/main/main.styles.d.ts +2 -0
- package/dist/dts/main/main.styles.d.ts.map +1 -0
- package/dist/dts/main/main.template.d.ts +4 -0
- package/dist/dts/main/main.template.d.ts.map +1 -0
- package/dist/dts/main/main.types.d.ts +54 -0
- package/dist/dts/main/main.types.d.ts.map +1 -0
- package/dist/dts/styles/index.d.ts +2 -0
- package/dist/dts/styles/index.d.ts.map +1 -0
- package/dist/dts/styles/styles.d.ts +5 -0
- package/dist/dts/styles/styles.d.ts.map +1 -0
- package/dist/dts/tags/index.d.ts +1 -0
- package/dist/dts/tags/index.d.ts.map +1 -0
- package/dist/dts/types/ai-chat-widget.d.ts +12 -0
- package/dist/dts/types/ai-chat-widget.d.ts.map +1 -0
- package/dist/dts/utils/index.d.ts +2 -0
- package/dist/dts/utils/index.d.ts.map +1 -0
- package/dist/dts/utils/logger.d.ts +2 -0
- package/dist/dts/utils/logger.d.ts.map +1 -0
- package/dist/esm/channel/ai-activity-channel.js +2 -0
- package/dist/esm/components/activity-halo/activity-halo.js +119 -0
- package/dist/esm/components/chat-bubble/chat-bubble.js +381 -0
- package/dist/esm/components/chat-bubble/chat-bubble.styles.js +193 -0
- package/dist/esm/components/chat-bubble/chat-bubble.template.js +50 -0
- package/dist/esm/components/chat-bubble/index.js +1 -0
- package/dist/esm/components/chat-driver/chat-driver.js +209 -0
- package/dist/esm/components/chat-driver/index.js +1 -0
- package/dist/esm/components/chat-interaction-wrapper/chat-interaction-wrapper.js +90 -0
- package/dist/esm/components/chat-interaction-wrapper/chat-interaction-wrapper.styles.js +6 -0
- package/dist/esm/components/chat-interaction-wrapper/chat-interaction-wrapper.template.js +4 -0
- package/dist/esm/components/chat-interaction-wrapper/index.js +3 -0
- package/dist/esm/components/chat-markdown/chat-markdown.js +95 -0
- package/dist/esm/components/chat-markdown/index.js +1 -0
- package/dist/esm/components/halo-overlay.js +118 -0
- package/dist/esm/config/config.js +16 -0
- package/dist/esm/config/configure.js +0 -0
- package/dist/esm/config/index.js +1 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/main/index.js +4 -0
- package/dist/esm/main/main.js +491 -0
- package/dist/esm/main/main.styles.js +356 -0
- package/dist/esm/main/main.template.js +272 -0
- package/dist/esm/main/main.types.js +22 -0
- package/dist/esm/styles/index.js +1 -0
- package/dist/esm/styles/styles.js +237 -0
- package/dist/esm/tags/index.js +0 -0
- package/dist/esm/types/ai-chat-widget.js +1 -0
- package/dist/esm/utils/index.js +1 -0
- package/dist/esm/utils/logger.js +2 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/docs/.gitattributes +2 -0
- package/docs/api/ai-assistant.ai_activity_channel_name.md +11 -0
- package/docs/api/ai-assistant.aiactivityevents.md +24 -0
- package/docs/api/ai-assistant.aiactivityhalo.channelname.md +16 -0
- package/docs/api/ai-assistant.aiactivityhalo.connectedcallback.md +18 -0
- package/docs/api/ai-assistant.aiactivityhalo.disconnectedcallback.md +18 -0
- package/docs/api/ai-assistant.aiactivityhalo.haloactive.md +14 -0
- package/docs/api/ai-assistant.aiactivityhalo.md +176 -0
- package/docs/api/ai-assistant.aiactivityhalo.minshowtime.md +16 -0
- package/docs/api/ai-assistant.aiactivityhalo.tools.md +16 -0
- package/docs/api/ai-assistant.aiassistantanimation.md +18 -0
- package/docs/api/ai-assistant.aiassistantanimationdef.label.md +16 -0
- package/docs/api/ai-assistant.aiassistantanimationdef.md +80 -0
- package/docs/api/ai-assistant.aiassistantanimationdef.tooltip.md +16 -0
- package/docs/api/ai-assistant.aiassistantconfig.chatconfig.md +16 -0
- package/docs/api/ai-assistant.aiassistantconfig.debugstatefactory.md +16 -0
- package/docs/api/ai-assistant.aiassistantconfig.headertitle.md +16 -0
- package/docs/api/ai-assistant.aiassistantconfig.md +157 -0
- package/docs/api/ai-assistant.aiassistantconfig.systemprompt.md +16 -0
- package/docs/api/ai-assistant.aiassistantconfig.tooldefinitions.md +16 -0
- package/docs/api/ai-assistant.aiassistantconfig.toolhandlers.md +16 -0
- package/docs/api/ai-assistant.aiassistantserializedstate.enabledanimations.md +14 -0
- package/docs/api/ai-assistant.aiassistantserializedstate.md +118 -0
- package/docs/api/ai-assistant.aiassistantserializedstate.messages.md +14 -0
- package/docs/api/ai-assistant.aiassistantserializedstate.showthinkingsteps.md +14 -0
- package/docs/api/ai-assistant.aiassistantserializedstate.showtoolcalls.md +14 -0
- package/docs/api/ai-assistant.aiassistantstate.md +16 -0
- package/docs/api/ai-assistant.aichatbubble.bubbleleft.md +11 -0
- package/docs/api/ai-assistant.aichatbubble.bubbletop.md +11 -0
- package/docs/api/ai-assistant.aichatbubble.channelname.md +11 -0
- package/docs/api/ai-assistant.aichatbubble.connectedcallback.md +15 -0
- package/docs/api/ai-assistant.aichatbubble.designsystemprefix.md +11 -0
- package/docs/api/ai-assistant.aichatbubble.dialogcontent.md +11 -0
- package/docs/api/ai-assistant.aichatbubble.dialogcontentchanged.md +64 -0
- package/docs/api/ai-assistant.aichatbubble.dialogheight.md +11 -0
- package/docs/api/ai-assistant.aichatbubble.dialogleft.md +11 -0
- package/docs/api/ai-assistant.aichatbubble.dialogopen.md +11 -0
- package/docs/api/ai-assistant.aichatbubble.dialogopenchanged.md +64 -0
- package/docs/api/ai-assistant.aichatbubble.dialogtop.md +11 -0
- package/docs/api/ai-assistant.aichatbubble.dialogwidth.md +11 -0
- package/docs/api/ai-assistant.aichatbubble.disconnectedcallback.md +15 -0
- package/docs/api/ai-assistant.aichatbubble.hovered.md +11 -0
- package/docs/api/ai-assistant.aichatbubble.imagesrc.md +11 -0
- package/docs/api/ai-assistant.aichatbubble.md +396 -0
- package/docs/api/ai-assistant.aichatbubble.onbubblemousedown.md +50 -0
- package/docs/api/ai-assistant.aichatbubble.onclosedialog.md +15 -0
- package/docs/api/ai-assistant.aichatbubble.ondialogheadermousedown.md +53 -0
- package/docs/api/ai-assistant.aichatbubble.onpopout.md +15 -0
- package/docs/api/ai-assistant.aichatbubble.title.md +11 -0
- package/docs/api/ai-assistant.aichatbubble.tooltipstyle.md +11 -0
- package/docs/api/ai-assistant.aichatwidget.data.md +14 -0
- package/docs/api/ai-assistant.aichatwidget.md +80 -0
- package/docs/api/ai-assistant.aichatwidget.resolved.md +16 -0
- package/docs/api/ai-assistant.animation_defs.md +25 -0
- package/docs/api/ai-assistant.chatdriver._constructor_.md +99 -0
- package/docs/api/ai-assistant.chatdriver.gethistory.md +18 -0
- package/docs/api/ai-assistant.chatdriver.isbusy.md +18 -0
- package/docs/api/ai-assistant.chatdriver.loadhistory.md +55 -0
- package/docs/api/ai-assistant.chatdriver.md +158 -0
- package/docs/api/ai-assistant.chatdriver.requestinteraction.md +73 -0
- package/docs/api/ai-assistant.chatdriver.resolveinteraction.md +69 -0
- package/docs/api/ai-assistant.chatdriver.sendmessage.md +69 -0
- package/docs/api/ai-assistant.chathistoryupdatedevent.md +16 -0
- package/docs/api/ai-assistant.defaultaiassistantconfig.md +16 -0
- package/docs/api/ai-assistant.foundationaiassistant.aiprovider.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.applystate.md +55 -0
- package/docs/api/ai-assistant.foundationaiassistant.attachmenterrors.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.attachments.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.channelname.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.chatconfig.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.connectedcallback.md +18 -0
- package/docs/api/ai-assistant.foundationaiassistant.debugstatefactory.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.designsystemprefix.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.disconnectedcallback.md +18 -0
- package/docs/api/ai-assistant.foundationaiassistant.downloadhistory.md +18 -0
- package/docs/api/ai-assistant.foundationaiassistant.enabledanimations.md +16 -0
- package/docs/api/ai-assistant.foundationaiassistant.handlefileselect.md +53 -0
- package/docs/api/ai-assistant.foundationaiassistant.handleinteractioncompleted.md +53 -0
- package/docs/api/ai-assistant.foundationaiassistant.handlepopout.md +20 -0
- package/docs/api/ai-assistant.foundationaiassistant.handlesendclick.md +18 -0
- package/docs/api/ai-assistant.foundationaiassistant.hasactivependinginteraction.md +16 -0
- package/docs/api/ai-assistant.foundationaiassistant.headertitle.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.imagesrc.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.inputvalue.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.md +826 -0
- package/docs/api/ai-assistant.foundationaiassistant.messages.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.messageschanged.md +18 -0
- package/docs/api/ai-assistant.foundationaiassistant.onchatheadermousedown.md +53 -0
- package/docs/api/ai-assistant.foundationaiassistant.placeholder.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.popoutmode.md +16 -0
- package/docs/api/ai-assistant.foundationaiassistant.removeattachment.md +53 -0
- package/docs/api/ai-assistant.foundationaiassistant.removeattachmenterror.md +53 -0
- package/docs/api/ai-assistant.foundationaiassistant.setenabledanimations.md +53 -0
- package/docs/api/ai-assistant.foundationaiassistant.settingsopen.md +16 -0
- package/docs/api/ai-assistant.foundationaiassistant.showhalo.md +16 -0
- package/docs/api/ai-assistant.foundationaiassistant.showhalochanged.md +18 -0
- package/docs/api/ai-assistant.foundationaiassistant.showloadingindicator.md +16 -0
- package/docs/api/ai-assistant.foundationaiassistant.showloadingindicatorchanged.md +18 -0
- package/docs/api/ai-assistant.foundationaiassistant.showthinkingsteps.md +16 -0
- package/docs/api/ai-assistant.foundationaiassistant.showtoolcalls.md +16 -0
- package/docs/api/ai-assistant.foundationaiassistant.state.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.statechanged.md +18 -0
- package/docs/api/ai-assistant.foundationaiassistant.systemprompt.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.togglesettings.md +18 -0
- package/docs/api/ai-assistant.foundationaiassistant.toggleshowthinkingsteps.md +18 -0
- package/docs/api/ai-assistant.foundationaiassistant.toggleshowtoolcalls.md +18 -0
- package/docs/api/ai-assistant.foundationaiassistant.tooldefinitions.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.toolhandlers.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.triggerfileinput.md +18 -0
- package/docs/api/ai-assistant.foundationaiassistant.visiblemessages.md +16 -0
- package/docs/api/ai-assistant.foundationaiassistanttemplate.md +50 -0
- package/docs/api/ai-assistant.md +262 -0
- package/docs/api/ai-assistant.popoutmode.md +16 -0
- package/docs/api/index.md +30 -0
- package/docs/api-report.md.api.md +280 -0
- package/license.txt +46 -0
- package/package.json +92 -0
- package/src/channel/ai-activity-channel.ts +30 -0
- package/src/components/activity-halo/activity-halo.ts +113 -0
- package/src/components/chat-bubble/chat-bubble.styles.ts +194 -0
- package/src/components/chat-bubble/chat-bubble.template.ts +63 -0
- package/src/components/chat-bubble/chat-bubble.ts +389 -0
- package/src/components/chat-bubble/index.ts +1 -0
- package/src/components/chat-driver/chat-driver.ts +254 -0
- package/src/components/chat-driver/index.ts +1 -0
- package/src/components/chat-interaction-wrapper/chat-interaction-wrapper.styles.ts +7 -0
- package/src/components/chat-interaction-wrapper/chat-interaction-wrapper.template.ts +6 -0
- package/src/components/chat-interaction-wrapper/chat-interaction-wrapper.ts +89 -0
- package/src/components/chat-interaction-wrapper/index.ts +3 -0
- package/src/components/chat-markdown/chat-markdown.ts +87 -0
- package/src/components/chat-markdown/index.ts +1 -0
- package/src/components/halo-overlay.ts +115 -0
- package/src/config/config.ts +59 -0
- package/src/config/configure.ts +0 -0
- package/src/config/index.ts +1 -0
- package/src/index.ts +9 -0
- package/src/main/index.ts +4 -0
- package/src/main/main.styles.ts +357 -0
- package/src/main/main.template.ts +364 -0
- package/src/main/main.ts +474 -0
- package/src/main/main.types.ts +58 -0
- package/src/styles/index.ts +1 -0
- package/src/styles/styles.ts +238 -0
- package/src/tags/index.ts +0 -0
- package/src/types/ai-chat-widget.ts +11 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/logger.ts +3 -0
- package/temp/api-report.md.api.md +280 -0
- package/tsconfig.json +11 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-markdown.d.ts","sourceRoot":"","sources":["../../../../src/components/chat-markdown/chat-markdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,cAAc,EAAoB,MAAM,uBAAuB,CAAC;AAuE7F,qBAOa,cAAe,SAAQ,cAAc;IACpC,OAAO,EAAE,MAAM,CAAM;IAEjC,cAAc;CAKf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/chat-markdown/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { GenesisElement } from '@genesislcap/web-core';
|
|
2
|
+
/**
|
|
3
|
+
* Animated halo overlay — rotating conic-gradient border with an inward glow.
|
|
4
|
+
*
|
|
5
|
+
* Drop inside any `position: relative; overflow: hidden` container and toggle
|
|
6
|
+
* the `active` attribute to show/hide the effect.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```html
|
|
10
|
+
* <ai-halo-overlay ?active="${(x) => x.isLoading}"></ai-halo-overlay>
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @beta
|
|
14
|
+
*/
|
|
15
|
+
export declare class AiHaloOverlay extends GenesisElement {
|
|
16
|
+
active: boolean;
|
|
17
|
+
private static readonly DEG_PER_FRAME;
|
|
18
|
+
private static readonly FULL_ROTATION_DEG;
|
|
19
|
+
private angle;
|
|
20
|
+
private animFrame?;
|
|
21
|
+
connectedCallback(): void;
|
|
22
|
+
disconnectedCallback(): void;
|
|
23
|
+
private tick;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=halo-overlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"halo-overlay.d.ts","sourceRoot":"","sources":["../../../src/components/halo-overlay.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,cAAc,EAAQ,MAAM,uBAAuB,CAAC;AAEvF;;;;;;;;;;;;GAYG;AACH,qBAkEa,aAAc,SAAQ,cAAc;IACpB,MAAM,EAAE,OAAO,CAAS;IASnD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAO;IAC5C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAO;IAEhD,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,SAAS,CAAC,CAAS;IAE3B,iBAAiB;IAKjB,oBAAoB;IAOpB,OAAO,CAAC,IAAI;CAKb"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ChatConfig, ChatToolDefinition, ChatToolHandlers } from '@genesislcap/foundation-ai';
|
|
2
|
+
import { PartialGenesisElementDefinition } from '@genesislcap/web-core';
|
|
3
|
+
/**
|
|
4
|
+
* Do not reference any ../main files here. We must avoid ../tags being referenced and
|
|
5
|
+
* therefore set up pre-configuration.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* AiAssistantConfig DI interface.
|
|
9
|
+
*
|
|
10
|
+
* @beta
|
|
11
|
+
*/
|
|
12
|
+
export interface AiAssistantConfig extends PartialGenesisElementDefinition {
|
|
13
|
+
/**
|
|
14
|
+
* Display title shown in the chat header (e.g. 'Trades Assistant').
|
|
15
|
+
*/
|
|
16
|
+
headerTitle?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Chat display and behaviour configuration.
|
|
19
|
+
*/
|
|
20
|
+
chatConfig: ChatConfig;
|
|
21
|
+
/**
|
|
22
|
+
* Tool handlers injected per-app at configure() time.
|
|
23
|
+
*/
|
|
24
|
+
toolHandlers?: ChatToolHandlers;
|
|
25
|
+
/**
|
|
26
|
+
* Tool definitions (JSON Schema) passed to the AI provider.
|
|
27
|
+
*/
|
|
28
|
+
toolDefinitions?: ChatToolDefinition[];
|
|
29
|
+
/**
|
|
30
|
+
* System prompt injected into every conversation.
|
|
31
|
+
*/
|
|
32
|
+
systemPrompt?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Optional factory called at download time to include extra app-specific debug state
|
|
35
|
+
* alongside the message history. Only used when `chatConfig.allowDebugDownload` is `true`.
|
|
36
|
+
*/
|
|
37
|
+
debugStateFactory?: () => unknown;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Default AiAssistantConfig DI implementation.
|
|
41
|
+
*
|
|
42
|
+
* @beta
|
|
43
|
+
*/
|
|
44
|
+
export declare const defaultAiAssistantConfig: AiAssistantConfig;
|
|
45
|
+
/**
|
|
46
|
+
* AiAssistantConfig DI key.
|
|
47
|
+
*
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
export declare const AiAssistantConfig: import("@microsoft/fast-foundation").InterfaceSymbol<AiAssistantConfig>;
|
|
51
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnG,OAAO,EAAM,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAE5E;;;GAGG;AAEH;;;;GAIG;AACH,MAAM,WAAW,iBAAkB,SAAQ,+BAA+B;IACxE;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,UAAU,EAAE,UAAU,CAAC;IACvB;;OAEG;IACH,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC;;OAEG;IACH,eAAe,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACvC;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC;CACnC;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,iBAGtC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,yEAE7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=configure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../../src/config/configure.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
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';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0CAA0C,CAAC;AACzD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/main/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { AIProvider } from '@genesislcap/foundation-ai';
|
|
2
|
+
import type { ChatAttachment, ChatConfig, ChatMessage, ChatToolDefinition, ChatToolHandlers } from '@genesislcap/foundation-ai';
|
|
3
|
+
import { GenesisElement } from '@genesislcap/web-core';
|
|
4
|
+
import type { AiAssistantSerializedState } from '../channel/ai-activity-channel';
|
|
5
|
+
import type { AiAssistantAnimation, AiAssistantState, PopoutMode } from './main.types';
|
|
6
|
+
/**
|
|
7
|
+
* Foundation AI Assistant component.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* Lazy-loaded via `configure()`. Inject an `AIProvider` and `AiAssistantConfig` through the DI
|
|
11
|
+
* container. The component creates a `ChatDriver` to manage the conversation loop.
|
|
12
|
+
*
|
|
13
|
+
* @beta
|
|
14
|
+
*/
|
|
15
|
+
export declare class FoundationAiAssistant extends GenesisElement {
|
|
16
|
+
aiProvider: AIProvider;
|
|
17
|
+
designSystemPrefix: string;
|
|
18
|
+
headerTitle?: string;
|
|
19
|
+
channelName: string;
|
|
20
|
+
imageSrc?: string;
|
|
21
|
+
placeholder: string;
|
|
22
|
+
/**
|
|
23
|
+
* Controls the pop-out button shown next to the settings cog.
|
|
24
|
+
* "expand" — in bubble, expands to layout panel (fires chat-popout).
|
|
25
|
+
* "collapse" — in layout panel, collapses back to bubble (fires chat-popin).
|
|
26
|
+
* Absent — no button (default standalone behaviour, no breaking change).
|
|
27
|
+
*/
|
|
28
|
+
popoutMode?: PopoutMode;
|
|
29
|
+
systemPrompt?: string;
|
|
30
|
+
toolDefinitions?: ChatToolDefinition[];
|
|
31
|
+
toolHandlers?: ChatToolHandlers;
|
|
32
|
+
chatConfig: ChatConfig;
|
|
33
|
+
debugStateFactory?: () => unknown;
|
|
34
|
+
messages: ChatMessage[];
|
|
35
|
+
state: AiAssistantState;
|
|
36
|
+
inputValue: string;
|
|
37
|
+
attachments: ChatAttachment[];
|
|
38
|
+
attachmentErrors: string[];
|
|
39
|
+
/** Current user-facing toggle state for tool call visibility. */
|
|
40
|
+
showToolCalls: boolean;
|
|
41
|
+
/** Current user-facing toggle state for thinking step visibility. */
|
|
42
|
+
showThinkingSteps: boolean;
|
|
43
|
+
/** Currently enabled animations. */
|
|
44
|
+
enabledAnimations: AiAssistantAnimation[];
|
|
45
|
+
/** Whether the loading spinner is currently visible. Controlled by the loading delay timer. */
|
|
46
|
+
showLoadingIndicator: boolean;
|
|
47
|
+
/** Whether the settings panel is open. */
|
|
48
|
+
settingsOpen: boolean;
|
|
49
|
+
private driver?;
|
|
50
|
+
private loadingTimer;
|
|
51
|
+
private activityChannel?;
|
|
52
|
+
private haloStartPublished;
|
|
53
|
+
/**
|
|
54
|
+
* Whether the halo animation should be shown.
|
|
55
|
+
* True when the AI is actively computing (loading state, no pending interaction).
|
|
56
|
+
*/
|
|
57
|
+
showHalo: boolean;
|
|
58
|
+
private syncShowHalo;
|
|
59
|
+
/** True when there is a pending (unresolved) interaction — disables the popout button. */
|
|
60
|
+
get hasActivePendingInteraction(): boolean;
|
|
61
|
+
showHaloChanged(): void;
|
|
62
|
+
private getActiveToolNames;
|
|
63
|
+
/**
|
|
64
|
+
* Messages filtered by the current toggle state.
|
|
65
|
+
* Tool-related messages (those with toolCalls or toolResult) are hidden when
|
|
66
|
+
* `showToolCalls` is false.
|
|
67
|
+
*/
|
|
68
|
+
get visibleMessages(): ChatMessage[];
|
|
69
|
+
connectedCallback(): void;
|
|
70
|
+
disconnectedCallback(): void;
|
|
71
|
+
private onChannelMessage;
|
|
72
|
+
stateChanged(): void;
|
|
73
|
+
messagesChanged(): void;
|
|
74
|
+
showLoadingIndicatorChanged(): void;
|
|
75
|
+
private scrollToBottom;
|
|
76
|
+
private static readonly DEFAULT_LOADING_DELAY_S;
|
|
77
|
+
private static readonly MS_PER_SECOND;
|
|
78
|
+
private startLoadingTimer;
|
|
79
|
+
private clearLoadingTimer;
|
|
80
|
+
private stopLoadingTimer;
|
|
81
|
+
/** Called when the user clicks the popout button. */
|
|
82
|
+
handlePopout(): void;
|
|
83
|
+
/** Applies a serialized state snapshot to this live instance (used on collapse path). */
|
|
84
|
+
applyState(state: AiAssistantSerializedState): void;
|
|
85
|
+
private serializeState;
|
|
86
|
+
toggleSettings(): void;
|
|
87
|
+
toggleShowToolCalls(): void;
|
|
88
|
+
toggleShowThinkingSteps(): void;
|
|
89
|
+
setEnabledAnimations(animations: AiAssistantAnimation[]): void;
|
|
90
|
+
downloadHistory(): void;
|
|
91
|
+
triggerFileInput(): void;
|
|
92
|
+
handleFileSelect(e: Event): void;
|
|
93
|
+
removeAttachment(attachment: ChatAttachment): void;
|
|
94
|
+
removeAttachmentError(message: string): void;
|
|
95
|
+
private isAcceptedFile;
|
|
96
|
+
private readFileAsText;
|
|
97
|
+
private loadSelectedFiles;
|
|
98
|
+
handleSendClick(): void;
|
|
99
|
+
private send;
|
|
100
|
+
onChatHeaderMouseDown(e: MouseEvent): void;
|
|
101
|
+
handleInteractionCompleted(e: Event): void;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=main.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/main/main.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.styles.d.ts","sourceRoot":"","sources":["../../../src/main/main.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,iDAkWlB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ViewTemplate } from '@genesislcap/web-core';
|
|
2
|
+
import type { FoundationAiAssistant } from './main';
|
|
3
|
+
export declare const FoundationAiAssistantTemplate: (designSystemPrefix: string) => ViewTemplate<FoundationAiAssistant>;
|
|
4
|
+
//# sourceMappingURL=main.template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.template.d.ts","sourceRoot":"","sources":["../../../src/main/main.template.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AA2CpD,eAAO,MAAM,6BAA6B,GACxC,oBAAoB,MAAM,KACzB,YAAY,CAAC,qBAAqB,CA4TpC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* State of the AI assistant component.
|
|
3
|
+
*
|
|
4
|
+
* @beta
|
|
5
|
+
*/
|
|
6
|
+
export type AiAssistantState = 'idle' | 'loading' | 'error';
|
|
7
|
+
/**
|
|
8
|
+
* Controls the pop-out button shown in the assistant header.
|
|
9
|
+
* - `"expand"` — assistant is embedded in the bubble dialog; button expands it to a layout panel.
|
|
10
|
+
* - `"collapse"` — assistant is in a layout panel; button collapses it back to the bubble.
|
|
11
|
+
*
|
|
12
|
+
* @beta
|
|
13
|
+
*/
|
|
14
|
+
export type PopoutMode = 'expand' | 'collapse';
|
|
15
|
+
/**
|
|
16
|
+
* Metadata describing a UI animation in the assistant.
|
|
17
|
+
*
|
|
18
|
+
* @beta
|
|
19
|
+
*/
|
|
20
|
+
export interface AiAssistantAnimationDef {
|
|
21
|
+
/** Display label shown in the settings multiselect. */
|
|
22
|
+
label: string;
|
|
23
|
+
/** Short description shown as a tooltip on the option. */
|
|
24
|
+
tooltip: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Registry of all available animations with their display metadata.
|
|
28
|
+
* Adding an entry here automatically extends the {@link AiAssistantAnimation} type.
|
|
29
|
+
*
|
|
30
|
+
* @beta
|
|
31
|
+
*/
|
|
32
|
+
export declare const ANIMATION_DEFS: {
|
|
33
|
+
loading: {
|
|
34
|
+
label: string;
|
|
35
|
+
tooltip: string;
|
|
36
|
+
};
|
|
37
|
+
halo: {
|
|
38
|
+
label: string;
|
|
39
|
+
tooltip: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Union of all available animation names, derived from {@link ANIMATION_DEFS}.
|
|
44
|
+
*
|
|
45
|
+
* @beta
|
|
46
|
+
*/
|
|
47
|
+
export type AiAssistantAnimation = keyof typeof ANIMATION_DEFS;
|
|
48
|
+
/**
|
|
49
|
+
* All available animation names, derived from the registry.
|
|
50
|
+
*
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
export declare const ALL_ANIMATIONS: AiAssistantAnimation[];
|
|
54
|
+
//# sourceMappingURL=main.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.types.d.ts","sourceRoot":"","sources":["../../../src/main/main.types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAE5D;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE/C;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc;;;;;;;;;CASwB,CAAC;AAEpD;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,OAAO,cAAc,CAAC;AAE/D;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAkC,oBAAoB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/styles/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/styles/styles.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,2BAA2B,iDAwOvC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tags/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface that AI inline interaction components can implement.
|
|
3
|
+
* The `AiChatInteractionWrapper` always sets `data` and `resolved` on the rendered element.
|
|
4
|
+
*
|
|
5
|
+
* @beta
|
|
6
|
+
*/
|
|
7
|
+
export interface AiChatWidget {
|
|
8
|
+
data: unknown;
|
|
9
|
+
/** When true, the interaction has already been resolved. Components should render read-only. */
|
|
10
|
+
resolved?: boolean;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=ai-chat-widget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-chat-widget.d.ts","sourceRoot":"","sources":["../../../src/types/ai-chat-widget.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,gGAAgG;IAChG,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/utils/logger.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,iDAA+B,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { createTypedBroadcastChannel } from '@genesislcap/foundation-broadcast-channel';
|
|
3
|
+
import { attr, customElement, GenesisElement, html, observable } from '@genesislcap/web-core';
|
|
4
|
+
import { AI_ACTIVITY_CHANNEL_NAME } from '../../channel/ai-activity-channel';
|
|
5
|
+
import { AiHaloOverlay } from '../halo-overlay';
|
|
6
|
+
const DEFAULT_MIN_SHOW_TIME = 600;
|
|
7
|
+
AiHaloOverlay;
|
|
8
|
+
/**
|
|
9
|
+
* Wrapper component that shows an `<ai-halo-overlay>` when the AI assistant
|
|
10
|
+
* is executing one of the declared tool names.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```html
|
|
14
|
+
* <ai-activity-halo tools="search_trades">
|
|
15
|
+
* <trades-grid></trades-grid>
|
|
16
|
+
* </ai-activity-halo>
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @beta
|
|
20
|
+
*/
|
|
21
|
+
let AiActivityHalo = class AiActivityHalo extends GenesisElement {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
/** Comma-separated list of tool names this element reacts to. */
|
|
25
|
+
this.tools = '';
|
|
26
|
+
/** Broadcast channel name — must match the assistant's channel-name attribute. */
|
|
27
|
+
this.channelName = AI_ACTIVITY_CHANNEL_NAME;
|
|
28
|
+
/** Minimum time in ms the halo stays visible after activation. */
|
|
29
|
+
this.minShowTime = DEFAULT_MIN_SHOW_TIME;
|
|
30
|
+
this.haloActive = false;
|
|
31
|
+
this.startTime = 0;
|
|
32
|
+
}
|
|
33
|
+
connectedCallback() {
|
|
34
|
+
super.connectedCallback();
|
|
35
|
+
this.channel = createTypedBroadcastChannel(this.channelName);
|
|
36
|
+
this.channel.onmessage = (ev) => {
|
|
37
|
+
if (this.channel.isMessageType('halo-start', ev)) {
|
|
38
|
+
const { toolNames } = ev.data.detail;
|
|
39
|
+
const myTools = this.tools
|
|
40
|
+
.split(',')
|
|
41
|
+
.map((t) => t.trim())
|
|
42
|
+
.filter(Boolean);
|
|
43
|
+
if (myTools.length === 0 || toolNames.some((name) => myTools.includes(name))) {
|
|
44
|
+
this.activate();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
else if (this.channel.isMessageType('halo-stop', ev)) {
|
|
48
|
+
this.scheduleDeactivate();
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
disconnectedCallback() {
|
|
53
|
+
var _a;
|
|
54
|
+
super.disconnectedCallback();
|
|
55
|
+
(_a = this.channel) === null || _a === void 0 ? void 0 : _a.close();
|
|
56
|
+
this.channel = undefined;
|
|
57
|
+
if (this.hideTimeout !== undefined) {
|
|
58
|
+
clearTimeout(this.hideTimeout);
|
|
59
|
+
this.hideTimeout = undefined;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
activate() {
|
|
63
|
+
if (this.hideTimeout !== undefined) {
|
|
64
|
+
clearTimeout(this.hideTimeout);
|
|
65
|
+
this.hideTimeout = undefined;
|
|
66
|
+
}
|
|
67
|
+
this.startTime = Date.now();
|
|
68
|
+
this.haloActive = true;
|
|
69
|
+
}
|
|
70
|
+
scheduleDeactivate() {
|
|
71
|
+
const elapsed = Date.now() - this.startTime;
|
|
72
|
+
const remaining = this.minShowTime - elapsed;
|
|
73
|
+
if (remaining <= 0) {
|
|
74
|
+
this.haloActive = false;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
this.hideTimeout = setTimeout(() => {
|
|
78
|
+
this.haloActive = false;
|
|
79
|
+
this.hideTimeout = undefined;
|
|
80
|
+
}, remaining);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
__decorate([
|
|
85
|
+
attr
|
|
86
|
+
], AiActivityHalo.prototype, "tools", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
attr({ attribute: 'channel-name' })
|
|
89
|
+
], AiActivityHalo.prototype, "channelName", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
attr({ attribute: 'min-show-time', converter: { fromView: Number, toView: String } })
|
|
92
|
+
], AiActivityHalo.prototype, "minShowTime", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
observable
|
|
95
|
+
], AiActivityHalo.prototype, "haloActive", void 0);
|
|
96
|
+
AiActivityHalo = __decorate([
|
|
97
|
+
customElement({
|
|
98
|
+
name: 'ai-activity-halo',
|
|
99
|
+
template: html `
|
|
100
|
+
<div class="wrapper">
|
|
101
|
+
<slot></slot>
|
|
102
|
+
<ai-halo-overlay aria-hidden="true" ?active="${(x) => x.haloActive}"></ai-halo-overlay>
|
|
103
|
+
</div>
|
|
104
|
+
`,
|
|
105
|
+
styles: `
|
|
106
|
+
:host {
|
|
107
|
+
display: contents;
|
|
108
|
+
}
|
|
109
|
+
.wrapper {
|
|
110
|
+
position: relative;
|
|
111
|
+
overflow: hidden;
|
|
112
|
+
border-radius: inherit;
|
|
113
|
+
height: 100%;
|
|
114
|
+
width: 100%;
|
|
115
|
+
}
|
|
116
|
+
`,
|
|
117
|
+
})
|
|
118
|
+
], AiActivityHalo);
|
|
119
|
+
export { AiActivityHalo };
|