@aintela/chat 0.5.3 → 0.7.0
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/README.md +46 -3
- package/dist/Memory-BUnmYGNv.js +37 -0
- package/dist/Memory-BUnmYGNv.js.map +1 -0
- package/dist/components.js +7782 -7222
- package/dist/components.js.map +1 -1
- package/dist/{httpArtifactService-EEhF_mp9.js → detachedRunActivity-CjyFTKSw.js} +784 -339
- package/dist/detachedRunActivity-CjyFTKSw.js.map +1 -0
- package/dist/detachedRunModel-X59Pb5V-.js +67 -0
- package/dist/detachedRunModel-X59Pb5V-.js.map +1 -0
- package/dist/hooks.js +1 -1
- package/dist/httpSessionService-Ckb9Cxia.js +320 -0
- package/dist/httpSessionService-Ckb9Cxia.js.map +1 -0
- package/dist/index.js +291 -265
- package/dist/models.js +46 -39
- package/dist/{serializer-CC-nM3ig.js → serializer-DNUH6kgE.js} +607 -547
- package/dist/serializer-DNUH6kgE.js.map +1 -0
- package/dist/services.js +22 -15
- package/dist/src/components/AiChat/AiChatContext.d.ts +3 -1
- package/dist/src/components/AiChat/AiChatTypes.d.ts +7 -1
- package/dist/src/components/AiChat/ChatPane/InteractionOriginBadge.d.ts +15 -0
- package/dist/src/components/AiChat/ChatPane/messageUserOrigin.test.d.ts +1 -0
- package/dist/src/components/AiChat/ChatPane/parts/uiToolRegistry.d.ts +1 -1
- package/dist/src/components/AiChat/aiChatEngine.d.ts +13 -1
- package/dist/src/components/AiChat/index.d.ts +1 -1
- package/dist/src/components/AiChat/stateConfiguration.d.ts +5 -5
- package/dist/src/components/index.d.ts +3 -1
- package/dist/src/components/v2/{SubAgentBoxV2.d.ts → DetachedRunBoxV2.d.ts} +6 -6
- package/dist/src/components/v2/DetachedRunTaskBox.d.ts +68 -0
- package/dist/src/components/v2/DetachedRunTaskBox.live.test.d.ts +1 -0
- package/dist/src/components/v2/DetachedRunTaskBox.test.d.ts +1 -0
- package/dist/src/components/v2/DetachedRunTranscript.d.ts +89 -0
- package/dist/src/components/v2/DetachedRunTranscript.test.d.ts +1 -0
- package/dist/src/components/v2/index.d.ts +9 -2
- package/dist/src/components/v2/toolCategories.d.ts +1 -1
- package/dist/src/components/v2/useDetachedRunLiveActivity.d.ts +30 -0
- package/dist/src/components/v2/useDetachedRunResumeKey.d.ts +15 -0
- package/dist/src/components/v2/useDetachedRunResumeKey.test.d.ts +1 -0
- package/dist/src/models/Interaction.d.ts +15 -0
- package/dist/src/models/ServerEvent.d.ts +3 -3
- package/dist/src/models/detachedRunModel.d.ts +59 -0
- package/dist/src/models/detachedRunModel.test.d.ts +1 -0
- package/dist/src/models/enums.d.ts +3 -1
- package/dist/src/models/index.d.ts +5 -4
- package/dist/src/models/semanticKernelModel/models.d.ts +27 -6
- package/dist/src/services/WebSocketConnection/WebSocketConnectionV2.d.ts +2 -1
- package/dist/src/services/WebSocketConnection/streamStats.d.ts +2 -2
- package/dist/src/services/WebSocketConnection/webSocketConnection.d.ts +15 -2
- package/dist/src/services/detachedRun/DetachedRunFramesTransport.d.ts +68 -0
- package/dist/src/services/detachedRun/DetachedRunFramesTransport.test.d.ts +1 -0
- package/dist/src/services/detachedRun/detachedRunActivity.d.ts +25 -0
- package/dist/src/services/detachedRun/streamDetachedRunFrames.d.ts +110 -0
- package/dist/src/services/detachedRun/streamDetachedRunFrames.test.d.ts +1 -0
- package/dist/src/services/index.d.ts +7 -0
- package/dist/src/services/servers/AgentGatewayService.d.ts +1 -1
- package/dist/src/services/servers/AgentGatewayWSAsync.d.ts +72 -6
- package/dist/src/services/servers/gatewayAnnounceDetachedRun.test.d.ts +1 -0
- package/dist/src/services/servers/gatewayInteractionStarted.test.d.ts +1 -0
- package/dist/src/services/wire/decodeFrame.d.ts +7 -2
- package/dist/tests/fakes/fakeWebSocket.d.ts +8 -2
- package/dist/tests/fakes/makeGateway.d.ts +3 -1
- package/dist/tests/fixtures.d.ts +8 -8
- package/dist/{useChatSessions-C6sYF4U6.js → useChatSessions-aTjNcj8q.js} +2 -2
- package/dist/{useChatSessions-C6sYF4U6.js.map → useChatSessions-aTjNcj8q.js.map} +1 -1
- package/package.json +1 -1
- package/dist/ClientMessage-DUby3KyC.js +0 -34
- package/dist/ClientMessage-DUby3KyC.js.map +0 -1
- package/dist/Memory-CjrYSkzB.js +0 -47
- package/dist/Memory-CjrYSkzB.js.map +0 -1
- package/dist/httpArtifactService-EEhF_mp9.js.map +0 -1
- package/dist/httpSessionService-wBby4ggl.js +0 -309
- package/dist/httpSessionService-wBby4ggl.js.map +0 -1
- package/dist/serializer-CC-nM3ig.js.map +0 -1
- package/dist/src/models/subAgentModel.d.ts +0 -48
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
|
+
var o = (e, n, t) => n in e ? u(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
|
|
3
|
+
var a = (e, n) => u(e, "name", { value: n, configurable: !0 });
|
|
4
|
+
var i = (e, n, t) => o(e, typeof n != "symbol" ? n + "" : n, t);
|
|
5
|
+
const s = class s {
|
|
6
|
+
constructor(n, t, c, d, l) {
|
|
7
|
+
i(this, "mimeType");
|
|
8
|
+
i(this, "data");
|
|
9
|
+
i(this, "friendlyMessage");
|
|
10
|
+
i(this, "fake");
|
|
11
|
+
/**
|
|
12
|
+
* Optional image attachments that travel as a structured payload
|
|
13
|
+
* on the WS frame (see `IMessage.Images`). Kept separate from
|
|
14
|
+
* `data` so we don't have to encode them into the text body — the
|
|
15
|
+
* server adds them as `ImageContent` entries on the user turn.
|
|
16
|
+
*/
|
|
17
|
+
i(this, "images");
|
|
18
|
+
/**
|
|
19
|
+
* Optional client-only UI representation for this user turn. Carried to the
|
|
20
|
+
* server as a `UserUiContent` sibling (persisted + replayed) but stripped from
|
|
21
|
+
* every model request — `data` stays the only model-facing text. `args` is a
|
|
22
|
+
* serialized JSON string. The gateway also injects a matching `UserAnswer` part
|
|
23
|
+
* on the live interaction so the component renders immediately.
|
|
24
|
+
*/
|
|
25
|
+
i(this, "userUi");
|
|
26
|
+
this.data = n, this.mimeType = t, this.friendlyMessage = d, this.fake = c, this.images = l;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
a(s, "ClientMessage");
|
|
30
|
+
let r = s;
|
|
31
|
+
const T = [
|
|
32
|
+
"Completed",
|
|
33
|
+
"Failed",
|
|
34
|
+
"Cancelled",
|
|
35
|
+
"WaitingForInput"
|
|
36
|
+
];
|
|
37
|
+
function D(e) {
|
|
38
|
+
return !!e && T.includes(e);
|
|
39
|
+
}
|
|
40
|
+
a(D, "isDetachedRunSettledStatus");
|
|
41
|
+
function h(e) {
|
|
42
|
+
return e === "Pending" || e === "Running";
|
|
43
|
+
}
|
|
44
|
+
a(h, "isDetachedRunActiveStatus");
|
|
45
|
+
const S = [
|
|
46
|
+
"Completed",
|
|
47
|
+
"Failed",
|
|
48
|
+
"Cancelled"
|
|
49
|
+
];
|
|
50
|
+
function m(e) {
|
|
51
|
+
return e ? S.includes(e) : !1;
|
|
52
|
+
}
|
|
53
|
+
a(m, "isDetachedRunTerminalStatus");
|
|
54
|
+
function E(e) {
|
|
55
|
+
return e === "WaitingForInput";
|
|
56
|
+
}
|
|
57
|
+
a(E, "isDetachedRunWaitingForInput");
|
|
58
|
+
export {
|
|
59
|
+
r as C,
|
|
60
|
+
T as D,
|
|
61
|
+
S as a,
|
|
62
|
+
D as b,
|
|
63
|
+
m as c,
|
|
64
|
+
E as d,
|
|
65
|
+
h as i
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=detachedRunModel-X59Pb5V-.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detachedRunModel-X59Pb5V-.js","sources":["../src/models/ClientMessage.ts","../src/models/detachedRunModel.ts"],"sourcesContent":["/**\n * A single image attachment carried alongside a ClientMessage. `data`\n * is the raw base64 payload (no `data:<mime>;base64,` prefix) so the\n * server can `Convert.FromBase64String` directly into bytes.\n */\nexport interface ClientMessageImage {\n mimeType: string;\n data: string;\n}\n\nexport class ClientMessage {\n mimeType: string;\n data: string;\n friendlyMessage?: string;\n fake?: boolean;\n /**\n * Optional image attachments that travel as a structured payload\n * on the WS frame (see `IMessage.Images`). Kept separate from\n * `data` so we don't have to encode them into the text body — the\n * server adds them as `ImageContent` entries on the user turn.\n */\n images?: ClientMessageImage[];\n\n /**\n * Optional client-only UI representation for this user turn. Carried to the\n * server as a `UserUiContent` sibling (persisted + replayed) but stripped from\n * every model request — `data` stays the only model-facing text. `args` is a\n * serialized JSON string. The gateway also injects a matching `UserAnswer` part\n * on the live interaction so the component renders immediately.\n */\n userUi?: { name: string; args?: string };\n\n constructor(data: string, mimeType: string, fake?: boolean, friendlyMessage?: string, images?: ClientMessageImage[]) {\n this.data = data;\n this.mimeType = mimeType;\n this.friendlyMessage = friendlyMessage;\n this.fake = fake;\n this.images = images;\n }\n}","import type { TodoList } from './todoListModel';\n\n/**\n * Mirrors the SDK's `AIA.Agents.Models.Agent.AgentStatus` enum. Values come back as plain strings (the\n * record keeps `Status.ToString()`).\n *\n * `WaitingForInput` (AIntelA.Agents ≥ 0.20): the run stopped to ask a question and nothing is executing.\n * It is NOT terminal — the task resumes when an answer arrives — so a poller should keep watching it.\n */\nexport type DetachedRunStatus =\n | 'Pending'\n | 'Running'\n | 'WaitingForInput'\n | 'Completed'\n | 'Failed'\n | 'Cancelled'\n | 'Unknown';\n\n/**\n * Why a settled run stopped — the SDK's `StopReason`. Absent while a run is active and on records written\n * before the SDK had it.\n */\nexport type DetachedRunStopReason =\n | 'Concluded'\n | 'NeedsInput'\n | 'EndedWithoutConclusion'\n | 'Cancelled'\n | 'Failed';\n\n/**\n * A detached run as the Agents SDK's REST surface returns it (`GET /detached-runs`, `GET /detached-runs/{id}`):\n * the state a client draws — a task box, a page of runs.\n *\n * `percentComplete` is 0–100 (null while the run has no task list). `conclusion` is the run's structured\n * conclusion as raw JSON, in the task's own format.\n */\nexport interface DetachedRunView {\n id: string;\n name: string;\n agentId: string;\n status: DetachedRunStatus | string;\n stopReason?: DetachedRunStopReason | string | null;\n todoList?: TodoList | null;\n percentComplete?: number | null;\n currentStep?: string | null;\n error?: string | null;\n hasConclusion: boolean;\n conclusion?: string | null;\n parentSessionId: string;\n sessionId: string;\n cancelRequested: boolean;\n created?: string | null;\n updatedAt?: string | null;\n settledAt?: string | null;\n /**\n * True once the conversation that started the run was told about its latest settle (the SDK's\n * `AnnouncedAt >= SettledAt`, AIA Issue 1548 §5). False on a settled run nobody announced yet — the cue for the\n * client to ask for the announcement. Absent on records from an SDK that predates it.\n */\n announced?: boolean;\n}\n\n/** The statuses a run SETTLES on — it stopped, for good or to ask — and that the conversation is told about. */\nexport const DETACHED_RUN_SETTLED_STATUSES: ReadonlyArray<DetachedRunStatus> = [\n 'Completed',\n 'Failed',\n 'Cancelled',\n 'WaitingForInput',\n];\n\nexport function isDetachedRunSettledStatus(status: string | undefined | null): boolean {\n return !!status && (DETACHED_RUN_SETTLED_STATUSES as readonly string[]).includes(status);\n}\n\n/** True while the run executes (or is about to): the statuses a live view follows. */\nexport function isDetachedRunActiveStatus(status: string | undefined | null): boolean {\n return status === 'Pending' || status === 'Running';\n}\n\n/**\n * Status values after which the detached run will never change again. `WaitingForInput` is deliberately absent:\n * the run has stopped, but the task resumes when its question is answered.\n */\nexport const DETACHED_RUN_TERMINAL_STATUSES: ReadonlyArray<DetachedRunStatus> = [\n 'Completed',\n 'Failed',\n 'Cancelled',\n];\n\nexport function isDetachedRunTerminalStatus(status: string | undefined | null): boolean {\n if (!status) return false;\n return (DETACHED_RUN_TERMINAL_STATUSES as readonly string[]).includes(status);\n}\n\n/** True when the task stopped to ask a question and is waiting for an answer. */\nexport function isDetachedRunWaitingForInput(status: string | undefined | null): boolean {\n return status === 'WaitingForInput';\n}\n"],"names":["_ClientMessage","data","mimeType","fake","friendlyMessage","images","__publicField","__name","ClientMessage","DETACHED_RUN_SETTLED_STATUSES","isDetachedRunSettledStatus","status","isDetachedRunActiveStatus","DETACHED_RUN_TERMINAL_STATUSES","isDetachedRunTerminalStatus","isDetachedRunWaitingForInput"],"mappings":";;;;AAUO,MAAMA,IAAN,MAAMA,EAAc;AAAA,EAsBzB,YAAYC,GAAcC,GAAkBC,GAAgBC,GAA0BC,GAA+B;AArBrH,IAAAC,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AAOA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,EAAA;AASA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,EAAA;AAGE,SAAK,OAAOL,GACZ,KAAK,WAAWC,GAChB,KAAK,kBAAkBE,GACvB,KAAK,OAAOD,GACZ,KAAK,SAASE;AAAA,EAChB;AACF;AA7B2BE,EAAAP,GAAA;AAApB,IAAMQ,IAANR;ACqDA,MAAMS,IAAkE;AAAA,EAC3E;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AAEO,SAASC,EAA2BC,GAA4C;AACnF,SAAO,CAAC,CAACA,KAAWF,EAAoD,SAASE,CAAM;AAC3F;AAFgBJ,EAAAG,GAAA;AAKT,SAASE,EAA0BD,GAA4C;AAClF,SAAOA,MAAW,aAAaA,MAAW;AAC9C;AAFgBJ,EAAAK,GAAA;AAQT,MAAMC,IAAmE;AAAA,EAC5E;AAAA,EACA;AAAA,EACA;AACJ;AAEO,SAASC,EAA4BH,GAA4C;AACpF,SAAKA,IACGE,EAAqD,SAASF,CAAM,IADxD;AAExB;AAHgBJ,EAAAO,GAAA;AAMT,SAASC,EAA6BJ,GAA4C;AACrF,SAAOA,MAAW;AACtB;AAFgBJ,EAAAQ,GAAA;"}
|
package/dist/hooks.js
CHANGED
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
var b = Object.defineProperty;
|
|
2
|
+
var j = (t, e, n) => e in t ? b(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var f = (t, e) => b(t, "name", { value: e, configurable: !0 });
|
|
4
|
+
var _ = (t, e, n) => j(t, typeof e != "symbol" ? e + "" : e, n);
|
|
5
|
+
import "reflect-metadata";
|
|
6
|
+
import { r as N, S as z, E as v, I as G, z as Q } from "./serializer-DNUH6kgE.js";
|
|
7
|
+
function K(t) {
|
|
8
|
+
if (t === null || typeof t != "object") return t;
|
|
9
|
+
const e = t;
|
|
10
|
+
if (e.$type === "MongoDbEvent") {
|
|
11
|
+
const { ["$type"]: n, ...s } = e;
|
|
12
|
+
return s;
|
|
13
|
+
}
|
|
14
|
+
return e;
|
|
15
|
+
}
|
|
16
|
+
f(K, "stripMongoDbDiscriminator");
|
|
17
|
+
function Y(t) {
|
|
18
|
+
var e, n, s, o;
|
|
19
|
+
for (const i of t) {
|
|
20
|
+
if (((n = (e = i.role) == null ? void 0 : e.label) == null ? void 0 : n.toLowerCase()) !== "user") continue;
|
|
21
|
+
const a = (o = (s = i.content) == null ? void 0 : s.items) == null ? void 0 : o.find((T) => "text" in T && typeof T.text == "string");
|
|
22
|
+
if (a) return a.text;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
f(Y, "firstUserText");
|
|
26
|
+
function J(t) {
|
|
27
|
+
var e, n, s, o;
|
|
28
|
+
for (const i of t) {
|
|
29
|
+
if (((n = (e = i.role) == null ? void 0 : e.label) == null ? void 0 : n.toLowerCase()) !== "user") continue;
|
|
30
|
+
const a = (o = (s = i.content) == null ? void 0 : s.items) == null ? void 0 : o.find((T) => T instanceof G);
|
|
31
|
+
if (a) return Q(a.origin);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
f(J, "userTurnOrigin");
|
|
35
|
+
const k = "ChatResponseMessage.ReasoningContent", P = "ChatResponseMessage.ReasoningHeadlines";
|
|
36
|
+
function F(t) {
|
|
37
|
+
var s;
|
|
38
|
+
const e = t == null ? void 0 : t.content;
|
|
39
|
+
if (!e) return;
|
|
40
|
+
const n = ((s = e.metadata) == null ? void 0 : s[P]) ?? (e.items ?? []).map((o) => {
|
|
41
|
+
var i;
|
|
42
|
+
return (i = o == null ? void 0 : o.metadata) == null ? void 0 : i[P];
|
|
43
|
+
}).find((o) => typeof o == "string");
|
|
44
|
+
if (!(typeof n != "string" || !n.trim()))
|
|
45
|
+
try {
|
|
46
|
+
const o = JSON.parse(n);
|
|
47
|
+
return Array.isArray(o) ? o.filter((i) => typeof i == "string" && i.length > 0) : void 0;
|
|
48
|
+
} catch {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
f(F, "extractHeadlines");
|
|
53
|
+
function q(t) {
|
|
54
|
+
var s, o;
|
|
55
|
+
const e = t == null ? void 0 : t.content;
|
|
56
|
+
if (!e) return;
|
|
57
|
+
const n = (s = e.metadata) == null ? void 0 : s[k];
|
|
58
|
+
if (typeof n == "string" && n.trim()) return n.trim();
|
|
59
|
+
for (const i of e.items ?? []) {
|
|
60
|
+
const a = (o = i == null ? void 0 : i.metadata) == null ? void 0 : o[k];
|
|
61
|
+
if (typeof a == "string" && a.trim()) return a.trim();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
f(q, "extractReasoning");
|
|
65
|
+
function L(t) {
|
|
66
|
+
return t === v.FunctionCall || t === v.PartialFunctionCall;
|
|
67
|
+
}
|
|
68
|
+
f(L, "isFunctionCallType");
|
|
69
|
+
function V(t, e) {
|
|
70
|
+
var n, s, o, i, a;
|
|
71
|
+
return {
|
|
72
|
+
...t,
|
|
73
|
+
eventType: v.FunctionResponse,
|
|
74
|
+
functionDetails: {
|
|
75
|
+
id: t.functionDetails.id,
|
|
76
|
+
name: ((n = e.functionDetails) == null ? void 0 : n.name) ?? t.functionDetails.name,
|
|
77
|
+
args: t.functionDetails.args ?? ((s = e.functionDetails) == null ? void 0 : s.args),
|
|
78
|
+
text: t.functionDetails.text,
|
|
79
|
+
response: (o = e.functionDetails) == null ? void 0 : o.response,
|
|
80
|
+
status: ((i = e.functionDetails) == null ? void 0 : i.status) ?? "Done",
|
|
81
|
+
start: t.functionDetails.start,
|
|
82
|
+
end: ((a = e.functionDetails) == null ? void 0 : a.end) ?? t.functionDetails.end,
|
|
83
|
+
silent: t.functionDetails.silent
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
f(V, "foldResponseIntoCall");
|
|
88
|
+
function W(t) {
|
|
89
|
+
var i, a, T, R, O;
|
|
90
|
+
const e = N(), n = [], s = /* @__PURE__ */ new Map();
|
|
91
|
+
for (const x of t) {
|
|
92
|
+
const w = K(x), m = e.parse(w);
|
|
93
|
+
if (!m) continue;
|
|
94
|
+
const D = z.parseFromTypedEvent(m);
|
|
95
|
+
if (!D) continue;
|
|
96
|
+
const c = D.interactionId ?? "__root__";
|
|
97
|
+
let d = s.get(c);
|
|
98
|
+
d || (d = { llm: [], server: [], raw: [] }, s.set(c, d), n.push(c)), d.llm.push(m), d.server.push(D), d.raw.push(w);
|
|
99
|
+
}
|
|
100
|
+
const o = [];
|
|
101
|
+
for (const x of n) {
|
|
102
|
+
const { llm: w, server: m, raw: D } = s.get(x), c = [], d = [], g = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ f((p) => {
|
|
103
|
+
const h = {
|
|
104
|
+
...p,
|
|
105
|
+
id: `${c.length + 1}-${x}`,
|
|
106
|
+
partial: !1
|
|
107
|
+
};
|
|
108
|
+
return c.push(h), c.length - 1;
|
|
109
|
+
}, "pushPart");
|
|
110
|
+
for (let p = 0; p < m.length; p++) {
|
|
111
|
+
const h = m[p], C = (a = (i = w[p].role) == null ? void 0 : i.label) == null ? void 0 : a.toLowerCase();
|
|
112
|
+
if (C === "user" || C === "system") {
|
|
113
|
+
if (C === "user")
|
|
114
|
+
for (const r of h.parts)
|
|
115
|
+
r.eventType === v.UserAnswer && S(r);
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
if (h.llmArtifacts && h.llmArtifacts.length > 0)
|
|
119
|
+
for (const r of h.llmArtifacts) {
|
|
120
|
+
const u = r.toArtifact(), I = d.findIndex((l) => l.id === u.id);
|
|
121
|
+
I === -1 ? d.push(u) : d[I] = u;
|
|
122
|
+
}
|
|
123
|
+
const A = q(D[p]);
|
|
124
|
+
let $ = !1;
|
|
125
|
+
for (const r of h.parts) {
|
|
126
|
+
const u = (T = r.functionDetails) == null ? void 0 : T.id;
|
|
127
|
+
if (r.eventType === v.FunctionResponse && u && g.has(u)) {
|
|
128
|
+
const l = g.get(u);
|
|
129
|
+
c[l] = V(c[l], r);
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
if (r.eventType === v.FunctionClientOutput && u) {
|
|
133
|
+
if (g.has(u)) {
|
|
134
|
+
const l = g.get(u), y = c[l];
|
|
135
|
+
c[l] = {
|
|
136
|
+
...y,
|
|
137
|
+
functionDetails: {
|
|
138
|
+
...y.functionDetails,
|
|
139
|
+
clientOutput: (R = r.functionDetails) == null ? void 0 : R.clientOutput
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
if (L(r.eventType) && u && g.has(u)) {
|
|
146
|
+
const l = g.get(u), y = c[l];
|
|
147
|
+
c[l] = {
|
|
148
|
+
...y,
|
|
149
|
+
eventType: r.eventType,
|
|
150
|
+
functionDetails: { ...y.functionDetails, ...r.functionDetails }
|
|
151
|
+
};
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
if (r.eventType === v.Text) {
|
|
155
|
+
const l = !!r.text && r.text.length > 0, y = !!A && !$;
|
|
156
|
+
if (!l && !y && !r.thoughtDetails)
|
|
157
|
+
continue;
|
|
158
|
+
if (y) {
|
|
159
|
+
S({
|
|
160
|
+
...r,
|
|
161
|
+
eventType: l ? v.Text : v.Thought,
|
|
162
|
+
thoughtDetails: { text: A, headlines: F(D[p]) },
|
|
163
|
+
// A step with no answer text BECOMES the thought, and
|
|
164
|
+
// `ThoughtPart` renders `part.text` (via
|
|
165
|
+
// getPartTextContent) — leaving it empty drew the
|
|
166
|
+
// "Pensou por 12s" header over a blank window. The live
|
|
167
|
+
// path already sets both (see `createFromThought`); this
|
|
168
|
+
// is the same part rebuilt from Session.Events, so it has
|
|
169
|
+
// to agree. When there IS answer text the part stays a
|
|
170
|
+
// Text and keeps it — the reasoning rides the strip.
|
|
171
|
+
text: l ? r.text : A
|
|
172
|
+
}), $ = !0;
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
S(r);
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
const I = S(r);
|
|
179
|
+
L(r.eventType) && u && g.set(u, I);
|
|
180
|
+
}
|
|
181
|
+
A && !$ && S({
|
|
182
|
+
id: "",
|
|
183
|
+
author: h.author,
|
|
184
|
+
eventType: v.Thought,
|
|
185
|
+
created: h.created,
|
|
186
|
+
partial: !1,
|
|
187
|
+
mustPush: !1,
|
|
188
|
+
textAppendable: !1,
|
|
189
|
+
thoughtDetails: { text: A, headlines: F(D[p]) },
|
|
190
|
+
// Both, for the same reason as above: the renderer reads `text`.
|
|
191
|
+
text: A
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
const U = /* @__PURE__ */ new Map();
|
|
195
|
+
for (const [p, h] of g) U.set(p, c[h]);
|
|
196
|
+
const M = J(w);
|
|
197
|
+
o.push({
|
|
198
|
+
created: ((O = m[0]) == null ? void 0 : O.created) ?? /* @__PURE__ */ new Date(),
|
|
199
|
+
interactionId: x,
|
|
200
|
+
artifactData: d,
|
|
201
|
+
partial: !1,
|
|
202
|
+
turn_complete: !0,
|
|
203
|
+
parts: c,
|
|
204
|
+
version: m.length,
|
|
205
|
+
functionMap: U,
|
|
206
|
+
interactionQuestion: Y(w) ?? "",
|
|
207
|
+
...M && { origin: M }
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
return o;
|
|
211
|
+
}
|
|
212
|
+
f(W, "decodeSessionEvents");
|
|
213
|
+
function X(t) {
|
|
214
|
+
return (typeof t == "function" ? t() : t) ?? "";
|
|
215
|
+
}
|
|
216
|
+
f(X, "resolveAccessToken");
|
|
217
|
+
function B(t, e = []) {
|
|
218
|
+
return {
|
|
219
|
+
id: t.id,
|
|
220
|
+
browserScopeId: t.id,
|
|
221
|
+
fullyLoaded: e.length > 0,
|
|
222
|
+
interactions: e,
|
|
223
|
+
artifacts: t.artifacts ?? [],
|
|
224
|
+
overview: t.overview ?? "",
|
|
225
|
+
agentType: t.agentType,
|
|
226
|
+
userDescription: t.userDescription ?? void 0,
|
|
227
|
+
lastQuestion: t.lastQuestion ?? void 0,
|
|
228
|
+
customer: t.customer ?? null,
|
|
229
|
+
activityCount: t.activityCount ?? 0,
|
|
230
|
+
user: t.user,
|
|
231
|
+
lastGeneratedOverview: t.lastGeneratedOverview ? new Date(t.lastGeneratedOverview) : null,
|
|
232
|
+
sessionRunMode: "normal",
|
|
233
|
+
created: t.created ? new Date(t.created) : void 0,
|
|
234
|
+
updatedAt: t.updatedAt ? new Date(t.updatedAt) : void 0
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
f(B, "headerToChatSession");
|
|
238
|
+
const E = class E {
|
|
239
|
+
constructor(e, n) {
|
|
240
|
+
_(this, "serverBaseUrl");
|
|
241
|
+
_(this, "accessToken");
|
|
242
|
+
this.serverBaseUrl = e.replace(/\/$/, ""), this.accessToken = n;
|
|
243
|
+
}
|
|
244
|
+
get headers() {
|
|
245
|
+
return {
|
|
246
|
+
"Content-Type": "application/json",
|
|
247
|
+
Authorization: `Bearer ${X(this.accessToken)}`
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
async getAllSessions() {
|
|
251
|
+
const e = await fetch(`${this.serverBaseUrl}/sessions?top=50`, {
|
|
252
|
+
headers: this.headers
|
|
253
|
+
});
|
|
254
|
+
if (!e.ok) throw new Error(`getAllSessions HTTP ${e.status}`);
|
|
255
|
+
return (await e.json()).map((s) => B(s));
|
|
256
|
+
}
|
|
257
|
+
async retrieveSession(e) {
|
|
258
|
+
const n = await fetch(`${this.serverBaseUrl}/sessions/${e}`, {
|
|
259
|
+
headers: this.headers
|
|
260
|
+
});
|
|
261
|
+
if (n.status === 404) return null;
|
|
262
|
+
if (!n.ok) throw new Error(`retrieveSession HTTP ${n.status}`);
|
|
263
|
+
const s = await n.json(), o = W(s.events ?? []);
|
|
264
|
+
for (const i of o) i.sessionId = s.header.id;
|
|
265
|
+
return B(s.header, o);
|
|
266
|
+
}
|
|
267
|
+
async getLastUsedSession() {
|
|
268
|
+
return (await this.getAllSessions())[0] ?? null;
|
|
269
|
+
}
|
|
270
|
+
// — Most write paths are inert: after the dual-collection collapse the
|
|
271
|
+
// server populates Session UI-header fields automatically during the turn.
|
|
272
|
+
// The two exceptions are rename (`patchSession` → PATCH /Session/Overview)
|
|
273
|
+
// and delete (`removeSession` → DELETE /Session/{id}), which are driven by
|
|
274
|
+
// the picker UI and have no WS-side equivalent. —
|
|
275
|
+
async removeSession(e) {
|
|
276
|
+
const n = await fetch(`${this.serverBaseUrl}/Session/${encodeURIComponent(e)}`, {
|
|
277
|
+
method: "DELETE",
|
|
278
|
+
headers: this.headers
|
|
279
|
+
});
|
|
280
|
+
if (!n.ok) throw new Error(`removeSession HTTP ${n.status}`);
|
|
281
|
+
}
|
|
282
|
+
async createSession(e, n, s) {
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
285
|
+
async createAgentSession() {
|
|
286
|
+
return { sessionId: null };
|
|
287
|
+
}
|
|
288
|
+
async closeSession(e) {
|
|
289
|
+
}
|
|
290
|
+
async generateOverviewForCurrentSession(e, n) {
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
293
|
+
async storeSession(e) {
|
|
294
|
+
return { data: e };
|
|
295
|
+
}
|
|
296
|
+
async patchSession(e, n) {
|
|
297
|
+
if (n.overview == null) return;
|
|
298
|
+
const s = `${this.serverBaseUrl}/Session/Overview?sessionId=${encodeURIComponent(e)}&overview=${encodeURIComponent(n.overview)}`, o = await fetch(s, { method: "PATCH", headers: this.headers });
|
|
299
|
+
if (!o.ok) throw new Error(`patchSession HTTP ${o.status}`);
|
|
300
|
+
}
|
|
301
|
+
delayedPatchActiveSession(e) {
|
|
302
|
+
}
|
|
303
|
+
async patchActiveSession(e) {
|
|
304
|
+
return Promise.resolve(null);
|
|
305
|
+
}
|
|
306
|
+
async getLlmSessionInformation() {
|
|
307
|
+
return { id: null, instructionSummaries: [] };
|
|
308
|
+
}
|
|
309
|
+
transformIntoInstances(e) {
|
|
310
|
+
return e;
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
f(E, "HttpSessionService");
|
|
314
|
+
let H = E;
|
|
315
|
+
export {
|
|
316
|
+
H,
|
|
317
|
+
W as d,
|
|
318
|
+
X as r
|
|
319
|
+
};
|
|
320
|
+
//# sourceMappingURL=httpSessionService-Ckb9Cxia.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpSessionService-Ckb9Cxia.js","sources":["../src/services/sessionEventDecoder.ts","../src/services/accessTokenProvider.ts","../src/services/httpSessionService.ts"],"sourcesContent":["import { ServerEvent } from '../models/ServerEvent';\nimport { InteractionOriginContent, LlmEvent } from '../models/semanticKernelModel/models';\nimport { createEventSerializer } from '../models/semanticKernelModel/serializer';\nimport { EventType } from '../models/enums';\nimport { toInteractionOrigin, type Interaction, type InteractionOrigin } from '../models/Interaction';\nimport type { InteractionPart } from '../models/InteractionPart';\nimport type { Artifact } from '../models/Artifact';\n\n/**\n * Strip the persistence-only `$type: \"MongoDbEvent\"` marker from the wire\n * object before handing it to typedjson. The server's session-detail endpoint\n * returns base-class `Event` instances (not `MongoDbEvent`), but downstream\n * resources that come through other code paths sometimes carry that marker;\n * leaving it in confuses typedjson because it isn't registered in\n * `KNOWN_CONTENT_TYPES`.\n */\nfunction stripMongoDbDiscriminator(raw: unknown): unknown {\n if (raw === null || typeof raw !== 'object') return raw;\n const obj = raw as Record<string, unknown>;\n if (obj['$type'] === 'MongoDbEvent') {\n const { ['$type']: _drop, ...rest } = obj;\n return rest;\n }\n return obj;\n}\n\nfunction firstUserText(events: LlmEvent[]): string | undefined {\n for (const e of events) {\n if (e.role?.label?.toLowerCase() !== 'user') continue;\n const item = e.content?.items?.find(p => 'text' in p && typeof (p as Record<string, unknown>).text === 'string');\n if (item) return (item as { text?: string }).text;\n }\n return undefined;\n}\n\n/**\n * Where the turn came from (AIA Issue 1548): the `InteractionOriginContent` item the server keeps beside a user\n * message whose origin is not `user`. Resolved by typedjson through the same `$type` discriminator as\n * `UserUiContent`, so it arrives as its own class.\n */\nfunction userTurnOrigin(events: LlmEvent[]): InteractionOrigin | undefined {\n for (const e of events) {\n if (e.role?.label?.toLowerCase() !== 'user') continue;\n const item = e.content?.items?.find((p): p is InteractionOriginContent => p instanceof InteractionOriginContent);\n if (item) return toInteractionOrigin(item.origin);\n }\n return undefined;\n}\n\n// The .NET semantic-kernel metadata key that carries the model's reasoning\n// trace on persisted (consolidated) events. typedjson drops `metadata` on\n// KernelContent-derived items (it's undecorated), so the reasoning only\n// survives on the RAW wire object — we read it from there.\nconst REASONING_METADATA_KEY = 'ChatResponseMessage.ReasoningContent';\n// Its companion: the headlines the server derived from that reasoning, a JSON array of strings (reasoning-trace\n// localization). Stamped by the agents server's HeadliningChatCompletionService on the same message.\nconst HEADLINES_METADATA_KEY = 'ChatResponseMessage.ReasoningHeadlines';\n\nfunction extractHeadlines(rawEvent: unknown): string[] | undefined {\n const content = (rawEvent as { content?: Record<string, any> })?.content;\n if (!content) return undefined;\n const raw = content.metadata?.[HEADLINES_METADATA_KEY]\n ?? (content.items ?? []).map((i: any) => i?.metadata?.[HEADLINES_METADATA_KEY]).find((v: unknown) => typeof v === 'string');\n if (typeof raw !== 'string' || !raw.trim()) return undefined;\n try {\n const parsed = JSON.parse(raw);\n return Array.isArray(parsed) ? parsed.filter((h): h is string => typeof h === 'string' && h.length > 0) : undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Pull the reasoning trace out of a raw wire event. The server duplicates it\n * onto the message `content.metadata` and onto each text item's `metadata`;\n * prefer the event-level copy, fall back to the first item that carries one.\n */\nfunction extractReasoning(rawEvent: unknown): string | undefined {\n const content = (rawEvent as { content?: Record<string, any> })?.content;\n if (!content) return undefined;\n const fromContent = content.metadata?.[REASONING_METADATA_KEY];\n if (typeof fromContent === 'string' && fromContent.trim()) return fromContent.trim();\n for (const item of content.items ?? []) {\n const r = item?.metadata?.[REASONING_METADATA_KEY];\n if (typeof r === 'string' && r.trim()) return r.trim();\n }\n return undefined;\n}\n\nfunction isFunctionCallType(t: EventType): boolean {\n return t === EventType.FunctionCall || t === EventType.PartialFunctionCall;\n}\n\n/**\n * Fold a FunctionResponse part onto the call part it answers, mirroring the\n * final state a live `merge` would have reached for that call: the call's\n * parsed `args`/`name`/`start` are preserved and the response's\n * `response`/`status`/`end` are layered on. eventType flips to\n * FunctionResponse, which is the completed-call shape the UI renders.\n */\nfunction foldResponseIntoCall(call: InteractionPart, response: InteractionPart): InteractionPart {\n return {\n ...call,\n eventType: EventType.FunctionResponse,\n functionDetails: {\n id: call.functionDetails!.id,\n name: response.functionDetails?.name ?? call.functionDetails!.name,\n args: call.functionDetails!.args ?? response.functionDetails?.args,\n text: call.functionDetails!.text,\n response: response.functionDetails?.response,\n status: response.functionDetails?.status ?? 'Done',\n start: call.functionDetails!.start,\n end: response.functionDetails?.end ?? call.functionDetails!.end,\n silent: call.functionDetails!.silent,\n },\n };\n}\n\n/**\n * Rebuilds the `Interaction[]` the chat UI renders from the historical event\n * log returned by <c>GET /sessions/{id}</c>.\n *\n * Unlike the live turn loop, this does NOT route events through\n * `InteractionService.merge`. The merge pipeline (and its `FlatParts` step) is\n * built for the *live* stream, where each event carries a single content item\n * arriving incrementally; it flattens every event down to one part. The\n * *persisted* log is different: the server stores consolidated blocks where a\n * single event's `content.items` holds many parts at once — e.g. a text\n * preamble plus several FunctionCalls. Running those through `merge` collapsed\n * each event to one part and silently dropped the rest (every function call in\n * a multi-item event disappeared on replay).\n *\n * This restore path instead reads *every* item as its own `InteractionPart`\n * (via `ServerEvent.parseFromTypedEvent`, which already maps one part per\n * item) and only applies the one piece of merge logic replay genuinely needs:\n * folding each FunctionResponse onto the call it answers, keyed by `callId`.\n * No copy-on-write cloning, no event-bus side effects, no streaming-append.\n */\nexport function decodeSessionEvents(rawEvents: unknown[]): Interaction[] {\n const serializer = createEventSerializer();\n\n // Parse + group by interactionId, preserving first-seen order so the\n // rendered timeline mirrors the wire-log order. Keep the typed LlmEvent\n // alongside the mapped ServerEvent — the former carries the role label\n // used to derive the interaction's question.\n const order: string[] = [];\n const grouped = new Map<string, { llm: LlmEvent[]; server: ServerEvent[]; raw: unknown[] }>();\n for (const raw of rawEvents) {\n const stripped = stripMongoDbDiscriminator(raw);\n const llmEvent = serializer.parse(stripped as Record<string, unknown>);\n if (!llmEvent) continue;\n const serverEvent = ServerEvent.parseFromTypedEvent(llmEvent);\n if (!serverEvent) continue;\n\n const key = serverEvent.interactionId ?? '__root__';\n let bucket = grouped.get(key);\n if (!bucket) {\n bucket = { llm: [], server: [], raw: [] };\n grouped.set(key, bucket);\n order.push(key);\n }\n bucket.llm.push(llmEvent);\n bucket.server.push(serverEvent);\n // Keep the stripped raw object — typedjson drops the item `metadata`\n // that holds the reasoning trace, so we recover it from here.\n bucket.raw.push(stripped);\n }\n\n const interactions: Interaction[] = [];\n for (const interactionId of order) {\n const { llm, server, raw } = grouped.get(interactionId)!;\n\n const parts: InteractionPart[] = [];\n const artifactData: Artifact[] = [];\n // callId → index in `parts` of the (possibly already folded) call part.\n const callIndex = new Map<string, number>();\n\n const pushPart = (part: InteractionPart) => {\n const stamped: InteractionPart = {\n ...part,\n id: `${parts.length + 1}-${interactionId}`,\n partial: false,\n };\n parts.push(stamped);\n return parts.length - 1;\n };\n\n for (let i = 0; i < server.length; i++) {\n const event = server[i];\n\n // `user` events are the question (captured below as\n // interactionQuestion), and `system` events are injected context\n // (schema, instructions) — neither renders as a chat part. The\n // live turn loop never feeds these through merge either; only the\n // persisted log co-locates them under the turn's interactionId.\n const role = llm[i].role?.label?.toLowerCase();\n if (role === 'user' || role === 'system') {\n // The user/system text isn't a chat part (the question is captured as\n // interactionQuestion via firstUserText). But a user turn may carry a client-only\n // UI representation — a UserUiContent that ServerEvent mapped to a UserAnswer part —\n // which must re-hydrate on reload. Push those; drop everything else on this event.\n if (role === 'user') {\n for (const part of event.parts) {\n if (part.eventType === EventType.UserAnswer) pushPart(part);\n }\n }\n continue;\n }\n\n // Artifacts: dedupe by id, last write wins (same as the live merge).\n if (event.llmArtifacts && event.llmArtifacts.length > 0) {\n for (const llmArtifact of event.llmArtifacts) {\n const artifact = llmArtifact.toArtifact();\n const i = artifactData.findIndex(a => a.id === artifact.id);\n if (i === -1) artifactData.push(artifact);\n else artifactData[i] = artifact;\n }\n }\n\n // The model's reasoning trace for this step lives in the event's\n // metadata (dropped by typedjson — read from raw). It rides the\n // event's text item, so attach it to the first text part: a\n // non-empty answer keeps its body and carries the trace in the\n // thinking strip; an empty \"thinking-only\" step becomes a Thought.\n const reasoning = extractReasoning(raw[i]);\n let reasoningUsed = false;\n\n for (const part of event.parts) {\n const callId = part.functionDetails?.id;\n\n // A response folds onto its matching call rather than becoming\n // a separate part.\n if (part.eventType === EventType.FunctionResponse && callId && callIndex.has(callId)) {\n const idx = callIndex.get(callId)!;\n parts[idx] = foldResponseIntoCall(parts[idx], part);\n continue;\n }\n\n // A client-only output sibling folds its payload onto the call it belongs to\n // (never a separate part). This is the persisted/replay counterpart of the live\n // StreamingFinalFunctionResultContent.clientOutput; a uiTool renderer reads it.\n if (part.eventType === EventType.FunctionClientOutput && callId) {\n if (callIndex.has(callId)) {\n const idx = callIndex.get(callId)!;\n const prev = parts[idx];\n parts[idx] = {\n ...prev,\n functionDetails: {\n ...prev.functionDetails!,\n clientOutput: part.functionDetails?.clientOutput,\n },\n };\n }\n // No matching call (shouldn't happen — the call precedes its Tool message):\n // drop it rather than render a standalone part.\n continue;\n }\n\n // A repeated full call for an id we've already seen (e.g. a\n // full FunctionCall following a PartialFunctionCall) updates the\n // existing part in place instead of duplicating it.\n if (isFunctionCallType(part.eventType) && callId && callIndex.has(callId)) {\n const idx = callIndex.get(callId)!;\n const prev = parts[idx];\n parts[idx] = {\n ...prev,\n eventType: part.eventType,\n functionDetails: { ...prev.functionDetails!, ...part.functionDetails! },\n };\n continue;\n }\n\n if (part.eventType === EventType.Text) {\n const hasText = !!part.text && part.text.length > 0;\n const attachReasoning = !!reasoning && !reasoningUsed;\n\n // Empty text with no reasoning to carry is a bare\n // placeholder — the consolidated log emits these alongside\n // function calls; dropping them keeps the timeline clean.\n if (!hasText && !attachReasoning && !part.thoughtDetails) {\n continue;\n }\n\n if (attachReasoning) {\n pushPart({\n ...part,\n eventType: hasText ? EventType.Text : EventType.Thought,\n thoughtDetails: { text: reasoning!, headlines: extractHeadlines(raw[i]) },\n // A step with no answer text BECOMES the thought, and\n // `ThoughtPart` renders `part.text` (via\n // getPartTextContent) — leaving it empty drew the\n // \"Pensou por 12s\" header over a blank window. The live\n // path already sets both (see `createFromThought`); this\n // is the same part rebuilt from Session.Events, so it has\n // to agree. When there IS answer text the part stays a\n // Text and keeps it — the reasoning rides the strip.\n text: hasText ? part.text : reasoning!,\n });\n reasoningUsed = true;\n continue;\n }\n\n pushPart(part);\n continue;\n }\n\n const idx = pushPart(part);\n if (isFunctionCallType(part.eventType) && callId) {\n callIndex.set(callId, idx);\n }\n }\n\n // Reasoning with no text item to ride on (rare) — surface it so\n // the trace isn't silently lost.\n if (reasoning && !reasoningUsed) {\n pushPart({\n id: '', author: event.author, eventType: EventType.Thought,\n created: event.created, partial: false,\n mustPush: false, textAppendable: false,\n thoughtDetails: { text: reasoning, headlines: extractHeadlines(raw[i]) },\n // Both, for the same reason as above: the renderer reads `text`.\n text: reasoning,\n });\n }\n }\n\n const functionMap = new Map<string, InteractionPart>();\n for (const [callId, idx] of callIndex) functionMap.set(callId, parts[idx]);\n const origin = userTurnOrigin(llm);\n\n interactions.push({\n created: server[0]?.created ?? new Date(),\n interactionId,\n artifactData,\n partial: false,\n turn_complete: true,\n parts,\n version: server.length,\n functionMap,\n interactionQuestion: firstUserText(llm) ?? '',\n ...(origin && { origin }),\n });\n }\n\n return interactions;\n}\n","/**\n * A bearer-token source for the library's HTTP clients: either a fixed token\n * string (legacy behavior) or a callback resolved on EVERY request, so a\n * long-lived service always sends the freshest JWT (sign-in, silent refresh,\n * guest→real promotion) instead of the one captured at construction.\n */\nexport type AccessTokenProvider = string | (() => string | undefined);\n\n/** The current token for `provider` (empty string when a callback yields none). */\nexport function resolveAccessToken(provider: AccessTokenProvider): string {\n return (typeof provider === 'function' ? provider() : provider) ?? '';\n}\n","import { ChatSession, Customer, decodeSessionEvents, Interaction, ISessionService } from \"..\";\nimport { resolveAccessToken, type AccessTokenProvider } from \"./accessTokenProvider\";\n\n/**\n * Wire shape returned by `GET /sessions` and the `.header` of `GET /sessions/{id}`.\n * Mirrors `Envision.SemanticKernel.Models.Session.SessionHeader` on the C#\n * side after the default camelCase rename ASP.NET Core applies on serialize.\n */\ninterface SessionHeaderWire {\n id: string;\n created?: string | null;\n updatedAt?: string | null;\n user?: ChatSession['user'];\n customer?: ChatSession['customer'];\n overview?: string | null;\n agentType?: ChatSession['agentType'];\n userDescription?: string | null;\n lastQuestion?: string | null;\n activityCount?: number;\n lastGeneratedOverview?: string | null;\n artifacts?: string[];\n}\n\ninterface SessionDetailWire {\n header: SessionHeaderWire;\n events: unknown[];\n}\n\nfunction headerToChatSession(h: SessionHeaderWire, interactions: Interaction[] = []): ChatSession {\n return {\n id: h.id,\n browserScopeId: h.id,\n fullyLoaded: interactions.length > 0,\n interactions,\n artifacts: h.artifacts ?? [],\n overview: h.overview ?? '',\n agentType: h.agentType as ChatSession['agentType'],\n userDescription: h.userDescription ?? undefined,\n lastQuestion: h.lastQuestion ?? undefined,\n customer: h.customer ?? null,\n activityCount: h.activityCount ?? 0,\n user: h.user as ChatSession['user'],\n lastGeneratedOverview: h.lastGeneratedOverview ? new Date(h.lastGeneratedOverview) : null,\n sessionRunMode: 'normal' as ChatSession['sessionRunMode'],\n created: h.created ? new Date(h.created) : undefined,\n updatedAt: h.updatedAt ? new Date(h.updatedAt) : undefined,\n } as ChatSession;\n}\n\n/**\n * Minimal ISessionService over the WSServer's REST `/sessions` endpoints.\n *\n * Reads from the unified `Sessions` collection. The list endpoint returns\n * header projections; the detail endpoint returns header + the raw\n * `LlmEvent[]` log which we replay through `decodeSessionEvents` to rebuild\n * the chat UI's `Interaction[]`. Mutation methods are no-ops — write paths\n * are exercised by the live agent turn loop and the WS connection, not by\n * REST calls from the picker.\n */\nexport class HttpSessionService implements ISessionService {\n private serverBaseUrl: string;\n private accessToken: AccessTokenProvider;\n\n constructor(serverBaseUrl: string, accessToken: AccessTokenProvider) {\n this.serverBaseUrl = serverBaseUrl.replace(/\\/$/, '');\n this.accessToken = accessToken;\n }\n\n private get headers(): HeadersInit {\n return {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${resolveAccessToken(this.accessToken)}`,\n };\n }\n\n async getAllSessions(): Promise<ChatSession[]> {\n const r = await fetch(`${this.serverBaseUrl}/sessions?top=50`, {\n headers: this.headers,\n });\n if (!r.ok) throw new Error(`getAllSessions HTTP ${r.status}`);\n const headers = (await r.json()) as SessionHeaderWire[];\n return headers.map(h => headerToChatSession(h));\n }\n\n async retrieveSession(sessionId: string): Promise<ChatSession | null> {\n const r = await fetch(`${this.serverBaseUrl}/sessions/${sessionId}`, {\n headers: this.headers,\n });\n if (r.status === 404) return null;\n if (!r.ok) throw new Error(`retrieveSession HTTP ${r.status}`);\n const detail = (await r.json()) as SessionDetailWire;\n const interactions = decodeSessionEvents(detail.events ?? []);\n // The decoder doesn't know the sessionId — stamp it now so downstream\n // consumers (artifact loaders, debugging surfaces) can correlate back.\n for (const it of interactions) it.sessionId = detail.header.id;\n return headerToChatSession(detail.header, interactions);\n }\n\n async getLastUsedSession(): Promise<ChatSession | null> {\n const all = await this.getAllSessions();\n return all[0] ?? null;\n }\n\n // — Most write paths are inert: after the dual-collection collapse the\n // server populates Session UI-header fields automatically during the turn.\n // The two exceptions are rename (`patchSession` → PATCH /Session/Overview)\n // and delete (`removeSession` → DELETE /Session/{id}), which are driven by\n // the picker UI and have no WS-side equivalent. —\n\n async removeSession(sessionId: string): Promise<void> {\n const r = await fetch(`${this.serverBaseUrl}/Session/${encodeURIComponent(sessionId)}`, {\n method: 'DELETE',\n headers: this.headers,\n });\n if (!r.ok) throw new Error(`removeSession HTTP ${r.status}`);\n }\n async createSession(_sessionId: string, _agentName: string, _customer?: Customer): Promise<ChatSession | null> { return null; }\n async createAgentSession(): Promise<any> { return { sessionId: null }; }\n async closeSession(_sessionId: string): Promise<void> { /* no-op */ }\n async generateOverviewForCurrentSession(_sys: string, _model: string): Promise<string | null> { return null; }\n async storeSession(session: ChatSession): Promise<any> { return { data: session }; }\n async patchSession(sessionId: string, partial: Partial<ChatSession>): Promise<void> {\n // SessionController.PatchOverview binds sessionId/overview from the\n // query string (no body, no route params). Anything else on `partial`\n // has no server-side endpoint yet — ignore it instead of guessing.\n if (partial.overview == null) return;\n const url =\n `${this.serverBaseUrl}/Session/Overview` +\n `?sessionId=${encodeURIComponent(sessionId)}` +\n `&overview=${encodeURIComponent(partial.overview)}`;\n const r = await fetch(url, { method: 'PATCH', headers: this.headers });\n if (!r.ok) throw new Error(`patchSession HTTP ${r.status}`);\n }\n delayedPatchActiveSession(_partial: Partial<ChatSession>): void { /* no-op */ }\n\n async patchActiveSession(_partial: Partial<ChatSession>): Promise<ChatSession | null> {\n return Promise.resolve(null);\n }\n async getLlmSessionInformation(): Promise<any> { return { id: null, instructionSummaries: [] }; }\n transformIntoInstances(session: ChatSession): ChatSession { return session; }\n}\n"],"names":["stripMongoDbDiscriminator","raw","obj","_drop","rest","__name","firstUserText","events","e","_b","_a","item","_d","_c","p","userTurnOrigin","InteractionOriginContent","toInteractionOrigin","REASONING_METADATA_KEY","HEADLINES_METADATA_KEY","extractHeadlines","rawEvent","content","i","v","parsed","h","extractReasoning","fromContent","r","isFunctionCallType","EventType","foldResponseIntoCall","call","response","_e","decodeSessionEvents","rawEvents","serializer","createEventSerializer","order","grouped","stripped","llmEvent","serverEvent","ServerEvent","key","bucket","interactions","interactionId","llm","server","parts","artifactData","callIndex","pushPart","part","stamped","event","role","llmArtifact","artifact","a","reasoning","reasoningUsed","callId","idx","prev","hasText","attachReasoning","functionMap","origin","resolveAccessToken","provider","headerToChatSession","_HttpSessionService","serverBaseUrl","accessToken","__publicField","sessionId","detail","it","_sessionId","_agentName","_customer","_sys","_model","session","partial","url","_partial","HttpSessionService"],"mappings":";;;;;;AAgBA,SAASA,EAA0BC,GAAuB;AACtD,MAAIA,MAAQ,QAAQ,OAAOA,KAAQ,SAAU,QAAOA;AACpD,QAAMC,IAAMD;AACZ,MAAIC,EAAI,UAAa,gBAAgB;AACjC,UAAM,EAAE,CAAC,OAAO,GAAGC,GAAO,GAAGC,MAASF;AACtC,WAAOE;AAAA,EACX;AACA,SAAOF;AACX;AARSG,EAAAL,GAAA;AAUT,SAASM,EAAcC,GAAwC;;AAC3D,aAAWC,KAAKD,GAAQ;AACpB,UAAIE,KAAAC,IAAAF,EAAE,SAAF,gBAAAE,EAAQ,UAAR,gBAAAD,EAAe,mBAAkB,OAAQ;AAC7C,UAAME,KAAOC,KAAAC,IAAAL,EAAE,YAAF,gBAAAK,EAAW,UAAX,gBAAAD,EAAkB,KAAK,CAAAE,MAAK,UAAUA,KAAK,OAAQA,EAA8B,QAAS;AACvG,QAAIH,UAAcA,EAA2B;AAAA,EACjD;AAEJ;AAPSN,EAAAC,GAAA;AAcT,SAASS,EAAeR,GAAmD;;AACvE,aAAWC,KAAKD,GAAQ;AACpB,UAAIE,KAAAC,IAAAF,EAAE,SAAF,gBAAAE,EAAQ,UAAR,gBAAAD,EAAe,mBAAkB,OAAQ;AAC7C,UAAME,KAAOC,KAAAC,IAAAL,EAAE,YAAF,gBAAAK,EAAW,UAAX,gBAAAD,EAAkB,KAAK,CAACE,MAAqCA,aAAaE;AACvF,QAAIL,EAAM,QAAOM,E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