@helpai/elements 0.46.0 → 0.46.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/elements-web-component.esm.js +4 -4
- package/elements-web-component.esm.js.map +3 -3
- package/elements.cjs.js +22 -22
- package/elements.cjs.js.map +3 -3
- package/elements.esm.js +22 -22
- package/elements.esm.js.map +3 -3
- package/elements.js +4 -4
- package/elements.js.map +3 -3
- package/index.d.ts +1 -1
- package/index.mjs +39 -5
- package/package.json +1 -1
- package/schema.d.ts +26 -26
- package/web-component.mjs +39 -5
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, H as HandshakeResponse, L as Link, S as ServerConfig, b as SiteConfig, W as WidgetConfig, c as WidgetConfigPartial, d as WidgetSettings, e as WidgetSettingsPartial } from './deployment-
|
|
1
|
+
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, H as HandshakeResponse, L as Link, S as ServerConfig, b as SiteConfig, W as WidgetConfig, c as WidgetConfigPartial, d as WidgetSettings, e as WidgetSettingsPartial } from './deployment-oSJ2nv2G.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
|
|
4
4
|
/**
|
package/index.mjs
CHANGED
|
@@ -30,7 +30,7 @@ var BRAND = {
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
// src/core/version.ts
|
|
33
|
-
var ELEMENTS_VERSION = true ? "0.46.
|
|
33
|
+
var ELEMENTS_VERSION = true ? "0.46.2" : "0.0.0-dev";
|
|
34
34
|
var ELEMENTS_VERSION_PARAM = "_ev";
|
|
35
35
|
|
|
36
36
|
// src/i18n/strings.ts
|
|
@@ -1653,7 +1653,10 @@ var DEFAULT_PATHS = {
|
|
|
1653
1653
|
var CONTEXT_PARAM = "context";
|
|
1654
1654
|
function buildSendMessageRequest(params) {
|
|
1655
1655
|
const wire = params.messages.map((m) => ({
|
|
1656
|
-
id
|
|
1656
|
+
// Use the backend's id when known (adopted from the stream's `start` chunk)
|
|
1657
|
+
// so a resumed assistant message matches what the backend persisted; falls
|
|
1658
|
+
// back to the client id (user messages, pre-`start` shells).
|
|
1659
|
+
id: m.serverMessageId ?? m.id,
|
|
1657
1660
|
parts: messageToWireParts(m),
|
|
1658
1661
|
role: m.role,
|
|
1659
1662
|
// Internal clock is epoch ms; the wire speaks ISO-8601 (Mongo ISODate).
|
|
@@ -1681,6 +1684,12 @@ function normalizeToolRef(ref) {
|
|
|
1681
1684
|
function messageToWireParts(m) {
|
|
1682
1685
|
const out = [];
|
|
1683
1686
|
for (const p35 of m.parts) {
|
|
1687
|
+
if (p35.kind === "step-start") {
|
|
1688
|
+
out.push({ type: "step-start" });
|
|
1689
|
+
}
|
|
1690
|
+
if (p35.kind === "reasoning" && p35.text) {
|
|
1691
|
+
out.push({ type: "reasoning", text: p35.text, state: p35.done ? "done" : "streaming" });
|
|
1692
|
+
}
|
|
1684
1693
|
if (p35.kind === "text" && p35.text) {
|
|
1685
1694
|
out.push({ text: p35.text, type: "text" });
|
|
1686
1695
|
}
|
|
@@ -2381,6 +2390,7 @@ function toReactive(m) {
|
|
|
2381
2390
|
status: m.status,
|
|
2382
2391
|
errorText: m.errorText,
|
|
2383
2392
|
finishReason: m.finishReason,
|
|
2393
|
+
serverMessageId: m.serverMessageId,
|
|
2384
2394
|
attachments: m.attachments,
|
|
2385
2395
|
partsSig: signal(m.parts.map(partToReactive))
|
|
2386
2396
|
};
|
|
@@ -2390,6 +2400,17 @@ function fromWireMessage(w) {
|
|
|
2390
2400
|
if (part.type === "text") {
|
|
2391
2401
|
return { kind: "text", id: `${w.id}-t${i}`, textSig: signal(part.text), doneSig: signal(true) };
|
|
2392
2402
|
}
|
|
2403
|
+
if (part.type === "reasoning") {
|
|
2404
|
+
return {
|
|
2405
|
+
kind: "reasoning",
|
|
2406
|
+
id: `${w.id}-r${i}`,
|
|
2407
|
+
textSig: signal(part.text),
|
|
2408
|
+
doneSig: signal(part.state !== "streaming")
|
|
2409
|
+
};
|
|
2410
|
+
}
|
|
2411
|
+
if (part.type === "step-start") {
|
|
2412
|
+
return { kind: "step-start", id: `${w.id}-ss${i}` };
|
|
2413
|
+
}
|
|
2393
2414
|
if (part.type === "file") {
|
|
2394
2415
|
return { kind: "file", url: part.url, mediaType: part.mediaType };
|
|
2395
2416
|
}
|
|
@@ -2423,6 +2444,9 @@ function fromWireMessage(w) {
|
|
|
2423
2444
|
return {
|
|
2424
2445
|
id: w.id,
|
|
2425
2446
|
role: w.role,
|
|
2447
|
+
// On reload the wire `id` IS the backend's id — keep it as `serverMessageId`
|
|
2448
|
+
// too so a HITL re-POST after a reload still references the backend's message.
|
|
2449
|
+
serverMessageId: w.id,
|
|
2426
2450
|
// Real send time when the backend provides it; otherwise fall back to now
|
|
2427
2451
|
// (older backends) so the timestamp + day divider still render.
|
|
2428
2452
|
createdAt: parseWireDate(w.createdAt) ?? Date.now(),
|
|
@@ -2438,6 +2462,7 @@ function fromReactive(m) {
|
|
|
2438
2462
|
status: m.status,
|
|
2439
2463
|
errorText: m.errorText,
|
|
2440
2464
|
finishReason: m.finishReason,
|
|
2465
|
+
serverMessageId: m.serverMessageId,
|
|
2441
2466
|
attachments: m.attachments,
|
|
2442
2467
|
parts: m.partsSig.value.map(partFromReactive)
|
|
2443
2468
|
};
|
|
@@ -2508,9 +2533,13 @@ var StreamReducer = class {
|
|
|
2508
2533
|
if (!m) return;
|
|
2509
2534
|
switch (chunk.type) {
|
|
2510
2535
|
case "start":
|
|
2511
|
-
|
|
2536
|
+
if (chunk.messageId) m.serverMessageId = chunk.messageId;
|
|
2537
|
+
return;
|
|
2512
2538
|
case "finish-step":
|
|
2513
2539
|
return;
|
|
2540
|
+
case "start-step":
|
|
2541
|
+
appendPart(m, { kind: "step-start", id: `ss${m.partsSig.value.length}` });
|
|
2542
|
+
return;
|
|
2514
2543
|
case "finish":
|
|
2515
2544
|
log7.debug("finish", { reason: chunk.finishReason, canContinue: chunk.canContinue });
|
|
2516
2545
|
m.status = "complete";
|
|
@@ -5204,6 +5233,8 @@ function PartView({
|
|
|
5204
5233
|
tool
|
|
5205
5234
|
}) {
|
|
5206
5235
|
switch (part.kind) {
|
|
5236
|
+
case "step-start":
|
|
5237
|
+
return null;
|
|
5207
5238
|
case "text":
|
|
5208
5239
|
return /* @__PURE__ */ jsx17(MarkdownView, { textSig: part.textSig, doneSig: part.doneSig });
|
|
5209
5240
|
case "reasoning":
|
|
@@ -5269,6 +5300,7 @@ function partKey(part) {
|
|
|
5269
5300
|
switch (part.kind) {
|
|
5270
5301
|
case "text":
|
|
5271
5302
|
case "reasoning":
|
|
5303
|
+
case "step-start":
|
|
5272
5304
|
return `${part.kind}:${part.id}`;
|
|
5273
5305
|
case "tool":
|
|
5274
5306
|
return `tool:${part.toolCallId}`;
|
|
@@ -7412,8 +7444,10 @@ function App({ options, hostElement, bus }) {
|
|
|
7412
7444
|
const body = buildSendMessageRequest({
|
|
7413
7445
|
messages: thread.map(fromReactive),
|
|
7414
7446
|
conversationId: activeConversationId,
|
|
7415
|
-
// The assistant message being generated / resumed
|
|
7416
|
-
|
|
7447
|
+
// The assistant message being generated / resumed — prefer the id the
|
|
7448
|
+
// backend assigned (adopted from the `start` chunk) so a HITL re-POST
|
|
7449
|
+
// resumes the message the backend persisted, not the client-minted id.
|
|
7450
|
+
messageId: assistantMsg.serverMessageId ?? assistantMsg.id,
|
|
7417
7451
|
// textModel + imageModel are backend-only — selected per deployment.
|
|
7418
7452
|
tools: options.features.tools,
|
|
7419
7453
|
// Identity + preferences ride on every message — server may need
|
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, H as HandshakeResponse, L as Link, P as PAGE_AREA_SUGGESTIONS, f as PageContext, S as ServerConfig, b as SiteConfig, U as UserContext, W as WidgetConfig, c as WidgetConfigPartial, d as WidgetSettings, e as WidgetSettingsPartial, g as assetSchema, h as blocksConfigSchema, i as connectionConfigPartialSchema, j as connectionConfigSchema, k as cssColorSchema, l as cssLengthSchema, m as endpointsSchema, n as handshakeResponseSchema, o as linkSchema, p as localeSchema, q as pageContextSchema, s as serverConfigSchema, r as siteConfigSchema, u as userContextSchema, t as uuid7Schema, w as widgetConfigPartialSchema, v as widgetConfigSchema, x as widgetSettingsPartialSchema, y as widgetSettingsSchema } from './deployment-
|
|
1
|
+
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, E as Endpoints, H as HandshakeResponse, L as Link, P as PAGE_AREA_SUGGESTIONS, f as PageContext, S as ServerConfig, b as SiteConfig, U as UserContext, W as WidgetConfig, c as WidgetConfigPartial, d as WidgetSettings, e as WidgetSettingsPartial, g as assetSchema, h as blocksConfigSchema, i as connectionConfigPartialSchema, j as connectionConfigSchema, k as cssColorSchema, l as cssLengthSchema, m as endpointsSchema, n as handshakeResponseSchema, o as linkSchema, p as localeSchema, q as pageContextSchema, s as serverConfigSchema, r as siteConfigSchema, u as userContextSchema, t as uuid7Schema, w as widgetConfigPartialSchema, v as widgetConfigSchema, x as widgetSettingsPartialSchema, y as widgetSettingsSchema } from './deployment-oSJ2nv2G.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";
|
|
59
60
|
expanded: "expanded";
|
|
60
61
|
auto: "auto";
|
|
61
|
-
normal: "normal";
|
|
62
62
|
}>>;
|
|
63
63
|
autoSizeBreakpoint: z.ZodDefault<z.ZodNumber>;
|
|
64
64
|
}, z.core.$loose>>;
|
|
@@ -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";
|
|
243
244
|
expanded: "expanded";
|
|
244
245
|
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";
|
|
272
273
|
expanded: "expanded";
|
|
273
274
|
auto: "auto";
|
|
274
|
-
normal: "normal";
|
|
275
275
|
}>>;
|
|
276
276
|
autoSizeBreakpoint: z.ZodDefault<z.ZodNumber>;
|
|
277
277
|
}, z.core.$loose>;
|
|
@@ -323,40 +323,40 @@ type FeatureFlags = z.infer<typeof featureFlagsSchema>;
|
|
|
323
323
|
*/
|
|
324
324
|
|
|
325
325
|
declare const actionNameSchema: z.ZodEnum<{
|
|
326
|
-
close: "close";
|
|
327
326
|
expand: "expand";
|
|
328
327
|
fullscreen: "fullscreen";
|
|
329
|
-
|
|
330
|
-
theme: "theme";
|
|
328
|
+
close: "close";
|
|
331
329
|
language: "language";
|
|
330
|
+
theme: "theme";
|
|
332
331
|
textSize: "textSize";
|
|
333
332
|
history: "history";
|
|
333
|
+
clear: "clear";
|
|
334
334
|
sound: "sound";
|
|
335
335
|
}>;
|
|
336
336
|
type ActionName = z.infer<typeof actionNameSchema>;
|
|
337
337
|
declare const headerActionsSchema: z.ZodArray<z.ZodEnum<{
|
|
338
|
-
close: "close";
|
|
339
338
|
expand: "expand";
|
|
340
339
|
fullscreen: "fullscreen";
|
|
341
|
-
|
|
342
|
-
theme: "theme";
|
|
340
|
+
close: "close";
|
|
343
341
|
language: "language";
|
|
342
|
+
theme: "theme";
|
|
344
343
|
textSize: "textSize";
|
|
345
344
|
history: "history";
|
|
345
|
+
clear: "clear";
|
|
346
346
|
sound: "sound";
|
|
347
347
|
}>>;
|
|
348
348
|
type HeaderActions = z.infer<typeof headerActionsSchema>;
|
|
349
349
|
/** Section wrapper — `actions` list wrapped under `header` in the dashboard form. */
|
|
350
350
|
declare const headerSchema: z.ZodObject<{
|
|
351
351
|
actions: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
352
|
-
close: "close";
|
|
353
352
|
expand: "expand";
|
|
354
353
|
fullscreen: "fullscreen";
|
|
355
|
-
|
|
356
|
-
theme: "theme";
|
|
354
|
+
close: "close";
|
|
357
355
|
language: "language";
|
|
356
|
+
theme: "theme";
|
|
358
357
|
textSize: "textSize";
|
|
359
358
|
history: "history";
|
|
359
|
+
clear: "clear";
|
|
360
360
|
sound: "sound";
|
|
361
361
|
}>>>;
|
|
362
362
|
}, z.core.$loose>;
|
|
@@ -372,33 +372,33 @@ type HeaderOptions = z.infer<typeof headerSchema>;
|
|
|
372
372
|
*/
|
|
373
373
|
|
|
374
374
|
declare const feedbackEventSchema: z.ZodEnum<{
|
|
375
|
-
voiceStart: "voiceStart";
|
|
376
|
-
voiceStop: "voiceStop";
|
|
377
375
|
error: "error";
|
|
378
376
|
messageReceived: "messageReceived";
|
|
379
377
|
messageSent: "messageSent";
|
|
378
|
+
voiceStart: "voiceStart";
|
|
379
|
+
voiceStop: "voiceStop";
|
|
380
380
|
}>;
|
|
381
381
|
type FeedbackEvent = z.infer<typeof feedbackEventSchema>;
|
|
382
382
|
declare const soundOptionsSchema: z.ZodObject<{
|
|
383
383
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
384
384
|
volume: z.ZodDefault<z.ZodNumber>;
|
|
385
385
|
events: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
386
|
-
voiceStart: "voiceStart";
|
|
387
|
-
voiceStop: "voiceStop";
|
|
388
386
|
error: "error";
|
|
389
387
|
messageReceived: "messageReceived";
|
|
390
388
|
messageSent: "messageSent";
|
|
389
|
+
voiceStart: "voiceStart";
|
|
390
|
+
voiceStop: "voiceStop";
|
|
391
391
|
}> & z.core.$partial, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>>;
|
|
392
392
|
}, z.core.$loose>;
|
|
393
393
|
type SoundOptions = z.infer<typeof soundOptionsSchema>;
|
|
394
394
|
declare const hapticsOptionsSchema: z.ZodObject<{
|
|
395
395
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
396
396
|
events: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
397
|
-
voiceStart: "voiceStart";
|
|
398
|
-
voiceStop: "voiceStop";
|
|
399
397
|
error: "error";
|
|
400
398
|
messageReceived: "messageReceived";
|
|
401
399
|
messageSent: "messageSent";
|
|
400
|
+
voiceStart: "voiceStart";
|
|
401
|
+
voiceStop: "voiceStop";
|
|
402
402
|
}> & z.core.$partial, z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
403
403
|
}, z.core.$loose>;
|
|
404
404
|
type HapticsOptions = z.infer<typeof hapticsOptionsSchema>;
|
|
@@ -407,21 +407,21 @@ declare const feedbackSchema: 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";
|
|
412
410
|
error: "error";
|
|
413
411
|
messageReceived: "messageReceived";
|
|
414
412
|
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
|
haptics: z.ZodOptional<z.ZodObject<{
|
|
418
418
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
419
419
|
events: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
420
|
-
voiceStart: "voiceStart";
|
|
421
|
-
voiceStop: "voiceStop";
|
|
422
420
|
error: "error";
|
|
423
421
|
messageReceived: "messageReceived";
|
|
424
422
|
messageSent: "messageSent";
|
|
423
|
+
voiceStart: "voiceStart";
|
|
424
|
+
voiceStop: "voiceStop";
|
|
425
425
|
}> & z.core.$partial, z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
426
426
|
}, z.core.$loose>>;
|
|
427
427
|
}, z.core.$loose>;
|
|
@@ -856,18 +856,18 @@ type I18nOptions = z.infer<typeof i18nSchema>;
|
|
|
856
856
|
*/
|
|
857
857
|
|
|
858
858
|
declare const moduleLayoutSchema: z.ZodEnum<{
|
|
859
|
-
home: "home";
|
|
860
859
|
chat: "chat";
|
|
861
860
|
help: "help";
|
|
861
|
+
home: "home";
|
|
862
862
|
news: "news";
|
|
863
863
|
}>;
|
|
864
864
|
type ModuleLayout = z.infer<typeof moduleLayoutSchema>;
|
|
865
865
|
declare const moduleSchema: z.ZodObject<{
|
|
866
866
|
label: z.ZodString;
|
|
867
867
|
layout: z.ZodEnum<{
|
|
868
|
-
home: "home";
|
|
869
868
|
chat: "chat";
|
|
870
869
|
help: "help";
|
|
870
|
+
home: "home";
|
|
871
871
|
news: "news";
|
|
872
872
|
}>;
|
|
873
873
|
contentTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -893,9 +893,9 @@ type ModuleOptions = z.infer<typeof moduleSchema>;
|
|
|
893
893
|
declare const modulesSchema: z.ZodArray<z.ZodObject<{
|
|
894
894
|
label: z.ZodString;
|
|
895
895
|
layout: z.ZodEnum<{
|
|
896
|
-
home: "home";
|
|
897
896
|
chat: "chat";
|
|
898
897
|
help: "help";
|
|
898
|
+
home: "home";
|
|
899
899
|
news: "news";
|
|
900
900
|
}>;
|
|
901
901
|
contentTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
package/web-component.mjs
CHANGED
|
@@ -1445,7 +1445,7 @@ function createAuth(opts) {
|
|
|
1445
1445
|
}
|
|
1446
1446
|
|
|
1447
1447
|
// src/core/version.ts
|
|
1448
|
-
var ELEMENTS_VERSION = true ? "0.46.
|
|
1448
|
+
var ELEMENTS_VERSION = true ? "0.46.2" : "0.0.0-dev";
|
|
1449
1449
|
var ELEMENTS_VERSION_PARAM = "_ev";
|
|
1450
1450
|
|
|
1451
1451
|
// src/stream/types.ts
|
|
@@ -1612,7 +1612,10 @@ var DEFAULT_PATHS = {
|
|
|
1612
1612
|
var CONTEXT_PARAM = "context";
|
|
1613
1613
|
function buildSendMessageRequest(params) {
|
|
1614
1614
|
const wire = params.messages.map((m) => ({
|
|
1615
|
-
id
|
|
1615
|
+
// Use the backend's id when known (adopted from the stream's `start` chunk)
|
|
1616
|
+
// so a resumed assistant message matches what the backend persisted; falls
|
|
1617
|
+
// back to the client id (user messages, pre-`start` shells).
|
|
1618
|
+
id: m.serverMessageId ?? m.id,
|
|
1616
1619
|
parts: messageToWireParts(m),
|
|
1617
1620
|
role: m.role,
|
|
1618
1621
|
// Internal clock is epoch ms; the wire speaks ISO-8601 (Mongo ISODate).
|
|
@@ -1640,6 +1643,12 @@ function normalizeToolRef(ref) {
|
|
|
1640
1643
|
function messageToWireParts(m) {
|
|
1641
1644
|
const out = [];
|
|
1642
1645
|
for (const p35 of m.parts) {
|
|
1646
|
+
if (p35.kind === "step-start") {
|
|
1647
|
+
out.push({ type: "step-start" });
|
|
1648
|
+
}
|
|
1649
|
+
if (p35.kind === "reasoning" && p35.text) {
|
|
1650
|
+
out.push({ type: "reasoning", text: p35.text, state: p35.done ? "done" : "streaming" });
|
|
1651
|
+
}
|
|
1643
1652
|
if (p35.kind === "text" && p35.text) {
|
|
1644
1653
|
out.push({ text: p35.text, type: "text" });
|
|
1645
1654
|
}
|
|
@@ -2340,6 +2349,7 @@ function toReactive(m) {
|
|
|
2340
2349
|
status: m.status,
|
|
2341
2350
|
errorText: m.errorText,
|
|
2342
2351
|
finishReason: m.finishReason,
|
|
2352
|
+
serverMessageId: m.serverMessageId,
|
|
2343
2353
|
attachments: m.attachments,
|
|
2344
2354
|
partsSig: signal(m.parts.map(partToReactive))
|
|
2345
2355
|
};
|
|
@@ -2349,6 +2359,17 @@ function fromWireMessage(w) {
|
|
|
2349
2359
|
if (part.type === "text") {
|
|
2350
2360
|
return { kind: "text", id: `${w.id}-t${i}`, textSig: signal(part.text), doneSig: signal(true) };
|
|
2351
2361
|
}
|
|
2362
|
+
if (part.type === "reasoning") {
|
|
2363
|
+
return {
|
|
2364
|
+
kind: "reasoning",
|
|
2365
|
+
id: `${w.id}-r${i}`,
|
|
2366
|
+
textSig: signal(part.text),
|
|
2367
|
+
doneSig: signal(part.state !== "streaming")
|
|
2368
|
+
};
|
|
2369
|
+
}
|
|
2370
|
+
if (part.type === "step-start") {
|
|
2371
|
+
return { kind: "step-start", id: `${w.id}-ss${i}` };
|
|
2372
|
+
}
|
|
2352
2373
|
if (part.type === "file") {
|
|
2353
2374
|
return { kind: "file", url: part.url, mediaType: part.mediaType };
|
|
2354
2375
|
}
|
|
@@ -2382,6 +2403,9 @@ function fromWireMessage(w) {
|
|
|
2382
2403
|
return {
|
|
2383
2404
|
id: w.id,
|
|
2384
2405
|
role: w.role,
|
|
2406
|
+
// On reload the wire `id` IS the backend's id — keep it as `serverMessageId`
|
|
2407
|
+
// too so a HITL re-POST after a reload still references the backend's message.
|
|
2408
|
+
serverMessageId: w.id,
|
|
2385
2409
|
// Real send time when the backend provides it; otherwise fall back to now
|
|
2386
2410
|
// (older backends) so the timestamp + day divider still render.
|
|
2387
2411
|
createdAt: parseWireDate(w.createdAt) ?? Date.now(),
|
|
@@ -2397,6 +2421,7 @@ function fromReactive(m) {
|
|
|
2397
2421
|
status: m.status,
|
|
2398
2422
|
errorText: m.errorText,
|
|
2399
2423
|
finishReason: m.finishReason,
|
|
2424
|
+
serverMessageId: m.serverMessageId,
|
|
2400
2425
|
attachments: m.attachments,
|
|
2401
2426
|
parts: m.partsSig.value.map(partFromReactive)
|
|
2402
2427
|
};
|
|
@@ -2467,9 +2492,13 @@ var StreamReducer = class {
|
|
|
2467
2492
|
if (!m) return;
|
|
2468
2493
|
switch (chunk.type) {
|
|
2469
2494
|
case "start":
|
|
2470
|
-
|
|
2495
|
+
if (chunk.messageId) m.serverMessageId = chunk.messageId;
|
|
2496
|
+
return;
|
|
2471
2497
|
case "finish-step":
|
|
2472
2498
|
return;
|
|
2499
|
+
case "start-step":
|
|
2500
|
+
appendPart(m, { kind: "step-start", id: `ss${m.partsSig.value.length}` });
|
|
2501
|
+
return;
|
|
2473
2502
|
case "finish":
|
|
2474
2503
|
log6.debug("finish", { reason: chunk.finishReason, canContinue: chunk.canContinue });
|
|
2475
2504
|
m.status = "complete";
|
|
@@ -5163,6 +5192,8 @@ function PartView({
|
|
|
5163
5192
|
tool
|
|
5164
5193
|
}) {
|
|
5165
5194
|
switch (part.kind) {
|
|
5195
|
+
case "step-start":
|
|
5196
|
+
return null;
|
|
5166
5197
|
case "text":
|
|
5167
5198
|
return /* @__PURE__ */ jsx17(MarkdownView, { textSig: part.textSig, doneSig: part.doneSig });
|
|
5168
5199
|
case "reasoning":
|
|
@@ -5228,6 +5259,7 @@ function partKey(part) {
|
|
|
5228
5259
|
switch (part.kind) {
|
|
5229
5260
|
case "text":
|
|
5230
5261
|
case "reasoning":
|
|
5262
|
+
case "step-start":
|
|
5231
5263
|
return `${part.kind}:${part.id}`;
|
|
5232
5264
|
case "tool":
|
|
5233
5265
|
return `tool:${part.toolCallId}`;
|
|
@@ -7371,8 +7403,10 @@ function App({ options, hostElement, bus }) {
|
|
|
7371
7403
|
const body = buildSendMessageRequest({
|
|
7372
7404
|
messages: thread.map(fromReactive),
|
|
7373
7405
|
conversationId: activeConversationId,
|
|
7374
|
-
// The assistant message being generated / resumed
|
|
7375
|
-
|
|
7406
|
+
// The assistant message being generated / resumed — prefer the id the
|
|
7407
|
+
// backend assigned (adopted from the `start` chunk) so a HITL re-POST
|
|
7408
|
+
// resumes the message the backend persisted, not the client-minted id.
|
|
7409
|
+
messageId: assistantMsg.serverMessageId ?? assistantMsg.id,
|
|
7376
7410
|
// textModel + imageModel are backend-only — selected per deployment.
|
|
7377
7411
|
tools: options.features.tools,
|
|
7378
7412
|
// Identity + preferences ride on every message — server may need
|