@aintela/chat 0.7.0 → 0.9.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/dist/components.js +10016 -8911
- package/dist/components.js.map +1 -1
- package/dist/{detachedRunActivity-CjyFTKSw.js → detachedRunActivity-jHa9SDv1.js} +225 -203
- package/dist/detachedRunActivity-jHa9SDv1.js.map +1 -0
- package/dist/hooks.js +1 -1
- package/dist/{httpSessionService-Ckb9Cxia.js → httpSessionService-BIkDesYB.js} +32 -31
- package/dist/{httpSessionService-Ckb9Cxia.js.map → httpSessionService-BIkDesYB.js.map} +1 -1
- package/dist/index.js +297 -264
- package/dist/models.js +1 -1
- package/dist/{serializer-DNUH6kgE.js → serializer-DvR3nOcf.js} +786 -717
- package/dist/serializer-DvR3nOcf.js.map +1 -0
- package/dist/services.js +2 -2
- package/dist/src/components/AgentTeam/BillingLimitBanner.d.ts +7 -0
- package/dist/src/components/AgentTeam/ChatAgentHeader.d.ts +34 -0
- package/dist/src/components/AgentTeam/HandoffDivider.d.ts +13 -0
- package/dist/src/components/AgentTeam/PersonaAvatar.d.ts +20 -0
- package/dist/src/components/AgentTeam/__tests__/agentTeam.test.d.ts +0 -0
- package/dist/src/components/AgentTeam/__tests__/billingLimit.test.d.ts +0 -0
- package/dist/src/components/AgentTeam/__tests__/messagePersona.test.d.ts +0 -0
- package/dist/src/components/AgentTeam/agentRoles.d.ts +33 -0
- package/dist/src/components/AgentTeam/chatAgent.d.ts +24 -0
- package/dist/src/components/AgentTeam/index.d.ts +7 -0
- package/dist/src/components/AgentTeam/personas.d.ts +60 -0
- package/dist/src/components/AiChat/AiChatContext.d.ts +15 -0
- package/dist/src/components/AiChat/AiChatTypes.d.ts +16 -0
- package/dist/src/components/AiChat/ChatPane/ChatTurn.d.ts +33 -0
- package/dist/src/components/AiChat/ChatPane/CurrentMessage.d.ts +6 -4
- package/dist/src/components/AiChat/ChatPane/parts/ReadOnlyGuard.d.ts +9 -0
- package/dist/src/components/AiChat/ChatPane/parts/uiPartStage.d.ts +15 -10
- package/dist/src/components/AiChat/ChatPane/parts/uiToolRegistry.d.ts +6 -0
- package/dist/src/components/AiChat/ChatPane/turnCommitKeepsUiTools.test.d.ts +1 -0
- package/dist/src/components/AiChat/stateConfiguration.d.ts +7 -0
- package/dist/src/components/LlmResponseRender/EnvironmentContext.d.ts +7 -0
- package/dist/src/components/index.d.ts +2 -1
- package/dist/src/components/v2/SharedSessionTranscript.d.ts +76 -0
- package/dist/src/components/v2/index.d.ts +2 -0
- package/dist/src/models/ChatSession.d.ts +6 -0
- package/dist/src/models/Interaction.d.ts +11 -0
- package/dist/src/models/ServerEvent.d.ts +3 -0
- package/dist/src/models/billingLimit.d.ts +23 -0
- package/dist/src/models/index.d.ts +2 -1
- package/dist/src/models/semanticKernelModel/models.d.ts +19 -1
- package/dist/src/services/WebSocketConnection/WebSocketConnectionV2.d.ts +2 -0
- package/dist/src/services/WebSocketConnection/webSocketConnection.d.ts +3 -0
- package/dist/src/services/detachedRun/DetachedRunFramesTransport.d.ts +11 -0
- package/dist/src/services/detachedRun/streamDetachedRunFrames.d.ts +7 -0
- package/dist/{useChatSessions-aTjNcj8q.js → useChatSessions-CyFKVtkk.js} +2 -2
- package/dist/{useChatSessions-aTjNcj8q.js.map → useChatSessions-CyFKVtkk.js.map} +1 -1
- package/package.json +1 -1
- package/dist/detachedRunActivity-CjyFTKSw.js.map +0 -1
- package/dist/serializer-DNUH6kgE.js.map +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var h = (i, t) =>
|
|
4
|
-
var o = (i, t, e) =>
|
|
5
|
-
import { i as N, E as I, S as x, z as
|
|
6
|
-
import { format as
|
|
7
|
-
import
|
|
8
|
-
import { C as E, P as
|
|
9
|
-
import { d as
|
|
10
|
-
import { r as
|
|
1
|
+
var wt = Object.defineProperty;
|
|
2
|
+
var bt = (i, t, e) => t in i ? wt(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
|
+
var h = (i, t) => wt(i, "name", { value: t, configurable: !0 });
|
|
4
|
+
var o = (i, t, e) => bt(i, typeof t != "symbol" ? t + "" : t, e);
|
|
5
|
+
import { i as N, E as I, S as x, z as St, C as U, j as Lt, L as Pt, P as z, n as Ft, q as _t, T as Nt, o as Ut, s as et, B as xt } from "./serializer-DvR3nOcf.js";
|
|
6
|
+
import { format as qt } from "date-fns";
|
|
7
|
+
import Wt from "lodash";
|
|
8
|
+
import { C as E, P as Bt } from "./Prompt-DZb7OaPp.js";
|
|
9
|
+
import { d as Gt } from "./environmentUtils-VZNTCzEE.js";
|
|
10
|
+
import { r as zt } from "./httpSessionService-BIkDesYB.js";
|
|
11
11
|
const Q = {
|
|
12
12
|
PROMPTS: "envision-prompts"
|
|
13
|
-
},
|
|
13
|
+
}, Ht = 50, nt = class nt {
|
|
14
14
|
getPrompts() {
|
|
15
15
|
try {
|
|
16
16
|
const t = localStorage.getItem(Q.PROMPTS);
|
|
@@ -40,7 +40,7 @@ const Q = {
|
|
|
40
40
|
storePrompt(t) {
|
|
41
41
|
try {
|
|
42
42
|
const e = this.getPrompts().filter((s) => s.promptText !== t.promptText);
|
|
43
|
-
e.unshift(t), localStorage.setItem(Q.PROMPTS, JSON.stringify(e.slice(0,
|
|
43
|
+
e.unshift(t), localStorage.setItem(Q.PROMPTS, JSON.stringify(e.slice(0, Ht)));
|
|
44
44
|
} catch (e) {
|
|
45
45
|
console.error("Error storing prompt:", e);
|
|
46
46
|
}
|
|
@@ -54,8 +54,8 @@ const Q = {
|
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
h(nt, "LocalStorageService");
|
|
57
|
-
let
|
|
58
|
-
const
|
|
57
|
+
let It = nt;
|
|
58
|
+
const Re = /* @__PURE__ */ h((i) => {
|
|
59
59
|
const t = i.getPrompts(), e = t.length;
|
|
60
60
|
if (e > 0) {
|
|
61
61
|
const s = t[0].promptText, n = t[t.length - 1].promptText, r = t[0].created;
|
|
@@ -237,8 +237,8 @@ const d = new X(), rt = class rt {
|
|
|
237
237
|
}
|
|
238
238
|
};
|
|
239
239
|
h(rt, "EventBusService");
|
|
240
|
-
let
|
|
241
|
-
const
|
|
240
|
+
let Tt = rt;
|
|
241
|
+
const Jt = 2e3;
|
|
242
242
|
function q(i) {
|
|
243
243
|
i.parts === i.prev.parts && (i.parts = i.prev.parts.slice());
|
|
244
244
|
}
|
|
@@ -247,13 +247,13 @@ function J(i) {
|
|
|
247
247
|
i.functionMap === i.prev.functionMap && (i.functionMap = new Map(i.functionMap));
|
|
248
248
|
}
|
|
249
249
|
h(J, "ownFunctionMap");
|
|
250
|
-
const
|
|
251
|
-
function
|
|
250
|
+
const jt = /* @__PURE__ */ h((i) => i == I.FunctionCall || i == I.PartialFunctionCall, "isFunctionCall"), Kt = /* @__PURE__ */ h((i) => i == I.FunctionResponse, "isFunctionResponse"), Ot = /* @__PURE__ */ h((i) => i.parts.length + 1 + "-" + i.prev.interactionId, "nextPartId");
|
|
251
|
+
function Qt(i, t) {
|
|
252
252
|
var e, s, n, r, a;
|
|
253
|
-
return !!(!t || i.mustPush || i.mustPush === !1 && (i.eventType !== t.eventType || ((e = i.functionDetails) == null ? void 0 : e.id) !== ((s = t.functionDetails) == null ? void 0 : s.id)) || i.textAppendable && (((r = (n = t.thoughtDetails) == null ? void 0 : n.text) == null ? void 0 : r.length) ?? ((a = t.text) == null ? void 0 : a.length) ?? 0) >
|
|
253
|
+
return !!(!t || i.mustPush || i.mustPush === !1 && (i.eventType !== t.eventType || ((e = i.functionDetails) == null ? void 0 : e.id) !== ((s = t.functionDetails) == null ? void 0 : s.id)) || i.textAppendable && (((r = (n = t.thoughtDetails) == null ? void 0 : n.text) == null ? void 0 : r.length) ?? ((a = t.text) == null ? void 0 : a.length) ?? 0) > Jt);
|
|
254
254
|
}
|
|
255
|
-
h(
|
|
256
|
-
function
|
|
255
|
+
h(Qt, "opensNewPart");
|
|
256
|
+
function Yt(i, t) {
|
|
257
257
|
const e = t.functionDetails.id, s = t.functionDetails.clientOutput, n = i.parts.findIndex((r) => {
|
|
258
258
|
var a;
|
|
259
259
|
return ((a = r.functionDetails) == null ? void 0 : a.id) === e;
|
|
@@ -272,14 +272,14 @@ function Kt(i, t) {
|
|
|
272
272
|
} else {
|
|
273
273
|
const r = {
|
|
274
274
|
...t,
|
|
275
|
-
id:
|
|
275
|
+
id: Ot(i),
|
|
276
276
|
functionDetails: { ...t.functionDetails, silent: !0 }
|
|
277
277
|
};
|
|
278
278
|
q(i), i.parts.push(r), J(i), i.functionMap.set(e, r);
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
|
-
h(
|
|
282
|
-
function
|
|
281
|
+
h(Yt, "foldClientOutput");
|
|
282
|
+
function Xt(i, t, e, s, n) {
|
|
283
283
|
var p;
|
|
284
284
|
const r = i.parts.findIndex((m) => {
|
|
285
285
|
var u;
|
|
@@ -314,20 +314,20 @@ function Qt(i, t, e, s, n) {
|
|
|
314
314
|
};
|
|
315
315
|
J(i), i.functionMap.set(s, f), f.eventType === I.FunctionResponse && ((p = n == null ? void 0 : n.onFunctionResponse) == null || p.call(n, f.functionDetails)), r > -1 && (q(i), i.parts[r] = f);
|
|
316
316
|
}
|
|
317
|
-
h(
|
|
318
|
-
function
|
|
317
|
+
h(Xt, "foldFunctionEvent");
|
|
318
|
+
function Vt(i, t, e, s) {
|
|
319
319
|
s && t.functionDetails && (J(i), i.functionMap.set(s, t));
|
|
320
320
|
const n = i.prev.parts[i.prev.parts.length - 1] ?? null;
|
|
321
321
|
n && n.textAppendable && (q(i), i.parts[i.parts.length - 1] = { ...n, ended: /* @__PURE__ */ new Date() });
|
|
322
322
|
const r = {
|
|
323
323
|
...t,
|
|
324
|
-
id:
|
|
324
|
+
id: Ot(i),
|
|
325
325
|
partial: e.partial
|
|
326
326
|
};
|
|
327
327
|
i.parts = [...i.parts, r];
|
|
328
328
|
}
|
|
329
|
-
h(
|
|
330
|
-
function
|
|
329
|
+
h(Vt, "openPart");
|
|
330
|
+
function Zt(i, t, e, s) {
|
|
331
331
|
const n = i.parts[i.parts.length - 1] ?? null;
|
|
332
332
|
if (!n) return;
|
|
333
333
|
const r = {
|
|
@@ -344,8 +344,8 @@ function Xt(i, t, e, s) {
|
|
|
344
344
|
r.text = t.text ?? "", r.textDetails.version++, t.thoughtDetails && (r.thoughtDetails = { ...t.thoughtDetails, text: t.thoughtDetails.text.trim() });
|
|
345
345
|
q(i), i.parts[i.parts.length - 1] = r;
|
|
346
346
|
}
|
|
347
|
-
h(
|
|
348
|
-
function
|
|
347
|
+
h(Zt, "appendText");
|
|
348
|
+
function te(i, t) {
|
|
349
349
|
if (!t || t.length === 0) return i;
|
|
350
350
|
const e = i.slice();
|
|
351
351
|
for (const s of t) {
|
|
@@ -354,8 +354,8 @@ function Vt(i, t) {
|
|
|
354
354
|
}
|
|
355
355
|
return e;
|
|
356
356
|
}
|
|
357
|
-
h(
|
|
358
|
-
function
|
|
357
|
+
h(te, "mergeArtifacts");
|
|
358
|
+
function ee(i, t, e) {
|
|
359
359
|
var c, l;
|
|
360
360
|
const s = N.FlatParts(t == null ? void 0 : t.parts), n = i.parts[i.parts.length - 1] ?? null, r = {
|
|
361
361
|
prev: i,
|
|
@@ -365,27 +365,28 @@ function Zt(i, t, e) {
|
|
|
365
365
|
let a = !1;
|
|
366
366
|
if (s) {
|
|
367
367
|
if (s.eventType === I.FunctionClientOutput && !!((c = s.functionDetails) != null && c.id))
|
|
368
|
-
|
|
369
|
-
else if (
|
|
370
|
-
const p =
|
|
368
|
+
Yt(r, s);
|
|
369
|
+
else if (Qt(s, n)) {
|
|
370
|
+
const p = jt(s.eventType) || Kt(s.eventType), m = p ? (l = s.functionDetails) == null ? void 0 : l.id : void 0;
|
|
371
371
|
p && !m && console.error("Got isCall or isResponse without a callId", s);
|
|
372
372
|
const u = m ? r.functionMap.get(m) : void 0;
|
|
373
|
-
u && m && s.functionDetails ?
|
|
373
|
+
u && m && s.functionDetails ? Xt(r, s, u, m, e) : (Vt(r, s, t, m), a = !0);
|
|
374
374
|
}
|
|
375
|
-
s.textAppendable &&
|
|
375
|
+
s.textAppendable && Zt(r, s, t, a);
|
|
376
376
|
}
|
|
377
377
|
return {
|
|
378
378
|
...i,
|
|
379
379
|
version: i.version + 1,
|
|
380
380
|
parts: r.parts,
|
|
381
|
-
artifactData:
|
|
381
|
+
artifactData: te(i.artifactData ?? [], t.llmArtifacts),
|
|
382
382
|
functionMap: r.functionMap,
|
|
383
383
|
turn_complete: t.turn_complete,
|
|
384
384
|
partial: t.partial,
|
|
385
|
-
asyncFinalResponse: t.asyncFinalResponse
|
|
385
|
+
asyncFinalResponse: t.asyncFinalResponse,
|
|
386
|
+
agent: t.agent ?? i.agent
|
|
386
387
|
};
|
|
387
388
|
}
|
|
388
|
-
h(
|
|
389
|
+
h(ee, "reduceInteraction");
|
|
389
390
|
const ot = class ot {
|
|
390
391
|
constructor(t, e) {
|
|
391
392
|
o(this, "interaction");
|
|
@@ -398,7 +399,7 @@ const ot = class ot {
|
|
|
398
399
|
* throttled subscribers cannot diverge from live state.
|
|
399
400
|
*/
|
|
400
401
|
merge(t) {
|
|
401
|
-
const e =
|
|
402
|
+
const e = ee(this.interaction, t, {
|
|
402
403
|
onFunctionResponse: /* @__PURE__ */ h((s) => this.eventBusService.gatewayEmitFunctionResponse(s), "onFunctionResponse")
|
|
403
404
|
});
|
|
404
405
|
return this.interaction = e, e;
|
|
@@ -406,7 +407,7 @@ const ot = class ot {
|
|
|
406
407
|
};
|
|
407
408
|
h(ot, "InteractionService");
|
|
408
409
|
let j = ot;
|
|
409
|
-
const
|
|
410
|
+
const kt = 4001, se = 4002, Dt = 4004, ne = 4100, H = 500, ie = 2e4, re = 1e3, oe = 0.2, _ = 300 * 1e3, ae = 0.75, ce = 2e3, S = "[Connection]", at = class at {
|
|
410
411
|
constructor(t) {
|
|
411
412
|
o(this, "ports");
|
|
412
413
|
o(this, "state");
|
|
@@ -463,7 +464,7 @@ const Ot = 4001, te = 4002, kt = 4004, ee = 4100, H = 500, se = 2e4, ne = 1e3, i
|
|
|
463
464
|
if (this.inflight) return this.inflight;
|
|
464
465
|
if (this.isUp && this.target.sessionId && !this.halted)
|
|
465
466
|
return Promise.resolve(this.target.sessionId);
|
|
466
|
-
} else this.target && (console.log(`${
|
|
467
|
+
} else this.target && (console.log(`${S} switching from session ${this.target.sessionId ?? "(new)"} to ${t ?? "(new)"}.`), this.close());
|
|
467
468
|
return this.halted = null, this.cancelRetry(), this.target = { sessionId: t, resume: (e == null ? void 0 : e.resume) === !0, prepare: e == null ? void 0 : e.prepare }, this.startIdleTick(), this.dial();
|
|
468
469
|
}
|
|
469
470
|
/**
|
|
@@ -475,7 +476,7 @@ const Ot = 4001, te = 4002, kt = 4004, ee = 4100, H = 500, se = 2e4, ne = 1e3, i
|
|
|
475
476
|
var e;
|
|
476
477
|
if (this.halted)
|
|
477
478
|
throw new Error(`The connection was halted (${this.halted}); session ${((e = this.target) == null ? void 0 : e.sessionId) ?? t ?? "none"} cannot be redialled.`);
|
|
478
|
-
return this.target ? this.inflight ? this.inflight : this.isUp && this.target.sessionId ? this.target.sessionId : (console.warn(`${
|
|
479
|
+
return this.target ? this.inflight ? this.inflight : this.isUp && this.target.sessionId ? this.target.sessionId : (console.warn(`${S} send guard: socket is DOWN at send time (session ${this.target.sessionId ?? "(new)"}, status ${this.state.connectionStatus}) — redialling now instead of in ${this.wait}ms.`), this.cancelRetry(), this.target.resume = !0, this.dial()) : (console.warn(`${S} send guard: nothing supervised yet — opening session ${t ?? "(new)"} with the replay cursor.`), this.open(t, { resume: !0 }));
|
|
479
480
|
}
|
|
480
481
|
/** Stop supervising: hang up, cancel any retry, stop the idle tick. Never throws. */
|
|
481
482
|
close() {
|
|
@@ -484,7 +485,7 @@ const Ot = 4001, te = 4002, kt = 4004, ee = 4100, H = 500, se = 2e4, ne = 1e3, i
|
|
|
484
485
|
try {
|
|
485
486
|
this.ports.hangUp();
|
|
486
487
|
} catch (e) {
|
|
487
|
-
console.error(`${
|
|
488
|
+
console.error(`${S} hangUp threw`, e);
|
|
488
489
|
}
|
|
489
490
|
t && this.state.setConnectionStatus(E.Disconnected);
|
|
490
491
|
}
|
|
@@ -500,12 +501,12 @@ const Ot = 4001, te = 4002, kt = 4004, ee = 4100, H = 500, se = 2e4, ne = 1e3, i
|
|
|
500
501
|
* A close that lands while a dial is in flight is remembered and judged when that dial fails.
|
|
501
502
|
*/
|
|
502
503
|
transportClosed(t, e) {
|
|
503
|
-
if (t !==
|
|
504
|
+
if (t !== kt && (this.lastCloseCode = t, !!this.target)) {
|
|
504
505
|
if (this.inflight) {
|
|
505
|
-
console.log(`${
|
|
506
|
+
console.log(`${S} socket closed (code=${t}) while a dial is in flight — judged when it settles.`);
|
|
506
507
|
return;
|
|
507
508
|
}
|
|
508
|
-
this.state.connectionStatus === E.Connected && (console.warn(`${
|
|
509
|
+
this.state.connectionStatus === E.Connected && (console.warn(`${S} socket closed: code=${t} reason="${e}" (session ${this.target.sessionId ?? "(new)"}).`), this.state.setConnectionStatus(E.Disconnected), this.judge(t));
|
|
509
510
|
}
|
|
510
511
|
}
|
|
511
512
|
// ─── The dial ───────────────────────────────────────────────────────────
|
|
@@ -513,11 +514,11 @@ const Ot = 4001, te = 4002, kt = 4004, ee = 4100, H = 500, se = 2e4, ne = 1e3, i
|
|
|
513
514
|
const t = this.target;
|
|
514
515
|
this.lastCloseCode = null, this.state.setConnectionStatus(E.Connecting);
|
|
515
516
|
const e = this.now();
|
|
516
|
-
console.log(`${
|
|
517
|
+
console.log(`${S} dialling session ${t.sessionId ?? "(new)"}${t.resume ? " with the replay cursor" : ""}${this.everConnected ? " (reconnect)" : ""}.`);
|
|
517
518
|
const n = (async () => (t.prepare && await t.prepare(), this.ports.dial(t.sessionId, { resume: t.resume })))().then((r) => {
|
|
518
519
|
var c, l;
|
|
519
520
|
if (this.target !== t) {
|
|
520
|
-
console.log(`${
|
|
521
|
+
console.log(`${S} a dial for ${t.sessionId ?? "(new)"} resolved after it was abandoned — hanging up.`);
|
|
521
522
|
try {
|
|
522
523
|
this.ports.hangUp();
|
|
523
524
|
} catch {
|
|
@@ -525,7 +526,7 @@ const Ot = 4001, te = 4002, kt = 4004, ee = 4100, H = 500, se = 2e4, ne = 1e3, i
|
|
|
525
526
|
throw new Error("Connection attempt abandoned");
|
|
526
527
|
}
|
|
527
528
|
if (t.sessionId && r !== t.sessionId) {
|
|
528
|
-
console.error(`${
|
|
529
|
+
console.error(`${S} asked for session ${t.sessionId}, the server answered with ${r} — refusing the swap and halting.`);
|
|
529
530
|
try {
|
|
530
531
|
this.ports.hangUp();
|
|
531
532
|
} catch {
|
|
@@ -533,11 +534,11 @@ const Ot = 4001, te = 4002, kt = 4004, ee = 4100, H = 500, se = 2e4, ne = 1e3, i
|
|
|
533
534
|
throw this.state.setConnectionStatus(E.Disconnected), this.halt("session-gone", { sessionId: t.sessionId, actualSessionId: r }), new Error(`Session ${t.sessionId} no longer exists on the server (it answered with ${r}).`);
|
|
534
535
|
}
|
|
535
536
|
const a = this.everConnected;
|
|
536
|
-
return this.everConnected = !0, t.sessionId = r, t.resume = !0, t.prepare = void 0, this.wait = H, this.attempt = 0, this.state.setConnectionStatus(E.Connected), console.log(`${
|
|
537
|
+
return this.everConnected = !0, t.sessionId = r, t.resume = !0, t.prepare = void 0, this.wait = H, this.attempt = 0, this.state.setConnectionStatus(E.Connected), console.log(`${S} ${a ? "reconnected to" : "connected to"} session ${r} in ${this.now() - e}ms.`), (l = (c = this.ports).onConnected) == null || l.call(c, r, { reconnect: a }), r;
|
|
537
538
|
}).catch((r) => {
|
|
538
539
|
if (this.target === t && !this.halted) {
|
|
539
540
|
const a = this.lastCloseCode;
|
|
540
|
-
console.error(`${
|
|
541
|
+
console.error(`${S} dial of session ${t.sessionId ?? "(new)"} failed after ${this.now() - e}ms${a !== null ? ` (socket closed with ${a})` : ""}:`, r), this.state.setConnectionStatus(E.Disconnected), this.inflight === n && (this.inflight = null), this.judge(a);
|
|
541
542
|
}
|
|
542
543
|
throw r;
|
|
543
544
|
}).finally(() => {
|
|
@@ -549,33 +550,33 @@ const Ot = 4001, te = 4002, kt = 4004, ee = 4100, H = 500, se = 2e4, ne = 1e3, i
|
|
|
549
550
|
judge(t) {
|
|
550
551
|
var s;
|
|
551
552
|
const e = (s = this.target) == null ? void 0 : s.sessionId;
|
|
552
|
-
if (t ===
|
|
553
|
-
if (t ===
|
|
553
|
+
if (t === se) return this.halt("attached-elsewhere", { sessionId: e, code: t });
|
|
554
|
+
if (t === Dt) return this.halt("session-gone", { sessionId: e, code: t });
|
|
554
555
|
if (t === 1e3 || t === 1008) return this.halt("closed-by-server", { sessionId: e, code: t });
|
|
555
556
|
this.scheduleRetry();
|
|
556
557
|
}
|
|
557
558
|
halt(t, e) {
|
|
558
559
|
var s, n;
|
|
559
|
-
this.halted = t, this.cancelRetry(), console.warn(`${
|
|
560
|
+
this.halted = t, this.cancelRetry(), console.warn(`${S} halted (${t}) on session ${e.sessionId ?? "(new)"}${e.code !== void 0 ? `, close code ${e.code}` : ""} — no automatic redial; an explicit open() may try again.`);
|
|
560
561
|
try {
|
|
561
562
|
(n = (s = this.ports).onHalt) == null || n.call(s, t, e);
|
|
562
563
|
} catch (r) {
|
|
563
|
-
console.error(`${
|
|
564
|
+
console.error(`${S} onHalt threw`, r);
|
|
564
565
|
}
|
|
565
566
|
}
|
|
566
567
|
scheduleRetry() {
|
|
567
568
|
var e, s;
|
|
568
569
|
if (!this.target || this.retryTimer || this.inflight) return;
|
|
569
570
|
if (!this.state.sessionActive) {
|
|
570
|
-
console.log(`${
|
|
571
|
+
console.log(`${S} session idle — not redialling until activity resumes.`);
|
|
571
572
|
return;
|
|
572
573
|
}
|
|
573
574
|
const t = this.jittered(this.wait);
|
|
574
|
-
this.wait = Math.min(Math.floor(this.wait + this.wait * this.wait /
|
|
575
|
+
this.wait = Math.min(Math.floor(this.wait + this.wait * this.wait / re), ie), this.attempt += 1, console.warn(`${S} redialling session ${this.target.sessionId ?? "(new)"} in ${t}ms (then ${this.wait}ms, attempt ${this.attempt}).`);
|
|
575
576
|
try {
|
|
576
577
|
(s = (e = this.ports).onRetryScheduled) == null || s.call(e, { sessionId: this.target.sessionId, delayMs: t, attempt: this.attempt });
|
|
577
578
|
} catch (n) {
|
|
578
|
-
console.error(`${
|
|
579
|
+
console.error(`${S} onRetryScheduled threw`, n);
|
|
579
580
|
}
|
|
580
581
|
this.retryTimer = setTimeout(() => {
|
|
581
582
|
this.retryTimer = null, !(!this.target || this.halted) && (this.target.resume = !0, this.dial().catch(() => {
|
|
@@ -586,7 +587,7 @@ const Ot = 4001, te = 4002, kt = 4004, ee = 4100, H = 500, se = 2e4, ne = 1e3, i
|
|
|
586
587
|
this.retryTimer && (clearTimeout(this.retryTimer), this.retryTimer = null);
|
|
587
588
|
}
|
|
588
589
|
jittered(t) {
|
|
589
|
-
return Math.max(0, Math.round(t + t *
|
|
590
|
+
return Math.max(0, Math.round(t + t * oe * (Math.random() * 2 - 1)));
|
|
590
591
|
}
|
|
591
592
|
sameTarget(t) {
|
|
592
593
|
var e;
|
|
@@ -594,7 +595,7 @@ const Ot = 4001, te = 4002, kt = 4004, ee = 4100, H = 500, se = 2e4, ne = 1e3, i
|
|
|
594
595
|
}
|
|
595
596
|
// ─── Idle ───────────────────────────────────────────────────────────────
|
|
596
597
|
startIdleTick() {
|
|
597
|
-
this.idleTimer || (this.idleTimer = setInterval(() => this.tick(),
|
|
598
|
+
this.idleTimer || (this.idleTimer = setInterval(() => this.tick(), ce));
|
|
598
599
|
}
|
|
599
600
|
stopIdleTick() {
|
|
600
601
|
this.idleTimer && (clearInterval(this.idleTimer), this.idleTimer = null);
|
|
@@ -613,18 +614,18 @@ const Ot = 4001, te = 4002, kt = 4004, ee = 4100, H = 500, se = 2e4, ne = 1e3, i
|
|
|
613
614
|
const t = this.now() - this.state.lastActivity;
|
|
614
615
|
if (t > _) {
|
|
615
616
|
if (this.state.sessionActive && this.state.setIsSessionActive(!1), this.cancelRetry(), this.state.connectionStatus === E.Connected) {
|
|
616
|
-
console.warn(`${
|
|
617
|
+
console.warn(`${S} idle for ${Math.round(t / 1e3)}s (limit ${_ / 1e3}s) — closing the socket (session ${this.target.sessionId ?? "(new)"}). Activity, or a send, redials it.`);
|
|
617
618
|
try {
|
|
618
619
|
this.ports.hangUp();
|
|
619
620
|
} catch (e) {
|
|
620
|
-
console.error(`${
|
|
621
|
+
console.error(`${S} hangUp threw`, e);
|
|
621
622
|
}
|
|
622
623
|
this.state.setConnectionStatus(E.Disconnected);
|
|
623
624
|
}
|
|
624
625
|
return;
|
|
625
626
|
}
|
|
626
|
-
this.state.sessionActive || (console.log(`${
|
|
627
|
-
}))), t > _ *
|
|
627
|
+
this.state.sessionActive || (console.log(`${S} activity resumed — the session is active again.`), this.state.setIsSessionActive(!0), this.wait = H, this.state.connectionStatus === E.Disconnected && !this.halted && !this.inflight && (this.target.resume = !0, this.dial().catch(() => {
|
|
628
|
+
}))), t > _ * ae ? this.idleWarningLogged || (this.idleWarningLogged = !0, console.warn(`${S} idle ${Math.round(t / 1e3)}s of ${_ / 1e3}s — the socket closes in about ${Math.round((_ - t) / 1e3)}s unless something happens.`)) : this.idleWarningLogged = !1;
|
|
628
629
|
}
|
|
629
630
|
};
|
|
630
631
|
h(at, "ConnectionSupervisor");
|
|
@@ -736,13 +737,13 @@ const y = class y {
|
|
|
736
737
|
this.sessionId = u, this.sessionState.setConnectionOutage(null), this.eventBusService.gatewayEmitConnected(u, g), this.flushAnnouncements();
|
|
737
738
|
}, "onConnected"),
|
|
738
739
|
onRetryScheduled: /* @__PURE__ */ h(({ delayMs: u, attempt: g }) => {
|
|
739
|
-
var
|
|
740
|
-
const
|
|
741
|
-
this.sessionState.setConnectionOutage({ since:
|
|
740
|
+
var D;
|
|
741
|
+
const w = Date.now(), M = ((D = this.sessionState.connectionOutage) == null ? void 0 : D.since) ?? w;
|
|
742
|
+
this.sessionState.setConnectionOutage({ since: M, retryAt: w + u, attempt: g, halted: null }), w - M >= y.OUTAGE_CLOSES_TURN_AFTER_MS && this.closeOpenTurnWith(y.OUTAGE_TURN_MESSAGE);
|
|
742
743
|
}, "onRetryScheduled"),
|
|
743
744
|
onHalt: /* @__PURE__ */ h((u, g) => {
|
|
744
|
-
const
|
|
745
|
-
this.sessionState.setConnectionOutage({ since: (
|
|
745
|
+
const w = this.sessionState.connectionOutage;
|
|
746
|
+
this.sessionState.setConnectionOutage({ since: (w == null ? void 0 : w.since) ?? Date.now(), retryAt: null, attempt: (w == null ? void 0 : w.attempt) ?? 0, halted: u }), this.notifyHalt(u, g), this.closeOpenTurnWith(y.HALT_TURN_MESSAGE[u]);
|
|
746
747
|
}, "onHalt")
|
|
747
748
|
}), this.wsService.onEvent = async (u) => {
|
|
748
749
|
await this.Message(u);
|
|
@@ -766,6 +767,8 @@ const y = class y {
|
|
|
766
767
|
this.eventBusService.gatewayEmitStreamError(u);
|
|
767
768
|
}, this.wsService.onOpen = () => {
|
|
768
769
|
this.everConnected = !0;
|
|
770
|
+
}, this.wsService.onBillingLimit = (u) => {
|
|
771
|
+
a.getState().setBillingLimit(u);
|
|
769
772
|
}, this.wsService.onFirstToken = (u) => {
|
|
770
773
|
this.localEmitFirstToken(u);
|
|
771
774
|
}, this.wsService.onClose = (u, g) => {
|
|
@@ -904,10 +907,10 @@ const y = class y {
|
|
|
904
907
|
const s = this.interactionsServiceMap.get(e);
|
|
905
908
|
if (s) {
|
|
906
909
|
const n = s.interaction;
|
|
907
|
-
n.interactionQuestion || (n.interactionQuestion = t.content ?? ""), n.origin ?? (n.origin =
|
|
910
|
+
n.interactionQuestion || (n.interactionQuestion = t.content ?? ""), n.origin ?? (n.origin = St(t.origin));
|
|
908
911
|
return;
|
|
909
912
|
}
|
|
910
|
-
this.openRemoteInteraction(e, t.content ?? "",
|
|
913
|
+
this.openRemoteInteraction(e, t.content ?? "", St(t.origin), !0);
|
|
911
914
|
}
|
|
912
915
|
getInteractions() {
|
|
913
916
|
return Array.from(this.interactionsMap.values());
|
|
@@ -924,7 +927,7 @@ const y = class y {
|
|
|
924
927
|
return e || (e = this.openRemoteInteraction(t.interactionId, "", void 0, !1)), e.merge(t);
|
|
925
928
|
}
|
|
926
929
|
getNewInteractionId() {
|
|
927
|
-
const e =
|
|
930
|
+
const e = qt(/* @__PURE__ */ new Date(), "MMM_dd_HH_mm_ss");
|
|
928
931
|
return `${this.msg_order}_${e}`;
|
|
929
932
|
}
|
|
930
933
|
// ─── Inbound: server events ─────────────────────────────────────────────
|
|
@@ -1109,7 +1112,7 @@ const y = class y {
|
|
|
1109
1112
|
try {
|
|
1110
1113
|
const { promptAsString: r, json: a } = this.sessionState.onRenderPrompt ? this.sessionState.onRenderPrompt(t.data) : { promptAsString: t.data, json: void 0 };
|
|
1111
1114
|
this.sessionState.onRenderPrompt && (t.data = a, t.friendlyMessage = r);
|
|
1112
|
-
const c = await this.sendMessageInternal(t, e), l =
|
|
1115
|
+
const c = await this.sendMessageInternal(t, e), l = Bt.createPrompt(r ?? "", (a == null ? void 0 : a.toString()) ?? {});
|
|
1113
1116
|
this.storageService.storePrompt(l);
|
|
1114
1117
|
const f = N.fromText("Planejando próximos passos");
|
|
1115
1118
|
return this.sendStatusMessage(t.data, [n, f], s.toString() + "1"), c != null && c.success ? this.eventBusService.ChatEmitMessageSent(t.data, c.interaction) : this.eventBusService.ChatEmitMessageError((c == null ? void 0 : c.error) ?? ""), c;
|
|
@@ -1171,7 +1174,7 @@ const y = class y {
|
|
|
1171
1174
|
sendStatusMessage(t, e, s) {
|
|
1172
1175
|
var r, a;
|
|
1173
1176
|
let n;
|
|
1174
|
-
((a = (r = this.currentIS) == null ? void 0 : r.interaction) == null ? void 0 : a.turn_complete) === !1 && !this.currentIS.interaction.remote ? (n =
|
|
1177
|
+
((a = (r = this.currentIS) == null ? void 0 : r.interaction) == null ? void 0 : a.turn_complete) === !1 && !this.currentIS.interaction.remote ? (n = Wt.cloneDeep(this.currentIS.interaction), n.parts.push(...e)) : n = {
|
|
1175
1178
|
interactionId: "tmp" + s,
|
|
1176
1179
|
created: /* @__PURE__ */ new Date(),
|
|
1177
1180
|
partial: !0,
|
|
@@ -1288,59 +1291,59 @@ o(y, "NO_CONNECTION_MESSAGE", "Não foi possível obter conexão com o servidor"
|
|
|
1288
1291
|
"session-gone": "A sessão não existe mais no servidor. A resposta foi interrompida.",
|
|
1289
1292
|
"closed-by-server": "O servidor encerrou a conexão. A resposta foi interrompida."
|
|
1290
1293
|
});
|
|
1291
|
-
let
|
|
1292
|
-
function
|
|
1293
|
-
const t = new
|
|
1294
|
+
let yt = y;
|
|
1295
|
+
function le(i) {
|
|
1296
|
+
const t = new Pt();
|
|
1294
1297
|
t.author = "main", t.streamingParts = i.streamingParts, i.partialEventType ? t.eventType = i.partialEventType : t.eventType = i.functionName ? { fullName: z.StreamingFunctionCallUpdateContent, type: I.PartialFunctionCall } : i.partialReasoning ? { fullName: z.StreamingReasoningContent, type: I.Thought } : { fullName: z.StreamingTextContent, type: I.Text }, t.interactionId = i.iteractionId ?? "", t.mimeType = "text/plain", t.partial = !0, t.role = { label: "Assistant" }, t.timestamp = i.timeStamp ?? (/* @__PURE__ */ new Date()).getTime(), t.turnComplete = !1;
|
|
1295
1298
|
const e = t.eventType.type;
|
|
1296
1299
|
if (e == I.PartialFunctionCall) {
|
|
1297
|
-
const s = new
|
|
1300
|
+
const s = new Ft();
|
|
1298
1301
|
s.choiceIndex = 0, s.callId = i.functionCallId, s.arguments = i.partialText, s.name = i.functionName, t.content = { items: [s], role: { label: "Assistant" } };
|
|
1299
1302
|
} else if (e == I.Text)
|
|
1300
1303
|
if (t.eventType.fullName == z.StreamingTextContent) {
|
|
1301
|
-
const s = new
|
|
1304
|
+
const s = new _t();
|
|
1302
1305
|
s.text = i.partialText, t.content = { items: [s], role: { label: "Assistant" } };
|
|
1303
1306
|
} else {
|
|
1304
|
-
const s = new
|
|
1307
|
+
const s = new Nt();
|
|
1305
1308
|
s.text = i.partialText, t.content = { items: [s], role: { label: "Assistant" } };
|
|
1306
1309
|
}
|
|
1307
1310
|
else if (e == I.Thought) {
|
|
1308
|
-
const s = new
|
|
1311
|
+
const s = new Ut();
|
|
1309
1312
|
s.text = i.partialReasoning, t.content = { items: [s], role: { label: "Assistant" } };
|
|
1310
1313
|
}
|
|
1311
1314
|
return t;
|
|
1312
1315
|
}
|
|
1313
|
-
h(
|
|
1316
|
+
h(le, "llmEventFromPartial");
|
|
1314
1317
|
function st(i) {
|
|
1315
|
-
const t = i.partialEvent ?
|
|
1318
|
+
const t = i.partialEvent ? le(i.partialEvent) : i.event;
|
|
1316
1319
|
if (t)
|
|
1317
1320
|
return i.detachedRunId && (t.detachedRunId = i.detachedRunId, t.detachedRunName = i.detachedRunName), t;
|
|
1318
1321
|
}
|
|
1319
1322
|
h(st, "llmEventFromFrame");
|
|
1320
|
-
function
|
|
1323
|
+
function $t(i) {
|
|
1321
1324
|
var t, e, s;
|
|
1322
1325
|
return (((e = (t = i.content) == null ? void 0 : t.items) == null ? void 0 : e.length) ?? 0) > 0 || (((s = i.streamingParts) == null ? void 0 : s.length) ?? 0) > 0;
|
|
1323
1326
|
}
|
|
1324
|
-
h(
|
|
1325
|
-
function
|
|
1327
|
+
h($t, "carriesContent");
|
|
1328
|
+
function Rt(i) {
|
|
1326
1329
|
var e;
|
|
1327
1330
|
if (i.type !== "InteractionStarted" || !((e = i.interaction) != null && e.interactionId)) return;
|
|
1328
1331
|
if (i.interaction.detachedRunId || !i.detachedRunId) return i.interaction;
|
|
1329
|
-
const t = Object.assign(new
|
|
1332
|
+
const t = Object.assign(new Lt(), i.interaction);
|
|
1330
1333
|
return t.detachedRunId = i.detachedRunId, t;
|
|
1331
1334
|
}
|
|
1332
|
-
h(
|
|
1333
|
-
const
|
|
1334
|
-
function
|
|
1335
|
+
h(Rt, "interactionStartFromFrame");
|
|
1336
|
+
const he = 0.02;
|
|
1337
|
+
function ue(i, t) {
|
|
1335
1338
|
if (!t) return null;
|
|
1336
1339
|
const e = (t.interactionsCompressed ?? 0) > 0 || (t.compressionRatio ?? 0) > 0;
|
|
1337
1340
|
if (!i)
|
|
1338
|
-
return e ?
|
|
1339
|
-
const s = i.size - t.size, n = t.maxSize || i.maxSize || 0, r = n > 0 ? s / n >=
|
|
1340
|
-
return !e && !r ? null :
|
|
1341
|
+
return e ? vt(t, t.size, t.size) : null;
|
|
1342
|
+
const s = i.size - t.size, n = t.maxSize || i.maxSize || 0, r = n > 0 ? s / n >= he : i.size > 0 && s / i.size >= 0.1;
|
|
1343
|
+
return !e && !r ? null : vt(t, i.size, t.size, i.ratio);
|
|
1341
1344
|
}
|
|
1342
|
-
h(
|
|
1343
|
-
function
|
|
1345
|
+
h(ue, "detectCompaction");
|
|
1346
|
+
function vt(i, t, e, s) {
|
|
1344
1347
|
return {
|
|
1345
1348
|
at: Date.now(),
|
|
1346
1349
|
// Where the bar stood when it happened — the marker's position. The ratio
|
|
@@ -1352,8 +1355,8 @@ function yt(i, t, e, s) {
|
|
|
1352
1355
|
interactionsCompressed: i.interactionsCompressed
|
|
1353
1356
|
};
|
|
1354
1357
|
}
|
|
1355
|
-
h(
|
|
1356
|
-
const
|
|
1358
|
+
h(vt, "entry");
|
|
1359
|
+
const Et = 4, de = 3, fe = 20, P = class P {
|
|
1357
1360
|
constructor() {
|
|
1358
1361
|
o(this, "stats");
|
|
1359
1362
|
o(this, "onFlush");
|
|
@@ -1389,14 +1392,14 @@ const vt = 4, he = 3, ue = 20, P = class P {
|
|
|
1389
1392
|
record(t) {
|
|
1390
1393
|
const e = Date.now();
|
|
1391
1394
|
if (this.events.push([e, t.textLength]), this.stats.eventCount += 1, this.stats.totalTransfered += t.rawLength, t.sessionInformation && !t.fromDetachedRun) {
|
|
1392
|
-
const r =
|
|
1393
|
-
r && (this.sessionCompactions.push(r), this.sessionCompactions.length >
|
|
1395
|
+
const r = ue(this.previousSessionInformation, t.sessionInformation);
|
|
1396
|
+
r && (this.sessionCompactions.push(r), this.sessionCompactions.length > fe && this.sessionCompactions.shift()), this.previousSessionInformation = t.sessionInformation, this.stats.sessionInformation = t.sessionInformation, this.stats.sessionCompactions = this.sessionCompactions;
|
|
1394
1397
|
}
|
|
1395
1398
|
this.stats.elapsed = (e - this.stats.startTime.getTime()) / 1e3;
|
|
1396
|
-
const s = e -
|
|
1399
|
+
const s = e - Et * 1e3;
|
|
1397
1400
|
for (; this.events.length > 0 && this.events[0][0] <= s; ) this.events.shift();
|
|
1398
1401
|
const n = this.events.reduce((r, a) => r + a[1], 0);
|
|
1399
|
-
this.stats.tokensPerSecond = n /
|
|
1402
|
+
this.stats.tokensPerSecond = n / de / Et, this.flushCoalesced();
|
|
1400
1403
|
}
|
|
1401
1404
|
flushCoalesced() {
|
|
1402
1405
|
if (!this.onFlush) return;
|
|
@@ -1413,7 +1416,7 @@ const vt = 4, he = 3, ue = 20, P = class P {
|
|
|
1413
1416
|
};
|
|
1414
1417
|
h(P, "StreamStatsTracker"), o(P, "STATS_FLUSH_MS", 120);
|
|
1415
1418
|
let tt = P;
|
|
1416
|
-
const
|
|
1419
|
+
const ge = 5e3, pe = 3e4, Y = 1e4, lt = class lt {
|
|
1417
1420
|
constructor(t = "ws://localhost:8000", e) {
|
|
1418
1421
|
o(this, "ws", null);
|
|
1419
1422
|
/** Frame counts, byte totals, the token-rate estimate and the compaction history — see StreamStatsTracker. */
|
|
@@ -1431,6 +1434,7 @@ const de = 5e3, fe = 3e4, Y = 1e4, lt = class lt {
|
|
|
1431
1434
|
o(this, "onOpen");
|
|
1432
1435
|
o(this, "onFirstToken");
|
|
1433
1436
|
o(this, "onSuspended");
|
|
1437
|
+
o(this, "onBillingLimit");
|
|
1434
1438
|
o(this, "onClose");
|
|
1435
1439
|
/**
|
|
1436
1440
|
* Fired when the server signals that we lost streaming events on resume — our
|
|
@@ -1464,7 +1468,7 @@ const de = 5e3, fe = 3e4, Y = 1e4, lt = class lt {
|
|
|
1464
1468
|
* the single-attach policy makes it undeliverable from here anyway.
|
|
1465
1469
|
*/
|
|
1466
1470
|
o(this, "pendingAnswers", []);
|
|
1467
|
-
this.baseUrl = t, this.getToken = e, this.firstTokenInteractions = /* @__PURE__ */ new Set(), this.streamingResponseSerializer = et(), console.log("SOCKET INSTACE",
|
|
1471
|
+
this.baseUrl = t, this.getToken = e, this.firstTokenInteractions = /* @__PURE__ */ new Set(), this.streamingResponseSerializer = et(), console.log("SOCKET INSTACE", Gt()), this.lastActivity = (/* @__PURE__ */ new Date()).getTime();
|
|
1468
1472
|
}
|
|
1469
1473
|
get stats() {
|
|
1470
1474
|
return this.statsTracker.stats;
|
|
@@ -1487,9 +1491,9 @@ const de = 5e3, fe = 3e4, Y = 1e4, lt = class lt {
|
|
|
1487
1491
|
*/
|
|
1488
1492
|
connect(t, e) {
|
|
1489
1493
|
return new Promise(async (s, n) => {
|
|
1490
|
-
var
|
|
1494
|
+
var D, F;
|
|
1491
1495
|
e != null && e.resume || (this.lastSeq = -1);
|
|
1492
|
-
const r = (
|
|
1496
|
+
const r = (D = this.getToken) == null ? void 0 : D.call(this), a = [];
|
|
1493
1497
|
r && a.push(`access_token=${encodeURIComponent(r)}`), t && this.lastSeq >= 0 && a.push(`lastSeq=${this.lastSeq}`), t && (e != null && e.resume) && e.openInteractionId && a.push(`openInteraction=${encodeURIComponent(e.openInteractionId)}`);
|
|
1494
1498
|
const c = a.length > 0 ? `?${a.join("&")}` : "", l = this.baseUrl.replace(/^http:\/\//, "ws://").replace(/^https:\/\//, "wss://"), f = `${l}/ws/connect/${t ?? ""}${c}`;
|
|
1495
1499
|
console.log("[WebSocket] Connecting to", `${l}/ws/connect/${t ?? ""}` + (t && this.lastSeq >= 0 ? ` (resume lastSeq=${this.lastSeq})` : "")), this.detachSocket(), this.ws = new WebSocket(f), this.ws.onopen = () => {
|
|
@@ -1512,7 +1516,7 @@ const de = 5e3, fe = 3e4, Y = 1e4, lt = class lt {
|
|
|
1512
1516
|
};
|
|
1513
1517
|
const p = 200, m = 3e4, u = 8e3, g = this.ws;
|
|
1514
1518
|
this.sessionId = void 0;
|
|
1515
|
-
let
|
|
1519
|
+
let w = 0, M = 0;
|
|
1516
1520
|
for (; ; ) {
|
|
1517
1521
|
if (this.ws !== g) {
|
|
1518
1522
|
n("Connection attempt superseded by a newer connect()");
|
|
@@ -1523,7 +1527,7 @@ const de = 5e3, fe = 3e4, Y = 1e4, lt = class lt {
|
|
|
1523
1527
|
n("Connection closed before a session id was received");
|
|
1524
1528
|
return;
|
|
1525
1529
|
}
|
|
1526
|
-
if (g.readyState === WebSocket.CONNECTING &&
|
|
1530
|
+
if (g.readyState === WebSocket.CONNECTING && w >= m) {
|
|
1527
1531
|
try {
|
|
1528
1532
|
g.close();
|
|
1529
1533
|
} catch {
|
|
@@ -1531,11 +1535,11 @@ const de = 5e3, fe = 3e4, Y = 1e4, lt = class lt {
|
|
|
1531
1535
|
n(`Server did not accept the connection within ${m / 1e3}s`);
|
|
1532
1536
|
return;
|
|
1533
1537
|
}
|
|
1534
|
-
if (g.readyState === WebSocket.OPEN &&
|
|
1538
|
+
if (g.readyState === WebSocket.OPEN && M >= u) {
|
|
1535
1539
|
n(`Connected but no session id arrived within ${u / 1e3}s`);
|
|
1536
1540
|
return;
|
|
1537
1541
|
}
|
|
1538
|
-
|
|
1542
|
+
w % 2e3 === 0 && console.log("Aguardando session Id"), await this.sleep(p), w += p, g.readyState === WebSocket.OPEN && (M += p);
|
|
1539
1543
|
}
|
|
1540
1544
|
console.log(`[WebSocket] Session ${this.sessionId} proven${this.lastSeq >= 0 ? ` (replaying from lastSeq=${this.lastSeq})` : ""}.`), this.lastKnownSessionId = this.sessionId, (F = this.onOpen) == null || F.call(this), this.flushPendingAnswers(this.sessionId), s(this.sessionId);
|
|
1541
1545
|
});
|
|
@@ -1577,7 +1581,7 @@ const de = 5e3, fe = 3e4, Y = 1e4, lt = class lt {
|
|
|
1577
1581
|
case "Event":
|
|
1578
1582
|
break;
|
|
1579
1583
|
case "InteractionStarted": {
|
|
1580
|
-
const r =
|
|
1584
|
+
const r = Rt(t);
|
|
1581
1585
|
r ? (n = this.onInteractionStarted) == null || n.call(this, r) : console.warn("[WebSocket] InteractionStarted frame without an interaction id");
|
|
1582
1586
|
break;
|
|
1583
1587
|
}
|
|
@@ -1590,7 +1594,7 @@ const de = 5e3, fe = 3e4, Y = 1e4, lt = class lt {
|
|
|
1590
1594
|
console.warn("[WebSocket] Unknown message type:", t.type);
|
|
1591
1595
|
}
|
|
1592
1596
|
const s = st(t);
|
|
1593
|
-
return s ? (
|
|
1597
|
+
return s ? ($t(s) && this.emitFirstToken(s.interactionId), this.handleEvent(s, e), s) : null;
|
|
1594
1598
|
}
|
|
1595
1599
|
emitFirstToken(t) {
|
|
1596
1600
|
var e;
|
|
@@ -1711,7 +1715,7 @@ const de = 5e3, fe = 3e4, Y = 1e4, lt = class lt {
|
|
|
1711
1715
|
const e = t - this.pingSentAt;
|
|
1712
1716
|
if (e >= Y) {
|
|
1713
1717
|
this.failSocket(
|
|
1714
|
-
|
|
1718
|
+
ne,
|
|
1715
1719
|
`No frame received for ${Math.round(e / 1e3)}s after a Ping`
|
|
1716
1720
|
);
|
|
1717
1721
|
return;
|
|
@@ -1719,11 +1723,11 @@ const de = 5e3, fe = 3e4, Y = 1e4, lt = class lt {
|
|
|
1719
1723
|
console.warn(`[WebSocket] Still no reply ${e}ms after the Ping (budget ${Y}ms, session ${this.sessionLabel}) — the peer may be gone.`);
|
|
1720
1724
|
return;
|
|
1721
1725
|
}
|
|
1722
|
-
t - this.lastActivity >=
|
|
1726
|
+
t - this.lastActivity >= pe && this.ping();
|
|
1723
1727
|
} catch (t) {
|
|
1724
1728
|
console.error("Error on monitor", t);
|
|
1725
1729
|
}
|
|
1726
|
-
},
|
|
1730
|
+
}, ge);
|
|
1727
1731
|
}
|
|
1728
1732
|
/**
|
|
1729
1733
|
* Send a heartbeat ping and start the reply clock (unless one is already running).
|
|
@@ -1769,7 +1773,7 @@ const de = 5e3, fe = 3e4, Y = 1e4, lt = class lt {
|
|
|
1769
1773
|
* Disconnect the WebSocket
|
|
1770
1774
|
*/
|
|
1771
1775
|
disconnect() {
|
|
1772
|
-
console.log(`[WebSocket] disconnect() (session ${this.sessionLabel})`), this.monitorInterval && (clearInterval(this.monitorInterval), this.monitorInterval = null), this.pingSentAt = null, this.firstTokenInteractions.clear(), this.lastKnownSessionId = void 0, this.lastSeq = -1, this.ws && (this.ws.close(
|
|
1776
|
+
console.log(`[WebSocket] disconnect() (session ${this.sessionLabel})`), this.monitorInterval && (clearInterval(this.monitorInterval), this.monitorInterval = null), this.pingSentAt = null, this.firstTokenInteractions.clear(), this.lastKnownSessionId = void 0, this.lastSeq = -1, this.ws && (this.ws.close(kt, "Intentional disconnect"), this.ws = null);
|
|
1773
1777
|
}
|
|
1774
1778
|
/**
|
|
1775
1779
|
* Check if connected
|
|
@@ -1778,26 +1782,42 @@ const de = 5e3, fe = 3e4, Y = 1e4, lt = class lt {
|
|
|
1778
1782
|
return this.ws !== null && this.ws.readyState === WebSocket.OPEN;
|
|
1779
1783
|
}
|
|
1780
1784
|
async handleEvent(t, e) {
|
|
1781
|
-
var
|
|
1785
|
+
var n, r, a, c;
|
|
1786
|
+
const s = (r = (n = t.content) == null ? void 0 : n.items) == null ? void 0 : r.find((l) => l instanceof xt);
|
|
1787
|
+
if (s) {
|
|
1788
|
+
(a = this.onBillingLimit) == null || a.call(this, {
|
|
1789
|
+
plan: s.plan ?? "team",
|
|
1790
|
+
state: s.state ?? "ok",
|
|
1791
|
+
used: s.used ?? 0,
|
|
1792
|
+
included: s.included ?? 0,
|
|
1793
|
+
limitReached: s.limitReached ?? !1,
|
|
1794
|
+
canManage: s.canManage ?? !1,
|
|
1795
|
+
title: s.title,
|
|
1796
|
+
message: s.message,
|
|
1797
|
+
actionUrl: s.actionUrl,
|
|
1798
|
+
interactionId: t.interactionId || void 0
|
|
1799
|
+
});
|
|
1800
|
+
return;
|
|
1801
|
+
}
|
|
1782
1802
|
try {
|
|
1783
|
-
const
|
|
1784
|
-
if (!
|
|
1803
|
+
const l = x.parseFromTypedEvent(t);
|
|
1804
|
+
if (!l)
|
|
1785
1805
|
throw "Server event was null";
|
|
1786
1806
|
this.statsTracker.record({
|
|
1787
1807
|
rawLength: e.length,
|
|
1788
|
-
textLength: ((
|
|
1789
|
-
sessionInformation:
|
|
1790
|
-
fromDetachedRun: !!
|
|
1791
|
-
}), this.onEvent && this.onEvent(
|
|
1792
|
-
console.error("Lost error on on-event",
|
|
1808
|
+
textLength: ((c = t.text) == null ? void 0 : c.length) ?? 0,
|
|
1809
|
+
sessionInformation: l.session_information,
|
|
1810
|
+
fromDetachedRun: !!l.detachedRunId
|
|
1811
|
+
}), this.onEvent && this.onEvent(l).catch((f) => {
|
|
1812
|
+
console.error("Lost error on on-event", f);
|
|
1793
1813
|
});
|
|
1794
|
-
} catch (
|
|
1795
|
-
console.error("handleEvent error",
|
|
1814
|
+
} catch (l) {
|
|
1815
|
+
console.error("handleEvent error", l);
|
|
1796
1816
|
}
|
|
1797
1817
|
}
|
|
1798
1818
|
};
|
|
1799
1819
|
h(lt, "WebSocketConnecionV2");
|
|
1800
|
-
let
|
|
1820
|
+
let Ct = lt;
|
|
1801
1821
|
const ht = class ht {
|
|
1802
1822
|
constructor(t, e) {
|
|
1803
1823
|
o(this, "cache", /* @__PURE__ */ new Map());
|
|
@@ -1806,7 +1826,7 @@ const ht = class ht {
|
|
|
1806
1826
|
this.serverBaseUrl = t.replace(/\/$/, ""), this.accessToken = e;
|
|
1807
1827
|
}
|
|
1808
1828
|
get headers() {
|
|
1809
|
-
return { Authorization: `Bearer ${
|
|
1829
|
+
return { Authorization: `Bearer ${zt(this.accessToken)}` };
|
|
1810
1830
|
}
|
|
1811
1831
|
async init() {
|
|
1812
1832
|
}
|
|
@@ -1854,7 +1874,7 @@ const ht = class ht {
|
|
|
1854
1874
|
}
|
|
1855
1875
|
};
|
|
1856
1876
|
h(ht, "HttpArtifactService");
|
|
1857
|
-
let
|
|
1877
|
+
let Mt = ht;
|
|
1858
1878
|
const ut = class ut extends Error {
|
|
1859
1879
|
constructor(t, e) {
|
|
1860
1880
|
super(e ?? `GET detached-run frames answered ${t}`), this.status = t, this.name = "DetachedRunFramesHttpError";
|
|
@@ -1862,15 +1882,15 @@ const ut = class ut extends Error {
|
|
|
1862
1882
|
};
|
|
1863
1883
|
h(ut, "DetachedRunFramesHttpError");
|
|
1864
1884
|
let L = ut;
|
|
1865
|
-
function
|
|
1885
|
+
function me(i) {
|
|
1866
1886
|
if (i instanceof L) {
|
|
1867
1887
|
const { status: t } = i;
|
|
1868
1888
|
return { kind: t === 401 ? "unauthorized" : t === 403 ? "forbidden" : t === 404 || t === 410 ? "notFound" : "gaveUp", status: t, cause: i };
|
|
1869
1889
|
}
|
|
1870
1890
|
return { kind: "gaveUp", cause: i };
|
|
1871
1891
|
}
|
|
1872
|
-
h(
|
|
1873
|
-
function
|
|
1892
|
+
h(me, "toDetachedRunFollowError");
|
|
1893
|
+
function we(i) {
|
|
1874
1894
|
let t = "", e = [], s, n;
|
|
1875
1895
|
const r = /* @__PURE__ */ h(() => {
|
|
1876
1896
|
(e.length > 0 || s !== void 0) && i({ event: s, data: e.join(`
|
|
@@ -1901,12 +1921,12 @@ function pe(i) {
|
|
|
1901
1921
|
}
|
|
1902
1922
|
};
|
|
1903
1923
|
}
|
|
1904
|
-
h(
|
|
1905
|
-
function
|
|
1924
|
+
h(we, "createSseParser");
|
|
1925
|
+
function Se(i) {
|
|
1906
1926
|
return i >= 500 || i === 408 || i === 429;
|
|
1907
1927
|
}
|
|
1908
|
-
h(
|
|
1909
|
-
function
|
|
1928
|
+
h(Se, "retryable");
|
|
1929
|
+
function Ie(i, t) {
|
|
1910
1930
|
return new Promise((e) => {
|
|
1911
1931
|
if (t != null && t.aborted) return e();
|
|
1912
1932
|
const s = setTimeout(n, i);
|
|
@@ -1916,15 +1936,16 @@ function we(i, t) {
|
|
|
1916
1936
|
h(n, "done"), t == null || t.addEventListener("abort", n, { once: !0 });
|
|
1917
1937
|
});
|
|
1918
1938
|
}
|
|
1919
|
-
h(
|
|
1920
|
-
function
|
|
1921
|
-
|
|
1939
|
+
h(Ie, "sleep");
|
|
1940
|
+
function Te(i, t, e, s) {
|
|
1941
|
+
const n = t === "session" ? "sessions" : "detached-runs";
|
|
1942
|
+
return `${i.replace(/\/+$/, "")}/${n}/${encodeURIComponent(e)}/frames?afterSeq=${s}`;
|
|
1922
1943
|
}
|
|
1923
|
-
h(
|
|
1924
|
-
async function
|
|
1925
|
-
var
|
|
1926
|
-
const { baseUrl: t, runId: e, signal: s, onFrame: n, onEnd: r, onOpen: a, onRetry: c } = i, l = i.fetchImpl ?? ((A, $) => fetch(A, $)),
|
|
1927
|
-
let
|
|
1944
|
+
h(Te, "framesUrl");
|
|
1945
|
+
async function ye(i) {
|
|
1946
|
+
var F, v, C, ft, gt;
|
|
1947
|
+
const { baseUrl: t, runId: e, signal: s, onFrame: n, onEnd: r, onOpen: a, onRetry: c } = i, l = i.resource ?? "detachedRun", f = i.fetchImpl ?? ((A, $) => fetch(A, $)), p = ((F = i.retry) == null ? void 0 : F.initialMs) ?? 500, m = ((v = i.retry) == null ? void 0 : v.maxMs) ?? 15e3, u = ((C = i.retry) == null ? void 0 : C.maxAttempts) ?? Number.POSITIVE_INFINITY;
|
|
1948
|
+
let g = i.afterSeq ?? 0, w = 0, M = !1;
|
|
1928
1949
|
async function D(A) {
|
|
1929
1950
|
if (i.onUnauthorized)
|
|
1930
1951
|
try {
|
|
@@ -1939,77 +1960,77 @@ async function Ie(i) {
|
|
|
1939
1960
|
for (h(D, "secondChance"); !(s != null && s.aborted); ) {
|
|
1940
1961
|
let A;
|
|
1941
1962
|
try {
|
|
1942
|
-
const O = { Accept: "text/event-stream" }, K = await ((
|
|
1963
|
+
const O = { Accept: "text/event-stream" }, K = await ((ft = i.getToken) == null ? void 0 : ft.call(i)) ?? void 0;
|
|
1943
1964
|
K && (O.Authorization = `Bearer ${K}`);
|
|
1944
|
-
const k = await
|
|
1965
|
+
const k = await f(Te(t, l, e, g), { method: "GET", headers: O, signal: s, cache: "no-store" });
|
|
1945
1966
|
if (k.status === 401) {
|
|
1946
|
-
if (!
|
|
1947
|
-
|
|
1967
|
+
if (!M && await D(K)) {
|
|
1968
|
+
M = !0;
|
|
1948
1969
|
continue;
|
|
1949
1970
|
}
|
|
1950
1971
|
throw new L(401);
|
|
1951
1972
|
}
|
|
1952
|
-
if (
|
|
1953
|
-
throw
|
|
1973
|
+
if (M = !1, !k.ok)
|
|
1974
|
+
throw Se(k.status) ? new Error(`GET detached-run frames answered ${k.status}`) : new L(k.status);
|
|
1954
1975
|
if (!k.body) throw new L(k.status, "The frames response has no readable body");
|
|
1955
1976
|
a == null || a();
|
|
1956
1977
|
let W = !1;
|
|
1957
|
-
const
|
|
1978
|
+
const B = we((T) => {
|
|
1958
1979
|
if (T.event === "end") {
|
|
1959
1980
|
const b = Number(T.data);
|
|
1960
|
-
T.data !== "" && Number.isFinite(b) && b >
|
|
1981
|
+
T.data !== "" && Number.isFinite(b) && b > g && (g = b), W = !0;
|
|
1961
1982
|
return;
|
|
1962
1983
|
}
|
|
1963
1984
|
if (T.event !== void 0 && T.event !== "message" || T.data === "") return;
|
|
1964
1985
|
const R = T.id !== void 0 && T.id !== "" ? Number(T.id) : void 0;
|
|
1965
1986
|
if (R !== void 0 && Number.isFinite(R)) {
|
|
1966
|
-
if (R <=
|
|
1967
|
-
|
|
1987
|
+
if (R <= g) return;
|
|
1988
|
+
g = R;
|
|
1968
1989
|
}
|
|
1969
1990
|
W = !1;
|
|
1970
|
-
let
|
|
1991
|
+
let mt;
|
|
1971
1992
|
try {
|
|
1972
|
-
|
|
1993
|
+
mt = JSON.parse(T.data);
|
|
1973
1994
|
} catch (b) {
|
|
1974
1995
|
console.warn(`[DetachedRunFrames] run ${e}: a frame that is not JSON was skipped (seq ${T.id ?? "?"})`, b);
|
|
1975
1996
|
return;
|
|
1976
1997
|
}
|
|
1977
|
-
|
|
1998
|
+
w = 0;
|
|
1978
1999
|
try {
|
|
1979
|
-
n(
|
|
2000
|
+
n(mt, R);
|
|
1980
2001
|
} catch (b) {
|
|
1981
2002
|
console.error(`[DetachedRunFrames] run ${e}: onFrame threw on seq ${T.id ?? "?"}`, b);
|
|
1982
2003
|
}
|
|
1983
|
-
}),
|
|
2004
|
+
}), G = k.body.getReader(), pt = new TextDecoder();
|
|
1984
2005
|
try {
|
|
1985
2006
|
for (; ; ) {
|
|
1986
|
-
const { done: T, value: R } = await
|
|
2007
|
+
const { done: T, value: R } = await G.read();
|
|
1987
2008
|
if (T) break;
|
|
1988
|
-
|
|
2009
|
+
B.push(pt.decode(R, { stream: !0 }));
|
|
1989
2010
|
}
|
|
1990
|
-
|
|
2011
|
+
B.push(pt.decode()), B.idle() || (W = !1), B.flush();
|
|
1991
2012
|
} finally {
|
|
1992
|
-
(
|
|
2013
|
+
(gt = G.releaseLock) == null || gt.call(G);
|
|
1993
2014
|
}
|
|
1994
|
-
if (W)
|
|
1995
|
-
return r == null || r(
|
|
1996
|
-
A = new Error("The frames stream closed before its end event");
|
|
2015
|
+
if (W && l !== "session")
|
|
2016
|
+
return r == null || r(g), { reason: "end", lastSeq: g };
|
|
2017
|
+
A = new Error(l === "session" ? "The session frames stream closed" : "The frames stream closed before its end event");
|
|
1997
2018
|
} catch (O) {
|
|
1998
2019
|
if (s != null && s.aborted) break;
|
|
1999
2020
|
if (O instanceof L) throw O;
|
|
2000
2021
|
A = O;
|
|
2001
2022
|
}
|
|
2002
|
-
if (
|
|
2003
|
-
const $ = Math.min(
|
|
2023
|
+
if (w += 1, w >= u) throw A;
|
|
2024
|
+
const $ = Math.min(p * 2 ** (w - 1), m);
|
|
2004
2025
|
try {
|
|
2005
|
-
c == null || c(A,
|
|
2026
|
+
c == null || c(A, w, $);
|
|
2006
2027
|
} catch {
|
|
2007
2028
|
}
|
|
2008
|
-
await
|
|
2029
|
+
await Ie($, s);
|
|
2009
2030
|
}
|
|
2010
|
-
return { reason: "aborted", lastSeq:
|
|
2031
|
+
return { reason: "aborted", lastSeq: g };
|
|
2011
2032
|
}
|
|
2012
|
-
h(
|
|
2033
|
+
h(ye, "streamDetachedRunFrames");
|
|
2013
2034
|
const dt = class dt {
|
|
2014
2035
|
constructor(t) {
|
|
2015
2036
|
o(this, "onEvent");
|
|
@@ -2042,7 +2063,8 @@ const dt = class dt {
|
|
|
2042
2063
|
return this.following;
|
|
2043
2064
|
}
|
|
2044
2065
|
connect(t, e) {
|
|
2045
|
-
|
|
2066
|
+
var s, n;
|
|
2067
|
+
return t ? ((t !== this.runId || !(e != null && e.resume)) && (this.lastSeq = ((n = (s = this.options).initialAfterSeq) == null ? void 0 : n.call(s)) ?? 0, this.firstTokens.clear()), this.runId = t, this.start(t)) : Promise.reject(new Error("DetachedRunFramesTransport: connect() needs the run id"));
|
|
2046
2068
|
}
|
|
2047
2069
|
/**
|
|
2048
2070
|
* Follow again from the last seq — after the stream ended and the run was resumed (answered). A no-op while a
|
|
@@ -2057,7 +2079,7 @@ const dt = class dt {
|
|
|
2057
2079
|
const e = new AbortController();
|
|
2058
2080
|
return this.controller = e, this.following = !0, new Promise((n, r) => {
|
|
2059
2081
|
let a = !1;
|
|
2060
|
-
|
|
2082
|
+
ye({
|
|
2061
2083
|
...this.options,
|
|
2062
2084
|
runId: t,
|
|
2063
2085
|
afterSeq: this.lastSeq,
|
|
@@ -2080,7 +2102,7 @@ const dt = class dt {
|
|
|
2080
2102
|
a || r(new Error("The frames stream stopped before it opened"));
|
|
2081
2103
|
}).catch((c) => {
|
|
2082
2104
|
var p, m, u;
|
|
2083
|
-
const l =
|
|
2105
|
+
const l = me(c), f = l.kind === "notFound" ? Dt : l.kind === "forbidden" || l.kind === "unauthorized" ? 1008 : 1011;
|
|
2084
2106
|
console.error(`[DetachedRunFrames] run ${t}: following stopped (${l.kind})`, c);
|
|
2085
2107
|
try {
|
|
2086
2108
|
(p = this.onFollowError) == null || p.call(this, l);
|
|
@@ -2104,14 +2126,14 @@ const dt = class dt {
|
|
|
2104
2126
|
return;
|
|
2105
2127
|
}
|
|
2106
2128
|
if (!e) return;
|
|
2107
|
-
const s =
|
|
2129
|
+
const s = Rt(e);
|
|
2108
2130
|
if (s) {
|
|
2109
2131
|
(r = this.onInteractionStarted) == null || r.call(this, s);
|
|
2110
2132
|
return;
|
|
2111
2133
|
}
|
|
2112
2134
|
const n = st(e);
|
|
2113
2135
|
if (n) {
|
|
2114
|
-
|
|
2136
|
+
$t(n) && n.interactionId && !this.firstTokens.has(n.interactionId) && (this.firstTokens.add(n.interactionId), (a = this.onFirstToken) == null || a.call(this, n.interactionId));
|
|
2115
2137
|
try {
|
|
2116
2138
|
const l = x.parseFromTypedEvent(n);
|
|
2117
2139
|
(c = this.onEvent) == null || c.call(this, l).catch((f) => console.error("[DetachedRunFrames] onEvent failed", f));
|
|
@@ -2134,9 +2156,9 @@ const dt = class dt {
|
|
|
2134
2156
|
}
|
|
2135
2157
|
};
|
|
2136
2158
|
h(dt, "DetachedRunFramesTransport");
|
|
2137
|
-
let
|
|
2138
|
-
const
|
|
2139
|
-
function
|
|
2159
|
+
let At = dt;
|
|
2160
|
+
const ve = "todolistUpdated";
|
|
2161
|
+
function be(i, t = et()) {
|
|
2140
2162
|
var n, r;
|
|
2141
2163
|
let e;
|
|
2142
2164
|
try {
|
|
@@ -2148,14 +2170,14 @@ function $e(i, t = et()) {
|
|
|
2148
2170
|
if (!e) return [];
|
|
2149
2171
|
const s = [];
|
|
2150
2172
|
for (const a of e.parts ?? [])
|
|
2151
|
-
if (a.eventType === I.ToolEvent && ((n = a.toolDetails) == null ? void 0 : n.eventName) ===
|
|
2152
|
-
const c =
|
|
2173
|
+
if (a.eventType === I.ToolEvent && ((n = a.toolDetails) == null ? void 0 : n.eventName) === ve) {
|
|
2174
|
+
const c = Ee(a.toolDetails.eventData);
|
|
2153
2175
|
c && s.push({ kind: "todo", todoList: c });
|
|
2154
2176
|
} else (a.eventType === I.FunctionCall || a.eventType === I.PartialFunctionCall) && ((r = a.functionDetails) != null && r.name) ? s.push({ kind: "tool", name: a.functionDetails.name, interactionId: e.interactionId }) : a.eventType === I.Text && a.text && s.push({ kind: "text", text: a.text, partial: !!e.partial, interactionId: e.interactionId });
|
|
2155
2177
|
return s;
|
|
2156
2178
|
}
|
|
2157
|
-
h(
|
|
2158
|
-
function
|
|
2179
|
+
h(be, "readDetachedRunActivity");
|
|
2180
|
+
function Ee(i) {
|
|
2159
2181
|
if (!i) return null;
|
|
2160
2182
|
try {
|
|
2161
2183
|
const t = JSON.parse(i);
|
|
@@ -2164,26 +2186,26 @@ function ye(i) {
|
|
|
2164
2186
|
return null;
|
|
2165
2187
|
}
|
|
2166
2188
|
}
|
|
2167
|
-
h(
|
|
2189
|
+
h(Ee, "parseTodoList");
|
|
2168
2190
|
export {
|
|
2169
|
-
|
|
2191
|
+
yt as A,
|
|
2170
2192
|
V as C,
|
|
2171
2193
|
L as D,
|
|
2172
|
-
|
|
2173
|
-
|
|
2194
|
+
Tt as E,
|
|
2195
|
+
Mt as H,
|
|
2174
2196
|
_ as I,
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2197
|
+
It as L,
|
|
2198
|
+
Jt as M,
|
|
2199
|
+
ve as T,
|
|
2200
|
+
ae as W,
|
|
2201
|
+
At as a,
|
|
2180
2202
|
j as b,
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2203
|
+
Ct as c,
|
|
2204
|
+
we as d,
|
|
2205
|
+
ee as e,
|
|
2206
|
+
be as r,
|
|
2207
|
+
ye as s,
|
|
2208
|
+
me as t,
|
|
2209
|
+
Re as u
|
|
2188
2210
|
};
|
|
2189
|
-
//# sourceMappingURL=detachedRunActivity-
|
|
2211
|
+
//# sourceMappingURL=detachedRunActivity-jHa9SDv1.js.map
|