@runtypelabs/persona 3.8.2 → 3.9.0

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.
@@ -103,396 +103,686 @@ __export(theme_editor_exports, {
103
103
  });
104
104
  module.exports = __toCommonJS(theme_editor_exports);
105
105
 
106
- // src/utils/tokens.ts
107
- var DEFAULT_PALETTE = {
108
- colors: {
109
- primary: {
110
- 50: "#ffffff",
111
- 100: "#f5f5f5",
112
- 200: "#d4d4d4",
113
- 300: "#a3a3a3",
114
- 400: "#737373",
115
- 500: "#171717",
116
- 600: "#0f0f0f",
117
- 700: "#0a0a0a",
118
- 800: "#050505",
119
- 900: "#030303",
120
- 950: "#000000"
121
- },
122
- secondary: {
123
- 50: "#f5f3ff",
124
- 100: "#ede9fe",
125
- 200: "#ddd6fe",
126
- 300: "#c4b5fd",
127
- 400: "#a78bfa",
128
- 500: "#8b5cf6",
129
- 600: "#7c3aed",
130
- 700: "#6d28d9",
131
- 800: "#5b21b6",
132
- 900: "#4c1d95",
133
- 950: "#2e1065"
134
- },
135
- accent: {
136
- 50: "#ecfeff",
137
- 100: "#cffafe",
138
- 200: "#a5f3fc",
139
- 300: "#67e8f9",
140
- 400: "#22d3ee",
141
- 500: "#06b6d4",
142
- 600: "#0891b2",
143
- 700: "#0e7490",
144
- 800: "#155e75",
145
- 900: "#164e63",
146
- 950: "#083344"
147
- },
148
- gray: {
149
- 50: "#f9fafb",
150
- 100: "#f3f4f6",
151
- 200: "#e5e7eb",
152
- 300: "#d1d5db",
153
- 400: "#9ca3af",
154
- 500: "#6b7280",
155
- 600: "#4b5563",
156
- 700: "#374151",
157
- 800: "#1f2937",
158
- 900: "#111827",
159
- 950: "#030712"
160
- },
161
- success: {
162
- 50: "#f0fdf4",
163
- 100: "#dcfce7",
164
- 200: "#bbf7d0",
165
- 300: "#86efac",
166
- 400: "#4ade80",
167
- 500: "#22c55e",
168
- 600: "#16a34a",
169
- 700: "#15803d",
170
- 800: "#166534",
171
- 900: "#14532d"
172
- },
173
- warning: {
174
- 50: "#fefce8",
175
- 100: "#fef9c3",
176
- 200: "#fef08a",
177
- 300: "#fde047",
178
- 400: "#facc15",
179
- 500: "#eab308",
180
- 600: "#ca8a04",
181
- 700: "#a16207",
182
- 800: "#854d0e",
183
- 900: "#713f12"
184
- },
185
- error: {
186
- 50: "#fef2f2",
187
- 100: "#fee2e2",
188
- 200: "#fecaca",
189
- 300: "#fca5a5",
190
- 400: "#f87171",
191
- 500: "#ef4444",
192
- 600: "#dc2626",
193
- 700: "#b91c1c",
194
- 800: "#991b1b",
195
- 900: "#7f1d1d"
196
- },
197
- info: {
198
- 50: "#eff6ff",
199
- 100: "#dbeafe",
200
- 200: "#bfdbfe",
201
- 300: "#93c5fd",
202
- 400: "#60a5fa",
203
- 500: "#3b82f6",
204
- 600: "#2563eb",
205
- 700: "#1d4ed8",
206
- 800: "#1e40af",
207
- 900: "#1e3a8a",
208
- 950: "#172554"
106
+ // src/utils/deep-merge.ts
107
+ var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
108
+ function deepMerge(base, override) {
109
+ if (!base) return override;
110
+ if (!override) return base;
111
+ const merged = { ...base };
112
+ for (const [key, value] of Object.entries(override)) {
113
+ const existing = merged[key];
114
+ if (isObject(existing) && isObject(value)) {
115
+ merged[key] = deepMerge(existing, value);
116
+ } else {
117
+ merged[key] = value;
209
118
  }
210
- },
211
- spacing: {
212
- 0: "0px",
213
- 1: "0.25rem",
214
- 2: "0.5rem",
215
- 3: "0.75rem",
216
- 4: "1rem",
217
- 5: "1.25rem",
218
- 6: "1.5rem",
219
- 8: "2rem",
220
- 10: "2.5rem",
221
- 12: "3rem",
222
- 16: "4rem",
223
- 20: "5rem",
224
- 24: "6rem",
225
- 32: "8rem",
226
- 40: "10rem",
227
- 48: "12rem",
228
- 56: "14rem",
229
- 64: "16rem"
230
- },
231
- typography: {
232
- fontFamily: {
233
- sans: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
234
- serif: 'Georgia, Cambria, "Times New Roman", Times, serif',
235
- mono: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"
236
- },
237
- fontSize: {
238
- xs: "0.75rem",
239
- sm: "0.875rem",
240
- base: "1rem",
241
- lg: "1.125rem",
242
- xl: "1.25rem",
243
- "2xl": "1.5rem",
244
- "3xl": "1.875rem",
245
- "4xl": "2.25rem"
119
+ }
120
+ return merged;
121
+ }
122
+
123
+ // src/defaults.ts
124
+ var DEFAULT_FLOATING_LAUNCHER_WIDTH = "min(440px, calc(100vw - 24px))";
125
+ var DEFAULT_FLOATING_LAUNCHER_MAX_WIDTH = "440px";
126
+ var DEFAULT_WIDGET_CONFIG = {
127
+ apiUrl: "http://localhost:43111/api/chat/dispatch",
128
+ // Client token mode defaults (optional, only used when clientToken is set)
129
+ clientToken: void 0,
130
+ theme: void 0,
131
+ darkTheme: void 0,
132
+ colorScheme: "light",
133
+ launcher: {
134
+ enabled: true,
135
+ mountMode: "floating",
136
+ dock: {
137
+ side: "right",
138
+ width: "420px"
246
139
  },
247
- fontWeight: {
248
- normal: "400",
249
- medium: "500",
250
- semibold: "600",
251
- bold: "700"
140
+ title: "Chat Assistant",
141
+ subtitle: "Here to help you get answers fast",
142
+ agentIconText: "\u{1F4AC}",
143
+ agentIconName: "bot",
144
+ headerIconName: "bot",
145
+ position: "bottom-right",
146
+ width: DEFAULT_FLOATING_LAUNCHER_WIDTH,
147
+ heightOffset: 0,
148
+ autoExpand: false,
149
+ callToActionIconHidden: false,
150
+ agentIconSize: "40px",
151
+ headerIconSize: "40px",
152
+ closeButtonSize: "32px",
153
+ callToActionIconName: "arrow-up-right",
154
+ callToActionIconText: "",
155
+ callToActionIconSize: "32px",
156
+ callToActionIconPadding: "5px",
157
+ callToActionIconColor: void 0,
158
+ callToActionIconBackgroundColor: void 0,
159
+ // closeButtonColor / clearChat.iconColor omitted so theme.components.header.actionIconForeground applies.
160
+ closeButtonBackgroundColor: "transparent",
161
+ clearChat: {
162
+ backgroundColor: "transparent",
163
+ borderColor: "transparent",
164
+ enabled: true,
165
+ placement: "inline",
166
+ iconName: "refresh-cw",
167
+ size: "32px",
168
+ showTooltip: true,
169
+ tooltipText: "Clear chat",
170
+ paddingX: "0px",
171
+ paddingY: "0px"
252
172
  },
253
- lineHeight: {
254
- tight: "1.25",
255
- normal: "1.5",
256
- relaxed: "1.625"
257
- }
173
+ headerIconHidden: false,
174
+ border: void 0,
175
+ shadow: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)"
258
176
  },
259
- shadows: {
260
- none: "none",
261
- sm: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
262
- md: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
263
- lg: "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",
264
- xl: "0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)",
265
- "2xl": "0 25px 50px -12px rgb(0 0 0 / 0.25)"
177
+ copy: {
178
+ welcomeTitle: "Hello \u{1F44B}",
179
+ welcomeSubtitle: "Ask anything about your account or products.",
180
+ inputPlaceholder: "How can I help...",
181
+ sendButtonLabel: "Send"
266
182
  },
267
- borders: {
268
- none: "none",
269
- sm: "1px solid",
270
- md: "2px solid",
271
- lg: "4px solid"
183
+ sendButton: {
184
+ borderWidth: "0px",
185
+ paddingX: "12px",
186
+ paddingY: "10px",
187
+ borderColor: void 0,
188
+ useIcon: true,
189
+ iconText: "\u2191",
190
+ size: "40px",
191
+ showTooltip: true,
192
+ tooltipText: "Send message",
193
+ iconName: "send"
272
194
  },
273
- radius: {
274
- none: "0px",
275
- sm: "0.125rem",
276
- md: "0.375rem",
277
- lg: "0.5rem",
278
- xl: "0.75rem",
279
- "2xl": "1rem",
280
- full: "9999px"
281
- }
282
- };
283
- var DEFAULT_SEMANTIC = {
284
- colors: {
285
- primary: "palette.colors.primary.500",
286
- secondary: "palette.colors.secondary.500",
287
- // Links/Focus role — solid primary
288
- accent: "palette.colors.primary.600",
289
- // Surfaces role — soft gray
290
- surface: "palette.colors.gray.50",
291
- background: "palette.colors.gray.50",
292
- container: "palette.colors.gray.50",
293
- text: "palette.colors.gray.900",
294
- textMuted: "palette.colors.gray.500",
295
- textInverse: "palette.colors.gray.50",
296
- // Borders role — soft gray
297
- border: "palette.colors.gray.200",
298
- divider: "palette.colors.gray.200",
299
- interactive: {
300
- // Primary Actions role — solid primary
301
- default: "palette.colors.primary.600",
302
- hover: "palette.colors.primary.700",
303
- // Links/Focus role — solid primary
304
- focus: "palette.colors.primary.600",
305
- active: "palette.colors.primary.600",
306
- disabled: "palette.colors.gray.300"
307
- },
308
- feedback: {
309
- success: "palette.colors.success.500",
310
- warning: "palette.colors.warning.500",
311
- error: "palette.colors.error.500",
312
- info: "palette.colors.info.500"
313
- }
314
- },
315
- spacing: {
316
- xs: "palette.spacing.1",
317
- sm: "palette.spacing.2",
318
- md: "palette.spacing.4",
319
- lg: "palette.spacing.6",
320
- xl: "palette.spacing.8",
321
- "2xl": "palette.spacing.10"
195
+ statusIndicator: {
196
+ visible: true,
197
+ idleText: "Online",
198
+ connectingText: "Connecting\u2026",
199
+ connectedText: "Streaming\u2026",
200
+ errorText: "Offline"
322
201
  },
323
- typography: {
324
- fontFamily: "palette.typography.fontFamily.sans",
325
- fontSize: "palette.typography.fontSize.base",
326
- fontWeight: "palette.typography.fontWeight.normal",
327
- lineHeight: "palette.typography.lineHeight.normal"
328
- }
329
- };
330
- var DEFAULT_COMPONENTS = {
331
- button: {
332
- primary: {
333
- // Primary Actions role — solid primary
334
- background: "palette.colors.primary.500",
335
- foreground: "palette.colors.primary.50",
336
- borderRadius: "palette.radius.lg",
337
- padding: "semantic.spacing.md"
338
- },
339
- secondary: {
340
- background: "semantic.colors.surface",
341
- foreground: "semantic.colors.secondary",
342
- borderRadius: "palette.radius.lg",
343
- padding: "semantic.spacing.md"
344
- },
345
- ghost: {
346
- background: "transparent",
347
- foreground: "semantic.colors.text",
348
- borderRadius: "palette.radius.md",
349
- padding: "semantic.spacing.sm"
350
- }
202
+ voiceRecognition: {
203
+ enabled: true,
204
+ pauseDuration: 2e3,
205
+ iconName: "mic",
206
+ iconSize: "39px",
207
+ borderWidth: "0px",
208
+ paddingX: "9px",
209
+ paddingY: "14px",
210
+ iconColor: void 0,
211
+ backgroundColor: "transparent",
212
+ borderColor: "transparent",
213
+ recordingIconColor: void 0,
214
+ recordingBackgroundColor: void 0,
215
+ recordingBorderColor: "transparent",
216
+ showTooltip: true,
217
+ tooltipText: "Start voice recognition"
351
218
  },
352
- input: {
353
- // Input role — soft gray
354
- background: "palette.colors.gray.50",
355
- placeholder: "palette.colors.gray.400",
356
- borderRadius: "palette.radius.lg",
357
- padding: "semantic.spacing.md",
358
- focus: {
359
- border: "palette.colors.gray.400",
360
- ring: "palette.colors.gray.400"
219
+ features: {
220
+ showReasoning: true,
221
+ showToolCalls: true,
222
+ scrollToBottom: {
223
+ enabled: true,
224
+ iconName: "arrow-down",
225
+ label: ""
361
226
  }
362
227
  },
363
- launcher: {
364
- background: "palette.colors.primary.500",
365
- foreground: "palette.colors.primary.50",
366
- border: "palette.colors.gray.200",
367
- size: "60px",
368
- iconSize: "28px",
369
- borderRadius: "palette.radius.full",
370
- shadow: "palette.shadows.lg"
371
- },
372
- panel: {
373
- width: "min(400px, calc(100vw - 24px))",
374
- maxWidth: "400px",
375
- height: "600px",
376
- maxHeight: "calc(100vh - 80px)",
377
- borderRadius: "palette.radius.xl",
378
- shadow: "palette.shadows.xl"
379
- },
380
- header: {
381
- // Header role — solid primary
382
- background: "palette.colors.primary.500",
383
- border: "palette.colors.primary.600",
384
- borderRadius: "palette.radius.xl palette.radius.xl 0 0",
385
- padding: "semantic.spacing.md",
386
- iconBackground: "palette.colors.primary.600",
387
- iconForeground: "palette.colors.primary.50",
388
- titleForeground: "palette.colors.primary.50",
389
- subtitleForeground: "palette.colors.primary.200",
390
- actionIconForeground: "palette.colors.primary.200"
228
+ suggestionChips: [
229
+ "What can you help me with?",
230
+ "Tell me about your features",
231
+ "How does this work?"
232
+ ],
233
+ suggestionChipsConfig: {
234
+ fontFamily: "sans-serif",
235
+ fontWeight: "500",
236
+ paddingX: "12px",
237
+ paddingY: "6px"
391
238
  },
392
- message: {
393
- user: {
394
- // User Messages role — solid primary
395
- background: "palette.colors.primary.500",
396
- text: "palette.colors.primary.50",
397
- borderRadius: "palette.radius.lg",
398
- shadow: "palette.shadows.sm"
239
+ layout: {
240
+ header: {
241
+ layout: "default",
242
+ showIcon: true,
243
+ showTitle: true,
244
+ showSubtitle: true,
245
+ showCloseButton: true,
246
+ showClearChat: true
399
247
  },
400
- assistant: {
401
- // Assistant Messages role — soft gray
402
- background: "palette.colors.gray.50",
403
- text: "palette.colors.gray.900",
404
- borderRadius: "palette.radius.lg",
405
- border: "palette.colors.gray.200",
406
- shadow: "palette.shadows.sm"
248
+ messages: {
249
+ layout: "bubble",
250
+ avatar: {
251
+ show: false,
252
+ position: "left"
253
+ },
254
+ timestamp: {
255
+ show: false,
256
+ position: "below"
257
+ },
258
+ groupConsecutive: false
407
259
  },
408
- border: "semantic.colors.border"
409
- },
410
- toolBubble: {
411
- shadow: "palette.shadows.sm"
412
- },
413
- reasoningBubble: {
414
- shadow: "palette.shadows.sm"
415
- },
416
- composer: {
417
- shadow: "none"
260
+ slots: {}
418
261
  },
419
262
  markdown: {
420
- inlineCode: {
421
- background: "palette.colors.gray.50",
422
- foreground: "palette.colors.gray.900"
263
+ options: {
264
+ gfm: true,
265
+ breaks: true
423
266
  },
424
- link: {
425
- // Links/Focus role — solid primary
426
- foreground: "palette.colors.primary.600"
267
+ disableDefaultStyles: false
268
+ },
269
+ messageActions: {
270
+ enabled: true,
271
+ showCopy: true,
272
+ showUpvote: false,
273
+ // Requires backend - disabled by default
274
+ showDownvote: false,
275
+ // Requires backend - disabled by default
276
+ visibility: "hover",
277
+ align: "right",
278
+ layout: "pill-inside"
279
+ },
280
+ debug: false
281
+ };
282
+ function mergeThemePartials(base, override) {
283
+ if (!base && !override) return void 0;
284
+ if (!base) return override;
285
+ if (!override) return base;
286
+ return deepMerge(
287
+ base,
288
+ override
289
+ );
290
+ }
291
+ function mergeWithDefaults(config) {
292
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
293
+ if (!config) return DEFAULT_WIDGET_CONFIG;
294
+ return {
295
+ ...DEFAULT_WIDGET_CONFIG,
296
+ ...config,
297
+ theme: mergeThemePartials(DEFAULT_WIDGET_CONFIG.theme, config.theme),
298
+ darkTheme: mergeThemePartials(DEFAULT_WIDGET_CONFIG.darkTheme, config.darkTheme),
299
+ launcher: {
300
+ ...DEFAULT_WIDGET_CONFIG.launcher,
301
+ ...config.launcher,
302
+ dock: {
303
+ ...(_a = DEFAULT_WIDGET_CONFIG.launcher) == null ? void 0 : _a.dock,
304
+ ...(_b = config.launcher) == null ? void 0 : _b.dock
305
+ },
306
+ clearChat: {
307
+ ...(_c = DEFAULT_WIDGET_CONFIG.launcher) == null ? void 0 : _c.clearChat,
308
+ ...(_d = config.launcher) == null ? void 0 : _d.clearChat
309
+ }
427
310
  },
428
- prose: {
429
- fontFamily: "inherit"
311
+ copy: {
312
+ ...DEFAULT_WIDGET_CONFIG.copy,
313
+ ...config.copy
430
314
  },
431
- codeBlock: {
432
- background: "semantic.colors.container",
433
- borderColor: "semantic.colors.border",
434
- textColor: "inherit"
315
+ sendButton: {
316
+ ...DEFAULT_WIDGET_CONFIG.sendButton,
317
+ ...config.sendButton
435
318
  },
436
- table: {
437
- headerBackground: "semantic.colors.container",
438
- borderColor: "semantic.colors.border"
319
+ statusIndicator: {
320
+ ...DEFAULT_WIDGET_CONFIG.statusIndicator,
321
+ ...config.statusIndicator
439
322
  },
440
- hr: {
441
- color: "semantic.colors.divider"
323
+ voiceRecognition: {
324
+ ...DEFAULT_WIDGET_CONFIG.voiceRecognition,
325
+ ...config.voiceRecognition
442
326
  },
443
- blockquote: {
444
- borderColor: "palette.colors.gray.900",
445
- background: "transparent",
446
- textColor: "palette.colors.gray.500"
447
- }
448
- },
449
- collapsibleWidget: {
450
- container: "palette.colors.gray.50",
451
- surface: "semantic.colors.surface",
452
- border: "semantic.colors.border"
453
- },
454
- voice: {
455
- recording: {
456
- indicator: "palette.colors.error.500",
457
- background: "palette.colors.error.50",
458
- border: "palette.colors.error.200"
327
+ features: (() => {
328
+ var _a2, _b2, _c2, _d2;
329
+ const da = (_a2 = DEFAULT_WIDGET_CONFIG.features) == null ? void 0 : _a2.artifacts;
330
+ const ca = (_b2 = config.features) == null ? void 0 : _b2.artifacts;
331
+ const dsb = (_c2 = DEFAULT_WIDGET_CONFIG.features) == null ? void 0 : _c2.scrollToBottom;
332
+ const csb = (_d2 = config.features) == null ? void 0 : _d2.scrollToBottom;
333
+ const mergedArtifacts = da === void 0 && ca === void 0 ? void 0 : {
334
+ ...da,
335
+ ...ca,
336
+ layout: {
337
+ ...da == null ? void 0 : da.layout,
338
+ ...ca == null ? void 0 : ca.layout
339
+ }
340
+ };
341
+ const mergedScrollToBottom = dsb === void 0 && csb === void 0 ? void 0 : {
342
+ ...dsb,
343
+ ...csb
344
+ };
345
+ return {
346
+ ...DEFAULT_WIDGET_CONFIG.features,
347
+ ...config.features,
348
+ ...mergedScrollToBottom !== void 0 ? { scrollToBottom: mergedScrollToBottom } : {},
349
+ ...mergedArtifacts !== void 0 ? { artifacts: mergedArtifacts } : {}
350
+ };
351
+ })(),
352
+ suggestionChips: (_e = config.suggestionChips) != null ? _e : DEFAULT_WIDGET_CONFIG.suggestionChips,
353
+ suggestionChipsConfig: {
354
+ ...DEFAULT_WIDGET_CONFIG.suggestionChipsConfig,
355
+ ...config.suggestionChipsConfig
459
356
  },
460
- processing: {
461
- icon: "palette.colors.primary.500",
462
- background: "palette.colors.primary.50"
357
+ layout: {
358
+ ...DEFAULT_WIDGET_CONFIG.layout,
359
+ ...config.layout,
360
+ header: {
361
+ ...(_f = DEFAULT_WIDGET_CONFIG.layout) == null ? void 0 : _f.header,
362
+ ...(_g = config.layout) == null ? void 0 : _g.header
363
+ },
364
+ messages: {
365
+ ...(_h = DEFAULT_WIDGET_CONFIG.layout) == null ? void 0 : _h.messages,
366
+ ...(_i = config.layout) == null ? void 0 : _i.messages,
367
+ avatar: {
368
+ ...(_k = (_j = DEFAULT_WIDGET_CONFIG.layout) == null ? void 0 : _j.messages) == null ? void 0 : _k.avatar,
369
+ ...(_m = (_l = config.layout) == null ? void 0 : _l.messages) == null ? void 0 : _m.avatar
370
+ },
371
+ timestamp: {
372
+ ...(_o = (_n = DEFAULT_WIDGET_CONFIG.layout) == null ? void 0 : _n.messages) == null ? void 0 : _o.timestamp,
373
+ ...(_q = (_p = config.layout) == null ? void 0 : _p.messages) == null ? void 0 : _q.timestamp
374
+ }
375
+ },
376
+ slots: {
377
+ ...(_r = DEFAULT_WIDGET_CONFIG.layout) == null ? void 0 : _r.slots,
378
+ ...(_s = config.layout) == null ? void 0 : _s.slots
379
+ }
463
380
  },
464
- speaking: {
465
- icon: "palette.colors.success.500"
381
+ markdown: {
382
+ ...DEFAULT_WIDGET_CONFIG.markdown,
383
+ ...config.markdown,
384
+ options: {
385
+ ...(_t = DEFAULT_WIDGET_CONFIG.markdown) == null ? void 0 : _t.options,
386
+ ...(_u = config.markdown) == null ? void 0 : _u.options
387
+ }
388
+ },
389
+ messageActions: {
390
+ ...DEFAULT_WIDGET_CONFIG.messageActions,
391
+ ...config.messageActions
466
392
  }
467
- },
468
- approval: {
469
- requested: {
470
- background: "palette.colors.warning.50",
471
- border: "palette.colors.warning.200",
472
- text: "palette.colors.gray.900"
393
+ };
394
+ }
395
+
396
+ // src/utils/tokens.ts
397
+ var DEFAULT_PALETTE = {
398
+ colors: {
399
+ primary: {
400
+ 50: "#ffffff",
401
+ 100: "#f5f5f5",
402
+ 200: "#d4d4d4",
403
+ 300: "#a3a3a3",
404
+ 400: "#737373",
405
+ 500: "#171717",
406
+ 600: "#0f0f0f",
407
+ 700: "#0a0a0a",
408
+ 800: "#050505",
409
+ 900: "#030303",
410
+ 950: "#000000"
473
411
  },
474
- approve: {
475
- background: "palette.colors.success.500",
476
- foreground: "palette.colors.gray.50",
477
- borderRadius: "palette.radius.md",
478
- padding: "semantic.spacing.sm"
412
+ secondary: {
413
+ 50: "#f5f3ff",
414
+ 100: "#ede9fe",
415
+ 200: "#ddd6fe",
416
+ 300: "#c4b5fd",
417
+ 400: "#a78bfa",
418
+ 500: "#8b5cf6",
419
+ 600: "#7c3aed",
420
+ 700: "#6d28d9",
421
+ 800: "#5b21b6",
422
+ 900: "#4c1d95",
423
+ 950: "#2e1065"
479
424
  },
480
- deny: {
481
- background: "palette.colors.error.500",
482
- foreground: "palette.colors.gray.50",
483
- borderRadius: "palette.radius.md",
484
- padding: "semantic.spacing.sm"
425
+ accent: {
426
+ 50: "#ecfeff",
427
+ 100: "#cffafe",
428
+ 200: "#a5f3fc",
429
+ 300: "#67e8f9",
430
+ 400: "#22d3ee",
431
+ 500: "#06b6d4",
432
+ 600: "#0891b2",
433
+ 700: "#0e7490",
434
+ 800: "#155e75",
435
+ 900: "#164e63",
436
+ 950: "#083344"
437
+ },
438
+ gray: {
439
+ 50: "#f9fafb",
440
+ 100: "#f3f4f6",
441
+ 200: "#e5e7eb",
442
+ 300: "#d1d5db",
443
+ 400: "#9ca3af",
444
+ 500: "#6b7280",
445
+ 600: "#4b5563",
446
+ 700: "#374151",
447
+ 800: "#1f2937",
448
+ 900: "#111827",
449
+ 950: "#030712"
450
+ },
451
+ success: {
452
+ 50: "#f0fdf4",
453
+ 100: "#dcfce7",
454
+ 200: "#bbf7d0",
455
+ 300: "#86efac",
456
+ 400: "#4ade80",
457
+ 500: "#22c55e",
458
+ 600: "#16a34a",
459
+ 700: "#15803d",
460
+ 800: "#166534",
461
+ 900: "#14532d"
462
+ },
463
+ warning: {
464
+ 50: "#fefce8",
465
+ 100: "#fef9c3",
466
+ 200: "#fef08a",
467
+ 300: "#fde047",
468
+ 400: "#facc15",
469
+ 500: "#eab308",
470
+ 600: "#ca8a04",
471
+ 700: "#a16207",
472
+ 800: "#854d0e",
473
+ 900: "#713f12"
474
+ },
475
+ error: {
476
+ 50: "#fef2f2",
477
+ 100: "#fee2e2",
478
+ 200: "#fecaca",
479
+ 300: "#fca5a5",
480
+ 400: "#f87171",
481
+ 500: "#ef4444",
482
+ 600: "#dc2626",
483
+ 700: "#b91c1c",
484
+ 800: "#991b1b",
485
+ 900: "#7f1d1d"
486
+ },
487
+ info: {
488
+ 50: "#eff6ff",
489
+ 100: "#dbeafe",
490
+ 200: "#bfdbfe",
491
+ 300: "#93c5fd",
492
+ 400: "#60a5fa",
493
+ 500: "#3b82f6",
494
+ 600: "#2563eb",
495
+ 700: "#1d4ed8",
496
+ 800: "#1e40af",
497
+ 900: "#1e3a8a",
498
+ 950: "#172554"
485
499
  }
486
500
  },
487
- attachment: {
488
- image: {
489
- background: "palette.colors.gray.100",
490
- border: "palette.colors.gray.200"
501
+ spacing: {
502
+ 0: "0px",
503
+ 1: "0.25rem",
504
+ 2: "0.5rem",
505
+ 3: "0.75rem",
506
+ 4: "1rem",
507
+ 5: "1.25rem",
508
+ 6: "1.5rem",
509
+ 8: "2rem",
510
+ 10: "2.5rem",
511
+ 12: "3rem",
512
+ 16: "4rem",
513
+ 20: "5rem",
514
+ 24: "6rem",
515
+ 32: "8rem",
516
+ 40: "10rem",
517
+ 48: "12rem",
518
+ 56: "14rem",
519
+ 64: "16rem"
520
+ },
521
+ typography: {
522
+ fontFamily: {
523
+ sans: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
524
+ serif: 'Georgia, Cambria, "Times New Roman", Times, serif',
525
+ mono: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"
526
+ },
527
+ fontSize: {
528
+ xs: "0.75rem",
529
+ sm: "0.875rem",
530
+ base: "1rem",
531
+ lg: "1.125rem",
532
+ xl: "1.25rem",
533
+ "2xl": "1.5rem",
534
+ "3xl": "1.875rem",
535
+ "4xl": "2.25rem"
536
+ },
537
+ fontWeight: {
538
+ normal: "400",
539
+ medium: "500",
540
+ semibold: "600",
541
+ bold: "700"
542
+ },
543
+ lineHeight: {
544
+ tight: "1.25",
545
+ normal: "1.5",
546
+ relaxed: "1.625"
491
547
  }
492
548
  },
493
- scrollToBottom: {
494
- background: "components.button.primary.background",
495
- foreground: "components.button.primary.foreground",
549
+ shadows: {
550
+ none: "none",
551
+ sm: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
552
+ md: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
553
+ lg: "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",
554
+ xl: "0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)",
555
+ "2xl": "0 25px 50px -12px rgb(0 0 0 / 0.25)"
556
+ },
557
+ borders: {
558
+ none: "none",
559
+ sm: "1px solid",
560
+ md: "2px solid",
561
+ lg: "4px solid"
562
+ },
563
+ radius: {
564
+ none: "0px",
565
+ sm: "0.125rem",
566
+ md: "0.375rem",
567
+ lg: "0.5rem",
568
+ xl: "0.75rem",
569
+ "2xl": "1rem",
570
+ full: "9999px"
571
+ }
572
+ };
573
+ var DEFAULT_SEMANTIC = {
574
+ colors: {
575
+ primary: "palette.colors.primary.500",
576
+ secondary: "palette.colors.secondary.500",
577
+ // Links/Focus role — solid primary
578
+ accent: "palette.colors.primary.600",
579
+ // Surfaces role — soft gray
580
+ surface: "palette.colors.gray.50",
581
+ background: "palette.colors.gray.50",
582
+ container: "palette.colors.gray.50",
583
+ text: "palette.colors.gray.900",
584
+ textMuted: "palette.colors.gray.500",
585
+ textInverse: "palette.colors.gray.50",
586
+ // Borders role — soft gray
587
+ border: "palette.colors.gray.200",
588
+ divider: "palette.colors.gray.200",
589
+ interactive: {
590
+ // Primary Actions role — solid primary
591
+ default: "palette.colors.primary.600",
592
+ hover: "palette.colors.primary.700",
593
+ // Links/Focus role — solid primary
594
+ focus: "palette.colors.primary.600",
595
+ active: "palette.colors.primary.600",
596
+ disabled: "palette.colors.gray.300"
597
+ },
598
+ feedback: {
599
+ success: "palette.colors.success.500",
600
+ warning: "palette.colors.warning.500",
601
+ error: "palette.colors.error.500",
602
+ info: "palette.colors.info.500"
603
+ }
604
+ },
605
+ spacing: {
606
+ xs: "palette.spacing.1",
607
+ sm: "palette.spacing.2",
608
+ md: "palette.spacing.4",
609
+ lg: "palette.spacing.6",
610
+ xl: "palette.spacing.8",
611
+ "2xl": "palette.spacing.10"
612
+ },
613
+ typography: {
614
+ fontFamily: "palette.typography.fontFamily.sans",
615
+ fontSize: "palette.typography.fontSize.base",
616
+ fontWeight: "palette.typography.fontWeight.normal",
617
+ lineHeight: "palette.typography.lineHeight.normal"
618
+ }
619
+ };
620
+ var DEFAULT_COMPONENTS = {
621
+ button: {
622
+ primary: {
623
+ // Primary Actions role — solid primary
624
+ background: "palette.colors.primary.500",
625
+ foreground: "palette.colors.primary.50",
626
+ borderRadius: "palette.radius.lg",
627
+ padding: "semantic.spacing.md"
628
+ },
629
+ secondary: {
630
+ background: "semantic.colors.surface",
631
+ foreground: "semantic.colors.secondary",
632
+ borderRadius: "palette.radius.lg",
633
+ padding: "semantic.spacing.md"
634
+ },
635
+ ghost: {
636
+ background: "transparent",
637
+ foreground: "semantic.colors.text",
638
+ borderRadius: "palette.radius.md",
639
+ padding: "semantic.spacing.sm"
640
+ }
641
+ },
642
+ input: {
643
+ // Input role — soft gray
644
+ background: "palette.colors.gray.50",
645
+ placeholder: "palette.colors.gray.400",
646
+ borderRadius: "palette.radius.lg",
647
+ padding: "semantic.spacing.md",
648
+ focus: {
649
+ border: "palette.colors.gray.400",
650
+ ring: "palette.colors.gray.400"
651
+ }
652
+ },
653
+ launcher: {
654
+ background: "palette.colors.primary.500",
655
+ foreground: "palette.colors.primary.50",
656
+ border: "palette.colors.gray.200",
657
+ size: "60px",
658
+ iconSize: "28px",
659
+ borderRadius: "palette.radius.full",
660
+ shadow: "palette.shadows.lg"
661
+ },
662
+ panel: {
663
+ width: DEFAULT_FLOATING_LAUNCHER_WIDTH,
664
+ maxWidth: DEFAULT_FLOATING_LAUNCHER_MAX_WIDTH,
665
+ height: "600px",
666
+ maxHeight: "calc(100vh - 80px)",
667
+ borderRadius: "palette.radius.xl",
668
+ shadow: "palette.shadows.xl"
669
+ },
670
+ header: {
671
+ // Header role — solid primary
672
+ background: "palette.colors.primary.500",
673
+ border: "palette.colors.primary.600",
674
+ borderRadius: "palette.radius.xl palette.radius.xl 0 0",
675
+ padding: "semantic.spacing.md",
676
+ iconBackground: "palette.colors.primary.600",
677
+ iconForeground: "palette.colors.primary.50",
678
+ titleForeground: "palette.colors.primary.50",
679
+ subtitleForeground: "palette.colors.primary.200",
680
+ actionIconForeground: "palette.colors.primary.200"
681
+ },
682
+ message: {
683
+ user: {
684
+ // User Messages role — solid primary
685
+ background: "palette.colors.primary.500",
686
+ text: "palette.colors.primary.50",
687
+ borderRadius: "palette.radius.lg",
688
+ shadow: "palette.shadows.sm"
689
+ },
690
+ assistant: {
691
+ // Assistant Messages role — soft gray
692
+ background: "palette.colors.gray.50",
693
+ text: "palette.colors.gray.900",
694
+ borderRadius: "palette.radius.lg",
695
+ border: "palette.colors.gray.200",
696
+ shadow: "palette.shadows.sm"
697
+ },
698
+ border: "semantic.colors.border"
699
+ },
700
+ toolBubble: {
701
+ shadow: "palette.shadows.sm"
702
+ },
703
+ reasoningBubble: {
704
+ shadow: "palette.shadows.sm"
705
+ },
706
+ composer: {
707
+ shadow: "none"
708
+ },
709
+ markdown: {
710
+ inlineCode: {
711
+ background: "palette.colors.gray.50",
712
+ foreground: "palette.colors.gray.900"
713
+ },
714
+ link: {
715
+ // Links/Focus role — solid primary
716
+ foreground: "palette.colors.primary.600"
717
+ },
718
+ prose: {
719
+ fontFamily: "inherit"
720
+ },
721
+ codeBlock: {
722
+ background: "semantic.colors.container",
723
+ borderColor: "semantic.colors.border",
724
+ textColor: "inherit"
725
+ },
726
+ table: {
727
+ headerBackground: "semantic.colors.container",
728
+ borderColor: "semantic.colors.border"
729
+ },
730
+ hr: {
731
+ color: "semantic.colors.divider"
732
+ },
733
+ blockquote: {
734
+ borderColor: "palette.colors.gray.900",
735
+ background: "transparent",
736
+ textColor: "palette.colors.gray.500"
737
+ }
738
+ },
739
+ collapsibleWidget: {
740
+ container: "palette.colors.gray.50",
741
+ surface: "semantic.colors.surface",
742
+ border: "semantic.colors.border"
743
+ },
744
+ voice: {
745
+ recording: {
746
+ indicator: "palette.colors.error.500",
747
+ background: "palette.colors.error.50",
748
+ border: "palette.colors.error.200"
749
+ },
750
+ processing: {
751
+ icon: "palette.colors.primary.500",
752
+ background: "palette.colors.primary.50"
753
+ },
754
+ speaking: {
755
+ icon: "palette.colors.success.500"
756
+ }
757
+ },
758
+ approval: {
759
+ requested: {
760
+ background: "palette.colors.warning.50",
761
+ border: "palette.colors.warning.200",
762
+ text: "palette.colors.gray.900"
763
+ },
764
+ approve: {
765
+ background: "palette.colors.success.500",
766
+ foreground: "palette.colors.gray.50",
767
+ borderRadius: "palette.radius.md",
768
+ padding: "semantic.spacing.sm"
769
+ },
770
+ deny: {
771
+ background: "palette.colors.error.500",
772
+ foreground: "palette.colors.gray.50",
773
+ borderRadius: "palette.radius.md",
774
+ padding: "semantic.spacing.sm"
775
+ }
776
+ },
777
+ attachment: {
778
+ image: {
779
+ background: "palette.colors.gray.100",
780
+ border: "palette.colors.gray.200"
781
+ }
782
+ },
783
+ scrollToBottom: {
784
+ background: "components.button.primary.background",
785
+ foreground: "components.button.primary.foreground",
496
786
  border: "semantic.colors.primary",
497
787
  size: "40px",
498
788
  borderRadius: "palette.radius.full",
@@ -886,23 +1176,6 @@ function themeToCssVariables(theme) {
886
1176
  return cssVars;
887
1177
  }
888
1178
 
889
- // src/utils/deep-merge.ts
890
- var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
891
- function deepMerge(base, override) {
892
- if (!base) return override;
893
- if (!override) return base;
894
- const merged = { ...base };
895
- for (const [key, value] of Object.entries(override)) {
896
- const existing = merged[key];
897
- if (isObject(existing) && isObject(value)) {
898
- merged[key] = deepMerge(existing, value);
899
- } else {
900
- merged[key] = value;
901
- }
902
- }
903
- return merged;
904
- }
905
-
906
1179
  // src/utils/theme.ts
907
1180
  var DARK_PALETTE = {
908
1181
  colors: {
@@ -932,444 +1205,173 @@ var DARK_PALETTE = {
932
1205
  900: "#4c1d95",
933
1206
  950: "#2e1065"
934
1207
  },
935
- accent: {
936
- 50: "#ecfeff",
937
- 100: "#cffafe",
938
- 200: "#a5f3fc",
939
- 300: "#67e8f9",
940
- 400: "#22d3ee",
941
- 500: "#06b6d4",
942
- 600: "#0891b2",
943
- 700: "#0e7490",
944
- 800: "#155e75",
945
- 900: "#164e63",
946
- 950: "#083344"
947
- },
948
- gray: {
949
- 50: "#f9fafb",
950
- 100: "#f3f4f6",
951
- 200: "#e5e7eb",
952
- 300: "#d1d5db",
953
- 400: "#9ca3af",
954
- 500: "#6b7280",
955
- 600: "#4b5563",
956
- 700: "#374151",
957
- 800: "#1f2937",
958
- 900: "#111827",
959
- 950: "#030712"
960
- },
961
- success: {
962
- 50: "#f0fdf4",
963
- 100: "#dcfce7",
964
- 200: "#bbf7d0",
965
- 300: "#86efac",
966
- 400: "#4ade80",
967
- 500: "#22c55e",
968
- 600: "#16a34a",
969
- 700: "#15803d",
970
- 800: "#166534",
971
- 900: "#14532d"
972
- },
973
- warning: {
974
- 50: "#fefce8",
975
- 100: "#fef9c3",
976
- 200: "#fef08a",
977
- 300: "#fde047",
978
- 400: "#facc15",
979
- 500: "#eab308",
980
- 600: "#ca8a04",
981
- 700: "#a16207",
982
- 800: "#854d0e",
983
- 900: "#713f12"
984
- },
985
- error: {
986
- 50: "#fef2f2",
987
- 100: "#fee2e2",
988
- 200: "#fecaca",
989
- 300: "#fca5a5",
990
- 400: "#f87171",
991
- 500: "#ef4444",
992
- 600: "#dc2626",
993
- 700: "#b91c1c",
994
- 800: "#991b1b",
995
- 900: "#7f1d1d"
996
- }
997
- }
998
- };
999
- var normalizeThemeConfig = (theme) => {
1000
- if (!theme || typeof theme !== "object" || Array.isArray(theme)) return void 0;
1001
- return theme;
1002
- };
1003
- var detectColorScheme = () => {
1004
- var _a;
1005
- if (typeof document !== "undefined" && document.documentElement.classList.contains("dark")) {
1006
- return "dark";
1007
- }
1008
- if (typeof window !== "undefined" && ((_a = window.matchMedia) == null ? void 0 : _a.call(window, "(prefers-color-scheme: dark)").matches)) {
1009
- return "dark";
1010
- }
1011
- return "light";
1012
- };
1013
- var getColorSchemeFromConfig = (config) => {
1014
- var _a;
1015
- const colorScheme = (_a = config == null ? void 0 : config.colorScheme) != null ? _a : "light";
1016
- if (colorScheme === "light") return "light";
1017
- if (colorScheme === "dark") return "dark";
1018
- return detectColorScheme();
1019
- };
1020
- var getColorScheme = (config) => {
1021
- return getColorSchemeFromConfig(config);
1022
- };
1023
- var createLightTheme = (userConfig) => {
1024
- return createTheme(userConfig);
1025
- };
1026
- var createDarkTheme = (userConfig) => {
1027
- var _a;
1028
- const baseTheme = createTheme(void 0, { validate: false });
1029
- return createTheme(
1030
- {
1031
- ...userConfig,
1032
- palette: {
1033
- ...baseTheme.palette,
1034
- colors: {
1035
- ...DARK_PALETTE.colors,
1036
- ...(_a = userConfig == null ? void 0 : userConfig.palette) == null ? void 0 : _a.colors
1037
- }
1038
- }
1039
- },
1040
- { validate: false }
1041
- );
1042
- };
1043
- var getActiveTheme = (config) => {
1044
- const scheme = getColorScheme(config);
1045
- const lightThemeConfig = normalizeThemeConfig(config == null ? void 0 : config.theme);
1046
- const darkThemeConfig = normalizeThemeConfig(config == null ? void 0 : config.darkTheme);
1047
- if (scheme === "dark") {
1048
- return createDarkTheme(
1049
- deepMerge(
1050
- lightThemeConfig != null ? lightThemeConfig : {},
1051
- darkThemeConfig != null ? darkThemeConfig : {}
1052
- )
1053
- );
1054
- }
1055
- return createLightTheme(lightThemeConfig);
1056
- };
1057
- var getCssVariables = (theme) => {
1058
- return themeToCssVariables(theme);
1059
- };
1060
- var applyThemeVariables = (element, config) => {
1061
- var _a;
1062
- const theme = getActiveTheme(config);
1063
- const cssVars = getCssVariables(theme);
1064
- for (const [name, value] of Object.entries(cssVars)) {
1065
- element.style.setProperty(name, value);
1066
- }
1067
- const toolCallShadow = (_a = config == null ? void 0 : config.toolCall) == null ? void 0 : _a.shadow;
1068
- if (toolCallShadow !== void 0) {
1069
- element.style.setProperty(
1070
- "--persona-tool-bubble-shadow",
1071
- toolCallShadow.trim() === "" ? "none" : toolCallShadow
1072
- );
1073
- }
1074
- };
1075
- var createThemeObserver = (callback) => {
1076
- const cleanupFns = [];
1077
- if (typeof document !== "undefined" && typeof MutationObserver !== "undefined") {
1078
- const observer = new MutationObserver(() => {
1079
- callback(detectColorScheme());
1080
- });
1081
- observer.observe(document.documentElement, {
1082
- attributes: true,
1083
- attributeFilter: ["class"]
1084
- });
1085
- cleanupFns.push(() => observer.disconnect());
1086
- }
1087
- if (typeof window !== "undefined" && window.matchMedia) {
1088
- const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
1089
- const handleChange = () => callback(detectColorScheme());
1090
- if (mediaQuery.addEventListener) {
1091
- mediaQuery.addEventListener("change", handleChange);
1092
- cleanupFns.push(() => mediaQuery.removeEventListener("change", handleChange));
1093
- } else if (mediaQuery.addListener) {
1094
- mediaQuery.addListener(handleChange);
1095
- cleanupFns.push(() => mediaQuery.removeListener(handleChange));
1096
- }
1097
- }
1098
- return () => {
1099
- cleanupFns.forEach((fn) => fn());
1100
- };
1101
- };
1102
-
1103
- // src/defaults.ts
1104
- var DEFAULT_WIDGET_CONFIG = {
1105
- apiUrl: "http://localhost:43111/api/chat/dispatch",
1106
- // Client token mode defaults (optional, only used when clientToken is set)
1107
- clientToken: void 0,
1108
- theme: void 0,
1109
- darkTheme: void 0,
1110
- colorScheme: "light",
1111
- launcher: {
1112
- enabled: true,
1113
- mountMode: "floating",
1114
- dock: {
1115
- side: "right",
1116
- width: "420px"
1117
- },
1118
- title: "Chat Assistant",
1119
- subtitle: "Here to help you get answers fast",
1120
- agentIconText: "\u{1F4AC}",
1121
- agentIconName: "bot",
1122
- headerIconName: "bot",
1123
- position: "bottom-right",
1124
- width: "min(400px, calc(100vw - 24px))",
1125
- heightOffset: 0,
1126
- autoExpand: false,
1127
- callToActionIconHidden: false,
1128
- agentIconSize: "40px",
1129
- headerIconSize: "40px",
1130
- closeButtonSize: "32px",
1131
- callToActionIconName: "arrow-up-right",
1132
- callToActionIconText: "",
1133
- callToActionIconSize: "32px",
1134
- callToActionIconPadding: "5px",
1135
- callToActionIconColor: void 0,
1136
- callToActionIconBackgroundColor: void 0,
1137
- // closeButtonColor / clearChat.iconColor omitted so theme.components.header.actionIconForeground applies.
1138
- closeButtonBackgroundColor: "transparent",
1139
- clearChat: {
1140
- backgroundColor: "transparent",
1141
- borderColor: "transparent",
1142
- enabled: true,
1143
- placement: "inline",
1144
- iconName: "refresh-cw",
1145
- size: "32px",
1146
- showTooltip: true,
1147
- tooltipText: "Clear chat",
1148
- paddingX: "0px",
1149
- paddingY: "0px"
1150
- },
1151
- headerIconHidden: false,
1152
- border: void 0,
1153
- shadow: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)"
1154
- },
1155
- copy: {
1156
- welcomeTitle: "Hello \u{1F44B}",
1157
- welcomeSubtitle: "Ask anything about your account or products.",
1158
- inputPlaceholder: "How can I help...",
1159
- sendButtonLabel: "Send"
1160
- },
1161
- sendButton: {
1162
- borderWidth: "0px",
1163
- paddingX: "12px",
1164
- paddingY: "10px",
1165
- borderColor: void 0,
1166
- useIcon: true,
1167
- iconText: "\u2191",
1168
- size: "40px",
1169
- showTooltip: true,
1170
- tooltipText: "Send message",
1171
- iconName: "send"
1172
- },
1173
- statusIndicator: {
1174
- visible: true,
1175
- idleText: "Online",
1176
- connectingText: "Connecting\u2026",
1177
- connectedText: "Streaming\u2026",
1178
- errorText: "Offline"
1179
- },
1180
- voiceRecognition: {
1181
- enabled: true,
1182
- pauseDuration: 2e3,
1183
- iconName: "mic",
1184
- iconSize: "39px",
1185
- borderWidth: "0px",
1186
- paddingX: "9px",
1187
- paddingY: "14px",
1188
- iconColor: void 0,
1189
- backgroundColor: "transparent",
1190
- borderColor: "transparent",
1191
- recordingIconColor: void 0,
1192
- recordingBackgroundColor: void 0,
1193
- recordingBorderColor: "transparent",
1194
- showTooltip: true,
1195
- tooltipText: "Start voice recognition"
1196
- },
1197
- features: {
1198
- showReasoning: true,
1199
- showToolCalls: true,
1200
- scrollToBottom: {
1201
- enabled: true,
1202
- iconName: "arrow-down",
1203
- label: ""
1204
- }
1205
- },
1206
- suggestionChips: [
1207
- "What can you help me with?",
1208
- "Tell me about your features",
1209
- "How does this work?"
1210
- ],
1211
- suggestionChipsConfig: {
1212
- fontFamily: "sans-serif",
1213
- fontWeight: "500",
1214
- paddingX: "12px",
1215
- paddingY: "6px"
1216
- },
1217
- layout: {
1218
- header: {
1219
- layout: "default",
1220
- showIcon: true,
1221
- showTitle: true,
1222
- showSubtitle: true,
1223
- showCloseButton: true,
1224
- showClearChat: true
1225
- },
1226
- messages: {
1227
- layout: "bubble",
1228
- avatar: {
1229
- show: false,
1230
- position: "left"
1231
- },
1232
- timestamp: {
1233
- show: false,
1234
- position: "below"
1235
- },
1236
- groupConsecutive: false
1237
- },
1238
- slots: {}
1239
- },
1240
- markdown: {
1241
- options: {
1242
- gfm: true,
1243
- breaks: true
1244
- },
1245
- disableDefaultStyles: false
1246
- },
1247
- messageActions: {
1248
- enabled: true,
1249
- showCopy: true,
1250
- showUpvote: false,
1251
- // Requires backend - disabled by default
1252
- showDownvote: false,
1253
- // Requires backend - disabled by default
1254
- visibility: "hover",
1255
- align: "right",
1256
- layout: "pill-inside"
1257
- },
1258
- debug: false
1259
- };
1260
- function mergeThemePartials(base, override) {
1261
- if (!base && !override) return void 0;
1262
- if (!base) return override;
1263
- if (!override) return base;
1264
- return deepMerge(
1265
- base,
1266
- override
1267
- );
1268
- }
1269
- function mergeWithDefaults(config) {
1270
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
1271
- if (!config) return DEFAULT_WIDGET_CONFIG;
1272
- return {
1273
- ...DEFAULT_WIDGET_CONFIG,
1274
- ...config,
1275
- theme: mergeThemePartials(DEFAULT_WIDGET_CONFIG.theme, config.theme),
1276
- darkTheme: mergeThemePartials(DEFAULT_WIDGET_CONFIG.darkTheme, config.darkTheme),
1277
- launcher: {
1278
- ...DEFAULT_WIDGET_CONFIG.launcher,
1279
- ...config.launcher,
1280
- dock: {
1281
- ...(_a = DEFAULT_WIDGET_CONFIG.launcher) == null ? void 0 : _a.dock,
1282
- ...(_b = config.launcher) == null ? void 0 : _b.dock
1283
- },
1284
- clearChat: {
1285
- ...(_c = DEFAULT_WIDGET_CONFIG.launcher) == null ? void 0 : _c.clearChat,
1286
- ...(_d = config.launcher) == null ? void 0 : _d.clearChat
1287
- }
1288
- },
1289
- copy: {
1290
- ...DEFAULT_WIDGET_CONFIG.copy,
1291
- ...config.copy
1292
- },
1293
- sendButton: {
1294
- ...DEFAULT_WIDGET_CONFIG.sendButton,
1295
- ...config.sendButton
1208
+ accent: {
1209
+ 50: "#ecfeff",
1210
+ 100: "#cffafe",
1211
+ 200: "#a5f3fc",
1212
+ 300: "#67e8f9",
1213
+ 400: "#22d3ee",
1214
+ 500: "#06b6d4",
1215
+ 600: "#0891b2",
1216
+ 700: "#0e7490",
1217
+ 800: "#155e75",
1218
+ 900: "#164e63",
1219
+ 950: "#083344"
1296
1220
  },
1297
- statusIndicator: {
1298
- ...DEFAULT_WIDGET_CONFIG.statusIndicator,
1299
- ...config.statusIndicator
1221
+ gray: {
1222
+ 50: "#f9fafb",
1223
+ 100: "#f3f4f6",
1224
+ 200: "#e5e7eb",
1225
+ 300: "#d1d5db",
1226
+ 400: "#9ca3af",
1227
+ 500: "#6b7280",
1228
+ 600: "#4b5563",
1229
+ 700: "#374151",
1230
+ 800: "#1f2937",
1231
+ 900: "#111827",
1232
+ 950: "#030712"
1300
1233
  },
1301
- voiceRecognition: {
1302
- ...DEFAULT_WIDGET_CONFIG.voiceRecognition,
1303
- ...config.voiceRecognition
1234
+ success: {
1235
+ 50: "#f0fdf4",
1236
+ 100: "#dcfce7",
1237
+ 200: "#bbf7d0",
1238
+ 300: "#86efac",
1239
+ 400: "#4ade80",
1240
+ 500: "#22c55e",
1241
+ 600: "#16a34a",
1242
+ 700: "#15803d",
1243
+ 800: "#166534",
1244
+ 900: "#14532d"
1304
1245
  },
1305
- features: (() => {
1306
- var _a2, _b2, _c2, _d2;
1307
- const da = (_a2 = DEFAULT_WIDGET_CONFIG.features) == null ? void 0 : _a2.artifacts;
1308
- const ca = (_b2 = config.features) == null ? void 0 : _b2.artifacts;
1309
- const dsb = (_c2 = DEFAULT_WIDGET_CONFIG.features) == null ? void 0 : _c2.scrollToBottom;
1310
- const csb = (_d2 = config.features) == null ? void 0 : _d2.scrollToBottom;
1311
- const mergedArtifacts = da === void 0 && ca === void 0 ? void 0 : {
1312
- ...da,
1313
- ...ca,
1314
- layout: {
1315
- ...da == null ? void 0 : da.layout,
1316
- ...ca == null ? void 0 : ca.layout
1317
- }
1318
- };
1319
- const mergedScrollToBottom = dsb === void 0 && csb === void 0 ? void 0 : {
1320
- ...dsb,
1321
- ...csb
1322
- };
1323
- return {
1324
- ...DEFAULT_WIDGET_CONFIG.features,
1325
- ...config.features,
1326
- ...mergedScrollToBottom !== void 0 ? { scrollToBottom: mergedScrollToBottom } : {},
1327
- ...mergedArtifacts !== void 0 ? { artifacts: mergedArtifacts } : {}
1328
- };
1329
- })(),
1330
- suggestionChips: (_e = config.suggestionChips) != null ? _e : DEFAULT_WIDGET_CONFIG.suggestionChips,
1331
- suggestionChipsConfig: {
1332
- ...DEFAULT_WIDGET_CONFIG.suggestionChipsConfig,
1333
- ...config.suggestionChipsConfig
1246
+ warning: {
1247
+ 50: "#fefce8",
1248
+ 100: "#fef9c3",
1249
+ 200: "#fef08a",
1250
+ 300: "#fde047",
1251
+ 400: "#facc15",
1252
+ 500: "#eab308",
1253
+ 600: "#ca8a04",
1254
+ 700: "#a16207",
1255
+ 800: "#854d0e",
1256
+ 900: "#713f12"
1334
1257
  },
1335
- layout: {
1336
- ...DEFAULT_WIDGET_CONFIG.layout,
1337
- ...config.layout,
1338
- header: {
1339
- ...(_f = DEFAULT_WIDGET_CONFIG.layout) == null ? void 0 : _f.header,
1340
- ...(_g = config.layout) == null ? void 0 : _g.header
1341
- },
1342
- messages: {
1343
- ...(_h = DEFAULT_WIDGET_CONFIG.layout) == null ? void 0 : _h.messages,
1344
- ...(_i = config.layout) == null ? void 0 : _i.messages,
1345
- avatar: {
1346
- ...(_k = (_j = DEFAULT_WIDGET_CONFIG.layout) == null ? void 0 : _j.messages) == null ? void 0 : _k.avatar,
1347
- ...(_m = (_l = config.layout) == null ? void 0 : _l.messages) == null ? void 0 : _m.avatar
1348
- },
1349
- timestamp: {
1350
- ...(_o = (_n = DEFAULT_WIDGET_CONFIG.layout) == null ? void 0 : _n.messages) == null ? void 0 : _o.timestamp,
1351
- ...(_q = (_p = config.layout) == null ? void 0 : _p.messages) == null ? void 0 : _q.timestamp
1258
+ error: {
1259
+ 50: "#fef2f2",
1260
+ 100: "#fee2e2",
1261
+ 200: "#fecaca",
1262
+ 300: "#fca5a5",
1263
+ 400: "#f87171",
1264
+ 500: "#ef4444",
1265
+ 600: "#dc2626",
1266
+ 700: "#b91c1c",
1267
+ 800: "#991b1b",
1268
+ 900: "#7f1d1d"
1269
+ }
1270
+ }
1271
+ };
1272
+ var normalizeThemeConfig = (theme) => {
1273
+ if (!theme || typeof theme !== "object" || Array.isArray(theme)) return void 0;
1274
+ return theme;
1275
+ };
1276
+ var detectColorScheme = () => {
1277
+ var _a;
1278
+ if (typeof document !== "undefined" && document.documentElement.classList.contains("dark")) {
1279
+ return "dark";
1280
+ }
1281
+ if (typeof window !== "undefined" && ((_a = window.matchMedia) == null ? void 0 : _a.call(window, "(prefers-color-scheme: dark)").matches)) {
1282
+ return "dark";
1283
+ }
1284
+ return "light";
1285
+ };
1286
+ var getColorSchemeFromConfig = (config) => {
1287
+ var _a;
1288
+ const colorScheme = (_a = config == null ? void 0 : config.colorScheme) != null ? _a : "light";
1289
+ if (colorScheme === "light") return "light";
1290
+ if (colorScheme === "dark") return "dark";
1291
+ return detectColorScheme();
1292
+ };
1293
+ var getColorScheme = (config) => {
1294
+ return getColorSchemeFromConfig(config);
1295
+ };
1296
+ var createLightTheme = (userConfig) => {
1297
+ return createTheme(userConfig);
1298
+ };
1299
+ var createDarkTheme = (userConfig) => {
1300
+ var _a;
1301
+ const baseTheme = createTheme(void 0, { validate: false });
1302
+ return createTheme(
1303
+ {
1304
+ ...userConfig,
1305
+ palette: {
1306
+ ...baseTheme.palette,
1307
+ colors: {
1308
+ ...DARK_PALETTE.colors,
1309
+ ...(_a = userConfig == null ? void 0 : userConfig.palette) == null ? void 0 : _a.colors
1352
1310
  }
1353
- },
1354
- slots: {
1355
- ...(_r = DEFAULT_WIDGET_CONFIG.layout) == null ? void 0 : _r.slots,
1356
- ...(_s = config.layout) == null ? void 0 : _s.slots
1357
- }
1358
- },
1359
- markdown: {
1360
- ...DEFAULT_WIDGET_CONFIG.markdown,
1361
- ...config.markdown,
1362
- options: {
1363
- ...(_t = DEFAULT_WIDGET_CONFIG.markdown) == null ? void 0 : _t.options,
1364
- ...(_u = config.markdown) == null ? void 0 : _u.options
1365
1311
  }
1366
1312
  },
1367
- messageActions: {
1368
- ...DEFAULT_WIDGET_CONFIG.messageActions,
1369
- ...config.messageActions
1313
+ { validate: false }
1314
+ );
1315
+ };
1316
+ var getActiveTheme = (config) => {
1317
+ const scheme = getColorScheme(config);
1318
+ const lightThemeConfig = normalizeThemeConfig(config == null ? void 0 : config.theme);
1319
+ const darkThemeConfig = normalizeThemeConfig(config == null ? void 0 : config.darkTheme);
1320
+ if (scheme === "dark") {
1321
+ return createDarkTheme(
1322
+ deepMerge(
1323
+ lightThemeConfig != null ? lightThemeConfig : {},
1324
+ darkThemeConfig != null ? darkThemeConfig : {}
1325
+ )
1326
+ );
1327
+ }
1328
+ return createLightTheme(lightThemeConfig);
1329
+ };
1330
+ var getCssVariables = (theme) => {
1331
+ return themeToCssVariables(theme);
1332
+ };
1333
+ var applyThemeVariables = (element, config) => {
1334
+ var _a;
1335
+ const theme = getActiveTheme(config);
1336
+ const cssVars = getCssVariables(theme);
1337
+ for (const [name, value] of Object.entries(cssVars)) {
1338
+ element.style.setProperty(name, value);
1339
+ }
1340
+ const toolCallShadow = (_a = config == null ? void 0 : config.toolCall) == null ? void 0 : _a.shadow;
1341
+ if (toolCallShadow !== void 0) {
1342
+ element.style.setProperty(
1343
+ "--persona-tool-bubble-shadow",
1344
+ toolCallShadow.trim() === "" ? "none" : toolCallShadow
1345
+ );
1346
+ }
1347
+ };
1348
+ var createThemeObserver = (callback) => {
1349
+ const cleanupFns = [];
1350
+ if (typeof document !== "undefined" && typeof MutationObserver !== "undefined") {
1351
+ const observer = new MutationObserver(() => {
1352
+ callback(detectColorScheme());
1353
+ });
1354
+ observer.observe(document.documentElement, {
1355
+ attributes: true,
1356
+ attributeFilter: ["class"]
1357
+ });
1358
+ cleanupFns.push(() => observer.disconnect());
1359
+ }
1360
+ if (typeof window !== "undefined" && window.matchMedia) {
1361
+ const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
1362
+ const handleChange = () => callback(detectColorScheme());
1363
+ if (mediaQuery.addEventListener) {
1364
+ mediaQuery.addEventListener("change", handleChange);
1365
+ cleanupFns.push(() => mediaQuery.removeEventListener("change", handleChange));
1366
+ } else if (mediaQuery.addListener) {
1367
+ mediaQuery.addListener(handleChange);
1368
+ cleanupFns.push(() => mediaQuery.removeListener(handleChange));
1370
1369
  }
1370
+ }
1371
+ return () => {
1372
+ cleanupFns.forEach((fn) => fn());
1371
1373
  };
1372
- }
1374
+ };
1373
1375
 
1374
1376
  // src/theme-editor/state.ts
1375
1377
  function getByPath(obj, path) {
@@ -2234,8 +2236,8 @@ var panelLayoutSectionDef = {
2234
2236
  title: "Panel",
2235
2237
  collapsed: false,
2236
2238
  fields: [
2237
- { id: "panel-width", label: "Width", type: "text", path: "theme.components.panel.width", defaultValue: "min(400px, calc(100vw - 24px))" },
2238
- { id: "panel-max-width", label: "Max Width", type: "text", path: "theme.components.panel.maxWidth", defaultValue: "400px" },
2239
+ { id: "panel-width", label: "Width", type: "text", path: "theme.components.panel.width", defaultValue: DEFAULT_FLOATING_LAUNCHER_WIDTH },
2240
+ { id: "panel-max-width", label: "Max Width", type: "text", path: "theme.components.panel.maxWidth", defaultValue: DEFAULT_FLOATING_LAUNCHER_MAX_WIDTH },
2239
2241
  { id: "panel-height", label: "Height", type: "text", path: "theme.components.panel.height", defaultValue: "600px" },
2240
2242
  { id: "panel-max-height", label: "Max Height", type: "text", path: "theme.components.panel.maxHeight", defaultValue: "calc(100vh - 80px)" },
2241
2243
  { id: "panel-border-radius", label: "Border Radius", type: "select", path: "theme.components.panel.borderRadius", defaultValue: "palette.radius.xl", options: [
@@ -2539,7 +2541,7 @@ var launcherBasicsSectionDef = {
2539
2541
  { id: "launch-enabled", label: "Enabled", type: "toggle", path: "launcher.enabled", defaultValue: true },
2540
2542
  { id: "launch-mount-mode", label: "Mount Mode", type: "select", path: "launcher.mountMode", defaultValue: "floating", options: [{ value: "floating", label: "Floating" }, { value: "docked", label: "Docked" }] },
2541
2543
  { id: "launch-position", label: "Position", type: "select", path: "launcher.position", defaultValue: "bottom-right", options: [{ value: "bottom-right", label: "Bottom Right" }, { value: "bottom-left", label: "Bottom Left" }, { value: "top-right", label: "Top Right" }, { value: "top-left", label: "Top Left" }] },
2542
- { id: "launch-width", label: "Width", type: "text", path: "launcher.width", defaultValue: "min(400px, calc(100vw - 24px))" },
2544
+ { id: "launch-width", label: "Width", type: "text", path: "launcher.width", defaultValue: DEFAULT_FLOATING_LAUNCHER_WIDTH },
2543
2545
  { id: "launch-auto-expand", label: "Auto Expand", type: "toggle", path: "launcher.autoExpand", defaultValue: false },
2544
2546
  { id: "launch-title", label: "Title", type: "text", path: "launcher.title", defaultValue: "Chat Assistant" },
2545
2547
  { id: "launch-subtitle", label: "Subtitle", type: "text", path: "launcher.subtitle", defaultValue: "Here to help you get answers fast" }
@@ -4253,6 +4255,7 @@ var AgentWidgetClient = class {
4253
4255
  let assistantMessage = null;
4254
4256
  const assistantMessageRef = { current: null };
4255
4257
  const partIdState = { current: null };
4258
+ let didSplitByPartId = false;
4256
4259
  const reasoningMessages = /* @__PURE__ */ new Map();
4257
4260
  const toolMessages = /* @__PURE__ */ new Map();
4258
4261
  const reasoningContext = {
@@ -4283,11 +4286,21 @@ var AgentWidgetClient = class {
4283
4286
  (_g2 = (_f2 = (_e2 = (_d2 = (_c2 = (_b2 = (_a2 = payload.callId) != null ? _a2 : payload.call_id) != null ? _b2 : payload.requestId) != null ? _c2 : payload.request_id) != null ? _d2 : payload.toolCallId) != null ? _e2 : payload.tool_call_id) != null ? _f2 : payload.stepId) != null ? _g2 : payload.step_id
4284
4287
  );
4285
4288
  };
4289
+ const baseAssistantId = assistantMessageId;
4290
+ let assistantIdConsumed = false;
4286
4291
  const ensureAssistantMessage = () => {
4287
4292
  if (assistantMessage) return assistantMessage;
4293
+ let id;
4294
+ if (!assistantIdConsumed && baseAssistantId) {
4295
+ id = baseAssistantId;
4296
+ assistantIdConsumed = true;
4297
+ } else if (baseAssistantId && partIdState.current) {
4298
+ id = `${baseAssistantId}_${partIdState.current}`;
4299
+ } else {
4300
+ id = `assistant-${Date.now()}-${Math.random().toString(16).slice(2)}`;
4301
+ }
4288
4302
  assistantMessage = {
4289
- // Use pre-generated ID if provided, otherwise generate one
4290
- id: assistantMessageId != null ? assistantMessageId : `assistant-${Date.now()}-${Math.random().toString(16).slice(2)}`,
4303
+ id,
4291
4304
  role: "assistant",
4292
4305
  content: "",
4293
4306
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -4656,13 +4669,51 @@ var AgentWidgetClient = class {
4656
4669
  if (callKey) {
4657
4670
  toolContext.byCall.delete(callKey);
4658
4671
  }
4672
+ } else if (payloadType === "text_start") {
4673
+ const incomingPartId = payload.partId;
4674
+ if (incomingPartId !== void 0 && partIdState.current !== null && incomingPartId !== partIdState.current) {
4675
+ const prev = assistantMessage;
4676
+ if (prev) {
4677
+ prev.streaming = false;
4678
+ emitMessage(prev);
4679
+ assistantMessage = null;
4680
+ didSplitByPartId = true;
4681
+ }
4682
+ }
4683
+ if (incomingPartId !== void 0) {
4684
+ partIdState.current = incomingPartId;
4685
+ }
4686
+ } else if (payloadType === "text_end") {
4687
+ const prev = assistantMessage;
4688
+ if (prev) {
4689
+ prev.streaming = false;
4690
+ emitMessage(prev);
4691
+ assistantMessage = null;
4692
+ didSplitByPartId = true;
4693
+ }
4659
4694
  } else if (payloadType === "step_chunk" || payloadType === "step_delta") {
4660
4695
  const stepType = payload.stepType;
4661
4696
  const executionType = payload.executionType;
4662
4697
  if (stepType === "tool" || executionType === "context") {
4663
4698
  continue;
4664
4699
  }
4700
+ const incomingPartId = payload.partId;
4701
+ if (incomingPartId !== void 0 && partIdState.current !== null && incomingPartId !== partIdState.current) {
4702
+ const prev = assistantMessage;
4703
+ if (prev) {
4704
+ prev.streaming = false;
4705
+ emitMessage(prev);
4706
+ assistantMessage = null;
4707
+ didSplitByPartId = true;
4708
+ }
4709
+ }
4710
+ if (incomingPartId !== void 0) {
4711
+ partIdState.current = incomingPartId;
4712
+ }
4665
4713
  const assistant = ensureAssistantMessage();
4714
+ if (incomingPartId !== void 0 && !assistant.partId) {
4715
+ assistant.partId = incomingPartId;
4716
+ }
4666
4717
  const chunk = (_ca = (_ba = (_aa = (_$ = payload.text) != null ? _$ : payload.delta) != null ? _aa : payload.content) != null ? _ba : payload.chunk) != null ? _ca : "";
4667
4718
  if (chunk) {
4668
4719
  const rawBuffer = (_da = rawContentBuffers.get(assistant.id)) != null ? _da : "";
@@ -4886,7 +4937,17 @@ var AgentWidgetClient = class {
4886
4937
  }
4887
4938
  } else if (payloadType === "flow_complete") {
4888
4939
  const finalContent = (_ma = payload.result) == null ? void 0 : _ma.response;
4889
- if (finalContent !== void 0 && finalContent !== null) {
4940
+ if (didSplitByPartId) {
4941
+ if (assistantMessage !== null) {
4942
+ const msg = assistantMessage;
4943
+ streamParsers.delete(msg.id);
4944
+ rawContentBuffers.delete(msg.id);
4945
+ if (msg.streaming !== false) {
4946
+ msg.streaming = false;
4947
+ emitMessage(msg);
4948
+ }
4949
+ }
4950
+ } else if (finalContent !== void 0 && finalContent !== null) {
4890
4951
  const assistant = ensureAssistantMessage();
4891
4952
  const rawBuffer = rawContentBuffers.get(assistant.id);
4892
4953
  const stringContent = rawBuffer != null ? rawBuffer : ensureStringContent(finalContent);
@@ -9306,7 +9367,7 @@ var createWrapper = (config) => {
9306
9367
  "persona-widget-panel persona-relative persona-min-h-[320px]"
9307
9368
  );
9308
9369
  const launcherWidth = (_i = (_h = config == null ? void 0 : config.launcher) == null ? void 0 : _h.width) != null ? _i : config == null ? void 0 : config.launcherWidth;
9309
- const width = launcherWidth != null ? launcherWidth : "min(400px, calc(100vw - 24px))";
9370
+ const width = launcherWidth != null ? launcherWidth : DEFAULT_FLOATING_LAUNCHER_WIDTH;
9310
9371
  panel.style.width = width;
9311
9372
  panel.style.maxWidth = width;
9312
9373
  wrapper.appendChild(panel);
@@ -13482,6 +13543,9 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
13482
13543
  selectedModelId: composerCfg == null ? void 0 : composerCfg.selectedModelId,
13483
13544
  onModelChange: (modelId) => {
13484
13545
  config.composer = { ...config.composer, selectedModelId: modelId };
13546
+ if (config.agent) {
13547
+ config.agent = { ...config.agent, model: modelId };
13548
+ }
13485
13549
  },
13486
13550
  onVoiceToggle: ((_A = config.voiceRecognition) == null ? void 0 : _A.enabled) === true ? () => {
13487
13551
  composerVoiceBridge == null ? void 0 : composerVoiceBridge();
@@ -13528,6 +13592,11 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
13528
13592
  composerForm.style.marginLeft = "auto";
13529
13593
  composerForm.style.marginRight = "auto";
13530
13594
  }
13595
+ if (contentMaxWidth && suggestions) {
13596
+ suggestions.style.maxWidth = contentMaxWidth;
13597
+ suggestions.style.marginLeft = "auto";
13598
+ suggestions.style.marginRight = "auto";
13599
+ }
13531
13600
  if (contentMaxWidth && attachmentPreviewsContainer) {
13532
13601
  attachmentPreviewsContainer.style.maxWidth = contentMaxWidth;
13533
13602
  attachmentPreviewsContainer.style.marginLeft = "auto";
@@ -14006,7 +14075,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
14006
14075
  const mobileBreakpoint = (_g2 = (_f2 = config.launcher) == null ? void 0 : _f2.mobileBreakpoint) != null ? _g2 : 640;
14007
14076
  if (mobileFullscreen && ownerWindow2.innerWidth <= mobileBreakpoint) return;
14008
14077
  if (!shouldExpandLauncherForArtifacts(config, launcherEnabled)) return;
14009
- const base = (_j2 = (_i2 = (_h2 = config.launcher) == null ? void 0 : _h2.width) != null ? _i2 : config.launcherWidth) != null ? _j2 : "min(400px, calc(100vw - 24px))";
14078
+ const base = (_j2 = (_i2 = (_h2 = config.launcher) == null ? void 0 : _h2.width) != null ? _i2 : config.launcherWidth) != null ? _j2 : DEFAULT_FLOATING_LAUNCHER_WIDTH;
14010
14079
  const expanded = (_n2 = (_m2 = (_l2 = (_k2 = config.features) == null ? void 0 : _k2.artifacts) == null ? void 0 : _l2.layout) == null ? void 0 : _m2.expandedPanelWidth) != null ? _n2 : "min(720px, calc(100vw - 24px))";
14011
14080
  const hasVisible = lastArtifactsState.artifacts.length > 0 && !artifactsPaneUserHidden;
14012
14081
  if (hasVisible) {
@@ -14122,7 +14191,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
14122
14191
  return;
14123
14192
  }
14124
14193
  const launcherWidth = (_r2 = (_q2 = config == null ? void 0 : config.launcher) == null ? void 0 : _q2.width) != null ? _r2 : config == null ? void 0 : config.launcherWidth;
14125
- const width = launcherWidth != null ? launcherWidth : "min(400px, calc(100vw - 24px))";
14194
+ const width = launcherWidth != null ? launcherWidth : DEFAULT_FLOATING_LAUNCHER_WIDTH;
14126
14195
  if (!sidebarMode && !dockedMode) {
14127
14196
  if (isInlineEmbed && fullHeight) {
14128
14197
  panel.style.width = "100%";
@@ -15642,7 +15711,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
15642
15711
  }
15643
15712
  if (!sidebarMode && !dockedMode) {
15644
15713
  const launcherWidth = (_k2 = (_j2 = config == null ? void 0 : config.launcher) == null ? void 0 : _j2.width) != null ? _k2 : config == null ? void 0 : config.launcherWidth;
15645
- const width = launcherWidth != null ? launcherWidth : "min(400px, calc(100vw - 24px))";
15714
+ const width = launcherWidth != null ? launcherWidth : DEFAULT_FLOATING_LAUNCHER_WIDTH;
15646
15715
  panel.style.width = width;
15647
15716
  panel.style.maxWidth = width;
15648
15717
  }
@@ -16731,6 +16800,11 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
16731
16800
  composerForm.style.marginLeft = "auto";
16732
16801
  composerForm.style.marginRight = "auto";
16733
16802
  }
16803
+ if (suggestions) {
16804
+ suggestions.style.maxWidth = updatedContentMaxWidth;
16805
+ suggestions.style.marginLeft = "auto";
16806
+ suggestions.style.marginRight = "auto";
16807
+ }
16734
16808
  } else {
16735
16809
  messagesWrapper.style.maxWidth = "";
16736
16810
  messagesWrapper.style.marginLeft = "";
@@ -16741,6 +16815,11 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
16741
16815
  composerForm.style.marginLeft = "";
16742
16816
  composerForm.style.marginRight = "";
16743
16817
  }
16818
+ if (suggestions) {
16819
+ suggestions.style.maxWidth = "";
16820
+ suggestions.style.marginLeft = "";
16821
+ suggestions.style.marginRight = "";
16822
+ }
16744
16823
  }
16745
16824
  const statusIndicatorConfig = (_Qa = config.statusIndicator) != null ? _Qa : {};
16746
16825
  const isVisible = (_Ra = statusIndicatorConfig.visible) != null ? _Ra : true;