@helpai/elements 0.8.1 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/elements-web-component.esm.js +27 -27
- package/elements-web-component.esm.js.map +3 -3
- package/elements.cjs.js +27 -27
- package/elements.cjs.js.map +3 -3
- package/elements.esm.js +27 -27
- package/elements.esm.js.map +3 -3
- package/elements.js +27 -27
- package/elements.js.map +3 -3
- package/index.d.ts +1 -1
- package/index.mjs +17 -2
- package/package.json +1 -1
- package/schema.d.ts +35 -35
- package/web-component.mjs +17 -2
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, L as Link, S as ServerConfig, b as SiteConfig, c as StartSessionResponse, W as WidgetConfig, d as WidgetConfigPartial, e as WidgetSettings, f as WidgetSettingsPartial } from './deployment-
|
|
1
|
+
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, L as Link, S as ServerConfig, b as SiteConfig, c as StartSessionResponse, W as WidgetConfig, d as WidgetConfigPartial, e as WidgetSettings, f as WidgetSettingsPartial } from './deployment-B4_b3Sjy.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
|
|
4
4
|
/**
|
package/index.mjs
CHANGED
|
@@ -5290,6 +5290,8 @@ function App({ options, hostElement, bus }) {
|
|
|
5290
5290
|
homeNavRef.current = createHomeNav(landingTab(), ids, (tab) => persistence.saveActiveModule(tab));
|
|
5291
5291
|
}
|
|
5292
5292
|
const homeNav = homeNavRef.current;
|
|
5293
|
+
const chatTabIdRef = useRef8(void 0);
|
|
5294
|
+
chatTabIdRef.current = chatTabId();
|
|
5293
5295
|
const [sessionReady, setSessionReady] = useState11(false);
|
|
5294
5296
|
const isInlineLike = options.mode === "standalone" || options.mode === "inline";
|
|
5295
5297
|
const initialPanelRef = useRef8(
|
|
@@ -5381,9 +5383,16 @@ function App({ options, hostElement, bus }) {
|
|
|
5381
5383
|
setPanelSize(state.panelSize);
|
|
5382
5384
|
}, [sessionReady, options, persistence]);
|
|
5383
5385
|
const homeNavSeeded = useRef8(false);
|
|
5386
|
+
const resumeActiveRef = useRef8(false);
|
|
5387
|
+
const resumeBubbleRef = useRef8(null);
|
|
5384
5388
|
useEffect17(() => {
|
|
5385
5389
|
if (!sessionReady || homeNavSeeded.current) return;
|
|
5386
5390
|
homeNavSeeded.current = true;
|
|
5391
|
+
if (resumeActiveRef.current) {
|
|
5392
|
+
const chatTab = chatTabIdRef.current;
|
|
5393
|
+
if (chatTab) homeNav.switchTab(chatTab);
|
|
5394
|
+
return;
|
|
5395
|
+
}
|
|
5387
5396
|
homeNav.reset(landingTab());
|
|
5388
5397
|
}, [sessionReady]);
|
|
5389
5398
|
const playWelcome = useCallback8(
|
|
@@ -5469,7 +5478,8 @@ function App({ options, hostElement, bus }) {
|
|
|
5469
5478
|
const chat = res.messages?.length ? { sessionId: persistedChatId, canContinue: res.canContinue ?? true, messages: res.messages } : await transport.loadSession(persistedChatId);
|
|
5470
5479
|
if (isStale()) return;
|
|
5471
5480
|
const loaded = (chat.messages ?? []).map(fromWireMessage);
|
|
5472
|
-
|
|
5481
|
+
const tail = resumeBubbleRef.current ? [resumeBubbleRef.current] : [];
|
|
5482
|
+
if (loaded.length || tail.length) messagesSig.value = [...loaded, ...tail];
|
|
5473
5483
|
setCanSend(chat.canContinue ?? true);
|
|
5474
5484
|
setSuggestions(chat.suggestions ?? []);
|
|
5475
5485
|
} catch (err) {
|
|
@@ -5504,10 +5514,14 @@ function App({ options, hostElement, bus }) {
|
|
|
5504
5514
|
for await (const evt of handle.iter) {
|
|
5505
5515
|
if (!bubble) {
|
|
5506
5516
|
bubble = makeAssistantMessage();
|
|
5517
|
+
resumeBubbleRef.current = bubble;
|
|
5507
5518
|
reducer.attach(bubble);
|
|
5508
5519
|
messagesSig.value = [...messagesSig.value, bubble];
|
|
5509
5520
|
setStreaming(true);
|
|
5510
5521
|
setActiveCancel(() => handle.cancel);
|
|
5522
|
+
resumeActiveRef.current = true;
|
|
5523
|
+
const chatTab = chatTabIdRef.current;
|
|
5524
|
+
if (chatTab) homeNav.switchTab(chatTab);
|
|
5511
5525
|
log16.info("resumed in-flight reply on mount");
|
|
5512
5526
|
}
|
|
5513
5527
|
reducer.apply(evt.chunk);
|
|
@@ -5526,6 +5540,7 @@ function App({ options, hostElement, bus }) {
|
|
|
5526
5540
|
}
|
|
5527
5541
|
log16.debug("mount resume ended without completing", { err });
|
|
5528
5542
|
} finally {
|
|
5543
|
+
resumeBubbleRef.current = null;
|
|
5529
5544
|
if (bubble) {
|
|
5530
5545
|
reducer.detach();
|
|
5531
5546
|
setStreaming(false);
|
|
@@ -5534,7 +5549,7 @@ function App({ options, hostElement, bus }) {
|
|
|
5534
5549
|
}
|
|
5535
5550
|
}
|
|
5536
5551
|
},
|
|
5537
|
-
[reducer, messagesSig, feedback, bus, options]
|
|
5552
|
+
[reducer, messagesSig, feedback, bus, options, homeNav]
|
|
5538
5553
|
);
|
|
5539
5554
|
useEffect17(() => {
|
|
5540
5555
|
void runStartSession({ newConversation: false });
|
package/package.json
CHANGED
package/schema.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, E as Endpoints, L as Link, P as PAGE_AREA_SUGGESTIONS, g as PageContext, S as ServerConfig, b as SiteConfig, c as StartSessionResponse, U as UserContext, W as WidgetConfig, d as WidgetConfigPartial, e as WidgetSettings, f as WidgetSettingsPartial, h as assetSchema, i as blocksConfigSchema, j as connectionConfigPartialSchema, k as connectionConfigSchema, l as cssColorSchema, m as cssLengthSchema, n as endpointsSchema, o as linkSchema, p as localeSchema, q as pageContextSchema, s as serverConfigSchema, r as siteConfigSchema, t as startSessionResponseSchema, u as userContextSchema, v as uuid7Schema, w as widgetConfigPartialSchema, x as widgetConfigSchema, y as widgetSettingsPartialSchema, z as widgetSettingsSchema } from './deployment-
|
|
1
|
+
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, E as Endpoints, L as Link, P as PAGE_AREA_SUGGESTIONS, g as PageContext, S as ServerConfig, b as SiteConfig, c as StartSessionResponse, U as UserContext, W as WidgetConfig, d as WidgetConfigPartial, e as WidgetSettings, f as WidgetSettingsPartial, h as assetSchema, i as blocksConfigSchema, j as connectionConfigPartialSchema, k as connectionConfigSchema, l as cssColorSchema, m as cssLengthSchema, n as endpointsSchema, o as linkSchema, p as localeSchema, q as pageContextSchema, s as serverConfigSchema, r as siteConfigSchema, t as startSessionResponseSchema, u as userContextSchema, v as uuid7Schema, w as widgetConfigPartialSchema, x as widgetConfigSchema, y as widgetSettingsPartialSchema, z as widgetSettingsSchema } from './deployment-B4_b3Sjy.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -56,9 +56,9 @@ declare const presentationSchema: z.ZodObject<{
|
|
|
56
56
|
inset: z.ZodOptional<z.ZodString>;
|
|
57
57
|
initialSize: z.ZodDefault<z.ZodEnum<{
|
|
58
58
|
fullscreen: "fullscreen";
|
|
59
|
-
normal: "normal";
|
|
60
59
|
expanded: "expanded";
|
|
61
60
|
auto: "auto";
|
|
61
|
+
normal: "normal";
|
|
62
62
|
}>>;
|
|
63
63
|
autoSizeBreakpoint: z.ZodDefault<z.ZodNumber>;
|
|
64
64
|
}, z.core.$loose>>;
|
|
@@ -148,9 +148,9 @@ declare const launcherSizeSchema: z.ZodEnum<{
|
|
|
148
148
|
}>;
|
|
149
149
|
type LauncherSize = z.infer<typeof launcherSizeSchema>;
|
|
150
150
|
declare const calloutShapeSchema: z.ZodEnum<{
|
|
151
|
+
callout: "callout";
|
|
151
152
|
pill: "pill";
|
|
152
153
|
bubble: "bubble";
|
|
153
|
-
callout: "callout";
|
|
154
154
|
}>;
|
|
155
155
|
type CalloutShape = z.infer<typeof calloutShapeSchema>;
|
|
156
156
|
declare const calloutPositionSchema: z.ZodEnum<{
|
|
@@ -162,9 +162,9 @@ type CalloutPosition = z.infer<typeof calloutPositionSchema>;
|
|
|
162
162
|
declare const launcherCalloutSchema: z.ZodObject<{
|
|
163
163
|
text: z.ZodDefault<z.ZodString>;
|
|
164
164
|
shape: z.ZodDefault<z.ZodEnum<{
|
|
165
|
+
callout: "callout";
|
|
165
166
|
pill: "pill";
|
|
166
167
|
bubble: "bubble";
|
|
167
|
-
callout: "callout";
|
|
168
168
|
}>>;
|
|
169
169
|
position: z.ZodDefault<z.ZodEnum<{
|
|
170
170
|
auto: "auto";
|
|
@@ -195,9 +195,9 @@ declare const launcherOptionsSchema: z.ZodObject<{
|
|
|
195
195
|
callout: z.ZodOptional<z.ZodObject<{
|
|
196
196
|
text: z.ZodDefault<z.ZodString>;
|
|
197
197
|
shape: z.ZodDefault<z.ZodEnum<{
|
|
198
|
+
callout: "callout";
|
|
198
199
|
pill: "pill";
|
|
199
200
|
bubble: "bubble";
|
|
200
|
-
callout: "callout";
|
|
201
201
|
}>>;
|
|
202
202
|
position: z.ZodDefault<z.ZodEnum<{
|
|
203
203
|
auto: "auto";
|
|
@@ -240,9 +240,9 @@ type LauncherOptions = z.infer<typeof launcherOptionsSchema>;
|
|
|
240
240
|
|
|
241
241
|
declare const initialSizeSchema: z.ZodEnum<{
|
|
242
242
|
fullscreen: "fullscreen";
|
|
243
|
-
normal: "normal";
|
|
244
243
|
expanded: "expanded";
|
|
245
244
|
auto: "auto";
|
|
245
|
+
normal: "normal";
|
|
246
246
|
}>;
|
|
247
247
|
declare const resizeOptionsSchema: z.ZodObject<{
|
|
248
248
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -269,9 +269,9 @@ declare const sizeOptionsSchema: z.ZodObject<{
|
|
|
269
269
|
inset: z.ZodOptional<z.ZodString>;
|
|
270
270
|
initialSize: z.ZodDefault<z.ZodEnum<{
|
|
271
271
|
fullscreen: "fullscreen";
|
|
272
|
-
normal: "normal";
|
|
273
272
|
expanded: "expanded";
|
|
274
273
|
auto: "auto";
|
|
274
|
+
normal: "normal";
|
|
275
275
|
}>>;
|
|
276
276
|
autoSizeBreakpoint: z.ZodDefault<z.ZodNumber>;
|
|
277
277
|
}, z.core.$loose>;
|
|
@@ -321,38 +321,38 @@ type FeatureFlags = z.infer<typeof featureFlagsSchema>;
|
|
|
321
321
|
*/
|
|
322
322
|
|
|
323
323
|
declare const actionNameSchema: z.ZodEnum<{
|
|
324
|
+
close: "close";
|
|
324
325
|
expand: "expand";
|
|
325
326
|
fullscreen: "fullscreen";
|
|
326
327
|
popOut: "popOut";
|
|
327
|
-
|
|
328
|
-
language: "language";
|
|
328
|
+
clear: "clear";
|
|
329
329
|
theme: "theme";
|
|
330
|
+
language: "language";
|
|
330
331
|
history: "history";
|
|
331
|
-
clear: "clear";
|
|
332
332
|
sound: "sound";
|
|
333
333
|
}>;
|
|
334
334
|
type ActionName = z.infer<typeof actionNameSchema>;
|
|
335
335
|
declare const headerActionsSchema: z.ZodObject<{
|
|
336
336
|
main: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
337
|
+
close: "close";
|
|
337
338
|
expand: "expand";
|
|
338
339
|
fullscreen: "fullscreen";
|
|
339
340
|
popOut: "popOut";
|
|
340
|
-
|
|
341
|
-
language: "language";
|
|
341
|
+
clear: "clear";
|
|
342
342
|
theme: "theme";
|
|
343
|
+
language: "language";
|
|
343
344
|
history: "history";
|
|
344
|
-
clear: "clear";
|
|
345
345
|
sound: "sound";
|
|
346
346
|
}>>>;
|
|
347
347
|
overflow: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
348
|
+
close: "close";
|
|
348
349
|
expand: "expand";
|
|
349
350
|
fullscreen: "fullscreen";
|
|
350
351
|
popOut: "popOut";
|
|
351
|
-
|
|
352
|
-
language: "language";
|
|
352
|
+
clear: "clear";
|
|
353
353
|
theme: "theme";
|
|
354
|
+
language: "language";
|
|
354
355
|
history: "history";
|
|
355
|
-
clear: "clear";
|
|
356
356
|
sound: "sound";
|
|
357
357
|
}>>>;
|
|
358
358
|
}, z.core.$loose>;
|
|
@@ -361,25 +361,25 @@ type HeaderActions = z.infer<typeof headerActionsSchema>;
|
|
|
361
361
|
declare const headerSchema: z.ZodObject<{
|
|
362
362
|
actions: z.ZodOptional<z.ZodObject<{
|
|
363
363
|
main: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
364
|
+
close: "close";
|
|
364
365
|
expand: "expand";
|
|
365
366
|
fullscreen: "fullscreen";
|
|
366
367
|
popOut: "popOut";
|
|
367
|
-
|
|
368
|
-
language: "language";
|
|
368
|
+
clear: "clear";
|
|
369
369
|
theme: "theme";
|
|
370
|
+
language: "language";
|
|
370
371
|
history: "history";
|
|
371
|
-
clear: "clear";
|
|
372
372
|
sound: "sound";
|
|
373
373
|
}>>>;
|
|
374
374
|
overflow: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
375
|
+
close: "close";
|
|
375
376
|
expand: "expand";
|
|
376
377
|
fullscreen: "fullscreen";
|
|
377
378
|
popOut: "popOut";
|
|
378
|
-
|
|
379
|
-
language: "language";
|
|
379
|
+
clear: "clear";
|
|
380
380
|
theme: "theme";
|
|
381
|
+
language: "language";
|
|
381
382
|
history: "history";
|
|
382
|
-
clear: "clear";
|
|
383
383
|
sound: "sound";
|
|
384
384
|
}>>>;
|
|
385
385
|
}, z.core.$loose>>;
|
|
@@ -396,33 +396,33 @@ type HeaderOptions = z.infer<typeof headerSchema>;
|
|
|
396
396
|
*/
|
|
397
397
|
|
|
398
398
|
declare const feedbackEventSchema: z.ZodEnum<{
|
|
399
|
+
voiceStart: "voiceStart";
|
|
400
|
+
voiceStop: "voiceStop";
|
|
399
401
|
error: "error";
|
|
400
402
|
messageReceived: "messageReceived";
|
|
401
403
|
messageSent: "messageSent";
|
|
402
|
-
voiceStart: "voiceStart";
|
|
403
|
-
voiceStop: "voiceStop";
|
|
404
404
|
}>;
|
|
405
405
|
type FeedbackEvent = z.infer<typeof feedbackEventSchema>;
|
|
406
406
|
declare const soundOptionsSchema: z.ZodObject<{
|
|
407
407
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
408
408
|
volume: z.ZodDefault<z.ZodNumber>;
|
|
409
409
|
events: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
410
|
+
voiceStart: "voiceStart";
|
|
411
|
+
voiceStop: "voiceStop";
|
|
410
412
|
error: "error";
|
|
411
413
|
messageReceived: "messageReceived";
|
|
412
414
|
messageSent: "messageSent";
|
|
413
|
-
voiceStart: "voiceStart";
|
|
414
|
-
voiceStop: "voiceStop";
|
|
415
415
|
}> & z.core.$partial, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>>;
|
|
416
416
|
}, z.core.$loose>;
|
|
417
417
|
type SoundOptions = z.infer<typeof soundOptionsSchema>;
|
|
418
418
|
declare const hapticsOptionsSchema: z.ZodObject<{
|
|
419
419
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
420
420
|
events: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
421
|
+
voiceStart: "voiceStart";
|
|
422
|
+
voiceStop: "voiceStop";
|
|
421
423
|
error: "error";
|
|
422
424
|
messageReceived: "messageReceived";
|
|
423
425
|
messageSent: "messageSent";
|
|
424
|
-
voiceStart: "voiceStart";
|
|
425
|
-
voiceStop: "voiceStop";
|
|
426
426
|
}> & z.core.$partial, z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
427
427
|
}, z.core.$loose>;
|
|
428
428
|
type HapticsOptions = z.infer<typeof hapticsOptionsSchema>;
|
|
@@ -431,21 +431,21 @@ declare const feedbackSchema: z.ZodObject<{
|
|
|
431
431
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
432
432
|
volume: z.ZodDefault<z.ZodNumber>;
|
|
433
433
|
events: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
434
|
+
voiceStart: "voiceStart";
|
|
435
|
+
voiceStop: "voiceStop";
|
|
434
436
|
error: "error";
|
|
435
437
|
messageReceived: "messageReceived";
|
|
436
438
|
messageSent: "messageSent";
|
|
437
|
-
voiceStart: "voiceStart";
|
|
438
|
-
voiceStop: "voiceStop";
|
|
439
439
|
}> & z.core.$partial, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>>;
|
|
440
440
|
}, z.core.$loose>>;
|
|
441
441
|
haptics: z.ZodOptional<z.ZodObject<{
|
|
442
442
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
443
443
|
events: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
444
|
+
voiceStart: "voiceStart";
|
|
445
|
+
voiceStop: "voiceStop";
|
|
444
446
|
error: "error";
|
|
445
447
|
messageReceived: "messageReceived";
|
|
446
448
|
messageSent: "messageSent";
|
|
447
|
-
voiceStart: "voiceStart";
|
|
448
|
-
voiceStop: "voiceStop";
|
|
449
449
|
}> & z.core.$partial, z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
450
450
|
}, z.core.$loose>>;
|
|
451
451
|
}, z.core.$loose>;
|
|
@@ -607,18 +607,18 @@ type I18nOptions = z.infer<typeof i18nSchema>;
|
|
|
607
607
|
*/
|
|
608
608
|
|
|
609
609
|
declare const moduleLayoutSchema: z.ZodEnum<{
|
|
610
|
+
home: "home";
|
|
610
611
|
chat: "chat";
|
|
611
612
|
help: "help";
|
|
612
|
-
home: "home";
|
|
613
613
|
news: "news";
|
|
614
614
|
}>;
|
|
615
615
|
type ModuleLayout = z.infer<typeof moduleLayoutSchema>;
|
|
616
616
|
declare const moduleSchema: z.ZodObject<{
|
|
617
617
|
label: z.ZodString;
|
|
618
618
|
layout: z.ZodEnum<{
|
|
619
|
+
home: "home";
|
|
619
620
|
chat: "chat";
|
|
620
621
|
help: "help";
|
|
621
|
-
home: "home";
|
|
622
622
|
news: "news";
|
|
623
623
|
}>;
|
|
624
624
|
contentTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -644,9 +644,9 @@ type ModuleOptions = z.infer<typeof moduleSchema>;
|
|
|
644
644
|
declare const modulesSchema: z.ZodArray<z.ZodObject<{
|
|
645
645
|
label: z.ZodString;
|
|
646
646
|
layout: z.ZodEnum<{
|
|
647
|
+
home: "home";
|
|
647
648
|
chat: "chat";
|
|
648
649
|
help: "help";
|
|
649
|
-
home: "home";
|
|
650
650
|
news: "news";
|
|
651
651
|
}>;
|
|
652
652
|
contentTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
package/web-component.mjs
CHANGED
|
@@ -5354,6 +5354,8 @@ function App({ options, hostElement, bus }) {
|
|
|
5354
5354
|
homeNavRef.current = createHomeNav(landingTab(), ids, (tab) => persistence.saveActiveModule(tab));
|
|
5355
5355
|
}
|
|
5356
5356
|
const homeNav = homeNavRef.current;
|
|
5357
|
+
const chatTabIdRef = useRef8(void 0);
|
|
5358
|
+
chatTabIdRef.current = chatTabId();
|
|
5357
5359
|
const [sessionReady, setSessionReady] = useState11(false);
|
|
5358
5360
|
const isInlineLike = options.mode === "standalone" || options.mode === "inline";
|
|
5359
5361
|
const initialPanelRef = useRef8(
|
|
@@ -5445,9 +5447,16 @@ function App({ options, hostElement, bus }) {
|
|
|
5445
5447
|
setPanelSize(state.panelSize);
|
|
5446
5448
|
}, [sessionReady, options, persistence]);
|
|
5447
5449
|
const homeNavSeeded = useRef8(false);
|
|
5450
|
+
const resumeActiveRef = useRef8(false);
|
|
5451
|
+
const resumeBubbleRef = useRef8(null);
|
|
5448
5452
|
useEffect17(() => {
|
|
5449
5453
|
if (!sessionReady || homeNavSeeded.current) return;
|
|
5450
5454
|
homeNavSeeded.current = true;
|
|
5455
|
+
if (resumeActiveRef.current) {
|
|
5456
|
+
const chatTab = chatTabIdRef.current;
|
|
5457
|
+
if (chatTab) homeNav.switchTab(chatTab);
|
|
5458
|
+
return;
|
|
5459
|
+
}
|
|
5451
5460
|
homeNav.reset(landingTab());
|
|
5452
5461
|
}, [sessionReady]);
|
|
5453
5462
|
const playWelcome = useCallback8(
|
|
@@ -5533,7 +5542,8 @@ function App({ options, hostElement, bus }) {
|
|
|
5533
5542
|
const chat = res.messages?.length ? { sessionId: persistedChatId, canContinue: res.canContinue ?? true, messages: res.messages } : await transport.loadSession(persistedChatId);
|
|
5534
5543
|
if (isStale()) return;
|
|
5535
5544
|
const loaded = (chat.messages ?? []).map(fromWireMessage);
|
|
5536
|
-
|
|
5545
|
+
const tail = resumeBubbleRef.current ? [resumeBubbleRef.current] : [];
|
|
5546
|
+
if (loaded.length || tail.length) messagesSig.value = [...loaded, ...tail];
|
|
5537
5547
|
setCanSend(chat.canContinue ?? true);
|
|
5538
5548
|
setSuggestions(chat.suggestions ?? []);
|
|
5539
5549
|
} catch (err) {
|
|
@@ -5568,10 +5578,14 @@ function App({ options, hostElement, bus }) {
|
|
|
5568
5578
|
for await (const evt of handle.iter) {
|
|
5569
5579
|
if (!bubble) {
|
|
5570
5580
|
bubble = makeAssistantMessage();
|
|
5581
|
+
resumeBubbleRef.current = bubble;
|
|
5571
5582
|
reducer.attach(bubble);
|
|
5572
5583
|
messagesSig.value = [...messagesSig.value, bubble];
|
|
5573
5584
|
setStreaming(true);
|
|
5574
5585
|
setActiveCancel(() => handle.cancel);
|
|
5586
|
+
resumeActiveRef.current = true;
|
|
5587
|
+
const chatTab = chatTabIdRef.current;
|
|
5588
|
+
if (chatTab) homeNav.switchTab(chatTab);
|
|
5575
5589
|
log16.info("resumed in-flight reply on mount");
|
|
5576
5590
|
}
|
|
5577
5591
|
reducer.apply(evt.chunk);
|
|
@@ -5590,6 +5604,7 @@ function App({ options, hostElement, bus }) {
|
|
|
5590
5604
|
}
|
|
5591
5605
|
log16.debug("mount resume ended without completing", { err });
|
|
5592
5606
|
} finally {
|
|
5607
|
+
resumeBubbleRef.current = null;
|
|
5593
5608
|
if (bubble) {
|
|
5594
5609
|
reducer.detach();
|
|
5595
5610
|
setStreaming(false);
|
|
@@ -5598,7 +5613,7 @@ function App({ options, hostElement, bus }) {
|
|
|
5598
5613
|
}
|
|
5599
5614
|
}
|
|
5600
5615
|
},
|
|
5601
|
-
[reducer, messagesSig, feedback, bus, options]
|
|
5616
|
+
[reducer, messagesSig, feedback, bus, options, homeNav]
|
|
5602
5617
|
);
|
|
5603
5618
|
useEffect17(() => {
|
|
5604
5619
|
void runStartSession({ newConversation: false });
|