@visma-swno/gaia-chat-ui 4.2.0-beta.1 → 4.2.0-beta.2
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/README.md +193 -9
- package/dist/app/app.d.ts +41 -1
- package/dist/chart-block-DYZfc12a.js +112 -0
- package/dist/components/composer/disclaimer/disclaimer.d.ts +1 -1
- package/dist/components/composer/message-composer.d.ts +7 -8
- package/dist/components/composer/resize-controller.d.ts +1 -1
- package/dist/components/conversation/activity-indicator/activity-indicator.d.ts +1 -1
- package/dist/components/conversation/conversation.d.ts +7 -14
- package/dist/components/conversation/conversation.styles.d.ts +1 -1
- package/dist/components/conversation/markdown-content/markdown-content.d.ts +4 -1
- package/dist/components/conversation/welcome-message/welcome-message.d.ts +2 -3
- package/dist/components/feedback/feedback.d.ts +6 -6
- package/dist/components/layout/app-header/app-header.d.ts +10 -7
- package/dist/components/layout/connection-status-overlay/connection-status-overlay.d.ts +12 -0
- package/dist/components/layout/error-notification/error-notification.d.ts +2 -2
- package/dist/components/message/message.d.ts +4 -1
- package/dist/components/message/renderers/chart-block/chart-block.d.ts +4 -8
- package/dist/components/message/renderers/chart-block/chart-block.styles.d.ts +1 -1
- package/dist/components/message/renderers/tool-approval-block.d.ts +4 -11
- package/dist/components/message/renderers/tool-status-block.d.ts +8 -26
- package/dist/components/message/renderers/tool-status-block.styles.d.ts +1 -1
- package/dist/components/message/renderers/typing-indicator/typing-indicator.d.ts +1 -1
- package/dist/components/primitives/avatar/avatar.d.ts +2 -2
- package/dist/components/primitives/button/button.d.ts +1 -1
- package/dist/components/primitives/icon/icon-library.generated.d.ts +4 -0
- package/dist/components/primitives/icon/icon-registry.d.ts +35 -0
- package/dist/components/primitives/icon/icon.d.ts +4 -7
- package/dist/components/primitives/popover/popover.d.ts +2 -1
- package/dist/components/primitives/spinner/spinner.d.ts +1 -1
- package/dist/components/shared/animations.styles.d.ts +14 -0
- package/dist/components/shared/error-boundary.d.ts +15 -0
- package/dist/components/shared/error-boundary.styles.d.ts +2 -0
- package/dist/components/shared/render-json-value.d.ts +2 -0
- package/dist/core/adapters/message-mapper.d.ts +60 -12
- package/dist/core/adapters/tool-utils.d.ts +67 -0
- package/dist/core/errors.d.ts +18 -0
- package/dist/core/messages.d.ts +72 -0
- package/dist/core/store/auth-coordinator.d.ts +29 -0
- package/dist/core/store/bootstrap-loader.d.ts +10 -0
- package/dist/core/store/chat-state-container.d.ts +19 -0
- package/dist/core/store/chat-store.d.ts +31 -48
- package/dist/core/store/config-manager.d.ts +36 -0
- package/dist/core/store/feedback-manager.d.ts +4 -0
- package/dist/core/store/index.d.ts +6 -1
- package/dist/core/store/session-manager.d.ts +39 -0
- package/dist/core/store/store-context.d.ts +12 -0
- package/dist/core/store/store-controller.d.ts +19 -0
- package/dist/core/store/support-manager.d.ts +30 -0
- package/dist/core/store/tool-registry.d.ts +23 -0
- package/dist/core/types.d.ts +31 -57
- package/dist/{da-B5UYLyw1.js → da-BoJQ3AZC.js} +30 -6
- package/dist/{fi-DCT6mKnL.js → fi-B10q-5gh.js} +30 -6
- package/dist/generated/locales/da.d.ts +26 -1
- package/dist/generated/locales/fi.d.ts +26 -1
- package/dist/generated/locales/nb.d.ts +26 -1
- package/dist/generated/locales/nl.d.ts +26 -1
- package/dist/generated/locales/sv.d.ts +26 -1
- package/dist/index-C_1azLkG.js +13371 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +4 -3
- package/dist/index.umd.js +447 -349
- package/dist/learning-universe-DPQzFukl.js +5 -0
- package/dist/markdown-CD6L_ZXu.js +1628 -0
- package/dist/{nb-DqPdqQaF.js → nb-C-lyw_Di.js} +30 -6
- package/dist/{nl-CvLZ_0oo.js → nl-C91EhoSO.js} +30 -6
- package/dist/services/agent-service.d.ts +69 -16
- package/dist/services/agent-subscriber.d.ts +42 -0
- package/dist/services/api-client.d.ts +9 -1
- package/dist/services/api-schemas.d.ts +205 -0
- package/dist/services/auth-service.d.ts +3 -8
- package/dist/services/index.d.ts +9 -0
- package/dist/services/run-coordinator.d.ts +57 -0
- package/dist/services/storage-service.d.ts +29 -0
- package/dist/services/support-service.d.ts +4 -12
- package/dist/services/thread-rehydrator.d.ts +9 -0
- package/dist/signalr-BjF2V9mZ.js +1776 -0
- package/dist/{sv-BGFQnOyW.js → sv-B3z601zM.js} +30 -6
- package/dist/types/frontend-tool.d.ts +32 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/utils/polling-task.d.ts +9 -0
- package/dist/vsn-DOuzJWsl.js +29 -0
- package/package.json +9 -3
- package/dist/components/message/renderers/index.d.ts +0 -7
- package/dist/components/message/renderers/tool-search-block.d.ts +0 -22
- package/dist/components/primitives/icon/icon-library.d.ts +0 -41
- package/dist/core/store.d.ts +0 -7
- package/dist/index-CvqUxl2f.js +0 -16057
- /package/dist/components/{message/renderers/tool-search-block.styles.d.ts → layout/connection-status-overlay/connection-status-overlay.styles.d.ts} +0 -0
- /package/dist/{index-1kWCFQ2W.js → echarts-1kWCFQ2W.js} +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @visma-swno/gaia-chat-ui
|
|
2
2
|
|
|
3
|
-
Web component library for the GAiA Assistant Chat UI, built with Lit for Visma Software Nordic products.
|
|
3
|
+
Web component library for the GAiA Assistant Chat UI, built with [Lit](https://lit.dev/) for Visma Software Nordic products.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -8,28 +8,31 @@ Web component library for the GAiA Assistant Chat UI, built with Lit for Visma S
|
|
|
8
8
|
npm install @visma-swno/gaia-chat-ui
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
`lit` is an external dependency and must be available in your bundle:
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
npm install lit@^3.3.0
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## Quick Start
|
|
18
18
|
|
|
19
19
|
```javascript
|
|
20
20
|
import '@visma-swno/gaia-chat-ui';
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
+
### Visitor Mode (Anonymous)
|
|
24
|
+
|
|
23
25
|
```html
|
|
24
26
|
<gaia-chat
|
|
25
27
|
profile-id="YOUR_PROFILE_ID"
|
|
26
28
|
base-url="https://api.assistant.vsn.dev"
|
|
27
29
|
auth-strategy="visitor"
|
|
28
|
-
>
|
|
29
|
-
</gaia-chat>
|
|
30
|
+
></gaia-chat>
|
|
30
31
|
```
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
### Visma Connect Mode (Authenticated)
|
|
34
|
+
|
|
35
|
+
Provide a `tokenProvider` that returns a valid OAuth access token. Implement caching and refresh: reuse a valid token until shortly before its `exp` claim, then silently refresh.
|
|
33
36
|
|
|
34
37
|
```html
|
|
35
38
|
<gaia-chat
|
|
@@ -37,8 +40,8 @@ For authenticated Visma users, switch to the Visma strategy and provide a token
|
|
|
37
40
|
profile-id="YOUR_PROFILE_ID"
|
|
38
41
|
base-url="https://api.assistant.vsn.dev"
|
|
39
42
|
auth-strategy="visma"
|
|
40
|
-
>
|
|
41
|
-
|
|
43
|
+
></gaia-chat>
|
|
44
|
+
|
|
42
45
|
<script type="module">
|
|
43
46
|
const assistant = document.getElementById('assistant');
|
|
44
47
|
|
|
@@ -50,6 +53,187 @@ For authenticated Visma users, switch to the Visma strategy and provide a token
|
|
|
50
53
|
</script>
|
|
51
54
|
```
|
|
52
55
|
|
|
56
|
+
## Properties
|
|
57
|
+
|
|
58
|
+
| Property / Attribute | Type | Default | Description |
|
|
59
|
+
| ----------------------- | ----------------------- | ------------------------------------------ | ------------------------------------------------------------ |
|
|
60
|
+
| `base-url` | `string` | `'https://api.assistant.stag.vsn.dev'` | Backend API base URL. |
|
|
61
|
+
| `profile-id` | `string` | `'default'` | Assistant profile identifier. |
|
|
62
|
+
| `auth-strategy` | `'visitor' \| 'visma'` | `'visitor'` | Authentication strategy. |
|
|
63
|
+
| `closeable` | `boolean` | `true` | Show a close button in the header. |
|
|
64
|
+
| `selected-model` | `string` | `''` | Override the default AI model. Must be in the profile's allowed overrides. |
|
|
65
|
+
| `enable-charts` | `boolean` | `false` | Enable inline chart rendering via the built-in echarts tool. |
|
|
66
|
+
| `tokenProvider` | `() => Promise<string>` | — | Async function returning an OAuth access token (Visma mode). Set via JS. |
|
|
67
|
+
| `hostContextProvider` | `HostContextProvider` | — | Async function returning application context per message. Set via JS. |
|
|
68
|
+
| `tools` | `FrontendTool[]` | `[]` | Frontend tool definitions sent to the agent. Set via JS. |
|
|
69
|
+
|
|
70
|
+
## Events
|
|
71
|
+
|
|
72
|
+
All events bubble and are composed (cross shadow DOM).
|
|
73
|
+
|
|
74
|
+
| Event | Detail Type | Description |
|
|
75
|
+
| ---------------------- | ------------------------------------------------------------------------------------------------ | --------------------------------------- |
|
|
76
|
+
| `conversation-cleared` | `void` | User cleared the conversation. |
|
|
77
|
+
| `message-sent` | `{ message: string; channel: 'assistant' \| 'support' }` | User sent a message. |
|
|
78
|
+
| `tool-call-approved` | `{ messageId: string }` | User approved a tool call. |
|
|
79
|
+
| `tool-call-declined` | `{ messageId: string }` | User declined a tool call. |
|
|
80
|
+
| `feedback-submitted` | `{ rating: number; comment: string \| null }` | User submitted feedback. |
|
|
81
|
+
| `close-requested` | `void` | User clicked the close button. |
|
|
82
|
+
| `tool-call` | `{ toolCallId: string; toolCallName: string; arguments: Record<string, unknown> \| string \| null; result: unknown }` | A frontend tool call was executed. |
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
document.querySelector('gaia-chat').addEventListener('message-sent', (e) => {
|
|
86
|
+
console.log('User sent:', e.detail.message);
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Methods
|
|
91
|
+
|
|
92
|
+
| Method | Description |
|
|
93
|
+
| -------------------- | ------------------------------------------------- |
|
|
94
|
+
| `clearConversation()`| Clear the current conversation and reset the chat.|
|
|
95
|
+
| `stopSupport()` | Stop any active support session. |
|
|
96
|
+
|
|
97
|
+
## Host Context Provider
|
|
98
|
+
|
|
99
|
+
Provide dynamic application context with each message. The agent and its plugins can use this context for personalized responses.
|
|
100
|
+
|
|
101
|
+
```javascript
|
|
102
|
+
const chat = document.querySelector('gaia-chat');
|
|
103
|
+
|
|
104
|
+
chat.hostContextProvider = async () => ({
|
|
105
|
+
customerId: getCurrentCustomerId(),
|
|
106
|
+
companyId: getCurrentCompanyId(),
|
|
107
|
+
partnerId: getPartnerId(),
|
|
108
|
+
data: {
|
|
109
|
+
environment: 'production',
|
|
110
|
+
userRole: getUserRole(),
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### HostContext
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
interface HostContext {
|
|
119
|
+
customerId?: string;
|
|
120
|
+
companyId?: string;
|
|
121
|
+
partnerId?: string;
|
|
122
|
+
data?: Record<string, unknown>;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
type HostContextProvider = () => HostContext | Promise<HostContext | null> | null;
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Frontend Tools
|
|
129
|
+
|
|
130
|
+
Register custom tools that the agent can invoke. Tool results are returned to the agent and a `tool-call` event is dispatched to the host.
|
|
131
|
+
|
|
132
|
+
```javascript
|
|
133
|
+
const chat = document.querySelector('gaia-chat');
|
|
134
|
+
|
|
135
|
+
chat.tools = [
|
|
136
|
+
{
|
|
137
|
+
name: 'getInvoice',
|
|
138
|
+
description: 'Retrieve an invoice by ID',
|
|
139
|
+
parameters: {
|
|
140
|
+
type: 'object',
|
|
141
|
+
properties: {
|
|
142
|
+
invoiceId: { type: 'string', description: 'The invoice ID' },
|
|
143
|
+
},
|
|
144
|
+
required: ['invoiceId'],
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
];
|
|
148
|
+
|
|
149
|
+
chat.addEventListener('tool-call', (e) => {
|
|
150
|
+
const { toolCallName, arguments: args } = e.detail;
|
|
151
|
+
// Handle the tool call and return data to the agent
|
|
152
|
+
});
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### FrontendTool
|
|
156
|
+
|
|
157
|
+
```typescript
|
|
158
|
+
interface FrontendTool {
|
|
159
|
+
name: string;
|
|
160
|
+
description: string;
|
|
161
|
+
parameters: JSONSchema7; // JSON Schema draft-07, must be type: 'object'
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Charts
|
|
166
|
+
|
|
167
|
+
Set `enable-charts` to enable the built-in echarts frontend tool. When enabled, the agent can render inline charts using [Apache ECharts](https://echarts.apache.org/).
|
|
168
|
+
|
|
169
|
+
```html
|
|
170
|
+
<gaia-chat enable-charts></gaia-chat>
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Icon Registry
|
|
174
|
+
|
|
175
|
+
Register custom SVG icons for use in the component:
|
|
176
|
+
|
|
177
|
+
```javascript
|
|
178
|
+
import { registerIcons } from '@visma-swno/gaia-chat-ui';
|
|
179
|
+
|
|
180
|
+
registerIcons({ 'my-icon': '<svg>...</svg>' });
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Styling
|
|
184
|
+
|
|
185
|
+
The component exposes CSS custom properties prefixed with `--gaia-` for theming. Set these on the `<gaia-chat>` element or any ancestor.
|
|
186
|
+
|
|
187
|
+
### Typography
|
|
188
|
+
|
|
189
|
+
| Property | Description |
|
|
190
|
+
| -------------------------------- | ------------------ |
|
|
191
|
+
| `--gaia-font-family` | Font family |
|
|
192
|
+
| `--gaia-font-size-xs` … `3xl` | Font sizes |
|
|
193
|
+
| `--gaia-line-height-xs` … `3xl` | Line heights |
|
|
194
|
+
| `--gaia-font-weight-regular` | Regular weight |
|
|
195
|
+
| `--gaia-font-weight-medium` | Medium weight |
|
|
196
|
+
| `--gaia-font-weight-semibold` | Semibold weight |
|
|
197
|
+
| `--gaia-font-weight-bold` | Bold weight |
|
|
198
|
+
|
|
199
|
+
### Colors
|
|
200
|
+
|
|
201
|
+
| Property group | Examples |
|
|
202
|
+
| ------------------------------- | ------------------------------------------------------------ |
|
|
203
|
+
| `--gaia-color-surface-*` | `page`, `primary`, `action`, `action-hover`, `error`, `success`, `information`, `warning`, `disabled`, `selected` |
|
|
204
|
+
| `--gaia-color-text-*` | `headings`, `body`, `body-secondary`, `action`, `action-hover`, `disabled`, `error`, `success`, `link-visited` |
|
|
205
|
+
| `--gaia-color-border-*` | `primary`, `secondary`, `tertiary`, `action`, `action-hover`, `focus`, `error`, `success` |
|
|
206
|
+
| `--gaia-color-icon-*` | `primary`, `action`, `action-hover`, `disabled`, `error`, `success`, `on-action`, `on-primary` |
|
|
207
|
+
| `--gaia-color-message-*` | `user`, `system`, `operator` |
|
|
208
|
+
| `--gaia-color-neutral-*` | `10` through `100` |
|
|
209
|
+
|
|
210
|
+
### Example
|
|
211
|
+
|
|
212
|
+
```css
|
|
213
|
+
gaia-chat {
|
|
214
|
+
--gaia-font-family: 'Inter', sans-serif;
|
|
215
|
+
--gaia-color-surface-page: #ffffff;
|
|
216
|
+
--gaia-color-surface-action: #0066cc;
|
|
217
|
+
--gaia-color-text-body: #1a1a1a;
|
|
218
|
+
--gaia-color-message-user: #e6f0ff;
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Localization
|
|
223
|
+
|
|
224
|
+
The component reads the `lang` attribute (on itself or `<html>`) and responds to changes at runtime. Supported locales are bundled with the component.
|
|
225
|
+
|
|
226
|
+
```html
|
|
227
|
+
<gaia-chat lang="nb"></gaia-chat>
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## Exports
|
|
231
|
+
|
|
232
|
+
```typescript
|
|
233
|
+
import { ChatApp, ToolCallEvent, registerIcons } from '@visma-swno/gaia-chat-ui';
|
|
234
|
+
import type { FrontendTool, HostContext, HostContextProvider } from '@visma-swno/gaia-chat-ui';
|
|
235
|
+
```
|
|
236
|
+
|
|
53
237
|
## Documentation
|
|
54
238
|
|
|
55
|
-
For
|
|
239
|
+
For development instructions and architecture details, see the [main repository](https://github.com/visma-swno/vsn-assistant).
|
package/dist/app/app.d.ts
CHANGED
|
@@ -3,21 +3,57 @@ import { StrategyType } from '../core/store';
|
|
|
3
3
|
import { TokenFetcher } from '../services/auth-service';
|
|
4
4
|
import { FrontendTool, HostContextProvider } from '../types';
|
|
5
5
|
import { BaseElement } from '../components/shared/base-element';
|
|
6
|
+
/**
|
|
7
|
+
* Root chat widget component.
|
|
8
|
+
*
|
|
9
|
+
* Bootstraps services, manages authentication, and renders the chat UI.
|
|
10
|
+
* Embed in any page to add AI-powered chat with support handoff.
|
|
11
|
+
*
|
|
12
|
+
* @element gaia-chat
|
|
13
|
+
*
|
|
14
|
+
* @fires {ConversationClearedEvent} conversation-cleared - When the user clears the conversation
|
|
15
|
+
* @fires {MessageSentEvent} message-sent - When the user sends a message
|
|
16
|
+
* @fires {ToolCallApprovedEvent} tool-call-approved - When the user approves a tool call
|
|
17
|
+
* @fires {ToolCallDeclinedEvent} tool-call-declined - When the user declines a tool call
|
|
18
|
+
* @fires {FeedbackSubmittedEvent} feedback-submitted - When the user submits feedback
|
|
19
|
+
* @fires {CloseRequestedEvent} close-requested - When the user clicks the close button
|
|
20
|
+
* @fires {ToolCallEvent} tool-call - When a frontend tool call is executed
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```html
|
|
24
|
+
* <gaia-chat
|
|
25
|
+
* base-url="https://api.assistant.stag.vsn.dev"
|
|
26
|
+
* profile-id="default"
|
|
27
|
+
* auth-strategy="visitor"
|
|
28
|
+
* ></gaia-chat>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
6
31
|
export declare class ChatApp extends BaseElement {
|
|
7
32
|
static styles: import('lit').CSSResult[];
|
|
33
|
+
/** Backend API base URL. */
|
|
8
34
|
baseUrl: string;
|
|
35
|
+
/** Assistant profile identifier. */
|
|
9
36
|
profileId: string;
|
|
10
37
|
/**
|
|
11
|
-
*
|
|
38
|
+
* Partner ID for support handoff.
|
|
39
|
+
* @deprecated Use hostContextProvider instead.
|
|
12
40
|
*/
|
|
13
41
|
supportPartnerId?: string;
|
|
42
|
+
/** Async function that returns an OAuth access token for Visma Connect auth. */
|
|
14
43
|
tokenProvider?: TokenFetcher;
|
|
44
|
+
/** Async function that returns application context sent with each message. */
|
|
15
45
|
hostContextProvider?: HostContextProvider;
|
|
46
|
+
/** Authentication strategy: "visitor" (anonymous) or "visma" (Visma Connect). */
|
|
16
47
|
authStrategy: StrategyType;
|
|
48
|
+
/** Whether to show a close button in the header. */
|
|
17
49
|
closeable: boolean;
|
|
50
|
+
/** Override the default AI model. Must be in the profile's allowed overrides list. */
|
|
18
51
|
selectedModel: string;
|
|
52
|
+
/** Frontend tool definitions sent to the agent. */
|
|
19
53
|
tools: FrontendTool[];
|
|
54
|
+
/** Enable inline chart rendering for the echarts frontend tool. */
|
|
20
55
|
enableCharts: boolean;
|
|
56
|
+
private get activeLang();
|
|
21
57
|
private langObserver?;
|
|
22
58
|
private store;
|
|
23
59
|
private storeState;
|
|
@@ -28,6 +64,10 @@ export declare class ChatApp extends BaseElement {
|
|
|
28
64
|
private handleAuthChanged;
|
|
29
65
|
willUpdate(changedProperties: PropertyValues): void;
|
|
30
66
|
private applySelectedModel;
|
|
67
|
+
/** Clears the current conversation and resets the chat. */
|
|
68
|
+
clearConversation(): void;
|
|
69
|
+
/** Stops any active support session. */
|
|
70
|
+
stopSupport(): void;
|
|
31
71
|
render(): import('lit-html').TemplateResult<1>;
|
|
32
72
|
}
|
|
33
73
|
declare global {
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { a as d, s as p, B as g, m as c } from "./index-C_1azLkG.js";
|
|
2
|
+
import { css as u, html as l } from "lit";
|
|
3
|
+
import { property as f, state as v, query as m, customElement as x } from "lit/decorators.js";
|
|
4
|
+
const b = [
|
|
5
|
+
d,
|
|
6
|
+
p,
|
|
7
|
+
u`
|
|
8
|
+
:host{display:block}.chart-container{border:1px solid var(--gaia-color-border-tertiary);border-radius:8px;min-height:300px;overflow:hidden;position:relative}.chart-canvas{height:300px;width:100%}.chart-loading{align-items:center;display:flex;gap:8px;min-height:300px;padding:12px 16px}.loading-dot{animation:pulse 2.5s ease-in-out infinite;background-color:oklch(55% .1 250deg);border-radius:50%;flex-shrink:0;height:8px;width:8px}.loading-text{font-size:var(--gaia-font-size-sm);line-height:var(--gaia-line-height-sm)}.chart-error{align-items:center;display:flex;gap:8px;min-height:48px;padding:12px 16px}.error-dot{background-color:oklch(55% .2 25deg);border-radius:50%;flex-shrink:0;height:8px;width:8px}.error-text{color:var(--gaia-color-text-body-secondary);font-size:var(--gaia-font-size-sm);line-height:var(--gaia-line-height-sm)}@media (prefers-reduced-motion:reduce){.loading-dot{animation:none}}
|
|
9
|
+
`
|
|
10
|
+
];
|
|
11
|
+
var y = Object.defineProperty, C = Object.getOwnPropertyDescriptor, n = (e, r, s, t) => {
|
|
12
|
+
for (var a = t > 1 ? void 0 : t ? C(r, s) : r, o = e.length - 1, h; o >= 0; o--)
|
|
13
|
+
(h = e[o]) && (a = (t ? h(r, s, a) : h(a)) || a);
|
|
14
|
+
return t && a && y(r, s, a), a;
|
|
15
|
+
};
|
|
16
|
+
function z(e) {
|
|
17
|
+
const r = e.toolCall.function.arguments;
|
|
18
|
+
if (!r) return null;
|
|
19
|
+
try {
|
|
20
|
+
const t = (typeof r == "string" ? JSON.parse(r) : r)?.chartConfig;
|
|
21
|
+
return t && typeof t == "object" ? t : null;
|
|
22
|
+
} catch {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
let i = class extends g {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments), this.chartState = "pending", this.chart = null, this.resizeObserver = null, this.chartConfig = null, this.rendered = !1;
|
|
29
|
+
}
|
|
30
|
+
disconnectedCallback() {
|
|
31
|
+
super.disconnectedCallback(), this.disposeChart();
|
|
32
|
+
}
|
|
33
|
+
willUpdate(e) {
|
|
34
|
+
super.willUpdate(e), e.has("message") && this.tryRenderChart();
|
|
35
|
+
}
|
|
36
|
+
updated(e) {
|
|
37
|
+
super.updated(e), this.chartState === "complete" && !this.rendered && this.canvasEl && this.initChart();
|
|
38
|
+
}
|
|
39
|
+
tryRenderChart() {
|
|
40
|
+
if (this.rendered) return;
|
|
41
|
+
const e = z(this.message);
|
|
42
|
+
e ? (this.chartConfig = e, this.chartState = "complete") : this.message.toolResponse && (this.chartState = "error");
|
|
43
|
+
}
|
|
44
|
+
async initChart() {
|
|
45
|
+
if (!(!this.canvasEl || !this.chartConfig || this.rendered)) {
|
|
46
|
+
this.rendered = !0;
|
|
47
|
+
try {
|
|
48
|
+
const e = await import("./echarts-1kWCFQ2W.js");
|
|
49
|
+
this.chart = e.init(this.canvasEl), this.chart.setOption(this.chartConfig), this.resizeObserver = new ResizeObserver(() => {
|
|
50
|
+
this.chart?.resize();
|
|
51
|
+
}), this.resizeObserver.observe(this.canvasEl);
|
|
52
|
+
} catch (e) {
|
|
53
|
+
console.error("[GaiaChartBlock] Failed to initialize chart:", e), this.chartState = "error", this.rendered = !1;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
disposeChart() {
|
|
58
|
+
this.resizeObserver?.disconnect(), this.resizeObserver = null, this.chart?.dispose(), this.chart = null, this.rendered = !1;
|
|
59
|
+
}
|
|
60
|
+
render() {
|
|
61
|
+
switch (this.chartState) {
|
|
62
|
+
case "pending":
|
|
63
|
+
return this.renderLoading();
|
|
64
|
+
case "error":
|
|
65
|
+
return this.renderError();
|
|
66
|
+
case "complete":
|
|
67
|
+
return l`<div class="chart-container">
|
|
68
|
+
<div
|
|
69
|
+
class="chart-canvas"
|
|
70
|
+
role="img"
|
|
71
|
+
aria-label=${c("Chart", { id: "chart-block-label" })}
|
|
72
|
+
></div>
|
|
73
|
+
</div>`;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
renderLoading() {
|
|
77
|
+
return l`<div class="chart-container">
|
|
78
|
+
<div class="chart-loading" role="status" aria-live="polite">
|
|
79
|
+
<span class="loading-dot" aria-hidden="true"></span>
|
|
80
|
+
<span class="loading-text shimmer-text"
|
|
81
|
+
>${c("Generating chart...", { id: "chart-block-loading" })}</span
|
|
82
|
+
>
|
|
83
|
+
</div>
|
|
84
|
+
</div>`;
|
|
85
|
+
}
|
|
86
|
+
renderError() {
|
|
87
|
+
return l`<div class="chart-container">
|
|
88
|
+
<div class="chart-error" role="status" aria-live="polite">
|
|
89
|
+
<span class="error-dot" aria-hidden="true"></span>
|
|
90
|
+
<span class="error-text"
|
|
91
|
+
>${c("Failed to render chart", { id: "chart-block-error" })}</span
|
|
92
|
+
>
|
|
93
|
+
</div>
|
|
94
|
+
</div>`;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
i.styles = [b];
|
|
98
|
+
n([
|
|
99
|
+
f({ attribute: !1 })
|
|
100
|
+
], i.prototype, "message", 2);
|
|
101
|
+
n([
|
|
102
|
+
v()
|
|
103
|
+
], i.prototype, "chartState", 2);
|
|
104
|
+
n([
|
|
105
|
+
m(".chart-canvas")
|
|
106
|
+
], i.prototype, "canvasEl", 2);
|
|
107
|
+
i = n([
|
|
108
|
+
x("gaia-chart-block")
|
|
109
|
+
], i);
|
|
110
|
+
export {
|
|
111
|
+
i as GaiaChartBlock
|
|
112
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseElement } from '../../shared/base-element';
|
|
2
|
-
export
|
|
2
|
+
export declare class GaiaDisclaimer extends BaseElement {
|
|
3
3
|
static styles: import('lit').CSSResult[];
|
|
4
4
|
render(): import('lit-html').TemplateResult<1>;
|
|
5
5
|
}
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import { PropertyValues } from 'lit';
|
|
2
2
|
import { HostContextProvider } from '../../types';
|
|
3
3
|
import { BaseElement } from '../shared/base-element';
|
|
4
|
-
export
|
|
4
|
+
export declare class GaiaMessageComposer extends BaseElement {
|
|
5
5
|
static styles: import('lit').CSSResult[];
|
|
6
6
|
private debounceTimer?;
|
|
7
7
|
private resizeController;
|
|
8
|
-
private
|
|
8
|
+
private ctrl;
|
|
9
9
|
textareaWrap: HTMLDivElement;
|
|
10
10
|
textarea: HTMLTextAreaElement;
|
|
11
11
|
autosize: HTMLDivElement;
|
|
12
12
|
private value;
|
|
13
13
|
private invalid;
|
|
14
|
-
private maxInputLength;
|
|
15
|
-
disabled: boolean;
|
|
16
|
-
loading: boolean;
|
|
17
|
-
private isConnectedToSupport;
|
|
18
14
|
profileId: string;
|
|
19
15
|
/**
|
|
20
16
|
* @deprecated Use hostContextProvider instead
|
|
@@ -23,15 +19,18 @@ export default class GaiaMessageComposer extends BaseElement {
|
|
|
23
19
|
hostContextProvider?: HostContextProvider;
|
|
24
20
|
rows: number;
|
|
25
21
|
maxRows: number;
|
|
26
|
-
private unsubscribe?;
|
|
27
|
-
connectedCallback(): void;
|
|
28
22
|
disconnectedCallback(): void;
|
|
29
23
|
private get notAllowedToSendMessage();
|
|
24
|
+
private isMessageNotAllowed;
|
|
30
25
|
private validateInput;
|
|
31
26
|
private handleChange;
|
|
32
27
|
private handleInput;
|
|
33
28
|
private closeFeedbackIfOpen;
|
|
34
29
|
private handleSendMessage;
|
|
30
|
+
private resolveHostContext;
|
|
31
|
+
private dispatchToSupport;
|
|
32
|
+
private dispatchToAssistant;
|
|
33
|
+
private handleSuggestedQuestionClick;
|
|
35
34
|
private handleKeyDown;
|
|
36
35
|
private maybeEmitTyping;
|
|
37
36
|
protected updated(changed: PropertyValues): Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactiveController } from 'lit';
|
|
2
|
-
import {
|
|
2
|
+
import { GaiaMessageComposer } from './message-composer';
|
|
3
3
|
export declare class ResizeController implements ReactiveController {
|
|
4
4
|
private host;
|
|
5
5
|
private resizeObserver;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { nothing } from 'lit';
|
|
2
2
|
import { SupportSessionActivityType } from '../../../core/types';
|
|
3
3
|
import { BaseElement } from '../../shared/base-element';
|
|
4
|
-
export
|
|
4
|
+
export declare class GaiaActivityIndicator extends BaseElement {
|
|
5
5
|
static styles: import('lit').CSSResult[];
|
|
6
6
|
/**
|
|
7
7
|
* The activity type to display.
|
|
@@ -1,22 +1,15 @@
|
|
|
1
|
-
import { PropertyValues } from 'lit';
|
|
2
1
|
import { BaseElement } from '../shared/base-element';
|
|
3
2
|
export declare class GaiaConversation extends BaseElement {
|
|
4
|
-
static styles: import('lit').CSSResult[];
|
|
3
|
+
static styles: import('lit').CSSResult[][];
|
|
5
4
|
private containerRef;
|
|
6
5
|
private scrollViewRef;
|
|
7
6
|
private lastMessageRef;
|
|
8
|
-
private
|
|
9
|
-
|
|
10
|
-
private
|
|
11
|
-
private
|
|
12
|
-
private
|
|
13
|
-
|
|
14
|
-
private messages;
|
|
15
|
-
private toolCallSummaries;
|
|
16
|
-
private unsubscribe?;
|
|
17
|
-
connectedCallback(): void;
|
|
18
|
-
disconnectedCallback(): void;
|
|
19
|
-
protected updated(changedProperties: PropertyValues): Promise<void>;
|
|
7
|
+
private ctrl;
|
|
8
|
+
/** Tracked for scroll change detection. */
|
|
9
|
+
private prevMessages;
|
|
10
|
+
private prevFeedbackOpen;
|
|
11
|
+
private prevError;
|
|
12
|
+
protected updated(): Promise<void>;
|
|
20
13
|
private handleScrollUpdate;
|
|
21
14
|
/**
|
|
22
15
|
* Whether the thinking indicator should be visible.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import('lit').CSSResult;
|
|
1
|
+
declare const _default: import('lit').CSSResult[];
|
|
2
2
|
export default _default;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { BaseElement } from '../../shared/base-element';
|
|
2
|
-
export
|
|
2
|
+
export declare class GaiaMarkdownContent extends BaseElement {
|
|
3
3
|
static styles: import('lit').CSSResult[];
|
|
4
|
+
private static hookInstalled;
|
|
5
|
+
private static installDOMPurifyHook;
|
|
4
6
|
value: string;
|
|
7
|
+
connectedCallback(): void;
|
|
5
8
|
render(): import('lit-html').TemplateResult<1>;
|
|
6
9
|
}
|
|
7
10
|
declare global {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { IconName } from '../../primitives/icon/icon-
|
|
1
|
+
import { IconName } from '../../primitives/icon/icon-registry';
|
|
2
2
|
import { WelcomeMessage } from '../../../services/api-client';
|
|
3
3
|
import { BaseElement } from '../../shared/base-element';
|
|
4
|
-
export
|
|
4
|
+
export declare class GaiaWelcomeMessage extends BaseElement {
|
|
5
5
|
static styles: import('lit').CSSResult[];
|
|
6
|
-
isInitialized: boolean;
|
|
7
6
|
welcomeMessage?: WelcomeMessage;
|
|
8
7
|
protected getIcon(icon: string): IconName;
|
|
9
8
|
render(): import('lit-html').TemplateResult<1>;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
+
import { PropertyValues } from 'lit';
|
|
1
2
|
import { BaseElement } from '../shared/base-element';
|
|
2
|
-
export
|
|
3
|
+
export declare class GaiaFeedback extends BaseElement {
|
|
3
4
|
static styles: import('lit').CSSResult[];
|
|
4
|
-
private
|
|
5
|
+
private ctrl;
|
|
5
6
|
private ratingInput;
|
|
6
7
|
private commentInput;
|
|
8
|
+
private closeButton;
|
|
7
9
|
private selectedRating;
|
|
8
10
|
private comment;
|
|
9
|
-
private target;
|
|
10
|
-
private unsubscribe?;
|
|
11
|
-
connectedCallback(): void;
|
|
12
|
-
disconnectedCallback(): void;
|
|
13
11
|
private canSubmit;
|
|
14
12
|
private handleRatingChange;
|
|
15
13
|
private handleCommentChange;
|
|
16
14
|
private handleSubmit;
|
|
17
15
|
private handleReset;
|
|
16
|
+
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
17
|
+
private handleKeyDown;
|
|
18
18
|
private handleClose;
|
|
19
19
|
render(): import('lit-html').TemplateResult<1>;
|
|
20
20
|
}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
+
import { PropertyValues } from 'lit';
|
|
1
2
|
import { BaseElement } from '../../shared/base-element';
|
|
2
|
-
export
|
|
3
|
+
export declare class GaiaAppHeader extends BaseElement {
|
|
3
4
|
static styles: import('lit').CSSResult[];
|
|
4
|
-
private
|
|
5
|
-
private
|
|
6
|
-
private isFeedbackOpen;
|
|
7
|
-
private hasMessages;
|
|
5
|
+
private ctrl;
|
|
6
|
+
private activeToolbarIndex;
|
|
8
7
|
closeable: boolean;
|
|
9
|
-
private unsubscribe?;
|
|
10
8
|
connectedCallback(): void;
|
|
11
9
|
disconnectedCallback(): void;
|
|
12
|
-
|
|
10
|
+
protected updated(changed: PropertyValues): void;
|
|
11
|
+
private getToolbarButtons;
|
|
12
|
+
private updateToolbarTabindex;
|
|
13
|
+
private nextEnabledIndex;
|
|
14
|
+
private handleToolbarKeyDown;
|
|
15
|
+
private handleFeedbackClosed;
|
|
13
16
|
private handleClearConversation;
|
|
14
17
|
private handleToggleFeedback;
|
|
15
18
|
private handleCloseChat;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { nothing } from 'lit';
|
|
2
|
+
import { BaseElement } from '../../shared/base-element';
|
|
3
|
+
export declare class GaiaConnectionStatusOverlay extends BaseElement {
|
|
4
|
+
static styles: import('lit').CSSResult[];
|
|
5
|
+
private ctrl;
|
|
6
|
+
render(): import('lit-html').TemplateResult<1> | typeof nothing;
|
|
7
|
+
}
|
|
8
|
+
declare global {
|
|
9
|
+
interface HTMLElementTagNameMap {
|
|
10
|
+
'gaia-connection-status-overlay': GaiaConnectionStatusOverlay;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { nothing } from 'lit';
|
|
2
2
|
import { AppError } from '../../../core/errors';
|
|
3
3
|
import { BaseElement } from '../../shared/base-element';
|
|
4
|
-
export
|
|
4
|
+
export declare class GaiaErrorNotification extends BaseElement {
|
|
5
5
|
static styles: import('lit').CSSResult[];
|
|
6
|
-
private
|
|
6
|
+
private ctrl;
|
|
7
7
|
absolute: boolean;
|
|
8
8
|
error?: AppError;
|
|
9
9
|
private handleClearError;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PropertyValues } from 'lit';
|
|
1
2
|
import { UiAssistantMessage, UiOperatorMessage, UiToolMessage, UiUserMessage } from '../../core/adapters/message-mapper';
|
|
2
3
|
import { BaseElement } from '../shared/base-element';
|
|
3
4
|
/**
|
|
@@ -8,7 +9,7 @@ type RenderableMessage = UiUserMessage | UiAssistantMessage | UiToolMessage | Ui
|
|
|
8
9
|
* Valid values for the `from` attribute used for styling.
|
|
9
10
|
*/
|
|
10
11
|
type FromRole = 'user' | 'assistant' | 'operator' | 'system';
|
|
11
|
-
export
|
|
12
|
+
export declare class GaiaMessage extends BaseElement {
|
|
12
13
|
static styles: import('lit').CSSResult[];
|
|
13
14
|
/**
|
|
14
15
|
* The role for styling. Set directly for slot-based usage (e.g., thinking indicator).
|
|
@@ -31,11 +32,13 @@ export default class GaiaMessage extends BaseElement {
|
|
|
31
32
|
* Timeout ID for resetting the copied state.
|
|
32
33
|
*/
|
|
33
34
|
private copyTimeoutId?;
|
|
35
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
34
36
|
render(): import('lit-html').TemplateResult<1>;
|
|
35
37
|
disconnectedCallback(): void;
|
|
36
38
|
/**
|
|
37
39
|
* Render content directly from message properties.
|
|
38
40
|
*/
|
|
41
|
+
private get messageAriaLabel();
|
|
39
42
|
private renderFromMessage;
|
|
40
43
|
/**
|
|
41
44
|
* Render avatar based on message type.
|