@asgard-js/core 0.3.12 → 0.3.13

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
@@ -228,7 +228,7 @@ function F(n, t) {
228
228
  0 <= e && n.splice(e, 1);
229
229
  }
230
230
  }
231
- var U = (function() {
231
+ var N = (function() {
232
232
  function n(t) {
233
233
  this.initialTeardown = t, this.closed = !1, this._parentage = null, this._finalizers = null;
234
234
  }
@@ -316,9 +316,9 @@ var U = (function() {
316
316
  var t = new n();
317
317
  return t.closed = !0, t;
318
318
  })(), n;
319
- })(), be = U.EMPTY;
319
+ })(), be = N.EMPTY;
320
320
  function Se(n) {
321
- return n instanceof U || n && "closed" in n && m(n.remove) && m(n.add) && m(n.unsubscribe);
321
+ return n instanceof N || n && "closed" in n && m(n.remove) && m(n.add) && m(n.unsubscribe);
322
322
  }
323
323
  function oe(n) {
324
324
  m(n) ? n() : n.unsubscribe();
@@ -377,7 +377,7 @@ var ne = (function(n) {
377
377
  this.unsubscribe();
378
378
  }
379
379
  }, t;
380
- })(U), We = (function() {
380
+ })(N), We = (function() {
381
381
  function n(t) {
382
382
  this.partialObserver = t;
383
383
  }
@@ -639,7 +639,7 @@ var nt = (function(n) {
639
639
  return this._throwIfClosed(), this._checkFinalizedStatuses(e), this._innerSubscribe(e);
640
640
  }, t.prototype._innerSubscribe = function(e) {
641
641
  var r = this, s = this, i = s.hasError, o = s.isStopped, a = s.observers;
642
- return i || o ? be : (this.currentObservers = null, a.push(e), new U(function() {
642
+ return i || o ? be : (this.currentObservers = null, a.push(e), new N(function() {
643
643
  r.currentObservers = null, F(a, e);
644
644
  }));
645
645
  }, t.prototype._checkFinalizedStatuses = function(e) {
@@ -705,7 +705,7 @@ var nt = (function(n) {
705
705
  return t.prototype.schedule = function(e, r) {
706
706
  return this;
707
707
  }, t;
708
- })(U), ue = {
708
+ })(N), ue = {
709
709
  setInterval: function(n, t) {
710
710
  for (var e = [], r = 2; r < arguments.length; r++)
711
711
  e[r - 2] = arguments[r];
@@ -857,7 +857,7 @@ function ke(n) {
857
857
  });
858
858
  });
859
859
  }
860
- function Ne(n) {
860
+ function Ue(n) {
861
861
  return m(n?.getReader);
862
862
  }
863
863
  function M(n) {
@@ -871,10 +871,10 @@ function M(n) {
871
871
  if (Ae(n))
872
872
  return pt(n);
873
873
  if (xe(n))
874
- return Ue(n);
874
+ return Ne(n);
875
875
  if (Le(n))
876
876
  return gt(n);
877
- if (Ne(n))
877
+ if (Ue(n))
878
878
  return mt(n);
879
879
  }
880
880
  throw Me(n);
@@ -924,7 +924,7 @@ function gt(n) {
924
924
  t.complete();
925
925
  });
926
926
  }
927
- function Ue(n) {
927
+ function Ne(n) {
928
928
  return new S(function(t) {
929
929
  vt(n, t).catch(function(e) {
930
930
  return t.error(e);
@@ -932,7 +932,7 @@ function Ue(n) {
932
932
  });
933
933
  }
934
934
  function mt(n) {
935
- return Ue(ke(n));
935
+ return Ne(ke(n));
936
936
  }
937
937
  function vt(n, t) {
938
938
  var e, r, s, i;
@@ -1066,7 +1066,7 @@ function wt(n, t) {
1066
1066
  return je(n, t);
1067
1067
  if (Le(n))
1068
1068
  return It(n, t);
1069
- if (Ne(n))
1069
+ if (Ue(n))
1070
1070
  return Et(n, t);
1071
1071
  }
1072
1072
  throw Me(n);
@@ -1083,7 +1083,7 @@ function Tt() {
1083
1083
  function Ct(n) {
1084
1084
  return n instanceof Date && !isNaN(n);
1085
1085
  }
1086
- function N(n, t) {
1086
+ function U(n, t) {
1087
1087
  return A(function(e, r) {
1088
1088
  var s = 0;
1089
1089
  e.subscribe(O(r, function(i) {
@@ -1096,7 +1096,7 @@ function At(n, t) {
1096
1096
  return Ot(t) ? n.apply(void 0, $([], R(t))) : n(t);
1097
1097
  }
1098
1098
  function _t(n) {
1099
- return N(function(t) {
1099
+ return U(function(t) {
1100
1100
  return At(n, t);
1101
1101
  });
1102
1102
  }
@@ -1106,7 +1106,7 @@ function kt(n) {
1106
1106
  var t = n[0];
1107
1107
  if (xt(t))
1108
1108
  return { args: t, keys: null };
1109
- if (Nt(t)) {
1109
+ if (Ut(t)) {
1110
1110
  var e = Lt(t);
1111
1111
  return {
1112
1112
  args: e.map(function(r) {
@@ -1118,10 +1118,10 @@ function kt(n) {
1118
1118
  }
1119
1119
  return { args: n, keys: null };
1120
1120
  }
1121
- function Nt(n) {
1121
+ function Ut(n) {
1122
1122
  return n && typeof n == "object" && Mt(n) === Pt;
1123
1123
  }
1124
- function Ut(n, t) {
1124
+ function Nt(n, t) {
1125
1125
  return n.reduce(function(e, r, s) {
1126
1126
  return e[r] = t[s], e;
1127
1127
  }, {});
@@ -1133,7 +1133,7 @@ function Rt() {
1133
1133
  if (i.length === 0)
1134
1134
  return ie([], e);
1135
1135
  var a = new S($t(i, e, o ? function(u) {
1136
- return Ut(o, u);
1136
+ return Nt(o, u);
1137
1137
  } : q));
1138
1138
  return r ? a.pipe(_t(r)) : a;
1139
1139
  }
@@ -1191,7 +1191,7 @@ function jt(n, t, e, r, s, i, o, a) {
1191
1191
  }
1192
1192
  function B(n, t, e) {
1193
1193
  return e === void 0 && (e = 1 / 0), m(t) ? B(function(r, s) {
1194
- return N(function(i, o) {
1194
+ return U(function(i, o) {
1195
1195
  return t(r, i, s, o);
1196
1196
  })(M(n(r, s)));
1197
1197
  }, e) : (typeof t == "number" && (e = t), A(function(r, s) {
@@ -1224,7 +1224,7 @@ function Gt(n) {
1224
1224
  });
1225
1225
  }
1226
1226
  function Kt(n) {
1227
- return N(function() {
1227
+ return U(function() {
1228
1228
  return n;
1229
1229
  });
1230
1230
  }
@@ -1817,6 +1817,7 @@ class y {
1817
1817
  }
1818
1818
  onMessageStart(t) {
1819
1819
  const e = t.fact.messageStart.message;
1820
+ if (e.parentToolUseId) return this;
1820
1821
  if (this.isTerminalBot(this.messages?.get(e.messageId))) return this;
1821
1822
  const r = new Map(this.messages);
1822
1823
  return r.set(e.messageId, {
@@ -1832,7 +1833,9 @@ class y {
1832
1833
  }), new y({ messages: r, pendingConsent: this.pendingConsent });
1833
1834
  }
1834
1835
  onMessageDelta(t) {
1835
- const e = t.fact.messageDelta.message, r = this.messages?.get(e.messageId);
1836
+ const e = t.fact.messageDelta.message;
1837
+ if (e.parentToolUseId) return this;
1838
+ const r = this.messages?.get(e.messageId);
1836
1839
  if (this.isTerminalBot(r)) return this;
1837
1840
  const s = r?.type === "bot" ? r : void 0, i = new Map(this.messages);
1838
1841
  return i.set(e.messageId, {
@@ -1848,7 +1851,9 @@ class y {
1848
1851
  }), new y({ messages: i, pendingConsent: this.pendingConsent });
1849
1852
  }
1850
1853
  onMessageComplete(t) {
1851
- const e = t.fact.messageComplete.message, r = new Map(this.messages), s = r.get(e.messageId);
1854
+ const e = t.fact.messageComplete.message;
1855
+ if (e.parentToolUseId) return this;
1856
+ const r = new Map(this.messages), s = r.get(e.messageId);
1852
1857
  return r.set(e.messageId, {
1853
1858
  type: "bot",
1854
1859
  eventType: d.MESSAGE_COMPLETE,
@@ -1863,6 +1868,7 @@ class y {
1863
1868
  }
1864
1869
  onThinkingStart(t) {
1865
1870
  const e = t.fact.messageThinkingStart.message;
1871
+ if (e.parentToolUseId) return this;
1866
1872
  if (this.isTerminalThinking(this.messages?.get(e.messageId))) return this;
1867
1873
  const r = new Map(this.messages), s = {
1868
1874
  type: "thinking",
@@ -1875,7 +1881,9 @@ class y {
1875
1881
  return r.set(e.messageId, s), new y({ messages: r, pendingConsent: this.pendingConsent });
1876
1882
  }
1877
1883
  onThinkingDelta(t) {
1878
- const e = t.fact.messageThinkingDelta.message, r = this.messages?.get(e.messageId);
1884
+ const e = t.fact.messageThinkingDelta.message;
1885
+ if (e.parentToolUseId) return this;
1886
+ const r = this.messages?.get(e.messageId);
1879
1887
  if (this.isTerminalThinking(r)) return this;
1880
1888
  const s = r?.type === "thinking" ? r : void 0, i = new Map(this.messages), o = {
1881
1889
  type: "thinking",
@@ -1888,7 +1896,9 @@ class y {
1888
1896
  return i.set(e.messageId, o), new y({ messages: i, pendingConsent: this.pendingConsent });
1889
1897
  }
1890
1898
  onThinkingComplete(t) {
1891
- const e = t.fact.messageThinkingComplete.message, r = this.messages?.get(e.messageId), s = r?.type === "thinking" ? r : void 0, i = new Map(this.messages), o = {
1899
+ const e = t.fact.messageThinkingComplete.message;
1900
+ if (e.parentToolUseId) return this;
1901
+ const r = this.messages?.get(e.messageId), s = r?.type === "thinking" ? r : void 0, i = new Map(this.messages), o = {
1892
1902
  type: "thinking",
1893
1903
  messageId: e.messageId,
1894
1904
  // Self-sufficient (F-011): the complete frame carries the full reasoning, so a complete-only
@@ -2155,9 +2165,9 @@ function In(n, t) {
2155
2165
  });
2156
2166
  }
2157
2167
  function En(n) {
2158
- const t = new P([]), e = new P([]), r = new U();
2159
- return r.add(n.pipe(N(vn), Y(bn)).subscribe(t)), r.add(
2160
- n.pipe(N(yn), Y(In)).subscribe(e)
2168
+ const t = new P([]), e = new P([]), r = new N();
2169
+ return r.add(n.pipe(U(vn), Y(bn)).subscribe(t)), r.add(
2170
+ n.pipe(U(yn), Y(In)).subscribe(e)
2161
2171
  ), {
2162
2172
  tasks$: t.asObservable(),
2163
2173
  subagents$: e.asObservable(),
@@ -2258,7 +2268,7 @@ class K {
2258
2268
  this.channelTitle$,
2259
2269
  this.sandboxPhase$
2260
2270
  ]).pipe(
2261
- N(([t, e, r, s, i, o]) => ({
2271
+ U(([t, e, r, s, i, o]) => ({
2262
2272
  isConnecting: t,
2263
2273
  conversation: e,
2264
2274
  tasks: r,