@pluno/product-agent-web 0.1.235 → 0.1.236
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/adapters/web/conversationAdapters.d.ts +6 -1
- package/dist/adapters/web/errorAdapter.d.ts +7 -1
- package/dist/core/protocol/normalizeError.d.ts +2 -0
- package/dist/product-agent-runtime.cjs +1 -1
- package/dist/product-agent-runtime.js +166 -146
- package/dist/product-agent-sdk.js +1205 -1185
- package/dist/product-agent-widget.js +2368 -2348
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ function f(s) {
|
|
|
8
8
|
updatedAt: null
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
class
|
|
11
|
+
class O {
|
|
12
12
|
constructor(e, t, i = (n, r) => r) {
|
|
13
13
|
this.loader = t, this.merge = i, this.state = f(e);
|
|
14
14
|
}
|
|
@@ -93,34 +93,34 @@ function m(s) {
|
|
|
93
93
|
nextCursor: s.nextCursor
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function $(s, e, t) {
|
|
97
97
|
if (t === "replace" || s === null) return e;
|
|
98
98
|
const i = { ...s.entitiesById, ...e.entitiesById }, n = [...s.ids];
|
|
99
99
|
for (const r of e.ids)
|
|
100
100
|
s.entitiesById[r] || n.push(r);
|
|
101
101
|
return { entitiesById: i, ids: n, nextCursor: e.nextCursor };
|
|
102
102
|
}
|
|
103
|
-
function
|
|
103
|
+
function F(s) {
|
|
104
104
|
return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function ue(s) {
|
|
107
107
|
return s.visible ? s.minimized ? { state: "minimized" } : { state: s.open ? "visible_open" : "visible_closed" } : { state: "hidden" };
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function pe(s, e) {
|
|
110
110
|
return e === "limit_exceeded" ? { allowed: !1, reason: "credits_exhausted", actions: ["upgrade", "earn_credits"] } : e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required" ? { allowed: !1, reason: "payment_issue", actions: ["upgrade"] } : s ?? { allowed: !0, reason: "allowed", actions: [] };
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function he(s) {
|
|
113
113
|
if (!s || typeof s != "object") return !1;
|
|
114
114
|
const e = s.paidCreditFallbackModel;
|
|
115
115
|
return typeof e == "string" && e.length > 0;
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function ge(s) {
|
|
118
118
|
return s ? s.submissionGate?.allowed === !1 ? { state: "action_required", reason: s.submissionGate.reason } : s.usingPaidCreditFallback === !0 ? { state: "paid_credit_fallback" } : s.creditLimit !== null && s.creditLimit > 0 && s.creditsRemaining !== null && s.creditsRemaining > 0 && s.creditsRemaining / s.creditLimit <= 0.2 ? { state: "low_credits" } : s.creditsUsed !== null ? { state: "usage" } : { state: "hidden" } : { state: "hidden" };
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function fe(s) {
|
|
121
121
|
return s.submissionAllowed && s.isAuthenticated && s.hasWorkspace && !s.isWebsiteBlocked && s.isCurrentPageResolved && !s.isSubmitting && !s.hasPendingMessage;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function me(s) {
|
|
124
124
|
const e = s.hasDraftMessage || s.hasPreSubmittedAttachment;
|
|
125
125
|
return s.hasRunningAssistantTurn && !e ? {
|
|
126
126
|
action: "stop",
|
|
@@ -130,13 +130,13 @@ function ge(s) {
|
|
|
130
130
|
disabled: !e || !s.canSubmitMessage
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
|
-
const
|
|
134
|
-
function
|
|
135
|
-
return (s instanceof Error ? s.message : s) ===
|
|
133
|
+
const Q = "Pluno is reconnecting. Try again in a moment.";
|
|
134
|
+
function B(s) {
|
|
135
|
+
return (s instanceof Error ? s.message : s) === Q;
|
|
136
136
|
}
|
|
137
|
-
class
|
|
137
|
+
class ye {
|
|
138
138
|
constructor(e, t, i = 20) {
|
|
139
|
-
this.loadPage = t, this.limit = i, this.recentQuery = new
|
|
139
|
+
this.loadPage = t, this.limit = i, this.recentQuery = new O(
|
|
140
140
|
`${e}:recent`,
|
|
141
141
|
async ({ cursor: n }) => m(
|
|
142
142
|
await this.loadPage({ cursor: n, limit: this.limit, pinned: !1 }).then((r) => ({
|
|
@@ -144,8 +144,8 @@ class fe {
|
|
|
144
144
|
nextCursor: r.nextCursor
|
|
145
145
|
}))
|
|
146
146
|
),
|
|
147
|
-
|
|
148
|
-
), this.pinnedQuery = new
|
|
147
|
+
$
|
|
148
|
+
), this.pinnedQuery = new O(
|
|
149
149
|
`${e}:pinned`,
|
|
150
150
|
async () => m({
|
|
151
151
|
entities: await this.loadAllPinned(),
|
|
@@ -177,7 +177,7 @@ class fe {
|
|
|
177
177
|
}) : null;
|
|
178
178
|
return {
|
|
179
179
|
key: e.key.slice(0, -7),
|
|
180
|
-
status:
|
|
180
|
+
status: z(e, t),
|
|
181
181
|
data: o,
|
|
182
182
|
error: e.error ?? t.error,
|
|
183
183
|
requestId: Math.max(e.requestId, t.requestId),
|
|
@@ -286,44 +286,44 @@ class fe {
|
|
|
286
286
|
function h(s) {
|
|
287
287
|
return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function z(s, e) {
|
|
290
290
|
return s.status === "error" || e.status === "error" ? "error" : s.status === "loading" || e.status === "loading" ? "loading" : s.status === "refreshing" || e.status === "refreshing" ? "refreshing" : s.status === "loading_more" ? "loading_more" : s.status === "ready" || e.status === "ready" ? "ready" : "not_requested";
|
|
291
291
|
}
|
|
292
|
-
function
|
|
292
|
+
function R(s) {
|
|
293
293
|
const e = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(?:\.(\d{1,6}))?(?:Z|\+00:00)$/.exec(s);
|
|
294
294
|
if (!e) throw new Error("Display timestamps must retain the backend UTC precision.");
|
|
295
295
|
return `${e[1]}.${(e[2] ?? "").padEnd(6, "0")}`;
|
|
296
296
|
}
|
|
297
|
-
function
|
|
297
|
+
function b(s) {
|
|
298
298
|
if (s === null || typeof s == "string" || typeof s == "boolean") return !0;
|
|
299
299
|
if (typeof s == "number") return Number.isFinite(s);
|
|
300
|
-
if (Array.isArray(s)) return s.every(
|
|
300
|
+
if (Array.isArray(s)) return s.every(b);
|
|
301
301
|
if (typeof s != "object") return !1;
|
|
302
302
|
const e = Object.getPrototypeOf(s);
|
|
303
|
-
return e !== Object.prototype && e !== null ? !1 : Object.values(s).every(
|
|
303
|
+
return e !== Object.prototype && e !== null ? !1 : Object.values(s).every(b);
|
|
304
304
|
}
|
|
305
305
|
function N(s) {
|
|
306
306
|
return s !== null && typeof s == "object" && !Object.isFrozen(s) && (Object.values(s).forEach(N), Object.freeze(s)), s;
|
|
307
307
|
}
|
|
308
|
-
function
|
|
309
|
-
if (!
|
|
308
|
+
function G(s) {
|
|
309
|
+
if (!b(s)) throw new Error("Conversation inputs must be JSON-safe values.");
|
|
310
310
|
return JSON.parse(JSON.stringify(s));
|
|
311
311
|
}
|
|
312
|
-
function
|
|
312
|
+
function H(s, e) {
|
|
313
313
|
if (!e) return !1;
|
|
314
314
|
const t = s.executionByUserMessage[e];
|
|
315
315
|
if (t) return ["completed", "stopped", "failed"].includes(t.phase);
|
|
316
|
-
const i = Object.values(s.items).sort((r, a) =>
|
|
316
|
+
const i = Object.values(s.items).sort((r, a) => R(r.created_at).localeCompare(R(a.created_at)) || r.id.localeCompare(a.id));
|
|
317
317
|
let n = !1;
|
|
318
318
|
for (const r of i)
|
|
319
319
|
if (r.type === "user_message" && (n = r.id === e), !!n && (r.type === "stopped" || r.type === "error" || r.type === "final_response" && s.streams[r.id]?.state === "finished" && s.streams[r.id].revision >= r.data.revision))
|
|
320
320
|
return !0;
|
|
321
321
|
return !1;
|
|
322
322
|
}
|
|
323
|
-
class
|
|
323
|
+
class ve {
|
|
324
324
|
constructor(e, t = null) {
|
|
325
325
|
this.storage = e, t && (this.decisions = new Map(
|
|
326
|
-
t.filter(
|
|
326
|
+
t.filter(E).map((i) => [this.getDecisionKey(i), i])
|
|
327
327
|
), this.initialized = !0);
|
|
328
328
|
}
|
|
329
329
|
storage;
|
|
@@ -345,7 +345,7 @@ class me {
|
|
|
345
345
|
if (n && n.version >= t.version) continue;
|
|
346
346
|
if (n && n.payload.kind !== t.payload.kind) throw new Error("Interaction kind changed.");
|
|
347
347
|
const r = n?.payload.kind === "personal_channel" && n.lifecycle === "completed" ? "completed" : t.lifecycle, a = n?.payload.kind === "sharing" && t.payload.kind === "sharing" ? { ...t.payload, variant: n.payload.variant } : t.payload;
|
|
348
|
-
this.sources.set(i, N(
|
|
348
|
+
this.sources.set(i, N(G({ ...t, lifecycle: r, payload: a }))), t.payload.kind === "integration_auth" && this.invalidateAuth(t.payload.request_id);
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
351
|
/** @internal */
|
|
@@ -371,7 +371,7 @@ class me {
|
|
|
371
371
|
userPrompt: o?.type === "user_message" ? o.data.content : "",
|
|
372
372
|
assistantAnswer: ""
|
|
373
373
|
},
|
|
374
|
-
terminal: !a.wait_for_terminal ||
|
|
374
|
+
terminal: !a.wait_for_terminal || H(i, r.user_message_id)
|
|
375
375
|
};
|
|
376
376
|
} else a.kind === "integration_auth" ? t.integrations.push({
|
|
377
377
|
revision: r.version,
|
|
@@ -401,7 +401,7 @@ class me {
|
|
|
401
401
|
if (this.initialized) return;
|
|
402
402
|
const e = await this.storage.load();
|
|
403
403
|
this.decisions = new Map(
|
|
404
|
-
e.filter(
|
|
404
|
+
e.filter(E).map((t) => [this.getDecisionKey(t), t])
|
|
405
405
|
), this.initialized = !0;
|
|
406
406
|
}
|
|
407
407
|
isEligible(e, t = Date.now()) {
|
|
@@ -463,51 +463,51 @@ class me {
|
|
|
463
463
|
return null;
|
|
464
464
|
}
|
|
465
465
|
getDecisionKey(e) {
|
|
466
|
-
const t =
|
|
466
|
+
const t = _(e.scope);
|
|
467
467
|
return e.action === "dont_show_again" ? `${t}:category:${e.category}` : `${t}:interaction:${e.promptKey}`;
|
|
468
468
|
}
|
|
469
469
|
getExactKey(e) {
|
|
470
|
-
return `${
|
|
470
|
+
return `${_(e.scope)}:interaction:${e.key}`;
|
|
471
471
|
}
|
|
472
472
|
getCategoryKey(e) {
|
|
473
|
-
return `${
|
|
473
|
+
return `${_(e.scope)}:category:${e.category}`;
|
|
474
474
|
}
|
|
475
475
|
}
|
|
476
|
-
function
|
|
476
|
+
function be(s, e) {
|
|
477
477
|
return {
|
|
478
|
-
load: async () =>
|
|
478
|
+
load: async () => V(s, e),
|
|
479
479
|
save: async (t) => s.setItem(e, JSON.stringify(t))
|
|
480
480
|
};
|
|
481
481
|
}
|
|
482
|
-
function
|
|
482
|
+
function V(s, e) {
|
|
483
483
|
const t = s.getItem(e);
|
|
484
484
|
if (!t) return [];
|
|
485
485
|
const i = JSON.parse(t);
|
|
486
|
-
return Array.isArray(i) ? i.filter(
|
|
486
|
+
return Array.isArray(i) ? i.filter(E) : [];
|
|
487
487
|
}
|
|
488
|
-
function
|
|
488
|
+
function _(s) {
|
|
489
489
|
return `${s.level}:${s.key}`;
|
|
490
490
|
}
|
|
491
491
|
function L(s) {
|
|
492
492
|
return s === "dismiss" || s === "later" || s === "snooze" || s === "never" || s === "dont_show_again";
|
|
493
493
|
}
|
|
494
|
-
function
|
|
494
|
+
function E(s) {
|
|
495
495
|
if (!s || typeof s != "object") return !1;
|
|
496
496
|
const e = s;
|
|
497
497
|
return typeof e.promptKey == "string" && typeof e.category == "string" && typeof e.decidedAt == "string" && (e.nextEligibleAt === null || typeof e.nextEligibleAt == "string") && L(e.action) && !!(e.scope && typeof e.scope == "object" && typeof e.scope.level == "string" && typeof e.scope.key == "string");
|
|
498
498
|
}
|
|
499
|
-
const
|
|
499
|
+
const Z = {
|
|
500
500
|
working: "⏳",
|
|
501
501
|
completed: "✅",
|
|
502
502
|
failed: "❗",
|
|
503
503
|
stopped: "⏹️"
|
|
504
|
-
},
|
|
505
|
-
function
|
|
506
|
-
if (!e) return
|
|
507
|
-
const t =
|
|
504
|
+
}, J = /^(?:⌛|⏳|✅|❗|⏹️) Pluno(?:: )?/;
|
|
505
|
+
function W(s, e) {
|
|
506
|
+
if (!e) return S(s);
|
|
507
|
+
const t = S(s), i = `${Z[e]} Pluno`;
|
|
508
508
|
return t ? `${i}: ${t}` : i;
|
|
509
509
|
}
|
|
510
|
-
class
|
|
510
|
+
class Se {
|
|
511
511
|
constructor(e) {
|
|
512
512
|
this.titleDocument = e;
|
|
513
513
|
}
|
|
@@ -529,10 +529,10 @@ class ve {
|
|
|
529
529
|
}
|
|
530
530
|
applyStatus(e) {
|
|
531
531
|
const t = this.titleDocument.getTitle();
|
|
532
|
-
t !== this.lastAppliedTitle && (this.baseTitle =
|
|
532
|
+
t !== this.lastAppliedTitle && (this.baseTitle = S(t)), this.status = e, this.stopObserving || (this.stopObserving = this.titleDocument.observeTitle(() => this.handleTitleChanged())), this.applyTitle();
|
|
533
533
|
}
|
|
534
534
|
applyClear() {
|
|
535
|
-
const e = this.titleDocument.getTitle(), t = this.lastAppliedTitle !== null && e === this.lastAppliedTitle, i = this.lastAppliedTitle === null ?
|
|
535
|
+
const e = this.titleDocument.getTitle(), t = this.lastAppliedTitle !== null && e === this.lastAppliedTitle, i = this.lastAppliedTitle === null ? S(e) : e;
|
|
536
536
|
this.status = null, this.lastAppliedTitle = null, this.stopObserving?.(), this.stopObserving = null, t ? this.titleDocument.setTitle(this.baseTitle) : i !== e && this.titleDocument.setTitle(i);
|
|
537
537
|
}
|
|
538
538
|
handleTitleChanged() {
|
|
@@ -541,11 +541,11 @@ class ve {
|
|
|
541
541
|
applyTitle() {
|
|
542
542
|
if (!this.status)
|
|
543
543
|
return;
|
|
544
|
-
const e =
|
|
544
|
+
const e = W(this.baseTitle, this.status);
|
|
545
545
|
this.lastAppliedTitle = e, this.titleDocument.getTitle() !== e && this.titleDocument.setTitle(e);
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
|
-
function
|
|
548
|
+
function _e(s) {
|
|
549
549
|
return {
|
|
550
550
|
getTitle: () => s.title,
|
|
551
551
|
setTitle: (e) => {
|
|
@@ -561,10 +561,30 @@ function be(s) {
|
|
|
561
561
|
}
|
|
562
562
|
};
|
|
563
563
|
}
|
|
564
|
-
function
|
|
565
|
-
return s.replace(
|
|
564
|
+
function S(s) {
|
|
565
|
+
return s.replace(J, "");
|
|
566
566
|
}
|
|
567
|
-
|
|
567
|
+
function Y(s) {
|
|
568
|
+
if (s.details !== void 0 && !b(s.details))
|
|
569
|
+
throw new TypeError("Product Agent transported error details must be JSON-safe.");
|
|
570
|
+
return {
|
|
571
|
+
code: s.code,
|
|
572
|
+
message: s.message,
|
|
573
|
+
retryable: s.retryable,
|
|
574
|
+
...s.details === void 0 ? {} : { details: s.details }
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
function I(s, e = "runtime_error") {
|
|
578
|
+
const t = s !== null && typeof s == "object" ? s : null, i = typeof s == "string" ? s : t && "message" in t && typeof t.message == "string" ? t.message : "", n = t && "code" in t && typeof t.code == "string" && t.code.trim() ? t.code : e, r = t && "details" in t ? t.details : null;
|
|
579
|
+
return Y({
|
|
580
|
+
code: n,
|
|
581
|
+
message: i.trim() && i.trim() !== "[object Object]" ? i : "The Product Agent operation failed. Try again.",
|
|
582
|
+
retryable: !!(t && "retryable" in t && t.retryable === !0),
|
|
583
|
+
// Only this public recovery action is consumed from error details. Do not copy arbitrary thrown metadata.
|
|
584
|
+
...r && typeof r == "object" && "securitySettingsUrl" in r && typeof r.securitySettingsUrl == "string" ? { details: { securitySettingsUrl: r.securitySettingsUrl } } : {}
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
const X = [
|
|
568
588
|
"submit",
|
|
569
589
|
"stop",
|
|
570
590
|
"staging_ipc",
|
|
@@ -600,15 +620,15 @@ const W = [
|
|
|
600
620
|
"stopping_painted",
|
|
601
621
|
"progress_painted",
|
|
602
622
|
"stopped_painted"
|
|
603
|
-
],
|
|
604
|
-
let
|
|
605
|
-
const
|
|
606
|
-
function
|
|
623
|
+
], ee = Math.random().toString(36).slice(2);
|
|
624
|
+
let te = 0;
|
|
625
|
+
const C = () => `timing:${ee}:${++te}`, g = (s) => typeof s == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(s);
|
|
626
|
+
function T(s) {
|
|
607
627
|
if (!s || typeof s != "object") return !1;
|
|
608
628
|
const e = s;
|
|
609
|
-
return Object.keys(e).every((t) => ["entrySurface", "operation", "layer", "stage", "status", "spanId", "requestId", "clientMessageId", "sessionId", "occurredAt", "durationMs"].includes(t)) && (e.entrySurface === void 0 || ["extension_sidepanel", "extension_widget", "main_web_chat", "embedded_widget", "embedded_custom_ui", "automation", "mcp", "whatsapp"].includes(e.entrySurface)) && ["send", "stop"].includes(e.operation) && ["renderer", "sdk", "extension", "http"].includes(e.layer) &&
|
|
629
|
+
return Object.keys(e).every((t) => ["entrySurface", "operation", "layer", "stage", "status", "spanId", "requestId", "clientMessageId", "sessionId", "occurredAt", "durationMs"].includes(t)) && (e.entrySurface === void 0 || ["extension_sidepanel", "extension_widget", "main_web_chat", "embedded_widget", "embedded_custom_ui", "automation", "mcp", "whatsapp"].includes(e.entrySurface)) && ["send", "stop"].includes(e.operation) && ["renderer", "sdk", "extension", "http"].includes(e.layer) && X.includes(e.stage) && ["started", "completed", "failed", "observed"].includes(e.status) && g(e.spanId) && g(e.requestId) && (e.clientMessageId === null || g(e.clientMessageId)) && (e.sessionId === null || g(e.sessionId)) && typeof e.occurredAt == "string" && e.occurredAt.length <= 40 && Number.isFinite(Date.parse(e.occurredAt)) && Number.isSafeInteger(e.durationMs) && e.durationMs >= 0;
|
|
610
630
|
}
|
|
611
|
-
function
|
|
631
|
+
function k(s, e) {
|
|
612
632
|
if (!s) return {
|
|
613
633
|
mark: (n) => {
|
|
614
634
|
},
|
|
@@ -623,13 +643,13 @@ function C(s, e) {
|
|
|
623
643
|
occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
624
644
|
durationMs: Math.max(0, Math.round(performance.now() - a))
|
|
625
645
|
};
|
|
626
|
-
s &&
|
|
646
|
+
s && T(c) && Promise.resolve().then(() => s(c)).catch(() => {
|
|
627
647
|
});
|
|
628
648
|
};
|
|
629
649
|
return {
|
|
630
|
-
mark: (n) => i(n, "observed", t,
|
|
650
|
+
mark: (n) => i(n, "observed", t, C()),
|
|
631
651
|
measure(n, r) {
|
|
632
|
-
const a = performance.now(), o =
|
|
652
|
+
const a = performance.now(), o = C();
|
|
633
653
|
return i(n, "started", a, o), r().then(
|
|
634
654
|
(c) => (i(n, "completed", a, o), c),
|
|
635
655
|
(c) => {
|
|
@@ -640,43 +660,43 @@ function C(s, e) {
|
|
|
640
660
|
};
|
|
641
661
|
}
|
|
642
662
|
const y = (s) => typeof s == "string" && /^[a-zA-Z0-9:_.-]{1,160}$/.test(s) ? s : null;
|
|
643
|
-
function
|
|
663
|
+
function se(s) {
|
|
644
664
|
if (!s || typeof s != "object") return !1;
|
|
645
665
|
const e = s, t = (n) => Number.isSafeInteger(n) && n >= 0, i = (n) => n && typeof n == "object" && Object.keys(n).every((r) => ["sequence", "at", "type", "changed", "generation", "sessionId", "scopeId", "requestId", "effectId", "clientScopeId", "reason", "effectKind", "eventType", "itemCount", "removedCount", "projectionReady"].includes(r)) && t(n.sequence) && t(n.at) && y(n.type) !== null && typeof n.changed == "boolean" && [n.generation, n.itemCount, n.removedCount].every((r) => r === null || t(r)) && [n.sessionId, n.scopeId, n.requestId, n.effectId, n.clientScopeId, n.reason, n.effectKind, n.eventType].every((r) => r === null || y(r) !== null) && (n.projectionReady === null || typeof n.projectionReady == "boolean");
|
|
646
666
|
return Object.keys(e).every((n) => ["ownerId", "revision", "dropped", "lastIntent", "lastSelection", "transitions"].includes(n)) && y(e.ownerId) !== null && t(e.revision) && t(e.dropped) && (e.lastIntent == null || i(e.lastIntent)) && (e.lastSelection === null || i(e.lastSelection)) && Array.isArray(e.transitions) && e.transitions.length <= 16 && e.transitions.every(i);
|
|
647
667
|
}
|
|
648
|
-
const
|
|
649
|
-
function
|
|
668
|
+
const x = ["messageKeys", "canonicalItemKeys", "terminalResponseKeys", "toolCallKeys", "activeResponseKeys"], P = (s) => typeof s == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(s), v = (s) => s === null || P(s), ie = (s) => typeof s == "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?(?:Z|\+00:00)$/.test(s) && Number.isFinite(Date.parse(s));
|
|
669
|
+
function U(s) {
|
|
650
670
|
if (!s || typeof s != "object") return !1;
|
|
651
671
|
const e = s;
|
|
652
|
-
return Object.keys(s).every((t) => ["sessionId", "itemId", "userMessageId", "createdAt", "runId", "retryable"].includes(t)) && v(e.sessionId) &&
|
|
672
|
+
return Object.keys(s).every((t) => ["sessionId", "itemId", "userMessageId", "createdAt", "runId", "retryable"].includes(t)) && v(e.sessionId) && P(e.itemId) && v(e.userMessageId) && (e.retryable === void 0 || typeof e.retryable == "boolean") && v(e.runId) && (e.createdAt === null || ie(e.createdAt));
|
|
653
673
|
}
|
|
654
|
-
function
|
|
674
|
+
function ne(s) {
|
|
655
675
|
if (!s || typeof s != "object") return !1;
|
|
656
676
|
const e = s, t = (i) => Number.isSafeInteger(i) && i >= 0;
|
|
657
|
-
return Object.keys(e).every((i) => ["capturedAt", "selectionKey", "userId", "loading", "draft", "thinking", "connected", "hasError", "phase", "queryStatus", "queryRequestId", "queryUpdatedAt", "renderSource", "selectionFencePending", "guardCreatedAt", "owner"].includes(i)) && t(e.capturedAt) && [e.queryUpdatedAt, e.guardCreatedAt].every((i) => i === null || t(i)) && [e.selectionKey, e.userId, e.phase, e.queryStatus, e.queryRequestId].every((i) => i === null || y(i) !== null) && [e.loading, e.draft, e.thinking, e.connected, e.hasError, e.selectionFencePending].every((i) => typeof i == "boolean") && ["state", "account", "interactions", "local", "sidepanel_layout"].includes(e.renderSource) && (e.owner === void 0 ||
|
|
677
|
+
return Object.keys(e).every((i) => ["capturedAt", "selectionKey", "userId", "loading", "draft", "thinking", "connected", "hasError", "phase", "queryStatus", "queryRequestId", "queryUpdatedAt", "renderSource", "selectionFencePending", "guardCreatedAt", "owner"].includes(i)) && t(e.capturedAt) && [e.queryUpdatedAt, e.guardCreatedAt].every((i) => i === null || t(i)) && [e.selectionKey, e.userId, e.phase, e.queryStatus, e.queryRequestId].every((i) => i === null || y(i) !== null) && [e.loading, e.draft, e.thinking, e.connected, e.hasError, e.selectionFencePending].every((i) => typeof i == "boolean") && ["state", "account", "interactions", "local", "sidepanel_layout"].includes(e.renderSource) && (e.owner === void 0 || se(e.owner));
|
|
658
678
|
}
|
|
659
679
|
function K(s) {
|
|
660
680
|
if (!s || typeof s != "object" || Object.keys(s).some((i) => i !== "before" && i !== "current")) return !1;
|
|
661
681
|
const e = (i) => {
|
|
662
682
|
if (!i || typeof i != "object") return !1;
|
|
663
683
|
const n = i;
|
|
664
|
-
return Object.keys(i).every((r) => [...
|
|
684
|
+
return Object.keys(i).every((r) => [...x, "sessionId", "runtimeItemCount", "welcome", "truncated", "thinkingSequence", "context"].includes(r)) && (n.context === void 0 || ne(n.context)) && (n.thinkingSequence === void 0 || Array.isArray(n.thinkingSequence) && n.thinkingSequence.length <= 20 && n.thinkingSequence.every((r) => r === "user" || r === "thinking")) && v(n.sessionId) && Number.isSafeInteger(n.runtimeItemCount) && n.runtimeItemCount >= 0 && typeof n.welcome == "boolean" && typeof n.truncated == "boolean" && x.every((r) => Array.isArray(n[r]) && n[r].length <= 20 && n[r].every(P));
|
|
665
685
|
}, t = s;
|
|
666
686
|
return (t.before === null || e(t.before)) && e(t.current);
|
|
667
687
|
}
|
|
668
|
-
const
|
|
669
|
-
function
|
|
688
|
+
const A = (s) => s === null || typeof s == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(s);
|
|
689
|
+
function re(s) {
|
|
670
690
|
if (!s || typeof s != "object") return !1;
|
|
671
691
|
const e = s;
|
|
672
|
-
return typeof e.observedAt == "string" && e.observedAt.length <= 40 && Number.isFinite(Date.parse(e.observedAt)) &&
|
|
692
|
+
return typeof e.observedAt == "string" && e.observedAt.length <= 40 && Number.isFinite(Date.parse(e.observedAt)) && A(e.sessionId) && A(e.responseItemId) && A(e.respondsToUserMessageId) && typeof e.panelVisible == "boolean" && typeof e.documentVisible == "boolean" && typeof e.loading == "boolean";
|
|
673
693
|
}
|
|
674
|
-
const
|
|
675
|
-
function
|
|
694
|
+
const D = 500;
|
|
695
|
+
function oe(s) {
|
|
676
696
|
const e = s.replace(/\n\s*at\s[\s\S]*$/, "").replace(/-----BEGIN [^-]*PRIVATE KEY-----[\s\S]*?(?:-----END [^-]*PRIVATE KEY-----|$)/g, "[REDACTED]").replace(/\b(?:set-cookie|cookie)\s*[:=]\s*[^\n]+/gi, "cookie=[REDACTED]").replace(/\bdata:[^\s<>"']+/gi, "[DATA]").replace(/\b(?:https?:\/\/|www\.)[^\s<>"']+/gi, "[URL]").replace(/\b(?:Bearer|Basic)\s+[^\s,;"']+/gi, "[REDACTED]").replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?/g, "[REDACTED]").replace(/\b(?:sk|pk|ghp|gho|github_pat|xoxb|xoxp)[-_][A-Za-z0-9_-]{8,}/g, "[REDACTED]").replace(/\b((?:access|refresh|id|auth)[_-]?token|api[_-]?key|client[_-]?secret|password|passwd|pwd|secret|token|jwt|authorization|cookie|set-cookie)\b["']?\s*[:=]\s*(?:"[^"]*"|'[^']*'|[^\s,;}&]+)/gi, "$1=[REDACTED]").replace(/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/gi, "[EMAIL]").replace(/(?:[A-Z]:[\\/]|\\\\|(?:~|\.\.?)?\/|[\w.-]+[\\/])[^\s<>"']+/gi, "[FILE]").replace(new RegExp("(?<![\\w.])(?:[\\w.-]+\\.[A-Z][A-Z0-9]{0,15}|\\.[A-Z][\\w.-]*)\\b", "gi"), "[FILE]").replace(/\s+/g, " ").trim();
|
|
677
|
-
return e.length >
|
|
697
|
+
return e.length > D ? `${e.slice(0, D - 1)}…` : e;
|
|
678
698
|
}
|
|
679
|
-
function
|
|
699
|
+
function ae(s, e, t = "stopped", i) {
|
|
680
700
|
const n = new Set(i ?? [
|
|
681
701
|
s.assistantDraftRespondsToUserMessageId,
|
|
682
702
|
s.activeResponseUserMessageId,
|
|
@@ -703,7 +723,7 @@ function re(s, e, t = "stopped", i) {
|
|
|
703
723
|
lastErrorCode: null
|
|
704
724
|
};
|
|
705
725
|
}
|
|
706
|
-
const
|
|
726
|
+
const ce = {
|
|
707
727
|
"stop-without-rendered-message": "Stop is enabled while no message is rendered or the welcome screen is still visible.",
|
|
708
728
|
"in-progress-stop-unavailable": "An in-progress response has no visible enabled interrupt control.",
|
|
709
729
|
"stop-did-not-interrupt": "The stopped response remained in progress after an interrupt click.",
|
|
@@ -719,10 +739,10 @@ const oe = {
|
|
|
719
739
|
"thinking-groups-without-user-message": "Multiple thinking groups appeared without a user message between them.",
|
|
720
740
|
"thinking-without-progress": "Thinking remained visible without progress for five minutes."
|
|
721
741
|
};
|
|
722
|
-
function
|
|
723
|
-
return typeof s == "string" && s.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call(
|
|
742
|
+
function le(s) {
|
|
743
|
+
return typeof s == "string" && s.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call(ce, s.slice(13));
|
|
724
744
|
}
|
|
725
|
-
function
|
|
745
|
+
function q(s) {
|
|
726
746
|
return {
|
|
727
747
|
...s.id === void 0 ? {} : { id: s.id },
|
|
728
748
|
name: s.name,
|
|
@@ -733,7 +753,7 @@ function D(s) {
|
|
|
733
753
|
...s.fileUrl === void 0 ? {} : { fileUrl: s.fileUrl }
|
|
734
754
|
};
|
|
735
755
|
}
|
|
736
|
-
function
|
|
756
|
+
function Ie(s) {
|
|
737
757
|
if (!s || typeof s != "object" || !("type" in s)) return !1;
|
|
738
758
|
const e = s;
|
|
739
759
|
switch (e.type) {
|
|
@@ -744,15 +764,15 @@ function Se(s) {
|
|
|
744
764
|
case "run.stop":
|
|
745
765
|
return e.clientMessageIds === void 0 || Array.isArray(e.clientMessageIds) && e.clientMessageIds.length <= 100 && e.clientMessageIds.every((t) => typeof t == "string" && t.length > 0 && t.length <= 160);
|
|
746
766
|
case "runtime.report_response_visibility":
|
|
747
|
-
return
|
|
767
|
+
return re(e.observation);
|
|
748
768
|
case "runtime.warmup":
|
|
749
769
|
return e.reason === "panel_open" || e.reason === "extension_install" || e.reason === "composer_input";
|
|
750
770
|
case "runtime.report_operation_timing":
|
|
751
|
-
return
|
|
771
|
+
return T(e.timing);
|
|
752
772
|
case "runtime.report_displayed_error":
|
|
753
|
-
return (e.renderedError === void 0 ||
|
|
773
|
+
return (e.renderedError === void 0 || U(e.renderedError)) && (e.reason === "conversation_error" || e.reason === "attachment_error" || e.reason === "history_error" || e.reason === "action_error") && typeof e.errorFingerprint == "string" && /^fnv1a-[0-9a-f]{8}$/.test(e.errorFingerprint) && (e.displayedMessage === void 0 || typeof e.displayedMessage == "string" && e.displayedMessage.length <= 500);
|
|
754
774
|
case "runtime.report_invalid_state_transition":
|
|
755
|
-
return (e.uiInvariant === void 0 || K(e.uiInvariant)) && (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll" ||
|
|
775
|
+
return (e.uiInvariant === void 0 || K(e.uiInvariant)) && (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll" || le(e.reason)) && (e.clientMessageId === void 0 || typeof e.clientMessageId == "string");
|
|
756
776
|
case "runtime.widget_lifecycle":
|
|
757
777
|
return (e.action === "opened" || e.action === "closed" || e.action === "minimized") && typeof e.trigger == "string";
|
|
758
778
|
case "session.load":
|
|
@@ -780,9 +800,9 @@ function Se(s) {
|
|
|
780
800
|
return !1;
|
|
781
801
|
}
|
|
782
802
|
}
|
|
783
|
-
class
|
|
803
|
+
class Ae {
|
|
784
804
|
constructor(e, t, i) {
|
|
785
|
-
this.adapter = t, this.state =
|
|
805
|
+
this.adapter = t, this.state = w(e), this.model = i;
|
|
786
806
|
}
|
|
787
807
|
adapter;
|
|
788
808
|
listeners = {};
|
|
@@ -809,10 +829,10 @@ class _e {
|
|
|
809
829
|
return i.add(t), this.listeners[e] = i, () => i.delete(t);
|
|
810
830
|
}
|
|
811
831
|
getState() {
|
|
812
|
-
const e =
|
|
832
|
+
const e = w(this.state);
|
|
813
833
|
for (const [t, i] of this.submissionPreviews)
|
|
814
834
|
e.messages.some((n) => n.id === t) || (e.messages.push({ ...i.message, attachments: i.message.attachments?.map((n) => ({ ...n })) }), e.segments && (e.segments = [...e.segments, { id: t, userMessageId: t, activityIds: [], outcomeIds: [], collapsed: !1 }]), e.isLoadingSession = !1, i.pending && (e.activeResponseUserMessageId = t, e.pendingMessageStatus = "sending", e.turnPhase = "sending", e.activity = { phase: "submitting", activeItemId: null }), i.error && (e.lastError = i.error, e.lastErrorCode = "message_delivery_failed"));
|
|
815
|
-
return this.stopError && (e.lastError = this.stopError, e.lastErrorCode = "stop_failed"), this.pendingStop ?
|
|
835
|
+
return this.stopError && (e.lastError = this.stopError, e.lastErrorCode = "stop_failed"), this.pendingStop ? ae(e, "", "stopping", this.pendingStop.userMessageIds) : e;
|
|
816
836
|
}
|
|
817
837
|
updateProjection(e, t, i, n, r) {
|
|
818
838
|
if (this.destroyed) return;
|
|
@@ -820,14 +840,14 @@ class _e {
|
|
|
820
840
|
(a.user?.id !== e.user?.id || a.selectionKey !== void 0 && a.selectionKey !== e.selectionKey || a.selectionKey === void 0 && a.sessionId !== null && a.sessionId !== e.sessionId) && (this.cancelPendingSubmissions(), this.submissionPreviews.clear());
|
|
821
841
|
for (const o of e.messages)
|
|
822
842
|
o.role === "user" && this.submissionPreviews.delete(o.id);
|
|
823
|
-
if (this.state =
|
|
843
|
+
if (this.state = w(e), a.user?.id === e.user?.id)
|
|
824
844
|
for (const o of this.state.messages) {
|
|
825
845
|
if (o.role !== "user" || !o.attachments?.length) continue;
|
|
826
|
-
const c = a.messages.find((
|
|
827
|
-
a.sessionId !== e.sessionId && !(a.sessionId === null && c) || (o.attachments =
|
|
846
|
+
const c = a.messages.find((l) => l.role === "user" && l.id === o.id);
|
|
847
|
+
a.sessionId !== e.sessionId && !(a.sessionId === null && c) || (o.attachments = de(c?.attachments, o.attachments));
|
|
828
848
|
}
|
|
829
849
|
if (t !== void 0 && (this.model = t), i && JSON.stringify(i) !== JSON.stringify(this.sessionHistoryState)) {
|
|
830
|
-
this.sessionHistoryState =
|
|
850
|
+
this.sessionHistoryState = j(i);
|
|
831
851
|
for (const o of this.sessionHistoryListeners)
|
|
832
852
|
o(this.getSessionHistoryState());
|
|
833
853
|
}
|
|
@@ -859,7 +879,7 @@ class _e {
|
|
|
859
879
|
this.dispatch({ type: "runtime.widget_lifecycle", action: e, trigger: t });
|
|
860
880
|
}
|
|
861
881
|
reportOperationTiming(e) {
|
|
862
|
-
!this.destroyed &&
|
|
882
|
+
!this.destroyed && T(e) && this.adapter.dispatch({ type: "runtime.report_operation_timing", timing: e }).catch(() => {
|
|
863
883
|
});
|
|
864
884
|
}
|
|
865
885
|
reportResponseVisibility(e) {
|
|
@@ -876,12 +896,12 @@ class _e {
|
|
|
876
896
|
});
|
|
877
897
|
}
|
|
878
898
|
reportDisplayedError(e, t, i, n) {
|
|
879
|
-
n !== void 0 && !
|
|
899
|
+
n !== void 0 && !U(n) || this.adapter.dispatch({
|
|
880
900
|
type: "runtime.report_displayed_error",
|
|
881
901
|
reason: e,
|
|
882
902
|
errorFingerprint: t,
|
|
883
903
|
...n ? { renderedError: n } : {},
|
|
884
|
-
...i ? { displayedMessage:
|
|
904
|
+
...i ? { displayedMessage: oe(i) } : {}
|
|
885
905
|
}).catch(() => {
|
|
886
906
|
});
|
|
887
907
|
}
|
|
@@ -890,12 +910,12 @@ class _e {
|
|
|
890
910
|
if (!i && n.length === 0) return Promise.resolve(null);
|
|
891
911
|
this.pendingStop = null, this.stopError = null;
|
|
892
912
|
const r = t.clientMessageId ?? (t.proactiveSuggestionQuestion && this.stagedProactiveSuggestionClientMessageId ? this.stagedProactiveSuggestionClientMessageId : crypto.randomUUID()), a = t.submittedAt ?? Date.now(), o = this.submissionGeneration;
|
|
893
|
-
this.pendingTransfers.set(r, n.flatMap((
|
|
913
|
+
this.pendingTransfers.set(r, n.flatMap((l) => l.id ? [l.id] : [])), this.submissionPreviews.set(r, { pending: !0, message: {
|
|
894
914
|
id: r,
|
|
895
915
|
role: "user",
|
|
896
916
|
content: i,
|
|
897
917
|
createdAt: "",
|
|
898
|
-
attachments: n.map((
|
|
918
|
+
attachments: n.map((l) => ({ ...l }))
|
|
899
919
|
} });
|
|
900
920
|
const c = this.sendMessageNow(i, { ...t, clientMessageId: r, submittedAt: a }, o);
|
|
901
921
|
return this.emit("state", this.getState()), c.finally(() => {
|
|
@@ -903,8 +923,8 @@ class _e {
|
|
|
903
923
|
});
|
|
904
924
|
}
|
|
905
925
|
async sendMessageNow(e, t, i) {
|
|
906
|
-
const n = e, r = t.clientMessageId, a =
|
|
907
|
-
i === this.submissionGeneration && this.reportOperationTiming(
|
|
926
|
+
const n = e, r = t.clientMessageId, a = k((l) => {
|
|
927
|
+
i === this.submissionGeneration && this.reportOperationTiming(l);
|
|
908
928
|
}, {
|
|
909
929
|
operation: "send",
|
|
910
930
|
layer: "renderer",
|
|
@@ -917,7 +937,7 @@ class _e {
|
|
|
917
937
|
if (i !== this.submissionGeneration) return null;
|
|
918
938
|
try {
|
|
919
939
|
if (!await a.measure("staging_ipc", async () => {
|
|
920
|
-
const
|
|
940
|
+
const d = await this.enqueueOperation(async () => this.destroyed || i !== this.submissionGeneration ? null : { result: this.adapter.dispatch({
|
|
921
941
|
type: "conversation.stage",
|
|
922
942
|
initiatedBy: t.initiatedBy,
|
|
923
943
|
invocation: t.invocation,
|
|
@@ -926,25 +946,25 @@ class _e {
|
|
|
926
946
|
clientMessageId: r,
|
|
927
947
|
proactiveSuggestionQuestion: t.proactiveSuggestionQuestion,
|
|
928
948
|
// Preview URLs belong to the renderer's optimistic snapshot and are not valid runtime-command metadata.
|
|
929
|
-
attachments: o.length > 0 ? o.map(
|
|
949
|
+
attachments: o.length > 0 ? o.map(q) : void 0,
|
|
930
950
|
submittedAt: t.submittedAt
|
|
931
951
|
}) });
|
|
932
|
-
return
|
|
952
|
+
return d ? (await d.result, d) : null;
|
|
933
953
|
}) || i !== this.submissionGeneration) return null;
|
|
934
954
|
if (c = !0, o.length > 0) {
|
|
935
955
|
if (!this.adapter.uploadAttachment)
|
|
936
956
|
throw new Error("The runtime does not support attachments.");
|
|
937
|
-
const
|
|
957
|
+
const d = [];
|
|
938
958
|
for (const u of o) {
|
|
939
959
|
if (u.sandboxPath || u.storageKey) {
|
|
940
|
-
|
|
960
|
+
d.push(u);
|
|
941
961
|
continue;
|
|
942
962
|
}
|
|
943
|
-
const
|
|
944
|
-
if (!
|
|
945
|
-
if (
|
|
963
|
+
const M = u.id ? this.attachmentFiles.get(u.id) : void 0;
|
|
964
|
+
if (!M) throw new Error(`Attachment bytes are unavailable for ${u.name}`);
|
|
965
|
+
if (d.push(await a.measure("attachment_transfer", () => this.adapter.uploadAttachment(M, u, { clientMessageId: r }))), i !== this.submissionGeneration) return null;
|
|
946
966
|
}
|
|
947
|
-
o =
|
|
967
|
+
o = d;
|
|
948
968
|
}
|
|
949
969
|
const p = await a.measure("send_ipc", () => this.adapter.dispatch({
|
|
950
970
|
type: "conversation.send",
|
|
@@ -954,23 +974,23 @@ class _e {
|
|
|
954
974
|
invocation: t.invocation,
|
|
955
975
|
proactiveSuggestionQuestion: t.proactiveSuggestionQuestion,
|
|
956
976
|
...t.automationOnboarding ? { automationOnboarding: !0 } : {},
|
|
957
|
-
attachments: o.length > 0 ? o.map(
|
|
977
|
+
attachments: o.length > 0 ? o.map(q) : void 0
|
|
958
978
|
}));
|
|
959
979
|
if (i !== this.submissionGeneration) return null;
|
|
960
|
-
for (const
|
|
961
|
-
|
|
980
|
+
for (const d of t.attachments ?? [])
|
|
981
|
+
d.id && this.attachmentFiles.delete(d.id);
|
|
962
982
|
return r === this.stagedProactiveSuggestionClientMessageId && (this.stagedProactiveSuggestionClientMessageId = null), p?.clientMessageId ?? r;
|
|
963
|
-
} catch (
|
|
983
|
+
} catch (l) {
|
|
964
984
|
if (i !== this.submissionGeneration) return null;
|
|
965
|
-
if (
|
|
966
|
-
for (const
|
|
967
|
-
|
|
985
|
+
if (B(l))
|
|
986
|
+
for (const d of t.attachments ?? [])
|
|
987
|
+
d.id && this.attachmentFiles.delete(d.id);
|
|
968
988
|
const p = this.submissionPreviews.get(r);
|
|
969
|
-
throw p && (p.pending = !1, p.error =
|
|
989
|
+
throw p && (p.pending = !1, p.error = I(l).message, this.emit("state", this.getState())), c && await this.adapter.dispatch({
|
|
970
990
|
type: "conversation.fail_staged",
|
|
971
991
|
clientMessageId: r,
|
|
972
|
-
message:
|
|
973
|
-
}),
|
|
992
|
+
message: I(l).message
|
|
993
|
+
}), l;
|
|
974
994
|
}
|
|
975
995
|
}
|
|
976
996
|
getModel() {
|
|
@@ -998,7 +1018,7 @@ class _e {
|
|
|
998
1018
|
...t,
|
|
999
1019
|
e.activeResponseUserMessageId,
|
|
1000
1020
|
e.messages.filter((o) => o.role === "user").slice(-1)[0]?.id
|
|
1001
|
-
].filter((o) => !!o))], n =
|
|
1021
|
+
].filter((o) => !!o))], n = k((o) => this.reportOperationTiming(o), {
|
|
1002
1022
|
operation: "stop",
|
|
1003
1023
|
layer: "renderer",
|
|
1004
1024
|
requestId: crypto.randomUUID(),
|
|
@@ -1009,7 +1029,7 @@ class _e {
|
|
|
1009
1029
|
const r = { userMessageIds: i, promise: Promise.resolve() };
|
|
1010
1030
|
this.pendingStop = r, r.promise = n.measure("stop_ipc", () => this.adapter.dispatch({ type: "run.stop", ...t.length ? { clientMessageIds: t } : {} })).then(() => {
|
|
1011
1031
|
}, (o) => {
|
|
1012
|
-
this.pendingStop === r && (this.stopError = o
|
|
1032
|
+
this.pendingStop === r && (this.stopError = I(o).message);
|
|
1013
1033
|
}).finally(() => {
|
|
1014
1034
|
this.pendingStop === r && (this.pendingStop = null, this.emit("state", this.getState()));
|
|
1015
1035
|
}), this.emit("state", this.getState());
|
|
@@ -1043,7 +1063,7 @@ class _e {
|
|
|
1043
1063
|
return t.sessionHistoryPage;
|
|
1044
1064
|
}
|
|
1045
1065
|
getSessionHistoryState() {
|
|
1046
|
-
return
|
|
1066
|
+
return j(this.sessionHistoryState);
|
|
1047
1067
|
}
|
|
1048
1068
|
subscribeSessionHistory(e) {
|
|
1049
1069
|
return this.sessionHistoryListeners.add(e), e(this.getSessionHistoryState()), () => this.sessionHistoryListeners.delete(e);
|
|
@@ -1122,7 +1142,7 @@ class _e {
|
|
|
1122
1142
|
for (const n of i ?? []) n(t);
|
|
1123
1143
|
}
|
|
1124
1144
|
}
|
|
1125
|
-
function
|
|
1145
|
+
function de(s, e) {
|
|
1126
1146
|
if (!e || !s) return e;
|
|
1127
1147
|
const t = /* @__PURE__ */ new Map();
|
|
1128
1148
|
for (const i of s) {
|
|
@@ -1134,7 +1154,7 @@ function ce(s, e) {
|
|
|
1134
1154
|
return n ? { ...i, previewUrl: n } : i;
|
|
1135
1155
|
});
|
|
1136
1156
|
}
|
|
1137
|
-
function
|
|
1157
|
+
function w(s) {
|
|
1138
1158
|
return {
|
|
1139
1159
|
...s,
|
|
1140
1160
|
starterPrompts: [...s.starterPrompts],
|
|
@@ -1158,36 +1178,36 @@ function I(s) {
|
|
|
1158
1178
|
activeScheduledFollowUps: s.activeScheduledFollowUps?.map((e) => ({ ...e })) ?? null
|
|
1159
1179
|
};
|
|
1160
1180
|
}
|
|
1161
|
-
function
|
|
1181
|
+
function j(s) {
|
|
1162
1182
|
return {
|
|
1163
1183
|
...s,
|
|
1164
1184
|
data: s.data ? m({
|
|
1165
|
-
entities:
|
|
1185
|
+
entities: F(s.data).map((e) => ({ ...e })),
|
|
1166
1186
|
nextCursor: s.data.nextCursor
|
|
1167
1187
|
}) : null
|
|
1168
1188
|
};
|
|
1169
1189
|
}
|
|
1170
1190
|
export {
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1191
|
+
Q as PRODUCT_AGENT_AUTH_RECONNECTING_ERROR_MESSAGE,
|
|
1192
|
+
ve as ProductAgentInteractionManager,
|
|
1193
|
+
O as ProductAgentQueryController,
|
|
1194
|
+
Ae as ProductAgentRemoteRuntimeClient,
|
|
1195
|
+
ye as ProductAgentSessionHistoryManager,
|
|
1196
|
+
Se as ProductAgentTaskPageTitleController,
|
|
1197
|
+
fe as canSubmitPersonalProductAgentMessage,
|
|
1198
|
+
be as createLocalStorageInteractionDecisionStorage,
|
|
1179
1199
|
f as createProductAgentQueryState,
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1200
|
+
_e as createProductAgentTaskPageTitleDocument,
|
|
1201
|
+
W as formatProductAgentTaskPageTitle,
|
|
1202
|
+
he as hasProductAgentPaidCreditFallback,
|
|
1203
|
+
B as isProductAgentAuthReconnectError,
|
|
1204
|
+
Ie as isProductAgentRuntimeCommand,
|
|
1205
|
+
$ as mergeProductAgentEntityPages,
|
|
1186
1206
|
m as normalizeProductAgentEntityPage,
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1207
|
+
V as readLocalStorageInteractionDecisions,
|
|
1208
|
+
pe as reconcileProductAgentSubmissionGate,
|
|
1209
|
+
ge as resolveProductAgentBillingPresentation,
|
|
1210
|
+
me as resolveProductAgentComposerAction,
|
|
1211
|
+
ue as resolveProductAgentWidgetPresentation,
|
|
1212
|
+
F as selectProductAgentQueryEntities
|
|
1193
1213
|
};
|