@assistant-ui/react 0.5.33 → 0.5.35

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.mjs CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  toLanguageModelMessages,
10
10
  toLanguageModelTools,
11
11
  toolResultStream
12
- } from "./chunk-DXLSOE2J.mjs";
12
+ } from "./chunk-LX7F2T2K.mjs";
13
13
  import {
14
14
  __export
15
15
  } from "./chunk-BJPOCE4O.mjs";
@@ -1142,19 +1142,40 @@ var LocalThreadRuntime = class {
1142
1142
  this.abortController?.abort();
1143
1143
  this.abortController = new AbortController();
1144
1144
  const initialContent = message.content;
1145
- const initialRoundtrips = message.roundtrips;
1145
+ const initialRoundtrips = message.metadata?.roundtrips;
1146
+ const initalCustom = message.metadata?.custom;
1146
1147
  const updateMessage = (m) => {
1147
1148
  message = {
1148
1149
  ...message,
1149
1150
  ...m.content ? { content: [...initialContent, ...m.content ?? []] } : void 0,
1150
1151
  status: m.status ?? message.status,
1151
- ...m.roundtrips?.length ? { roundtrips: [...initialRoundtrips ?? [], ...m.roundtrips] } : void 0
1152
+ // TODO deprecated, remove in v0.6
1153
+ ...m.metadata?.roundtrips ? {
1154
+ roundtrips: [
1155
+ ...initialRoundtrips ?? [],
1156
+ ...m.metadata.roundtrips
1157
+ ]
1158
+ } : void 0,
1159
+ ...m.metadata ? {
1160
+ metadata: {
1161
+ ...message.metadata,
1162
+ ...m.metadata.roundtrips ? {
1163
+ roundtrips: [
1164
+ ...initialRoundtrips ?? [],
1165
+ ...m.metadata.roundtrips
1166
+ ]
1167
+ } : void 0,
1168
+ ...m.metadata?.custom ? {
1169
+ custom: { ...initalCustom ?? {}, ...m.metadata.custom }
1170
+ } : void 0
1171
+ }
1172
+ } : void 0
1152
1173
  };
1153
1174
  this.repository.addOrUpdateMessage(parentId, message);
1154
1175
  this.notifySubscribers();
1155
1176
  };
1156
1177
  const maxToolRoundtrips = this.options?.maxToolRoundtrips ?? 1;
1157
- const toolRoundtrips = message.roundtrips?.length ?? 0;
1178
+ const toolRoundtrips = message.metadata?.roundtrips?.length ?? 0;
1158
1179
  if (toolRoundtrips > maxToolRoundtrips) {
1159
1180
  updateMessage({
1160
1181
  status: {