@helpai/elements 0.50.3 → 0.50.4

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/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-C_jlXJAe.js';
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
@@ -29,7 +29,7 @@ var BRAND = {
29
29
  };
30
30
 
31
31
  // src/core/version.ts
32
- var ELEMENTS_VERSION = true ? "0.50.3" : "0.0.0-dev";
32
+ var ELEMENTS_VERSION = true ? "0.50.4" : "0.0.0-dev";
33
33
  var ELEMENTS_VERSION_PARAM = "_ev";
34
34
 
35
35
  // src/i18n/strings.ts
@@ -2876,12 +2876,44 @@ var StreamReducer = class {
2876
2876
  __publicField(this, "messagesSig", messagesSig);
2877
2877
  /** Currently-streaming assistant message; null when no stream is active. */
2878
2878
  __publicField(this, "active", null);
2879
+ /**
2880
+ * Text/reasoning parts still "open" in the CURRENT step, keyed `${kind}:${id}`.
2881
+ * Cleared per stream (`attach`) and per step boundary (`finish-step`) — exactly
2882
+ * like web-www's per-step `activeTextParts`. Lookups go through this map, NOT a
2883
+ * scan of the whole message, so a text id reused in a LATER step or in a resume
2884
+ * stream (e.g. the reply that continues after an approval pause) starts a NEW
2885
+ * part instead of merging into an earlier same-id part. Without it the
2886
+ * continuation text merges into the pre-tool text and renders ABOVE the tool
2887
+ * card (correct only after a reload, when the backend replays ordered parts).
2888
+ */
2889
+ __publicField(this, "openTextParts", /* @__PURE__ */ new Map());
2890
+ /** Monotonic counter for client-unique part ids (the React key). The backend
2891
+ * reuses chunk ids across steps/streams, so the chunk id alone is NOT a safe
2892
+ * key — two parts could share `txt-0` and collide. Part ids are client-only
2893
+ * (text/reasoning ids never ride the wire), so a counter is sufficient. */
2894
+ __publicField(this, "partSeq", 0);
2879
2895
  }
2880
2896
  attach(msg) {
2881
2897
  this.active = msg;
2898
+ this.openTextParts.clear();
2882
2899
  }
2883
2900
  detach() {
2884
2901
  this.active = null;
2902
+ this.openTextParts.clear();
2903
+ }
2904
+ /**
2905
+ * Find-or-create the open text/reasoning part for `id` within the current step.
2906
+ * Scoped to {@link openTextParts} (reset on step/stream boundaries) so parts
2907
+ * never merge across a tool/resume boundary. Mirrors www's `ensureTextPart`.
2908
+ */
2909
+ ensureTextPart(m, kind, id) {
2910
+ const key = `${kind}:${id}`;
2911
+ const existing = this.openTextParts.get(key);
2912
+ if (existing) return existing;
2913
+ const part = { kind, id: `${id}#${this.partSeq++}`, textSig: signal2(""), doneSig: signal2(false) };
2914
+ this.openTextParts.set(key, part);
2915
+ appendPart(m, part);
2916
+ return part;
2885
2917
  }
2886
2918
  apply(chunk) {
2887
2919
  const m = this.active;
@@ -2891,6 +2923,7 @@ var StreamReducer = class {
2891
2923
  if (chunk.messageId) m.serverMessageId = chunk.messageId;
2892
2924
  return;
2893
2925
  case "finish-step":
2926
+ this.openTextParts.clear();
2894
2927
  return;
2895
2928
  case "start-step":
2896
2929
  appendPart(m, { kind: "step-start", id: `ss${m.partsSig.value.length}` });
@@ -2908,26 +2941,26 @@ var StreamReducer = class {
2908
2941
  this.bumpDone(m);
2909
2942
  return;
2910
2943
  case "text-start":
2911
- ensureTextPart(m, "text", chunk.id);
2944
+ this.ensureTextPart(m, "text", chunk.id);
2912
2945
  return;
2913
2946
  case "text-delta": {
2914
- const p36 = ensureTextPart(m, "text", chunk.id);
2947
+ const p36 = this.ensureTextPart(m, "text", chunk.id);
2915
2948
  p36.textSig.value += chunk.delta;
2916
2949
  return;
2917
2950
  }
2918
2951
  case "text-end":
2919
- ensureTextPart(m, "text", chunk.id).doneSig.value = true;
2952
+ this.ensureTextPart(m, "text", chunk.id).doneSig.value = true;
2920
2953
  return;
2921
2954
  case "reasoning-start":
2922
- ensureTextPart(m, "reasoning", chunk.id).doneSig.value = false;
2955
+ this.ensureTextPart(m, "reasoning", chunk.id).doneSig.value = false;
2923
2956
  return;
2924
2957
  case "reasoning-delta": {
2925
- const p36 = ensureTextPart(m, "reasoning", chunk.id);
2958
+ const p36 = this.ensureTextPart(m, "reasoning", chunk.id);
2926
2959
  p36.textSig.value += chunk.delta;
2927
2960
  return;
2928
2961
  }
2929
2962
  case "reasoning-end":
2930
- ensureTextPart(m, "reasoning", chunk.id).doneSig.value = true;
2963
+ this.ensureTextPart(m, "reasoning", chunk.id).doneSig.value = true;
2931
2964
  return;
2932
2965
  case "tool-input-start":
2933
2966
  case "tool-input-delta":
@@ -2972,13 +3005,6 @@ var StreamReducer = class {
2972
3005
  this.messagesSig.value = [...this.messagesSig.value];
2973
3006
  }
2974
3007
  };
2975
- function ensureTextPart(m, kind, id) {
2976
- const existing = m.partsSig.value.find((p36) => p36.kind === kind && p36.id === id);
2977
- if (existing) return existing;
2978
- const part = { kind, id, textSig: signal2(""), doneSig: signal2(false) };
2979
- appendPart(m, part);
2980
- return part;
2981
- }
2982
3008
  function ensureToolPart(m, toolCallId, toolName2) {
2983
3009
  const existing = m.partsSig.value.find((p36) => p36.kind === "tool" && p36.toolCallId === toolCallId);
2984
3010
  if (existing) return existing;
package/package.json CHANGED
@@ -80,5 +80,5 @@
80
80
  ],
81
81
  "type": "module",
82
82
  "types": "./index.d.ts",
83
- "version": "0.50.3"
83
+ "version": "0.50.4"
84
84
  }
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-C_jlXJAe.js';
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
- clear: "clear";
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
- clear: "clear";
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
- clear: "clear";
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
@@ -1794,7 +1794,7 @@ function createAuth(opts) {
1794
1794
  }
1795
1795
 
1796
1796
  // src/core/version.ts
1797
- var ELEMENTS_VERSION = true ? "0.50.3" : "0.0.0-dev";
1797
+ var ELEMENTS_VERSION = true ? "0.50.4" : "0.0.0-dev";
1798
1798
  var ELEMENTS_VERSION_PARAM = "_ev";
1799
1799
 
1800
1800
  // src/stream/types.ts
@@ -2835,12 +2835,44 @@ var StreamReducer = class {
2835
2835
  __publicField(this, "messagesSig", messagesSig);
2836
2836
  /** Currently-streaming assistant message; null when no stream is active. */
2837
2837
  __publicField(this, "active", null);
2838
+ /**
2839
+ * Text/reasoning parts still "open" in the CURRENT step, keyed `${kind}:${id}`.
2840
+ * Cleared per stream (`attach`) and per step boundary (`finish-step`) — exactly
2841
+ * like web-www's per-step `activeTextParts`. Lookups go through this map, NOT a
2842
+ * scan of the whole message, so a text id reused in a LATER step or in a resume
2843
+ * stream (e.g. the reply that continues after an approval pause) starts a NEW
2844
+ * part instead of merging into an earlier same-id part. Without it the
2845
+ * continuation text merges into the pre-tool text and renders ABOVE the tool
2846
+ * card (correct only after a reload, when the backend replays ordered parts).
2847
+ */
2848
+ __publicField(this, "openTextParts", /* @__PURE__ */ new Map());
2849
+ /** Monotonic counter for client-unique part ids (the React key). The backend
2850
+ * reuses chunk ids across steps/streams, so the chunk id alone is NOT a safe
2851
+ * key — two parts could share `txt-0` and collide. Part ids are client-only
2852
+ * (text/reasoning ids never ride the wire), so a counter is sufficient. */
2853
+ __publicField(this, "partSeq", 0);
2838
2854
  }
2839
2855
  attach(msg) {
2840
2856
  this.active = msg;
2857
+ this.openTextParts.clear();
2841
2858
  }
2842
2859
  detach() {
2843
2860
  this.active = null;
2861
+ this.openTextParts.clear();
2862
+ }
2863
+ /**
2864
+ * Find-or-create the open text/reasoning part for `id` within the current step.
2865
+ * Scoped to {@link openTextParts} (reset on step/stream boundaries) so parts
2866
+ * never merge across a tool/resume boundary. Mirrors www's `ensureTextPart`.
2867
+ */
2868
+ ensureTextPart(m, kind, id) {
2869
+ const key = `${kind}:${id}`;
2870
+ const existing = this.openTextParts.get(key);
2871
+ if (existing) return existing;
2872
+ const part = { kind, id: `${id}#${this.partSeq++}`, textSig: signal2(""), doneSig: signal2(false) };
2873
+ this.openTextParts.set(key, part);
2874
+ appendPart(m, part);
2875
+ return part;
2844
2876
  }
2845
2877
  apply(chunk) {
2846
2878
  const m = this.active;
@@ -2850,6 +2882,7 @@ var StreamReducer = class {
2850
2882
  if (chunk.messageId) m.serverMessageId = chunk.messageId;
2851
2883
  return;
2852
2884
  case "finish-step":
2885
+ this.openTextParts.clear();
2853
2886
  return;
2854
2887
  case "start-step":
2855
2888
  appendPart(m, { kind: "step-start", id: `ss${m.partsSig.value.length}` });
@@ -2867,26 +2900,26 @@ var StreamReducer = class {
2867
2900
  this.bumpDone(m);
2868
2901
  return;
2869
2902
  case "text-start":
2870
- ensureTextPart(m, "text", chunk.id);
2903
+ this.ensureTextPart(m, "text", chunk.id);
2871
2904
  return;
2872
2905
  case "text-delta": {
2873
- const p36 = ensureTextPart(m, "text", chunk.id);
2906
+ const p36 = this.ensureTextPart(m, "text", chunk.id);
2874
2907
  p36.textSig.value += chunk.delta;
2875
2908
  return;
2876
2909
  }
2877
2910
  case "text-end":
2878
- ensureTextPart(m, "text", chunk.id).doneSig.value = true;
2911
+ this.ensureTextPart(m, "text", chunk.id).doneSig.value = true;
2879
2912
  return;
2880
2913
  case "reasoning-start":
2881
- ensureTextPart(m, "reasoning", chunk.id).doneSig.value = false;
2914
+ this.ensureTextPart(m, "reasoning", chunk.id).doneSig.value = false;
2882
2915
  return;
2883
2916
  case "reasoning-delta": {
2884
- const p36 = ensureTextPart(m, "reasoning", chunk.id);
2917
+ const p36 = this.ensureTextPart(m, "reasoning", chunk.id);
2885
2918
  p36.textSig.value += chunk.delta;
2886
2919
  return;
2887
2920
  }
2888
2921
  case "reasoning-end":
2889
- ensureTextPart(m, "reasoning", chunk.id).doneSig.value = true;
2922
+ this.ensureTextPart(m, "reasoning", chunk.id).doneSig.value = true;
2890
2923
  return;
2891
2924
  case "tool-input-start":
2892
2925
  case "tool-input-delta":
@@ -2931,13 +2964,6 @@ var StreamReducer = class {
2931
2964
  this.messagesSig.value = [...this.messagesSig.value];
2932
2965
  }
2933
2966
  };
2934
- function ensureTextPart(m, kind, id) {
2935
- const existing = m.partsSig.value.find((p36) => p36.kind === kind && p36.id === id);
2936
- if (existing) return existing;
2937
- const part = { kind, id, textSig: signal2(""), doneSig: signal2(false) };
2938
- appendPart(m, part);
2939
- return part;
2940
- }
2941
2967
  function ensureToolPart(m, toolCallId, toolName2) {
2942
2968
  const existing = m.partsSig.value.find((p36) => p36.kind === "tool" && p36.toolCallId === toolCallId);
2943
2969
  if (existing) return existing;