@aintela/chat 0.2.45 → 0.2.47
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/components.js +217 -260
- package/dist/components.js.map +1 -1
- package/dist/hooks.js +1 -1
- package/dist/{httpArtifactService--6WV2FDW.js → httpArtifactService-CcYAfh2q.js} +62 -59
- package/dist/httpArtifactService-CcYAfh2q.js.map +1 -0
- package/dist/{httpSessionService-CNzThf-T.js → httpSessionService-BDlqebW2.js} +2 -2
- package/dist/{httpSessionService-CNzThf-T.js.map → httpSessionService-BDlqebW2.js.map} +1 -1
- package/dist/index.js +4 -4
- package/dist/models.js +1 -1
- package/dist/{serializer-uea8YsIP.js → serializer-DNt8QqNO.js} +241 -225
- package/dist/serializer-DNt8QqNO.js.map +1 -0
- package/dist/services.js +2 -2
- package/dist/src/components/AiChat/ChatPane/parts/types.d.ts +10 -4
- package/dist/src/models/ServerEvent.d.ts +17 -0
- package/dist/src/models/semanticKernelModel/models.d.ts +3 -0
- package/dist/{useChatSessions-mnF6pUGm.js → useChatSessions-sbBneRk9.js} +2 -2
- package/dist/{useChatSessions-mnF6pUGm.js.map → useChatSessions-sbBneRk9.js.map} +1 -1
- package/package.json +1 -1
- package/dist/httpArtifactService--6WV2FDW.js.map +0 -1
- package/dist/serializer-uea8YsIP.js.map +0 -1
package/dist/hooks.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
var rt = Object.defineProperty;
|
|
2
|
-
var St = (
|
|
3
|
-
var g = (
|
|
4
|
-
var a = (
|
|
2
|
+
var St = (D, t, e) => t in D ? rt(D, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : D[t] = e;
|
|
3
|
+
var g = (D, t) => rt(D, "name", { value: t, configurable: !0 });
|
|
4
|
+
var a = (D, t, e) => St(D, typeof t != "symbol" ? t + "" : t, e);
|
|
5
5
|
import { d as L, t as wt, E as C, k as yt, j as Tt, q as It, C as B } from "./environmentUtils-CUVZ6Dq1.js";
|
|
6
|
-
import { I as _, S as gt, g as Ct, L as vt, P as x, b as Et, e as Mt, T as
|
|
6
|
+
import { I as _, S as gt, g as Ct, L as vt, P as x, b as Et, e as Mt, T as Dt, c as Ot } from "./serializer-DNt8QqNO.js";
|
|
7
7
|
import { unified as At } from "unified";
|
|
8
8
|
import kt from "remark-parse";
|
|
9
9
|
import { toMarkdown as Nt } from "mdast-util-to-markdown";
|
|
10
10
|
import { format as Pt } from "date-fns";
|
|
11
11
|
import _t from "lodash";
|
|
12
12
|
import { P as bt, C as R } from "./Prompt-DZb7OaPp.js";
|
|
13
|
-
import { r as Ft } from "./httpSessionService-
|
|
13
|
+
import { r as Ft } from "./httpSessionService-BDlqebW2.js";
|
|
14
14
|
const w = {
|
|
15
15
|
ARTIFACTS: "envision-artifacts",
|
|
16
16
|
SECTIONS: "envision-sections",
|
|
@@ -199,8 +199,8 @@ const w = {
|
|
|
199
199
|
};
|
|
200
200
|
g(K, "LocalStorageService");
|
|
201
201
|
let ot = K;
|
|
202
|
-
const te = /* @__PURE__ */ g((
|
|
203
|
-
const t =
|
|
202
|
+
const te = /* @__PURE__ */ g((D) => {
|
|
203
|
+
const t = D.getPrompts(), e = t.length;
|
|
204
204
|
if (e > 0) {
|
|
205
205
|
const s = t[0].promptText, i = t[t.length - 1].promptText, n = t[0].created;
|
|
206
206
|
return { promptState: e + "_" + s + "_" + i + "_" + n };
|
|
@@ -561,8 +561,8 @@ ${n.value}
|
|
|
561
561
|
let n = new W();
|
|
562
562
|
for (let u = 0; u < t.length; u++) {
|
|
563
563
|
const h = t[u];
|
|
564
|
-
let
|
|
565
|
-
!e &&
|
|
564
|
+
let m = !((((l = h.functionDetails) == null ? void 0 : l.isUi) ?? !1) || ((o = h.functionDetails) == null ? void 0 : o.cancelUi) !== !0 && (((d = h.functionDetails) == null ? void 0 : d.isAskUser) ?? !1)) && h.eventType !== C.Text && h.eventType !== C.Thought && (h.eventType === C.FunctionCall || h.eventType === C.PartialFunctionCall || h.eventType === C.FunctionResponse) && u < t.length - 1;
|
|
565
|
+
!e && m && !s || (m ? (h.eventType == C.Thought && (n.hasThoughts = !0), n.parts.push(h), n.isLastGroup = u === t.length - 1) : (n.parts.length > 0 && (i.push(n), n = new W()), i.push({
|
|
566
566
|
type: pt.block,
|
|
567
567
|
parts: [h],
|
|
568
568
|
isLastGroup: u === t.length - 1,
|
|
@@ -600,21 +600,23 @@ ${n.value}
|
|
|
600
600
|
const f = o[o.length - 1];
|
|
601
601
|
(((k = (A = f.thoughtDetails) == null ? void 0 : A.text) == null ? void 0 : k.length) ?? ((et = f.text) == null ? void 0 : et.length) ?? 0) > Rt && (l = !0);
|
|
602
602
|
}
|
|
603
|
-
let
|
|
603
|
+
let m = !1;
|
|
604
604
|
if ((n == null ? void 0 : n.eventType) === C.FunctionClientOutput && !!((st = n.functionDetails) != null && st.id) && n) {
|
|
605
605
|
const f = n.functionDetails.id, I = n.functionDetails.clientOutput, E = o.findIndex((S) => {
|
|
606
|
-
var
|
|
607
|
-
return ((
|
|
606
|
+
var p;
|
|
607
|
+
return ((p = S.functionDetails) == null ? void 0 : p.id) === f;
|
|
608
608
|
});
|
|
609
609
|
if (E > -1) {
|
|
610
|
-
const S = o[E],
|
|
610
|
+
const S = o[E], p = {
|
|
611
611
|
...S,
|
|
612
612
|
functionDetails: {
|
|
613
613
|
...S.functionDetails,
|
|
614
|
-
clientOutput: I ?? S.functionDetails.clientOutput
|
|
614
|
+
clientOutput: I ?? S.functionDetails.clientOutput,
|
|
615
|
+
// Sticky true-wins: this event IS the park, and a later merge must not clear it.
|
|
616
|
+
parked: n.functionDetails.parked === !0 || S.functionDetails.parked === !0
|
|
615
617
|
}
|
|
616
618
|
};
|
|
617
|
-
v(), o[E] =
|
|
619
|
+
v(), o[E] = p, h(), d.set(f, p), s.push(p);
|
|
618
620
|
} else {
|
|
619
621
|
const S = {
|
|
620
622
|
...n,
|
|
@@ -631,12 +633,12 @@ ${n.value}
|
|
|
631
633
|
const S = o.findIndex((mt) => {
|
|
632
634
|
var at;
|
|
633
635
|
return ((at = mt.functionDetails) == null ? void 0 : at.id) === I;
|
|
634
|
-
}),
|
|
635
|
-
...
|
|
636
|
+
}), p = S > -1 ? o[S] : E, F = {
|
|
637
|
+
...p,
|
|
636
638
|
eventType: n.eventType,
|
|
637
639
|
functionDetails: {
|
|
638
|
-
id:
|
|
639
|
-
name: n.functionDetails.name ??
|
|
640
|
+
id: p.functionDetails.id,
|
|
641
|
+
name: n.functionDetails.name ?? p.functionDetails.name,
|
|
640
642
|
// Take the parsed args from the incoming event when
|
|
641
643
|
// present (the full FunctionCall carries them), fall
|
|
642
644
|
// back to what was already on the part. Previously
|
|
@@ -645,41 +647,42 @@ ${n.value}
|
|
|
645
647
|
// args off every full FunctionCall fold because the
|
|
646
648
|
// PartialFunctionCall stream only accumulates raw
|
|
647
649
|
// JSON in `.text` — `.args` stayed undefined.
|
|
648
|
-
args: n.functionDetails.args ??
|
|
650
|
+
args: n.functionDetails.args ?? p.functionDetails.args,
|
|
649
651
|
response: n.functionDetails.response,
|
|
650
652
|
status: n.functionDetails.status ?? "Composing",
|
|
651
|
-
start: n.functionDetails.start ??
|
|
652
|
-
end: n.functionDetails.end ??
|
|
653
|
+
start: n.functionDetails.start ?? p.functionDetails.start,
|
|
654
|
+
end: n.functionDetails.end ?? p.functionDetails.end,
|
|
653
655
|
// true-wins: a UI call has multiple reps (streaming part with isUi, the
|
|
654
656
|
// persisted FunctionCall, the result) and they interleave. `??` let a later
|
|
655
657
|
// `false`/`undefined` rep clobber an earlier `true`; OR-ing keeps it sticky.
|
|
656
|
-
isUi: n.functionDetails.isUi === !0 ||
|
|
658
|
+
isUi: n.functionDetails.isUi === !0 || p.functionDetails.isUi === !0,
|
|
657
659
|
// Keep the call's friendly args summary when the result event (which has none) folds in.
|
|
658
|
-
argsDescription: n.functionDetails.argsDescription ??
|
|
660
|
+
argsDescription: n.functionDetails.argsDescription ?? p.functionDetails.argsDescription,
|
|
659
661
|
// The tool's client-only payload rides the RESULT event; keep it sticky so a
|
|
660
662
|
// later rep without one can't clobber it. This is what a uiTool renderer reads.
|
|
661
|
-
clientOutput: n.functionDetails.clientOutput ??
|
|
663
|
+
clientOutput: n.functionDetails.clientOutput ?? p.functionDetails.clientOutput,
|
|
662
664
|
// Ask-user component ([KernelUIComponent]) — sticky like isUi/clientOutput. The
|
|
663
665
|
// streaming final CALL carries it, but the PartialFunctionCall it folds onto (and a
|
|
664
666
|
// later result rep) may not; dropping it strips the part's askUser classification so
|
|
665
667
|
// the docked drawer never surfaces (issue #60 — esp. a no-arg tool like update_profile,
|
|
666
668
|
// which has no name match to fall back on the way ask_user/askauth do).
|
|
667
|
-
askUserComponent: n.functionDetails.askUserComponent ??
|
|
668
|
-
isAskUser: n.functionDetails.isAskUser ||
|
|
669
|
+
askUserComponent: n.functionDetails.askUserComponent ?? p.functionDetails.askUserComponent,
|
|
670
|
+
isAskUser: n.functionDetails.isAskUser || p.functionDetails.isAskUser || !!(n.functionDetails.askUserComponent ?? p.functionDetails.askUserComponent),
|
|
669
671
|
// Runtime "don't render" override rides the RESULT; true-wins sticky like isUi so it
|
|
670
672
|
// survives folding onto the earlier call rep and suppresses drawer/uiTool classification.
|
|
671
|
-
cancelUi: n.functionDetails.cancelUi === !0 ||
|
|
673
|
+
cancelUi: n.functionDetails.cancelUi === !0 || p.functionDetails.cancelUi === !0,
|
|
674
|
+
parked: n.functionDetails.parked === !0 || p.functionDetails.parked === !0
|
|
672
675
|
}
|
|
673
676
|
};
|
|
674
677
|
h(), d.set(I, F), F.eventType === C.FunctionResponse && this.eventBusService.gatewayEmitFunctionResponse(F.functionDetails), s.push(F), S > -1 && (v(), o[S] = F);
|
|
675
678
|
} else {
|
|
676
679
|
if (I && n.functionDetails && !E && (h(), d.set(I, n)), r && r.textAppendable) {
|
|
677
|
-
const
|
|
680
|
+
const p = {
|
|
678
681
|
...r,
|
|
679
682
|
ended: /* @__PURE__ */ new Date(),
|
|
680
683
|
isStillWriting: !1
|
|
681
684
|
};
|
|
682
|
-
v(), o[o.length - 1] =
|
|
685
|
+
v(), o[o.length - 1] = p, s.push(p);
|
|
683
686
|
}
|
|
684
687
|
const S = {
|
|
685
688
|
...n,
|
|
@@ -687,7 +690,7 @@ ${n.value}
|
|
|
687
690
|
isStillWriting: n.textAppendable,
|
|
688
691
|
partial: t.partial
|
|
689
692
|
};
|
|
690
|
-
(it = S.functionDetails) != null && it.silent || s.push(S), o = [...o, S],
|
|
693
|
+
(it = S.functionDetails) != null && it.silent || s.push(S), o = [...o, S], m = !0;
|
|
691
694
|
}
|
|
692
695
|
}
|
|
693
696
|
let y = o[o.length - 1] ?? null;
|
|
@@ -700,7 +703,7 @@ ${n.value}
|
|
|
700
703
|
let I = !1;
|
|
701
704
|
if (t.partial) {
|
|
702
705
|
try {
|
|
703
|
-
f.textDetails.version++,
|
|
706
|
+
f.textDetails.version++, m || (f.text = (y.text ?? "") + (n.text ?? ""));
|
|
704
707
|
} catch (E) {
|
|
705
708
|
console.error("Error here", E.toString());
|
|
706
709
|
}
|
|
@@ -721,7 +724,7 @@ ${n.value}
|
|
|
721
724
|
for (const I of t.llmArtifacts) {
|
|
722
725
|
const E = I.toArtifact();
|
|
723
726
|
f || (M = M.slice(), f = !0);
|
|
724
|
-
const S = M.findIndex((
|
|
727
|
+
const S = M.findIndex((p) => p.id === E.id);
|
|
725
728
|
S === -1 ? M.push(E) : M[S] = E;
|
|
726
729
|
}
|
|
727
730
|
}
|
|
@@ -1325,7 +1328,7 @@ const H = 4001, Lt = 4002, lt = 4, xt = 3, Bt = 500, Wt = 3e4, $t = 2, qt = 0.2,
|
|
|
1325
1328
|
}
|
|
1326
1329
|
this.isReconnecting = !1, this.reconnectAttempts = 0, this.onClose && this.onClose(T.code, T.reason);
|
|
1327
1330
|
};
|
|
1328
|
-
const v = 200,
|
|
1331
|
+
const v = 200, m = 3e4, O = 8e3, y = this.ws;
|
|
1329
1332
|
this.sessionId = void 0;
|
|
1330
1333
|
let M = 0, P = 0;
|
|
1331
1334
|
for (; !this.sessionId; ) {
|
|
@@ -1337,16 +1340,16 @@ const H = 4001, Lt = 4002, lt = 4, xt = 3, Bt = 500, Wt = 3e4, $t = 2, qt = 0.2,
|
|
|
1337
1340
|
s("Connection closed before a session id was received");
|
|
1338
1341
|
return;
|
|
1339
1342
|
}
|
|
1340
|
-
if (y.readyState === WebSocket.CONNECTING && M >=
|
|
1343
|
+
if (y.readyState === WebSocket.CONNECTING && M >= m) {
|
|
1341
1344
|
try {
|
|
1342
1345
|
y.close();
|
|
1343
1346
|
} catch {
|
|
1344
1347
|
}
|
|
1345
|
-
s(`Server did not accept the connection within ${
|
|
1348
|
+
s(`Server did not accept the connection within ${m / 1e3}s`);
|
|
1346
1349
|
return;
|
|
1347
1350
|
}
|
|
1348
|
-
if (y.readyState === WebSocket.OPEN && P >=
|
|
1349
|
-
s(`Connected but no session id arrived within ${
|
|
1351
|
+
if (y.readyState === WebSocket.OPEN && P >= O) {
|
|
1352
|
+
s(`Connected but no session id arrived within ${O / 1e3}s`);
|
|
1350
1353
|
return;
|
|
1351
1354
|
}
|
|
1352
1355
|
M % 2e3 === 0 && console.log("Aguardando session Id"), await this.sleep(v), M += v, y.readyState === WebSocket.OPEN && (P += v);
|
|
@@ -1455,7 +1458,7 @@ const H = 4001, Lt = 4002, lt = 4, xt = 3, Bt = 500, Wt = 3e4, $t = 2, qt = 0.2,
|
|
|
1455
1458
|
}
|
|
1456
1459
|
};
|
|
1457
1460
|
} else {
|
|
1458
|
-
var n = new
|
|
1461
|
+
var n = new Dt();
|
|
1459
1462
|
n.text = u.partialText, h.content = {
|
|
1460
1463
|
items: [n],
|
|
1461
1464
|
role: {
|
|
@@ -1464,7 +1467,7 @@ const H = 4001, Lt = 4002, lt = 4, xt = 3, Bt = 500, Wt = 3e4, $t = 2, qt = 0.2,
|
|
|
1464
1467
|
};
|
|
1465
1468
|
}
|
|
1466
1469
|
else if (h.eventType.type == C.Thought) {
|
|
1467
|
-
var r = new
|
|
1470
|
+
var r = new Ot();
|
|
1468
1471
|
r.text = u.partialReasoning, h.content = {
|
|
1469
1472
|
items: [r],
|
|
1470
1473
|
role: {
|
|
@@ -1685,30 +1688,30 @@ const Jt = "envision_agent_sessionId", V = class V extends G {
|
|
|
1685
1688
|
a(this, "lastConnectionPromise", null);
|
|
1686
1689
|
a(this, "socketState", R.Disconnected);
|
|
1687
1690
|
a(this, "streamOpened", !1);
|
|
1688
|
-
this.hearBeatPort = h, this.root_url = this.base_url, this.wsService = d, this.wsService.onEvent = async (
|
|
1689
|
-
await super.Message(
|
|
1690
|
-
}, this.wsService.onNewPacket = (
|
|
1691
|
-
this.sessionState.setStatistics(
|
|
1692
|
-
}, this.wsService.onPong = (
|
|
1693
|
-
}, this.wsService.onError = (
|
|
1691
|
+
this.hearBeatPort = h, this.root_url = this.base_url, this.wsService = d, this.wsService.onEvent = async (m) => {
|
|
1692
|
+
await super.Message(m);
|
|
1693
|
+
}, this.wsService.onNewPacket = (m) => {
|
|
1694
|
+
this.sessionState.setStatistics(m), this.eventBusService.streamEmitNewChunk(m);
|
|
1695
|
+
}, this.wsService.onPong = (m) => {
|
|
1696
|
+
}, this.wsService.onError = (m) => {
|
|
1694
1697
|
this.streamOpened = !1;
|
|
1695
|
-
const
|
|
1696
|
-
data: this.getErrorEvent(
|
|
1698
|
+
const O = {
|
|
1699
|
+
data: this.getErrorEvent(m),
|
|
1697
1700
|
lastEventId: (/* @__PURE__ */ new Date()).getTime().toString(),
|
|
1698
1701
|
origin: "gatewayService"
|
|
1699
1702
|
};
|
|
1700
|
-
console.error("Stream error:",
|
|
1703
|
+
console.error("Stream error:", m), this.everConnected && this.notificationPort.pushNotification({
|
|
1701
1704
|
message: "Reiniciando a conexão com o servidor",
|
|
1702
1705
|
type: "info"
|
|
1703
|
-
}), super.Message(
|
|
1706
|
+
}), super.Message(O);
|
|
1704
1707
|
}, this.wsService.onOpen = () => {
|
|
1705
1708
|
this.everConnected = !0, this.sessionState.setConnectionStatus(R.Connected);
|
|
1706
|
-
}, this.wsService.onReconnected = (
|
|
1709
|
+
}, this.wsService.onReconnected = (m) => {
|
|
1707
1710
|
this.sessionState.setConnectionStatus(R.Connected);
|
|
1708
|
-
}, this.wsService.onFirstToken = (
|
|
1709
|
-
this.localEmitFirstToken(
|
|
1710
|
-
}, this.wsService.onClose = (
|
|
1711
|
-
|
|
1711
|
+
}, this.wsService.onFirstToken = (m) => {
|
|
1712
|
+
this.localEmitFirstToken(m);
|
|
1713
|
+
}, this.wsService.onClose = (m, O) => {
|
|
1714
|
+
m != H && this.sessionState.setConnectionStatus(R.Disconnected);
|
|
1712
1715
|
};
|
|
1713
1716
|
}
|
|
1714
1717
|
reset(e, s) {
|
|
@@ -1816,7 +1819,7 @@ const Jt = "envision_agent_sessionId", V = class V extends G {
|
|
|
1816
1819
|
}
|
|
1817
1820
|
// Send a message to the server via HTTP POST
|
|
1818
1821
|
async sendMessageInternal(e, s, i) {
|
|
1819
|
-
var l, o, d, u, h, v,
|
|
1822
|
+
var l, o, d, u, h, v, m, O;
|
|
1820
1823
|
const n = this.suspendState;
|
|
1821
1824
|
this.suspendState = !1;
|
|
1822
1825
|
const r = this.startInteraction(e.friendlyMessage ?? e.data, n);
|
|
@@ -1845,11 +1848,11 @@ const Jt = "envision_agent_sessionId", V = class V extends G {
|
|
|
1845
1848
|
},
|
|
1846
1849
|
// Forward image attachments as a structured payload (PascalCase
|
|
1847
1850
|
// keys to match the C# `Message.Images` / `MessageImage` model).
|
|
1848
|
-
Images: (
|
|
1851
|
+
Images: (m = e.images) != null && m.length ? e.images.map((y) => ({ MimeType: y.mimeType, Data: y.data })) : void 0,
|
|
1849
1852
|
// Client-only UI representation for this turn (PascalCase to match the C# `Message.UserUi`
|
|
1850
1853
|
// model). The server persists it as a UserUiContent sibling and strips it from the model
|
|
1851
1854
|
// request; Content remains the only model-facing text.
|
|
1852
|
-
UserUi: (
|
|
1855
|
+
UserUi: (O = e.userUi) != null && O.name ? { Name: e.userUi.name, Args: e.userUi.args } : void 0
|
|
1853
1856
|
}), this.localOpen(r.interactionId, "system"), Promise.resolve({
|
|
1854
1857
|
interaction: r,
|
|
1855
1858
|
success: !0
|
|
@@ -1926,4 +1929,4 @@ export {
|
|
|
1926
1929
|
dt as a,
|
|
1927
1930
|
te as u
|
|
1928
1931
|
};
|
|
1929
|
-
//# sourceMappingURL=httpArtifactService
|
|
1932
|
+
//# sourceMappingURL=httpArtifactService-CcYAfh2q.js.map
|