@asgard-js/core 0.3.60 → 0.3.61

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/dist/index.mjs CHANGED
@@ -150,16 +150,16 @@ function Ee(n, t) {
150
150
  var V;
151
151
  p = new AbortController();
152
152
  try {
153
- const D = await Ye(n, Object.assign(Object.assign({}, h), { headers: d, signal: p.signal }));
154
- await We(D), await ze(D.body, Je(Qe((C) => {
153
+ const H = await Ye(n, Object.assign(Object.assign({}, h), { headers: d, signal: p.signal }));
154
+ await We(H), await ze(H.body, Je(Qe((C) => {
155
155
  C ? d[le] = C : delete d[le];
156
156
  }, (C) => {
157
157
  L = C;
158
158
  }, o))), i?.(), _(), m();
159
- } catch (D) {
159
+ } catch (H) {
160
160
  if (!p.signal.aborted)
161
161
  try {
162
- const C = (V = a?.(D)) !== null && V !== void 0 ? V : L;
162
+ const C = (V = a?.(H)) !== null && V !== void 0 ? V : L;
163
163
  window.clearTimeout(E), E = window.setTimeout(X, C);
164
164
  } catch (C) {
165
165
  _(), v(C);
@@ -287,7 +287,7 @@ function N(n) {
287
287
  };
288
288
  throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
289
289
  }
290
- function F(n, t) {
290
+ function D(n, t) {
291
291
  var e = typeof Symbol == "function" && n[Symbol.iterator];
292
292
  if (!e) return n;
293
293
  var r = e.call(n), s, o = [], i;
@@ -304,7 +304,7 @@ function F(n, t) {
304
304
  }
305
305
  return o;
306
306
  }
307
- function H(n, t, e) {
307
+ function F(n, t, e) {
308
308
  if (e || arguments.length === 2) for (var r = 0, s = t.length, o; r < s; r++)
309
309
  (o || !(r in t)) && (o || (o = Array.prototype.slice.call(t, 0, r)), o[r] = t[r]);
310
310
  return n.concat(o || Array.prototype.slice.call(t));
@@ -436,7 +436,7 @@ var j = (function() {
436
436
  try {
437
437
  de(p);
438
438
  } catch (f) {
439
- o = o ?? [], f instanceof z ? o = H(H([], F(o)), F(f.errors)) : o.push(f);
439
+ o = o ?? [], f instanceof z ? o = F(F([], D(o)), D(f.errors)) : o.push(f);
440
440
  }
441
441
  }
442
442
  } catch (f) {
@@ -494,7 +494,7 @@ var it = {
494
494
  setTimeout: function(n, t) {
495
495
  for (var e = [], r = 2; r < arguments.length; r++)
496
496
  e[r - 2] = arguments[r];
497
- return setTimeout.apply(void 0, H([n, t], F(e)));
497
+ return setTimeout.apply(void 0, F([n, t], D(e)));
498
498
  },
499
499
  clearTimeout: function(n) {
500
500
  return clearTimeout(n);
@@ -874,7 +874,7 @@ var mt = (function(n) {
874
874
  setInterval: function(n, t) {
875
875
  for (var e = [], r = 2; r < arguments.length; r++)
876
876
  e[r - 2] = arguments[r];
877
- return setInterval.apply(void 0, H([n, t], F(e)));
877
+ return setInterval.apply(void 0, F([n, t], D(e)));
878
878
  },
879
879
  clearInterval: function(n) {
880
880
  return clearInterval(n);
@@ -991,7 +991,7 @@ var je = Tt();
991
991
  function $e(n) {
992
992
  return g(n?.[je]);
993
993
  }
994
- function Fe(n) {
994
+ function De(n) {
995
995
  return st(this, arguments, function() {
996
996
  var e, r, s, o;
997
997
  return Ie(this, function(i) {
@@ -1022,7 +1022,7 @@ function Fe(n) {
1022
1022
  });
1023
1023
  });
1024
1024
  }
1025
- function He(n) {
1025
+ function Fe(n) {
1026
1026
  return g(n?.getReader);
1027
1027
  }
1028
1028
  function U(n) {
@@ -1036,10 +1036,10 @@ function U(n) {
1036
1036
  if (Me(n))
1037
1037
  return Ot(n);
1038
1038
  if (Ne(n))
1039
- return De(n);
1039
+ return He(n);
1040
1040
  if ($e(n))
1041
1041
  return At(n);
1042
- if (He(n))
1042
+ if (Fe(n))
1043
1043
  return Pt(n);
1044
1044
  }
1045
1045
  throw Re(n);
@@ -1089,7 +1089,7 @@ function At(n) {
1089
1089
  t.complete();
1090
1090
  });
1091
1091
  }
1092
- function De(n) {
1092
+ function He(n) {
1093
1093
  return new S(function(t) {
1094
1094
  Lt(n, t).catch(function(e) {
1095
1095
  return t.error(e);
@@ -1097,7 +1097,7 @@ function De(n) {
1097
1097
  });
1098
1098
  }
1099
1099
  function Pt(n) {
1100
- return De(Fe(n));
1100
+ return He(De(n));
1101
1101
  }
1102
1102
  function Lt(n, t) {
1103
1103
  var e, r, s, o;
@@ -1217,7 +1217,7 @@ function qe(n, t) {
1217
1217
  });
1218
1218
  }
1219
1219
  function Nt(n, t) {
1220
- return qe(Fe(n), t);
1220
+ return qe(De(n), t);
1221
1221
  }
1222
1222
  function Rt(n, t) {
1223
1223
  if (n != null) {
@@ -1231,7 +1231,7 @@ function Rt(n, t) {
1231
1231
  return qe(n, t);
1232
1232
  if ($e(n))
1233
1233
  return kt(n, t);
1234
- if (He(n))
1234
+ if (Fe(n))
1235
1235
  return Nt(n, t);
1236
1236
  }
1237
1237
  throw Re(n);
@@ -1256,13 +1256,13 @@ function R(n, t) {
1256
1256
  }));
1257
1257
  });
1258
1258
  }
1259
- var Ft = Array.isArray;
1260
- function Ht(n, t) {
1261
- return Ft(t) ? n.apply(void 0, H([], F(t))) : n(t);
1259
+ var Dt = Array.isArray;
1260
+ function Ft(n, t) {
1261
+ return Dt(t) ? n.apply(void 0, F([], D(t))) : n(t);
1262
1262
  }
1263
- function Dt(n) {
1263
+ function Ht(n) {
1264
1264
  return R(function(t) {
1265
- return Ht(n, t);
1265
+ return Ft(n, t);
1266
1266
  });
1267
1267
  }
1268
1268
  var Bt = Array.isArray, Gt = Object.getPrototypeOf, qt = Object.prototype, Kt = Object.keys;
@@ -1300,7 +1300,7 @@ function Vt() {
1300
1300
  var a = new S(zt(o, e, i ? function(c) {
1301
1301
  return Xt(i, c);
1302
1302
  } : W));
1303
- return r ? a.pipe(Dt(r)) : a;
1303
+ return r ? a.pipe(Ht(r)) : a;
1304
1304
  }
1305
1305
  function zt(n, t, e) {
1306
1306
  return e === void 0 && (e = W), function(r) {
@@ -2104,6 +2104,7 @@ class b {
2104
2104
  typingText: "",
2105
2105
  messageId: e.messageId,
2106
2106
  message: e,
2107
+ time: /* @__PURE__ */ new Date(),
2107
2108
  traceId: t.traceId,
2108
2109
  raw: ""
2109
2110
  }), new b({ messages: r, pendingConsent: this.pendingConsent });
@@ -2121,6 +2122,7 @@ class b {
2121
2122
  typingText: `${s?.typingText ?? ""}${e.text}`,
2122
2123
  messageId: e.messageId,
2123
2124
  message: e,
2125
+ time: /* @__PURE__ */ new Date(),
2124
2126
  traceId: t.traceId ?? s?.traceId,
2125
2127
  raw: s?.raw ?? ""
2126
2128
  }), new b({ messages: o, pendingConsent: this.pendingConsent });
@@ -2136,6 +2138,7 @@ class b {
2136
2138
  typingText: null,
2137
2139
  messageId: e.messageId,
2138
2140
  message: e,
2141
+ time: /* @__PURE__ */ new Date(),
2139
2142
  traceId: t.traceId ?? (s?.type === "bot" ? s.traceId : void 0),
2140
2143
  raw: JSON.stringify(t)
2141
2144
  }), new b({ messages: r, pendingConsent: this.pendingConsent });
@@ -2149,6 +2152,7 @@ class b {
2149
2152
  messageId: e.messageId,
2150
2153
  text: e.text,
2151
2154
  isThinking: !0,
2155
+ time: /* @__PURE__ */ new Date(),
2152
2156
  traceId: t.traceId
2153
2157
  };
2154
2158
  return r.set(e.messageId, s), new b({ messages: r, pendingConsent: this.pendingConsent });
@@ -2163,6 +2167,7 @@ class b {
2163
2167
  messageId: e.messageId,
2164
2168
  text: `${s?.text ?? ""}${e.text}`,
2165
2169
  isThinking: !0,
2170
+ time: s?.time ?? /* @__PURE__ */ new Date(),
2166
2171
  traceId: t.traceId ?? s?.traceId
2167
2172
  };
2168
2173
  return o.set(e.messageId, i), new b({ messages: o, pendingConsent: this.pendingConsent });
@@ -2177,6 +2182,7 @@ class b {
2177
2182
  // replay (no start/delta) still renders the whole text.
2178
2183
  text: e.text,
2179
2184
  isThinking: !1,
2185
+ time: s?.time ?? /* @__PURE__ */ new Date(),
2180
2186
  traceId: t.traceId ?? s?.traceId
2181
2187
  };
2182
2188
  return o.set(e.messageId, i), new b({ messages: o, pendingConsent: this.pendingConsent });
@@ -2191,6 +2197,7 @@ class b {
2191
2197
  blobIds: e.blobIds,
2192
2198
  customMessageId: e.customMessageId,
2193
2199
  identityHint: e.identityHint,
2200
+ time: /* @__PURE__ */ new Date(),
2194
2201
  traceId: t.traceId
2195
2202
  };
2196
2203
  return s.set(e.messageId, o), new b({ messages: s, pendingConsent: this.pendingConsent });
@@ -2202,6 +2209,7 @@ class b {
2202
2209
  eventType: l.ERROR,
2203
2210
  messageId: e,
2204
2211
  error: r,
2212
+ time: /* @__PURE__ */ new Date(),
2205
2213
  traceId: t.traceId
2206
2214
  }), new b({ messages: s, pendingConsent: this.pendingConsent });
2207
2215
  }
@@ -2221,6 +2229,7 @@ class b {
2221
2229
  toolUseId: e.toolUseId,
2222
2230
  parentToolUseId: e.parentToolUseId,
2223
2231
  isComplete: !1,
2232
+ time: /* @__PURE__ */ new Date(),
2224
2233
  traceId: t.traceId
2225
2234
  };
2226
2235
  return r.set(s, o), new b({ messages: r, pendingConsent: this.pendingConsent });
@@ -2255,6 +2264,7 @@ class b {
2255
2264
  isError: e.isError,
2256
2265
  sidecar: e.toolUseResultSidecar,
2257
2266
  isComplete: !0,
2267
+ time: /* @__PURE__ */ new Date(),
2258
2268
  traceId: t.traceId
2259
2269
  };
2260
2270
  r.set(s, i);
@@ -2274,6 +2284,7 @@ class b {
2274
2284
  agentId: e.agentId,
2275
2285
  subagentType: e.subagentType,
2276
2286
  description: e.description,
2287
+ time: /* @__PURE__ */ new Date(),
2277
2288
  traceId: t.traceId
2278
2289
  };
2279
2290
  return r.delete(s), r.set(s, o), new b({ messages: r, pendingConsent: this.pendingConsent });
@@ -2288,6 +2299,7 @@ class b {
2288
2299
  subagentType: e.subagentType,
2289
2300
  status: e.status,
2290
2301
  summary: e.summary,
2302
+ time: /* @__PURE__ */ new Date(),
2291
2303
  traceId: t.traceId
2292
2304
  };
2293
2305
  return r.delete(s), r.set(s, o), new b({ messages: r, pendingConsent: this.pendingConsent });
@@ -2792,7 +2804,8 @@ class q {
2792
2804
  text: o,
2793
2805
  blobIds: t.blobIds,
2794
2806
  filePreviewUrls: t.filePreviewUrls,
2795
- documentNames: t.documentNames
2807
+ documentNames: t.documentNames,
2808
+ time: /* @__PURE__ */ new Date()
2796
2809
  })
2797
2810
  ), this.fetchSse(
2798
2811
  "user",