@pluno/product-agent-web 0.1.217 → 0.1.218
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/product-agent-runtime.cjs +1 -1
- package/dist/product-agent-runtime.js +165 -167
- package/dist/product-agent-sdk.js +69 -68
- package/dist/product-agent-widget.js +11 -10
- package/package.json +1 -1
|
@@ -344,7 +344,7 @@ function bn(t, e, s) {
|
|
|
344
344
|
for (const h of t) {
|
|
345
345
|
const p = s(h);
|
|
346
346
|
let m = o.get(p.id);
|
|
347
|
-
if (p.isOptimistic && p.optimisticKey ? m = a.get(p.optimisticKey) : p.isAssistantDraft && p.assistantDraftKey ? m = l.get(p.assistantDraftKey) : p.isActivity && (m = p.activityKeys?.map((
|
|
347
|
+
if (p.isOptimistic && p.optimisticKey ? m = a.get(p.optimisticKey) : p.isAssistantDraft && p.assistantDraftKey ? m = l.get(p.assistantDraftKey) : p.isActivity && (m = p.activityKeys?.map((k) => c.get(k)).find((k) => k !== void 0) ?? m), m && !f.has(m)) {
|
|
348
348
|
g.push(m), f.add(m);
|
|
349
349
|
continue;
|
|
350
350
|
}
|
|
@@ -361,7 +361,7 @@ function Ht(t, e, s, n) {
|
|
|
361
361
|
return !r.isActivity || !r.isTransient ? !0 : e !== null && r.respondsToUserMessageId !== void 0 ? r.respondsToUserMessageId !== e : s === null || r.runId !== s;
|
|
362
362
|
});
|
|
363
363
|
}
|
|
364
|
-
const Je = "pluno.productAgent.transportId", vn = "pluno.productAgent.transportIdentity", Xe = "pluno.productAgent.transportIdentity.event",
|
|
364
|
+
const Je = "pluno.productAgent.transportId", vn = "pluno.productAgent.transportIdentity", Xe = "pluno.productAgent.transportIdentity.event", kn = 50, En = globalThis.setTimeout.bind(globalThis);
|
|
365
365
|
let de = null;
|
|
366
366
|
const Ce = /* @__PURE__ */ new Set(), Ye = /* @__PURE__ */ new Map();
|
|
367
367
|
async function Cn(t = bs()) {
|
|
@@ -434,7 +434,7 @@ function bs() {
|
|
|
434
434
|
storage: Dn(),
|
|
435
435
|
channel: Un(),
|
|
436
436
|
randomUUID: () => crypto.randomUUID(),
|
|
437
|
-
settle: () => new Promise((t) =>
|
|
437
|
+
settle: () => new Promise((t) => En(t, kn))
|
|
438
438
|
};
|
|
439
439
|
}
|
|
440
440
|
function Dn() {
|
|
@@ -521,24 +521,24 @@ const xn = [
|
|
|
521
521
|
function Bt(t, e) {
|
|
522
522
|
return t.filter((s, n) => {
|
|
523
523
|
const i = Ft(s);
|
|
524
|
-
return
|
|
524
|
+
return ks(i) ? !t.slice(n + 1).some((r) => {
|
|
525
525
|
const o = Ft(r);
|
|
526
|
-
return
|
|
526
|
+
return Es(i, o) && Cs(i, o);
|
|
527
527
|
}) : !0;
|
|
528
528
|
});
|
|
529
529
|
}
|
|
530
|
-
function
|
|
530
|
+
function ks(t) {
|
|
531
531
|
return t.type === "run_status" && t.status === "stopped" && t.reason === "task_tab_closed";
|
|
532
532
|
}
|
|
533
533
|
function Hn(t, e) {
|
|
534
|
-
return t.reason === "task_tab_closed" && Cs(t, e) &&
|
|
534
|
+
return t.reason === "task_tab_closed" && Cs(t, e) && Es(t, e);
|
|
535
535
|
}
|
|
536
536
|
function Ft(t) {
|
|
537
537
|
return t.data && typeof t.data == "object" ? t.data : {};
|
|
538
538
|
}
|
|
539
|
-
function
|
|
539
|
+
function Es(t, e) {
|
|
540
540
|
const s = typeof t.runId == "string" ? t.runId : null, n = typeof e.runId == "string" ? e.runId : null;
|
|
541
|
-
return s && n && s === n ? !1 : e.type === "message" ? e.role === "assistant" : e.type === "run_status" ? !
|
|
541
|
+
return s && n && s === n ? !1 : e.type === "message" ? e.role === "assistant" : e.type === "run_status" ? !ks(e) : e.type === "run_error";
|
|
542
542
|
}
|
|
543
543
|
function Cs(t, e) {
|
|
544
544
|
return typeof t.respondsToUserMessageId == "string" && typeof e.respondsToUserMessageId == "string" ? t.respondsToUserMessageId === e.respondsToUserMessageId : typeof t.clientMessageId == "string" && typeof e.clientMessageId == "string" ? t.clientMessageId === e.clientMessageId : typeof t.runId == "string" && typeof e.runId == "string" && t.runId === e.runId;
|
|
@@ -956,10 +956,8 @@ class Kn {
|
|
|
956
956
|
return i !== void 0 ? i : (this.scheduledEligibility.set(n, s), s);
|
|
957
957
|
}
|
|
958
958
|
getNextEligibilityAt(e = Date.now()) {
|
|
959
|
-
for (const [n, i] of this.scheduledEligibility)
|
|
960
|
-
i <= e && this.scheduledEligibility.delete(n);
|
|
961
959
|
const s = [
|
|
962
|
-
...this.scheduledEligibility.values(),
|
|
960
|
+
...Array.from(this.scheduledEligibility.values()).filter((n) => n > e),
|
|
963
961
|
...Array.from(this.decisions.values()).map((n) => n.nextEligibleAt ? Date.parse(n.nextEligibleAt) : Number.NaN).filter((n) => Number.isFinite(n) && n > e)
|
|
964
962
|
];
|
|
965
963
|
return s.length > 0 ? Math.min(...s) : null;
|
|
@@ -1619,7 +1617,7 @@ const li = "https://app.pluno.ai", ci = 2e4, ui = 1e4, di = 6e4, hi = 6e4, pi =
|
|
|
1619
1617
|
".pdf:application/pdf",
|
|
1620
1618
|
".png:image/png",
|
|
1621
1619
|
".webp:image/webp"
|
|
1622
|
-
]), Qo = ".pdf,.png,.jpg,.jpeg,.webp", vt = 64e3, nt = 4e3,
|
|
1620
|
+
]), Qo = ".pdf,.png,.jpg,.jpeg,.webp", vt = 64e3, nt = 4e3, kt = 30, ki = 2e3, Ei = 1e3, Us = "Image is too large for model vision input.", Ci = 100, Pi = 20, qs = "pluno.productAgent.state.", pt = "pluno.productAgent.pendingEvents.", Os = "pluno.productAgent.pendingDeliveryRecovery.", Fe = "pluno.productAgent.activeToolCalls.", _i = 100;
|
|
1623
1621
|
function Di(t, e = 0) {
|
|
1624
1622
|
const s = t === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (t - 1));
|
|
1625
1623
|
return Math.max(e, s);
|
|
@@ -1747,7 +1745,7 @@ class We {
|
|
|
1747
1745
|
r.missedResponseChecks
|
|
1748
1746
|
));
|
|
1749
1747
|
} else
|
|
1750
|
-
|
|
1748
|
+
ke(e.clientId, null);
|
|
1751
1749
|
F(e.clientId, this.queuedClientEvents);
|
|
1752
1750
|
}
|
|
1753
1751
|
options;
|
|
@@ -2146,7 +2144,7 @@ class We {
|
|
|
2146
2144
|
content: n,
|
|
2147
2145
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2148
2146
|
...i.length > 0 ? { attachments: i } : {}
|
|
2149
|
-
}, f = this.state.messages.some((I) => I.id === d.id || I.clientMessageId === a), g = this.state.isThinking, h = this.state.taskStatus, p = this.state.pendingMessageStatus, m = this.state.turnPhase, y = this.state.messages,
|
|
2147
|
+
}, f = this.state.messages.some((I) => I.id === d.id || I.clientMessageId === a), g = this.state.isThinking, h = this.state.taskStatus, p = this.state.pendingMessageStatus, m = this.state.turnPhase, y = this.state.messages, k = f ? this.state.messages : [
|
|
2150
2148
|
...this.state.messages.map(
|
|
2151
2149
|
(I) => c && I.id === c.id ? {
|
|
2152
2150
|
...I,
|
|
@@ -2164,7 +2162,7 @@ class We {
|
|
|
2164
2162
|
lastError: this.state.lastError
|
|
2165
2163
|
};
|
|
2166
2164
|
this.setState({
|
|
2167
|
-
messages:
|
|
2165
|
+
messages: k,
|
|
2168
2166
|
...g ? {} : {
|
|
2169
2167
|
assistantDraft: "",
|
|
2170
2168
|
assistantDraftItemId: null,
|
|
@@ -2222,7 +2220,7 @@ class We {
|
|
|
2222
2220
|
entrySurface: this.options.entrySurface,
|
|
2223
2221
|
content: n,
|
|
2224
2222
|
proactiveSuggestionQuestion: s.proactiveSuggestionQuestion,
|
|
2225
|
-
pageContent: O &&
|
|
2223
|
+
pageContent: O && Et() || void 0,
|
|
2226
2224
|
attachments: r.length > 0 ? r.map(Ne) : void 0,
|
|
2227
2225
|
page: o,
|
|
2228
2226
|
model: this.options.model,
|
|
@@ -2326,16 +2324,16 @@ class We {
|
|
|
2326
2324
|
};
|
|
2327
2325
|
let o;
|
|
2328
2326
|
if (this.options.persistAttachmentUpload)
|
|
2329
|
-
o = await
|
|
2327
|
+
o = await Ee(
|
|
2330
2328
|
() => this.options.persistAttachmentUpload(r, e),
|
|
2331
2329
|
"Failed to upload attachment"
|
|
2332
2330
|
);
|
|
2333
2331
|
else {
|
|
2334
|
-
const l = this.options.prepareAttachmentUpload ? await
|
|
2332
|
+
const l = this.options.prepareAttachmentUpload ? await Ee(
|
|
2335
2333
|
() => this.options.prepareAttachmentUpload(r),
|
|
2336
2334
|
"Failed to prepare attachment upload"
|
|
2337
2335
|
) : await this.prepareEmbedAttachmentUpload(r);
|
|
2338
|
-
await
|
|
2336
|
+
await Ee(async () => {
|
|
2339
2337
|
const c = await fetch(new URL(l.uploadUrl, this.options.backendUrl), {
|
|
2340
2338
|
method: l.uploadMethod,
|
|
2341
2339
|
headers: l.uploadHeaders,
|
|
@@ -2375,7 +2373,7 @@ class We {
|
|
|
2375
2373
|
}
|
|
2376
2374
|
async prepareEmbedAttachmentUpload(e) {
|
|
2377
2375
|
let s = !1;
|
|
2378
|
-
return await
|
|
2376
|
+
return await Ee(async () => {
|
|
2379
2377
|
const n = await this.fetchEmbedAttachmentUpload(e, !1);
|
|
2380
2378
|
if (n.ok)
|
|
2381
2379
|
return await n.json();
|
|
@@ -2450,7 +2448,7 @@ class We {
|
|
|
2450
2448
|
return this.clientRuntime.route("directory", { legacy: () => {
|
|
2451
2449
|
this.stopSessionRecoveryPolling();
|
|
2452
2450
|
const s = e.notifyTransport !== !1, n = this.activeComposerWarmupId;
|
|
2453
|
-
!this.options.keepRunsActiveOnSessionNavigation && s && this.state.sessionId && (this.state.isThinking || this.state.pendingMessageStatus !== null) && this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "new_chat" }), this.rememberCurrentRunAsBackground(), this.rememberCurrentRunAsDetached(), this.clearPendingComposerWarmup(), this.cleanupSessionBrowserApis(), this.queuedClientEvents = this.queuedClientEvents.filter((i) => i.type !== "chat.user_message"), F(this.options.clientId, this.queuedClientEvents),
|
|
2451
|
+
!this.options.keepRunsActiveOnSessionNavigation && s && this.state.sessionId && (this.state.isThinking || this.state.pendingMessageStatus !== null) && this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "new_chat" }), this.rememberCurrentRunAsBackground(), this.rememberCurrentRunAsDetached(), this.clearPendingComposerWarmup(), this.cleanupSessionBrowserApis(), this.queuedClientEvents = this.queuedClientEvents.filter((i) => i.type !== "chat.user_message"), F(this.options.clientId, this.queuedClientEvents), ke(this.options.clientId, null), this.pendingDeliveryIssued = !1, this.queuedDeliveryRetryAttempt = null, this.clearThinkingWatchdog(), this.clearAllFirstResponseTimers(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.retryableClientMessageId = null, this.stagedProactiveSuggestionQuestionMessageId = null, this.lastUserMessagePageUrl = null, this.clearSessionLoadRequest(), this.sessionActivityRequestId = null, this.retryAttemptsByClientMessageId = {}, this.thinkingWatchdogResyncAttemptsByClientMessageId = {}, this.nonTranscriptToolCallIds.clear(), this.options.productVariant === "personal" && (this.personalModelSelectionOverride = null, this.options.model = void 0), s && this.send({
|
|
2454
2452
|
type: "session.reset",
|
|
2455
2453
|
sessionId: this.state.sessionId ?? void 0,
|
|
2456
2454
|
warmupId: n ?? void 0,
|
|
@@ -2969,7 +2967,7 @@ class We {
|
|
|
2969
2967
|
}
|
|
2970
2968
|
}
|
|
2971
2969
|
startFirstResponseTimer(e, s, n = 0) {
|
|
2972
|
-
this.
|
|
2970
|
+
if (this.firstResponseTimersByClientMessageId.has(e)) return;
|
|
2973
2971
|
const i = s ?? Date.now();
|
|
2974
2972
|
this.firstResponseTimersByClientMessageId.set(e, {
|
|
2975
2973
|
submittedAt: i,
|
|
@@ -3000,18 +2998,21 @@ class We {
|
|
|
3000
2998
|
}
|
|
3001
2999
|
reportFirstResponseSlow(e) {
|
|
3002
3000
|
const s = this.firstResponseTimersByClientMessageId.get(e);
|
|
3003
|
-
s && (s.missedResponseChecks = Me, window.clearTimeout(s.timer), this.
|
|
3001
|
+
s && (s.missedResponseChecks = Me, window.clearTimeout(s.timer), this.reportHealthSignal("first_response_slow", {
|
|
3004
3002
|
clientMessageId: e,
|
|
3005
3003
|
durationMs: Date.now() - s.submittedAt,
|
|
3006
3004
|
missedResponseChecks: s.missedResponseChecks,
|
|
3007
3005
|
ackObserved: this.activeClientMessageId === e && this.activeRunAckObserved
|
|
3008
3006
|
}));
|
|
3009
3007
|
}
|
|
3010
|
-
clearFirstResponseTimer(e) {
|
|
3008
|
+
clearFirstResponseTimer(e, s = !1) {
|
|
3011
3009
|
if (!e)
|
|
3012
3010
|
return;
|
|
3013
|
-
const
|
|
3014
|
-
|
|
3011
|
+
const n = this.firstResponseTimersByClientMessageId.get(e);
|
|
3012
|
+
n && (s && this.reportHealthSignal("first_response", {
|
|
3013
|
+
clientMessageId: e,
|
|
3014
|
+
durationMs: Math.max(0, Date.now() - n.submittedAt)
|
|
3015
|
+
}), window.clearTimeout(n.timer), this.firstResponseTimersByClientMessageId.delete(e));
|
|
3015
3016
|
}
|
|
3016
3017
|
clearAllFirstResponseTimers() {
|
|
3017
3018
|
for (const { timer: e } of this.firstResponseTimersByClientMessageId.values())
|
|
@@ -3028,7 +3029,7 @@ class We {
|
|
|
3028
3029
|
if (!e)
|
|
3029
3030
|
return;
|
|
3030
3031
|
const n = ys(this.options.clientId);
|
|
3031
|
-
!s && n?.clientMessageId !== e ||
|
|
3032
|
+
!s && n?.clientMessageId !== e || ke(this.options.clientId, {
|
|
3032
3033
|
clientMessageId: e,
|
|
3033
3034
|
retryAttempts: this.retryAttemptsByClientMessageId[e] ?? 0,
|
|
3034
3035
|
submittedAt: s?.submittedAt ?? n.submittedAt,
|
|
@@ -3040,7 +3041,7 @@ class We {
|
|
|
3040
3041
|
clearPersistedPendingDelivery(e) {
|
|
3041
3042
|
this.queuedClientEvents = this.queuedClientEvents.filter(
|
|
3042
3043
|
(s) => s.type !== "chat.user_message" || s.clientMessageId !== e
|
|
3043
|
-
), F(this.options.clientId, this.queuedClientEvents),
|
|
3044
|
+
), F(this.options.clientId, this.queuedClientEvents), ke(this.options.clientId, null), this.pendingDeliveryIssued = !1, this.queuedDeliveryRetryAttempt = null;
|
|
3044
3045
|
}
|
|
3045
3046
|
/** @internal */
|
|
3046
3047
|
reportTransportDiagnostic(e, s = {}) {
|
|
@@ -3349,7 +3350,7 @@ class We {
|
|
|
3349
3350
|
const s = ts(e), n = this.pendingClientMessageId, i = s ? this.getResponseEvidenceClientMessageId(e) : null, r = s ? this.promotePendingDeliveryFromResponseEvidence(e) : !1;
|
|
3350
3351
|
if (s) {
|
|
3351
3352
|
const o = r ? n : i === this.activeClientMessageId ? this.activeClientMessageId : n === null ? this.activeClientMessageId : null;
|
|
3352
|
-
this.clearFirstResponseTimer(o);
|
|
3353
|
+
this.clearFirstResponseTimer(o, !0);
|
|
3353
3354
|
}
|
|
3354
3355
|
if (e.type === "run.steered") {
|
|
3355
3356
|
this.handleRunSteered(e);
|
|
@@ -3426,8 +3427,8 @@ class We {
|
|
|
3426
3427
|
clientMessageId: p?.clientMessageId,
|
|
3427
3428
|
respondsToUserMessageId: w(h, "id"),
|
|
3428
3429
|
runId: p?.runId
|
|
3429
|
-
}), y = this.filterStoppedSnapshotItems(a, c),
|
|
3430
|
-
|
|
3430
|
+
}), y = this.filterStoppedSnapshotItems(a, c), k = e.pendingMessageStatus === "sending" ? "sending" : e.pendingMessageStatus === "queued" ? "reconnecting" : null, A = typeof e.pendingClientMessageId == "string" ? e.pendingClientMessageId : null, O = e.isRetrying === !0, C = e.turnPhase === "sending" || e.turnPhase === "starting" || e.turnPhase === "thinking" ? e.turnPhase : null;
|
|
3431
|
+
k && A && (this.pendingClientMessageId = A);
|
|
3431
3432
|
let I = Pr(
|
|
3432
3433
|
e.assistantDraft
|
|
3433
3434
|
);
|
|
@@ -3468,7 +3469,7 @@ class We {
|
|
|
3468
3469
|
)
|
|
3469
3470
|
} : {},
|
|
3470
3471
|
isLoadingSession: !1,
|
|
3471
|
-
...
|
|
3472
|
+
...k ? { pendingMessageStatus: k } : {},
|
|
3472
3473
|
...C ? { turnPhase: C } : {},
|
|
3473
3474
|
isRetrying: O,
|
|
3474
3475
|
...C ? { taskStatus: "working" } : {},
|
|
@@ -4525,11 +4526,11 @@ function Ni() {
|
|
|
4525
4526
|
throw y;
|
|
4526
4527
|
}
|
|
4527
4528
|
try {
|
|
4528
|
-
const y = g instanceof Request ? g : null,
|
|
4529
|
-
if (!ne(
|
|
4529
|
+
const y = g instanceof Request ? g : null, k = wo(g, y), A = Qs(h?.headers ?? y?.headers);
|
|
4530
|
+
if (!ne(k, A, h?.body)) {
|
|
4530
4531
|
const C = {
|
|
4531
4532
|
requestId: lt("fetch"),
|
|
4532
|
-
url: j(
|
|
4533
|
+
url: j(k, nt),
|
|
4533
4534
|
method: (h?.method ?? y?.method ?? "GET").toUpperCase(),
|
|
4534
4535
|
requestHeaders: A,
|
|
4535
4536
|
requestBody: Ts(h?.body),
|
|
@@ -4559,7 +4560,7 @@ function Ni() {
|
|
|
4559
4560
|
}
|
|
4560
4561
|
return m;
|
|
4561
4562
|
}, a = function(g, h, p, m, y) {
|
|
4562
|
-
const
|
|
4563
|
+
const k = n.call(this, g, h, p ?? !0, m ?? void 0, y ?? void 0), A = typeof h == "string" ? h : h.toString();
|
|
4563
4564
|
return it.set(this, {
|
|
4564
4565
|
requestId: lt("xhr"),
|
|
4565
4566
|
method: String(g ?? "GET").toUpperCase(),
|
|
@@ -4568,10 +4569,10 @@ function Ni() {
|
|
|
4568
4569
|
startedAtMs: Date.now(),
|
|
4569
4570
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4570
4571
|
excluded: ne(A)
|
|
4571
|
-
}),
|
|
4572
|
+
}), k;
|
|
4572
4573
|
}, l = function(g, h) {
|
|
4573
4574
|
const p = i.call(this, g, h), m = it.get(this);
|
|
4574
|
-
return m && Object.keys(m.requestHeaders).length <
|
|
4575
|
+
return m && Object.keys(m.requestHeaders).length < kt && (m.requestHeaders[g] = _t(g, h), m.excluded = m.excluded || ne(m.url, m.requestHeaders)), p;
|
|
4575
4576
|
}, c = function(g) {
|
|
4576
4577
|
try {
|
|
4577
4578
|
const h = it.get(this);
|
|
@@ -4580,7 +4581,7 @@ function Ni() {
|
|
|
4580
4581
|
() => {
|
|
4581
4582
|
queueMicrotask(() => {
|
|
4582
4583
|
try {
|
|
4583
|
-
const p =
|
|
4584
|
+
const p = Eo(this.getAllResponseHeaders());
|
|
4584
4585
|
e({
|
|
4585
4586
|
requestId: h.requestId,
|
|
4586
4587
|
url: h.url,
|
|
@@ -4739,7 +4740,7 @@ function $i() {
|
|
|
4739
4740
|
};
|
|
4740
4741
|
}
|
|
4741
4742
|
function ji() {
|
|
4742
|
-
return Rs(globalThis, "getPageSnapshot", async () =>
|
|
4743
|
+
return Rs(globalThis, "getPageSnapshot", async () => Et());
|
|
4743
4744
|
}
|
|
4744
4745
|
function zi() {
|
|
4745
4746
|
return Rs(globalThis, "pageImages", {
|
|
@@ -4964,7 +4965,7 @@ function or() {
|
|
|
4964
4965
|
return {
|
|
4965
4966
|
pageUrl: location.href,
|
|
4966
4967
|
pageTitle: document.title,
|
|
4967
|
-
htmlContent:
|
|
4968
|
+
htmlContent: Et()
|
|
4968
4969
|
};
|
|
4969
4970
|
}
|
|
4970
4971
|
function ar(t) {
|
|
@@ -4990,7 +4991,7 @@ function lr() {
|
|
|
4990
4991
|
function rt() {
|
|
4991
4992
|
return Hs()?.surface === "browser_extension_sdk_preview";
|
|
4992
4993
|
}
|
|
4993
|
-
function
|
|
4994
|
+
function Et() {
|
|
4994
4995
|
if (!document.body)
|
|
4995
4996
|
return "";
|
|
4996
4997
|
const t = [], e = [], s = (p, m) => {
|
|
@@ -5187,9 +5188,9 @@ function ur(t, e) {
|
|
|
5187
5188
|
};
|
|
5188
5189
|
return [`--- ${O} ---`, ...I(A, 0).lines].join(`
|
|
5189
5190
|
`);
|
|
5190
|
-
}, y = [],
|
|
5191
|
-
|
|
5192
|
-
${JSON.stringify(
|
|
5191
|
+
}, y = [], k = re(window.getSelection()?.toString() ?? "");
|
|
5192
|
+
k && y.push(`--- selected text ---
|
|
5193
|
+
${JSON.stringify(k)}`), d.length > 0 && y.push(hr(d, s, l, o));
|
|
5193
5194
|
for (const A of t.slice(0, 3))
|
|
5194
5195
|
y.push(m(A, "active overlay DOM", /* @__PURE__ */ new Set()));
|
|
5195
5196
|
if (e && y.push(m(e, "main DOM", /* @__PURE__ */ new Set())), document.body) {
|
|
@@ -5467,7 +5468,7 @@ function xe(t, e) {
|
|
|
5467
5468
|
e
|
|
5468
5469
|
),
|
|
5469
5470
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5470
|
-
...
|
|
5471
|
+
...E(i) !== null ? { displaySequence: E(i) } : {},
|
|
5471
5472
|
...D(i) !== null ? { causalSequence: D(i) } : {},
|
|
5472
5473
|
respondsToUserMessageId: U(i) ?? void 0,
|
|
5473
5474
|
...R(i) ? { runId: R(i) } : {},
|
|
@@ -5484,7 +5485,7 @@ function xe(t, e) {
|
|
|
5484
5485
|
e
|
|
5485
5486
|
),
|
|
5486
5487
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5487
|
-
...
|
|
5488
|
+
...E(i) !== null ? { displaySequence: E(i) } : {},
|
|
5488
5489
|
...D(i) !== null ? { causalSequence: D(i) } : {},
|
|
5489
5490
|
respondsToUserMessageId: U(i) ?? void 0,
|
|
5490
5491
|
...R(i) ? { runId: R(i) } : {},
|
|
@@ -5510,7 +5511,7 @@ function xe(t, e) {
|
|
|
5510
5511
|
role: "tool",
|
|
5511
5512
|
content: "",
|
|
5512
5513
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5513
|
-
...
|
|
5514
|
+
...E(i) !== null ? { displaySequence: E(i) } : {},
|
|
5514
5515
|
respondsToUserMessageId: U(i) ?? void 0,
|
|
5515
5516
|
...R(i) ? { runId: R(i) } : {},
|
|
5516
5517
|
dataType: "function_call_output",
|
|
@@ -5525,7 +5526,7 @@ function xe(t, e) {
|
|
|
5525
5526
|
role: "tool",
|
|
5526
5527
|
content: "",
|
|
5527
5528
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5528
|
-
...
|
|
5529
|
+
...E(i) !== null ? { displaySequence: E(i) } : {},
|
|
5529
5530
|
respondsToUserMessageId: U(i) ?? void 0,
|
|
5530
5531
|
...R(i) ? { runId: R(i) } : {},
|
|
5531
5532
|
dataType: "scheduled_check_in",
|
|
@@ -5540,7 +5541,7 @@ function xe(t, e) {
|
|
|
5540
5541
|
role: "tool",
|
|
5541
5542
|
content: `Connect ${a.appName} to continue`,
|
|
5542
5543
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5543
|
-
...
|
|
5544
|
+
...E(i) !== null ? { displaySequence: E(i) } : {},
|
|
5544
5545
|
...D(i) !== null ? { causalSequence: D(i) } : {},
|
|
5545
5546
|
respondsToUserMessageId: U(i) ?? void 0,
|
|
5546
5547
|
...R(i) ? { runId: R(i) } : {},
|
|
@@ -5553,7 +5554,7 @@ function xe(t, e) {
|
|
|
5553
5554
|
role: "tool",
|
|
5554
5555
|
content: "Connect WhatsApp to continue",
|
|
5555
5556
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5556
|
-
...
|
|
5557
|
+
...E(i) !== null ? { displaySequence: E(i) } : {},
|
|
5557
5558
|
...D(i) !== null ? { causalSequence: D(i) } : {},
|
|
5558
5559
|
respondsToUserMessageId: U(i) ?? void 0,
|
|
5559
5560
|
...R(i) ? { runId: R(i) } : {},
|
|
@@ -5566,9 +5567,9 @@ function xe(t, e) {
|
|
|
5566
5567
|
return i.type === "function_call" || i.type === "tool_call" || i.type === "web_search_call" || i.type === "mcp_call" || i.type === "tab_lifecycle_decision" ? {
|
|
5567
5568
|
id: String(s.id ?? crypto.randomUUID()),
|
|
5568
5569
|
role: "tool",
|
|
5569
|
-
content: i.type === "mcp_call" ? Rr(i) :
|
|
5570
|
+
content: i.type === "mcp_call" ? Rr(i) : Er(i),
|
|
5570
5571
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5571
|
-
...
|
|
5572
|
+
...E(i) !== null ? { displaySequence: E(i) } : {},
|
|
5572
5573
|
...D(i) !== null ? { causalSequence: D(i) } : {},
|
|
5573
5574
|
respondsToUserMessageId: U(i) ?? void 0,
|
|
5574
5575
|
...R(i) ? { runId: R(i) } : {},
|
|
@@ -5580,9 +5581,9 @@ function xe(t, e) {
|
|
|
5580
5581
|
} : i.type === "run_status" || i.type === "run_error" ? i.type === "run_error" && i.stage === "tool_execution" ? null : {
|
|
5581
5582
|
id: String(s.id ?? crypto.randomUUID()),
|
|
5582
5583
|
role: "system",
|
|
5583
|
-
content:
|
|
5584
|
+
content: kr(i),
|
|
5584
5585
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5585
|
-
...
|
|
5586
|
+
...E(i) !== null ? { displaySequence: E(i) } : {},
|
|
5586
5587
|
...D(i) !== null ? { causalSequence: D(i) } : {},
|
|
5587
5588
|
respondsToUserMessageId: U(i) ?? void 0,
|
|
5588
5589
|
...R(i) ? { runId: R(i) } : {},
|
|
@@ -5629,10 +5630,10 @@ function vr(t) {
|
|
|
5629
5630
|
return null;
|
|
5630
5631
|
}
|
|
5631
5632
|
}
|
|
5632
|
-
function
|
|
5633
|
+
function kr(t) {
|
|
5633
5634
|
return t.type === "run_status" && t.status === "steered" ? "Steered" : typeof t.message == "string" && t.message.trim().length > 0 ? t.message : "";
|
|
5634
5635
|
}
|
|
5635
|
-
function
|
|
5636
|
+
function Er(t) {
|
|
5636
5637
|
if (t.type === "web_search_call") {
|
|
5637
5638
|
const e = t.action;
|
|
5638
5639
|
if (e && typeof e == "object") {
|
|
@@ -5685,7 +5686,7 @@ function pe(t) {
|
|
|
5685
5686
|
function D(t) {
|
|
5686
5687
|
return typeof t.causalSequence == "number" && Number.isSafeInteger(t.causalSequence) ? t.causalSequence : null;
|
|
5687
5688
|
}
|
|
5688
|
-
function
|
|
5689
|
+
function E(t) {
|
|
5689
5690
|
return typeof t.displaySequence == "number" && Number.isSafeInteger(t.displaySequence) ? t.displaySequence : null;
|
|
5690
5691
|
}
|
|
5691
5692
|
function os(t) {
|
|
@@ -6365,7 +6366,7 @@ function ys(t) {
|
|
|
6365
6366
|
return null;
|
|
6366
6367
|
}
|
|
6367
6368
|
}
|
|
6368
|
-
function
|
|
6369
|
+
function ke(t, e) {
|
|
6369
6370
|
try {
|
|
6370
6371
|
const s = `${Os}${t}`;
|
|
6371
6372
|
if (!e) {
|
|
@@ -6565,7 +6566,7 @@ function Qs(t) {
|
|
|
6565
6566
|
const e = {};
|
|
6566
6567
|
try {
|
|
6567
6568
|
new Headers(t).forEach((s, n) => {
|
|
6568
|
-
Object.keys(e).length <
|
|
6569
|
+
Object.keys(e).length < kt && (e[n] = _t(n, s));
|
|
6569
6570
|
});
|
|
6570
6571
|
} catch {
|
|
6571
6572
|
return {};
|
|
@@ -6573,7 +6574,7 @@ function Qs(t) {
|
|
|
6573
6574
|
return e;
|
|
6574
6575
|
}
|
|
6575
6576
|
function _t(t, e) {
|
|
6576
|
-
return tn(t) ? je : j(Be(e),
|
|
6577
|
+
return tn(t) ? je : j(Be(e), ki);
|
|
6577
6578
|
}
|
|
6578
6579
|
function wo(t, e) {
|
|
6579
6580
|
return typeof t == "string" ? t : t instanceof URL ? t.toString() : e?.url ?? "";
|
|
@@ -6598,7 +6599,7 @@ async function Mo(t) {
|
|
|
6598
6599
|
const n = new Promise((a) => {
|
|
6599
6600
|
s = window.setTimeout(() => {
|
|
6600
6601
|
e?.cancel(), a("timeout");
|
|
6601
|
-
},
|
|
6602
|
+
}, Ei);
|
|
6602
6603
|
}), i = new TextDecoder();
|
|
6603
6604
|
let r = "", o = 0;
|
|
6604
6605
|
for (; ; ) {
|
|
@@ -6658,7 +6659,7 @@ function Js(t) {
|
|
|
6658
6659
|
return s !== null && Number.isInteger(n) && n >= 0 && n <= vt && (e.startsWith("text/") || e.includes("json") || e.includes("javascript"));
|
|
6659
6660
|
}
|
|
6660
6661
|
function ne(t, e = {}, s) {
|
|
6661
|
-
if (
|
|
6662
|
+
if (ko(s))
|
|
6662
6663
|
return !0;
|
|
6663
6664
|
const n = Object.entries(e).find(([i]) => i.toLowerCase() === "content-type")?.[1]?.toLowerCase();
|
|
6664
6665
|
if (n?.includes("multipart/form-data") || n?.includes("application/octet-stream"))
|
|
@@ -6683,16 +6684,16 @@ function vo(t, e) {
|
|
|
6683
6684
|
return !0;
|
|
6684
6685
|
}
|
|
6685
6686
|
}
|
|
6686
|
-
function
|
|
6687
|
+
function ko(t) {
|
|
6687
6688
|
return t instanceof FormData || t instanceof Blob || t instanceof ArrayBuffer || ArrayBuffer.isView(t) || typeof ReadableStream < "u" && t instanceof ReadableStream;
|
|
6688
6689
|
}
|
|
6689
|
-
function
|
|
6690
|
+
function Eo(t) {
|
|
6690
6691
|
const e = {};
|
|
6691
6692
|
for (const s of t.trim().split(/[\r\n]+/)) {
|
|
6692
6693
|
const n = s.indexOf(":");
|
|
6693
6694
|
if (n <= 0)
|
|
6694
6695
|
continue;
|
|
6695
|
-
if (Object.keys(e).length >=
|
|
6696
|
+
if (Object.keys(e).length >= kt)
|
|
6696
6697
|
break;
|
|
6697
6698
|
const i = s.slice(0, n).trim();
|
|
6698
6699
|
e[i] = _t(i, s.slice(n + 1).trim());
|
|
@@ -6711,7 +6712,7 @@ class qe extends Error {
|
|
|
6711
6712
|
}
|
|
6712
6713
|
status;
|
|
6713
6714
|
}
|
|
6714
|
-
async function
|
|
6715
|
+
async function Ee(t, e) {
|
|
6715
6716
|
let s = null;
|
|
6716
6717
|
for (let n = 0; n < Zt; n += 1)
|
|
6717
6718
|
try {
|
|
@@ -1083,10 +1083,8 @@ class vc {
|
|
|
1083
1083
|
return i !== void 0 ? i : (this.scheduledEligibility.set(s, n), n);
|
|
1084
1084
|
}
|
|
1085
1085
|
getNextEligibilityAt(e = Date.now()) {
|
|
1086
|
-
for (const [s, i] of this.scheduledEligibility)
|
|
1087
|
-
i <= e && this.scheduledEligibility.delete(s);
|
|
1088
1086
|
const n = [
|
|
1089
|
-
...this.scheduledEligibility.values(),
|
|
1087
|
+
...Array.from(this.scheduledEligibility.values()).filter((s) => s > e),
|
|
1090
1088
|
...Array.from(this.decisions.values()).map((s) => s.nextEligibleAt ? Date.parse(s.nextEligibleAt) : Number.NaN).filter((s) => Number.isFinite(s) && s > e)
|
|
1091
1089
|
];
|
|
1092
1090
|
return n.length > 0 ? Math.min(...n) : null;
|
|
@@ -2724,7 +2722,7 @@ class bo {
|
|
|
2724
2722
|
}
|
|
2725
2723
|
}
|
|
2726
2724
|
startFirstResponseTimer(e, n, s = 0) {
|
|
2727
|
-
this.
|
|
2725
|
+
if (this.firstResponseTimersByClientMessageId.has(e)) return;
|
|
2728
2726
|
const i = n ?? Date.now();
|
|
2729
2727
|
this.firstResponseTimersByClientMessageId.set(e, {
|
|
2730
2728
|
submittedAt: i,
|
|
@@ -2755,18 +2753,21 @@ class bo {
|
|
|
2755
2753
|
}
|
|
2756
2754
|
reportFirstResponseSlow(e) {
|
|
2757
2755
|
const n = this.firstResponseTimersByClientMessageId.get(e);
|
|
2758
|
-
n && (n.missedResponseChecks = is, window.clearTimeout(n.timer), this.
|
|
2756
|
+
n && (n.missedResponseChecks = is, window.clearTimeout(n.timer), this.reportHealthSignal("first_response_slow", {
|
|
2759
2757
|
clientMessageId: e,
|
|
2760
2758
|
durationMs: Date.now() - n.submittedAt,
|
|
2761
2759
|
missedResponseChecks: n.missedResponseChecks,
|
|
2762
2760
|
ackObserved: this.activeClientMessageId === e && this.activeRunAckObserved
|
|
2763
2761
|
}));
|
|
2764
2762
|
}
|
|
2765
|
-
clearFirstResponseTimer(e) {
|
|
2763
|
+
clearFirstResponseTimer(e, n = !1) {
|
|
2766
2764
|
if (!e)
|
|
2767
2765
|
return;
|
|
2768
|
-
const
|
|
2769
|
-
|
|
2766
|
+
const s = this.firstResponseTimersByClientMessageId.get(e);
|
|
2767
|
+
s && (n && this.reportHealthSignal("first_response", {
|
|
2768
|
+
clientMessageId: e,
|
|
2769
|
+
durationMs: Math.max(0, Date.now() - s.submittedAt)
|
|
2770
|
+
}), window.clearTimeout(s.timer), this.firstResponseTimersByClientMessageId.delete(e));
|
|
2770
2771
|
}
|
|
2771
2772
|
clearAllFirstResponseTimers() {
|
|
2772
2773
|
for (const { timer: e } of this.firstResponseTimersByClientMessageId.values())
|
|
@@ -3104,7 +3105,7 @@ class bo {
|
|
|
3104
3105
|
const n = Fr(e), s = this.pendingClientMessageId, i = n ? this.getResponseEvidenceClientMessageId(e) : null, o = n ? this.promotePendingDeliveryFromResponseEvidence(e) : !1;
|
|
3105
3106
|
if (n) {
|
|
3106
3107
|
const a = o ? s : i === this.activeClientMessageId ? this.activeClientMessageId : s === null ? this.activeClientMessageId : null;
|
|
3107
|
-
this.clearFirstResponseTimer(a);
|
|
3108
|
+
this.clearFirstResponseTimer(a, !0);
|
|
3108
3109
|
}
|
|
3109
3110
|
if (e.type === "run.steered") {
|
|
3110
3111
|
this.handleRunSteered(e);
|
|
@@ -6895,7 +6896,7 @@ function Vg(t) {
|
|
|
6895
6896
|
e ^= t.charCodeAt(n), e = Math.imul(e, 16777619);
|
|
6896
6897
|
return `fnv1a-${(e >>> 0).toString(16).padStart(8, "0")}`;
|
|
6897
6898
|
}
|
|
6898
|
-
const Yg = "0.1.
|
|
6899
|
+
const Yg = "0.1.218", Xg = 80, Jg = 64e3, ga = 60, Pi = 160;
|
|
6899
6900
|
function Qg(t, e, n, s) {
|
|
6900
6901
|
const i = [], o = [];
|
|
6901
6902
|
let a = 0, r = 0, d = 0, c = crypto.randomUUID(), u = s.getState(), h = u.user?.id, f = null, g = "", w = "";
|
package/package.json
CHANGED