@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
package/package.json
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@genesislcap/ai-assistant",
|
|
3
|
+
"description": "Genesis AI Assistant micro-frontend",
|
|
4
|
+
"version": "14.403.0-ai-assistant.1",
|
|
5
|
+
"license": "SEE LICENSE IN license.txt",
|
|
6
|
+
"main": "dist/esm/index.js",
|
|
7
|
+
"types": "dist/ai-assistant.d.ts",
|
|
8
|
+
"config": {
|
|
9
|
+
"PORT": 5099
|
|
10
|
+
},
|
|
11
|
+
"genx": {
|
|
12
|
+
"app": {
|
|
13
|
+
"rootElement": "foundation-ai-assistant"
|
|
14
|
+
},
|
|
15
|
+
"federation": {
|
|
16
|
+
"remotes": [
|
|
17
|
+
"@genesislcap/rapid-design-system"
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/ai-assistant.d.ts",
|
|
24
|
+
"default": "./dist/esm/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./config": {
|
|
27
|
+
"types": "./dist/dts/config/index.d.ts",
|
|
28
|
+
"default": "./dist/esm/config/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./package.json": "./package.json"
|
|
31
|
+
},
|
|
32
|
+
"typesVersions": {
|
|
33
|
+
"*": {
|
|
34
|
+
"config": [
|
|
35
|
+
"./dist/dts/config/index.d.ts"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "genx build -b ts",
|
|
41
|
+
"build:webpack": "genx build",
|
|
42
|
+
"build:webpack:stats": "genx analyze",
|
|
43
|
+
"circular": "npx -y madge --extensions ts --circular ./src",
|
|
44
|
+
"clean": "rimraf dist temp tsconfig.tsbuildinfo",
|
|
45
|
+
"dev": "genx dev -b webpack",
|
|
46
|
+
"dev:tsc": "genx dev -b ts",
|
|
47
|
+
"dev:no-open": "genx dev --no-open -b webpack",
|
|
48
|
+
"serve": "genx serve",
|
|
49
|
+
"test": "genx test",
|
|
50
|
+
"test:coverage": "genx test --coverage",
|
|
51
|
+
"lint": "genx lint --profile",
|
|
52
|
+
"lint:fix": "genx lint --fix"
|
|
53
|
+
},
|
|
54
|
+
"madge": {
|
|
55
|
+
"detectiveOptions": {
|
|
56
|
+
"ts": {
|
|
57
|
+
"skipTypeImports": true
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@genesislcap/foundation-testing": "14.403.0-ai-assistant.1",
|
|
63
|
+
"@genesislcap/genx": "14.403.0-ai-assistant.1",
|
|
64
|
+
"@genesislcap/rollup-builder": "14.403.0-ai-assistant.1",
|
|
65
|
+
"@genesislcap/ts-builder": "14.403.0-ai-assistant.1",
|
|
66
|
+
"@genesislcap/uvu-playwright-builder": "14.403.0-ai-assistant.1",
|
|
67
|
+
"@genesislcap/vite-builder": "14.403.0-ai-assistant.1",
|
|
68
|
+
"@genesislcap/webpack-builder": "14.403.0-ai-assistant.1",
|
|
69
|
+
"@types/dompurify": "^3.0.5",
|
|
70
|
+
"@types/marked": "^5.0.2"
|
|
71
|
+
},
|
|
72
|
+
"dependencies": {
|
|
73
|
+
"@genesislcap/foundation-ai": "14.403.0-ai-assistant.1",
|
|
74
|
+
"@genesislcap/foundation-broadcast-channel": "14.403.0-ai-assistant.1",
|
|
75
|
+
"@genesislcap/foundation-logger": "14.403.0-ai-assistant.1",
|
|
76
|
+
"@genesislcap/foundation-ui": "14.403.0-ai-assistant.1",
|
|
77
|
+
"@genesislcap/foundation-utils": "14.403.0-ai-assistant.1",
|
|
78
|
+
"@genesislcap/rapid-design-system": "14.403.0-ai-assistant.1",
|
|
79
|
+
"@genesislcap/web-core": "14.403.0-ai-assistant.1",
|
|
80
|
+
"dompurify": "^3.3.1",
|
|
81
|
+
"marked": "^17.0.3"
|
|
82
|
+
},
|
|
83
|
+
"repository": {
|
|
84
|
+
"type": "git",
|
|
85
|
+
"url": "git+https://github.com/genesislcap/foundation-ui.git",
|
|
86
|
+
"directory": "packages/foundation/foundation-mf/ai-assistant"
|
|
87
|
+
},
|
|
88
|
+
"publishConfig": {
|
|
89
|
+
"access": "public"
|
|
90
|
+
},
|
|
91
|
+
"gitHead": "9bf644a2d10eb82216e29b5449d84127561ddf72"
|
|
92
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// TODO: each bubble/assistant pair must use a unique channel-name to avoid cross-talk
|
|
2
|
+
|
|
3
|
+
import type { ChatMessage } from '@genesislcap/foundation-ai';
|
|
4
|
+
import type { AiAssistantAnimation } from '../main/main.types';
|
|
5
|
+
|
|
6
|
+
export const AI_ACTIVITY_CHANNEL_NAME = 'foundation-ai-activity';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Serialized state of a `FoundationAiAssistant` instance.
|
|
10
|
+
* All fields are JSON-serializable and round-trip through BroadcastChannel structured-clone.
|
|
11
|
+
*
|
|
12
|
+
* @beta
|
|
13
|
+
*/
|
|
14
|
+
export interface AiAssistantSerializedState {
|
|
15
|
+
messages: ChatMessage[];
|
|
16
|
+
showToolCalls: boolean;
|
|
17
|
+
showThinkingSteps: boolean;
|
|
18
|
+
enabledAnimations: AiAssistantAnimation[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type AiActivityEvents = {
|
|
22
|
+
/** Fired when the assistant begins a tool call. Contains the names of all active tools. */
|
|
23
|
+
'halo-start': { toolNames: string[] };
|
|
24
|
+
/** Fired when the assistant finishes all tool processing and returns to idle. */
|
|
25
|
+
'halo-stop': void;
|
|
26
|
+
/** Fired when the user clicks the expand button — moves assistant from bubble into layout. */
|
|
27
|
+
'chat-popout': { state: AiAssistantSerializedState };
|
|
28
|
+
/** Fired when the user clicks the collapse button — moves assistant from layout back to bubble. */
|
|
29
|
+
'chat-popin': { state: AiAssistantSerializedState };
|
|
30
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { createTypedBroadcastChannel } from '@genesislcap/foundation-broadcast-channel';
|
|
2
|
+
import type { TypedBroadcastChannel } 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 type { AiActivityEvents } from '../../channel/ai-activity-channel';
|
|
6
|
+
import { AiHaloOverlay } from '../halo-overlay';
|
|
7
|
+
|
|
8
|
+
const DEFAULT_MIN_SHOW_TIME = 600;
|
|
9
|
+
|
|
10
|
+
AiHaloOverlay;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Wrapper component that shows an `<ai-halo-overlay>` when the AI assistant
|
|
14
|
+
* is executing one of the declared tool names.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```html
|
|
18
|
+
* <ai-activity-halo tools="search_trades">
|
|
19
|
+
* <trades-grid></trades-grid>
|
|
20
|
+
* </ai-activity-halo>
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @beta
|
|
24
|
+
*/
|
|
25
|
+
@customElement({
|
|
26
|
+
name: 'ai-activity-halo',
|
|
27
|
+
template: html`
|
|
28
|
+
<div class="wrapper">
|
|
29
|
+
<slot></slot>
|
|
30
|
+
<ai-halo-overlay aria-hidden="true" ?active="${(x) => x.haloActive}"></ai-halo-overlay>
|
|
31
|
+
</div>
|
|
32
|
+
`,
|
|
33
|
+
styles: `
|
|
34
|
+
:host {
|
|
35
|
+
display: contents;
|
|
36
|
+
}
|
|
37
|
+
.wrapper {
|
|
38
|
+
position: relative;
|
|
39
|
+
overflow: hidden;
|
|
40
|
+
border-radius: inherit;
|
|
41
|
+
height: 100%;
|
|
42
|
+
width: 100%;
|
|
43
|
+
}
|
|
44
|
+
`,
|
|
45
|
+
})
|
|
46
|
+
export class AiActivityHalo extends GenesisElement {
|
|
47
|
+
/** Comma-separated list of tool names this element reacts to. */
|
|
48
|
+
@attr tools: string = '';
|
|
49
|
+
|
|
50
|
+
/** Broadcast channel name — must match the assistant's channel-name attribute. */
|
|
51
|
+
@attr({ attribute: 'channel-name' }) channelName: string = AI_ACTIVITY_CHANNEL_NAME;
|
|
52
|
+
|
|
53
|
+
/** Minimum time in ms the halo stays visible after activation. */
|
|
54
|
+
@attr({ attribute: 'min-show-time', converter: { fromView: Number, toView: String } })
|
|
55
|
+
minShowTime: number = DEFAULT_MIN_SHOW_TIME;
|
|
56
|
+
|
|
57
|
+
@observable haloActive: boolean = false;
|
|
58
|
+
|
|
59
|
+
private channel?: TypedBroadcastChannel<AiActivityEvents>;
|
|
60
|
+
private hideTimeout?: ReturnType<typeof setTimeout>;
|
|
61
|
+
private startTime: number = 0;
|
|
62
|
+
|
|
63
|
+
connectedCallback() {
|
|
64
|
+
super.connectedCallback();
|
|
65
|
+
this.channel = createTypedBroadcastChannel<AiActivityEvents>(this.channelName);
|
|
66
|
+
this.channel.onmessage = (ev) => {
|
|
67
|
+
if (this.channel!.isMessageType('halo-start', ev)) {
|
|
68
|
+
const { toolNames } = ev.data.detail;
|
|
69
|
+
const myTools = this.tools
|
|
70
|
+
.split(',')
|
|
71
|
+
.map((t) => t.trim())
|
|
72
|
+
.filter(Boolean);
|
|
73
|
+
if (myTools.length === 0 || toolNames.some((name) => myTools.includes(name))) {
|
|
74
|
+
this.activate();
|
|
75
|
+
}
|
|
76
|
+
} else if (this.channel!.isMessageType('halo-stop', ev)) {
|
|
77
|
+
this.scheduleDeactivate();
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
disconnectedCallback() {
|
|
83
|
+
super.disconnectedCallback();
|
|
84
|
+
this.channel?.close();
|
|
85
|
+
this.channel = undefined;
|
|
86
|
+
if (this.hideTimeout !== undefined) {
|
|
87
|
+
clearTimeout(this.hideTimeout);
|
|
88
|
+
this.hideTimeout = undefined;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
private activate() {
|
|
93
|
+
if (this.hideTimeout !== undefined) {
|
|
94
|
+
clearTimeout(this.hideTimeout);
|
|
95
|
+
this.hideTimeout = undefined;
|
|
96
|
+
}
|
|
97
|
+
this.startTime = Date.now();
|
|
98
|
+
this.haloActive = true;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
private scheduleDeactivate() {
|
|
102
|
+
const elapsed = Date.now() - this.startTime;
|
|
103
|
+
const remaining = this.minShowTime - elapsed;
|
|
104
|
+
if (remaining <= 0) {
|
|
105
|
+
this.haloActive = false;
|
|
106
|
+
} else {
|
|
107
|
+
this.hideTimeout = setTimeout(() => {
|
|
108
|
+
this.haloActive = false;
|
|
109
|
+
this.hideTimeout = undefined;
|
|
110
|
+
}, remaining);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { css } from '@genesislcap/web-core';
|
|
2
|
+
|
|
3
|
+
export const styles = css`
|
|
4
|
+
:host {
|
|
5
|
+
position: fixed;
|
|
6
|
+
inset: 0;
|
|
7
|
+
pointer-events: none;
|
|
8
|
+
z-index: 9999;
|
|
9
|
+
overflow: visible;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
:host([hidden]) {
|
|
13
|
+
display: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.bubble {
|
|
17
|
+
position: absolute;
|
|
18
|
+
width: 62px;
|
|
19
|
+
height: 62px;
|
|
20
|
+
border-radius: 50%;
|
|
21
|
+
cursor: grab;
|
|
22
|
+
pointer-events: all;
|
|
23
|
+
overflow: visible;
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
user-select: none;
|
|
28
|
+
transition:
|
|
29
|
+
transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
|
|
30
|
+
box-shadow 0.25s ease;
|
|
31
|
+
background: linear-gradient(135deg, #0e1628 0%, #192340 100%);
|
|
32
|
+
box-shadow: 0 4px 20px rgb(0 0 0 / 45%);
|
|
33
|
+
border: 2px solid rgb(255 255 255 / 15%);
|
|
34
|
+
color: white;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.bubble img {
|
|
38
|
+
width: 62px;
|
|
39
|
+
height: 62px;
|
|
40
|
+
border-radius: 50%;
|
|
41
|
+
object-fit: cover;
|
|
42
|
+
pointer-events: none;
|
|
43
|
+
box-shadow: 0 4px 20px rgb(0 0 0 / 45%);
|
|
44
|
+
border: 2px solid rgb(255 255 255 / 15%);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.bubble svg {
|
|
48
|
+
pointer-events: none;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.bubble:hover,
|
|
52
|
+
.bubble.hovered {
|
|
53
|
+
transform: scale(1.18);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.bubble:hover img,
|
|
57
|
+
.bubble.hovered img {
|
|
58
|
+
box-shadow:
|
|
59
|
+
0 6px 32px rgb(0 100 255 / 55%),
|
|
60
|
+
0 0 0 3px rgb(0 120 255 / 35%);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.bubble:active {
|
|
64
|
+
cursor: grabbing;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.tooltip {
|
|
68
|
+
position: absolute;
|
|
69
|
+
bottom: calc(100% + 10px);
|
|
70
|
+
background: linear-gradient(135deg, #0078ff 0%, #0050d0 100%);
|
|
71
|
+
color: #fff;
|
|
72
|
+
font-size: 0.78em;
|
|
73
|
+
font-weight: 600;
|
|
74
|
+
letter-spacing: 0.03em;
|
|
75
|
+
white-space: nowrap;
|
|
76
|
+
padding: 5px 10px;
|
|
77
|
+
border-radius: 8px;
|
|
78
|
+
box-shadow: 0 4px 14px rgb(0 120 255 / 45%);
|
|
79
|
+
pointer-events: none;
|
|
80
|
+
opacity: 0%;
|
|
81
|
+
translate: 0 4px;
|
|
82
|
+
transition:
|
|
83
|
+
opacity 0.18s ease,
|
|
84
|
+
translate 0.18s ease;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.tooltip::after {
|
|
88
|
+
content: '';
|
|
89
|
+
position: absolute;
|
|
90
|
+
top: 100%;
|
|
91
|
+
left: var(--arrow-left, 50%);
|
|
92
|
+
transform: translateX(-50%);
|
|
93
|
+
border: 5px solid transparent;
|
|
94
|
+
border-top-color: #0050d0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.bubble:hover .tooltip,
|
|
98
|
+
.bubble.hovered .tooltip {
|
|
99
|
+
opacity: 100%;
|
|
100
|
+
translate: 0 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.pulse-ring {
|
|
104
|
+
position: absolute;
|
|
105
|
+
width: 62px;
|
|
106
|
+
height: 62px;
|
|
107
|
+
border-radius: 50%;
|
|
108
|
+
border: 2px solid rgb(0 120 255 / 50%);
|
|
109
|
+
animation: pulse 2.5s ease-out infinite;
|
|
110
|
+
pointer-events: none;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@keyframes pulse {
|
|
114
|
+
0% {
|
|
115
|
+
transform: scale(1);
|
|
116
|
+
opacity: 70%;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
70% {
|
|
120
|
+
transform: scale(1.5);
|
|
121
|
+
opacity: 0%;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
100% {
|
|
125
|
+
transform: scale(1.5);
|
|
126
|
+
opacity: 0%;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.dialog {
|
|
131
|
+
position: absolute;
|
|
132
|
+
box-sizing: border-box;
|
|
133
|
+
width: 400px;
|
|
134
|
+
height: 520px;
|
|
135
|
+
min-width: 300px;
|
|
136
|
+
min-height: 300px;
|
|
137
|
+
max-width: 50vw;
|
|
138
|
+
max-height: calc(100vh - 40px);
|
|
139
|
+
background: var(--neutral-layer-1);
|
|
140
|
+
border-radius: 14px;
|
|
141
|
+
box-shadow:
|
|
142
|
+
0 12px 50px rgb(0 0 0 / 55%),
|
|
143
|
+
0 0 0 1px rgb(255 255 255 / 6%);
|
|
144
|
+
pointer-events: all;
|
|
145
|
+
display: flex;
|
|
146
|
+
flex-direction: column;
|
|
147
|
+
overflow: hidden;
|
|
148
|
+
resize: both;
|
|
149
|
+
border: 1px solid var(--neutral-stroke-rest);
|
|
150
|
+
animation: dialog-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
@keyframes dialog-in {
|
|
154
|
+
from {
|
|
155
|
+
opacity: 0%;
|
|
156
|
+
transform: scale(0.85) translateY(12px);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
to {
|
|
160
|
+
opacity: 100%;
|
|
161
|
+
transform: scale(1) translateY(0);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
@keyframes dialog-out {
|
|
166
|
+
from {
|
|
167
|
+
opacity: 100%;
|
|
168
|
+
transform: scale(1) translateY(0);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
to {
|
|
172
|
+
opacity: 0%;
|
|
173
|
+
transform: scale(0.85) translateY(12px);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.dialog.closing {
|
|
178
|
+
animation: dialog-out 0.2s cubic-bezier(0.4, 0, 0.6, 1) forwards;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.dialog-content {
|
|
182
|
+
flex: 1;
|
|
183
|
+
overflow: hidden;
|
|
184
|
+
display: flex;
|
|
185
|
+
min-height: 0;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.dialog-content ::slotted(*) {
|
|
189
|
+
display: flex;
|
|
190
|
+
flex: 1;
|
|
191
|
+
width: 100%;
|
|
192
|
+
min-height: 0;
|
|
193
|
+
}
|
|
194
|
+
`;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { html, repeat, slotted, ViewTemplate, when } from '@genesislcap/web-core';
|
|
2
|
+
import type { AiChatBubble } from './chat-bubble';
|
|
3
|
+
|
|
4
|
+
const genesisIconTemplate = html`
|
|
5
|
+
<svg
|
|
6
|
+
viewBox="-4 0 30 26"
|
|
7
|
+
fill="none"
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
style="width:60%;height:60%"
|
|
10
|
+
>
|
|
11
|
+
<path
|
|
12
|
+
d="M18.7702 23.0437C18.7702 22.4675 18.8526 21.8089 19.0995 21.3149C19.3465 20.7386 19.6758 20.2447 20.0874 19.833C20.4991 19.4214 20.993 19.0921 21.5693 18.8451C22.1456 18.5982 22.7219 18.5158 23.2981 18.5158H25.9326V11.6828H19.1819V14.3172C19.1819 15.5521 18.6879 16.7047 17.8647 17.5279C17.0414 18.3512 15.8888 18.8451 14.7363 18.9275H6.7507V6.99025H16.4651V0.157227H3.54C2.63442 0.157227 1.72884 0.568855 1.07023 1.22746C0.411628 1.88606 0 2.79165 0 3.77955V22.2205C0 23.1261 0.411628 24.0316 1.07023 24.7726C1.72884 25.4312 2.63442 25.8428 3.54 25.8428H18.7702V23.0437Z"
|
|
13
|
+
fill="currentColor"
|
|
14
|
+
/>
|
|
15
|
+
</svg>
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
export const AiChatBubbleTemplate = (): ViewTemplate<AiChatBubble> => {
|
|
19
|
+
return html<AiChatBubble>`
|
|
20
|
+
${when(
|
|
21
|
+
(x) => !x.dialogOpen,
|
|
22
|
+
html<AiChatBubble>`
|
|
23
|
+
<div
|
|
24
|
+
class="bubble ${(x) => (x.hovered ? 'hovered' : '')}"
|
|
25
|
+
style="${(x) => `translate: ${x.bubbleLeft}px ${x.bubbleTop}px`}"
|
|
26
|
+
@mousedown="${(x, c) => x.onBubbleMouseDown(c.event as MouseEvent)}"
|
|
27
|
+
@mouseenter="${(x) => (x.hovered = true)}"
|
|
28
|
+
@mouseleave="${(x) => (x.hovered = false)}"
|
|
29
|
+
>
|
|
30
|
+
${when(
|
|
31
|
+
(x) => !!x.imageSrc,
|
|
32
|
+
html<AiChatBubble>`
|
|
33
|
+
<img src="${(x) => x.imageSrc}" alt="AI" draggable="false" />
|
|
34
|
+
`,
|
|
35
|
+
)}
|
|
36
|
+
${when((x) => !x.imageSrc, genesisIconTemplate)}
|
|
37
|
+
<div class="pulse-ring"></div>
|
|
38
|
+
<div class="tooltip" style="${(x) => x.tooltipStyle}">${(x) => x.title}</div>
|
|
39
|
+
</div>
|
|
40
|
+
`,
|
|
41
|
+
)}
|
|
42
|
+
${repeat(
|
|
43
|
+
// Pass the component instance as the sole array item so inner bindings
|
|
44
|
+
// can use x directly. recycle: false ensures a fresh element on every
|
|
45
|
+
// open, preventing stale .closing class or animationend listeners from
|
|
46
|
+
// a previous close persisting on the reused view.
|
|
47
|
+
(x) => (x.dialogOpen ? [x] : []),
|
|
48
|
+
html<AiChatBubble>`
|
|
49
|
+
<div
|
|
50
|
+
class="dialog"
|
|
51
|
+
style="${(x) =>
|
|
52
|
+
`translate: ${x.dialogLeft}px ${x.dialogTop}px; width: ${x.dialogWidth}px; height: ${x.dialogHeight}px`}"
|
|
53
|
+
@chat-header-mousedown="${(x, c) => x.onDialogHeaderMouseDown(c.event as CustomEvent)}"
|
|
54
|
+
>
|
|
55
|
+
<div class="dialog-content">
|
|
56
|
+
<slot name="dialog-content" ${slotted('dialogContent')}></slot>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
`,
|
|
60
|
+
{ recycle: false },
|
|
61
|
+
)}
|
|
62
|
+
`;
|
|
63
|
+
};
|