@helpai/elements 0.46.2 → 0.46.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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.2" : "0.0.0-dev";
33
+ var ELEMENTS_VERSION = true ? "0.46.3" : "0.0.0-dev";
34
34
  var ELEMENTS_VERSION_PARAM = "_ev";
35
35
 
36
36
  // src/i18n/strings.ts
@@ -2374,12 +2374,13 @@ function makeAssistantMessage() {
2374
2374
  };
2375
2375
  }
2376
2376
  function makeInstantWelcomeMessage(m) {
2377
+ const id = uuid7();
2377
2378
  return toReactive({
2378
- id: m.id,
2379
+ id,
2379
2380
  role: m.role,
2380
2381
  createdAt: Date.now(),
2381
2382
  status: "complete",
2382
- parts: [{ kind: "text", id: `${m.id}-t0`, text: m.text, done: true }]
2383
+ parts: [{ kind: "text", id: `${id}-t0`, text: m.text, done: true }]
2383
2384
  });
2384
2385
  }
2385
2386
  function toReactive(m) {
@@ -6961,6 +6962,9 @@ var p34 = BRAND.cssPrefix;
6961
6962
  function makeLocalizedWelcome(w, strings) {
6962
6963
  return makeInstantWelcomeMessage({ ...w, text: localizeText(strings, w.text) });
6963
6964
  }
6965
+ function firstText(m) {
6966
+ return m.partsSig.value.find((p35) => p35.kind === "text")?.textSig.value ?? "";
6967
+ }
6964
6968
  function allToolPartsSettled(msg) {
6965
6969
  const tools = msg.partsSig.value.filter((p35) => p35.kind === "tool");
6966
6970
  return tools.length > 0 && tools.every((p35) => {
@@ -7154,8 +7158,9 @@ function App({ options, hostElement, bus }) {
7154
7158
  (n) => n !== void 0
7155
7159
  );
7156
7160
  const welcomeAnchor = (timelineStamps.length ? Math.min(...timelineStamps) : Date.now()) - 1;
7157
- const loadedIds = new Set(loaded.map((m) => m.id));
7158
- const welcomeRows = (welcomeRef.current?.messages ?? []).filter((w) => !loadedIds.has(w.id)).map((w) => {
7161
+ const welcomeKey = (role, text) => `${role}|${text}`;
7162
+ const loadedKeys = new Set(loaded.map((m) => welcomeKey(m.role, firstText(m))));
7163
+ const welcomeRows = (welcomeRef.current?.messages ?? []).filter((w) => !loadedKeys.has(welcomeKey(w.role, localizeText(stringsRef.current, w.text)))).map((w) => {
7159
7164
  const row = makeLocalizedWelcome(w, stringsRef.current);
7160
7165
  row.createdAt = welcomeAnchor;
7161
7166
  return row;
package/package.json CHANGED
@@ -80,5 +80,5 @@
80
80
  ],
81
81
  "type": "module",
82
82
  "types": "./index.d.ts",
83
- "version": "0.46.2"
83
+ "version": "0.46.3"
84
84
  }
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.2" : "0.0.0-dev";
1448
+ var ELEMENTS_VERSION = true ? "0.46.3" : "0.0.0-dev";
1449
1449
  var ELEMENTS_VERSION_PARAM = "_ev";
1450
1450
 
1451
1451
  // src/stream/types.ts
@@ -2333,12 +2333,13 @@ function makeAssistantMessage() {
2333
2333
  };
2334
2334
  }
2335
2335
  function makeInstantWelcomeMessage(m) {
2336
+ const id = uuid7();
2336
2337
  return toReactive({
2337
- id: m.id,
2338
+ id,
2338
2339
  role: m.role,
2339
2340
  createdAt: Date.now(),
2340
2341
  status: "complete",
2341
- parts: [{ kind: "text", id: `${m.id}-t0`, text: m.text, done: true }]
2342
+ parts: [{ kind: "text", id: `${id}-t0`, text: m.text, done: true }]
2342
2343
  });
2343
2344
  }
2344
2345
  function toReactive(m) {
@@ -6920,6 +6921,9 @@ var p34 = BRAND.cssPrefix;
6920
6921
  function makeLocalizedWelcome(w, strings) {
6921
6922
  return makeInstantWelcomeMessage({ ...w, text: localizeText(strings, w.text) });
6922
6923
  }
6924
+ function firstText(m) {
6925
+ return m.partsSig.value.find((p35) => p35.kind === "text")?.textSig.value ?? "";
6926
+ }
6923
6927
  function allToolPartsSettled(msg) {
6924
6928
  const tools = msg.partsSig.value.filter((p35) => p35.kind === "tool");
6925
6929
  return tools.length > 0 && tools.every((p35) => {
@@ -7113,8 +7117,9 @@ function App({ options, hostElement, bus }) {
7113
7117
  (n) => n !== void 0
7114
7118
  );
7115
7119
  const welcomeAnchor = (timelineStamps.length ? Math.min(...timelineStamps) : Date.now()) - 1;
7116
- const loadedIds = new Set(loaded.map((m) => m.id));
7117
- const welcomeRows = (welcomeRef.current?.messages ?? []).filter((w) => !loadedIds.has(w.id)).map((w) => {
7120
+ const welcomeKey = (role, text) => `${role}|${text}`;
7121
+ const loadedKeys = new Set(loaded.map((m) => welcomeKey(m.role, firstText(m))));
7122
+ const welcomeRows = (welcomeRef.current?.messages ?? []).filter((w) => !loadedKeys.has(welcomeKey(w.role, localizeText(stringsRef.current, w.text)))).map((w) => {
7118
7123
  const row = makeLocalizedWelcome(w, stringsRef.current);
7119
7124
  row.createdAt = welcomeAnchor;
7120
7125
  return row;