@aikaara/chat-sdk 0.2.0 → 0.3.3
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/dist/cdn/aikaara-chat.iife.js +318 -61
- package/dist/headless.cjs +1 -8
- package/dist/headless.d.ts +873 -6
- package/dist/headless.mjs +244 -10520
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +500 -6
- package/dist/index.mjs +36 -29
- package/dist/ui-B0-Np9Dn.cjs +792 -0
- package/dist/ui-BMGa0gZH.mjs +13265 -0
- package/dist/ui.cjs +1 -528
- package/dist/ui.d.ts +588 -6
- package/dist/ui.mjs +16 -1010
- package/package.json +1 -1
- package/dist/AikaaraChatClient-C4lWcRsS.mjs +0 -611
- package/dist/AikaaraChatClient-ChZ2bL9f.cjs +0 -1
package/dist/ui.d.ts
CHANGED
|
@@ -8,14 +8,45 @@ export declare class AikaaraChatBubble extends HTMLElement {
|
|
|
8
8
|
|
|
9
9
|
declare class AikaaraChatClient extends EventEmitter<ChatEvents> {
|
|
10
10
|
private connection;
|
|
11
|
+
private tiledesk;
|
|
11
12
|
private api;
|
|
12
13
|
private messageStore;
|
|
13
14
|
private conversationManager;
|
|
14
15
|
private subscription;
|
|
15
16
|
private config;
|
|
16
|
-
|
|
17
|
+
private mode;
|
|
18
|
+
private uploadAdapter;
|
|
19
|
+
private historyAdapter;
|
|
20
|
+
private tiledeskUnsubs;
|
|
21
|
+
constructor(config: ChatClientConfig_2, opts?: {
|
|
22
|
+
uploadAdapter?: UploadAdapter_2;
|
|
23
|
+
historyAdapter?: ConversationHistoryAdapter_2;
|
|
24
|
+
});
|
|
25
|
+
private usesAikaara;
|
|
26
|
+
private usesTiledesk;
|
|
27
|
+
private initTiledeskTransport;
|
|
17
28
|
connect(): Promise<void>;
|
|
18
|
-
|
|
29
|
+
private hydrateTiledeskHistory;
|
|
30
|
+
sendMessage(content: string, opts?: {
|
|
31
|
+
attributes?: Record<string, unknown>;
|
|
32
|
+
metadata?: Record<string, unknown>;
|
|
33
|
+
}): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Upload a file via the configured UploadAdapter (client-side: file goes
|
|
36
|
+
* to the tenant's own backend, never through Aikaara). Then publish the
|
|
37
|
+
* Tiledesk file-message envelope so hooks_controller picks it up.
|
|
38
|
+
*/
|
|
39
|
+
sendFile(file: File | Blob, opts?: {
|
|
40
|
+
caption?: string;
|
|
41
|
+
}): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Trigger Tiledesk's CHAT_INITIATED event — required to kick off a bot flow
|
|
44
|
+
* for newly-created Tiledesk request groups.
|
|
45
|
+
*/
|
|
46
|
+
initiateTiledeskChat(extraAttributes?: Record<string, unknown>): void;
|
|
47
|
+
/** Mark a Tiledesk message as read (publishes status=300 update). */
|
|
48
|
+
markTiledeskRead(messageId: string): void;
|
|
49
|
+
setUploadAdapter(adapter: UploadAdapter_2): void;
|
|
19
50
|
sendUserEvent(eventKey: string, value?: object, source?: string): Promise<void>;
|
|
20
51
|
loadHistory(): Promise<Message_2[]>;
|
|
21
52
|
get messages(): Message_2[];
|
|
@@ -40,6 +71,8 @@ declare class AikaaraChatClient extends EventEmitter<ChatEvents> {
|
|
|
40
71
|
*/
|
|
41
72
|
setContext(context: AppContext): Promise<void>;
|
|
42
73
|
disconnect(): Promise<void>;
|
|
74
|
+
private handleTiledeskMessage;
|
|
75
|
+
private handleTiledeskStatusUpdate;
|
|
43
76
|
/**
|
|
44
77
|
* Parse structured action results from tool execution output.
|
|
45
78
|
* When the agent calls tools like `edit_current_entity`, `save_current_entity`,
|
|
@@ -61,17 +94,38 @@ export declare class AikaaraChatHeader extends HTMLElement {
|
|
|
61
94
|
setStatus(status: string): void;
|
|
62
95
|
}
|
|
63
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Chat input box. Composes a textarea + send button + optional attach button.
|
|
99
|
+
*
|
|
100
|
+
* Events fired (composed:true so they cross shadow boundaries):
|
|
101
|
+
* - `send` `{ content: string }` — user pressed enter / clicked send
|
|
102
|
+
* - `file-pick` `{ file: File }` — user selected a file to upload
|
|
103
|
+
*
|
|
104
|
+
* Attributes:
|
|
105
|
+
* - `placeholder` placeholder text
|
|
106
|
+
* - `disable-attach` hides the attach button (set when host has no uploadAdapter)
|
|
107
|
+
* - `accept` forwarded to the hidden <input type="file">
|
|
108
|
+
* - `multiple` allow selecting multiple files
|
|
109
|
+
*/
|
|
64
110
|
export declare class AikaaraChatInput extends HTMLElement {
|
|
65
111
|
private shadow;
|
|
66
112
|
private textarea;
|
|
67
113
|
private sendBtn;
|
|
114
|
+
private attachBtn;
|
|
115
|
+
private fileInput;
|
|
68
116
|
private _disabled;
|
|
117
|
+
private _uploading;
|
|
69
118
|
constructor();
|
|
119
|
+
static get observedAttributes(): string[];
|
|
70
120
|
connectedCallback(): void;
|
|
71
121
|
set disabled(val: boolean);
|
|
72
122
|
get disabled(): boolean;
|
|
123
|
+
/** Toggle the attach button into a "uploading…" spinner state. */
|
|
124
|
+
set uploading(val: boolean);
|
|
125
|
+
get uploading(): boolean;
|
|
73
126
|
focus(): void;
|
|
74
127
|
clear(): void;
|
|
128
|
+
private refreshSendDisabled;
|
|
75
129
|
private handleSend;
|
|
76
130
|
private autoGrow;
|
|
77
131
|
}
|
|
@@ -87,6 +141,8 @@ export declare class AikaaraChatWidget extends HTMLElement {
|
|
|
87
141
|
attributeChangedCallback(_name: string, oldVal: string, newVal: string): void;
|
|
88
142
|
configure(config: Partial<WidgetConfig>): void;
|
|
89
143
|
private getConfig;
|
|
144
|
+
setUploadAdapter(adapter: UploadAdapter): void;
|
|
145
|
+
setHistoryAdapter(adapter: ConversationHistoryAdapter): void;
|
|
90
146
|
private render;
|
|
91
147
|
private initController;
|
|
92
148
|
sendUserEvent(eventKey: string, value?: Record<string, unknown>, source?: string): void;
|
|
@@ -106,11 +162,19 @@ export declare class AikaaraErrorBanner extends HTMLElement {
|
|
|
106
162
|
|
|
107
163
|
export declare class AikaaraMessageBubble extends HTMLElement {
|
|
108
164
|
private shadow;
|
|
165
|
+
private templatePayload;
|
|
166
|
+
private attachments;
|
|
109
167
|
static get observedAttributes(): string[];
|
|
110
168
|
constructor();
|
|
111
169
|
connectedCallback(): void;
|
|
112
170
|
attributeChangedCallback(): void;
|
|
171
|
+
setTemplatePayload(payload: unknown): void;
|
|
172
|
+
setAttachments(attachments: Array<{
|
|
173
|
+
fileName: string;
|
|
174
|
+
fileUrl: string;
|
|
175
|
+
}>): void;
|
|
113
176
|
private render;
|
|
177
|
+
private renderAttachments;
|
|
114
178
|
}
|
|
115
179
|
|
|
116
180
|
export declare class AikaaraMessageList extends HTMLElement {
|
|
@@ -129,10 +193,46 @@ export declare class AikaaraMessageList extends HTMLElement {
|
|
|
129
193
|
showTypingIndicator(): void;
|
|
130
194
|
removeTypingIndicator(): void;
|
|
131
195
|
private appendMessageElement;
|
|
196
|
+
/**
|
|
197
|
+
* Replace an existing rendered message (matched by id or externalId) in place.
|
|
198
|
+
* Used when a Tiledesk self-echo reconciles with an optimistic bubble or when
|
|
199
|
+
* a status update flips delivered → read.
|
|
200
|
+
*/
|
|
201
|
+
upsertMessage(message: Message): void;
|
|
202
|
+
private findRenderedMessage;
|
|
132
203
|
private scrollToBottom;
|
|
133
204
|
private formatTime;
|
|
134
205
|
}
|
|
135
206
|
|
|
207
|
+
export declare class AikaaraModalAction extends HTMLElement {
|
|
208
|
+
private shadow;
|
|
209
|
+
private data;
|
|
210
|
+
private dismissed;
|
|
211
|
+
constructor();
|
|
212
|
+
connectedCallback(): void;
|
|
213
|
+
setPayload(payload: ModalActionPayload): void;
|
|
214
|
+
dismiss(): void;
|
|
215
|
+
private handleOk;
|
|
216
|
+
private render;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export declare class AikaaraOptionList extends HTMLElement {
|
|
220
|
+
private shadow;
|
|
221
|
+
private data;
|
|
222
|
+
private selected;
|
|
223
|
+
constructor();
|
|
224
|
+
connectedCallback(): void;
|
|
225
|
+
setPayload(payload: OptionListPayload): void;
|
|
226
|
+
/** Read selected values — used by parent submit action to collect form state. */
|
|
227
|
+
getValues(): {
|
|
228
|
+
name: string;
|
|
229
|
+
values: string[];
|
|
230
|
+
type: string;
|
|
231
|
+
};
|
|
232
|
+
private toggle;
|
|
233
|
+
private render;
|
|
234
|
+
}
|
|
235
|
+
|
|
136
236
|
export declare class AikaaraStreamingMessage extends HTMLElement {
|
|
137
237
|
private shadow;
|
|
138
238
|
private bubble;
|
|
@@ -142,6 +242,64 @@ export declare class AikaaraStreamingMessage extends HTMLElement {
|
|
|
142
242
|
finalize(): void;
|
|
143
243
|
}
|
|
144
244
|
|
|
245
|
+
export declare class AikaaraSubmitAction extends HTMLElement {
|
|
246
|
+
private shadow;
|
|
247
|
+
private data;
|
|
248
|
+
constructor();
|
|
249
|
+
connectedCallback(): void;
|
|
250
|
+
setPayload(payload: SubmitActionPayload): void;
|
|
251
|
+
private collectFormValues;
|
|
252
|
+
private handleClick;
|
|
253
|
+
private render;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Centered grey pill used for system / metadata messages
|
|
258
|
+
* (e.g. "Group created", "Assigned to Taxbuddy AI").
|
|
259
|
+
*
|
|
260
|
+
* Theming knobs (CSS custom properties on :host or any ancestor):
|
|
261
|
+
* --aikaara-system-pill-bg
|
|
262
|
+
* --aikaara-system-pill-color
|
|
263
|
+
* --aikaara-system-pill-radius
|
|
264
|
+
* --aikaara-system-pill-padding
|
|
265
|
+
* --aikaara-system-pill-font-size
|
|
266
|
+
* --aikaara-system-pill-font-weight
|
|
267
|
+
* --aikaara-system-pill-border
|
|
268
|
+
*/
|
|
269
|
+
export declare class AikaaraSystemPill extends HTMLElement {
|
|
270
|
+
private shadow;
|
|
271
|
+
static get observedAttributes(): string[];
|
|
272
|
+
constructor();
|
|
273
|
+
connectedCallback(): void;
|
|
274
|
+
attributeChangedCallback(): void;
|
|
275
|
+
private render;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Renders the payload of a contentType=300 Tiledesk template. Walks the
|
|
280
|
+
* payload structure and mounts the right child component(s):
|
|
281
|
+
* - { type: 'checkbox' | 'radio' | 'button' } → <aikaara-option-list>
|
|
282
|
+
* - { type: 'submit' } → <aikaara-submit-action>
|
|
283
|
+
* - { type: 'modal' } / single object with `message + ok` → <aikaara-modal-action>
|
|
284
|
+
*
|
|
285
|
+
* Tenants can override per-template UI by registering a custom element named
|
|
286
|
+
* `aikaara-template-{templateId}` (or by templateId-based slot). The renderer
|
|
287
|
+
* checks for that first; if present, it delegates the whole payload there.
|
|
288
|
+
*/
|
|
289
|
+
export declare class AikaaraTemplateRenderer extends HTMLElement {
|
|
290
|
+
private shadow;
|
|
291
|
+
private payloadData;
|
|
292
|
+
private innerMessage;
|
|
293
|
+
static get observedAttributes(): string[];
|
|
294
|
+
constructor();
|
|
295
|
+
connectedCallback(): void;
|
|
296
|
+
attributeChangedCallback(): void;
|
|
297
|
+
setPayload(payload: unknown, innerMessage?: string): void;
|
|
298
|
+
private render;
|
|
299
|
+
private mountField;
|
|
300
|
+
private mountModal;
|
|
301
|
+
}
|
|
302
|
+
|
|
145
303
|
export declare class AikaaraTypingIndicator extends HTMLElement {
|
|
146
304
|
private shadow;
|
|
147
305
|
constructor();
|
|
@@ -172,11 +330,37 @@ declare interface ChatClientConfig extends ConnectionConfig {
|
|
|
172
330
|
conversationId?: string;
|
|
173
331
|
systemPromptId?: number;
|
|
174
332
|
channel?: 'widget' | 'api' | 'sidekick';
|
|
333
|
+
/**
|
|
334
|
+
* Transport selection.
|
|
335
|
+
* - `aikaara` (default): ActionCable to Aikaara Rails (AI streaming).
|
|
336
|
+
* - `tiledesk`: MQTT direct to a self-hosted Tiledesk + chat21 stack.
|
|
337
|
+
* - `dual`: both — Aikaara cable for AI, Tiledesk MQTT for live-agent + file events.
|
|
338
|
+
*/
|
|
339
|
+
transport?: TransportMode;
|
|
340
|
+
/**
|
|
341
|
+
* Tiledesk-side identity. Required when `transport` is `tiledesk` or `dual`.
|
|
342
|
+
* `userId` here is the Tiledesk user `_id` and is also used as the SDK conversation
|
|
343
|
+
* subject — Aikaara conversations bound to this user via ext_uid mapping.
|
|
344
|
+
*/
|
|
345
|
+
tiledeskIdentity?: {
|
|
346
|
+
userId: string;
|
|
347
|
+
userName?: string;
|
|
348
|
+
departmentId?: string;
|
|
349
|
+
senderFullname?: string;
|
|
350
|
+
};
|
|
351
|
+
/**
|
|
352
|
+
* Tenant-level defaults merged into the `action` object of every template
|
|
353
|
+
* postback (e.g. submit-action click). Useful for app-specific keys like
|
|
354
|
+
* `serviceType: 'ITR'` that the bot expects on every form submission.
|
|
355
|
+
* Per-submit values from the form take precedence over these defaults.
|
|
356
|
+
*/
|
|
357
|
+
templateActionAttributes?: Record<string, unknown>;
|
|
175
358
|
onMessage?: (message: Message) => void;
|
|
176
359
|
onStatusChange?: (status: string) => void;
|
|
177
360
|
onError?: (error: Error) => void;
|
|
178
361
|
onStreamUpdate?: (delta: string, fullContent: string) => void;
|
|
179
362
|
onConnectionStateChange?: (state: ConnectionState) => void;
|
|
363
|
+
onTemplateMessage?: (template: TemplateMessageEvent) => void;
|
|
180
364
|
}
|
|
181
365
|
|
|
182
366
|
declare interface ChatClientConfig_2 extends ConnectionConfig_2 {
|
|
@@ -186,11 +370,37 @@ declare interface ChatClientConfig_2 extends ConnectionConfig_2 {
|
|
|
186
370
|
conversationId?: string;
|
|
187
371
|
systemPromptId?: number;
|
|
188
372
|
channel?: 'widget' | 'api' | 'sidekick';
|
|
373
|
+
/**
|
|
374
|
+
* Transport selection.
|
|
375
|
+
* - `aikaara` (default): ActionCable to Aikaara Rails (AI streaming).
|
|
376
|
+
* - `tiledesk`: MQTT direct to a self-hosted Tiledesk + chat21 stack.
|
|
377
|
+
* - `dual`: both — Aikaara cable for AI, Tiledesk MQTT for live-agent + file events.
|
|
378
|
+
*/
|
|
379
|
+
transport?: TransportMode_2;
|
|
380
|
+
/**
|
|
381
|
+
* Tiledesk-side identity. Required when `transport` is `tiledesk` or `dual`.
|
|
382
|
+
* `userId` here is the Tiledesk user `_id` and is also used as the SDK conversation
|
|
383
|
+
* subject — Aikaara conversations bound to this user via ext_uid mapping.
|
|
384
|
+
*/
|
|
385
|
+
tiledeskIdentity?: {
|
|
386
|
+
userId: string;
|
|
387
|
+
userName?: string;
|
|
388
|
+
departmentId?: string;
|
|
389
|
+
senderFullname?: string;
|
|
390
|
+
};
|
|
391
|
+
/**
|
|
392
|
+
* Tenant-level defaults merged into the `action` object of every template
|
|
393
|
+
* postback (e.g. submit-action click). Useful for app-specific keys like
|
|
394
|
+
* `serviceType: 'ITR'` that the bot expects on every form submission.
|
|
395
|
+
* Per-submit values from the form take precedence over these defaults.
|
|
396
|
+
*/
|
|
397
|
+
templateActionAttributes?: Record<string, unknown>;
|
|
189
398
|
onMessage?: (message: Message_2) => void;
|
|
190
399
|
onStatusChange?: (status: string) => void;
|
|
191
400
|
onError?: (error: Error) => void;
|
|
192
401
|
onStreamUpdate?: (delta: string, fullContent: string) => void;
|
|
193
402
|
onConnectionStateChange?: (state: ConnectionState_2) => void;
|
|
403
|
+
onTemplateMessage?: (template: TemplateMessageEvent_2) => void;
|
|
194
404
|
}
|
|
195
405
|
|
|
196
406
|
declare interface ChatEvents {
|
|
@@ -255,6 +465,32 @@ declare type ConnectionState = 'disconnected' | 'connecting' | 'connected' | 're
|
|
|
255
465
|
|
|
256
466
|
declare type ConnectionState_2 = 'disconnected' | 'connecting' | 'connected' | 'reconnecting';
|
|
257
467
|
|
|
468
|
+
/**
|
|
469
|
+
* Pluggable adapter that hydrates prior conversation messages on connect.
|
|
470
|
+
* The SDK calls this once after MQTT subscribes so the user sees existing
|
|
471
|
+
* history before any new live messages arrive.
|
|
472
|
+
*/
|
|
473
|
+
declare interface ConversationHistoryAdapter {
|
|
474
|
+
fetchMessages(conversationId: string, ctx: {
|
|
475
|
+
userId: string;
|
|
476
|
+
appId?: string;
|
|
477
|
+
projectId?: string;
|
|
478
|
+
}): Promise<TiledeskMessage[]>;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
* Pluggable adapter that hydrates prior conversation messages on connect.
|
|
483
|
+
* The SDK calls this once after MQTT subscribes so the user sees existing
|
|
484
|
+
* history before any new live messages arrive.
|
|
485
|
+
*/
|
|
486
|
+
declare interface ConversationHistoryAdapter_2 {
|
|
487
|
+
fetchMessages(conversationId: string, ctx: {
|
|
488
|
+
userId: string;
|
|
489
|
+
appId?: string;
|
|
490
|
+
projectId?: string;
|
|
491
|
+
}): Promise<TiledeskMessage_2[]>;
|
|
492
|
+
}
|
|
493
|
+
|
|
258
494
|
declare interface EditEntityAction {
|
|
259
495
|
action: 'edit_entity';
|
|
260
496
|
entity_type: string;
|
|
@@ -279,7 +515,7 @@ declare interface FieldUpdate {
|
|
|
279
515
|
declare interface Message {
|
|
280
516
|
id: string;
|
|
281
517
|
conversationId: string;
|
|
282
|
-
role: 'user' | 'assistant' | 'system' | 'tool';
|
|
518
|
+
role: 'user' | 'assistant' | 'system' | 'tool' | 'agent';
|
|
283
519
|
content: string;
|
|
284
520
|
toolCalls?: ToolCall[];
|
|
285
521
|
toolCallResults?: ToolCallResult;
|
|
@@ -287,13 +523,25 @@ declare interface Message {
|
|
|
287
523
|
tokensOutput?: number;
|
|
288
524
|
metadata?: Record<string, unknown>;
|
|
289
525
|
createdAt: string;
|
|
290
|
-
status?: 'sending' | 'sent' | 'streaming' | 'complete' | 'error';
|
|
526
|
+
status?: 'sending' | 'sent' | 'delivered' | 'read' | 'streaming' | 'complete' | 'error';
|
|
527
|
+
externalId?: string;
|
|
528
|
+
template?: {
|
|
529
|
+
contentType?: string;
|
|
530
|
+
templateId?: string;
|
|
531
|
+
payload?: unknown;
|
|
532
|
+
};
|
|
533
|
+
attachments?: Array<{
|
|
534
|
+
fileName: string;
|
|
535
|
+
fileUrl: string;
|
|
536
|
+
cloudFileId?: string;
|
|
537
|
+
contentType?: string;
|
|
538
|
+
}>;
|
|
291
539
|
}
|
|
292
540
|
|
|
293
541
|
declare interface Message_2 {
|
|
294
542
|
id: string;
|
|
295
543
|
conversationId: string;
|
|
296
|
-
role: 'user' | 'assistant' | 'system' | 'tool';
|
|
544
|
+
role: 'user' | 'assistant' | 'system' | 'tool' | 'agent';
|
|
297
545
|
content: string;
|
|
298
546
|
toolCalls?: ToolCall_2[];
|
|
299
547
|
toolCallResults?: ToolCallResult_2;
|
|
@@ -301,31 +549,274 @@ declare interface Message_2 {
|
|
|
301
549
|
tokensOutput?: number;
|
|
302
550
|
metadata?: Record<string, unknown>;
|
|
303
551
|
createdAt: string;
|
|
304
|
-
status?: 'sending' | 'sent' | 'streaming' | 'complete' | 'error';
|
|
552
|
+
status?: 'sending' | 'sent' | 'delivered' | 'read' | 'streaming' | 'complete' | 'error';
|
|
553
|
+
externalId?: string;
|
|
554
|
+
template?: {
|
|
555
|
+
contentType?: string;
|
|
556
|
+
templateId?: string;
|
|
557
|
+
payload?: unknown;
|
|
558
|
+
};
|
|
559
|
+
attachments?: Array<{
|
|
560
|
+
fileName: string;
|
|
561
|
+
fileUrl: string;
|
|
562
|
+
cloudFileId?: string;
|
|
563
|
+
contentType?: string;
|
|
564
|
+
}>;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Modal-style action dialog. Bandhan uses these for blocking confirms
|
|
569
|
+
* (e.g. "Please tick the checkbox to proceed" with an Ok button).
|
|
570
|
+
*
|
|
571
|
+
* Payload shape (flexible — matches several bandhan modal templates):
|
|
572
|
+
* { message: 'Please tick…', okLabel?: 'Ok', cancelLabel?: 'Cancel',
|
|
573
|
+
* action?: { message, requestType } }
|
|
574
|
+
*
|
|
575
|
+
* On Ok the component fires `template-action` with the configured message
|
|
576
|
+
* (or the modal text itself) and dismisses. Cancel just dismisses.
|
|
577
|
+
*
|
|
578
|
+
* Theming:
|
|
579
|
+
* --aikaara-modal-overlay-bg, --aikaara-modal-bg, --aikaara-modal-color,
|
|
580
|
+
* --aikaara-modal-radius, --aikaara-modal-padding, --aikaara-modal-shadow,
|
|
581
|
+
* --aikaara-modal-button-bg, --aikaara-modal-button-color,
|
|
582
|
+
* --aikaara-modal-button-radius, --aikaara-modal-cancel-color
|
|
583
|
+
*/
|
|
584
|
+
declare interface ModalActionPayload {
|
|
585
|
+
message: string;
|
|
586
|
+
okLabel?: string;
|
|
587
|
+
cancelLabel?: string;
|
|
588
|
+
action?: {
|
|
589
|
+
message?: string;
|
|
590
|
+
requestType?: string;
|
|
591
|
+
};
|
|
305
592
|
}
|
|
306
593
|
|
|
307
594
|
declare interface NavigateAction {
|
|
308
595
|
navigate_to: string;
|
|
309
596
|
}
|
|
310
597
|
|
|
598
|
+
/**
|
|
599
|
+
* Rendering for contentType=300 form fields with `type: 'checkbox' | 'radio' | 'button'`.
|
|
600
|
+
*
|
|
601
|
+
* Bandhan envelope:
|
|
602
|
+
* { data: { name: 'IncomeSources', title: 'Income Sources',
|
|
603
|
+
* options: [{ label, value }, ...] },
|
|
604
|
+
* type: 'checkbox' | 'radio' | 'button' }
|
|
605
|
+
*
|
|
606
|
+
* Emits a `template-action` CustomEvent on selection. For `button` type the
|
|
607
|
+
* action fires immediately on click. For `checkbox`/`radio` the parent submit
|
|
608
|
+
* action collects values via `getValues()`.
|
|
609
|
+
*
|
|
610
|
+
* Theming:
|
|
611
|
+
* --aikaara-option-bg, --aikaara-option-color, --aikaara-option-border,
|
|
612
|
+
* --aikaara-option-radius, --aikaara-option-padding, --aikaara-option-gap,
|
|
613
|
+
* --aikaara-option-selected-bg, --aikaara-option-selected-color,
|
|
614
|
+
* --aikaara-option-selected-border, --aikaara-option-title-color,
|
|
615
|
+
* --aikaara-option-title-font-size, --aikaara-option-title-font-weight
|
|
616
|
+
*/
|
|
617
|
+
declare interface OptionItem {
|
|
618
|
+
label: string;
|
|
619
|
+
value: string;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
declare interface OptionListPayload {
|
|
623
|
+
name: string;
|
|
624
|
+
title?: string;
|
|
625
|
+
options: OptionItem[];
|
|
626
|
+
type: 'checkbox' | 'radio' | 'button';
|
|
627
|
+
}
|
|
628
|
+
|
|
311
629
|
export declare function registerComponents(): void;
|
|
312
630
|
|
|
313
631
|
declare interface SaveEntityAction {
|
|
314
632
|
action: 'save_entity';
|
|
315
633
|
}
|
|
316
634
|
|
|
635
|
+
/**
|
|
636
|
+
* Primary CTA submit button for contentType=300 forms.
|
|
637
|
+
*
|
|
638
|
+
* Bandhan envelope:
|
|
639
|
+
* { data: { name: 'Confirm Income Sources', type: 'submit',
|
|
640
|
+
* action: { message, formAction, requestType } },
|
|
641
|
+
* type: 'submit' }
|
|
642
|
+
*
|
|
643
|
+
* On click, collects values from sibling AikaaraOptionList components
|
|
644
|
+
* (queried by walking up to the parent template renderer's children) and
|
|
645
|
+
* fires `template-action` with the action message + collected attributes.
|
|
646
|
+
*
|
|
647
|
+
* Theming:
|
|
648
|
+
* --aikaara-submit-bg, --aikaara-submit-color, --aikaara-submit-border,
|
|
649
|
+
* --aikaara-submit-radius, --aikaara-submit-padding,
|
|
650
|
+
* --aikaara-submit-hover-bg, --aikaara-submit-disabled-opacity,
|
|
651
|
+
* --aikaara-submit-font-size, --aikaara-submit-font-weight
|
|
652
|
+
*/
|
|
653
|
+
declare interface SubmitActionPayload {
|
|
654
|
+
name: string;
|
|
655
|
+
action: {
|
|
656
|
+
message: string;
|
|
657
|
+
formAction?: string;
|
|
658
|
+
requestType?: string;
|
|
659
|
+
};
|
|
660
|
+
/** id of the bot prompt that triggered this form, stamped on the postback */
|
|
661
|
+
messageId?: string;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
declare interface TemplateMessageEvent {
|
|
665
|
+
messageId: string;
|
|
666
|
+
conversationId: string;
|
|
667
|
+
role: 'user' | 'assistant' | 'system' | 'agent';
|
|
668
|
+
contentType?: string;
|
|
669
|
+
templateId?: string;
|
|
670
|
+
payload?: unknown;
|
|
671
|
+
innerMessage?: string;
|
|
672
|
+
raw: unknown;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
declare interface TemplateMessageEvent_2 {
|
|
676
|
+
messageId: string;
|
|
677
|
+
conversationId: string;
|
|
678
|
+
role: 'user' | 'assistant' | 'system' | 'agent';
|
|
679
|
+
contentType?: string;
|
|
680
|
+
templateId?: string;
|
|
681
|
+
payload?: unknown;
|
|
682
|
+
innerMessage?: string;
|
|
683
|
+
raw: unknown;
|
|
684
|
+
}
|
|
685
|
+
|
|
317
686
|
declare interface TestToolAction {
|
|
318
687
|
action: 'test_tool';
|
|
319
688
|
tool_id: number;
|
|
320
689
|
parameters: Record<string, unknown>;
|
|
321
690
|
}
|
|
322
691
|
|
|
692
|
+
declare interface TiledeskFileTemplateConfig {
|
|
693
|
+
templateId: string;
|
|
694
|
+
headerImgSrc?: string;
|
|
695
|
+
type?: 'link' | 'image';
|
|
696
|
+
isDeepLink?: boolean;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
declare interface TiledeskFileTemplateConfig_2 {
|
|
700
|
+
templateId: string;
|
|
701
|
+
headerImgSrc?: string;
|
|
702
|
+
type?: 'link' | 'image';
|
|
703
|
+
isDeepLink?: boolean;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
declare interface TiledeskMessage {
|
|
707
|
+
text?: string;
|
|
708
|
+
type?: string;
|
|
709
|
+
sender?: string;
|
|
710
|
+
senderFullname?: string;
|
|
711
|
+
sender_fullname?: string;
|
|
712
|
+
recipient?: string;
|
|
713
|
+
recipient_fullname?: string;
|
|
714
|
+
channel_type?: string;
|
|
715
|
+
timestamp?: number;
|
|
716
|
+
app_id?: string;
|
|
717
|
+
message_id?: string;
|
|
718
|
+
status?: number;
|
|
719
|
+
attributes?: Record<string, unknown>;
|
|
720
|
+
metadata?: Record<string, unknown>;
|
|
721
|
+
[key: string]: unknown;
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
declare interface TiledeskMessage_2 {
|
|
725
|
+
text?: string;
|
|
726
|
+
type?: string;
|
|
727
|
+
sender?: string;
|
|
728
|
+
senderFullname?: string;
|
|
729
|
+
sender_fullname?: string;
|
|
730
|
+
recipient?: string;
|
|
731
|
+
recipient_fullname?: string;
|
|
732
|
+
channel_type?: string;
|
|
733
|
+
timestamp?: number;
|
|
734
|
+
app_id?: string;
|
|
735
|
+
message_id?: string;
|
|
736
|
+
status?: number;
|
|
737
|
+
attributes?: Record<string, unknown>;
|
|
738
|
+
metadata?: Record<string, unknown>;
|
|
739
|
+
[key: string]: unknown;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
declare interface TiledeskMessageDefaults {
|
|
743
|
+
channelType?: string;
|
|
744
|
+
channel?: string;
|
|
745
|
+
requestChannel?: string;
|
|
746
|
+
platform?: string;
|
|
747
|
+
medium?: string;
|
|
748
|
+
departmentId?: string;
|
|
749
|
+
attributes?: Record<string, unknown>;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
declare interface TiledeskMessageDefaults_2 {
|
|
753
|
+
channelType?: string;
|
|
754
|
+
channel?: string;
|
|
755
|
+
requestChannel?: string;
|
|
756
|
+
platform?: string;
|
|
757
|
+
medium?: string;
|
|
758
|
+
departmentId?: string;
|
|
759
|
+
attributes?: Record<string, unknown>;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
declare interface TiledeskTopicTemplates {
|
|
763
|
+
inbound?: string;
|
|
764
|
+
inboundUpdate?: string;
|
|
765
|
+
outbound?: string;
|
|
766
|
+
presence?: string;
|
|
767
|
+
wildcardSubscribe?: string;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
declare interface TiledeskTopicTemplates_2 {
|
|
771
|
+
inbound?: string;
|
|
772
|
+
inboundUpdate?: string;
|
|
773
|
+
outbound?: string;
|
|
774
|
+
presence?: string;
|
|
775
|
+
wildcardSubscribe?: string;
|
|
776
|
+
}
|
|
777
|
+
|
|
323
778
|
declare interface TiledeskTransportConfig {
|
|
324
779
|
mqttEndpoint: string;
|
|
325
780
|
jwtToken: string;
|
|
326
781
|
userId: string;
|
|
327
782
|
userName?: string;
|
|
328
783
|
projectId: string;
|
|
784
|
+
appId?: string;
|
|
785
|
+
clientId?: string;
|
|
786
|
+
protocolVersion?: 3 | 4 | 5;
|
|
787
|
+
protocolId?: 'MQIsdp' | 'MQTT';
|
|
788
|
+
mqttUsername?: string;
|
|
789
|
+
connectTimeoutMs?: number;
|
|
790
|
+
keepAliveSec?: number;
|
|
791
|
+
maxReconnectAttempts?: number;
|
|
792
|
+
reconnectMaxDelayMs?: number;
|
|
793
|
+
tokenProvider?: () => Promise<string>;
|
|
794
|
+
wildcardSubscribe?: boolean;
|
|
795
|
+
subscribeQos?: 0 | 1 | 2;
|
|
796
|
+
publishQos?: 0 | 1 | 2;
|
|
797
|
+
publishRetain?: boolean;
|
|
798
|
+
enablePresence?: boolean;
|
|
799
|
+
presencePayloadConnected?: Record<string, unknown>;
|
|
800
|
+
presencePayloadDisconnected?: Record<string, unknown>;
|
|
801
|
+
topicTemplates?: TiledeskTopicTemplates;
|
|
802
|
+
messageDefaults?: TiledeskMessageDefaults;
|
|
803
|
+
fileTemplate?: TiledeskFileTemplateConfig;
|
|
804
|
+
recipientFullnameResolver?: (conversationId: string) => string | undefined;
|
|
805
|
+
senderFullname?: string;
|
|
806
|
+
/**
|
|
807
|
+
* If true (default), AikaaraChatClient publishes a `CHAT_INITIATED` event
|
|
808
|
+
* to the conversation's outbound topic on first connect — but only when
|
|
809
|
+
* the conversation history is empty (so reload of an in-flight chat
|
|
810
|
+
* doesn't replay the kickoff).
|
|
811
|
+
*/
|
|
812
|
+
autoInitiateOnEmpty?: boolean;
|
|
813
|
+
/** Extra attributes merged into the auto-fired CHAT_INITIATED envelope. */
|
|
814
|
+
chatInitiatedAttributes?: Record<string, unknown>;
|
|
815
|
+
/**
|
|
816
|
+
* Log decoded MQTT frames to console as they're sent/received.
|
|
817
|
+
* Off by default — set true for debugging Tiledesk wire traffic.
|
|
818
|
+
*/
|
|
819
|
+
debug?: boolean;
|
|
329
820
|
}
|
|
330
821
|
|
|
331
822
|
declare interface TiledeskTransportConfig_2 {
|
|
@@ -334,6 +825,42 @@ declare interface TiledeskTransportConfig_2 {
|
|
|
334
825
|
userId: string;
|
|
335
826
|
userName?: string;
|
|
336
827
|
projectId: string;
|
|
828
|
+
appId?: string;
|
|
829
|
+
clientId?: string;
|
|
830
|
+
protocolVersion?: 3 | 4 | 5;
|
|
831
|
+
protocolId?: 'MQIsdp' | 'MQTT';
|
|
832
|
+
mqttUsername?: string;
|
|
833
|
+
connectTimeoutMs?: number;
|
|
834
|
+
keepAliveSec?: number;
|
|
835
|
+
maxReconnectAttempts?: number;
|
|
836
|
+
reconnectMaxDelayMs?: number;
|
|
837
|
+
tokenProvider?: () => Promise<string>;
|
|
838
|
+
wildcardSubscribe?: boolean;
|
|
839
|
+
subscribeQos?: 0 | 1 | 2;
|
|
840
|
+
publishQos?: 0 | 1 | 2;
|
|
841
|
+
publishRetain?: boolean;
|
|
842
|
+
enablePresence?: boolean;
|
|
843
|
+
presencePayloadConnected?: Record<string, unknown>;
|
|
844
|
+
presencePayloadDisconnected?: Record<string, unknown>;
|
|
845
|
+
topicTemplates?: TiledeskTopicTemplates_2;
|
|
846
|
+
messageDefaults?: TiledeskMessageDefaults_2;
|
|
847
|
+
fileTemplate?: TiledeskFileTemplateConfig_2;
|
|
848
|
+
recipientFullnameResolver?: (conversationId: string) => string | undefined;
|
|
849
|
+
senderFullname?: string;
|
|
850
|
+
/**
|
|
851
|
+
* If true (default), AikaaraChatClient publishes a `CHAT_INITIATED` event
|
|
852
|
+
* to the conversation's outbound topic on first connect — but only when
|
|
853
|
+
* the conversation history is empty (so reload of an in-flight chat
|
|
854
|
+
* doesn't replay the kickoff).
|
|
855
|
+
*/
|
|
856
|
+
autoInitiateOnEmpty?: boolean;
|
|
857
|
+
/** Extra attributes merged into the auto-fired CHAT_INITIATED envelope. */
|
|
858
|
+
chatInitiatedAttributes?: Record<string, unknown>;
|
|
859
|
+
/**
|
|
860
|
+
* Log decoded MQTT frames to console as they're sent/received.
|
|
861
|
+
* Off by default — set true for debugging Tiledesk wire traffic.
|
|
862
|
+
*/
|
|
863
|
+
debug?: boolean;
|
|
337
864
|
}
|
|
338
865
|
|
|
339
866
|
declare interface ToolCall {
|
|
@@ -364,6 +891,52 @@ declare interface ToolCallResult_2 {
|
|
|
364
891
|
content: string;
|
|
365
892
|
}
|
|
366
893
|
|
|
894
|
+
declare type TransportMode = 'aikaara' | 'tiledesk' | 'dual';
|
|
895
|
+
|
|
896
|
+
declare type TransportMode_2 = 'aikaara' | 'tiledesk' | 'dual';
|
|
897
|
+
|
|
898
|
+
declare interface UploadAdapter {
|
|
899
|
+
upload(file: File | Blob, ctx: UploadAdapterContext): Promise<UploadAdapterResult>;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
declare interface UploadAdapter_2 {
|
|
903
|
+
upload(file: File | Blob, ctx: UploadAdapterContext_2): Promise<UploadAdapterResult_2>;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
declare interface UploadAdapterContext {
|
|
907
|
+
conversationId: string;
|
|
908
|
+
userId: string;
|
|
909
|
+
projectId?: string;
|
|
910
|
+
appId?: string;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
declare interface UploadAdapterContext_2 {
|
|
914
|
+
conversationId: string;
|
|
915
|
+
userId: string;
|
|
916
|
+
projectId?: string;
|
|
917
|
+
appId?: string;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
declare interface UploadAdapterResult {
|
|
921
|
+
url: string;
|
|
922
|
+
fileName: string;
|
|
923
|
+
cloudFileId?: string;
|
|
924
|
+
relativePath?: string;
|
|
925
|
+
contentType?: string;
|
|
926
|
+
byteSize?: number;
|
|
927
|
+
meta?: Record<string, unknown>;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
declare interface UploadAdapterResult_2 {
|
|
931
|
+
url: string;
|
|
932
|
+
fileName: string;
|
|
933
|
+
cloudFileId?: string;
|
|
934
|
+
relativePath?: string;
|
|
935
|
+
contentType?: string;
|
|
936
|
+
byteSize?: number;
|
|
937
|
+
meta?: Record<string, unknown>;
|
|
938
|
+
}
|
|
939
|
+
|
|
367
940
|
declare interface WidgetConfig extends ChatClientConfig {
|
|
368
941
|
position?: 'bottom-right' | 'bottom-left';
|
|
369
942
|
offset?: {
|
|
@@ -386,6 +959,15 @@ declare interface WidgetConfig extends ChatClientConfig {
|
|
|
386
959
|
showBubble?: boolean;
|
|
387
960
|
bubbleText?: string;
|
|
388
961
|
bubbleIcon?: string;
|
|
962
|
+
uploadAdapter?: UploadAdapter;
|
|
963
|
+
historyAdapter?: ConversationHistoryAdapter;
|
|
964
|
+
/**
|
|
965
|
+
* Display mode:
|
|
966
|
+
* - `popup` (default): floating bubble in the corner, click to open panel.
|
|
967
|
+
* - `embed`: render the chat panel inline at the host element's location,
|
|
968
|
+
* filling its container. Bubble + open/close animation are skipped.
|
|
969
|
+
*/
|
|
970
|
+
display?: 'popup' | 'embed';
|
|
389
971
|
}
|
|
390
972
|
|
|
391
973
|
export { }
|