@pluno/product-agent-web 0.1.291 → 0.1.293
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/directoryAdapters.d.ts +1 -0
- package/dist/core/model-selection/commands.d.ts +3 -0
- package/dist/core/model-selection/contracts.d.ts +1 -1
- package/dist/core/model-selection/selectors.d.ts +1 -1
- package/dist/core/session-directory/contracts.d.ts +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/modelSelection.d.ts +43 -30
- package/dist/product-agent-runtime.cjs +1 -1
- package/dist/product-agent-runtime.js +216 -206
- package/dist/product-agent-sdk.js +2096 -2067
- package/dist/product-agent-widget.js +3201 -3184
- package/dist/public/operationRoutes.d.ts +1 -0
- package/dist/runtime/modelSelection.d.ts +1 -1
- package/dist/runtimeClient.d.ts +2 -0
- package/dist/widget.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
function
|
|
1
|
+
function we(i, e) {
|
|
2
2
|
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"] } : i ?? { allowed: !0, reason: "allowed", actions: [] };
|
|
3
3
|
}
|
|
4
|
-
function
|
|
4
|
+
function S(i) {
|
|
5
5
|
return {
|
|
6
6
|
key: i,
|
|
7
7
|
status: "not_requested",
|
|
@@ -11,9 +11,9 @@ function _(i) {
|
|
|
11
11
|
updatedAt: null
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
class
|
|
14
|
+
class O {
|
|
15
15
|
constructor(e, t, s = (n, r) => r) {
|
|
16
|
-
this.loader = t, this.merge = s, this.state =
|
|
16
|
+
this.loader = t, this.merge = s, this.state = S(e);
|
|
17
17
|
}
|
|
18
18
|
loader;
|
|
19
19
|
merge;
|
|
@@ -28,10 +28,10 @@ class q {
|
|
|
28
28
|
return this.listeners.add(e), e(this.state), () => this.listeners.delete(e);
|
|
29
29
|
}
|
|
30
30
|
setKey(e) {
|
|
31
|
-
e !== this.state.key && (this.state =
|
|
31
|
+
e !== this.state.key && (this.state = S(e), this.trailingLoad = null, this.publish());
|
|
32
32
|
}
|
|
33
33
|
reset() {
|
|
34
|
-
this.state =
|
|
34
|
+
this.state = S(this.state.key), this.trailingLoad = null, this.publish();
|
|
35
35
|
}
|
|
36
36
|
invalidate() {
|
|
37
37
|
this.state = {
|
|
@@ -86,7 +86,7 @@ class q {
|
|
|
86
86
|
for (const e of this.listeners) e(this.state);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function w(i) {
|
|
90
90
|
const e = {}, t = [];
|
|
91
91
|
for (const s of i.entities)
|
|
92
92
|
e[s.id] || t.push(s.id), e[s.id] = s;
|
|
@@ -96,28 +96,28 @@ function I(i) {
|
|
|
96
96
|
nextCursor: i.nextCursor
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function J(i, e, t) {
|
|
100
100
|
if (t === "replace" || i === null) return e;
|
|
101
101
|
const s = { ...i.entitiesById, ...e.entitiesById }, n = [...i.ids];
|
|
102
102
|
for (const r of e.ids)
|
|
103
103
|
i.entitiesById[r] || n.push(r);
|
|
104
104
|
return { entitiesById: s, ids: n, nextCursor: e.nextCursor };
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function W(i) {
|
|
107
107
|
return i ? i.ids.map((e) => i.entitiesById[e]).filter((e) => !!e) : [];
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function Ae(i) {
|
|
110
110
|
return i.visible ? i.minimized ? { state: "minimized" } : { state: i.open ? "visible_open" : "visible_closed" } : { state: "hidden" };
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function Me(i) {
|
|
113
113
|
if (!i || typeof i != "object") return !1;
|
|
114
114
|
const e = i.paidCreditFallbackModel;
|
|
115
115
|
return typeof e == "string" && e.length > 0;
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function Ee(i) {
|
|
118
118
|
return i ? i.submissionGate?.allowed === !1 ? ["credits_exhausted", "payment_issue", "onboarding_required"].includes(i.submissionGate.reason) ? { state: "action_required", reason: i.submissionGate.reason } : { state: "hidden" } : i.usingPaidCreditFallback === !0 ? { state: "paid_credit_fallback" } : i.creditLimit !== null && i.creditLimit > 0 && i.creditsRemaining !== null && i.creditsRemaining > 0 && i.creditsRemaining / i.creditLimit <= 0.2 ? { state: "low_credits" } : i.creditsUsed !== null ? { state: "usage" } : { state: "hidden" } : { state: "hidden" };
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function Te(i) {
|
|
121
121
|
return i.submissionAllowed && i.isAuthenticated && i.hasWorkspace && !i.isWebsiteBlocked && i.isCurrentPageResolved && !i.isSubmitting && !i.hasPendingMessage;
|
|
122
122
|
}
|
|
123
123
|
function Pe(i) {
|
|
@@ -130,24 +130,24 @@ function Pe(i) {
|
|
|
130
130
|
disabled: !e || !i.canSubmitMessage
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
|
-
const
|
|
134
|
-
function
|
|
135
|
-
return (i instanceof Error ? i.message : i) ===
|
|
133
|
+
const Y = "Pluno is reconnecting. Try again in a moment.";
|
|
134
|
+
function C(i) {
|
|
135
|
+
return (i instanceof Error ? i.message : i) === Y;
|
|
136
136
|
}
|
|
137
|
-
class
|
|
137
|
+
class Re {
|
|
138
138
|
constructor(e, t, s = 20) {
|
|
139
|
-
this.loadPage = t, this.limit = s, this.recentQuery = new
|
|
139
|
+
this.loadPage = t, this.limit = s, this.recentQuery = new O(
|
|
140
140
|
`${e}:recent`,
|
|
141
|
-
async ({ cursor: n }) =>
|
|
141
|
+
async ({ cursor: n }) => w(
|
|
142
142
|
await this.loadPage({ cursor: n, limit: this.limit, pinned: !1 }).then((r) => ({
|
|
143
143
|
entities: r.sessions,
|
|
144
144
|
nextCursor: r.nextCursor
|
|
145
145
|
}))
|
|
146
146
|
),
|
|
147
|
-
|
|
148
|
-
), this.pinnedQuery = new
|
|
147
|
+
J
|
|
148
|
+
), this.pinnedQuery = new O(
|
|
149
149
|
`${e}:pinned`,
|
|
150
|
-
async () =>
|
|
150
|
+
async () => w({
|
|
151
151
|
entities: await this.loadAllPinned(),
|
|
152
152
|
nextCursor: null
|
|
153
153
|
})
|
|
@@ -167,17 +167,17 @@ class Te {
|
|
|
167
167
|
activityReconciliationScheduled = !1;
|
|
168
168
|
getState() {
|
|
169
169
|
const e = this.recentQuery.getState(), t = this.pinnedQuery.getState(), s = [
|
|
170
|
-
...
|
|
171
|
-
...
|
|
170
|
+
..._(t.data),
|
|
171
|
+
..._(e.data)
|
|
172
172
|
], n = new Map(s.map((c) => [c.id, c])), r = Array.from(n.values()).map(
|
|
173
173
|
(c) => this.applyOverrides(c, this.completedRefreshSequence)
|
|
174
|
-
), o = Array.from(this.optimisticEntities.values()).filter((c) => !n.has(c.id)).reverse(), a = e.data || t.data || o.length > 0 ?
|
|
174
|
+
), o = Array.from(this.optimisticEntities.values()).filter((c) => !n.has(c.id)).reverse(), a = e.data || t.data || o.length > 0 ? w({
|
|
175
175
|
entities: [...o, ...r],
|
|
176
176
|
nextCursor: e.data?.nextCursor ?? null
|
|
177
177
|
}) : null;
|
|
178
178
|
return {
|
|
179
179
|
key: e.key.slice(0, -7),
|
|
180
|
-
status:
|
|
180
|
+
status: X(e, t),
|
|
181
181
|
data: a,
|
|
182
182
|
error: e.error ?? t.error,
|
|
183
183
|
requestId: Math.max(e.requestId, t.requestId),
|
|
@@ -243,8 +243,8 @@ class Te {
|
|
|
243
243
|
}
|
|
244
244
|
reconcileDurableEntities() {
|
|
245
245
|
const e = [
|
|
246
|
-
...
|
|
247
|
-
...
|
|
246
|
+
..._(this.pinnedQuery.getState().data),
|
|
247
|
+
..._(this.recentQuery.getState().data)
|
|
248
248
|
], t = new Set(e.map((s) => s.id));
|
|
249
249
|
for (const s of this.optimisticEntities.keys())
|
|
250
250
|
t.has(s) && this.optimisticEntities.delete(s);
|
|
@@ -283,44 +283,44 @@ class Te {
|
|
|
283
283
|
for (const e of this.listeners) e(this.getState());
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
|
-
function
|
|
286
|
+
function _(i) {
|
|
287
287
|
return i ? i.ids.map((e) => i.entitiesById[e]).filter((e) => !!e) : [];
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function X(i, e) {
|
|
290
290
|
return i.status === "error" || e.status === "error" ? "error" : i.status === "loading" || e.status === "loading" ? "loading" : i.status === "refreshing" || e.status === "refreshing" ? "refreshing" : i.status === "loading_more" ? "loading_more" : i.status === "ready" || e.status === "ready" ? "ready" : "not_requested";
|
|
291
291
|
}
|
|
292
|
-
function
|
|
292
|
+
function x(i) {
|
|
293
293
|
const e = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(?:\.(\d{1,6}))?(?:Z|\+00:00)$/.exec(i);
|
|
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 A(i) {
|
|
298
298
|
if (i === null || typeof i == "string" || typeof i == "boolean") return !0;
|
|
299
299
|
if (typeof i == "number") return Number.isFinite(i);
|
|
300
|
-
if (Array.isArray(i)) return i.every(
|
|
300
|
+
if (Array.isArray(i)) return i.every(A);
|
|
301
301
|
if (typeof i != "object") return !1;
|
|
302
302
|
const e = Object.getPrototypeOf(i);
|
|
303
|
-
return e !== Object.prototype && e !== null ? !1 : Object.values(i).every(
|
|
303
|
+
return e !== Object.prototype && e !== null ? !1 : Object.values(i).every(A);
|
|
304
304
|
}
|
|
305
|
-
function
|
|
306
|
-
return i !== null && typeof i == "object" && !Object.isFrozen(i) && (Object.values(i).forEach(
|
|
305
|
+
function L(i) {
|
|
306
|
+
return i !== null && typeof i == "object" && !Object.isFrozen(i) && (Object.values(i).forEach(L), Object.freeze(i)), i;
|
|
307
307
|
}
|
|
308
|
-
function
|
|
309
|
-
if (!
|
|
308
|
+
function ee(i) {
|
|
309
|
+
if (!A(i)) throw new Error("Conversation inputs must be JSON-safe values.");
|
|
310
310
|
return JSON.parse(JSON.stringify(i));
|
|
311
311
|
}
|
|
312
|
-
function
|
|
312
|
+
function te(i, e) {
|
|
313
313
|
if (!e) return !1;
|
|
314
314
|
const t = i.executionByUserMessage[e];
|
|
315
315
|
if (t) return ["completed", "stopped", "failed"].includes(t.phase);
|
|
316
|
-
const s = Object.values(i.items).sort((r, o) =>
|
|
316
|
+
const s = Object.values(i.items).sort((r, o) => x(r.created_at).localeCompare(x(o.created_at)) || r.id.localeCompare(o.id));
|
|
317
317
|
let n = !1;
|
|
318
318
|
for (const r of s)
|
|
319
319
|
if (r.type === "user_message" && (n = r.id === e), !!n && (r.type === "stopped" || r.type === "error" || r.type === "final_response" && i.streams[r.id]?.state === "finished" && i.streams[r.id].revision >= r.data.revision))
|
|
320
320
|
return !0;
|
|
321
321
|
return !1;
|
|
322
322
|
}
|
|
323
|
-
class
|
|
323
|
+
class ke {
|
|
324
324
|
constructor(e, t = null) {
|
|
325
325
|
this.storage = e, t && (this.decisions = new Map(
|
|
326
326
|
t.filter(P).map((s) => [this.getDecisionKey(s), s])
|
|
@@ -345,7 +345,7 @@ class Re {
|
|
|
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, o = n?.payload.kind === "sharing" && t.payload.kind === "sharing" ? { ...t.payload, variant: n.payload.variant } : t.payload;
|
|
348
|
-
this.sources.set(s,
|
|
348
|
+
this.sources.set(s, L(ee({ ...t, lifecycle: r, payload: o }))), t.payload.kind === "integration_auth" && this.invalidateAuth(t.payload.request_id);
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
351
|
/** @internal */
|
|
@@ -371,7 +371,7 @@ class Re {
|
|
|
371
371
|
userPrompt: a?.type === "user_message" ? a.data.content : "",
|
|
372
372
|
assistantAnswer: ""
|
|
373
373
|
},
|
|
374
|
-
terminal: !o.wait_for_terminal ||
|
|
374
|
+
terminal: !o.wait_for_terminal || te(s, r.user_message_id)
|
|
375
375
|
};
|
|
376
376
|
} else o.kind === "integration_auth" ? t.integrations.push({
|
|
377
377
|
revision: r.version,
|
|
@@ -463,29 +463,29 @@ class Re {
|
|
|
463
463
|
return null;
|
|
464
464
|
}
|
|
465
465
|
getDecisionKey(e) {
|
|
466
|
-
const t =
|
|
466
|
+
const t = E(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(e.scope)}:interaction:${e.key}`;
|
|
471
471
|
}
|
|
472
472
|
getCategoryKey(e) {
|
|
473
|
-
return `${
|
|
473
|
+
return `${E(e.scope)}:category:${e.category}`;
|
|
474
474
|
}
|
|
475
475
|
}
|
|
476
|
-
function
|
|
476
|
+
function qe(i, e) {
|
|
477
477
|
return {
|
|
478
|
-
load: async () =>
|
|
478
|
+
load: async () => se(i, e),
|
|
479
479
|
save: async (t) => i.setItem(e, JSON.stringify(t))
|
|
480
480
|
};
|
|
481
481
|
}
|
|
482
|
-
function
|
|
482
|
+
function se(i, e) {
|
|
483
483
|
const t = i.getItem(e);
|
|
484
484
|
if (!t) return [];
|
|
485
485
|
const s = JSON.parse(t);
|
|
486
486
|
return Array.isArray(s) ? s.filter(P) : [];
|
|
487
487
|
}
|
|
488
|
-
function
|
|
488
|
+
function E(i) {
|
|
489
489
|
return `${i.level}:${i.key}`;
|
|
490
490
|
}
|
|
491
491
|
function U(i) {
|
|
@@ -496,18 +496,18 @@ function P(i) {
|
|
|
496
496
|
const e = i;
|
|
497
497
|
return typeof e.promptKey == "string" && typeof e.category == "string" && typeof e.decidedAt == "string" && (e.nextEligibleAt === null || typeof e.nextEligibleAt == "string") && U(e.action) && !!(e.scope && typeof e.scope == "object" && typeof e.scope.level == "string" && typeof e.scope.key == "string");
|
|
498
498
|
}
|
|
499
|
-
const
|
|
499
|
+
const ie = {
|
|
500
500
|
working: "⏳",
|
|
501
501
|
completed: "✅",
|
|
502
502
|
failed: "❗",
|
|
503
503
|
stopped: "⏹️"
|
|
504
|
-
},
|
|
505
|
-
function
|
|
506
|
-
if (!e) return
|
|
507
|
-
const t =
|
|
504
|
+
}, ne = /^(?:⌛|⏳|✅|❗|⏹️) Pluno(?:: )?/;
|
|
505
|
+
function re(i, e) {
|
|
506
|
+
if (!e) return M(i);
|
|
507
|
+
const t = M(i), s = `${ie[e]} Pluno`;
|
|
508
508
|
return t ? `${s}: ${t}` : s;
|
|
509
509
|
}
|
|
510
|
-
class
|
|
510
|
+
class Oe {
|
|
511
511
|
constructor(e) {
|
|
512
512
|
this.titleDocument = e;
|
|
513
513
|
}
|
|
@@ -529,10 +529,10 @@ class qe {
|
|
|
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 = M(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, s = this.lastAppliedTitle === null ?
|
|
535
|
+
const e = this.titleDocument.getTitle(), t = this.lastAppliedTitle !== null && e === this.lastAppliedTitle, s = this.lastAppliedTitle === null ? M(e) : e;
|
|
536
536
|
this.status = null, this.lastAppliedTitle = null, this.stopObserving?.(), this.stopObserving = null, t ? this.titleDocument.setTitle(this.baseTitle) : s !== e && this.titleDocument.setTitle(s);
|
|
537
537
|
}
|
|
538
538
|
handleTitleChanged() {
|
|
@@ -541,11 +541,11 @@ class qe {
|
|
|
541
541
|
applyTitle() {
|
|
542
542
|
if (!this.status)
|
|
543
543
|
return;
|
|
544
|
-
const e =
|
|
544
|
+
const e = re(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 Ce(i) {
|
|
549
549
|
return {
|
|
550
550
|
getTitle: () => i.title,
|
|
551
551
|
setTitle: (e) => {
|
|
@@ -561,13 +561,13 @@ function Oe(i) {
|
|
|
561
561
|
}
|
|
562
562
|
};
|
|
563
563
|
}
|
|
564
|
-
function
|
|
565
|
-
return i.replace(
|
|
564
|
+
function M(i) {
|
|
565
|
+
return i.replace(ne, "");
|
|
566
566
|
}
|
|
567
|
-
const
|
|
568
|
-
version:
|
|
567
|
+
const oe = "0.1.293", ae = {
|
|
568
|
+
version: oe
|
|
569
569
|
}, g = (i) => typeof i == "string" && /^[a-zA-Z0-9:_.-]{1,160}$/.test(i) ? i : null;
|
|
570
|
-
function
|
|
570
|
+
function de(i) {
|
|
571
571
|
if (!i || typeof i != "object") return !1;
|
|
572
572
|
const e = i, t = (n) => Number.isSafeInteger(n) && n >= 0, s = (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) && g(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 || g(r) !== null) && (n.projectionReady === null || typeof n.projectionReady == "boolean");
|
|
573
573
|
return Object.keys(e).every((n) => ["ownerId", "revision", "dropped", "lastIntent", "lastSelection", "transitions"].includes(n)) && g(e.ownerId) !== null && t(e.revision) && t(e.dropped) && (e.lastIntent == null || s(e.lastIntent)) && (e.lastSelection === null || s(e.lastSelection)) && Array.isArray(e.transitions) && e.transitions.length <= 16 && e.transitions.every(s);
|
|
@@ -577,60 +577,60 @@ function F(i) {
|
|
|
577
577
|
const e = i;
|
|
578
578
|
return Object.keys(e).every((t) => ["sessionId", "episodeId", "consecutiveFailures", "transportCode", "requestId", "durationMs"].includes(t)) && typeof e.sessionId == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(e.sessionId) && typeof e.episodeId == "string" && /^[a-zA-Z0-9:_-]{1,500}$/.test(e.episodeId) && (e.transportCode === void 0 || typeof e.transportCode == "string" && /^[a-z0-9_]{1,80}$/.test(e.transportCode)) && (e.requestId === void 0 || typeof e.requestId == "string" && /^[a-zA-Z0-9_-]{1,160}$/.test(e.requestId)) && (e.durationMs === void 0 || typeof e.durationMs == "number" && Number.isFinite(e.durationMs) && e.durationMs >= 0) && Number.isSafeInteger(e.consecutiveFailures) && e.consecutiveFailures >= 1;
|
|
579
579
|
}
|
|
580
|
-
const
|
|
581
|
-
function
|
|
580
|
+
const D = ["messageKeys", "canonicalItemKeys", "terminalResponseKeys", "toolCallKeys", "activeResponseKeys"], R = (i) => typeof i == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(i), y = (i) => i === null || R(i), ce = (i) => typeof i == "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?(?:Z|\+00:00)$/.test(i) && Number.isFinite(Date.parse(i));
|
|
581
|
+
function G(i) {
|
|
582
582
|
if (!i || typeof i != "object") return !1;
|
|
583
583
|
const e = i;
|
|
584
|
-
return Object.keys(i).every((t) => ["sessionId", "itemId", "userMessageId", "createdAt", "runId", "retryable"].includes(t)) &&
|
|
584
|
+
return Object.keys(i).every((t) => ["sessionId", "itemId", "userMessageId", "createdAt", "runId", "retryable"].includes(t)) && y(e.sessionId) && R(e.itemId) && y(e.userMessageId) && (e.retryable === void 0 || typeof e.retryable == "boolean") && y(e.runId) && (e.createdAt === null || ce(e.createdAt));
|
|
585
585
|
}
|
|
586
|
-
function
|
|
586
|
+
function le(i) {
|
|
587
587
|
if (!i || typeof i != "object") return !1;
|
|
588
588
|
const e = i, t = (s) => Number.isSafeInteger(s) && s >= 0;
|
|
589
|
-
return Object.keys(e).every((s) => ["capturedAt", "selectionKey", "userId", "loading", "draft", "thinking", "connected", "hasError", "phase", "queryStatus", "queryRequestId", "queryUpdatedAt", "renderSource", "selectionFencePending", "guardCreatedAt", "owner", "sdkVersion", "presentationGate", "firstObservedAt", "confirmationMs"].includes(s)) && t(e.capturedAt) && [e.queryUpdatedAt, e.guardCreatedAt].every((s) => s === null || t(s)) && [e.selectionKey, e.userId, e.phase, e.queryStatus, e.queryRequestId].every((s) => s === null || g(s) !== null) && [e.loading, e.draft, e.thinking, e.connected, e.hasError, e.selectionFencePending].every((s) => typeof s == "boolean") && ["state", "account", "interactions", "local", "sidepanel_layout", "observer"].includes(e.renderSource) && (e.owner === void 0 ||
|
|
589
|
+
return Object.keys(e).every((s) => ["capturedAt", "selectionKey", "userId", "loading", "draft", "thinking", "connected", "hasError", "phase", "queryStatus", "queryRequestId", "queryUpdatedAt", "renderSource", "selectionFencePending", "guardCreatedAt", "owner", "sdkVersion", "presentationGate", "firstObservedAt", "confirmationMs"].includes(s)) && t(e.capturedAt) && [e.queryUpdatedAt, e.guardCreatedAt].every((s) => s === null || t(s)) && [e.selectionKey, e.userId, e.phase, e.queryStatus, e.queryRequestId].every((s) => s === null || g(s) !== null) && [e.loading, e.draft, e.thinking, e.connected, e.hasError, e.selectionFencePending].every((s) => typeof s == "boolean") && ["state", "account", "interactions", "local", "sidepanel_layout", "observer"].includes(e.renderSource) && (e.owner === void 0 || de(e.owner)) && (e.sdkVersion === void 0 || typeof e.sdkVersion == "string" && e.sdkVersion.length <= 32 && /^\d+\.\d+\.\d+(?:[-+][a-zA-Z0-9.-]+)?$/.test(e.sdkVersion)) && (e.presentationGate === void 0 || ["none", "authentication", "signup"].includes(e.presentationGate)) && [e.firstObservedAt, e.confirmationMs].every((s) => s === void 0 || t(s));
|
|
590
590
|
}
|
|
591
|
-
function
|
|
591
|
+
function B(i) {
|
|
592
592
|
if (!i || typeof i != "object" || Object.keys(i).some((s) => s !== "before" && s !== "current")) return !1;
|
|
593
593
|
const e = (s) => {
|
|
594
594
|
if (!s || typeof s != "object") return !1;
|
|
595
595
|
const n = s;
|
|
596
|
-
return Object.keys(s).every((r) => [...
|
|
596
|
+
return Object.keys(s).every((r) => [...D, "sessionId", "runtimeItemCount", "welcome", "truncated", "thinkingSequence", "context", "duplicateToolCalls"].includes(r)) && (n.duplicateToolCalls === void 0 || Array.isArray(n.duplicateToolCalls) && n.duplicateToolCalls.length <= 5 && n.duplicateToolCalls.every((r) => r && Object.keys(r).every((o) => ["key", "count", "rows", "truncated"].includes(o)) && y(r.key) && Number.isSafeInteger(r.count) && r.count >= 2 && typeof r.truncated == "boolean" && Array.isArray(r.rows) && r.rows.length >= 1 && r.rows.length <= 5 && r.rows.length <= r.count && r.rows.every((o) => o && Object.keys(o).every((a) => ["itemId", "groupId"].includes(a)) && y(o.itemId) && y(o.groupId)))) && (n.context === void 0 || le(n.context)) && (n.thinkingSequence === void 0 || Array.isArray(n.thinkingSequence) && n.thinkingSequence.length <= 20 && n.thinkingSequence.every((r) => r === "user" || r === "thinking")) && y(n.sessionId) && Number.isSafeInteger(n.runtimeItemCount) && n.runtimeItemCount >= 0 && typeof n.welcome == "boolean" && typeof n.truncated == "boolean" && D.every((r) => Array.isArray(n[r]) && n[r].length <= 20 && n[r].every(R));
|
|
597
597
|
}, t = i;
|
|
598
598
|
return (t.before === null || e(t.before)) && e(t.current);
|
|
599
599
|
}
|
|
600
|
-
const
|
|
601
|
-
function
|
|
600
|
+
const N = 500;
|
|
601
|
+
function H(i) {
|
|
602
602
|
const e = i.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();
|
|
603
|
-
return e.length >
|
|
603
|
+
return e.length > N ? `${e.slice(0, N - 1)}…` : e;
|
|
604
604
|
}
|
|
605
|
-
function
|
|
605
|
+
function ue(i) {
|
|
606
606
|
let e = 2166136261;
|
|
607
607
|
for (let t = 0; t < i.length; t += 1)
|
|
608
608
|
e ^= i.charCodeAt(t), e = Math.imul(e, 16777619);
|
|
609
609
|
return `fnv1a-${(e >>> 0).toString(16).padStart(8, "0")}`;
|
|
610
610
|
}
|
|
611
|
-
function
|
|
611
|
+
function k(i) {
|
|
612
612
|
if (!i || typeof i != "object") return !1;
|
|
613
613
|
const e = i;
|
|
614
614
|
return Object.keys(i).every((t) => ["boundary", "category", "messageKind"].includes(t)) && ["runtime", "web_transport", "extension_ipc"].includes(e.boundary) && ["error", "object", "null", "array", "string", "undefined", "number", "boolean", "bigint", "symbol", "function"].includes(e.category) && ["object_coercion", "text", "blank", "non_text"].includes(e.messageKind);
|
|
615
615
|
}
|
|
616
|
-
function
|
|
616
|
+
function pe(i) {
|
|
617
617
|
if (!i || typeof i != "object") return !1;
|
|
618
618
|
const e = i;
|
|
619
|
-
return Object.keys(e).every((t) => ["sessionId", "requestId", "code", "normalization", "builds", "clientMessageId"].includes(t)) && (e.clientMessageId === void 0 || g(e.clientMessageId) !== null) && [e.sessionId, e.requestId, e.code].every((t) => t === null || g(t) !== null) && (e.normalization === void 0 ||
|
|
619
|
+
return Object.keys(e).every((t) => ["sessionId", "requestId", "code", "normalization", "builds", "clientMessageId"].includes(t)) && (e.clientMessageId === void 0 || g(e.clientMessageId) !== null) && [e.sessionId, e.requestId, e.code].every((t) => t === null || g(t) !== null) && (e.normalization === void 0 || k(e.normalization)) && !!e.builds && typeof e.builds == "object" && typeof e.builds.sdk == "string" && Object.entries(e.builds).every(([t, s]) => ["sdk", "rendererExtension", "contentExtension", "backgroundExtension"].includes(t) && typeof s == "string" && /^\d{1,5}\.\d{1,5}\.\d{1,5}$/.test(s));
|
|
620
620
|
}
|
|
621
|
-
function
|
|
622
|
-
const r = !s && e === "conversation_error" && t !== void 0 && i.conversationDiagnostics?.errorMessageFingerprint ===
|
|
621
|
+
function he(i, e, t, s, n = {}) {
|
|
622
|
+
const r = !s && e === "conversation_error" && t !== void 0 && i.conversationDiagnostics?.errorMessageFingerprint === ue(H(t)) ? i.conversationDiagnostics : void 0;
|
|
623
623
|
return {
|
|
624
624
|
sessionId: g(i.sessionId),
|
|
625
625
|
requestId: g(r?.httpRequest?.requestId ?? r?.errorRequestId ?? r?.queryRequestId),
|
|
626
626
|
...g(r?.failedClientMessageId) ? { clientMessageId: r.failedClientMessageId } : {},
|
|
627
627
|
code: r ? g(i.lastErrorCode) : null,
|
|
628
|
-
...
|
|
629
|
-
builds: { sdk:
|
|
628
|
+
...k(r?.errorNormalization) ? { normalization: r.errorNormalization } : {},
|
|
629
|
+
builds: { sdk: ae.version, ...n }
|
|
630
630
|
};
|
|
631
631
|
}
|
|
632
|
-
function
|
|
633
|
-
if (i.details !== void 0 && !
|
|
632
|
+
function ge(i) {
|
|
633
|
+
if (i.details !== void 0 && !A(i.details))
|
|
634
634
|
throw new TypeError("Product Agent transported error details must be JSON-safe.");
|
|
635
635
|
return {
|
|
636
636
|
code: i.code,
|
|
@@ -639,11 +639,11 @@ function he(i) {
|
|
|
639
639
|
...i.details === void 0 ? {} : { details: i.details }
|
|
640
640
|
};
|
|
641
641
|
}
|
|
642
|
-
function
|
|
642
|
+
function b(i, e = "runtime_error", t = "runtime") {
|
|
643
643
|
const s = i !== null && typeof i == "object" ? i : null, n = typeof i == "string" ? i : s && "message" in s && typeof s.message == "string" ? s.message : "", r = s && "code" in s && typeof s.code == "string" && s.code.trim() ? s.code : e, o = s && "details" in s ? s.details : null, a = o && typeof o == "object" ? o : {}, c = {
|
|
644
644
|
...typeof a.httpStatus == "number" && Number.isInteger(a.httpStatus) && a.httpStatus >= 100 && a.httpStatus <= 599 ? { httpStatus: a.httpStatus } : {},
|
|
645
645
|
// Preserve the first boundary's shape after normalization replaces the original message/prototype.
|
|
646
|
-
errorNormalization:
|
|
646
|
+
errorNormalization: k(a.errorNormalization) ? a.errorNormalization : {
|
|
647
647
|
boundary: t,
|
|
648
648
|
category: i instanceof Error ? "error" : i === null ? "null" : Array.isArray(i) ? "array" : typeof i,
|
|
649
649
|
messageKind: n.trim() === "[object Object]" ? "object_coercion" : n.trim() ? "text" : typeof i == "string" || s && "message" in s && typeof s.message == "string" ? "blank" : "non_text"
|
|
@@ -656,7 +656,7 @@ function y(i, e = "runtime_error", t = "runtime") {
|
|
|
656
656
|
...typeof a.durationMs == "number" && Number.isFinite(a.durationMs) && a.durationMs >= 0 ? { durationMs: a.durationMs } : {},
|
|
657
657
|
...typeof a.successfulRequests == "number" && Number.isSafeInteger(a.successfulRequests) && a.successfulRequests >= 0 ? { successfulRequests: a.successfulRequests } : {}
|
|
658
658
|
};
|
|
659
|
-
return
|
|
659
|
+
return ge({
|
|
660
660
|
code: r,
|
|
661
661
|
message: n.trim() && n.trim() !== "[object Object]" ? n : "The Product Agent operation failed. Try again.",
|
|
662
662
|
retryable: !!(s && "retryable" in s && s.retryable === !0),
|
|
@@ -687,7 +687,7 @@ function Q(i) {
|
|
|
687
687
|
"upstreamTraceId"
|
|
688
688
|
].includes(s)) && g(e.requestId) !== null && ["GET", "POST", "PUT", "PATCH", "DELETE"].includes(e.method) && ["/api/product-agent/conversations/:sessionId/snapshot", "/api/product-agent/:namespace/commands", "/api/product-agent/:namespace/:operation"].includes(e.route) && (e.status === null || t(e.status) && e.status >= 100 && e.status <= 599) && (e.abortTrigger === null || ["deadline", "transport_disposed", "owner_disposed", "authority_retired", "observation_released", "request_replaced", "caller_cancelled", "unexpected_abort"].includes(e.abortTrigger)) && ["http_deadline", "http_transport", "conversation_query", "browser", "http_response"].includes(e.owner) && (e.category === void 0 || /^[a-z0-9_]{1,80}$/.test(e.category)) && [e.responseHeadersMs, e.responseBodyMs].every((s) => s == null || t(s)) && t(e.elapsedMs) && t(e.attempt) && e.attempt >= 1 && e.attempt <= 10 && [e.queryRequestId, e.ownerId, e.sessionId].every((s) => s === null || g(s) !== null) && (e.authorityGeneration === null || t(e.authorityGeneration)) && typeof e.release == "string" && /^[a-zA-Z0-9._-]{1,80}$/.test(e.release) && [e.upstreamRequestId, e.upstreamTraceId].every((s) => s === null || typeof s == "string" && /^[a-zA-Z0-9_:;=./-]{1,160}$/.test(s));
|
|
689
689
|
}
|
|
690
|
-
const
|
|
690
|
+
const fe = [
|
|
691
691
|
"submit",
|
|
692
692
|
"stop",
|
|
693
693
|
"staging_ipc",
|
|
@@ -750,7 +750,7 @@ const ge = [
|
|
|
750
750
|
"acceptance_applied",
|
|
751
751
|
"cancellation_queue",
|
|
752
752
|
"cancellation_write"
|
|
753
|
-
],
|
|
753
|
+
], V = [
|
|
754
754
|
"request_timed_out",
|
|
755
755
|
"delivery_unknown",
|
|
756
756
|
"invalid_ack",
|
|
@@ -766,20 +766,20 @@ const ge = [
|
|
|
766
766
|
"backend_refusal",
|
|
767
767
|
"unknown"
|
|
768
768
|
];
|
|
769
|
-
function
|
|
769
|
+
function me(i) {
|
|
770
770
|
const e = i, t = e?.code;
|
|
771
|
-
return e?.backendRefusal === !0 ? "backend_refusal" : typeof t == "string" && t !== "backend_refusal" &&
|
|
771
|
+
return e?.backendRefusal === !0 ? "backend_refusal" : typeof t == "string" && t !== "backend_refusal" && V.includes(t) ? t : e?.name === "AbortError" ? "aborted" : e?.name === "TypeError" ? "type_error" : "unknown";
|
|
772
772
|
}
|
|
773
|
-
const
|
|
774
|
-
let
|
|
775
|
-
const
|
|
776
|
-
function
|
|
773
|
+
const Z = Math.random().toString(36).slice(2);
|
|
774
|
+
let ye = 0;
|
|
775
|
+
const j = () => `timing:${Z}:${++ye}`, v = (i) => typeof i == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(i);
|
|
776
|
+
function q(i) {
|
|
777
777
|
if (!i || typeof i != "object") return !1;
|
|
778
778
|
const e = i;
|
|
779
|
-
return Object.keys(e).every((t) => ["entrySurface", "operation", "layer", "stage", "status", "spanId", "requestId", "clientMessageId", "sessionId", "occurredAt", "durationMs", "failureCategory", "tabId", "queueDepth", "workerId"].includes(t)) && (e.tabId === void 0 || Number.isSafeInteger(e.tabId) && e.tabId >= 0) && (e.queueDepth === void 0 || Number.isSafeInteger(e.queueDepth) && e.queueDepth >= 0) && (e.workerId === void 0 ||
|
|
779
|
+
return Object.keys(e).every((t) => ["entrySurface", "operation", "layer", "stage", "status", "spanId", "requestId", "clientMessageId", "sessionId", "occurredAt", "durationMs", "failureCategory", "tabId", "queueDepth", "workerId"].includes(t)) && (e.tabId === void 0 || Number.isSafeInteger(e.tabId) && e.tabId >= 0) && (e.queueDepth === void 0 || Number.isSafeInteger(e.queueDepth) && e.queueDepth >= 0) && (e.workerId === void 0 || v(e.workerId)) && (e.failureCategory === void 0 || e.status === "failed" && V.includes(e.failureCategory)) && (e.entrySurface === void 0 || ["extension_sidepanel", "extension_widget", "main_web_chat", "embedded_widget", "embedded_custom_ui", "automation", "mcp", "whatsapp", "email"].includes(e.entrySurface)) && ["send", "stop"].includes(e.operation) && ["renderer", "sdk", "extension", "http"].includes(e.layer) && fe.includes(e.stage) && ["started", "completed", "failed", "observed"].includes(e.status) && v(e.spanId) && v(e.requestId) && (e.clientMessageId === null || v(e.clientMessageId)) && (e.sessionId === null || v(e.sessionId)) && typeof e.occurredAt == "string" && e.occurredAt.length <= 40 && Number.isFinite(Date.parse(e.occurredAt)) && Number.isSafeInteger(e.durationMs) && e.durationMs >= 0;
|
|
780
780
|
}
|
|
781
|
-
function
|
|
782
|
-
if (e = { workerId:
|
|
781
|
+
function K(i, e) {
|
|
782
|
+
if (e = { workerId: Z, ...e }, !i) return {
|
|
783
783
|
identity: e,
|
|
784
784
|
mark: (n) => {
|
|
785
785
|
},
|
|
@@ -793,16 +793,16 @@ function j(i, e) {
|
|
|
793
793
|
spanId: a,
|
|
794
794
|
occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
795
795
|
durationMs: Math.max(0, Math.round(performance.now() - o)),
|
|
796
|
-
...r === "failed" ? { failureCategory:
|
|
796
|
+
...r === "failed" ? { failureCategory: me(c) } : {}
|
|
797
797
|
};
|
|
798
|
-
i &&
|
|
798
|
+
i && q(d) && Promise.resolve().then(() => i(d)).catch(() => {
|
|
799
799
|
});
|
|
800
800
|
};
|
|
801
801
|
return {
|
|
802
802
|
identity: e,
|
|
803
|
-
mark: (n) => s(n, "observed", t,
|
|
803
|
+
mark: (n) => s(n, "observed", t, j()),
|
|
804
804
|
measure(n, r) {
|
|
805
|
-
const o = performance.now(), a =
|
|
805
|
+
const o = performance.now(), a = j();
|
|
806
806
|
return s(n, "started", o, a), r().then(
|
|
807
807
|
(c) => (s(n, "completed", o, a), c),
|
|
808
808
|
(c) => {
|
|
@@ -812,13 +812,13 @@ function j(i, e) {
|
|
|
812
812
|
}
|
|
813
813
|
};
|
|
814
814
|
}
|
|
815
|
-
const
|
|
816
|
-
function
|
|
815
|
+
const T = (i) => i === null || typeof i == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(i);
|
|
816
|
+
function be(i) {
|
|
817
817
|
if (!i || typeof i != "object") return !1;
|
|
818
818
|
const e = i;
|
|
819
|
-
return typeof e.observedAt == "string" && e.observedAt.length <= 40 && Number.isFinite(Date.parse(e.observedAt)) &&
|
|
819
|
+
return typeof e.observedAt == "string" && e.observedAt.length <= 40 && Number.isFinite(Date.parse(e.observedAt)) && T(e.sessionId) && T(e.responseItemId) && T(e.respondsToUserMessageId) && typeof e.panelVisible == "boolean" && typeof e.documentVisible == "boolean" && typeof e.loading == "boolean";
|
|
820
820
|
}
|
|
821
|
-
function
|
|
821
|
+
function ve(i, e, t = "stopped", s, n = "Run stopped by user.") {
|
|
822
822
|
const r = new Set(s ?? [
|
|
823
823
|
i.assistantDraftRespondsToUserMessageId,
|
|
824
824
|
i.activeResponseUserMessageId,
|
|
@@ -845,7 +845,7 @@ function be(i, e, t = "stopped", s, n = "Run stopped by user.") {
|
|
|
845
845
|
lastErrorCode: null
|
|
846
846
|
};
|
|
847
847
|
}
|
|
848
|
-
const
|
|
848
|
+
const _e = {
|
|
849
849
|
"stop-without-rendered-message": "Stop is enabled while no message is rendered or the welcome screen is still visible.",
|
|
850
850
|
"in-progress-stop-unavailable": "An in-progress response has no visible enabled interrupt control.",
|
|
851
851
|
"stop-did-not-interrupt": "The stopped response remained in progress after an interrupt click.",
|
|
@@ -861,10 +861,10 @@ const ve = {
|
|
|
861
861
|
"thinking-groups-without-user-message": "Multiple thinking groups appeared without a user message between them.",
|
|
862
862
|
"thinking-without-progress": "Thinking remained visible without progress for five minutes."
|
|
863
863
|
};
|
|
864
|
-
function
|
|
865
|
-
return typeof i == "string" && i.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call(
|
|
864
|
+
function Ie(i) {
|
|
865
|
+
return typeof i == "string" && i.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call(_e, i.slice(13));
|
|
866
866
|
}
|
|
867
|
-
function
|
|
867
|
+
function z(i) {
|
|
868
868
|
return {
|
|
869
869
|
...i.id === void 0 ? {} : { id: i.id },
|
|
870
870
|
name: i.name,
|
|
@@ -875,7 +875,7 @@ function K(i) {
|
|
|
875
875
|
...i.fileUrl === void 0 ? {} : { fileUrl: i.fileUrl }
|
|
876
876
|
};
|
|
877
877
|
}
|
|
878
|
-
function
|
|
878
|
+
function xe(i) {
|
|
879
879
|
if (!i || typeof i != "object" || !("type" in i)) return !1;
|
|
880
880
|
const e = i;
|
|
881
881
|
switch (e.type) {
|
|
@@ -887,15 +887,15 @@ function Ce(i) {
|
|
|
887
887
|
case "run.stop":
|
|
888
888
|
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);
|
|
889
889
|
case "runtime.report_response_visibility":
|
|
890
|
-
return
|
|
890
|
+
return be(e.observation);
|
|
891
891
|
case "runtime.warmup":
|
|
892
892
|
return (e.reason === "panel_open" || e.reason === "extension_install" || e.reason === "composer_input") && (e.requestedModel === void 0 || typeof e.requestedModel == "string");
|
|
893
893
|
case "runtime.report_operation_timing":
|
|
894
|
-
return
|
|
894
|
+
return q(e.timing);
|
|
895
895
|
case "runtime.report_displayed_error":
|
|
896
|
-
return (e.errorDiagnostic === void 0 ||
|
|
896
|
+
return (e.errorDiagnostic === void 0 || pe(e.errorDiagnostic)) && (e.httpRequest === void 0 || Q(e.httpRequest)) && (e.historyRefreshFailure === void 0 || F(e.historyRefreshFailure)) && (e.renderedError === void 0 || G(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);
|
|
897
897
|
case "runtime.report_invalid_state_transition":
|
|
898
|
-
return (e.uiInvariant === void 0 ||
|
|
898
|
+
return (e.uiInvariant === void 0 || B(e.uiInvariant)) && (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll" || Ie(e.reason)) && (e.clientMessageId === void 0 || typeof e.clientMessageId == "string");
|
|
899
899
|
case "runtime.prompt_presented":
|
|
900
900
|
return (e.feature === "notifications" || e.feature === "tab_grouping") && typeof e.openingGeneration == "number" && Number.isSafeInteger(e.openingGeneration) && e.openingGeneration > 0;
|
|
901
901
|
case "runtime.widget_lifecycle":
|
|
@@ -925,9 +925,9 @@ function Ce(i) {
|
|
|
925
925
|
return !1;
|
|
926
926
|
}
|
|
927
927
|
}
|
|
928
|
-
class
|
|
928
|
+
class De {
|
|
929
929
|
constructor(e, t, s) {
|
|
930
|
-
this.adapter = t, this.state =
|
|
930
|
+
this.adapter = t, this.state = I(e), this.hasBeenReady = e.status === "connected" && e.submissionReady !== !1, this.initialModel = s ?? "gpt-5.6-terra", this.model = this.initialModel;
|
|
931
931
|
}
|
|
932
932
|
adapter;
|
|
933
933
|
listeners = {};
|
|
@@ -936,8 +936,9 @@ class xe {
|
|
|
936
936
|
interactionListeners = /* @__PURE__ */ new Set();
|
|
937
937
|
accountListeners = /* @__PURE__ */ new Set();
|
|
938
938
|
state;
|
|
939
|
-
sessionHistoryState =
|
|
939
|
+
sessionHistoryState = S("unavailable");
|
|
940
940
|
model;
|
|
941
|
+
modelExplicit = !1;
|
|
941
942
|
initialModel;
|
|
942
943
|
interactions = [];
|
|
943
944
|
account = null;
|
|
@@ -948,6 +949,8 @@ class xe {
|
|
|
948
949
|
submissionPreviews = /* @__PURE__ */ new Map();
|
|
949
950
|
// Durable metadata can retire the preview before receipt reconciliation permits byte transfer.
|
|
950
951
|
submissionRetries = /* @__PURE__ */ new Map();
|
|
952
|
+
// Items painted before an owner restart, kept until the restarted owner has reread the same conversation's history.
|
|
953
|
+
retainedTranscript = null;
|
|
951
954
|
submissionGeneration = 0;
|
|
952
955
|
pendingStop = null;
|
|
953
956
|
stopError = null;
|
|
@@ -962,35 +965,42 @@ class xe {
|
|
|
962
965
|
return s.add(t), this.listeners[e] = s, () => s.delete(t);
|
|
963
966
|
}
|
|
964
967
|
getState() {
|
|
965
|
-
const e =
|
|
966
|
-
this.pendingNavigation && (e.isLoadingSession = !0)
|
|
968
|
+
const e = I(this.state);
|
|
969
|
+
if (this.pendingNavigation && (e.isLoadingSession = !0), this.retainedTranscript) {
|
|
970
|
+
const n = I({ ...e, ...this.retainedTranscript }), r = new Set(n.messages.map((a) => a.id)), o = new Set(n.segments?.map((a) => a.id));
|
|
971
|
+
e.messages = [...n.messages, ...e.messages.filter((a) => !r.has(a.id))], (n.segments || e.segments) && (e.segments = [
|
|
972
|
+
...(n.segments ?? []).map((a) => ({ ...a })),
|
|
973
|
+
...(e.segments ?? []).filter((a) => !o.has(a.id))
|
|
974
|
+
]), e.removedItems = { ...n.removedItems, ...e.removedItems };
|
|
975
|
+
}
|
|
967
976
|
for (const [n, r] of this.submissionPreviews)
|
|
968
977
|
e.messages.some((o) => o.id === n) || (e.messages.push({ ...r.message, attachments: r.message.attachments?.map((o) => ({ ...o })) }), e.segments && (e.segments = [...e.segments, { id: n, userMessageId: n, activityIds: [], outcomeIds: [], collapsed: !1 }]), e.isLoadingSession = !1, r.pending && (e.activeResponseUserMessageId = n, e.pendingMessageStatus = "sending", e.turnPhase = "sending", e.activity = { phase: "submitting", activeItemId: null }), r.error && (e.lastError = r.error.message, e.lastErrorCode = ["unauthorized", "401", "auth_reconnecting", "submission_not_available", "submission_checkpoint_pending"].includes(r.error.code) ? r.error.code : "message_delivery_failed"));
|
|
969
978
|
this.stopError && (e.lastError = this.stopError, e.lastErrorCode = "stop_failed");
|
|
970
979
|
const t = [...this.stopPreviews.keys()];
|
|
971
980
|
if (!t.length) return e;
|
|
972
|
-
const s =
|
|
981
|
+
const s = ve(e, "", "stopping", t);
|
|
973
982
|
return e.activeResponseUserMessageId && !this.stopPreviews.has(e.activeResponseUserMessageId) ? { ...e, messages: s.messages, segments: s.segments } : s;
|
|
974
983
|
}
|
|
975
984
|
updateProjection(e, t, s, n, r) {
|
|
976
985
|
if (this.destroyed) return;
|
|
977
986
|
const o = this.getState(), a = !this.hasBeenReady && (!o.user || o.user.id === e.user?.id), c = o.stableSelectionKey !== void 0 && o.stableSelectionKey === e.stableSelectionKey && o.user?.id === e.user?.id && o.sessionId === e.sessionId, d = c && this.pendingTransfers.size > 0 && this.submissionRetries.size === 0 && [...this.pendingTransfers.keys()].every((l) => this.readinessPendingSubmissions.has(l));
|
|
978
|
-
!a && !d && (o.user?.id !== e.user?.id || o.selectionKey !== void 0 && o.selectionKey !== e.selectionKey || o.selectionKey === void 0 && o.sessionId !== null && o.sessionId !== e.sessionId) && (c || (this.model = this.initialModel), this.cancelPendingSubmissions(), this.submissionPreviews.clear());
|
|
987
|
+
!a && !d && (o.user?.id !== e.user?.id || o.selectionKey !== void 0 && o.selectionKey !== e.selectionKey || o.selectionKey === void 0 && o.sessionId !== null && o.sessionId !== e.sessionId) && (c || (this.model = t ?? this.initialModel, this.modelExplicit = !1), this.cancelPendingSubmissions(), this.submissionPreviews.clear());
|
|
979
988
|
for (const l of e.messages)
|
|
980
989
|
l.role === "user" && e.receipts?.find((u) => u.userMessageId === l.id)?.durable !== !1 && this.submissionPreviews.delete(l.id);
|
|
981
|
-
|
|
990
|
+
const p = c && e.sessionId !== null && e.isLoadingSession && !e.isDraftSession;
|
|
991
|
+
this.retainedTranscript = p ? this.retainedTranscript ?? (this.state.isLoadingSession || this.state.messages.length === 0 ? null : { messages: this.state.messages, segments: this.state.segments, removedItems: this.state.removedItems }) : null, this.state = I(e), t !== void 0 && !this.modelExplicit && (this.model = t), e.status === "connected" && e.submissionReady !== !1 && (this.hasBeenReady = !0);
|
|
982
992
|
for (const [l, u] of this.stopPreviews) {
|
|
983
|
-
const
|
|
984
|
-
(u !== void 0 && u !== "[]" &&
|
|
993
|
+
const h = e.activity?.executionKey;
|
|
994
|
+
(u !== void 0 && u !== "[]" && h !== void 0 && h !== "[]" && (h !== u || ["completed", "failed", "stopped"].includes(e.activity.phase)) || (u === void 0 || u === "[]") && e.messages.some((m) => m.respondsToUserMessageId === l && !m.provisional && m.loading !== !0 && (m.dataType === "run_status" || m.dataType === "run_error" || m.role === "assistant" && m.phase !== "commentary" && (m.streamState === void 0 || ["finished", "stopped", "failed"].includes(m.streamState))))) && this.stopPreviews.delete(l);
|
|
985
995
|
}
|
|
986
996
|
if (this.pendingStop?.userMessageIds.every((l) => !this.stopPreviews.has(l)) && (this.pendingStop = null), o.user?.id === e.user?.id)
|
|
987
997
|
for (const l of this.state.messages) {
|
|
988
998
|
if (l.role !== "user" || !l.attachments?.length) continue;
|
|
989
|
-
const u = o.messages.find((
|
|
990
|
-
o.sessionId !== e.sessionId && !(o.sessionId === null && u) || (l.attachments =
|
|
999
|
+
const u = o.messages.find((h) => h.role === "user" && h.id === l.id);
|
|
1000
|
+
o.sessionId !== e.sessionId && !(o.sessionId === null && u) || (l.attachments = Se(u?.attachments, l.attachments));
|
|
991
1001
|
}
|
|
992
1002
|
if (s && JSON.stringify(s) !== JSON.stringify(this.sessionHistoryState)) {
|
|
993
|
-
this.sessionHistoryState =
|
|
1003
|
+
this.sessionHistoryState = $(s);
|
|
994
1004
|
for (const l of this.sessionHistoryListeners)
|
|
995
1005
|
l(this.getSessionHistoryState());
|
|
996
1006
|
}
|
|
@@ -1011,7 +1021,7 @@ class xe {
|
|
|
1011
1021
|
if (!this.destroyed) {
|
|
1012
1022
|
this.destroyed = !0;
|
|
1013
1023
|
for (const e of this.durabilityWaiters) e();
|
|
1014
|
-
this.pendingStop = null, this.stopPreviews.clear(), this.pendingTransfers.clear(), this.submissionRetries.clear(), this.submissionPreviews.clear(), this.attachmentFiles.clear(), this.sessionHistoryListeners.clear(), this.interactionListeners.clear(), this.accountListeners.clear();
|
|
1024
|
+
this.pendingStop = null, this.stopPreviews.clear(), this.pendingTransfers.clear(), this.submissionRetries.clear(), this.submissionPreviews.clear(), this.retainedTranscript = null, this.attachmentFiles.clear(), this.sessionHistoryListeners.clear(), this.interactionListeners.clear(), this.accountListeners.clear();
|
|
1015
1025
|
for (const e of Object.values(this.listeners)) e?.clear();
|
|
1016
1026
|
this.adapter.onDisconnect?.();
|
|
1017
1027
|
}
|
|
@@ -1027,7 +1037,7 @@ class xe {
|
|
|
1027
1037
|
this.dispatch({ type: "runtime.widget_lifecycle", action: e, trigger: t });
|
|
1028
1038
|
}
|
|
1029
1039
|
reportOperationTiming(e) {
|
|
1030
|
-
!this.destroyed &&
|
|
1040
|
+
!this.destroyed && q(e) && this.adapter.dispatch({ type: "runtime.report_operation_timing", timing: e }).catch(() => {
|
|
1031
1041
|
});
|
|
1032
1042
|
}
|
|
1033
1043
|
reportResponseVisibility(e) {
|
|
@@ -1035,7 +1045,7 @@ class xe {
|
|
|
1035
1045
|
});
|
|
1036
1046
|
}
|
|
1037
1047
|
reportInvalidStateTransition(e, t, s) {
|
|
1038
|
-
s !== void 0 && !
|
|
1048
|
+
s !== void 0 && !B(s) || this.adapter.dispatch({
|
|
1039
1049
|
type: "runtime.report_invalid_state_transition",
|
|
1040
1050
|
reason: e,
|
|
1041
1051
|
clientMessageId: t,
|
|
@@ -1045,8 +1055,8 @@ class xe {
|
|
|
1045
1055
|
}
|
|
1046
1056
|
reportDisplayedError(e, t, s, n, r) {
|
|
1047
1057
|
const o = e === "conversation_error" && !n ? this.getState().conversationDiagnostics?.httpRequest : void 0;
|
|
1048
|
-
if (n !== void 0 && !
|
|
1049
|
-
const a =
|
|
1058
|
+
if (n !== void 0 && !G(n) || r !== void 0 && !F(r)) return;
|
|
1059
|
+
const a = he(this.getState(), e, s, !!n, this.adapter.diagnosticBuilds);
|
|
1050
1060
|
this.adapter.dispatch({
|
|
1051
1061
|
type: "runtime.report_displayed_error",
|
|
1052
1062
|
errorDiagnostic: a,
|
|
@@ -1056,7 +1066,7 @@ class xe {
|
|
|
1056
1066
|
...n ? { renderedError: n } : {},
|
|
1057
1067
|
...r ? { historyRefreshFailure: r } : {},
|
|
1058
1068
|
...Q(o) ? { httpRequest: o } : {},
|
|
1059
|
-
...s ? { displayedMessage:
|
|
1069
|
+
...s ? { displayedMessage: H(s) } : {}
|
|
1060
1070
|
}).catch(() => {
|
|
1061
1071
|
});
|
|
1062
1072
|
}
|
|
@@ -1085,8 +1095,8 @@ class xe {
|
|
|
1085
1095
|
});
|
|
1086
1096
|
}
|
|
1087
1097
|
async sendMessageNow(e, t, s) {
|
|
1088
|
-
const n = e, r = t.clientMessageId, o =
|
|
1089
|
-
s === this.submissionGeneration && this.reportOperationTiming(
|
|
1098
|
+
const n = e, r = t.clientMessageId, o = K((p) => {
|
|
1099
|
+
s === this.submissionGeneration && this.reportOperationTiming(p);
|
|
1090
1100
|
}, {
|
|
1091
1101
|
operation: "send",
|
|
1092
1102
|
layer: "renderer",
|
|
@@ -1099,7 +1109,7 @@ class xe {
|
|
|
1099
1109
|
if (s !== this.submissionGeneration) return null;
|
|
1100
1110
|
d && this.readinessPendingSubmissions.add(r);
|
|
1101
1111
|
try {
|
|
1102
|
-
const
|
|
1112
|
+
const p = await o.measure("staging_ipc", async () => {
|
|
1103
1113
|
if (d) {
|
|
1104
1114
|
if (!await o.measure("authentication", () => this.waitForSubmissionReadiness(s))) return null;
|
|
1105
1115
|
this.readinessPendingSubmissions.delete(r), d = !1, t = { ...t, selectionKey: this.state.selectionKey };
|
|
@@ -1116,36 +1126,36 @@ class xe {
|
|
|
1116
1126
|
clientMessageId: r,
|
|
1117
1127
|
proactiveSuggestionQuestion: t.proactiveSuggestionQuestion,
|
|
1118
1128
|
// Preview URLs belong to the renderer's optimistic snapshot and are not valid runtime-command metadata.
|
|
1119
|
-
attachments: a.length > 0 ? a.map(
|
|
1129
|
+
attachments: a.length > 0 ? a.map(z) : void 0,
|
|
1120
1130
|
submittedAt: t.submittedAt
|
|
1121
|
-
}).then((
|
|
1122
|
-
const
|
|
1123
|
-
if (
|
|
1124
|
-
const
|
|
1125
|
-
return
|
|
1131
|
+
}).then((u) => ({ result: u }), async (u) => {
|
|
1132
|
+
const h = b(u);
|
|
1133
|
+
if (h.code !== "submission_checkpoint_pending") throw u;
|
|
1134
|
+
const f = this.submissionPreviews.get(r);
|
|
1135
|
+
return f && (f.error = h), this.emit("state", this.getState()), await this.waitForSubmissionDurability(r, s) ? { result: void 0 } : null;
|
|
1126
1136
|
});
|
|
1127
1137
|
});
|
|
1128
|
-
if (!
|
|
1129
|
-
if (c = !0, this.submissionRetries.delete(r),
|
|
1138
|
+
if (!p || s !== this.submissionGeneration) return null;
|
|
1139
|
+
if (c = !0, this.submissionRetries.delete(r), p.result?.submissionAccepted) {
|
|
1130
1140
|
r === this.stagedProactiveSuggestionClientMessageId && (this.stagedProactiveSuggestionClientMessageId = null);
|
|
1131
|
-
for (const
|
|
1132
|
-
|
|
1141
|
+
for (const l of t.attachments ?? [])
|
|
1142
|
+
l.id && this.attachmentFiles.delete(l.id);
|
|
1133
1143
|
return r;
|
|
1134
1144
|
}
|
|
1135
1145
|
if (a.length > 0) {
|
|
1136
1146
|
if (!this.adapter.uploadAttachment)
|
|
1137
1147
|
throw new Error("The runtime does not support attachments.");
|
|
1138
|
-
const
|
|
1139
|
-
for (const
|
|
1140
|
-
if (
|
|
1141
|
-
|
|
1148
|
+
const l = [];
|
|
1149
|
+
for (const u of a) {
|
|
1150
|
+
if (u.sandboxPath || u.storageKey) {
|
|
1151
|
+
l.push(u);
|
|
1142
1152
|
continue;
|
|
1143
1153
|
}
|
|
1144
|
-
const
|
|
1145
|
-
if (!
|
|
1146
|
-
if (
|
|
1154
|
+
const h = u.id ? this.attachmentFiles.get(u.id) : void 0;
|
|
1155
|
+
if (!h) throw new Error(`Attachment bytes are unavailable for ${u.name}`);
|
|
1156
|
+
if (l.push(await o.measure("attachment_transfer", () => this.adapter.uploadAttachment(h, u, { clientMessageId: r }))), s !== this.submissionGeneration) return null;
|
|
1147
1157
|
}
|
|
1148
|
-
a =
|
|
1158
|
+
a = l;
|
|
1149
1159
|
}
|
|
1150
1160
|
if (s !== this.submissionGeneration || (await this.adapter.dispatch({
|
|
1151
1161
|
type: "conversation.send",
|
|
@@ -1157,27 +1167,27 @@ class xe {
|
|
|
1157
1167
|
invocation: t.invocation,
|
|
1158
1168
|
automationOnboarding: t.automationOnboarding,
|
|
1159
1169
|
proactiveSuggestionQuestion: t.proactiveSuggestionQuestion,
|
|
1160
|
-
attachments: a.length > 0 ? a.map(
|
|
1170
|
+
attachments: a.length > 0 ? a.map(z) : void 0
|
|
1161
1171
|
}), s !== this.submissionGeneration)) return null;
|
|
1162
|
-
for (const
|
|
1163
|
-
|
|
1172
|
+
for (const l of t.attachments ?? [])
|
|
1173
|
+
l.id && this.attachmentFiles.delete(l.id);
|
|
1164
1174
|
return r === this.stagedProactiveSuggestionClientMessageId && (this.stagedProactiveSuggestionClientMessageId = null), r;
|
|
1165
|
-
} catch (
|
|
1175
|
+
} catch (p) {
|
|
1166
1176
|
if (s !== this.submissionGeneration) return null;
|
|
1167
|
-
if (
|
|
1168
|
-
for (const
|
|
1169
|
-
|
|
1170
|
-
const
|
|
1171
|
-
!c && !
|
|
1172
|
-
retry: async () => (d && await this.connect(), this.sendMessageNow(e, { ...t, reconcileAcceptance: !d && !
|
|
1173
|
-
attachmentIds: (t.attachments ?? []).flatMap((
|
|
1177
|
+
if (C(p))
|
|
1178
|
+
for (const f of t.attachments ?? [])
|
|
1179
|
+
f.id && this.attachmentFiles.delete(f.id);
|
|
1180
|
+
const u = b(p).code === "command_not_received";
|
|
1181
|
+
!c && !C(p) && (d || u || t.selectionKey !== void 0) && this.submissionRetries.set(r, {
|
|
1182
|
+
retry: async () => (d && await this.connect(), this.sendMessageNow(e, { ...t, reconcileAcceptance: !d && !u }, s)),
|
|
1183
|
+
attachmentIds: (t.attachments ?? []).flatMap((f) => f.id ? [f.id] : [])
|
|
1174
1184
|
});
|
|
1175
|
-
const
|
|
1176
|
-
throw
|
|
1185
|
+
const h = this.submissionPreviews.get(r);
|
|
1186
|
+
throw h && (h.pending = !1, h.error = b(p), this.emit("state", this.getState())), c && await this.adapter.dispatch({
|
|
1177
1187
|
type: "conversation.fail_staged",
|
|
1178
1188
|
clientMessageId: r,
|
|
1179
|
-
message:
|
|
1180
|
-
}),
|
|
1189
|
+
message: b(p).message
|
|
1190
|
+
}), p;
|
|
1181
1191
|
} finally {
|
|
1182
1192
|
this.readinessPendingSubmissions.delete(r);
|
|
1183
1193
|
}
|
|
@@ -1186,7 +1196,7 @@ class xe {
|
|
|
1186
1196
|
return this.model;
|
|
1187
1197
|
}
|
|
1188
1198
|
setModel(e) {
|
|
1189
|
-
return this.model === e || (this.model = e, this.emit("state", this.getState())), Promise.resolve();
|
|
1199
|
+
return this.modelExplicit = !0, this.model === e || (this.model = e, this.emit("state", this.getState())), Promise.resolve();
|
|
1190
1200
|
}
|
|
1191
1201
|
async retryLastMessage(e) {
|
|
1192
1202
|
const t = e ?? [...this.submissionPreviews].reverse().find(([, a]) => a.error)?.[0] ?? this.state.messages.filter((a) => a.role === "user").slice(-1)[0]?.id;
|
|
@@ -1198,7 +1208,7 @@ class xe {
|
|
|
1198
1208
|
return n && r ? (s && (s.pending = !0, s.error = void 0), this.submissionRetries.delete(t), this.pendingTransfers.set(t, n.attachmentIds), this.emit("state", this.getState()), await r()) : await this.dispatch({ type: "run.retry", clientMessageId: t }), !0;
|
|
1199
1209
|
} catch (a) {
|
|
1200
1210
|
if (!s && !r) throw a;
|
|
1201
|
-
return s && o === this.submissionGeneration && this.submissionPreviews.get(t) === s && (s.error =
|
|
1211
|
+
return s && o === this.submissionGeneration && this.submissionPreviews.get(t) === s && (s.error = b(a), this.emit("state", this.getState())), !1;
|
|
1202
1212
|
} finally {
|
|
1203
1213
|
r && this.pendingTransfers.delete(t), s && o === this.submissionGeneration && this.submissionPreviews.get(t) === s && (s.pending = !1, this.emit("state", this.getState()));
|
|
1204
1214
|
}
|
|
@@ -1221,7 +1231,7 @@ class xe {
|
|
|
1221
1231
|
...t,
|
|
1222
1232
|
e.activeResponseUserMessageId,
|
|
1223
1233
|
e.messages.filter((d) => d.role === "user").slice(-1)[0]?.id
|
|
1224
|
-
].filter((d) => !!d))], n =
|
|
1234
|
+
].filter((d) => !!d))], n = K((d) => this.reportOperationTiming(d), {
|
|
1225
1235
|
operation: "stop",
|
|
1226
1236
|
layer: "renderer",
|
|
1227
1237
|
requestId: crypto.randomUUID(),
|
|
@@ -1237,9 +1247,9 @@ class xe {
|
|
|
1237
1247
|
const a = this.submissionGeneration;
|
|
1238
1248
|
return r.promise = n.measure("stop_ipc", () => this.adapter.dispatch({ type: "run.stop", ...t.length ? { clientMessageIds: t } : {} })).then(() => {
|
|
1239
1249
|
}, (d) => {
|
|
1240
|
-
if (!(a !== this.submissionGeneration || s.every((
|
|
1241
|
-
for (const
|
|
1242
|
-
this.stopError =
|
|
1250
|
+
if (!(a !== this.submissionGeneration || s.every((p) => !this.stopPreviews.has(p)))) {
|
|
1251
|
+
for (const p of s) this.stopPreviews.delete(p);
|
|
1252
|
+
this.stopError = b(d).message;
|
|
1243
1253
|
}
|
|
1244
1254
|
}).finally(() => {
|
|
1245
1255
|
this.destroyed || a !== this.submissionGeneration || (this.pendingStop === r && (this.pendingStop = null), this.emit("state", this.getState()));
|
|
@@ -1315,7 +1325,7 @@ class xe {
|
|
|
1315
1325
|
return t;
|
|
1316
1326
|
}
|
|
1317
1327
|
startNewSession(e = {}) {
|
|
1318
|
-
return this.cancelPendingSubmissions(), this.submissionPreviews.clear(), this.model = this.initialModel, this.emit("state", this.getState()), e.notifyTransport === !1 ? Promise.resolve() : this.navigate({ type: "session.new" });
|
|
1328
|
+
return this.cancelPendingSubmissions(), this.submissionPreviews.clear(), this.retainedTranscript = null, this.model = this.initialModel, this.modelExplicit = !1, this.emit("state", this.getState()), e.notifyTransport === !1 ? Promise.resolve() : this.navigate({ type: "session.new" });
|
|
1319
1329
|
}
|
|
1320
1330
|
async listSessions(e = {}) {
|
|
1321
1331
|
const t = await this.dispatch({ type: "session.list", ...e });
|
|
@@ -1327,7 +1337,7 @@ class xe {
|
|
|
1327
1337
|
return t.sessionHistoryPage;
|
|
1328
1338
|
}
|
|
1329
1339
|
getSessionHistoryState() {
|
|
1330
|
-
return
|
|
1340
|
+
return $(this.sessionHistoryState);
|
|
1331
1341
|
}
|
|
1332
1342
|
subscribeSessionHistory(e) {
|
|
1333
1343
|
return this.sessionHistoryListeners.add(e), e(this.getSessionHistoryState()), () => this.sessionHistoryListeners.delete(e);
|
|
@@ -1379,7 +1389,7 @@ class xe {
|
|
|
1379
1389
|
}
|
|
1380
1390
|
loadSession(e) {
|
|
1381
1391
|
return e === this.getState().sessionId ? this.adapter.dispatch({ type: "session.load", sessionId: e }).then(() => {
|
|
1382
|
-
}) : (this.cancelPendingSubmissions(), this.submissionPreviews.clear(), this.emit("state", this.getState()), this.navigate({ type: "session.load", sessionId: e }));
|
|
1392
|
+
}) : (this.cancelPendingSubmissions(), this.submissionPreviews.clear(), this.retainedTranscript = null, this.emit("state", this.getState()), this.navigate({ type: "session.load", sessionId: e }));
|
|
1383
1393
|
}
|
|
1384
1394
|
stageProactiveSuggestionQuestion(e) {
|
|
1385
1395
|
const t = e.trim();
|
|
@@ -1409,7 +1419,7 @@ class xe {
|
|
|
1409
1419
|
for (const n of s ?? []) n(t);
|
|
1410
1420
|
}
|
|
1411
1421
|
}
|
|
1412
|
-
function
|
|
1422
|
+
function Se(i, e) {
|
|
1413
1423
|
if (!e || !i) return e;
|
|
1414
1424
|
const t = /* @__PURE__ */ new Map();
|
|
1415
1425
|
for (const s of i) {
|
|
@@ -1421,7 +1431,7 @@ function Ie(i, e) {
|
|
|
1421
1431
|
return n ? { ...s, previewUrl: n } : s;
|
|
1422
1432
|
});
|
|
1423
1433
|
}
|
|
1424
|
-
function
|
|
1434
|
+
function I(i) {
|
|
1425
1435
|
return {
|
|
1426
1436
|
...i,
|
|
1427
1437
|
starterPrompts: [...i.starterPrompts],
|
|
@@ -1445,36 +1455,36 @@ function E(i) {
|
|
|
1445
1455
|
activeScheduledFollowUps: i.activeScheduledFollowUps?.map((e) => ({ ...e })) ?? null
|
|
1446
1456
|
};
|
|
1447
1457
|
}
|
|
1448
|
-
function
|
|
1458
|
+
function $(i) {
|
|
1449
1459
|
return {
|
|
1450
1460
|
...i,
|
|
1451
|
-
data: i.data ?
|
|
1452
|
-
entities:
|
|
1461
|
+
data: i.data ? w({
|
|
1462
|
+
entities: W(i.data).map((e) => ({ ...e })),
|
|
1453
1463
|
nextCursor: i.data.nextCursor
|
|
1454
1464
|
}) : null
|
|
1455
1465
|
};
|
|
1456
1466
|
}
|
|
1457
1467
|
export {
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1468
|
+
Y as PRODUCT_AGENT_AUTH_RECONNECTING_ERROR_MESSAGE,
|
|
1469
|
+
ke as ProductAgentInteractionManager,
|
|
1470
|
+
O as ProductAgentQueryController,
|
|
1471
|
+
De as ProductAgentRemoteRuntimeClient,
|
|
1472
|
+
Re as ProductAgentSessionHistoryManager,
|
|
1473
|
+
Oe as ProductAgentTaskPageTitleController,
|
|
1474
|
+
Te as canSubmitPersonalProductAgentMessage,
|
|
1475
|
+
qe as createLocalStorageInteractionDecisionStorage,
|
|
1476
|
+
S as createProductAgentQueryState,
|
|
1477
|
+
Ce as createProductAgentTaskPageTitleDocument,
|
|
1478
|
+
re as formatProductAgentTaskPageTitle,
|
|
1479
|
+
Me as hasProductAgentPaidCreditFallback,
|
|
1480
|
+
C as isProductAgentAuthReconnectError,
|
|
1481
|
+
xe as isProductAgentRuntimeCommand,
|
|
1482
|
+
J as mergeProductAgentEntityPages,
|
|
1483
|
+
w as normalizeProductAgentEntityPage,
|
|
1484
|
+
se as readLocalStorageInteractionDecisions,
|
|
1485
|
+
we as reconcileProductAgentSubmissionGate,
|
|
1486
|
+
Ee as resolveProductAgentBillingPresentation,
|
|
1477
1487
|
Pe as resolveProductAgentComposerAction,
|
|
1478
|
-
|
|
1479
|
-
|
|
1488
|
+
Ae as resolveProductAgentWidgetPresentation,
|
|
1489
|
+
W as selectProductAgentQueryEntities
|
|
1480
1490
|
};
|