@aintela/chat 0.2.26 → 0.2.28
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/{auth-DbmLacBc.js → auth-GFZAFz7L.js} +2 -2
- package/dist/{auth-DbmLacBc.js.map → auth-GFZAFz7L.js.map} +1 -1
- package/dist/components.js +4454 -4376
- package/dist/components.js.map +1 -1
- package/dist/{environmentUtils-BaKw5_VD.js → environmentUtils-CUVZ6Dq1.js} +44 -28
- package/dist/environmentUtils-CUVZ6Dq1.js.map +1 -0
- package/dist/hooks.js +1 -1
- package/dist/{httpArtifactService-DFlQzSgN.js → httpArtifactService-B668XBHO.js} +119 -112
- package/dist/httpArtifactService-B668XBHO.js.map +1 -0
- package/dist/{httpSessionService-D9JXx3JD.js → httpSessionService-BuT5FlDc.js} +3 -3
- package/dist/{httpSessionService-D9JXx3JD.js.map → httpSessionService-BuT5FlDc.js.map} +1 -1
- package/dist/index.js +6 -6
- package/dist/models.js +2 -2
- package/dist/serializer-BPina6fX.js +1337 -0
- package/dist/serializer-BPina6fX.js.map +1 -0
- package/dist/services.js +2 -2
- package/dist/src/models/InteractionPart.test.d.ts +1 -0
- package/dist/src/models/semanticKernelModel/models.d.ts +8 -5
- package/dist/{useChatSessions-C1rHmRuS.js → useChatSessions-DsHPo0GV.js} +2 -2
- package/dist/{useChatSessions-C1rHmRuS.js.map → useChatSessions-DsHPo0GV.js.map} +1 -1
- package/dist/utils.js +2 -2
- package/package.json +1 -1
- package/dist/environmentUtils-BaKw5_VD.js.map +0 -1
- package/dist/httpArtifactService-DFlQzSgN.js.map +0 -1
- package/dist/serializer-C1uBjgTd.js +0 -1318
- package/dist/serializer-C1uBjgTd.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var nt = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var a = (O, t, e) =>
|
|
5
|
-
import { d as _, t as mt, E as y, k as pt, j as St, q as wt, C as
|
|
6
|
-
import { I as A, S as ut, g as Tt, L as yt, P as F, b as It, e as Ct, T as vt, c as Et } from "./serializer-
|
|
2
|
+
var gt = (O, t, e) => t in O ? nt(O, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : O[t] = e;
|
|
3
|
+
var f = (O, t) => nt(O, "name", { value: t, configurable: !0 });
|
|
4
|
+
var a = (O, t, e) => gt(O, typeof t != "symbol" ? t + "" : t, e);
|
|
5
|
+
import { d as _, t as mt, E as y, k as pt, j as St, q as wt, C as L } from "./environmentUtils-CUVZ6Dq1.js";
|
|
6
|
+
import { I as A, S as ut, g as Tt, L as yt, P as F, b as It, e as Ct, T as vt, c as Et } from "./serializer-BPina6fX.js";
|
|
7
7
|
import { unified as Mt } from "unified";
|
|
8
8
|
import Ot from "remark-parse";
|
|
9
9
|
import { toMarkdown as Dt } from "mdast-util-to-markdown";
|
|
@@ -38,7 +38,7 @@ const T = {
|
|
|
38
38
|
}
|
|
39
39
|
], J = class J {
|
|
40
40
|
constructor() {
|
|
41
|
-
a(this, "onPromptCreated", /* @__PURE__ */
|
|
41
|
+
a(this, "onPromptCreated", /* @__PURE__ */ f(() => {
|
|
42
42
|
}, "onPromptCreated"));
|
|
43
43
|
}
|
|
44
44
|
getItem(t) {
|
|
@@ -196,9 +196,9 @@ const T = {
|
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
};
|
|
199
|
-
|
|
199
|
+
f(J, "LocalStorageService");
|
|
200
200
|
let it = J;
|
|
201
|
-
const jt = /* @__PURE__ */
|
|
201
|
+
const jt = /* @__PURE__ */ f((O) => {
|
|
202
202
|
const t = O.getPrompts(), e = t.length;
|
|
203
203
|
if (e > 0) {
|
|
204
204
|
const s = t[0].promptText, i = t[t.length - 1].promptText, n = t[0].created;
|
|
@@ -230,7 +230,7 @@ const jt = /* @__PURE__ */ g((O) => {
|
|
|
230
230
|
a(this, "gatewayFirstToken", "gatewayFirstToken");
|
|
231
231
|
}
|
|
232
232
|
};
|
|
233
|
-
|
|
233
|
+
f(q, "EventTypes");
|
|
234
234
|
let x = q;
|
|
235
235
|
const c = new x(), G = class G {
|
|
236
236
|
constructor() {
|
|
@@ -483,7 +483,7 @@ const c = new x(), G = class G {
|
|
|
483
483
|
this.listeners[e] && (this.listeners[e] = this.listeners[e].filter((s) => s !== t));
|
|
484
484
|
}
|
|
485
485
|
};
|
|
486
|
-
|
|
486
|
+
f(G, "EventBusService");
|
|
487
487
|
let B = G;
|
|
488
488
|
const H = class H extends B {
|
|
489
489
|
constructor() {
|
|
@@ -511,7 +511,7 @@ const H = class H extends B {
|
|
|
511
511
|
console.log("MockEventBusService.gatewayOffFunctionResponse", t);
|
|
512
512
|
}
|
|
513
513
|
};
|
|
514
|
-
|
|
514
|
+
f(H, "MockEventBusService");
|
|
515
515
|
let at = H;
|
|
516
516
|
const dt = {
|
|
517
517
|
inline: "inline",
|
|
@@ -525,13 +525,13 @@ const dt = {
|
|
|
525
525
|
a(this, "type", dt.inline);
|
|
526
526
|
}
|
|
527
527
|
};
|
|
528
|
-
|
|
528
|
+
f(K, "InteractionPartGroup");
|
|
529
529
|
let R = K;
|
|
530
530
|
const z = class z {
|
|
531
531
|
constructor(t, e) {
|
|
532
532
|
a(this, "interaction");
|
|
533
533
|
a(this, "eventBusService");
|
|
534
|
-
a(this, "parseTextIntoParts", /* @__PURE__ */
|
|
534
|
+
a(this, "parseTextIntoParts", /* @__PURE__ */ f((t) => {
|
|
535
535
|
if (!t || t.trim().length == 0) return [];
|
|
536
536
|
const e = Mt().use(Ot).parse(t), s = [];
|
|
537
537
|
let i = null;
|
|
@@ -590,48 +590,48 @@ ${n.value}
|
|
|
590
590
|
let l = !1;
|
|
591
591
|
n && (l = !r || n.mustPush || n.mustPush === !1 && (n.eventType !== (r == null ? void 0 : r.eventType) || ((X = n == null ? void 0 : n.functionDetails) == null ? void 0 : X.id) !== ((Z = r.functionDetails) == null ? void 0 : Z.id)));
|
|
592
592
|
let o = e.parts, u = e.functionMap ?? /* @__PURE__ */ new Map(), d = !e.functionMap;
|
|
593
|
-
const h = /* @__PURE__ */
|
|
593
|
+
const h = /* @__PURE__ */ f(() => {
|
|
594
594
|
d || (u = new Map(u), d = !0);
|
|
595
|
-
}, "cloneFunctionMap"), v = /* @__PURE__ */
|
|
595
|
+
}, "cloneFunctionMap"), v = /* @__PURE__ */ f(() => {
|
|
596
596
|
o === e.parts && (o = e.parts.slice());
|
|
597
597
|
}, "clonePartsIfShared");
|
|
598
|
-
let
|
|
598
|
+
let p = !1;
|
|
599
599
|
if ((n == null ? void 0 : n.eventType) === y.FunctionClientOutput && !!((V = n.functionDetails) != null && V.id) && n) {
|
|
600
|
-
const
|
|
601
|
-
var
|
|
602
|
-
return ((
|
|
600
|
+
const g = n.functionDetails.id, C = n.functionDetails.clientOutput, E = o.findIndex((w) => {
|
|
601
|
+
var m;
|
|
602
|
+
return ((m = w.functionDetails) == null ? void 0 : m.id) === g;
|
|
603
603
|
});
|
|
604
604
|
if (E > -1) {
|
|
605
|
-
const w = o[E],
|
|
605
|
+
const w = o[E], m = {
|
|
606
606
|
...w,
|
|
607
607
|
functionDetails: {
|
|
608
608
|
...w.functionDetails,
|
|
609
609
|
clientOutput: C ?? w.functionDetails.clientOutput
|
|
610
610
|
}
|
|
611
611
|
};
|
|
612
|
-
v(), o[E] =
|
|
612
|
+
v(), o[E] = m, h(), u.set(g, m), s.push(m);
|
|
613
613
|
} else {
|
|
614
614
|
const w = {
|
|
615
615
|
...n,
|
|
616
616
|
id: o.length + 1 + "-" + e.interactionId,
|
|
617
617
|
functionDetails: { ...n.functionDetails, silent: !0 }
|
|
618
618
|
};
|
|
619
|
-
v(), o = o === e.parts ? e.parts.slice() : o, o.push(w), h(), u.set(
|
|
619
|
+
v(), o = o === e.parts ? e.parts.slice() : o, o.push(w), h(), u.set(g, w);
|
|
620
620
|
}
|
|
621
621
|
} else if (l && n) {
|
|
622
|
-
const
|
|
623
|
-
|
|
622
|
+
const g = this.isFunctionCall(n.eventType) || this.isFunctionResponse(n.eventType), C = g ? (tt = n.functionDetails) == null ? void 0 : tt.id : void 0;
|
|
623
|
+
g && !C && console.error("Got isCall or isResponse without a callId", n);
|
|
624
624
|
const E = C ? u.get(C) : void 0;
|
|
625
625
|
if (E && C && n.functionDetails) {
|
|
626
|
-
const w = o.findIndex((
|
|
626
|
+
const w = o.findIndex((ft) => {
|
|
627
627
|
var st;
|
|
628
|
-
return ((st =
|
|
629
|
-
}),
|
|
630
|
-
...
|
|
628
|
+
return ((st = ft.functionDetails) == null ? void 0 : st.id) === C;
|
|
629
|
+
}), m = w > -1 ? o[w] : E, N = {
|
|
630
|
+
...m,
|
|
631
631
|
eventType: n.eventType,
|
|
632
632
|
functionDetails: {
|
|
633
|
-
id:
|
|
634
|
-
name: n.functionDetails.name ??
|
|
633
|
+
id: m.functionDetails.id,
|
|
634
|
+
name: n.functionDetails.name ?? m.functionDetails.name,
|
|
635
635
|
// Take the parsed args from the incoming event when
|
|
636
636
|
// present (the full FunctionCall carries them), fall
|
|
637
637
|
// back to what was already on the part. Previously
|
|
@@ -640,31 +640,38 @@ ${n.value}
|
|
|
640
640
|
// args off every full FunctionCall fold because the
|
|
641
641
|
// PartialFunctionCall stream only accumulates raw
|
|
642
642
|
// JSON in `.text` — `.args` stayed undefined.
|
|
643
|
-
args: n.functionDetails.args ??
|
|
643
|
+
args: n.functionDetails.args ?? m.functionDetails.args,
|
|
644
644
|
response: n.functionDetails.response,
|
|
645
645
|
status: n.functionDetails.status ?? "Composing",
|
|
646
|
-
start: n.functionDetails.start ??
|
|
647
|
-
end: n.functionDetails.end ??
|
|
646
|
+
start: n.functionDetails.start ?? m.functionDetails.start,
|
|
647
|
+
end: n.functionDetails.end ?? m.functionDetails.end,
|
|
648
648
|
// true-wins: a UI call has multiple reps (streaming part with isUi, the
|
|
649
649
|
// persisted FunctionCall, the result) and they interleave. `??` let a later
|
|
650
650
|
// `false`/`undefined` rep clobber an earlier `true`; OR-ing keeps it sticky.
|
|
651
|
-
isUi: n.functionDetails.isUi === !0 ||
|
|
651
|
+
isUi: n.functionDetails.isUi === !0 || m.functionDetails.isUi === !0,
|
|
652
652
|
// Keep the call's friendly args summary when the result event (which has none) folds in.
|
|
653
|
-
argsDescription: n.functionDetails.argsDescription ??
|
|
653
|
+
argsDescription: n.functionDetails.argsDescription ?? m.functionDetails.argsDescription,
|
|
654
654
|
// The tool's client-only payload rides the RESULT event; keep it sticky so a
|
|
655
655
|
// later rep without one can't clobber it. This is what a uiTool renderer reads.
|
|
656
|
-
clientOutput: n.functionDetails.clientOutput ??
|
|
656
|
+
clientOutput: n.functionDetails.clientOutput ?? m.functionDetails.clientOutput,
|
|
657
|
+
// Ask-user component ([KernelUIComponent]) — sticky like isUi/clientOutput. The
|
|
658
|
+
// streaming final CALL carries it, but the PartialFunctionCall it folds onto (and a
|
|
659
|
+
// later result rep) may not; dropping it strips the part's askUser classification so
|
|
660
|
+
// the docked drawer never surfaces (issue #60 — esp. a no-arg tool like update_profile,
|
|
661
|
+
// which has no name match to fall back on the way ask_user/askauth do).
|
|
662
|
+
askUserComponent: n.functionDetails.askUserComponent ?? m.functionDetails.askUserComponent,
|
|
663
|
+
isAskUser: n.functionDetails.isAskUser || m.functionDetails.isAskUser || !!(n.functionDetails.askUserComponent ?? m.functionDetails.askUserComponent)
|
|
657
664
|
}
|
|
658
665
|
};
|
|
659
666
|
h(), u.set(C, N), N.eventType === y.FunctionResponse && this.eventBusService.gatewayEmitFunctionResponse(N.functionDetails), s.push(N), w > -1 && (v(), o[w] = N);
|
|
660
667
|
} else {
|
|
661
668
|
if (C && n.functionDetails && !E && (h(), u.set(C, n)), r && r.textAppendable) {
|
|
662
|
-
const
|
|
669
|
+
const m = {
|
|
663
670
|
...r,
|
|
664
671
|
ended: /* @__PURE__ */ new Date(),
|
|
665
672
|
isStillWriting: !1
|
|
666
673
|
};
|
|
667
|
-
v(), o[o.length - 1] =
|
|
674
|
+
v(), o[o.length - 1] = m, s.push(m);
|
|
668
675
|
}
|
|
669
676
|
const w = {
|
|
670
677
|
...n,
|
|
@@ -672,12 +679,12 @@ ${n.value}
|
|
|
672
679
|
isStillWriting: n.textAppendable,
|
|
673
680
|
partial: t.partial
|
|
674
681
|
};
|
|
675
|
-
(et = w.functionDetails) != null && et.silent || s.push(w), o = [...o, w],
|
|
682
|
+
(et = w.functionDetails) != null && et.silent || s.push(w), o = [...o, w], p = !0;
|
|
676
683
|
}
|
|
677
684
|
}
|
|
678
685
|
let I = o[o.length - 1] ?? null;
|
|
679
686
|
if (I && n && n.textAppendable) {
|
|
680
|
-
const
|
|
687
|
+
const g = {
|
|
681
688
|
...I,
|
|
682
689
|
partial: t.partial,
|
|
683
690
|
textDetails: I.textDetails ? { ...I.textDetails } : { version: 0 }
|
|
@@ -685,32 +692,32 @@ ${n.value}
|
|
|
685
692
|
let C = !1;
|
|
686
693
|
if (t.partial) {
|
|
687
694
|
try {
|
|
688
|
-
|
|
695
|
+
g.textDetails.version++, p || (g.text = (I.text ?? "") + (n.text ?? ""));
|
|
689
696
|
} catch (E) {
|
|
690
697
|
console.error("Error here", E.toString());
|
|
691
698
|
}
|
|
692
|
-
|
|
693
|
-
...
|
|
694
|
-
text:
|
|
695
|
-
},
|
|
699
|
+
g.textLastChunk = n.text ?? "", g.isStillWriting = !0, C = !0, n.thoughtDetails && g.thoughtDetails && n.thoughtDetails.text !== g.thoughtDetails.text && (g.thoughtDetails = {
|
|
700
|
+
...g.thoughtDetails,
|
|
701
|
+
text: g.thoughtDetails.text + n.thoughtDetails.text
|
|
702
|
+
}, g.thoughtLastChunk = n.thoughtDetails.text);
|
|
696
703
|
} else
|
|
697
|
-
|
|
704
|
+
g.isStillWriting = !1, g.text = n.text ?? "", g.textDetails.version++, n.thoughtDetails && (g.thoughtDetails = {
|
|
698
705
|
...n.thoughtDetails,
|
|
699
706
|
text: n.thoughtDetails.text.trim()
|
|
700
707
|
}), C = !l;
|
|
701
|
-
v(), o[o.length - 1] =
|
|
708
|
+
v(), o[o.length - 1] = g, I = g, C && s.push(g);
|
|
702
709
|
}
|
|
703
710
|
let M = e.artifactData ?? [];
|
|
704
711
|
if (t.llmArtifacts && t.llmArtifacts.length > 0) {
|
|
705
|
-
let
|
|
712
|
+
let g = !1;
|
|
706
713
|
for (const C of t.llmArtifacts) {
|
|
707
714
|
const E = C.toArtifact();
|
|
708
|
-
|
|
709
|
-
const w = M.findIndex((
|
|
715
|
+
g || (M = M.slice(), g = !0);
|
|
716
|
+
const w = M.findIndex((m) => m.id === E.id);
|
|
710
717
|
w === -1 ? M.push(E) : M[w] = E;
|
|
711
718
|
}
|
|
712
719
|
}
|
|
713
|
-
const
|
|
720
|
+
const U = {
|
|
714
721
|
...e,
|
|
715
722
|
version: e.version + 1,
|
|
716
723
|
parts: o,
|
|
@@ -720,18 +727,18 @@ ${n.value}
|
|
|
720
727
|
partial: t.partial,
|
|
721
728
|
asyncFinalResponse: t.asyncFinalResponse
|
|
722
729
|
};
|
|
723
|
-
return this.interaction =
|
|
724
|
-
updatedInteraction:
|
|
730
|
+
return this.interaction = U, {
|
|
731
|
+
updatedInteraction: U,
|
|
725
732
|
updatedParts: s,
|
|
726
733
|
newArtifacts: i,
|
|
727
|
-
mainBranch:
|
|
734
|
+
mainBranch: U,
|
|
728
735
|
analyticsBranch: null,
|
|
729
736
|
analyticsBranchPartsChanged: null,
|
|
730
737
|
mainBranchPartsChanged: s
|
|
731
738
|
};
|
|
732
739
|
}
|
|
733
740
|
};
|
|
734
|
-
|
|
741
|
+
f(z, "InteractionService");
|
|
735
742
|
let b = z;
|
|
736
743
|
const kt = 1200 * 1e3, D = class D {
|
|
737
744
|
constructor(t, e, s, i, n, r, l, o, u, d = St.Interactive) {
|
|
@@ -759,46 +766,46 @@ const kt = 1200 * 1e3, D = class D {
|
|
|
759
766
|
//Define all SSEServer methods here, use from SSEServer.ts
|
|
760
767
|
a(this, "eventBusService");
|
|
761
768
|
a(this, "artifactService");
|
|
762
|
-
a(this, "onTurnOpen", /* @__PURE__ */
|
|
769
|
+
a(this, "onTurnOpen", /* @__PURE__ */ f((t) => {
|
|
763
770
|
this.eventBusService.gatewayOnTurnOpen(t);
|
|
764
771
|
}, "onTurnOpen"));
|
|
765
|
-
a(this, "offTurnOpen", /* @__PURE__ */
|
|
772
|
+
a(this, "offTurnOpen", /* @__PURE__ */ f((t) => {
|
|
766
773
|
this.eventBusService.gatewayOffTurnOpen(t);
|
|
767
774
|
}, "offTurnOpen"));
|
|
768
|
-
a(this, "onTurnComplete", /* @__PURE__ */
|
|
775
|
+
a(this, "onTurnComplete", /* @__PURE__ */ f((t) => {
|
|
769
776
|
this.eventBusService.gatewayOnTurnComplete(t);
|
|
770
777
|
}, "onTurnComplete"));
|
|
771
|
-
a(this, "offTurnComplete", /* @__PURE__ */
|
|
778
|
+
a(this, "offTurnComplete", /* @__PURE__ */ f((t) => {
|
|
772
779
|
this.eventBusService.gatewayOffTurnComplete(t);
|
|
773
780
|
}, "offTurnComplete"));
|
|
774
|
-
a(this, "onStreamError", /* @__PURE__ */
|
|
781
|
+
a(this, "onStreamError", /* @__PURE__ */ f((t) => {
|
|
775
782
|
this.eventBusService.gatewayOnStreamError(t);
|
|
776
783
|
}, "onStreamError"));
|
|
777
|
-
a(this, "offStreamError", /* @__PURE__ */
|
|
784
|
+
a(this, "offStreamError", /* @__PURE__ */ f((t) => {
|
|
778
785
|
this.eventBusService.gatewayOffStreamError(t);
|
|
779
786
|
}, "offStreamError"));
|
|
780
|
-
a(this, "onStreamEnded", /* @__PURE__ */
|
|
787
|
+
a(this, "onStreamEnded", /* @__PURE__ */ f((t) => {
|
|
781
788
|
this.eventBusService.gatewayOnStreamEnded(t);
|
|
782
789
|
}, "onStreamEnded"));
|
|
783
|
-
a(this, "offStreamEnded", /* @__PURE__ */
|
|
790
|
+
a(this, "offStreamEnded", /* @__PURE__ */ f((t) => {
|
|
784
791
|
this.eventBusService.gatewayOffStreamEnded(t);
|
|
785
792
|
}, "offStreamEnded"));
|
|
786
|
-
a(this, "onMessage", /* @__PURE__ */
|
|
793
|
+
a(this, "onMessage", /* @__PURE__ */ f((t) => {
|
|
787
794
|
this.eventBusService.gatewayOnMessage(t);
|
|
788
795
|
}, "onMessage"));
|
|
789
|
-
a(this, "offMessage", /* @__PURE__ */
|
|
796
|
+
a(this, "offMessage", /* @__PURE__ */ f((t) => {
|
|
790
797
|
this.eventBusService.gatewayOffMessage(t);
|
|
791
798
|
}, "offMessage"));
|
|
792
|
-
a(this, "onFirstToken", /* @__PURE__ */
|
|
799
|
+
a(this, "onFirstToken", /* @__PURE__ */ f((t) => {
|
|
793
800
|
this.eventBusService.gatewayOnFirstToken(t);
|
|
794
801
|
}, "onFirstToken"));
|
|
795
|
-
a(this, "offFirstToken", /* @__PURE__ */
|
|
802
|
+
a(this, "offFirstToken", /* @__PURE__ */ f((t) => {
|
|
796
803
|
this.eventBusService.gatewayOffFirstToken(t);
|
|
797
804
|
}, "offFirstToken"));
|
|
798
|
-
a(this, "onFunctionResponse", /* @__PURE__ */
|
|
805
|
+
a(this, "onFunctionResponse", /* @__PURE__ */ f((t) => {
|
|
799
806
|
this.eventBusService.gatewayOnFunctionResponse(t);
|
|
800
807
|
}, "onFunctionResponse"));
|
|
801
|
-
a(this, "offFunctionResponse", /* @__PURE__ */
|
|
808
|
+
a(this, "offFunctionResponse", /* @__PURE__ */ f((t) => {
|
|
802
809
|
this.eventBusService.gatewayOffFunctionResponse(t);
|
|
803
810
|
}, "offFunctionResponse"));
|
|
804
811
|
a(this, "toolSessionId", null);
|
|
@@ -1158,9 +1165,9 @@ const kt = 1200 * 1e3, D = class D {
|
|
|
1158
1165
|
return `${this.msg_order}_${e}`;
|
|
1159
1166
|
}
|
|
1160
1167
|
};
|
|
1161
|
-
|
|
1168
|
+
f(D, "AgentGatewayService"), a(D, "SUSPENSION_MSG", "SUSPEND"), a(D, "CURRENT_MSG_THROTTLE_MS", 20);
|
|
1162
1169
|
let $ = D;
|
|
1163
|
-
const W = 4001, _t = 4002, rt = 4, Ft = 3, Rt = 500, bt = 3e4,
|
|
1170
|
+
const W = 4001, _t = 4002, rt = 4, Ft = 3, Rt = 500, bt = 3e4, Ut = 2, Lt = 0.2, ot = 2, j = class j {
|
|
1164
1171
|
constructor(t = "ws://localhost:8000", e) {
|
|
1165
1172
|
a(this, "ws", null);
|
|
1166
1173
|
a(this, "stats");
|
|
@@ -1257,11 +1264,11 @@ const W = 4001, _t = 4002, rt = 4, Ft = 3, Rt = 500, bt = 3e4, Lt = 2, Ut = 0.2,
|
|
|
1257
1264
|
*/
|
|
1258
1265
|
connect(t) {
|
|
1259
1266
|
return new Promise(async (e, s) => {
|
|
1260
|
-
var
|
|
1267
|
+
var p;
|
|
1261
1268
|
this.intentionalDisconnect = !1;
|
|
1262
1269
|
const i = this._internalReconnect;
|
|
1263
1270
|
i || (this.cancelPendingReconnect(), this.isReconnecting = !1, this.reconnectAttempts = 0, this.lastSeq = -1), this._internalReconnect = !1;
|
|
1264
|
-
const n = (
|
|
1271
|
+
const n = (p = this.getToken) == null ? void 0 : p.call(this), r = [];
|
|
1265
1272
|
n && r.push(`access_token=${encodeURIComponent(n)}`), t && this.lastSeq >= 0 && r.push(`lastSeq=${this.lastSeq}`);
|
|
1266
1273
|
const l = r.length > 0 ? `?${r.join("&")}` : "", o = this.baseUrl.replace(/^http:\/\//, "ws://").replace(/^https:\/\//, "wss://"), u = `${o}/ws/connect/${t ?? ""}${l}`, d = `${o}/ws/connect/${t ?? ""}` + (i && t && this.lastSeq >= 0 ? ` (resume lastSeq=${this.lastSeq})` : "");
|
|
1267
1274
|
if (console.log("Connecting to ", d), this.ws) {
|
|
@@ -1276,29 +1283,29 @@ const W = 4001, _t = 4002, rt = 4, Ft = 3, Rt = 500, bt = 3e4, Lt = 2, Ut = 0.2,
|
|
|
1276
1283
|
let h = !1;
|
|
1277
1284
|
this.ws.onopen = () => {
|
|
1278
1285
|
console.log("[WebSocket] Connected");
|
|
1279
|
-
const
|
|
1280
|
-
this.isReconnecting = !1, this.reconnectAttempts = 0, this.pingPongStack.push((/* @__PURE__ */ new Date()).getTime()), this.ping(), this.monitor(), this.onOpen && this.onOpen(),
|
|
1281
|
-
}, this.ws.onmessage = (
|
|
1286
|
+
const S = this.isReconnecting;
|
|
1287
|
+
this.isReconnecting = !1, this.reconnectAttempts = 0, this.pingPongStack.push((/* @__PURE__ */ new Date()).getTime()), this.ping(), this.monitor(), this.onOpen && this.onOpen(), S && this.onReconnected && this.onReconnected(t ?? this.lastKnownSessionId ?? "");
|
|
1288
|
+
}, this.ws.onmessage = (S) => {
|
|
1282
1289
|
try {
|
|
1283
1290
|
this.lastActivity = (/* @__PURE__ */ new Date()).getTime();
|
|
1284
|
-
const I = this.streamingResponseSerializer.parse(
|
|
1291
|
+
const I = this.streamingResponseSerializer.parse(S.data);
|
|
1285
1292
|
if (!I)
|
|
1286
1293
|
throw "Error parsing event JSON";
|
|
1287
|
-
const M = this.handleMessage(I,
|
|
1294
|
+
const M = this.handleMessage(I, S.data);
|
|
1288
1295
|
!h && (M != null && M.timestamp) && (h = !0, this.hasEverReceivedPacket = !0);
|
|
1289
1296
|
} catch (I) {
|
|
1290
1297
|
console.error("[WebSocket] Error parsing message:", I);
|
|
1291
1298
|
}
|
|
1292
|
-
}, this.ws.onerror = (
|
|
1293
|
-
console.error("[WebSocket] Error:",
|
|
1294
|
-
}, this.ws.onclose = (
|
|
1295
|
-
console.log("[WebSocket] Closed:",
|
|
1299
|
+
}, this.ws.onerror = (S) => {
|
|
1300
|
+
console.error("[WebSocket] Error:", S), this.onError && this.onError("WebSocket error");
|
|
1301
|
+
}, this.ws.onclose = (S) => {
|
|
1302
|
+
console.log("[WebSocket] Closed:", S.code, S.reason), this.monitorInterval && (clearInterval(this.monitorInterval), this.monitorInterval = null), this.pingPongStack = [];
|
|
1296
1303
|
const I = this.sessionId ?? this.lastKnownSessionId;
|
|
1297
|
-
if (this.sessionId = void 0, (h || this.hasEverReceivedPacket) && this.shouldAttemptReconnect(
|
|
1298
|
-
this.scheduleReconnect(I,
|
|
1304
|
+
if (this.sessionId = void 0, (h || this.hasEverReceivedPacket) && this.shouldAttemptReconnect(S.code)) {
|
|
1305
|
+
this.scheduleReconnect(I, S.code, S.reason);
|
|
1299
1306
|
return;
|
|
1300
1307
|
}
|
|
1301
|
-
this.isReconnecting = !1, this.reconnectAttempts = 0, this.onClose && this.onClose(
|
|
1308
|
+
this.isReconnecting = !1, this.reconnectAttempts = 0, this.onClose && this.onClose(S.code, S.reason);
|
|
1302
1309
|
};
|
|
1303
1310
|
let v = 0;
|
|
1304
1311
|
for (this.sessionId = void 0; !this.sessionId && v < 30; )
|
|
@@ -1322,7 +1329,7 @@ const W = 4001, _t = 4002, rt = 4, Ft = 3, Rt = 500, bt = 3e4, Lt = 2, Ut = 0.2,
|
|
|
1322
1329
|
this.reconnectTimer && (clearTimeout(this.reconnectTimer), this.reconnectTimer = null);
|
|
1323
1330
|
}
|
|
1324
1331
|
computeBackoffDelay() {
|
|
1325
|
-
const t = Rt * Math.pow(
|
|
1332
|
+
const t = Rt * Math.pow(Ut, this.reconnectAttempts), e = Math.min(t, bt), s = e * Lt * (Math.random() * 2 - 1);
|
|
1326
1333
|
return Math.max(0, Math.round(e + s));
|
|
1327
1334
|
}
|
|
1328
1335
|
scheduleReconnect(t, e, s) {
|
|
@@ -1477,7 +1484,7 @@ const W = 4001, _t = 4002, rt = 4, Ft = 3, Rt = 500, bt = 3e4, Lt = 2, Ut = 0.2,
|
|
|
1477
1484
|
}
|
|
1478
1485
|
suspendStream() {
|
|
1479
1486
|
this.sendBaseMessage({
|
|
1480
|
-
Action:
|
|
1487
|
+
Action: L.Suspend,
|
|
1481
1488
|
AgentId: "",
|
|
1482
1489
|
InteractionId: "",
|
|
1483
1490
|
ModelId: ""
|
|
@@ -1486,7 +1493,7 @@ const W = 4001, _t = 4002, rt = 4, Ft = 3, Rt = 500, bt = 3e4, Lt = 2, Ut = 0.2,
|
|
|
1486
1493
|
/** Send the user's answer to a parked ask_user tool call (ChatAction.AnswerHumanTool). */
|
|
1487
1494
|
answerHumanTool(t, e) {
|
|
1488
1495
|
this.sendBaseMessage({
|
|
1489
|
-
Action:
|
|
1496
|
+
Action: L.AnswerHumanTool,
|
|
1490
1497
|
AgentId: "",
|
|
1491
1498
|
InteractionId: "",
|
|
1492
1499
|
ToolCallId: t,
|
|
@@ -1575,7 +1582,7 @@ const W = 4001, _t = 4002, rt = 4, Ft = 3, Rt = 500, bt = 3e4, Lt = 2, Ut = 0.2,
|
|
|
1575
1582
|
}
|
|
1576
1583
|
}
|
|
1577
1584
|
};
|
|
1578
|
-
|
|
1585
|
+
f(j, "WebSocketConnecionV2");
|
|
1579
1586
|
let ct = j;
|
|
1580
1587
|
const xt = "envision_agent_sessionId", Y = class Y extends $ {
|
|
1581
1588
|
constructor(e, s, i, n, r, l, o, u, d, h, v) {
|
|
@@ -1589,30 +1596,30 @@ const xt = "envision_agent_sessionId", Y = class Y extends $ {
|
|
|
1589
1596
|
a(this, "lastConnectionPromise", null);
|
|
1590
1597
|
a(this, "socketState", P.Disconnected);
|
|
1591
1598
|
a(this, "streamOpened", !1);
|
|
1592
|
-
this.hearBeatPort = h, this.root_url = this.base_url, this.wsService = u, this.wsService.onEvent = async (
|
|
1593
|
-
await super.Message(
|
|
1594
|
-
}, this.wsService.onNewPacket = (
|
|
1595
|
-
this.sessionState.setStatistics(
|
|
1596
|
-
}, this.wsService.onPong = (
|
|
1597
|
-
}, this.wsService.onError = (
|
|
1599
|
+
this.hearBeatPort = h, this.root_url = this.base_url, this.wsService = u, this.wsService.onEvent = async (p) => {
|
|
1600
|
+
await super.Message(p);
|
|
1601
|
+
}, this.wsService.onNewPacket = (p) => {
|
|
1602
|
+
this.sessionState.setStatistics(p), this.eventBusService.streamEmitNewChunk(p);
|
|
1603
|
+
}, this.wsService.onPong = (p) => {
|
|
1604
|
+
}, this.wsService.onError = (p) => {
|
|
1598
1605
|
this.streamOpened = !1;
|
|
1599
|
-
const
|
|
1600
|
-
data: this.getErrorEvent(
|
|
1606
|
+
const S = {
|
|
1607
|
+
data: this.getErrorEvent(p),
|
|
1601
1608
|
lastEventId: (/* @__PURE__ */ new Date()).getTime().toString(),
|
|
1602
1609
|
origin: "gatewayService"
|
|
1603
1610
|
};
|
|
1604
|
-
console.error("Stream error:",
|
|
1605
|
-
message: "Stream error" +
|
|
1611
|
+
console.error("Stream error:", p), this.notificationPort.pushNotification({
|
|
1612
|
+
message: "Stream error" + p,
|
|
1606
1613
|
type: "warning"
|
|
1607
|
-
}), super.Message(
|
|
1614
|
+
}), super.Message(S);
|
|
1608
1615
|
}, this.wsService.onOpen = () => {
|
|
1609
1616
|
this.sessionState.setConnectionStatus(P.Connected);
|
|
1610
|
-
}, this.wsService.onReconnected = (
|
|
1617
|
+
}, this.wsService.onReconnected = (p) => {
|
|
1611
1618
|
this.sessionState.setConnectionStatus(P.Connected);
|
|
1612
|
-
}, this.wsService.onFirstToken = (
|
|
1613
|
-
this.localEmitFirstToken(
|
|
1614
|
-
}, this.wsService.onClose = (
|
|
1615
|
-
|
|
1619
|
+
}, this.wsService.onFirstToken = (p) => {
|
|
1620
|
+
this.localEmitFirstToken(p);
|
|
1621
|
+
}, this.wsService.onClose = (p, S) => {
|
|
1622
|
+
p != W && this.sessionState.setConnectionStatus(P.Disconnected);
|
|
1616
1623
|
};
|
|
1617
1624
|
}
|
|
1618
1625
|
reset(e, s) {
|
|
@@ -1711,7 +1718,7 @@ const xt = "envision_agent_sessionId", Y = class Y extends $ {
|
|
|
1711
1718
|
}
|
|
1712
1719
|
// Send a message to the server via HTTP POST
|
|
1713
1720
|
async sendMessageInternal(e, s, i) {
|
|
1714
|
-
var l, o, u, d, h, v,
|
|
1721
|
+
var l, o, u, d, h, v, p, S;
|
|
1715
1722
|
const n = this.suspendState;
|
|
1716
1723
|
this.suspendState = !1;
|
|
1717
1724
|
const r = this.startInteraction(e.friendlyMessage ?? e.data, n);
|
|
@@ -1724,7 +1731,7 @@ const xt = "envision_agent_sessionId", Y = class Y extends $ {
|
|
|
1724
1731
|
return this.wsService.sendMessage({
|
|
1725
1732
|
Content: e.data,
|
|
1726
1733
|
SessionId: this.sessionId,
|
|
1727
|
-
Action:
|
|
1734
|
+
Action: L.SendMessage,
|
|
1728
1735
|
ModelId: this.config.model,
|
|
1729
1736
|
InteractionId: r.interactionId,
|
|
1730
1737
|
AgentId: (u = this.config.agentConfig) == null ? void 0 : u.id,
|
|
@@ -1740,18 +1747,18 @@ const xt = "envision_agent_sessionId", Y = class Y extends $ {
|
|
|
1740
1747
|
},
|
|
1741
1748
|
// Forward image attachments as a structured payload (PascalCase
|
|
1742
1749
|
// keys to match the C# `Message.Images` / `MessageImage` model).
|
|
1743
|
-
Images: (
|
|
1750
|
+
Images: (p = e.images) != null && p.length ? e.images.map((I) => ({ MimeType: I.mimeType, Data: I.data })) : void 0,
|
|
1744
1751
|
// Client-only UI representation for this turn (PascalCase to match the C# `Message.UserUi`
|
|
1745
1752
|
// model). The server persists it as a UserUiContent sibling and strips it from the model
|
|
1746
1753
|
// request; Content remains the only model-facing text.
|
|
1747
|
-
UserUi: (
|
|
1754
|
+
UserUi: (S = e.userUi) != null && S.name ? { Name: e.userUi.name, Args: e.userUi.args } : void 0
|
|
1748
1755
|
}), this.localOpen(r.interactionId, "system"), Promise.resolve({
|
|
1749
1756
|
interaction: r,
|
|
1750
1757
|
success: !0
|
|
1751
1758
|
});
|
|
1752
1759
|
}
|
|
1753
1760
|
};
|
|
1754
|
-
|
|
1761
|
+
f(Y, "AgentGatewayWSAsync");
|
|
1755
1762
|
let lt = Y;
|
|
1756
1763
|
const Q = class Q {
|
|
1757
1764
|
constructor(t, e) {
|
|
@@ -1808,7 +1815,7 @@ const Q = class Q {
|
|
|
1808
1815
|
}
|
|
1809
1816
|
}
|
|
1810
1817
|
};
|
|
1811
|
-
|
|
1818
|
+
f(Q, "HttpArtifactService");
|
|
1812
1819
|
let ht = Q;
|
|
1813
1820
|
export {
|
|
1814
1821
|
$ as A,
|
|
@@ -1821,4 +1828,4 @@ export {
|
|
|
1821
1828
|
lt as a,
|
|
1822
1829
|
jt as u
|
|
1823
1830
|
};
|
|
1824
|
-
//# sourceMappingURL=httpArtifactService-
|
|
1831
|
+
//# sourceMappingURL=httpArtifactService-B668XBHO.js.map
|