@asgard-js/core 0.3.52 → 0.3.53
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.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +78 -75
- package/dist/index.mjs.map +1 -1
- package/dist/lib/channel.d.ts +2 -1
- package/dist/lib/channel.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -29,7 +29,7 @@ class Z extends Error {
|
|
|
29
29
|
function Ln(n) {
|
|
30
30
|
return n instanceof Z;
|
|
31
31
|
}
|
|
32
|
-
class
|
|
32
|
+
class ee extends Error {
|
|
33
33
|
/** The paused batch's process id, as carried by the pending consent prompt. */
|
|
34
34
|
processId;
|
|
35
35
|
constructor(t) {
|
|
@@ -37,7 +37,7 @@ class we extends Error {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
function Un(n) {
|
|
40
|
-
return n instanceof
|
|
40
|
+
return n instanceof ee;
|
|
41
41
|
}
|
|
42
42
|
var $ = /* @__PURE__ */ ((n) => (n.RESET_CHANNEL = "RESET_CHANNEL", n.NONE = "NONE", n.RESPONSE_TOOL_CALL_CONSENT = "RESPONSE_TOOL_CALL_CONSENT", n.NUDGE = "NUDGE", n))($ || {}), l = /* @__PURE__ */ ((n) => (n.INIT = "asgard.run.init", n.PROCESS = "asgard.process", n.PROCESS_START = "asgard.process.start", n.PROCESS_COMPLETE = "asgard.process.complete", n.MESSAGE = "asgard.message", n.MESSAGE_START = "asgard.message.start", n.MESSAGE_DELTA = "asgard.message.delta", n.MESSAGE_COMPLETE = "asgard.message.complete", n.MESSAGE_USER = "asgard.message.user", n.MESSAGE_THINKING_START = "asgard.message.thinking.start", n.MESSAGE_THINKING_DELTA = "asgard.message.thinking.delta", n.MESSAGE_THINKING_COMPLETE = "asgard.message.thinking.complete", n.TOOL_CALL = "asgard.tool_call", n.TOOL_CALL_START = "asgard.tool_call.start", n.TOOL_CALL_COMPLETE = "asgard.tool_call.complete", n.TOOL_CALL_CONSENT = "asgard.tool_call.consent", n.SUBAGENT_START = "asgard.subagent.start", n.SUBAGENT_COMPLETE = "asgard.subagent.complete", n.CHANNEL_TITLE_UPDATE = "asgard.channel.title.update", n.SANDBOX_LAUNCH = "asgard.sandbox.launch", n.SANDBOX_READY = "asgard.sandbox.ready", n.DONE = "asgard.run.done", n.ERROR = "asgard.run.error", n))(l || {}), Xe = /* @__PURE__ */ ((n) => (n.ALLOW_ONCE = "ALLOW_ONCE", n.ALLOW_ALWAYS = "ALLOW_ALWAYS", n.DENY_ONCE = "DENY_ONCE", n))(Xe || {}), Ve = /* @__PURE__ */ ((n) => (n.TEXT = "TEXT", n.HINT = "HINT", n.BUTTON = "BUTTON", n.IMAGE = "IMAGE", n.VIDEO = "VIDEO", n.AUDIO = "AUDIO", n.LOCATION = "LOCATION", n.CAROUSEL = "CAROUSEL", n.CHART = "CHART", n.TABLE = "TABLE", n.ATTACHMENT = "ATTACHMENT", n))(Ve || {});
|
|
43
43
|
async function ze(n, t) {
|
|
@@ -74,11 +74,11 @@ function Je(n) {
|
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
function Qe(n, t, e) {
|
|
77
|
-
let r =
|
|
77
|
+
let r = ue();
|
|
78
78
|
const s = new TextDecoder();
|
|
79
79
|
return function(i, a) {
|
|
80
80
|
if (i.length === 0)
|
|
81
|
-
e?.(r), r =
|
|
81
|
+
e?.(r), r = ue();
|
|
82
82
|
else if (a > 0) {
|
|
83
83
|
const c = s.decode(i.subarray(0, a)), u = a + (i[a + 1] === 32 ? 2 : 1), h = s.decode(i.subarray(u));
|
|
84
84
|
switch (c) {
|
|
@@ -104,7 +104,7 @@ function Ze(n, t) {
|
|
|
104
104
|
const e = new Uint8Array(n.length + t.length);
|
|
105
105
|
return e.set(n), e.set(t, n.length), e;
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function ue() {
|
|
108
108
|
return {
|
|
109
109
|
data: "",
|
|
110
110
|
event: "",
|
|
@@ -120,12 +120,12 @@ var et = function(n, t) {
|
|
|
120
120
|
t.indexOf(r[s]) < 0 && Object.prototype.propertyIsEnumerable.call(n, r[s]) && (e[r[s]] = n[r[s]]);
|
|
121
121
|
return e;
|
|
122
122
|
};
|
|
123
|
-
const
|
|
123
|
+
const te = "text/event-stream", tt = 1e3, le = "last-event-id";
|
|
124
124
|
function Ee(n, t) {
|
|
125
125
|
var { signal: e, headers: r, onopen: s, onmessage: o, onclose: i, onerror: a, openWhenHidden: c, fetch: u } = t, h = et(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
126
126
|
return new Promise((m, b) => {
|
|
127
127
|
const d = Object.assign({}, r);
|
|
128
|
-
d.accept || (d.accept =
|
|
128
|
+
d.accept || (d.accept = te);
|
|
129
129
|
let p;
|
|
130
130
|
function f() {
|
|
131
131
|
p.abort(), document.hidden || X();
|
|
@@ -145,7 +145,7 @@ function Ee(n, t) {
|
|
|
145
145
|
try {
|
|
146
146
|
const H = await Ye(n, Object.assign(Object.assign({}, h), { headers: d, signal: p.signal }));
|
|
147
147
|
await We(H), await ze(H.body, Je(Qe((C) => {
|
|
148
|
-
C ? d[
|
|
148
|
+
C ? d[le] = C : delete d[le];
|
|
149
149
|
}, (C) => {
|
|
150
150
|
_ = C;
|
|
151
151
|
}, o))), i?.(), L(), m();
|
|
@@ -164,20 +164,20 @@ function Ee(n, t) {
|
|
|
164
164
|
}
|
|
165
165
|
function nt(n) {
|
|
166
166
|
const t = n.headers.get("content-type");
|
|
167
|
-
if (!t?.startsWith(
|
|
168
|
-
throw new Error(`Expected content-type to be ${
|
|
167
|
+
if (!t?.startsWith(te))
|
|
168
|
+
throw new Error(`Expected content-type to be ${te}, Actual: ${t}`);
|
|
169
169
|
}
|
|
170
|
-
var
|
|
171
|
-
return
|
|
170
|
+
var ne = function(n, t) {
|
|
171
|
+
return ne = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, r) {
|
|
172
172
|
e.__proto__ = r;
|
|
173
173
|
} || function(e, r) {
|
|
174
174
|
for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (e[s] = r[s]);
|
|
175
|
-
},
|
|
175
|
+
}, ne(n, t);
|
|
176
176
|
};
|
|
177
177
|
function T(n, t) {
|
|
178
178
|
if (typeof t != "function" && t !== null)
|
|
179
179
|
throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
|
|
180
|
-
|
|
180
|
+
ne(n, t);
|
|
181
181
|
function e() {
|
|
182
182
|
this.constructor = n;
|
|
183
183
|
}
|
|
@@ -427,7 +427,7 @@ var j = (function() {
|
|
|
427
427
|
for (var b = N(m), d = b.next(); !d.done; d = b.next()) {
|
|
428
428
|
var p = d.value;
|
|
429
429
|
try {
|
|
430
|
-
|
|
430
|
+
de(p);
|
|
431
431
|
} catch (f) {
|
|
432
432
|
o = o ?? [], f instanceof z ? o = F(F([], D(o)), D(f.errors)) : o.push(f);
|
|
433
433
|
}
|
|
@@ -449,7 +449,7 @@ var j = (function() {
|
|
|
449
449
|
var e;
|
|
450
450
|
if (t && t !== this)
|
|
451
451
|
if (this.closed)
|
|
452
|
-
|
|
452
|
+
de(t);
|
|
453
453
|
else {
|
|
454
454
|
if (t instanceof n) {
|
|
455
455
|
if (t.closed || t._hasParent(this))
|
|
@@ -478,7 +478,7 @@ var j = (function() {
|
|
|
478
478
|
function xe(n) {
|
|
479
479
|
return n instanceof j || n && "closed" in n && g(n.remove) && g(n.add) && g(n.unsubscribe);
|
|
480
480
|
}
|
|
481
|
-
function
|
|
481
|
+
function de(n) {
|
|
482
482
|
g(n) ? n() : n.unsubscribe();
|
|
483
483
|
}
|
|
484
484
|
var it = {
|
|
@@ -499,19 +499,19 @@ function Oe(n) {
|
|
|
499
499
|
throw n;
|
|
500
500
|
});
|
|
501
501
|
}
|
|
502
|
-
function
|
|
502
|
+
function re() {
|
|
503
503
|
}
|
|
504
504
|
function G(n) {
|
|
505
505
|
n();
|
|
506
506
|
}
|
|
507
|
-
var
|
|
507
|
+
var oe = (function(n) {
|
|
508
508
|
T(t, n);
|
|
509
509
|
function t(e) {
|
|
510
510
|
var r = n.call(this) || this;
|
|
511
511
|
return r.isStopped = !1, e ? (r.destination = e, xe(e) && e.add(r)) : r.destination = lt, r;
|
|
512
512
|
}
|
|
513
513
|
return t.create = function(e, r, s) {
|
|
514
|
-
return new
|
|
514
|
+
return new se(e, r, s);
|
|
515
515
|
}, t.prototype.next = function(e) {
|
|
516
516
|
this.isStopped || this._next(e);
|
|
517
517
|
}, t.prototype.error = function(e) {
|
|
@@ -566,7 +566,7 @@ var se = (function(n) {
|
|
|
566
566
|
B(e);
|
|
567
567
|
}
|
|
568
568
|
}, n;
|
|
569
|
-
})(),
|
|
569
|
+
})(), se = (function(n) {
|
|
570
570
|
T(t, n);
|
|
571
571
|
function t(e, r, s) {
|
|
572
572
|
var o = n.call(this) || this, i;
|
|
@@ -577,7 +577,7 @@ var se = (function(n) {
|
|
|
577
577
|
} : i = e, o.destination = new ct(i), o;
|
|
578
578
|
}
|
|
579
579
|
return t;
|
|
580
|
-
})(
|
|
580
|
+
})(oe);
|
|
581
581
|
function B(n) {
|
|
582
582
|
Oe(n);
|
|
583
583
|
}
|
|
@@ -586,10 +586,10 @@ function ut(n) {
|
|
|
586
586
|
}
|
|
587
587
|
var lt = {
|
|
588
588
|
closed: !0,
|
|
589
|
-
next:
|
|
589
|
+
next: re,
|
|
590
590
|
error: ut,
|
|
591
|
-
complete:
|
|
592
|
-
},
|
|
591
|
+
complete: re
|
|
592
|
+
}, ie = (function() {
|
|
593
593
|
return typeof Symbol == "function" && Symbol.observable || "@@observable";
|
|
594
594
|
})();
|
|
595
595
|
function W(n) {
|
|
@@ -610,7 +610,7 @@ var S = (function() {
|
|
|
610
610
|
var e = new n();
|
|
611
611
|
return e.source = this, e.operator = t, e;
|
|
612
612
|
}, n.prototype.subscribe = function(t, e, r) {
|
|
613
|
-
var s = this, o = ft(t) ? t : new
|
|
613
|
+
var s = this, o = ft(t) ? t : new se(t, e, r);
|
|
614
614
|
return G(function() {
|
|
615
615
|
var i = s, a = i.operator, c = i.source;
|
|
616
616
|
o.add(a ? a.call(o, c) : c ? s._subscribe(o) : s._trySubscribe(o));
|
|
@@ -623,8 +623,8 @@ var S = (function() {
|
|
|
623
623
|
}
|
|
624
624
|
}, n.prototype.forEach = function(t, e) {
|
|
625
625
|
var r = this;
|
|
626
|
-
return e =
|
|
627
|
-
var i = new
|
|
626
|
+
return e = he(e), new e(function(s, o) {
|
|
627
|
+
var i = new se({
|
|
628
628
|
next: function(a) {
|
|
629
629
|
try {
|
|
630
630
|
t(a);
|
|
@@ -640,7 +640,7 @@ var S = (function() {
|
|
|
640
640
|
}, n.prototype._subscribe = function(t) {
|
|
641
641
|
var e;
|
|
642
642
|
return (e = this.source) === null || e === void 0 ? void 0 : e.subscribe(t);
|
|
643
|
-
}, n.prototype[
|
|
643
|
+
}, n.prototype[ie] = function() {
|
|
644
644
|
return this;
|
|
645
645
|
}, n.prototype.pipe = function() {
|
|
646
646
|
for (var t = [], e = 0; e < arguments.length; e++)
|
|
@@ -648,7 +648,7 @@ var S = (function() {
|
|
|
648
648
|
return dt(t)(this);
|
|
649
649
|
}, n.prototype.toPromise = function(t) {
|
|
650
650
|
var e = this;
|
|
651
|
-
return t =
|
|
651
|
+
return t = he(t), new t(function(r, s) {
|
|
652
652
|
var o;
|
|
653
653
|
e.subscribe(function(i) {
|
|
654
654
|
return o = i;
|
|
@@ -662,7 +662,7 @@ var S = (function() {
|
|
|
662
662
|
return new n(t);
|
|
663
663
|
}, n;
|
|
664
664
|
})();
|
|
665
|
-
function
|
|
665
|
+
function he(n) {
|
|
666
666
|
var t;
|
|
667
667
|
return (t = n ?? it.Promise) !== null && t !== void 0 ? t : Promise;
|
|
668
668
|
}
|
|
@@ -670,7 +670,7 @@ function ht(n) {
|
|
|
670
670
|
return n && g(n.next) && g(n.error) && g(n.complete);
|
|
671
671
|
}
|
|
672
672
|
function ft(n) {
|
|
673
|
-
return n && n instanceof
|
|
673
|
+
return n && n instanceof oe || ht(n) && xe(n);
|
|
674
674
|
}
|
|
675
675
|
function pt(n) {
|
|
676
676
|
return g(n?.lift);
|
|
@@ -726,18 +726,18 @@ var mt = (function(n) {
|
|
|
726
726
|
n.prototype.unsubscribe.call(this), !r && ((e = this.onFinalize) === null || e === void 0 || e.call(this));
|
|
727
727
|
}
|
|
728
728
|
}, t;
|
|
729
|
-
})(
|
|
729
|
+
})(oe), gt = Te(function(n) {
|
|
730
730
|
return function() {
|
|
731
731
|
n(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
|
|
732
732
|
};
|
|
733
|
-
}),
|
|
733
|
+
}), ae = (function(n) {
|
|
734
734
|
T(t, n);
|
|
735
735
|
function t() {
|
|
736
736
|
var e = n.call(this) || this;
|
|
737
737
|
return e.closed = !1, e.currentObservers = null, e.observers = [], e.isStopped = !1, e.hasError = !1, e.thrownError = null, e;
|
|
738
738
|
}
|
|
739
739
|
return t.prototype.lift = function(e) {
|
|
740
|
-
var r = new
|
|
740
|
+
var r = new fe(this, this);
|
|
741
741
|
return r.operator = e, r;
|
|
742
742
|
}, t.prototype._throwIfClosed = function() {
|
|
743
743
|
if (this.closed)
|
|
@@ -807,9 +807,9 @@ var mt = (function(n) {
|
|
|
807
807
|
var e = new S();
|
|
808
808
|
return e.source = this, e;
|
|
809
809
|
}, t.create = function(e, r) {
|
|
810
|
-
return new
|
|
810
|
+
return new fe(e, r);
|
|
811
811
|
}, t;
|
|
812
|
-
})(S),
|
|
812
|
+
})(S), fe = (function(n) {
|
|
813
813
|
T(t, n);
|
|
814
814
|
function t(e, r) {
|
|
815
815
|
var s = n.call(this) || this;
|
|
@@ -828,7 +828,7 @@ var mt = (function(n) {
|
|
|
828
828
|
var r, s;
|
|
829
829
|
return (s = (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(e)) !== null && s !== void 0 ? s : Ce;
|
|
830
830
|
}, t;
|
|
831
|
-
})(
|
|
831
|
+
})(ae), x = (function(n) {
|
|
832
832
|
T(t, n);
|
|
833
833
|
function t(e) {
|
|
834
834
|
var r = n.call(this) || this;
|
|
@@ -851,7 +851,7 @@ var mt = (function(n) {
|
|
|
851
851
|
}, t.prototype.next = function(e) {
|
|
852
852
|
n.prototype.next.call(this, this._value = e);
|
|
853
853
|
}, t;
|
|
854
|
-
})(
|
|
854
|
+
})(ae), bt = {
|
|
855
855
|
now: function() {
|
|
856
856
|
return Date.now();
|
|
857
857
|
}
|
|
@@ -863,7 +863,7 @@ var mt = (function(n) {
|
|
|
863
863
|
return t.prototype.schedule = function(e, r) {
|
|
864
864
|
return this;
|
|
865
865
|
}, t;
|
|
866
|
-
})(j),
|
|
866
|
+
})(j), pe = {
|
|
867
867
|
setInterval: function(n, t) {
|
|
868
868
|
for (var e = [], r = 2; r < arguments.length; r++)
|
|
869
869
|
e[r - 2] = arguments[r];
|
|
@@ -887,11 +887,11 @@ var mt = (function(n) {
|
|
|
887
887
|
var o = this.id, i = this.scheduler;
|
|
888
888
|
return o != null && (this.id = this.recycleAsyncId(i, o, r)), this.pending = !0, this.delay = r, this.id = (s = this.id) !== null && s !== void 0 ? s : this.requestAsyncId(i, this.id, r), this;
|
|
889
889
|
}, t.prototype.requestAsyncId = function(e, r, s) {
|
|
890
|
-
return s === void 0 && (s = 0),
|
|
890
|
+
return s === void 0 && (s = 0), pe.setInterval(e.flush.bind(e, this), s);
|
|
891
891
|
}, t.prototype.recycleAsyncId = function(e, r, s) {
|
|
892
892
|
if (s === void 0 && (s = 0), s != null && this.delay === s && this.pending === !1)
|
|
893
893
|
return r;
|
|
894
|
-
r != null &&
|
|
894
|
+
r != null && pe.clearInterval(r);
|
|
895
895
|
}, t.prototype.execute = function(e, r) {
|
|
896
896
|
if (this.closed)
|
|
897
897
|
return new Error("executing a cancelled action");
|
|
@@ -915,7 +915,7 @@ var mt = (function(n) {
|
|
|
915
915
|
this.work = this.state = this.scheduler = null, this.pending = !1, K(o, this), r != null && (this.id = this.recycleAsyncId(s, r, null)), this.delay = null, n.prototype.unsubscribe.call(this);
|
|
916
916
|
}
|
|
917
917
|
}, t;
|
|
918
|
-
})(vt),
|
|
918
|
+
})(vt), me = (function() {
|
|
919
919
|
function n(t, e) {
|
|
920
920
|
e === void 0 && (e = n.now), this.schedulerActionCtor = t, this.now = e;
|
|
921
921
|
}
|
|
@@ -925,7 +925,7 @@ var mt = (function(n) {
|
|
|
925
925
|
})(), St = (function(n) {
|
|
926
926
|
T(t, n);
|
|
927
927
|
function t(e, r) {
|
|
928
|
-
r === void 0 && (r =
|
|
928
|
+
r === void 0 && (r = me.now);
|
|
929
929
|
var s = n.call(this, e, r) || this;
|
|
930
930
|
return s.actions = [], s._active = !1, s;
|
|
931
931
|
}
|
|
@@ -947,7 +947,7 @@ var mt = (function(n) {
|
|
|
947
947
|
throw s;
|
|
948
948
|
}
|
|
949
949
|
}, t;
|
|
950
|
-
})(
|
|
950
|
+
})(me), Ae = new St(yt), wt = Ae, Et = new S(function(n) {
|
|
951
951
|
return n.complete();
|
|
952
952
|
});
|
|
953
953
|
function Pe(n) {
|
|
@@ -969,7 +969,7 @@ function Me(n) {
|
|
|
969
969
|
return g(n?.then);
|
|
970
970
|
}
|
|
971
971
|
function ke(n) {
|
|
972
|
-
return g(n[
|
|
972
|
+
return g(n[ie]);
|
|
973
973
|
}
|
|
974
974
|
function Ne(n) {
|
|
975
975
|
return Symbol.asyncIterator && g(n?.[Symbol.asyncIterator]);
|
|
@@ -1039,7 +1039,7 @@ function U(n) {
|
|
|
1039
1039
|
}
|
|
1040
1040
|
function Ct(n) {
|
|
1041
1041
|
return new S(function(t) {
|
|
1042
|
-
var e = n[
|
|
1042
|
+
var e = n[ie]();
|
|
1043
1043
|
if (g(e.subscribe))
|
|
1044
1044
|
return e.subscribe(t);
|
|
1045
1045
|
throw new TypeError("Provided object does not correctly implement Symbol.observable");
|
|
@@ -1229,14 +1229,14 @@ function Rt(n, t) {
|
|
|
1229
1229
|
}
|
|
1230
1230
|
throw Re(n);
|
|
1231
1231
|
}
|
|
1232
|
-
function
|
|
1232
|
+
function ce(n, t) {
|
|
1233
1233
|
return t ? Rt(n, t) : U(n);
|
|
1234
1234
|
}
|
|
1235
1235
|
function jt() {
|
|
1236
1236
|
for (var n = [], t = 0; t < arguments.length; t++)
|
|
1237
1237
|
n[t] = arguments[t];
|
|
1238
1238
|
var e = Le(n);
|
|
1239
|
-
return
|
|
1239
|
+
return ce(n, e);
|
|
1240
1240
|
}
|
|
1241
1241
|
function $t(n) {
|
|
1242
1242
|
return n instanceof Date && !isNaN(n);
|
|
@@ -1289,7 +1289,7 @@ function Vt() {
|
|
|
1289
1289
|
n[t] = arguments[t];
|
|
1290
1290
|
var e = Le(n), r = It(n), s = Yt(n), o = s.args, i = s.keys;
|
|
1291
1291
|
if (o.length === 0)
|
|
1292
|
-
return
|
|
1292
|
+
return ce([], e);
|
|
1293
1293
|
var a = new S(zt(o, e, i ? function(c) {
|
|
1294
1294
|
return Xt(i, c);
|
|
1295
1295
|
} : W));
|
|
@@ -1297,10 +1297,10 @@ function Vt() {
|
|
|
1297
1297
|
}
|
|
1298
1298
|
function zt(n, t, e) {
|
|
1299
1299
|
return e === void 0 && (e = W), function(r) {
|
|
1300
|
-
|
|
1300
|
+
ge(t, function() {
|
|
1301
1301
|
for (var s = n.length, o = new Array(s), i = s, a = s, c = function(h) {
|
|
1302
|
-
|
|
1303
|
-
var m =
|
|
1302
|
+
ge(t, function() {
|
|
1303
|
+
var m = ce(n[h], t), b = !1;
|
|
1304
1304
|
m.subscribe(A(r, function(d) {
|
|
1305
1305
|
o[h] = d, b || (b = !0, a--), a || r.next(e(o.slice()));
|
|
1306
1306
|
}, function() {
|
|
@@ -1312,7 +1312,7 @@ function zt(n, t, e) {
|
|
|
1312
1312
|
}, r);
|
|
1313
1313
|
};
|
|
1314
1314
|
}
|
|
1315
|
-
function
|
|
1315
|
+
function ge(n, t, e) {
|
|
1316
1316
|
n ? O(e, n, t) : t();
|
|
1317
1317
|
}
|
|
1318
1318
|
function Jt(n, t, e, r, s, o, i, a) {
|
|
@@ -1423,10 +1423,10 @@ function an(n) {
|
|
|
1423
1423
|
return P(function(t, e) {
|
|
1424
1424
|
U(n).subscribe(A(e, function() {
|
|
1425
1425
|
return e.complete();
|
|
1426
|
-
},
|
|
1426
|
+
}, re)), !e.closed && t.subscribe(e);
|
|
1427
1427
|
});
|
|
1428
1428
|
}
|
|
1429
|
-
function
|
|
1429
|
+
function be(n) {
|
|
1430
1430
|
const { endpoint: t, apiKey: e, payload: r, debugMode: s, customHeaders: o } = n, i = n.method ?? "POST";
|
|
1431
1431
|
return new S((a) => {
|
|
1432
1432
|
const c = new AbortController();
|
|
@@ -1506,7 +1506,7 @@ class Mn {
|
|
|
1506
1506
|
endpoint;
|
|
1507
1507
|
botProviderEndpoint;
|
|
1508
1508
|
debugMode;
|
|
1509
|
-
destroy$ = new
|
|
1509
|
+
destroy$ = new ae();
|
|
1510
1510
|
closed = !1;
|
|
1511
1511
|
detached = !1;
|
|
1512
1512
|
detachTimer;
|
|
@@ -1564,7 +1564,7 @@ class Mn {
|
|
|
1564
1564
|
}
|
|
1565
1565
|
fetchSse(t, e) {
|
|
1566
1566
|
return e?.onSseStart?.(), this.inFlight += 1, this.runSse(
|
|
1567
|
-
|
|
1567
|
+
be({
|
|
1568
1568
|
apiKey: this.apiKey,
|
|
1569
1569
|
endpoint: this.endpoint,
|
|
1570
1570
|
debugMode: this.debugMode,
|
|
@@ -1583,7 +1583,7 @@ class Mn {
|
|
|
1583
1583
|
e?.onSseStart?.(), this.inFlight += 1;
|
|
1584
1584
|
const r = new URL(this.endpoint);
|
|
1585
1585
|
return r.searchParams.set("custom_channel_id", t), this.runSse(
|
|
1586
|
-
|
|
1586
|
+
be({
|
|
1587
1587
|
apiKey: this.apiKey,
|
|
1588
1588
|
endpoint: r.toString(),
|
|
1589
1589
|
debugMode: this.debugMode,
|
|
@@ -1967,7 +1967,7 @@ function dn() {
|
|
|
1967
1967
|
}
|
|
1968
1968
|
return J(ln);
|
|
1969
1969
|
}
|
|
1970
|
-
const hn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto),
|
|
1970
|
+
const hn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ve = { randomUUID: hn };
|
|
1971
1971
|
function fn(n, t, e) {
|
|
1972
1972
|
n = n || {};
|
|
1973
1973
|
const r = n.random ?? n.rng?.() ?? dn();
|
|
@@ -1976,7 +1976,7 @@ function fn(n, t, e) {
|
|
|
1976
1976
|
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, un(r);
|
|
1977
1977
|
}
|
|
1978
1978
|
function Ke(n, t, e) {
|
|
1979
|
-
return
|
|
1979
|
+
return ve.randomUUID && !n ? ve.randomUUID() : fn(n);
|
|
1980
1980
|
}
|
|
1981
1981
|
class v {
|
|
1982
1982
|
messages = null;
|
|
@@ -2294,7 +2294,7 @@ const pn = /* @__PURE__ */ new Set(["TaskCreate", "TaskUpdate"]);
|
|
|
2294
2294
|
function mn(n) {
|
|
2295
2295
|
return n.toolsetName === "" && pn.has(n.toolName);
|
|
2296
2296
|
}
|
|
2297
|
-
function
|
|
2297
|
+
function ye(n) {
|
|
2298
2298
|
return typeof n == "object" && n !== null ? n : void 0;
|
|
2299
2299
|
}
|
|
2300
2300
|
function I(n) {
|
|
@@ -2305,7 +2305,7 @@ function gn(n) {
|
|
|
2305
2305
|
for (const r of n) {
|
|
2306
2306
|
const s = r.parameter ?? {}, o = r.sidecar ?? {};
|
|
2307
2307
|
if (r.toolName === "TaskCreate") {
|
|
2308
|
-
const i =
|
|
2308
|
+
const i = ye(o.task), a = I(i?.id);
|
|
2309
2309
|
if (!a) continue;
|
|
2310
2310
|
e.has(a) || t.push(a), e.set(a, {
|
|
2311
2311
|
id: a,
|
|
@@ -2316,7 +2316,7 @@ function gn(n) {
|
|
|
2316
2316
|
// initial status = pending (keep existing on repeat)
|
|
2317
2317
|
});
|
|
2318
2318
|
} else if (r.toolName === "TaskUpdate") {
|
|
2319
|
-
const i =
|
|
2319
|
+
const i = ye(o.statusChange), a = I(s.taskId) || I(o.taskId), c = I(i?.to) || I(s.status);
|
|
2320
2320
|
if (!a || !c) continue;
|
|
2321
2321
|
const u = e.get(a);
|
|
2322
2322
|
u && e.set(a, { ...u, status: c });
|
|
@@ -2330,7 +2330,7 @@ function bn(n) {
|
|
|
2330
2330
|
function vn(n) {
|
|
2331
2331
|
return !!n;
|
|
2332
2332
|
}
|
|
2333
|
-
function
|
|
2333
|
+
function Se(n) {
|
|
2334
2334
|
n.status !== "running" && (n.status = "running", n.summary = void 0);
|
|
2335
2335
|
}
|
|
2336
2336
|
function yn(n) {
|
|
@@ -2344,11 +2344,11 @@ function yn(n) {
|
|
|
2344
2344
|
}
|
|
2345
2345
|
case "subagentStart": {
|
|
2346
2346
|
const i = s(o.parentToolUseId);
|
|
2347
|
-
i.agentId = o.agentId ?? i.agentId, i.subagentType = o.subagentType ?? i.subagentType, i.description = o.description ?? i.description,
|
|
2347
|
+
i.agentId = o.agentId ?? i.agentId, i.subagentType = o.subagentType ?? i.subagentType, i.description = o.description ?? i.description, Se(i);
|
|
2348
2348
|
break;
|
|
2349
2349
|
}
|
|
2350
2350
|
case "toolStart": {
|
|
2351
|
-
|
|
2351
|
+
Se(s(o.parentToolUseId)), r.get(o.parentToolUseId).set(o.toolUseId, {
|
|
2352
2352
|
toolsetName: o.toolsetName,
|
|
2353
2353
|
toolName: o.toolName,
|
|
2354
2354
|
parameter: o.parameter ?? {},
|
|
@@ -2464,7 +2464,7 @@ function On(n) {
|
|
|
2464
2464
|
teardown: () => r.unsubscribe()
|
|
2465
2465
|
};
|
|
2466
2466
|
}
|
|
2467
|
-
function
|
|
2467
|
+
function we(n) {
|
|
2468
2468
|
const t = /* @__PURE__ */ new Map();
|
|
2469
2469
|
for (const e of n) t.set(e.sandboxName, e);
|
|
2470
2470
|
return [...t.values()].sort(
|
|
@@ -2529,7 +2529,7 @@ class q {
|
|
|
2529
2529
|
if (!t.customChannelId)
|
|
2530
2530
|
throw new Error("customChannelId must be required");
|
|
2531
2531
|
this.client = t.client, this.customChannelId = t.customChannelId, this.customMessageId = t.customMessageId, this.joinRunState = t.runState ?? "IDLE", this.isConnecting$ = new x(!1), this.runStatusSubject = new x(Q), this.conversation$ = new x(t.conversation), this.channelTitleSubject = new x(t.channelTitle ?? null), this.sandboxPhaseSubject = new x("idle"), this.launchedSandboxesSubject = new x(
|
|
2532
|
-
|
|
2532
|
+
we(t.launchedSandboxes ?? [])
|
|
2533
2533
|
), this.derivedStores = On(this.conversation$), this.tasks$ = this.derivedStores.tasks$, this.subagents$ = this.derivedStores.subagents$, this.channelTitle$ = this.channelTitleSubject.pipe(M()), this.sandboxPhase$ = this.sandboxPhaseSubject.pipe(M()), this.launchedSandboxes$ = this.launchedSandboxesSubject.pipe(M()), this.runStatus$ = this.runStatusSubject.pipe(M(Pn)), this.statesObserver = t.statesObserver;
|
|
2534
2534
|
}
|
|
2535
2535
|
/** Current Task Check List snapshot (F-013) — for framework-agnostic `getSnapshot()` bridging. */
|
|
@@ -2566,7 +2566,7 @@ class q {
|
|
|
2566
2566
|
* launch whose name now appears (promoted to live). metadata (heartbeat-backed) is the sole authority.
|
|
2567
2567
|
*/
|
|
2568
2568
|
applyLaunchedSandboxes(t) {
|
|
2569
|
-
const e =
|
|
2569
|
+
const e = we(t);
|
|
2570
2570
|
this.pendingLaunches = this.pendingLaunches.filter((r) => !e.some((s) => s.sandboxName === r)), this.launchedSandboxesSubject.next(e);
|
|
2571
2571
|
}
|
|
2572
2572
|
/**
|
|
@@ -2780,7 +2780,7 @@ class q {
|
|
|
2780
2780
|
const r = this.runStatusSubject.value.kind;
|
|
2781
2781
|
if (r) return Promise.reject(new Z(r));
|
|
2782
2782
|
const s = this.conversation$.value.pendingConsent;
|
|
2783
|
-
if (s) return Promise.reject(new
|
|
2783
|
+
if (s) return Promise.reject(new ee(s.processId));
|
|
2784
2784
|
const o = t.text.trim(), i = t.customMessageId ?? Ke();
|
|
2785
2785
|
return this.currentUserMessageId = i, this.lastSentMessageId = i, this.conversation$.next(
|
|
2786
2786
|
this.conversation$.value.pushMessage({
|
|
@@ -2836,11 +2836,14 @@ class q {
|
|
|
2836
2836
|
* function to compute it at send time. In `@asgard-js/react` this is filled in automatically from
|
|
2837
2837
|
* `onBeforeSendMessage`.
|
|
2838
2838
|
*
|
|
2839
|
-
* Rejects with `ChannelBusyError` when a run already holds the channel,
|
|
2839
|
+
* Rejects with `ChannelBusyError` when a run already holds the channel, and with
|
|
2840
|
+
* `ChannelAwaitingConsentError` while a consent prompt is pending — exactly like `sendMessage`.
|
|
2840
2841
|
*/
|
|
2841
2842
|
nudge(t, e) {
|
|
2842
2843
|
const r = this.runStatusSubject.value.kind;
|
|
2843
|
-
|
|
2844
|
+
if (r) return Promise.reject(new Z(r));
|
|
2845
|
+
const s = this.conversation$.value.pendingConsent;
|
|
2846
|
+
return s ? Promise.reject(new ee(s.processId)) : this.fetchSse(
|
|
2844
2847
|
"nudge",
|
|
2845
2848
|
{
|
|
2846
2849
|
action: $.NUDGE,
|
|
@@ -2940,7 +2943,7 @@ function kn(n) {
|
|
|
2940
2943
|
export {
|
|
2941
2944
|
Mn as AsgardServiceClient,
|
|
2942
2945
|
q as Channel,
|
|
2943
|
-
|
|
2946
|
+
ee as ChannelAwaitingConsentError,
|
|
2944
2947
|
Z as ChannelBusyError,
|
|
2945
2948
|
v as Conversation,
|
|
2946
2949
|
l as EventType,
|
|
@@ -2958,7 +2961,7 @@ export {
|
|
|
2958
2961
|
_n as isHttpError,
|
|
2959
2962
|
vn as isSubagentChildTool,
|
|
2960
2963
|
mn as isTaskTool,
|
|
2961
|
-
|
|
2964
|
+
we as reconcileLaunched,
|
|
2962
2965
|
yn as reduceSubagents,
|
|
2963
2966
|
gn as reduceTaskEvents,
|
|
2964
2967
|
kn as resolveSandboxUri,
|