@pluno/product-agent-web 0.1.254 → 0.1.255
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Wn = [
|
|
2
2
|
"submit",
|
|
3
3
|
"stop",
|
|
4
4
|
"staging_ipc",
|
|
@@ -55,17 +55,17 @@ const Kn = [
|
|
|
55
55
|
"backend_refusal",
|
|
56
56
|
"unknown"
|
|
57
57
|
];
|
|
58
|
-
function
|
|
58
|
+
function Vn(s) {
|
|
59
59
|
const e = s, t = e?.code;
|
|
60
60
|
return e?.backendRefusal === !0 ? "backend_refusal" : typeof t == "string" && t !== "backend_refusal" && $i.includes(t) ? t : e?.name === "AbortError" ? "aborted" : e?.name === "TypeError" ? "type_error" : "unknown";
|
|
61
61
|
}
|
|
62
|
-
const
|
|
63
|
-
let
|
|
64
|
-
const Qs = () => `timing:${
|
|
62
|
+
const Gn = Math.random().toString(36).slice(2);
|
|
63
|
+
let Qn = 0;
|
|
64
|
+
const Qs = () => `timing:${Gn}:${++Qn}`, Ve = (s) => typeof s == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(s);
|
|
65
65
|
function Fe(s) {
|
|
66
66
|
if (!s || typeof s != "object") return !1;
|
|
67
67
|
const e = s;
|
|
68
|
-
return Object.keys(e).every((t) => ["entrySurface", "operation", "layer", "stage", "status", "spanId", "requestId", "clientMessageId", "sessionId", "occurredAt", "durationMs", "failureCategory"].includes(t)) && (e.failureCategory === void 0 || e.status === "failed" && $i.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) &&
|
|
68
|
+
return Object.keys(e).every((t) => ["entrySurface", "operation", "layer", "stage", "status", "spanId", "requestId", "clientMessageId", "sessionId", "occurredAt", "durationMs", "failureCategory"].includes(t)) && (e.failureCategory === void 0 || e.status === "failed" && $i.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) && Wn.includes(e.stage) && ["started", "completed", "failed", "observed"].includes(e.status) && Ve(e.spanId) && Ve(e.requestId) && (e.clientMessageId === null || Ve(e.clientMessageId)) && (e.sessionId === null || Ve(e.sessionId)) && typeof e.occurredAt == "string" && e.occurredAt.length <= 40 && Number.isFinite(Date.parse(e.occurredAt)) && Number.isSafeInteger(e.durationMs) && e.durationMs >= 0;
|
|
69
69
|
}
|
|
70
70
|
function J(s, e) {
|
|
71
71
|
if (!s) return {
|
|
@@ -81,7 +81,7 @@ function J(s, e) {
|
|
|
81
81
|
spanId: o,
|
|
82
82
|
occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
83
83
|
durationMs: Math.max(0, Math.round(performance.now() - a)),
|
|
84
|
-
...r === "failed" ? { failureCategory:
|
|
84
|
+
...r === "failed" ? { failureCategory: Vn(c) } : {}
|
|
85
85
|
};
|
|
86
86
|
s && Fe(d) && Promise.resolve().then(() => s(d)).catch(() => {
|
|
87
87
|
});
|
|
@@ -99,7 +99,7 @@ function J(s, e) {
|
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function Jn(s) {
|
|
103
103
|
let e = [], t;
|
|
104
104
|
const i = () => {
|
|
105
105
|
clearTimeout(t), t = void 0;
|
|
@@ -111,7 +111,7 @@ function Qn(s) {
|
|
|
111
111
|
Fe(n) && (JSON.stringify([...e, n]).length > 2800 && i(), e.push(n), e.length === 8 ? i() : t ??= setTimeout(i, 250));
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function Xn(s, e, t, i) {
|
|
115
115
|
if (s !== e)
|
|
116
116
|
for (const n of Object.values(e.submissions))
|
|
117
117
|
n.delivery !== "accepted" || s.submissions[n.userMessageId]?.delivery === "accepted" || J(t, {
|
|
@@ -124,12 +124,12 @@ function Jn(s, e, t, i) {
|
|
|
124
124
|
}).mark("acceptance_applied");
|
|
125
125
|
}
|
|
126
126
|
const P = (s) => typeof s == "string" && /^[a-zA-Z0-9:_.-]{1,160}$/.test(s) ? s : null;
|
|
127
|
-
function
|
|
127
|
+
function Yn(s) {
|
|
128
128
|
if (!s || typeof s != "object") return !1;
|
|
129
129
|
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) && P(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 || P(r) !== null) && (n.projectionReady === null || typeof n.projectionReady == "boolean");
|
|
130
130
|
return Object.keys(e).every((n) => ["ownerId", "revision", "dropped", "lastIntent", "lastSelection", "transitions"].includes(n)) && P(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);
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function Zn(s, e, t) {
|
|
133
133
|
const i = s;
|
|
134
134
|
if (!/^(directory\.|conversation\.|session\.)/.test(i.type ?? "") && !/^(directory\.|conversation\.|session\.)/.test(i.effectKind ?? "") || i.type === "conversation.display_received" && !["conversation.execution.updated", "conversation.item.removed"].includes(i.event?.type ?? "")) return null;
|
|
135
135
|
const n = i.output?.snapshot;
|
|
@@ -157,23 +157,23 @@ function _s(s) {
|
|
|
157
157
|
const e = s;
|
|
158
158
|
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;
|
|
159
159
|
}
|
|
160
|
-
const Js = ["messageKeys", "canonicalItemKeys", "terminalResponseKeys", "toolCallKeys", "activeResponseKeys"], Ss = (s) => typeof s == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(s), et = (s) => s === null || Ss(s),
|
|
160
|
+
const Js = ["messageKeys", "canonicalItemKeys", "terminalResponseKeys", "toolCallKeys", "activeResponseKeys"], Ss = (s) => typeof s == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(s), et = (s) => s === null || Ss(s), er = (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));
|
|
161
161
|
function Rs(s) {
|
|
162
162
|
if (!s || typeof s != "object") return !1;
|
|
163
163
|
const e = s;
|
|
164
|
-
return Object.keys(s).every((t) => ["sessionId", "itemId", "userMessageId", "createdAt", "runId", "retryable"].includes(t)) && et(e.sessionId) && Ss(e.itemId) && et(e.userMessageId) && (e.retryable === void 0 || typeof e.retryable == "boolean") && et(e.runId) && (e.createdAt === null ||
|
|
164
|
+
return Object.keys(s).every((t) => ["sessionId", "itemId", "userMessageId", "createdAt", "runId", "retryable"].includes(t)) && et(e.sessionId) && Ss(e.itemId) && et(e.userMessageId) && (e.retryable === void 0 || typeof e.retryable == "boolean") && et(e.runId) && (e.createdAt === null || er(e.createdAt));
|
|
165
165
|
}
|
|
166
|
-
function
|
|
166
|
+
function tr(s) {
|
|
167
167
|
if (!s || typeof s != "object") return !1;
|
|
168
168
|
const e = s, t = (i) => Number.isSafeInteger(i) && i >= 0;
|
|
169
|
-
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 || P(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 ||
|
|
169
|
+
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 || P(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 || Yn(e.owner));
|
|
170
170
|
}
|
|
171
171
|
function As(s) {
|
|
172
172
|
if (!s || typeof s != "object" || Object.keys(s).some((i) => i !== "before" && i !== "current")) return !1;
|
|
173
173
|
const e = (i) => {
|
|
174
174
|
if (!i || typeof i != "object") return !1;
|
|
175
175
|
const n = i;
|
|
176
|
-
return Object.keys(i).every((r) => [...Js, "sessionId", "runtimeItemCount", "welcome", "truncated", "thinkingSequence", "context"].includes(r)) && (n.context === void 0 ||
|
|
176
|
+
return Object.keys(i).every((r) => [...Js, "sessionId", "runtimeItemCount", "welcome", "truncated", "thinkingSequence", "context"].includes(r)) && (n.context === void 0 || tr(n.context)) && (n.thinkingSequence === void 0 || Array.isArray(n.thinkingSequence) && n.thinkingSequence.length <= 20 && n.thinkingSequence.every((r) => r === "user" || r === "thinking")) && et(n.sessionId) && Number.isSafeInteger(n.runtimeItemCount) && n.runtimeItemCount >= 0 && typeof n.welcome == "boolean" && typeof n.truncated == "boolean" && Js.every((r) => Array.isArray(n[r]) && n[r].length <= 20 && n[r].every(Ss));
|
|
177
177
|
}, t = s;
|
|
178
178
|
return (t.before === null || e(t.before)) && e(t.current);
|
|
179
179
|
}
|
|
@@ -188,7 +188,7 @@ function Fi(s) {
|
|
|
188
188
|
e ^= s.charCodeAt(t), e = Math.imul(e, 16777619);
|
|
189
189
|
return `fnv1a-${(e >>> 0).toString(16).padStart(8, "0")}`;
|
|
190
190
|
}
|
|
191
|
-
const Es = "0.1.
|
|
191
|
+
const Es = "0.1.255", zi = {
|
|
192
192
|
version: Es
|
|
193
193
|
};
|
|
194
194
|
function ze(s) {
|
|
@@ -196,7 +196,7 @@ function ze(s) {
|
|
|
196
196
|
const e = s;
|
|
197
197
|
return Object.keys(s).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);
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function sr(s) {
|
|
200
200
|
if (!s || typeof s != "object") return !1;
|
|
201
201
|
const e = s;
|
|
202
202
|
return Object.keys(e).every((t) => ["sessionId", "requestId", "code", "normalization", "builds", "clientMessageId"].includes(t)) && (e.clientMessageId === void 0 || P(e.clientMessageId) !== null) && [e.sessionId, e.requestId, e.code].every((t) => t === null || P(t) !== null) && (e.normalization === void 0 || ze(e.normalization)) && !!e.builds && typeof e.builds == "object" && typeof e.builds.sdk == "string" && Object.entries(e.builds).every(([t, i]) => ["sdk", "rendererExtension", "contentExtension", "backgroundExtension"].includes(t) && typeof i == "string" && /^\d{1,5}\.\d{1,5}\.\d{1,5}$/.test(i));
|
|
@@ -220,7 +220,7 @@ function je(s) {
|
|
|
220
220
|
const e = Object.getPrototypeOf(s);
|
|
221
221
|
return e !== Object.prototype && e !== null ? !1 : Object.values(s).every(je);
|
|
222
222
|
}
|
|
223
|
-
function
|
|
223
|
+
function ir(s) {
|
|
224
224
|
if (s.details !== void 0 && !je(s.details))
|
|
225
225
|
throw new TypeError("Product Agent transported error details must be JSON-safe.");
|
|
226
226
|
return {
|
|
@@ -246,14 +246,14 @@ function he(s, e = "runtime_error", t = "runtime") {
|
|
|
246
246
|
...typeof o.durationMs == "number" && Number.isFinite(o.durationMs) && o.durationMs >= 0 ? { durationMs: o.durationMs } : {},
|
|
247
247
|
...typeof o.successfulRequests == "number" && Number.isSafeInteger(o.successfulRequests) && o.successfulRequests >= 0 ? { successfulRequests: o.successfulRequests } : {}
|
|
248
248
|
};
|
|
249
|
-
return
|
|
249
|
+
return ir({
|
|
250
250
|
code: r,
|
|
251
251
|
message: n.trim() && n.trim() !== "[object Object]" ? n : "The Product Agent operation failed. Try again.",
|
|
252
252
|
retryable: !!(i && "retryable" in i && i.retryable === !0),
|
|
253
253
|
...Object.keys(c).length ? { details: c } : {}
|
|
254
254
|
});
|
|
255
255
|
}
|
|
256
|
-
function
|
|
256
|
+
function nr(s, e = "runtime") {
|
|
257
257
|
const t = he(s, "runtime_error", e), i = s !== null && typeof s == "object" && "stack" in s && typeof s.stack == "string" ? be(s.stack.slice(0, 4e3).split(`
|
|
258
258
|
`).slice(0, 6).join(`
|
|
259
259
|
`).replace(/\n\s*at\s/g, `
|
|
@@ -290,7 +290,7 @@ function de(s) {
|
|
|
290
290
|
"upstreamTraceId"
|
|
291
291
|
].includes(i)) && P(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((i) => i == null || t(i)) && t(e.elapsedMs) && t(e.attempt) && e.attempt >= 1 && e.attempt <= 10 && [e.queryRequestId, e.ownerId, e.sessionId].every((i) => i === null || P(i) !== 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((i) => i === null || typeof i == "string" && /^[a-zA-Z0-9_:;=./-]{1,160}$/.test(i));
|
|
292
292
|
}
|
|
293
|
-
function
|
|
293
|
+
function rr(s) {
|
|
294
294
|
const e = {}, t = (i, n) => {
|
|
295
295
|
if (!i || typeof i != "object") return;
|
|
296
296
|
const r = i;
|
|
@@ -311,7 +311,7 @@ function nr(s) {
|
|
|
311
311
|
}
|
|
312
312
|
return e;
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function or(s, e = Math.random, t = Math.random) {
|
|
315
315
|
const i = () => Math.floor(t() * 21) - 10;
|
|
316
316
|
return {
|
|
317
317
|
"activeUsers.load": async () => ({ count: await s(), updatedAt: Date.now(), offset: i() }),
|
|
@@ -319,14 +319,14 @@ function rr(s, e = Math.random, t = Math.random) {
|
|
|
319
319
|
"activeUsers.wait": ({ milliseconds: n }) => new Promise((r) => setTimeout(() => r(null), n + Math.round((e() - 0.5) * 1e3)))
|
|
320
320
|
};
|
|
321
321
|
}
|
|
322
|
-
async function
|
|
322
|
+
async function ar(s, e = fetch) {
|
|
323
323
|
const t = await e(new URL("/api/product-agent/embed/active-users", s), { cache: "no-store", credentials: "omit" });
|
|
324
324
|
if (!t.ok) throw new Error(`Active users request failed (${t.status})`);
|
|
325
325
|
const i = await t.json();
|
|
326
326
|
if (typeof i.count != "number" || !Number.isFinite(i.count) || i.count < 0) throw new Error("Invalid active users count");
|
|
327
327
|
return Math.round(i.count);
|
|
328
328
|
}
|
|
329
|
-
function
|
|
329
|
+
function cr(s) {
|
|
330
330
|
const e = {
|
|
331
331
|
sidepanel: "extension_sidepanel",
|
|
332
332
|
browser_extension_page_ui: "extension_widget",
|
|
@@ -338,7 +338,7 @@ function ar(s) {
|
|
|
338
338
|
};
|
|
339
339
|
return s && s in e ? e[s] : s ?? "embedded_custom_ui";
|
|
340
340
|
}
|
|
341
|
-
function
|
|
341
|
+
function dr(s, e) {
|
|
342
342
|
const t = {}, i = {};
|
|
343
343
|
for (const n of e) {
|
|
344
344
|
const r = n.command.payload, a = String(r.clientMessageId);
|
|
@@ -375,7 +375,7 @@ function Ys(s) {
|
|
|
375
375
|
return null;
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
|
-
function
|
|
378
|
+
function lr(s, e) {
|
|
379
379
|
try {
|
|
380
380
|
window.sessionStorage.setItem(`pa.authority:${s}`, e);
|
|
381
381
|
} catch (t) {
|
|
@@ -433,7 +433,7 @@ function es(s) {
|
|
|
433
433
|
function Vi(s) {
|
|
434
434
|
return ["history_load_failed", "request_timed_out", "connection_interrupted", "408", "425", "429"].includes(s) || /^5\d\d$/.test(s);
|
|
435
435
|
}
|
|
436
|
-
const Ts = (s) => s.selectedModel ?? s.historyModel ?? s.defaultModel,
|
|
436
|
+
const Ts = (s) => s.selectedModel ?? s.historyModel ?? s.defaultModel, ur = (s, e) => s.scopes[e];
|
|
437
437
|
function oe(s) {
|
|
438
438
|
return s?.execution_message_ids ?? s?.user_message_ids ?? [];
|
|
439
439
|
}
|
|
@@ -479,7 +479,7 @@ function ss(s, e) {
|
|
|
479
479
|
for (const i of oe(e)) t[i] = { version: e.version, phase: e.phase };
|
|
480
480
|
return { ...s, execution: e, executionByUserMessage: t };
|
|
481
481
|
}
|
|
482
|
-
function
|
|
482
|
+
function hr(s) {
|
|
483
483
|
const e = /* @__PURE__ */ new Set();
|
|
484
484
|
for (const t of Object.values(s.items)) {
|
|
485
485
|
const i = pt(t), n = s.streams[t.id];
|
|
@@ -551,7 +551,7 @@ function rs(s, e) {
|
|
|
551
551
|
function Ge(s) {
|
|
552
552
|
return JSON.stringify(s, (e, t) => t && typeof t == "object" && !Array.isArray(t) ? Object.fromEntries(Object.entries(t).sort(([i], [n]) => i.localeCompare(n))) : t);
|
|
553
553
|
}
|
|
554
|
-
function
|
|
554
|
+
function pr(s, e, t, i) {
|
|
555
555
|
let n = s;
|
|
556
556
|
const r = [];
|
|
557
557
|
let a = null;
|
|
@@ -733,7 +733,7 @@ function hr(s, e, t, i) {
|
|
|
733
733
|
requestId: e.requestId,
|
|
734
734
|
lane: e.lane,
|
|
735
735
|
before: e.lane === "history" ? c.cursor : null,
|
|
736
|
-
refreshItemIds:
|
|
736
|
+
refreshItemIds: hr(o),
|
|
737
737
|
retryPreparation: c.error?.code === "history_preparation_failed"
|
|
738
738
|
}, l = Object.values(s.submissions).filter((p) => p.sessionId === e.sessionId && p.delivery === "accepted" && p.executionVersion === null).map((p) => p.userMessageId), u = s.requestSequence + 1, h = `conversation:${s.generation}:${u}`;
|
|
739
739
|
n = {
|
|
@@ -822,7 +822,7 @@ function os(s, e, t, i = !1) {
|
|
|
822
822
|
function as(s, e = null) {
|
|
823
823
|
return { command: X(s), conversationScopeId: e, phase: "waiting", effectId: null, result: null, error: null };
|
|
824
824
|
}
|
|
825
|
-
function
|
|
825
|
+
function fr(s) {
|
|
826
826
|
const e = { ...s.context, ...s.contextPreparation };
|
|
827
827
|
return Object.fromEntries(["page", "pageContent", "agentMode", "metadata", "sessionTabs", "proactiveSuggestionQuestion"].filter((t) => t in e).map((t) => [t, e[t]]));
|
|
828
828
|
}
|
|
@@ -872,7 +872,7 @@ function cs(s) {
|
|
|
872
872
|
request_id: c.requestId,
|
|
873
873
|
type: "chat.user_message",
|
|
874
874
|
payload: {
|
|
875
|
-
...
|
|
875
|
+
...fr(c),
|
|
876
876
|
sessionId: c.sessionId,
|
|
877
877
|
clientMessageId: o,
|
|
878
878
|
content: c.content,
|
|
@@ -933,7 +933,7 @@ function cs(s) {
|
|
|
933
933
|
}
|
|
934
934
|
return { state: ie(e), effects: t };
|
|
935
935
|
}
|
|
936
|
-
function
|
|
936
|
+
function mr(s, e, t, i) {
|
|
937
937
|
let n = s, r = e;
|
|
938
938
|
if (e.type === "effect.completed" || e.type === "effect.failed") {
|
|
939
939
|
e.effectKind === "conversation.checkpoint" && e.effectId === s.checkpointEffectId && (n = { ...n, checkpointEffectId: null, checkpointError: e.type === "effect.failed" ? e.error : null });
|
|
@@ -1137,7 +1137,7 @@ function fr(s, e, t, i) {
|
|
|
1137
1137
|
l?.phase === "uncertain" && (n = { ...s, operations: { ...s.operations, [e.requestId]: { ...l, phase: "waiting" } } });
|
|
1138
1138
|
}
|
|
1139
1139
|
}
|
|
1140
|
-
const a =
|
|
1140
|
+
const a = pr(n, r, t, i);
|
|
1141
1141
|
let o = a.state;
|
|
1142
1142
|
e.type === "conversation.submission_stage" && o !== n && !o.deliveries[e.userMessageId] && (o = {
|
|
1143
1143
|
...o,
|
|
@@ -1252,7 +1252,7 @@ function me(s, e) {
|
|
|
1252
1252
|
retryable: s !== null && typeof s == "object" && "retryable" in s && typeof s.retryable == "boolean" ? s.retryable : ["authority_retired", "executor_not_ready", "connection_interrupted", "request_timed_out", "408", "425", "429"].includes(i) || /^5\d\d$/.test(i)
|
|
1253
1253
|
});
|
|
1254
1254
|
}
|
|
1255
|
-
function
|
|
1255
|
+
function gr(s) {
|
|
1256
1256
|
let e = Promise.resolve();
|
|
1257
1257
|
const t = (o = Qi(s.runtime().engine.getState().slices.conversation, s.runtime().engine.getState().slices.directory)) => {
|
|
1258
1258
|
const c = () => (H(s, s.authority), s.saveDelivery(o));
|
|
@@ -1497,7 +1497,7 @@ function mr(s) {
|
|
|
1497
1497
|
})
|
|
1498
1498
|
};
|
|
1499
1499
|
}
|
|
1500
|
-
class
|
|
1500
|
+
class yr {
|
|
1501
1501
|
constructor(e) {
|
|
1502
1502
|
this.options = e, this.owner = `conversation:${e.authority.authorityId}:${e.authority.generation}`, this.deliveryRecovery = new tt({
|
|
1503
1503
|
activeIntervalMs: 3e3,
|
|
@@ -1692,10 +1692,10 @@ function Xi(s, e) {
|
|
|
1692
1692
|
const a = e ?? [...s.items].reverse().find((o) => o.type === "user_message")?.id ?? [...s.submissions].reverse().find((o) => !o.cancelled && o.delivery === "accepted")?.userMessageId;
|
|
1693
1693
|
return s.sessionId && a ? { type: "execution", userMessageId: a, sessionId: s.sessionId } : null;
|
|
1694
1694
|
}
|
|
1695
|
-
function
|
|
1695
|
+
function vr(s, e) {
|
|
1696
1696
|
return ie({ scopes: Object.fromEntries([...new Set(Object.values(e.clients))].map((t) => [t, Re(s, e, t)])) });
|
|
1697
1697
|
}
|
|
1698
|
-
function
|
|
1698
|
+
function Ir(s, e) {
|
|
1699
1699
|
if (!e) return !1;
|
|
1700
1700
|
const t = s.executionByUserMessage[e];
|
|
1701
1701
|
if (t) return ["completed", "stopped", "failed"].includes(t.phase);
|
|
@@ -1706,10 +1706,10 @@ function vr(s, e) {
|
|
|
1706
1706
|
return !0;
|
|
1707
1707
|
return !1;
|
|
1708
1708
|
}
|
|
1709
|
-
const
|
|
1709
|
+
const br = /(\]\()(\/api\/product-agent\/attachments\/download\?[^)\s]+)(\))/g;
|
|
1710
1710
|
function Se(s, e) {
|
|
1711
1711
|
return e ? s.replace(
|
|
1712
|
-
|
|
1712
|
+
br,
|
|
1713
1713
|
(t, i, n, r) => `${i}${new URL(n, e).toString()}${r}`
|
|
1714
1714
|
) : s;
|
|
1715
1715
|
}
|
|
@@ -1750,7 +1750,7 @@ function ti(s, e) {
|
|
|
1750
1750
|
...s.file_url === null ? {} : { fileUrl: new URL(s.file_url, e).toString() }
|
|
1751
1751
|
};
|
|
1752
1752
|
}
|
|
1753
|
-
function
|
|
1753
|
+
function wr(s, e, t, i) {
|
|
1754
1754
|
const n = t === "open" || t === "awaiting_content", r = {
|
|
1755
1755
|
id: s.id,
|
|
1756
1756
|
createdAt: s.created_at,
|
|
@@ -1787,11 +1787,11 @@ function br(s, e, t, i) {
|
|
|
1787
1787
|
return { ...r, role: "system", dataType: "run_status", content: s.data.message, loading: !1 };
|
|
1788
1788
|
}
|
|
1789
1789
|
}
|
|
1790
|
-
function
|
|
1790
|
+
function _r(s, e, t, i) {
|
|
1791
1791
|
const n = /* @__PURE__ */ new Map();
|
|
1792
1792
|
for (const I of s.segments)
|
|
1793
1793
|
for (const _ of [...I.activityIds, ...I.outcomeIds]) n.set(_, I.userMessageId);
|
|
1794
|
-
const r = s.items.map((I) =>
|
|
1794
|
+
const r = s.items.map((I) => wr(
|
|
1795
1795
|
I,
|
|
1796
1796
|
n.get(I.id) ?? null,
|
|
1797
1797
|
s.streamStates[I.id],
|
|
@@ -1910,7 +1910,7 @@ function si(s) {
|
|
|
1910
1910
|
return "This request was interrupted before acceptance could be confirmed.";
|
|
1911
1911
|
}
|
|
1912
1912
|
}
|
|
1913
|
-
function
|
|
1913
|
+
function Sr(s) {
|
|
1914
1914
|
return {
|
|
1915
1915
|
content: s.content,
|
|
1916
1916
|
...typeof s.context.proactiveSuggestionQuestion == "string" ? { proactiveSuggestionQuestion: s.context.proactiveSuggestionQuestion } : {},
|
|
@@ -1927,7 +1927,7 @@ function _r(s) {
|
|
|
1927
1927
|
}))
|
|
1928
1928
|
};
|
|
1929
1929
|
}
|
|
1930
|
-
function
|
|
1930
|
+
function Rr(s) {
|
|
1931
1931
|
const e = () => {
|
|
1932
1932
|
const t = s.runtime(), i = t.engine.getState().slices.directory;
|
|
1933
1933
|
return !t.isDisposed && i.authorityId === s.authority.authorityId && i.generation === s.authority.generation;
|
|
@@ -2032,31 +2032,31 @@ function it(s) {
|
|
|
2032
2032
|
nextCursor: s.nextCursor
|
|
2033
2033
|
};
|
|
2034
2034
|
}
|
|
2035
|
-
function
|
|
2035
|
+
function Ar(s, e, t) {
|
|
2036
2036
|
if (t === "replace" || s === null) return e;
|
|
2037
2037
|
const i = { ...s.entitiesById, ...e.entitiesById }, n = [...s.ids];
|
|
2038
2038
|
for (const r of e.ids)
|
|
2039
2039
|
s.entitiesById[r] || n.push(r);
|
|
2040
2040
|
return { entitiesById: i, ids: n, nextCursor: e.nextCursor };
|
|
2041
2041
|
}
|
|
2042
|
-
function
|
|
2042
|
+
function Er(s) {
|
|
2043
2043
|
return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
|
|
2044
2044
|
}
|
|
2045
|
-
function
|
|
2045
|
+
function Ld(s) {
|
|
2046
2046
|
return s.visible ? s.minimized ? { state: "minimized" } : { state: s.open ? "visible_open" : "visible_closed" } : { state: "hidden" };
|
|
2047
2047
|
}
|
|
2048
2048
|
function nt(s, e) {
|
|
2049
2049
|
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: [] };
|
|
2050
2050
|
}
|
|
2051
|
-
function
|
|
2051
|
+
function Tr(s) {
|
|
2052
2052
|
if (!s || typeof s != "object") return !1;
|
|
2053
2053
|
const e = s.paidCreditFallbackModel;
|
|
2054
2054
|
return typeof e == "string" && e.length > 0;
|
|
2055
2055
|
}
|
|
2056
|
-
function
|
|
2056
|
+
function $d(s) {
|
|
2057
2057
|
return s.submissionAllowed && s.isAuthenticated && s.hasWorkspace && !s.isWebsiteBlocked && s.isCurrentPageResolved && !s.isSubmitting && !s.hasPendingMessage;
|
|
2058
2058
|
}
|
|
2059
|
-
function
|
|
2059
|
+
function Fd(s) {
|
|
2060
2060
|
const e = s.hasDraftMessage || s.hasPreSubmittedAttachment;
|
|
2061
2061
|
return s.hasRunningAssistantTurn && !e ? {
|
|
2062
2062
|
action: "stop",
|
|
@@ -2066,9 +2066,9 @@ function $d(s) {
|
|
|
2066
2066
|
disabled: !e || !s.canSubmitMessage
|
|
2067
2067
|
};
|
|
2068
2068
|
}
|
|
2069
|
-
const
|
|
2070
|
-
function
|
|
2071
|
-
return (s instanceof Error ? s.message : s) ===
|
|
2069
|
+
const kr = "Pluno is reconnecting. Try again in a moment.";
|
|
2070
|
+
function qr(s) {
|
|
2071
|
+
return (s instanceof Error ? s.message : s) === kr;
|
|
2072
2072
|
}
|
|
2073
2073
|
const se = /* @__PURE__ */ Object.create(null);
|
|
2074
2074
|
se.open = "0";
|
|
@@ -2093,7 +2093,7 @@ function ri(s) {
|
|
|
2093
2093
|
return s instanceof Uint8Array ? s : s instanceof ArrayBuffer ? new Uint8Array(s) : new Uint8Array(s.buffer, s.byteOffset, s.byteLength);
|
|
2094
2094
|
}
|
|
2095
2095
|
let Mt;
|
|
2096
|
-
function
|
|
2096
|
+
function Cr(s, e) {
|
|
2097
2097
|
if (Yi && s.data instanceof Blob)
|
|
2098
2098
|
return s.data.arrayBuffer().then(ri).then(e);
|
|
2099
2099
|
if (Zi && (s.data instanceof ArrayBuffer || en(s.data)))
|
|
@@ -2105,14 +2105,14 @@ function qr(s, e) {
|
|
|
2105
2105
|
const oi = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", De = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
|
|
2106
2106
|
for (let s = 0; s < oi.length; s++)
|
|
2107
2107
|
De[oi.charCodeAt(s)] = s;
|
|
2108
|
-
const
|
|
2108
|
+
const Mr = (s) => {
|
|
2109
2109
|
let e = s.length * 0.75, t = s.length, i, n = 0, r, a, o, c;
|
|
2110
2110
|
s[s.length - 1] === "=" && (e--, s[s.length - 2] === "=" && e--);
|
|
2111
2111
|
const d = new ArrayBuffer(e), l = new Uint8Array(d);
|
|
2112
2112
|
for (i = 0; i < t; i += 4)
|
|
2113
2113
|
r = De[s.charCodeAt(i)], a = De[s.charCodeAt(i + 1)], o = De[s.charCodeAt(i + 2)], c = De[s.charCodeAt(i + 3)], l[n++] = r << 2 | a >> 4, l[n++] = (a & 15) << 4 | o >> 2, l[n++] = (o & 3) << 6 | c & 63;
|
|
2114
2114
|
return d;
|
|
2115
|
-
},
|
|
2115
|
+
}, Pr = typeof ArrayBuffer == "function", qs = (s, e) => {
|
|
2116
2116
|
if (typeof s != "string")
|
|
2117
2117
|
return {
|
|
2118
2118
|
type: "message",
|
|
@@ -2121,20 +2121,20 @@ const Cr = (s) => {
|
|
|
2121
2121
|
const t = s.charAt(0);
|
|
2122
2122
|
return t === "b" ? {
|
|
2123
2123
|
type: "message",
|
|
2124
|
-
data:
|
|
2124
|
+
data: Or(s.substring(1), e)
|
|
2125
2125
|
} : rt[t] ? s.length > 1 ? {
|
|
2126
2126
|
type: rt[t],
|
|
2127
2127
|
data: s.substring(1)
|
|
2128
2128
|
} : {
|
|
2129
2129
|
type: rt[t]
|
|
2130
2130
|
} : ls;
|
|
2131
|
-
},
|
|
2132
|
-
if (
|
|
2133
|
-
const t =
|
|
2131
|
+
}, Or = (s, e) => {
|
|
2132
|
+
if (Pr) {
|
|
2133
|
+
const t = Mr(s);
|
|
2134
2134
|
return tn(t, e);
|
|
2135
2135
|
} else
|
|
2136
2136
|
return { base64: !0, data: s };
|
|
2137
|
-
}, tn = (s, e) => e === "blob" ? s instanceof Blob ? s : new Blob([s]) : s instanceof ArrayBuffer ? s : s.buffer, sn = "",
|
|
2137
|
+
}, tn = (s, e) => e === "blob" ? s instanceof Blob ? s : new Blob([s]) : s instanceof ArrayBuffer ? s : s.buffer, sn = "", xr = (s, e) => {
|
|
2138
2138
|
const t = s.length, i = new Array(t);
|
|
2139
2139
|
let n = 0;
|
|
2140
2140
|
s.forEach((r, a) => {
|
|
@@ -2142,7 +2142,7 @@ const Cr = (s) => {
|
|
|
2142
2142
|
i[a] = o, ++n === t && e(i.join(sn));
|
|
2143
2143
|
});
|
|
2144
2144
|
});
|
|
2145
|
-
},
|
|
2145
|
+
}, Dr = (s, e) => {
|
|
2146
2146
|
const t = s.split(sn), i = [];
|
|
2147
2147
|
for (let n = 0; n < t.length; n++) {
|
|
2148
2148
|
const r = qs(t[n], e);
|
|
@@ -2151,10 +2151,10 @@ const Cr = (s) => {
|
|
|
2151
2151
|
}
|
|
2152
2152
|
return i;
|
|
2153
2153
|
};
|
|
2154
|
-
function
|
|
2154
|
+
function Ur() {
|
|
2155
2155
|
return new TransformStream({
|
|
2156
2156
|
transform(s, e) {
|
|
2157
|
-
|
|
2157
|
+
Cr(s, (t) => {
|
|
2158
2158
|
const i = t.length;
|
|
2159
2159
|
let n;
|
|
2160
2160
|
if (i < 126)
|
|
@@ -2186,7 +2186,7 @@ function Je(s, e) {
|
|
|
2186
2186
|
t[n] = s[0][i++], i === s[0].length && (s.shift(), i = 0);
|
|
2187
2187
|
return s.length && i < s[0].length && (s[0] = s[0].slice(i)), t;
|
|
2188
2188
|
}
|
|
2189
|
-
function
|
|
2189
|
+
function Nr(s, e) {
|
|
2190
2190
|
Pt || (Pt = new TextDecoder());
|
|
2191
2191
|
const t = [];
|
|
2192
2192
|
let i = 0, n = -1, r = !1;
|
|
@@ -2227,24 +2227,24 @@ function Ur(s, e) {
|
|
|
2227
2227
|
});
|
|
2228
2228
|
}
|
|
2229
2229
|
const nn = 4;
|
|
2230
|
-
function
|
|
2231
|
-
if (s) return
|
|
2230
|
+
function U(s) {
|
|
2231
|
+
if (s) return Br(s);
|
|
2232
2232
|
}
|
|
2233
|
-
function
|
|
2234
|
-
for (var e in
|
|
2235
|
-
s[e] =
|
|
2233
|
+
function Br(s) {
|
|
2234
|
+
for (var e in U.prototype)
|
|
2235
|
+
s[e] = U.prototype[e];
|
|
2236
2236
|
return s;
|
|
2237
2237
|
}
|
|
2238
|
-
|
|
2238
|
+
U.prototype.on = U.prototype.addEventListener = function(s, e) {
|
|
2239
2239
|
return this._callbacks = this._callbacks || {}, (this._callbacks["$" + s] = this._callbacks["$" + s] || []).push(e), this;
|
|
2240
2240
|
};
|
|
2241
|
-
|
|
2241
|
+
U.prototype.once = function(s, e) {
|
|
2242
2242
|
function t() {
|
|
2243
2243
|
this.off(s, t), e.apply(this, arguments);
|
|
2244
2244
|
}
|
|
2245
2245
|
return t.fn = e, this.on(s, t), this;
|
|
2246
2246
|
};
|
|
2247
|
-
|
|
2247
|
+
U.prototype.off = U.prototype.removeListener = U.prototype.removeAllListeners = U.prototype.removeEventListener = function(s, e) {
|
|
2248
2248
|
if (this._callbacks = this._callbacks || {}, arguments.length == 0)
|
|
2249
2249
|
return this._callbacks = {}, this;
|
|
2250
2250
|
var t = this._callbacks["$" + s];
|
|
@@ -2258,7 +2258,7 @@ D.prototype.off = D.prototype.removeListener = D.prototype.removeAllListeners =
|
|
|
2258
2258
|
}
|
|
2259
2259
|
return t.length === 0 && delete this._callbacks["$" + s], this;
|
|
2260
2260
|
};
|
|
2261
|
-
|
|
2261
|
+
U.prototype.emit = function(s) {
|
|
2262
2262
|
this._callbacks = this._callbacks || {};
|
|
2263
2263
|
for (var e = new Array(arguments.length - 1), t = this._callbacks["$" + s], i = 1; i < arguments.length; i++)
|
|
2264
2264
|
e[i - 1] = arguments[i];
|
|
@@ -2269,26 +2269,26 @@ D.prototype.emit = function(s) {
|
|
|
2269
2269
|
}
|
|
2270
2270
|
return this;
|
|
2271
2271
|
};
|
|
2272
|
-
|
|
2273
|
-
|
|
2272
|
+
U.prototype.emitReserved = U.prototype.emit;
|
|
2273
|
+
U.prototype.listeners = function(s) {
|
|
2274
2274
|
return this._callbacks = this._callbacks || {}, this._callbacks["$" + s] || [];
|
|
2275
2275
|
};
|
|
2276
|
-
|
|
2276
|
+
U.prototype.hasListeners = function(s) {
|
|
2277
2277
|
return !!this.listeners(s).length;
|
|
2278
2278
|
};
|
|
2279
|
-
const vt = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), Y = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(),
|
|
2279
|
+
const vt = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), Y = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), jr = "arraybuffer";
|
|
2280
2280
|
function rn(s, ...e) {
|
|
2281
2281
|
return e.reduce((t, i) => (s.hasOwnProperty(i) && (t[i] = s[i]), t), {});
|
|
2282
2282
|
}
|
|
2283
|
-
const
|
|
2283
|
+
const Lr = Y.setTimeout, $r = Y.clearTimeout;
|
|
2284
2284
|
function It(s, e) {
|
|
2285
|
-
e.useNativeTimers ? (s.setTimeoutFn =
|
|
2286
|
-
}
|
|
2287
|
-
const $r = 1.33;
|
|
2288
|
-
function Fr(s) {
|
|
2289
|
-
return typeof s == "string" ? zr(s) : Math.ceil((s.byteLength || s.size) * $r);
|
|
2285
|
+
e.useNativeTimers ? (s.setTimeoutFn = Lr.bind(Y), s.clearTimeoutFn = $r.bind(Y)) : (s.setTimeoutFn = Y.setTimeout.bind(Y), s.clearTimeoutFn = Y.clearTimeout.bind(Y));
|
|
2290
2286
|
}
|
|
2287
|
+
const Fr = 1.33;
|
|
2291
2288
|
function zr(s) {
|
|
2289
|
+
return typeof s == "string" ? Hr(s) : Math.ceil((s.byteLength || s.size) * Fr);
|
|
2290
|
+
}
|
|
2291
|
+
function Hr(s) {
|
|
2292
2292
|
let e = 0, t = 0;
|
|
2293
2293
|
for (let i = 0, n = s.length; i < n; i++)
|
|
2294
2294
|
e = s.charCodeAt(i), e < 128 ? t += 1 : e < 2048 ? t += 2 : e < 55296 || e >= 57344 ? t += 3 : (i++, t += 4);
|
|
@@ -2297,13 +2297,13 @@ function zr(s) {
|
|
|
2297
2297
|
function on() {
|
|
2298
2298
|
return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
|
|
2299
2299
|
}
|
|
2300
|
-
function
|
|
2300
|
+
function Kr(s) {
|
|
2301
2301
|
let e = "";
|
|
2302
2302
|
for (let t in s)
|
|
2303
2303
|
s.hasOwnProperty(t) && (e.length && (e += "&"), e += encodeURIComponent(t) + "=" + encodeURIComponent(s[t]));
|
|
2304
2304
|
return e;
|
|
2305
2305
|
}
|
|
2306
|
-
function
|
|
2306
|
+
function Wr(s) {
|
|
2307
2307
|
let e = {}, t = s.split("&");
|
|
2308
2308
|
for (let i = 0, n = t.length; i < n; i++) {
|
|
2309
2309
|
let r = t[i].split("=");
|
|
@@ -2311,12 +2311,12 @@ function Kr(s) {
|
|
|
2311
2311
|
}
|
|
2312
2312
|
return e;
|
|
2313
2313
|
}
|
|
2314
|
-
class
|
|
2314
|
+
class Vr extends Error {
|
|
2315
2315
|
constructor(e, t, i) {
|
|
2316
2316
|
super(e), this.description = t, this.context = i, this.type = "TransportError";
|
|
2317
2317
|
}
|
|
2318
2318
|
}
|
|
2319
|
-
class Cs extends
|
|
2319
|
+
class Cs extends U {
|
|
2320
2320
|
/**
|
|
2321
2321
|
* Transport abstract constructor.
|
|
2322
2322
|
*
|
|
@@ -2336,7 +2336,7 @@ class Cs extends D {
|
|
|
2336
2336
|
* @protected
|
|
2337
2337
|
*/
|
|
2338
2338
|
onError(e, t, i) {
|
|
2339
|
-
return super.emitReserved("error", new
|
|
2339
|
+
return super.emitReserved("error", new Vr(e, t, i)), this;
|
|
2340
2340
|
}
|
|
2341
2341
|
/**
|
|
2342
2342
|
* Opens the transport.
|
|
@@ -2410,11 +2410,11 @@ class Cs extends D {
|
|
|
2410
2410
|
return this.opts.port && (this.opts.secure && Number(this.opts.port) !== 443 || !this.opts.secure && Number(this.opts.port) !== 80) ? ":" + this.opts.port : "";
|
|
2411
2411
|
}
|
|
2412
2412
|
_query(e) {
|
|
2413
|
-
const t =
|
|
2413
|
+
const t = Kr(e);
|
|
2414
2414
|
return t.length ? "?" + t : "";
|
|
2415
2415
|
}
|
|
2416
2416
|
}
|
|
2417
|
-
class
|
|
2417
|
+
class Gr extends Cs {
|
|
2418
2418
|
constructor() {
|
|
2419
2419
|
super(...arguments), this._polling = !1;
|
|
2420
2420
|
}
|
|
@@ -2470,7 +2470,7 @@ class Vr extends Cs {
|
|
|
2470
2470
|
return this.onClose({ description: "transport closed by the server" }), !1;
|
|
2471
2471
|
this.onPacket(i);
|
|
2472
2472
|
};
|
|
2473
|
-
|
|
2473
|
+
Dr(e, this.socket.binaryType).forEach(t), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
|
|
2474
2474
|
}
|
|
2475
2475
|
/**
|
|
2476
2476
|
* For polling, send a close packet.
|
|
@@ -2490,7 +2490,7 @@ class Vr extends Cs {
|
|
|
2490
2490
|
* @protected
|
|
2491
2491
|
*/
|
|
2492
2492
|
write(e) {
|
|
2493
|
-
this.writable = !1,
|
|
2493
|
+
this.writable = !1, xr(e, (t) => {
|
|
2494
2494
|
this.doWrite(t, () => {
|
|
2495
2495
|
this.writable = !0, this.emitReserved("drain");
|
|
2496
2496
|
});
|
|
@@ -2511,10 +2511,10 @@ try {
|
|
|
2511
2511
|
an = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
|
|
2512
2512
|
} catch {
|
|
2513
2513
|
}
|
|
2514
|
-
const
|
|
2515
|
-
function
|
|
2514
|
+
const Qr = an;
|
|
2515
|
+
function Jr() {
|
|
2516
2516
|
}
|
|
2517
|
-
class
|
|
2517
|
+
class Xr extends Gr {
|
|
2518
2518
|
/**
|
|
2519
2519
|
* XHR Polling constructor.
|
|
2520
2520
|
*
|
|
@@ -2556,7 +2556,7 @@ class Jr extends Vr {
|
|
|
2556
2556
|
}), this.pollXhr = e;
|
|
2557
2557
|
}
|
|
2558
2558
|
}
|
|
2559
|
-
let Ae = class ot extends
|
|
2559
|
+
let Ae = class ot extends U {
|
|
2560
2560
|
/**
|
|
2561
2561
|
* Request constructor
|
|
2562
2562
|
*
|
|
@@ -2627,7 +2627,7 @@ let Ae = class ot extends D {
|
|
|
2627
2627
|
*/
|
|
2628
2628
|
_cleanup(e) {
|
|
2629
2629
|
if (!(typeof this._xhr > "u" || this._xhr === null)) {
|
|
2630
|
-
if (this._xhr.onreadystatechange =
|
|
2630
|
+
if (this._xhr.onreadystatechange = Jr, e)
|
|
2631
2631
|
try {
|
|
2632
2632
|
this._xhr.abort();
|
|
2633
2633
|
} catch {
|
|
@@ -2667,17 +2667,17 @@ function ai() {
|
|
|
2667
2667
|
for (let s in Ae.requests)
|
|
2668
2668
|
Ae.requests.hasOwnProperty(s) && Ae.requests[s].abort();
|
|
2669
2669
|
}
|
|
2670
|
-
const
|
|
2670
|
+
const Yr = (function() {
|
|
2671
2671
|
const s = cn({
|
|
2672
2672
|
xdomain: !1
|
|
2673
2673
|
});
|
|
2674
2674
|
return s && s.responseType !== null;
|
|
2675
2675
|
})();
|
|
2676
|
-
class
|
|
2676
|
+
class Zr extends Xr {
|
|
2677
2677
|
constructor(e) {
|
|
2678
2678
|
super(e);
|
|
2679
2679
|
const t = e && e.forceBase64;
|
|
2680
|
-
this.supportsBinary =
|
|
2680
|
+
this.supportsBinary = Yr && !t;
|
|
2681
2681
|
}
|
|
2682
2682
|
request(e = {}) {
|
|
2683
2683
|
return Object.assign(e, { xd: this.xd }, this.opts), new Ae(cn, this.uri(), e);
|
|
@@ -2686,7 +2686,7 @@ class Yr extends Jr {
|
|
|
2686
2686
|
function cn(s) {
|
|
2687
2687
|
const e = s.xdomain;
|
|
2688
2688
|
try {
|
|
2689
|
-
if (typeof XMLHttpRequest < "u" && (!e ||
|
|
2689
|
+
if (typeof XMLHttpRequest < "u" && (!e || Qr))
|
|
2690
2690
|
return new XMLHttpRequest();
|
|
2691
2691
|
} catch {
|
|
2692
2692
|
}
|
|
@@ -2697,7 +2697,7 @@ function cn(s) {
|
|
|
2697
2697
|
}
|
|
2698
2698
|
}
|
|
2699
2699
|
const dn = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
|
|
2700
|
-
class
|
|
2700
|
+
class eo extends Cs {
|
|
2701
2701
|
get name() {
|
|
2702
2702
|
return "websocket";
|
|
2703
2703
|
}
|
|
@@ -2754,7 +2754,7 @@ class Zr extends Cs {
|
|
|
2754
2754
|
}
|
|
2755
2755
|
}
|
|
2756
2756
|
const Ot = Y.WebSocket || Y.MozWebSocket;
|
|
2757
|
-
class
|
|
2757
|
+
class to extends eo {
|
|
2758
2758
|
createSocket(e, t, i) {
|
|
2759
2759
|
return dn ? new Ot(e, t, i) : t ? new Ot(e, t) : new Ot(e);
|
|
2760
2760
|
}
|
|
@@ -2762,7 +2762,7 @@ class eo extends Zr {
|
|
|
2762
2762
|
this.ws.send(t);
|
|
2763
2763
|
}
|
|
2764
2764
|
}
|
|
2765
|
-
class
|
|
2765
|
+
class so extends Cs {
|
|
2766
2766
|
get name() {
|
|
2767
2767
|
return "webtransport";
|
|
2768
2768
|
}
|
|
@@ -2778,7 +2778,7 @@ class to extends Cs {
|
|
|
2778
2778
|
this.onError("webtransport error", e);
|
|
2779
2779
|
}), this._transport.ready.then(() => {
|
|
2780
2780
|
this._transport.createBidirectionalStream().then((e) => {
|
|
2781
|
-
const t =
|
|
2781
|
+
const t = Nr(Number.MAX_SAFE_INTEGER, this.socket.binaryType), i = e.readable.pipeThrough(t).getReader(), n = Ur();
|
|
2782
2782
|
n.readable.pipeTo(e.writable), this._writer = n.writable.getWriter();
|
|
2783
2783
|
const r = () => {
|
|
2784
2784
|
i.read().then(({ done: o, value: c }) => {
|
|
@@ -2808,11 +2808,11 @@ class to extends Cs {
|
|
|
2808
2808
|
(e = this._transport) === null || e === void 0 || e.close();
|
|
2809
2809
|
}
|
|
2810
2810
|
}
|
|
2811
|
-
const
|
|
2812
|
-
websocket:
|
|
2813
|
-
webtransport:
|
|
2814
|
-
polling:
|
|
2815
|
-
},
|
|
2811
|
+
const io = {
|
|
2812
|
+
websocket: to,
|
|
2813
|
+
webtransport: so,
|
|
2814
|
+
polling: Zr
|
|
2815
|
+
}, no = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, ro = [
|
|
2816
2816
|
"source",
|
|
2817
2817
|
"protocol",
|
|
2818
2818
|
"authority",
|
|
@@ -2833,16 +2833,16 @@ function us(s) {
|
|
|
2833
2833
|
throw "URI too long";
|
|
2834
2834
|
const e = s, t = s.indexOf("["), i = s.indexOf("]");
|
|
2835
2835
|
t != -1 && i != -1 && (s = s.substring(0, t) + s.substring(t, i).replace(/:/g, ";") + s.substring(i, s.length));
|
|
2836
|
-
let n =
|
|
2836
|
+
let n = no.exec(s || ""), r = {}, a = 14;
|
|
2837
2837
|
for (; a--; )
|
|
2838
|
-
r[
|
|
2839
|
-
return t != -1 && i != -1 && (r.source = e, r.host = r.host.substring(1, r.host.length - 1).replace(/;/g, ":"), r.authority = r.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), r.ipv6uri = !0), r.pathNames =
|
|
2838
|
+
r[ro[a]] = n[a] || "";
|
|
2839
|
+
return t != -1 && i != -1 && (r.source = e, r.host = r.host.substring(1, r.host.length - 1).replace(/;/g, ":"), r.authority = r.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), r.ipv6uri = !0), r.pathNames = oo(r, r.path), r.queryKey = ao(r, r.query), r;
|
|
2840
2840
|
}
|
|
2841
|
-
function
|
|
2841
|
+
function oo(s, e) {
|
|
2842
2842
|
const t = /\/{2,9}/g, i = e.replace(t, "/").split("/");
|
|
2843
2843
|
return (e.slice(0, 1) == "/" || e.length === 0) && i.splice(0, 1), e.slice(-1) == "/" && i.splice(i.length - 1, 1), i;
|
|
2844
2844
|
}
|
|
2845
|
-
function
|
|
2845
|
+
function ao(s, e) {
|
|
2846
2846
|
const t = {};
|
|
2847
2847
|
return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(i, n, r) {
|
|
2848
2848
|
n && (t[n] = r);
|
|
@@ -2852,7 +2852,7 @@ const hs = typeof addEventListener == "function" && typeof removeEventListener =
|
|
|
2852
2852
|
hs && addEventListener("offline", () => {
|
|
2853
2853
|
at.forEach((s) => s());
|
|
2854
2854
|
}, !1);
|
|
2855
|
-
class fe extends
|
|
2855
|
+
class fe extends U {
|
|
2856
2856
|
/**
|
|
2857
2857
|
* Socket constructor.
|
|
2858
2858
|
*
|
|
@@ -2860,7 +2860,7 @@ class fe extends D {
|
|
|
2860
2860
|
* @param {Object} opts - options
|
|
2861
2861
|
*/
|
|
2862
2862
|
constructor(e, t) {
|
|
2863
|
-
if (super(), this.binaryType =
|
|
2863
|
+
if (super(), this.binaryType = jr, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, e && typeof e == "object" && (t = e, e = null), e) {
|
|
2864
2864
|
const i = us(e);
|
|
2865
2865
|
t.hostname = i.host, t.secure = i.protocol === "https" || i.protocol === "wss", t.port = i.port, i.query && (t.query = i.query);
|
|
2866
2866
|
} else t.host && (t.hostname = us(t.host).host);
|
|
@@ -2881,7 +2881,7 @@ class fe extends D {
|
|
|
2881
2881
|
},
|
|
2882
2882
|
transportOptions: {},
|
|
2883
2883
|
closeOnBeforeunload: !1
|
|
2884
|
-
}, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query =
|
|
2884
|
+
}, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = Wr(this.opts.query)), hs && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
|
|
2885
2885
|
this.transport && (this.transport.removeAllListeners(), this.transport.close());
|
|
2886
2886
|
}, addEventListener("beforeunload", this._beforeunloadEventListener, !1)), this.hostname !== "localhost" && (this._offlineEventListener = () => {
|
|
2887
2887
|
this._onClose("transport close", {
|
|
@@ -3016,7 +3016,7 @@ class fe extends D {
|
|
|
3016
3016
|
let t = 1;
|
|
3017
3017
|
for (let i = 0; i < this.writeBuffer.length; i++) {
|
|
3018
3018
|
const n = this.writeBuffer[i].data;
|
|
3019
|
-
if (n && (t +=
|
|
3019
|
+
if (n && (t += zr(n)), i > 0 && t > this._maxPayload)
|
|
3020
3020
|
return this.writeBuffer.slice(0, i);
|
|
3021
3021
|
t += 2;
|
|
3022
3022
|
}
|
|
@@ -3123,7 +3123,7 @@ class fe extends D {
|
|
|
3123
3123
|
}
|
|
3124
3124
|
}
|
|
3125
3125
|
fe.protocol = nn;
|
|
3126
|
-
class
|
|
3126
|
+
class co extends fe {
|
|
3127
3127
|
constructor() {
|
|
3128
3128
|
super(...arguments), this._upgrades = [];
|
|
3129
3129
|
}
|
|
@@ -3195,21 +3195,21 @@ class ao extends fe {
|
|
|
3195
3195
|
return t;
|
|
3196
3196
|
}
|
|
3197
3197
|
}
|
|
3198
|
-
let
|
|
3198
|
+
let lo = class extends co {
|
|
3199
3199
|
constructor(e, t = {}) {
|
|
3200
3200
|
const i = typeof e == "object", n = i ? { ...e } : { ...t };
|
|
3201
|
-
(!n.transports || n.transports && typeof n.transports[0] == "string") && (n.transports = (n.transports || ["polling", "websocket", "webtransport"]).map((r) =>
|
|
3201
|
+
(!n.transports || n.transports && typeof n.transports[0] == "string") && (n.transports = (n.transports || ["polling", "websocket", "webtransport"]).map((r) => io[r]).filter((r) => !!r)), super(i ? n : e, n);
|
|
3202
3202
|
}
|
|
3203
3203
|
};
|
|
3204
|
-
function
|
|
3204
|
+
function uo(s, e = "", t) {
|
|
3205
3205
|
let i = s;
|
|
3206
3206
|
t = t || typeof location < "u" && location, s == null && (s = t.protocol + "//" + t.host), typeof s == "string" && (s.charAt(0) === "/" && (s.charAt(1) === "/" ? s = t.protocol + s : s = t.host + s), /^(https?|wss?):\/\//.test(s) || (typeof t < "u" ? s = t.protocol + "//" + s : s = "https://" + s), i = us(s)), i.port || (/^(http|ws)$/.test(i.protocol) ? i.port = "80" : /^(http|ws)s$/.test(i.protocol) && (i.port = "443")), i.path = i.path || "/";
|
|
3207
3207
|
const r = i.host.indexOf(":") !== -1 ? "[" + i.host + "]" : i.host;
|
|
3208
3208
|
return i.id = i.protocol + "://" + r + ":" + i.port + e, i.href = i.protocol + "://" + r + (t && t.port === i.port ? "" : ":" + i.port), i;
|
|
3209
3209
|
}
|
|
3210
|
-
const
|
|
3210
|
+
const ho = typeof ArrayBuffer == "function", po = (s) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(s) : s.buffer instanceof ArrayBuffer, ln = Object.prototype.toString, fo = typeof Blob == "function" || typeof Blob < "u" && ln.call(Blob) === "[object BlobConstructor]", mo = typeof File == "function" || typeof File < "u" && ln.call(File) === "[object FileConstructor]";
|
|
3211
3211
|
function Ms(s) {
|
|
3212
|
-
return
|
|
3212
|
+
return ho && (s instanceof ArrayBuffer || po(s)) || fo && s instanceof Blob || mo && s instanceof File;
|
|
3213
3213
|
}
|
|
3214
3214
|
function ct(s, e) {
|
|
3215
3215
|
if (!s || typeof s != "object")
|
|
@@ -3229,7 +3229,7 @@ function ct(s, e) {
|
|
|
3229
3229
|
return !0;
|
|
3230
3230
|
return !1;
|
|
3231
3231
|
}
|
|
3232
|
-
function
|
|
3232
|
+
function go(s) {
|
|
3233
3233
|
const e = [], t = s.data, i = s;
|
|
3234
3234
|
return i.data = dt(t, e), i.attachments = e.length, { packet: i, buffers: e };
|
|
3235
3235
|
}
|
|
@@ -3254,7 +3254,7 @@ function dt(s, e, t) {
|
|
|
3254
3254
|
}
|
|
3255
3255
|
return s;
|
|
3256
3256
|
}
|
|
3257
|
-
function
|
|
3257
|
+
function yo(s, e) {
|
|
3258
3258
|
return s.data = ps(s.data, e), delete s.attachments, s;
|
|
3259
3259
|
}
|
|
3260
3260
|
function ps(s, e) {
|
|
@@ -3272,7 +3272,7 @@ function ps(s, e) {
|
|
|
3272
3272
|
Object.prototype.hasOwnProperty.call(s, t) && (s[t] = ps(s[t], e));
|
|
3273
3273
|
return s;
|
|
3274
3274
|
}
|
|
3275
|
-
const
|
|
3275
|
+
const vo = [
|
|
3276
3276
|
"connect",
|
|
3277
3277
|
// used on the client side
|
|
3278
3278
|
"connect_error",
|
|
@@ -3290,7 +3290,7 @@ var R;
|
|
|
3290
3290
|
(function(s) {
|
|
3291
3291
|
s[s.CONNECT = 0] = "CONNECT", s[s.DISCONNECT = 1] = "DISCONNECT", s[s.EVENT = 2] = "EVENT", s[s.ACK = 3] = "ACK", s[s.CONNECT_ERROR = 4] = "CONNECT_ERROR", s[s.BINARY_EVENT = 5] = "BINARY_EVENT", s[s.BINARY_ACK = 6] = "BINARY_ACK";
|
|
3292
3292
|
})(R || (R = {}));
|
|
3293
|
-
class
|
|
3293
|
+
class Io {
|
|
3294
3294
|
/**
|
|
3295
3295
|
* Encoder constructor
|
|
3296
3296
|
*
|
|
@@ -3326,11 +3326,11 @@ class vo {
|
|
|
3326
3326
|
* a list of buffers.
|
|
3327
3327
|
*/
|
|
3328
3328
|
encodeAsBinary(e) {
|
|
3329
|
-
const t =
|
|
3329
|
+
const t = go(e), i = this.encodeAsString(t.packet), n = t.buffers;
|
|
3330
3330
|
return n.unshift(i), n;
|
|
3331
3331
|
}
|
|
3332
3332
|
}
|
|
3333
|
-
class Ps extends
|
|
3333
|
+
class Ps extends U {
|
|
3334
3334
|
/**
|
|
3335
3335
|
* Decoder constructor
|
|
3336
3336
|
*/
|
|
@@ -3352,7 +3352,7 @@ class Ps extends D {
|
|
|
3352
3352
|
throw new Error("got plaintext data when reconstructing a packet");
|
|
3353
3353
|
t = this.decodeString(e);
|
|
3354
3354
|
const i = t.type === R.BINARY_EVENT;
|
|
3355
|
-
i || t.type === R.BINARY_ACK ? (t.type = i ? R.EVENT : R.ACK, this.reconstructor = new
|
|
3355
|
+
i || t.type === R.BINARY_ACK ? (t.type = i ? R.EVENT : R.ACK, this.reconstructor = new bo(t)) : super.emitReserved("decoded", t);
|
|
3356
3356
|
} else if (Ms(e) || e.base64)
|
|
3357
3357
|
if (this.reconstructor)
|
|
3358
3358
|
t = this.reconstructor.takeBinaryData(e), t && (this.reconstructor = null, super.emitReserved("decoded", t));
|
|
@@ -3382,7 +3382,7 @@ class Ps extends D {
|
|
|
3382
3382
|
if (a != Number(a) || e.charAt(t) !== "-")
|
|
3383
3383
|
throw new Error("Illegal attachments");
|
|
3384
3384
|
const o = Number(a);
|
|
3385
|
-
if (!
|
|
3385
|
+
if (!wo(o) || o < 1)
|
|
3386
3386
|
throw new Error("Illegal attachments");
|
|
3387
3387
|
if (o > this.opts.maxAttachments)
|
|
3388
3388
|
throw new Error("too many attachments");
|
|
@@ -3435,7 +3435,7 @@ class Ps extends D {
|
|
|
3435
3435
|
return typeof t == "string" || ci(t);
|
|
3436
3436
|
case R.EVENT:
|
|
3437
3437
|
case R.BINARY_EVENT:
|
|
3438
|
-
return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" &&
|
|
3438
|
+
return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && vo.indexOf(t[0]) === -1);
|
|
3439
3439
|
case R.ACK:
|
|
3440
3440
|
case R.BINARY_ACK:
|
|
3441
3441
|
return Array.isArray(t);
|
|
@@ -3448,7 +3448,7 @@ class Ps extends D {
|
|
|
3448
3448
|
this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
|
|
3449
3449
|
}
|
|
3450
3450
|
}
|
|
3451
|
-
class
|
|
3451
|
+
class bo {
|
|
3452
3452
|
constructor(e) {
|
|
3453
3453
|
this.packet = e, this.buffers = [], this.reconPack = e;
|
|
3454
3454
|
}
|
|
@@ -3462,7 +3462,7 @@ class Io {
|
|
|
3462
3462
|
*/
|
|
3463
3463
|
takeBinaryData(e) {
|
|
3464
3464
|
if (this.buffers.push(e), this.buffers.length === this.reconPack.attachments) {
|
|
3465
|
-
const t =
|
|
3465
|
+
const t = yo(this.reconPack, this.buffers);
|
|
3466
3466
|
return this.finishedReconstruction(), t;
|
|
3467
3467
|
}
|
|
3468
3468
|
return null;
|
|
@@ -3474,16 +3474,16 @@ class Io {
|
|
|
3474
3474
|
this.reconPack = null, this.buffers = [];
|
|
3475
3475
|
}
|
|
3476
3476
|
}
|
|
3477
|
-
const
|
|
3477
|
+
const wo = Number.isInteger || function(s) {
|
|
3478
3478
|
return typeof s == "number" && isFinite(s) && Math.floor(s) === s;
|
|
3479
3479
|
};
|
|
3480
3480
|
function ci(s) {
|
|
3481
3481
|
return Object.prototype.toString.call(s) === "[object Object]";
|
|
3482
3482
|
}
|
|
3483
|
-
const
|
|
3483
|
+
const _o = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3484
3484
|
__proto__: null,
|
|
3485
3485
|
Decoder: Ps,
|
|
3486
|
-
Encoder:
|
|
3486
|
+
Encoder: Io,
|
|
3487
3487
|
get PacketType() {
|
|
3488
3488
|
return R;
|
|
3489
3489
|
}
|
|
@@ -3493,7 +3493,7 @@ function ee(s, e, t) {
|
|
|
3493
3493
|
s.off(e, t);
|
|
3494
3494
|
};
|
|
3495
3495
|
}
|
|
3496
|
-
const
|
|
3496
|
+
const So = Object.freeze({
|
|
3497
3497
|
connect: 1,
|
|
3498
3498
|
connect_error: 1,
|
|
3499
3499
|
disconnect: 1,
|
|
@@ -3502,7 +3502,7 @@ const _o = Object.freeze({
|
|
|
3502
3502
|
newListener: 1,
|
|
3503
3503
|
removeListener: 1
|
|
3504
3504
|
});
|
|
3505
|
-
class un extends
|
|
3505
|
+
class un extends U {
|
|
3506
3506
|
/**
|
|
3507
3507
|
* `Socket` constructor.
|
|
3508
3508
|
*/
|
|
@@ -3618,7 +3618,7 @@ class un extends D {
|
|
|
3618
3618
|
*/
|
|
3619
3619
|
emit(e, ...t) {
|
|
3620
3620
|
var i, n, r;
|
|
3621
|
-
if (
|
|
3621
|
+
if (So.hasOwnProperty(e))
|
|
3622
3622
|
throw new Error('"' + e.toString() + '" is a reserved event name');
|
|
3623
3623
|
if (t.unshift(e), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile)
|
|
3624
3624
|
return this._addToQueue(t), this;
|
|
@@ -4117,7 +4117,7 @@ Te.prototype.setMax = function(s) {
|
|
|
4117
4117
|
Te.prototype.setJitter = function(s) {
|
|
4118
4118
|
this.jitter = s;
|
|
4119
4119
|
};
|
|
4120
|
-
class fs extends
|
|
4120
|
+
class fs extends U {
|
|
4121
4121
|
constructor(e, t) {
|
|
4122
4122
|
var i;
|
|
4123
4123
|
super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t = t || {}, t.path = t.path || "/socket.io", this.opts = t, It(this, t), this.reconnection(t.reconnection !== !1), this.reconnectionAttempts(t.reconnectionAttempts || 1 / 0), this.reconnectionDelay(t.reconnectionDelay || 1e3), this.reconnectionDelayMax(t.reconnectionDelayMax || 5e3), this.randomizationFactor((i = t.randomizationFactor) !== null && i !== void 0 ? i : 0.5), this.backoff = new Te({
|
|
@@ -4125,7 +4125,7 @@ class fs extends D {
|
|
|
4125
4125
|
max: this.reconnectionDelayMax(),
|
|
4126
4126
|
jitter: this.randomizationFactor()
|
|
4127
4127
|
}), this.timeout(t.timeout == null ? 2e4 : t.timeout), this._readyState = "closed", this.uri = e;
|
|
4128
|
-
const n = t.parser ||
|
|
4128
|
+
const n = t.parser || _o;
|
|
4129
4129
|
this.encoder = new n.Encoder(), this.decoder = new n.Decoder(), this._autoConnect = t.autoConnect !== !1, this._autoConnect && this.open();
|
|
4130
4130
|
}
|
|
4131
4131
|
reconnection(e) {
|
|
@@ -4168,7 +4168,7 @@ class fs extends D {
|
|
|
4168
4168
|
open(e) {
|
|
4169
4169
|
if (~this._readyState.indexOf("open"))
|
|
4170
4170
|
return this;
|
|
4171
|
-
this.engine = new
|
|
4171
|
+
this.engine = new lo(this.uri, this.opts);
|
|
4172
4172
|
const t = this.engine, i = this;
|
|
4173
4173
|
this._readyState = "opening", this.skipReconnect = !1;
|
|
4174
4174
|
const n = ee(t, "open", function() {
|
|
@@ -4358,7 +4358,7 @@ class fs extends D {
|
|
|
4358
4358
|
const Ce = {};
|
|
4359
4359
|
function lt(s, e) {
|
|
4360
4360
|
typeof s == "object" && (e = s, s = void 0), e = e || {};
|
|
4361
|
-
const t =
|
|
4361
|
+
const t = uo(s, e.path || "/socket.io"), i = t.source, n = t.id, r = t.path, a = Ce[n] && r in Ce[n].nsps, o = e.forceNew || e["force new connection"] || e.multiplex === !1 || a;
|
|
4362
4362
|
let c;
|
|
4363
4363
|
return o ? c = new fs(i, e) : (Ce[n] || (Ce[n] = new fs(i, e)), c = Ce[n]), t.query && !e.query && (e.query = t.queryKey), c.socket(t.path, e);
|
|
4364
4364
|
}
|
|
@@ -4368,7 +4368,7 @@ Object.assign(lt, {
|
|
|
4368
4368
|
io: lt,
|
|
4369
4369
|
connect: lt
|
|
4370
4370
|
});
|
|
4371
|
-
const
|
|
4371
|
+
const Ro = 9e4, Ao = /* @__PURE__ */ new Set([
|
|
4372
4372
|
"chat.user_message",
|
|
4373
4373
|
"chat.retry_last_user_message",
|
|
4374
4374
|
"run.stop",
|
|
@@ -4393,7 +4393,7 @@ function di(s, e) {
|
|
|
4393
4393
|
const t = s.result && typeof s.result == "object" ? s.result : void 0, i = typeof t?.message == "string" && t.message.trim() ? t.message : `${e} (${s.code ?? "request_rejected"})`;
|
|
4394
4394
|
return new b(i, s.code ?? "request_rejected", !1, s.result, !0);
|
|
4395
4395
|
}
|
|
4396
|
-
class
|
|
4396
|
+
class Eo {
|
|
4397
4397
|
constructor(e) {
|
|
4398
4398
|
this.options = e, this.socket = lt(`${e.backendUrl.replace(/\/$/, "")}/product-agent`, {
|
|
4399
4399
|
path: "/api/product-agent/socket.io",
|
|
@@ -4402,7 +4402,7 @@ class Ao {
|
|
|
4402
4402
|
reconnectionDelay: 1e3,
|
|
4403
4403
|
reconnectionDelayMax: 1e4,
|
|
4404
4404
|
randomizationFactor: 0.5,
|
|
4405
|
-
timeout:
|
|
4405
|
+
timeout: 3e4,
|
|
4406
4406
|
forceNew: !0,
|
|
4407
4407
|
auth: { ...e.auth },
|
|
4408
4408
|
reconnection: e.reconnect ?? !0
|
|
@@ -4545,7 +4545,7 @@ class Ao {
|
|
|
4545
4545
|
readinessPhase: this.ready ? "bootstrap" : this.admitted ? "activation" : "namespace_ready"
|
|
4546
4546
|
})), e === this.generation && this.recover(i));
|
|
4547
4547
|
};
|
|
4548
|
-
this.admissionTimer = setTimeout(() => t("connect_timeout"),
|
|
4548
|
+
this.admissionTimer = setTimeout(() => t("connect_timeout"), 6e4), this.readinessTimer = setTimeout(() => t("auth_timeout"), Ro);
|
|
4549
4549
|
}
|
|
4550
4550
|
clearReadinessTimers() {
|
|
4551
4551
|
this.admissionTimer !== null && clearTimeout(this.admissionTimer), this.readinessTimer !== null && clearTimeout(this.readinessTimer), this.admissionTimer = null, this.readinessTimer = null;
|
|
@@ -4566,7 +4566,7 @@ class Ao {
|
|
|
4566
4566
|
this.bindings.get(e)?.owners.delete(t), this.ready && await this.synchronize();
|
|
4567
4567
|
}
|
|
4568
4568
|
async rpc(e, t) {
|
|
4569
|
-
if (!
|
|
4569
|
+
if (!Ao.has(e)) throw new b("Operation requires its HTTP adapter", "unsupported_rpc");
|
|
4570
4570
|
const i = this.generation, n = JSON.stringify(t);
|
|
4571
4571
|
return e === "run.stop" && this.uploadingResult ? (this.assertReady(i), this.request("runtime.rpc", { type: e, payload: JSON.parse(n) }, i)) : this.enqueue(async () => {
|
|
4572
4572
|
if (this.assertReady(i), e === "tool.result") {
|
|
@@ -4703,7 +4703,7 @@ class Ao {
|
|
|
4703
4703
|
}
|
|
4704
4704
|
}
|
|
4705
4705
|
}
|
|
4706
|
-
function
|
|
4706
|
+
function To() {
|
|
4707
4707
|
const s = crypto.getRandomValues(new Uint8Array(16));
|
|
4708
4708
|
s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128;
|
|
4709
4709
|
const e = Array.from(s, (t) => t.toString(16).padStart(2, "0")).join("");
|
|
@@ -4767,7 +4767,7 @@ class hn {
|
|
|
4767
4767
|
h.signal.aborted || (p.trigger = S, h.abort());
|
|
4768
4768
|
}, m = () => f("transport_disposed"), y = () => f(["owner_disposed", "authority_retired", "observation_released", "request_replaced"].includes(a?.reason) ? a.reason : "caller_cancelled");
|
|
4769
4769
|
this.requests.signal.addEventListener("abort", m, { once: !0 }), a?.addEventListener("abort", y, { once: !0 });
|
|
4770
|
-
const g = r === "conversations" && /^\/[^/]+\/snapshot$/.test(e) && n === "POST", w = /^\/conversations(?:\/[^/]+)?$/.test(e) && (n ?? (i === void 0 ? "GET" : "POST")) === "GET", I = setTimeout(() => f("deadline"), w ? 6e4 : g ? 3e4 : 15e3), _ =
|
|
4770
|
+
const g = r === "conversations" && /^\/[^/]+\/snapshot$/.test(e) && n === "POST", w = /^\/conversations(?:\/[^/]+)?$/.test(e) && (n ?? (i === void 0 ? "GET" : "POST")) === "GET", I = setTimeout(() => f("deadline"), w ? 6e4 : g ? 3e4 : 15e3), _ = To(), E = Date.now();
|
|
4771
4771
|
let C = null, M = !1, te = null, B = null, V = null;
|
|
4772
4772
|
try {
|
|
4773
4773
|
const S = await Promise.resolve(fetch(l, {
|
|
@@ -4872,11 +4872,11 @@ function pn() {
|
|
|
4872
4872
|
function x(s) {
|
|
4873
4873
|
return JSON.stringify([s.kind, s.origin, s.limit]);
|
|
4874
4874
|
}
|
|
4875
|
-
function
|
|
4875
|
+
function ko(s) {
|
|
4876
4876
|
const e = s.map((t) => Ue(t) || t.requestId !== null && t.status !== "error" ? { ...t, status: t.status === "error" ? t.data?.length ? "refreshing" : "loading" : t.status, error: null } : t);
|
|
4877
4877
|
return e.find((t) => t.status === "error") ?? e.find((t) => t.status === "loading_more" || t.status === "loading" || t.status === "refreshing") ?? e.find((t) => t.query.kind === "recent") ?? e[0];
|
|
4878
4878
|
}
|
|
4879
|
-
function
|
|
4879
|
+
function qo(s) {
|
|
4880
4880
|
return [...new Set(s.flatMap((e) => e.data ?? []))];
|
|
4881
4881
|
}
|
|
4882
4882
|
function Ue(s) {
|
|
@@ -4918,7 +4918,7 @@ function ui(s) {
|
|
|
4918
4918
|
c() || (i = s.runtime.engine.subscribe(c), n = s.runtime.onDispose(o));
|
|
4919
4919
|
});
|
|
4920
4920
|
}
|
|
4921
|
-
function
|
|
4921
|
+
function Co(s) {
|
|
4922
4922
|
const e = s.http.auth.client_kind === "extension" ? "extension" : void 0, t = /* @__PURE__ */ new Map();
|
|
4923
4923
|
return {
|
|
4924
4924
|
"directory.query": async (i) => {
|
|
@@ -4958,7 +4958,7 @@ function qo(s) {
|
|
|
4958
4958
|
}
|
|
4959
4959
|
};
|
|
4960
4960
|
}
|
|
4961
|
-
class
|
|
4961
|
+
class Mo {
|
|
4962
4962
|
constructor(e) {
|
|
4963
4963
|
this.options = e, this.owner = `directory:${e.authority.authorityId}:${e.authority.generation}`, this.boundary = { authority: e.authority, currentAuthority: () => e.runtime.engine.getState().slices.directory }, this.unsubscribe = e.runtime.engine.subscribe(() => this.reconcile());
|
|
4964
4964
|
}
|
|
@@ -5131,7 +5131,7 @@ class Co {
|
|
|
5131
5131
|
this.unsubscribe(), this.reconcile();
|
|
5132
5132
|
}
|
|
5133
5133
|
}
|
|
5134
|
-
function
|
|
5134
|
+
function Po(s) {
|
|
5135
5135
|
if (!s || typeof s != "object") return !1;
|
|
5136
5136
|
const e = s;
|
|
5137
5137
|
if (e.version !== 1 || typeof e.authorityId != "string" || typeof e.browserSessionId != "string" || !Array.isArray(e.bindings) || !e.mains || typeof e.mains != "object" || Array.isArray(e.mains)) return !1;
|
|
@@ -5148,7 +5148,7 @@ function Mo(s) {
|
|
|
5148
5148
|
return !0;
|
|
5149
5149
|
}
|
|
5150
5150
|
const hi = /* @__PURE__ */ new WeakMap();
|
|
5151
|
-
class
|
|
5151
|
+
class Oo {
|
|
5152
5152
|
constructor(e) {
|
|
5153
5153
|
this.options = e;
|
|
5154
5154
|
}
|
|
@@ -5218,7 +5218,7 @@ class Po {
|
|
|
5218
5218
|
const t = this.state();
|
|
5219
5219
|
if (!this.current() || Object.keys(t.clients).length || Object.keys(t.selections).length) return !1;
|
|
5220
5220
|
const i = await this.options.persistence.read();
|
|
5221
|
-
if (!
|
|
5221
|
+
if (!Po(i) || i.authorityId !== this.options.authority.authorityId || i.browserSessionId !== this.options.persistence.sessionId()) return !1;
|
|
5222
5222
|
const n = new Set(await this.options.persistence.liveClients());
|
|
5223
5223
|
if (!this.current() || this.state().clients !== t.clients) return !1;
|
|
5224
5224
|
const r = i.bindings.filter((c) => n.has(c.clientScopeId));
|
|
@@ -5240,7 +5240,7 @@ class Po {
|
|
|
5240
5240
|
return await Promise.all(a.map((c) => this.options.runtime.engine.dispatch(c))), !0;
|
|
5241
5241
|
}
|
|
5242
5242
|
}
|
|
5243
|
-
function
|
|
5243
|
+
function xo(s, e, t, i = () => crypto.randomUUID()) {
|
|
5244
5244
|
const n = `pluno.productAgent.directory:${encodeURIComponent(t)}:${encodeURIComponent(e)}`, r = `${n}:tabSession`, a = s.getItem(r) ?? i();
|
|
5245
5245
|
return s.setItem(r, a), {
|
|
5246
5246
|
sessionId: () => a,
|
|
@@ -5252,9 +5252,9 @@ function Oo(s, e, t, i = () => crypto.randomUUID()) {
|
|
|
5252
5252
|
};
|
|
5253
5253
|
}
|
|
5254
5254
|
const pi = /* @__PURE__ */ new Map(), fi = /* @__PURE__ */ new Map();
|
|
5255
|
-
function
|
|
5255
|
+
function Do(s, e, t = () => crypto.randomUUID()) {
|
|
5256
5256
|
try {
|
|
5257
|
-
return
|
|
5257
|
+
return xo(window.sessionStorage, s, e, t);
|
|
5258
5258
|
} catch (i) {
|
|
5259
5259
|
if (!(i instanceof DOMException) || i.name !== "SecurityError" && i.name !== "QuotaExceededError") throw i;
|
|
5260
5260
|
const n = `${e}:${s}`, r = fi.get(n) ?? t();
|
|
@@ -5268,13 +5268,13 @@ function xo(s, e, t = () => crypto.randomUUID()) {
|
|
|
5268
5268
|
};
|
|
5269
5269
|
}
|
|
5270
5270
|
}
|
|
5271
|
-
class
|
|
5271
|
+
class D extends EventTarget {
|
|
5272
5272
|
constructor(e) {
|
|
5273
5273
|
super(), this.options = e, this.httpTransport = new hn({
|
|
5274
5274
|
...e,
|
|
5275
5275
|
executorConnection: () => this.connectionId,
|
|
5276
5276
|
restoreExecutor: (t) => this.restoreExecutor(t)
|
|
5277
|
-
}), this.transport = new
|
|
5277
|
+
}), this.transport = new Eo({
|
|
5278
5278
|
backendUrl: e.backendUrl,
|
|
5279
5279
|
auth: e.auth,
|
|
5280
5280
|
displaySchema: e.displaySchema,
|
|
@@ -5360,7 +5360,7 @@ class N extends EventTarget {
|
|
|
5360
5360
|
startInitialReadinessBudget() {
|
|
5361
5361
|
this.hasBeenReady || this.initialReadinessTimer !== null || (this.initialReadinessTimer = setTimeout(() => {
|
|
5362
5362
|
this.initialReadinessTimer = null, !(this.hasBeenReady || this.readyState === 3) && (this.initialReadinessExpired = !0, this.receive({ type: "error", code: "connection_failed", message: "Pluno could not connect. Try again." }));
|
|
5363
|
-
},
|
|
5363
|
+
}, 12e4));
|
|
5364
5364
|
}
|
|
5365
5365
|
resetBootstrap() {
|
|
5366
5366
|
this.bootstrapRequests.abort(), this.bootstrapRequests = new AbortController(), this.suggestionTimer !== null && clearTimeout(this.suggestionTimer), this.suggestionTimer = null;
|
|
@@ -5651,7 +5651,7 @@ function mn(s) {
|
|
|
5651
5651
|
const e = s;
|
|
5652
5652
|
return typeof e.observedAt == "string" && e.observedAt.length <= 40 && Number.isFinite(Date.parse(e.observedAt)) && ve(e.sessionId) && ve(e.responseItemId) && ve(e.respondsToUserMessageId) && typeof e.panelVisible == "boolean" && typeof e.documentVisible == "boolean" && typeof e.loading == "boolean";
|
|
5653
5653
|
}
|
|
5654
|
-
function
|
|
5654
|
+
function Uo(s, e, t) {
|
|
5655
5655
|
if (!mn(t)) return;
|
|
5656
5656
|
const i = ms.get(s) ?? /* @__PURE__ */ new Map();
|
|
5657
5657
|
i.set(e, {
|
|
@@ -5664,11 +5664,11 @@ function Do(s, e, t) {
|
|
|
5664
5664
|
loading: t.loading
|
|
5665
5665
|
}), i.size > 2 && i.delete(i.keys().next().value), ms.set(s, i);
|
|
5666
5666
|
}
|
|
5667
|
-
function
|
|
5667
|
+
function No(s, e, t) {
|
|
5668
5668
|
const i = ms.get(s)?.get(e);
|
|
5669
5669
|
return i?.sessionId === t ? i : null;
|
|
5670
5670
|
}
|
|
5671
|
-
function
|
|
5671
|
+
function Bo(s, e, t, i, n, r, a, o, c = null, d = !1) {
|
|
5672
5672
|
const l = i ? o.find((h) => h.role === "user" && (h.id === i || h.clientMessageId === i)) : void 0, u = l ? [...o].reverse().find((h) => (h.role === "assistant" || h.dataType === "commentary_history" || h.dataType === "tool_summary") && h.respondsToUserMessageId === l.id) : void 0;
|
|
5673
5673
|
return {
|
|
5674
5674
|
capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -5678,14 +5678,14 @@ function No(s, e, t, i, n, r, a, o, c = null, d = !1) {
|
|
|
5678
5678
|
clientUserMessageItemId: l && ve(l.id) ? l.id : null,
|
|
5679
5679
|
clientResponseItemId: u && ve(u.id) ? u.id : null,
|
|
5680
5680
|
clientDraftObserved: !!(l && d && c === l.id),
|
|
5681
|
-
renderer:
|
|
5681
|
+
renderer: No(s, e, t)
|
|
5682
5682
|
};
|
|
5683
5683
|
}
|
|
5684
|
-
const
|
|
5684
|
+
const jo = 1e4, Lo = 3e3;
|
|
5685
5685
|
function gn() {
|
|
5686
5686
|
return { authenticated: !1, generation: 0, sequence: 0, displaySequence: 0, backendCount: null, query: Le("activeUsers") };
|
|
5687
5687
|
}
|
|
5688
|
-
function
|
|
5688
|
+
function $o(s, e) {
|
|
5689
5689
|
if (e.type === "activeUsers.authenticate") {
|
|
5690
5690
|
if (s.authenticated === e.authenticated) return { state: s, effects: [] };
|
|
5691
5691
|
const i = { ...gn(), authenticated: e.authenticated, generation: s.generation + 1 };
|
|
@@ -5707,7 +5707,7 @@ function Lo(s, e) {
|
|
|
5707
5707
|
return s.backendCount === null ? gi(t) : { state: t, effects: [] };
|
|
5708
5708
|
}
|
|
5709
5709
|
function mi(s) {
|
|
5710
|
-
const e = s.sequence + 1, t = `activeUsers:${s.generation}:${e}`, i = [{ id: `${t}:wait`, kind: "activeUsers.wait", input: { milliseconds:
|
|
5710
|
+
const e = s.sequence + 1, t = `activeUsers:${s.generation}:${e}`, i = [{ id: `${t}:wait`, kind: "activeUsers.wait", input: { milliseconds: jo } }];
|
|
5711
5711
|
return s.query.status === "loading" || s.query.status === "refreshing" ? { state: { ...s, sequence: e }, effects: i } : (i.push({ id: `${t}:load`, kind: "activeUsers.load", input: { generation: s.generation } }), { state: { ...s, sequence: e, query: { ...s.query, requestId: `${t}:load`, status: s.query.data === null ? "loading" : "refreshing", error: null } }, effects: i });
|
|
5712
5712
|
}
|
|
5713
5713
|
function gi(s) {
|
|
@@ -5715,11 +5715,11 @@ function gi(s) {
|
|
|
5715
5715
|
return { state: { ...s, displaySequence: e }, effects: [{
|
|
5716
5716
|
id: `activeUsers:${s.generation}:display:${e}`,
|
|
5717
5717
|
kind: "activeUsers.displayWait",
|
|
5718
|
-
input: { milliseconds:
|
|
5718
|
+
input: { milliseconds: Lo }
|
|
5719
5719
|
}] };
|
|
5720
5720
|
}
|
|
5721
|
-
const
|
|
5722
|
-
function
|
|
5721
|
+
const Fo = () => Object.freeze({ scopes: Object.freeze({}) });
|
|
5722
|
+
function zo(s, e) {
|
|
5723
5723
|
const t = s.scopes[e.clientScopeId];
|
|
5724
5724
|
let i;
|
|
5725
5725
|
if (e.type === "model.scope_close") {
|
|
@@ -5832,7 +5832,7 @@ function vi(s, e, t, i) {
|
|
|
5832
5832
|
membershipRevision: s.membershipRevision + 1
|
|
5833
5833
|
};
|
|
5834
5834
|
}
|
|
5835
|
-
function
|
|
5835
|
+
function Ho(s, e) {
|
|
5836
5836
|
switch (e.type) {
|
|
5837
5837
|
case "directory.bind":
|
|
5838
5838
|
case "directory.provisional": {
|
|
@@ -5844,7 +5844,7 @@ function zo(s, e) {
|
|
|
5844
5844
|
const n = s.clients[e.clientScopeId];
|
|
5845
5845
|
if (n === e.conversationScopeId) return s;
|
|
5846
5846
|
const r = s.selections[n];
|
|
5847
|
-
if (e.type === "directory.bind" && e.reason === "tool" && !
|
|
5847
|
+
if (e.type === "directory.bind" && e.reason === "tool" && !Ko(s, e.clientScopeId, e.sessionId))
|
|
5848
5848
|
throw new Error("Tool target is already bound to another conversation.");
|
|
5849
5849
|
return r && r.sessionId !== null && r.sessionId === t.sessionId ? {
|
|
5850
5850
|
...s,
|
|
@@ -5879,7 +5879,7 @@ function zo(s, e) {
|
|
|
5879
5879
|
return s;
|
|
5880
5880
|
}
|
|
5881
5881
|
}
|
|
5882
|
-
function
|
|
5882
|
+
function Ko(s, e, t) {
|
|
5883
5883
|
const i = s.clients[e];
|
|
5884
5884
|
return i === void 0 || s.selections[i].sessionId === t;
|
|
5885
5885
|
}
|
|
@@ -6027,11 +6027,11 @@ function Ie(s, e) {
|
|
|
6027
6027
|
}
|
|
6028
6028
|
t = { ...t, requestSequence: s.requestSequence + 1, requests: { ...t.requests, [n]: a } }, i.push({ id: n, ...a });
|
|
6029
6029
|
} else
|
|
6030
|
-
t =
|
|
6030
|
+
t = Ho(s, e);
|
|
6031
6031
|
}
|
|
6032
6032
|
return { state: $e(t), effects: i };
|
|
6033
6033
|
}
|
|
6034
|
-
function
|
|
6034
|
+
function Wo(s) {
|
|
6035
6035
|
const e = { ...s.entities };
|
|
6036
6036
|
for (const [a, o] of Object.entries(s.mutations)) {
|
|
6037
6037
|
if (!e[a]) continue;
|
|
@@ -6060,7 +6060,7 @@ function Ko(s) {
|
|
|
6060
6060
|
]))
|
|
6061
6061
|
});
|
|
6062
6062
|
}
|
|
6063
|
-
class
|
|
6063
|
+
class Vo {
|
|
6064
6064
|
constructor(e, t, i) {
|
|
6065
6065
|
this.handlers = e, this.accept = t, this.errorAdapter = i;
|
|
6066
6066
|
}
|
|
@@ -6099,7 +6099,7 @@ class Wo {
|
|
|
6099
6099
|
);
|
|
6100
6100
|
}
|
|
6101
6101
|
}
|
|
6102
|
-
class
|
|
6102
|
+
class Go {
|
|
6103
6103
|
state;
|
|
6104
6104
|
reducer;
|
|
6105
6105
|
selector;
|
|
@@ -6113,7 +6113,7 @@ class Vo {
|
|
|
6113
6113
|
scopedDiagnostics = /* @__PURE__ */ new Map();
|
|
6114
6114
|
diagnostics = { ownerId: `owner-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`, revision: 0, dropped: 0, lastSelection: null, transitions: [] };
|
|
6115
6115
|
constructor(e) {
|
|
6116
|
-
this.state = e.initialState, this.reducer = e.reducer, this.selector = e.selector, this.effectRunner = new
|
|
6116
|
+
this.state = e.initialState, this.reducer = e.reducer, this.selector = e.selector, this.effectRunner = new Vo(
|
|
6117
6117
|
e.effectHandlers,
|
|
6118
6118
|
(t) => this.acceptEffectResult(t),
|
|
6119
6119
|
e.errorAdapter
|
|
@@ -6131,7 +6131,7 @@ class Vo {
|
|
|
6131
6131
|
return this.state;
|
|
6132
6132
|
}
|
|
6133
6133
|
recordDiagnosticTransition(e, t = !1) {
|
|
6134
|
-
let i =
|
|
6134
|
+
let i = Zn(e, this.diagnostics.revision + 1, t);
|
|
6135
6135
|
if (i?.effectId) {
|
|
6136
6136
|
if (i.type === "effect.started")
|
|
6137
6137
|
this.diagnosticEffects.set(i.effectId, i), this.diagnosticEffects.size > 128 && this.diagnosticEffects.delete(this.diagnosticEffects.keys().next().value);
|
|
@@ -6247,7 +6247,7 @@ class Vo {
|
|
|
6247
6247
|
for (const t of this.listeners) t(e);
|
|
6248
6248
|
}
|
|
6249
6249
|
}
|
|
6250
|
-
const
|
|
6250
|
+
const Qo = Object.freeze({
|
|
6251
6251
|
modelSelection: "core",
|
|
6252
6252
|
directory: "core",
|
|
6253
6253
|
activeUsers: "core",
|
|
@@ -6257,24 +6257,24 @@ const Go = Object.freeze({
|
|
|
6257
6257
|
browserExecution: "legacy"
|
|
6258
6258
|
});
|
|
6259
6259
|
function Ii(s, e) {
|
|
6260
|
-
const t =
|
|
6260
|
+
const t = Qo[s], i = e[t];
|
|
6261
6261
|
if (!i) throw new Error(`No ${t} implementation for ${s}.`);
|
|
6262
6262
|
return i();
|
|
6263
6263
|
}
|
|
6264
|
-
function
|
|
6264
|
+
function Jo(s) {
|
|
6265
6265
|
return s.type === "effect.completed" || s.type === "effect.failed" ? s.effectKind === "directory.query" || s.effectKind === "directory.mutate" : s.type.startsWith("directory.");
|
|
6266
6266
|
}
|
|
6267
|
-
function
|
|
6267
|
+
function Xo(s) {
|
|
6268
6268
|
return s.type === "effect.completed" || s.type === "effect.failed" ? s.effectKind.startsWith("conversation.") : s.type.startsWith("conversation.");
|
|
6269
6269
|
}
|
|
6270
|
-
const
|
|
6270
|
+
const Yo = {
|
|
6271
6271
|
"directory.query": async () => {
|
|
6272
6272
|
throw new Error("Directory ports are not installed before S5-C.");
|
|
6273
6273
|
},
|
|
6274
6274
|
"directory.mutate": async () => {
|
|
6275
6275
|
throw new Error("Directory ports are not installed before S5-C.");
|
|
6276
6276
|
}
|
|
6277
|
-
},
|
|
6277
|
+
}, Zo = {
|
|
6278
6278
|
"conversation.prepare": async () => {
|
|
6279
6279
|
throw new Error("Conversation preparation adapter is not installed.");
|
|
6280
6280
|
},
|
|
@@ -6331,14 +6331,14 @@ function bi(s, e, t) {
|
|
|
6331
6331
|
}
|
|
6332
6332
|
return i;
|
|
6333
6333
|
}
|
|
6334
|
-
class
|
|
6334
|
+
class ea {
|
|
6335
6335
|
engine;
|
|
6336
6336
|
disposeListeners = /* @__PURE__ */ new Set();
|
|
6337
6337
|
conversationPorts;
|
|
6338
|
-
constructor(e =
|
|
6339
|
-
this.conversationPorts = { ...
|
|
6338
|
+
constructor(e = Yo, t = {}, i) {
|
|
6339
|
+
this.conversationPorts = { ...Zo, ...t }, this.engine = new Go({
|
|
6340
6340
|
initialState: Object.freeze({ revision: 0, slices: Object.freeze({
|
|
6341
|
-
modelSelection:
|
|
6341
|
+
modelSelection: Fo(),
|
|
6342
6342
|
directory: pn(),
|
|
6343
6343
|
conversation: Wi(),
|
|
6344
6344
|
activeUsers: gn()
|
|
@@ -6346,18 +6346,18 @@ class Zo {
|
|
|
6346
6346
|
reducer: (n, r) => {
|
|
6347
6347
|
const a = r.value;
|
|
6348
6348
|
if (a.type.startsWith("activeUsers.") || (a.type === "effect.completed" || a.type === "effect.failed") && a.effectKind.startsWith("activeUsers.")) {
|
|
6349
|
-
const c =
|
|
6349
|
+
const c = $o(n.slices.activeUsers, a);
|
|
6350
6350
|
return { state: c.state === n.slices.activeUsers ? n : Object.freeze({ revision: n.revision + 1, slices: Object.freeze({ ...n.slices, activeUsers: c.state }) }), effects: c.effects };
|
|
6351
6351
|
}
|
|
6352
|
-
if (
|
|
6352
|
+
if (Jo(a)) {
|
|
6353
6353
|
const c = Ie(n.slices.directory, a), d = cs(rs(n.slices.conversation, c.state)), l = os(n.slices.conversation, d.state, c.state, c.state.clients !== n.slices.directory.clients), u = l.state, h = bi(n.slices.conversation, u, c.state);
|
|
6354
6354
|
return { state: h === n.slices.directory && u === n.slices.conversation ? n : Object.freeze({
|
|
6355
6355
|
revision: n.revision + 1,
|
|
6356
6356
|
slices: Object.freeze({ ...n.slices, directory: h, conversation: u })
|
|
6357
6357
|
}), effects: [...l.effects, ...c.effects, ...d.effects] };
|
|
6358
6358
|
}
|
|
6359
|
-
if (
|
|
6360
|
-
const c =
|
|
6359
|
+
if (Xo(a)) {
|
|
6360
|
+
const c = mr(n.slices.conversation, a, n.slices.directory, n.slices.modelSelection);
|
|
6361
6361
|
let d = n.slices.directory;
|
|
6362
6362
|
for (const [p, f] of Object.entries(c.state.operations)) {
|
|
6363
6363
|
if (!["runtime.warmup", "attachment.prepare"].includes(f.command.type) || !f.conversationScopeId || f.phase !== "done" || n.slices.conversation.operations[p]?.phase === "done") continue;
|
|
@@ -6390,13 +6390,13 @@ class Zo {
|
|
|
6390
6390
|
slices: Object.freeze({ ...n.slices, directory: d, conversation: h.state })
|
|
6391
6391
|
}), effects: [...c.effects, ...h.effects, ...u.effects] };
|
|
6392
6392
|
}
|
|
6393
|
-
const o =
|
|
6393
|
+
const o = zo(n.slices.modelSelection, a);
|
|
6394
6394
|
return { state: o === n.slices.modelSelection ? n : Object.freeze({
|
|
6395
6395
|
revision: n.revision + 1,
|
|
6396
6396
|
slices: Object.freeze({ ...n.slices, modelSelection: o })
|
|
6397
6397
|
}), effects: [] };
|
|
6398
6398
|
},
|
|
6399
|
-
selector: (n) => Object.freeze({ ...n.slices, directory:
|
|
6399
|
+
selector: (n) => Object.freeze({ ...n.slices, directory: Wo(n.slices.directory), conversation: vr(n.slices.conversation, n.slices.directory) }),
|
|
6400
6400
|
effectHandlers: {
|
|
6401
6401
|
...e,
|
|
6402
6402
|
"conversation.prepare": (n) => this.conversationPorts["conversation.prepare"](n),
|
|
@@ -6450,8 +6450,8 @@ class Zo {
|
|
|
6450
6450
|
}
|
|
6451
6451
|
}
|
|
6452
6452
|
}
|
|
6453
|
-
const
|
|
6454
|
-
async function
|
|
6453
|
+
const ta = "pluno-product-agent-attachments", sa = 1, ys = "files", ia = 1440 * 60 * 1e3;
|
|
6454
|
+
async function na(s) {
|
|
6455
6455
|
const e = await bt();
|
|
6456
6456
|
await vn(e, "readwrite", (t) => t.put(s));
|
|
6457
6457
|
}
|
|
@@ -6478,7 +6478,7 @@ async function yn(s, e) {
|
|
|
6478
6478
|
});
|
|
6479
6479
|
});
|
|
6480
6480
|
}
|
|
6481
|
-
async function
|
|
6481
|
+
async function ra(s = ia) {
|
|
6482
6482
|
const e = await bt(), t = Date.now() - s;
|
|
6483
6483
|
await Os(e, "readwrite", async (i) => {
|
|
6484
6484
|
const n = i.index("lastUsedAt");
|
|
@@ -6487,7 +6487,7 @@ async function na(s = sa) {
|
|
|
6487
6487
|
}
|
|
6488
6488
|
function bt() {
|
|
6489
6489
|
return typeof indexedDB > "u" ? Promise.reject(new Error("Product Agent attachment storage is unavailable")) : new Promise((s, e) => {
|
|
6490
|
-
const t = indexedDB.open(
|
|
6490
|
+
const t = indexedDB.open(ta, sa);
|
|
6491
6491
|
t.onupgradeneeded = () => {
|
|
6492
6492
|
const n = t.result.createObjectStore(ys, { keyPath: "attachmentId" });
|
|
6493
6493
|
n.createIndex("lastUsedAt", "lastUsedAt", { unique: !1 }), n.createIndex("sessionId", "sessionId", { unique: !1 }), n.createIndex("origin", "origin", { unique: !1 });
|
|
@@ -6524,11 +6524,11 @@ function xs(s) {
|
|
|
6524
6524
|
s.onsuccess = () => e(s.result), s.onerror = () => t(s.error ?? new Error("Product Agent attachment storage request failed"));
|
|
6525
6525
|
});
|
|
6526
6526
|
}
|
|
6527
|
-
function
|
|
6527
|
+
function oa(s) {
|
|
6528
6528
|
return s !== null && (typeof s == "object" || typeof s == "function");
|
|
6529
6529
|
}
|
|
6530
6530
|
function In(s, e, t) {
|
|
6531
|
-
const i = Reflect.get(s, "pluno"), n =
|
|
6531
|
+
const i = Reflect.get(s, "pluno"), n = oa(i) ? i : {};
|
|
6532
6532
|
if (n !== i && !Reflect.set(s, "pluno", n))
|
|
6533
6533
|
return null;
|
|
6534
6534
|
const r = Object.getOwnPropertyDescriptor(n, e);
|
|
@@ -6543,12 +6543,12 @@ function In(s, e, t) {
|
|
|
6543
6543
|
};
|
|
6544
6544
|
}
|
|
6545
6545
|
const Ds = "suggest_share_on_socials";
|
|
6546
|
-
function
|
|
6546
|
+
function aa(s) {
|
|
6547
6547
|
for (let e = s.length - 1; e >= 0; e -= 1) {
|
|
6548
6548
|
const t = s[e];
|
|
6549
6549
|
if (t.role !== "tool" || t.toolName !== Ds || t.sharePromptAllowed !== void 0)
|
|
6550
6550
|
continue;
|
|
6551
|
-
if (
|
|
6551
|
+
if (da(s, e, t.callId) !== !0)
|
|
6552
6552
|
return null;
|
|
6553
6553
|
const i = _i(s, e, "assistant");
|
|
6554
6554
|
if (!i)
|
|
@@ -6562,7 +6562,7 @@ function oa(s) {
|
|
|
6562
6562
|
}
|
|
6563
6563
|
return null;
|
|
6564
6564
|
}
|
|
6565
|
-
function
|
|
6565
|
+
function ca(s) {
|
|
6566
6566
|
let e = s;
|
|
6567
6567
|
if (typeof s == "string")
|
|
6568
6568
|
try {
|
|
@@ -6570,10 +6570,10 @@ function aa(s) {
|
|
|
6570
6570
|
} catch {
|
|
6571
6571
|
return null;
|
|
6572
6572
|
}
|
|
6573
|
-
const t =
|
|
6573
|
+
const t = la(e);
|
|
6574
6574
|
return t ? typeof t.showSharePrompt == "boolean" ? t.showSharePrompt : t.ok === !0 && typeof t.message == "string" && t.message.includes("social-sharing prompt") ? !0 : null : null;
|
|
6575
6575
|
}
|
|
6576
|
-
function
|
|
6576
|
+
function da(s, e, t) {
|
|
6577
6577
|
if (!t)
|
|
6578
6578
|
return null;
|
|
6579
6579
|
for (let i = e + 1; i < s.length; i += 1) {
|
|
@@ -6591,17 +6591,17 @@ function _i(s, e, t) {
|
|
|
6591
6591
|
}
|
|
6592
6592
|
return null;
|
|
6593
6593
|
}
|
|
6594
|
-
function
|
|
6594
|
+
function la(s) {
|
|
6595
6595
|
return s && typeof s == "object" && !Array.isArray(s) ? s : null;
|
|
6596
6596
|
}
|
|
6597
|
-
const
|
|
6598
|
-
function
|
|
6599
|
-
return (s.type === "function_call" || s.type === "tool_call") && s.name ===
|
|
6597
|
+
const ua = "save_runtime_captured_skill";
|
|
6598
|
+
function ha(s) {
|
|
6599
|
+
return (s.type === "function_call" || s.type === "tool_call") && s.name === ua;
|
|
6600
6600
|
}
|
|
6601
|
-
const Ut = "pluno.productAgent.transportId",
|
|
6601
|
+
const Ut = "pluno.productAgent.transportId", pa = "pluno.productAgent.transportIdentity", Nt = "pluno.productAgent.transportIdentity.event", fa = 50, ma = globalThis.setTimeout.bind(globalThis);
|
|
6602
6602
|
let Pe = null;
|
|
6603
6603
|
const ut = /* @__PURE__ */ new Set(), Bt = /* @__PURE__ */ new Map();
|
|
6604
|
-
async function
|
|
6604
|
+
async function ga(s = bn()) {
|
|
6605
6605
|
const e = s.randomUUID(), t = s.storage.getItem(Ut);
|
|
6606
6606
|
let i = t ?? s.randomUUID(), n = !1, r = !1;
|
|
6607
6607
|
const a = s.channel.subscribe((c) => {
|
|
@@ -6639,8 +6639,8 @@ async function ma(s = bn()) {
|
|
|
6639
6639
|
}
|
|
6640
6640
|
};
|
|
6641
6641
|
}
|
|
6642
|
-
async function
|
|
6643
|
-
Pe || (Pe =
|
|
6642
|
+
async function ya(s = !1) {
|
|
6643
|
+
Pe || (Pe = ga({
|
|
6644
6644
|
...bn(),
|
|
6645
6645
|
skipStoredIdentityCollisionCheck: s
|
|
6646
6646
|
}), Pe.then((n) => {
|
|
@@ -6649,7 +6649,7 @@ async function ga(s = !1) {
|
|
|
6649
6649
|
};
|
|
6650
6650
|
window.addEventListener("pagehide", r);
|
|
6651
6651
|
}));
|
|
6652
|
-
const e = await Pe, t =
|
|
6652
|
+
const e = await Pe, t = va();
|
|
6653
6653
|
ut.add(t);
|
|
6654
6654
|
let i = !1;
|
|
6655
6655
|
return {
|
|
@@ -6660,7 +6660,7 @@ async function ga(s = !1) {
|
|
|
6660
6660
|
}
|
|
6661
6661
|
};
|
|
6662
6662
|
}
|
|
6663
|
-
function
|
|
6663
|
+
function va() {
|
|
6664
6664
|
let s = 0;
|
|
6665
6665
|
for (; ut.has(s); )
|
|
6666
6666
|
s += 1;
|
|
@@ -6668,13 +6668,13 @@ function ya() {
|
|
|
6668
6668
|
}
|
|
6669
6669
|
function bn() {
|
|
6670
6670
|
return {
|
|
6671
|
-
storage:
|
|
6672
|
-
channel:
|
|
6671
|
+
storage: Ia(),
|
|
6672
|
+
channel: ba(),
|
|
6673
6673
|
randomUUID: () => crypto.randomUUID(),
|
|
6674
|
-
settle: () => new Promise((s) =>
|
|
6674
|
+
settle: () => new Promise((s) => ma(s, fa))
|
|
6675
6675
|
};
|
|
6676
6676
|
}
|
|
6677
|
-
function
|
|
6677
|
+
function Ia() {
|
|
6678
6678
|
return {
|
|
6679
6679
|
getItem: (s) => {
|
|
6680
6680
|
try {
|
|
@@ -6692,9 +6692,9 @@ function va() {
|
|
|
6692
6692
|
}
|
|
6693
6693
|
};
|
|
6694
6694
|
}
|
|
6695
|
-
function
|
|
6695
|
+
function ba() {
|
|
6696
6696
|
if (typeof BroadcastChannel < "u") {
|
|
6697
|
-
const s = new BroadcastChannel(
|
|
6697
|
+
const s = new BroadcastChannel(pa);
|
|
6698
6698
|
return {
|
|
6699
6699
|
postMessage: (e) => s.postMessage(e),
|
|
6700
6700
|
subscribe: (e) => {
|
|
@@ -6704,9 +6704,9 @@ function Ia() {
|
|
|
6704
6704
|
close: () => s.close()
|
|
6705
6705
|
};
|
|
6706
6706
|
}
|
|
6707
|
-
return
|
|
6707
|
+
return wa();
|
|
6708
6708
|
}
|
|
6709
|
-
function
|
|
6709
|
+
function wa() {
|
|
6710
6710
|
const s = /* @__PURE__ */ new Set(), e = (t) => {
|
|
6711
6711
|
if (t.key !== Nt || !t.newValue)
|
|
6712
6712
|
return;
|
|
@@ -6728,7 +6728,7 @@ function ba() {
|
|
|
6728
6728
|
};
|
|
6729
6729
|
}
|
|
6730
6730
|
const wn = "schedule_follow_up";
|
|
6731
|
-
function
|
|
6731
|
+
function _a(s) {
|
|
6732
6732
|
let e = s;
|
|
6733
6733
|
if (typeof e == "string")
|
|
6734
6734
|
try {
|
|
@@ -6744,7 +6744,7 @@ function wa(s) {
|
|
|
6744
6744
|
dueAt: t.dueAt
|
|
6745
6745
|
};
|
|
6746
6746
|
}
|
|
6747
|
-
const
|
|
6747
|
+
const Sa = [
|
|
6748
6748
|
"anthropic/claude-opus-5",
|
|
6749
6749
|
"anthropic/claude-sonnet-5",
|
|
6750
6750
|
"deepseek/deepseek-chat-v3.1",
|
|
@@ -6755,16 +6755,16 @@ const _a = [
|
|
|
6755
6755
|
"gpt-5.6-luna",
|
|
6756
6756
|
"gpt-5.6-terra",
|
|
6757
6757
|
"gpt-5.6-sol"
|
|
6758
|
-
], vs = (s) => typeof s == "string" &&
|
|
6759
|
-
function
|
|
6758
|
+
], vs = (s) => typeof s == "string" && Sa.includes(s), jt = /* @__PURE__ */ new Map();
|
|
6759
|
+
function Ra(s, e, t) {
|
|
6760
6760
|
const i = `pluno.productAgent.modelClientScope:${e}`, n = s.getItem(i);
|
|
6761
6761
|
if (n) return n;
|
|
6762
6762
|
const r = t();
|
|
6763
6763
|
return s.setItem(i, r), r;
|
|
6764
6764
|
}
|
|
6765
|
-
function
|
|
6765
|
+
function Aa(s, e) {
|
|
6766
6766
|
try {
|
|
6767
|
-
const t =
|
|
6767
|
+
const t = Ra(window.sessionStorage, s, e);
|
|
6768
6768
|
return jt.set(s, t), t;
|
|
6769
6769
|
} catch (t) {
|
|
6770
6770
|
if (!(t instanceof DOMException) || t.name !== "SecurityError" && t.name !== "QuotaExceededError") throw t;
|
|
@@ -6772,16 +6772,16 @@ function Ra(s, e) {
|
|
|
6772
6772
|
return jt.set(s, i), i;
|
|
6773
6773
|
}
|
|
6774
6774
|
}
|
|
6775
|
-
function
|
|
6775
|
+
function Ea(s) {
|
|
6776
6776
|
if (!s || typeof s != "object") return;
|
|
6777
6777
|
const e = s, t = e.requestedModel ?? e.requested_model, i = e.effectiveModel ?? e.effective_model, n = e.provider;
|
|
6778
6778
|
if (!(!vs(t) || !vs(i) || n !== "openrouter" && n !== "azure" && n !== "openai"))
|
|
6779
6779
|
return Object.freeze({ requestedModel: t, effectiveModel: i, provider: n });
|
|
6780
6780
|
}
|
|
6781
|
-
const Us = (s, e) =>
|
|
6781
|
+
const Us = (s, e) => ur(
|
|
6782
6782
|
s.engine.getState().slices.modelSelection,
|
|
6783
6783
|
e
|
|
6784
|
-
),
|
|
6784
|
+
), Ta = (s, e) => Ts(Us(s, e));
|
|
6785
6785
|
function Lt(s, e, t, i) {
|
|
6786
6786
|
return s.engine.dispatch({
|
|
6787
6787
|
type: "model.submission_capture",
|
|
@@ -6790,8 +6790,8 @@ function Lt(s, e, t, i) {
|
|
|
6790
6790
|
requestedModel: i
|
|
6791
6791
|
}), Us(s, e).submissions[t].requestedModel;
|
|
6792
6792
|
}
|
|
6793
|
-
function
|
|
6794
|
-
const a =
|
|
6793
|
+
function ka(s, e, t, i, n, r) {
|
|
6794
|
+
const a = Ea(n);
|
|
6795
6795
|
a && s.engine.accept({
|
|
6796
6796
|
type: "model.routing_accepted",
|
|
6797
6797
|
clientScopeId: e,
|
|
@@ -6806,7 +6806,7 @@ function $t(s, e, t, i) {
|
|
|
6806
6806
|
for (const n of i) {
|
|
6807
6807
|
if (!n || typeof n != "object") continue;
|
|
6808
6808
|
const r = n, a = r.clientMessageId ?? r.client_message_id, o = r.updatedAt ?? r.updated_at;
|
|
6809
|
-
typeof a == "string" &&
|
|
6809
|
+
typeof a == "string" && ka(
|
|
6810
6810
|
s,
|
|
6811
6811
|
e,
|
|
6812
6812
|
t,
|
|
@@ -6816,7 +6816,7 @@ function $t(s, e, t, i) {
|
|
|
6816
6816
|
);
|
|
6817
6817
|
}
|
|
6818
6818
|
}
|
|
6819
|
-
class
|
|
6819
|
+
class qa {
|
|
6820
6820
|
constructor(e, t = null) {
|
|
6821
6821
|
this.storage = e, t && (this.decisions = new Map(
|
|
6822
6822
|
t.filter(Is).map((i) => [this.getDecisionKey(i), i])
|
|
@@ -6867,7 +6867,7 @@ class ka {
|
|
|
6867
6867
|
userPrompt: o?.type === "user_message" ? o.data.content : "",
|
|
6868
6868
|
assistantAnswer: ""
|
|
6869
6869
|
},
|
|
6870
|
-
terminal: !a.wait_for_terminal ||
|
|
6870
|
+
terminal: !a.wait_for_terminal || Ir(i, r.user_message_id)
|
|
6871
6871
|
};
|
|
6872
6872
|
} else a.kind === "integration_auth" ? t.integrations.push({
|
|
6873
6873
|
revision: r.version,
|
|
@@ -6969,13 +6969,13 @@ class ka {
|
|
|
6969
6969
|
return `${Ft(e.scope)}:category:${e.category}`;
|
|
6970
6970
|
}
|
|
6971
6971
|
}
|
|
6972
|
-
function
|
|
6972
|
+
function Hd(s, e) {
|
|
6973
6973
|
return {
|
|
6974
|
-
load: async () =>
|
|
6974
|
+
load: async () => Ca(s, e),
|
|
6975
6975
|
save: async (t) => s.setItem(e, JSON.stringify(t))
|
|
6976
6976
|
};
|
|
6977
6977
|
}
|
|
6978
|
-
function
|
|
6978
|
+
function Ca(s, e) {
|
|
6979
6979
|
const t = s.getItem(e);
|
|
6980
6980
|
if (!t) return [];
|
|
6981
6981
|
const i = JSON.parse(t);
|
|
@@ -6992,7 +6992,7 @@ function Is(s) {
|
|
|
6992
6992
|
const e = s;
|
|
6993
6993
|
return typeof e.promptKey == "string" && typeof e.category == "string" && typeof e.decidedAt == "string" && (e.nextEligibleAt === null || typeof e.nextEligibleAt == "string") && _n(e.action) && !!(e.scope && typeof e.scope == "object" && typeof e.scope.level == "string" && typeof e.scope.key == "string");
|
|
6994
6994
|
}
|
|
6995
|
-
class
|
|
6995
|
+
class Kd {
|
|
6996
6996
|
constructor(e, t, i = 20) {
|
|
6997
6997
|
this.loadPage = t, this.limit = i, this.recentQuery = new ii(
|
|
6998
6998
|
`${e}:recent`,
|
|
@@ -7002,7 +7002,7 @@ class Hd {
|
|
|
7002
7002
|
nextCursor: r.nextCursor
|
|
7003
7003
|
}))
|
|
7004
7004
|
),
|
|
7005
|
-
|
|
7005
|
+
Ar
|
|
7006
7006
|
), this.pinnedQuery = new ii(
|
|
7007
7007
|
`${e}:pinned`,
|
|
7008
7008
|
async () => it({
|
|
@@ -7035,7 +7035,7 @@ class Hd {
|
|
|
7035
7035
|
}) : null;
|
|
7036
7036
|
return {
|
|
7037
7037
|
key: e.key.slice(0, -7),
|
|
7038
|
-
status:
|
|
7038
|
+
status: Ma(e, t),
|
|
7039
7039
|
data: o,
|
|
7040
7040
|
error: e.error ?? t.error,
|
|
7041
7041
|
requestId: Math.max(e.requestId, t.requestId),
|
|
@@ -7144,21 +7144,21 @@ class Hd {
|
|
|
7144
7144
|
function Xe(s) {
|
|
7145
7145
|
return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
|
|
7146
7146
|
}
|
|
7147
|
-
function
|
|
7147
|
+
function Ma(s, e) {
|
|
7148
7148
|
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";
|
|
7149
7149
|
}
|
|
7150
|
-
const
|
|
7150
|
+
const Pa = {
|
|
7151
7151
|
working: "⏳",
|
|
7152
7152
|
completed: "✅",
|
|
7153
7153
|
failed: "❗",
|
|
7154
7154
|
stopped: "⏹️"
|
|
7155
|
-
},
|
|
7156
|
-
function
|
|
7155
|
+
}, Oa = /^(?:⌛|⏳|✅|❗|⏹️) Pluno(?:: )?/;
|
|
7156
|
+
function xa(s, e) {
|
|
7157
7157
|
if (!e) return ft(s);
|
|
7158
|
-
const t = ft(s), i = `${
|
|
7158
|
+
const t = ft(s), i = `${Pa[e]} Pluno`;
|
|
7159
7159
|
return t ? `${i}: ${t}` : i;
|
|
7160
7160
|
}
|
|
7161
|
-
class
|
|
7161
|
+
class Wd {
|
|
7162
7162
|
constructor(e) {
|
|
7163
7163
|
this.titleDocument = e;
|
|
7164
7164
|
}
|
|
@@ -7192,11 +7192,11 @@ class Kd {
|
|
|
7192
7192
|
applyTitle() {
|
|
7193
7193
|
if (!this.status)
|
|
7194
7194
|
return;
|
|
7195
|
-
const e =
|
|
7195
|
+
const e = xa(this.baseTitle, this.status);
|
|
7196
7196
|
this.lastAppliedTitle = e, this.titleDocument.getTitle() !== e && this.titleDocument.setTitle(e);
|
|
7197
7197
|
}
|
|
7198
7198
|
}
|
|
7199
|
-
function
|
|
7199
|
+
function Vd(s) {
|
|
7200
7200
|
return {
|
|
7201
7201
|
getTitle: () => s.title,
|
|
7202
7202
|
setTitle: (e) => {
|
|
@@ -7213,9 +7213,9 @@ function Wd(s) {
|
|
|
7213
7213
|
};
|
|
7214
7214
|
}
|
|
7215
7215
|
function ft(s) {
|
|
7216
|
-
return s.replace(
|
|
7216
|
+
return s.replace(Oa, "");
|
|
7217
7217
|
}
|
|
7218
|
-
const
|
|
7218
|
+
const Da = {
|
|
7219
7219
|
"stop-without-rendered-message": "Stop is enabled while no message is rendered or the welcome screen is still visible.",
|
|
7220
7220
|
"in-progress-stop-unavailable": "An in-progress response has no visible enabled interrupt control.",
|
|
7221
7221
|
"stop-did-not-interrupt": "The stopped response remained in progress after an interrupt click.",
|
|
@@ -7231,8 +7231,8 @@ const xa = {
|
|
|
7231
7231
|
"thinking-groups-without-user-message": "Multiple thinking groups appeared without a user message between them.",
|
|
7232
7232
|
"thinking-without-progress": "Thinking remained visible without progress for five minutes."
|
|
7233
7233
|
};
|
|
7234
|
-
function
|
|
7235
|
-
return typeof s == "string" && s.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call(
|
|
7234
|
+
function Ua(s) {
|
|
7235
|
+
return typeof s == "string" && s.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call(Da, s.slice(13));
|
|
7236
7236
|
}
|
|
7237
7237
|
function Si(s) {
|
|
7238
7238
|
return {
|
|
@@ -7245,7 +7245,7 @@ function Si(s) {
|
|
|
7245
7245
|
...s.fileUrl === void 0 ? {} : { fileUrl: s.fileUrl }
|
|
7246
7246
|
};
|
|
7247
7247
|
}
|
|
7248
|
-
function
|
|
7248
|
+
function Gd(s) {
|
|
7249
7249
|
if (!s || typeof s != "object" || !("type" in s)) return !1;
|
|
7250
7250
|
const e = s;
|
|
7251
7251
|
switch (e.type) {
|
|
@@ -7263,9 +7263,9 @@ function Vd(s) {
|
|
|
7263
7263
|
case "runtime.report_operation_timing":
|
|
7264
7264
|
return Fe(e.timing);
|
|
7265
7265
|
case "runtime.report_displayed_error":
|
|
7266
|
-
return (e.errorDiagnostic === void 0 ||
|
|
7266
|
+
return (e.errorDiagnostic === void 0 || sr(e.errorDiagnostic)) && (e.httpRequest === void 0 || de(e.httpRequest)) && (e.historyRefreshFailure === void 0 || _s(e.historyRefreshFailure)) && (e.renderedError === void 0 || Rs(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);
|
|
7267
7267
|
case "runtime.report_invalid_state_transition":
|
|
7268
|
-
return (e.uiInvariant === void 0 || As(e.uiInvariant)) && (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll" ||
|
|
7268
|
+
return (e.uiInvariant === void 0 || As(e.uiInvariant)) && (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll" || Ua(e.reason)) && (e.clientMessageId === void 0 || typeof e.clientMessageId == "string");
|
|
7269
7269
|
case "runtime.widget_lifecycle":
|
|
7270
7270
|
return (e.action === "opened" || e.action === "closed" || e.action === "minimized") && typeof e.trigger == "string";
|
|
7271
7271
|
case "session.load":
|
|
@@ -7293,7 +7293,7 @@ function Vd(s) {
|
|
|
7293
7293
|
return !1;
|
|
7294
7294
|
}
|
|
7295
7295
|
}
|
|
7296
|
-
class
|
|
7296
|
+
class Qd {
|
|
7297
7297
|
constructor(e, t, i) {
|
|
7298
7298
|
this.adapter = t, this.state = zt(e), this.model = i;
|
|
7299
7299
|
}
|
|
@@ -7347,7 +7347,7 @@ class Gd {
|
|
|
7347
7347
|
for (const o of this.state.messages) {
|
|
7348
7348
|
if (o.role !== "user" || !o.attachments?.length) continue;
|
|
7349
7349
|
const c = a.messages.find((d) => d.role === "user" && d.id === o.id);
|
|
7350
|
-
a.sessionId !== e.sessionId && !(a.sessionId === null && c) || (o.attachments =
|
|
7350
|
+
a.sessionId !== e.sessionId && !(a.sessionId === null && c) || (o.attachments = Na(c?.attachments, o.attachments));
|
|
7351
7351
|
}
|
|
7352
7352
|
if (t !== void 0 && (this.model = t), i && JSON.stringify(i) !== JSON.stringify(this.sessionHistoryState)) {
|
|
7353
7353
|
this.sessionHistoryState = Ri(i);
|
|
@@ -7493,7 +7493,7 @@ class Gd {
|
|
|
7493
7493
|
return r === this.stagedProactiveSuggestionClientMessageId && (this.stagedProactiveSuggestionClientMessageId = null), r;
|
|
7494
7494
|
} catch (d) {
|
|
7495
7495
|
if (i !== this.submissionGeneration) return null;
|
|
7496
|
-
if (
|
|
7496
|
+
if (qr(d))
|
|
7497
7497
|
for (const u of t.attachments ?? [])
|
|
7498
7498
|
u.id && this.attachmentFiles.delete(u.id);
|
|
7499
7499
|
const l = this.submissionPreviews.get(r);
|
|
@@ -7678,7 +7678,7 @@ class Gd {
|
|
|
7678
7678
|
for (const n of i ?? []) n(t);
|
|
7679
7679
|
}
|
|
7680
7680
|
}
|
|
7681
|
-
function
|
|
7681
|
+
function Na(s, e) {
|
|
7682
7682
|
if (!e || !s) return e;
|
|
7683
7683
|
const t = /* @__PURE__ */ new Map();
|
|
7684
7684
|
for (const i of s) {
|
|
@@ -7718,12 +7718,12 @@ function Ri(s) {
|
|
|
7718
7718
|
return {
|
|
7719
7719
|
...s,
|
|
7720
7720
|
data: s.data ? it({
|
|
7721
|
-
entities:
|
|
7721
|
+
entities: Er(s.data).map((e) => ({ ...e })),
|
|
7722
7722
|
nextCursor: s.data.nextCursor
|
|
7723
7723
|
}) : null
|
|
7724
7724
|
};
|
|
7725
7725
|
}
|
|
7726
|
-
const
|
|
7726
|
+
const Ba = globalThis.fetch.bind(globalThis), Ai = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', ja = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', La = ".pluno-pa-widget__panel", $a = ".pluno-pa-widget__timeline", Fa = "__plunoExtensionWidgetOwner";
|
|
7727
7727
|
class ne extends Error {
|
|
7728
7728
|
constructor(e, t, i, n) {
|
|
7729
7729
|
super(e), this.retryable = t, this.status = i, this.retryAfterMs = n, this.name = "ProductAgentTokenProviderError";
|
|
@@ -7732,10 +7732,10 @@ class ne extends Error {
|
|
|
7732
7732
|
status;
|
|
7733
7733
|
retryAfterMs;
|
|
7734
7734
|
}
|
|
7735
|
-
function
|
|
7735
|
+
function za(s) {
|
|
7736
7736
|
return s === "dismiss" || s === "later" || s === "snooze" || s === "never" || s === "dont_show_again";
|
|
7737
7737
|
}
|
|
7738
|
-
let
|
|
7738
|
+
let Ha = 0;
|
|
7739
7739
|
function Ht(s) {
|
|
7740
7740
|
const e = {};
|
|
7741
7741
|
for (const c of [
|
|
@@ -7767,7 +7767,7 @@ function Ht(s) {
|
|
|
7767
7767
|
const r = (c) => {
|
|
7768
7768
|
if (!c || typeof c != "object")
|
|
7769
7769
|
return null;
|
|
7770
|
-
const d = c, l = d.data, u = l && typeof l == "object" ? l : {}, h =
|
|
7770
|
+
const d = c, l = d.data, u = l && typeof l == "object" ? l : {}, h = Cn(c);
|
|
7771
7771
|
return {
|
|
7772
7772
|
id: typeof d.id == "string" ? d.id : null,
|
|
7773
7773
|
streamId: u.type === "message" && u.role === "assistant" && typeof u.id == "string" ? u.id : null,
|
|
@@ -7801,7 +7801,7 @@ function Ht(s) {
|
|
|
7801
7801
|
}
|
|
7802
7802
|
}
|
|
7803
7803
|
}
|
|
7804
|
-
return { ...e, ...
|
|
7804
|
+
return { ...e, ...rr(s) };
|
|
7805
7805
|
}
|
|
7806
7806
|
function we(s, e, t) {
|
|
7807
7807
|
if (typeof window > "u")
|
|
@@ -7815,26 +7815,26 @@ function we(s, e, t) {
|
|
|
7815
7815
|
source: "web_sdk",
|
|
7816
7816
|
category: s,
|
|
7817
7817
|
name: e,
|
|
7818
|
-
sequence: ++
|
|
7818
|
+
sequence: ++Ha,
|
|
7819
7819
|
wallTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7820
7820
|
monotonicMs: performance.now(),
|
|
7821
7821
|
data: t
|
|
7822
7822
|
};
|
|
7823
7823
|
window.dispatchEvent(new CustomEvent("product-agent:trace", { detail: n }));
|
|
7824
7824
|
}
|
|
7825
|
-
const
|
|
7825
|
+
const Ka = "https://app.pluno.ai", Wa = 2e4, Va = 1e4, Ga = 6e4, Qa = 6e4, Ja = 1e4, Xa = 1e4, Ya = 1e3, bs = 3e4, Ei = 0.2, Kt = 6e4, Wt = 3, Ti = "Still connecting to Pluno. Retrying automatically.", Za = 1e3, ec = 100, ki = 3, tc = [300, 1e3], Sn = 50 * 1024 * 1024, sc = /* @__PURE__ */ new Set([
|
|
7826
7826
|
".jpeg:image/jpeg",
|
|
7827
7827
|
".jpg:image/jpeg",
|
|
7828
7828
|
".pdf:application/pdf",
|
|
7829
7829
|
".png:image/png",
|
|
7830
7830
|
".webp:image/webp"
|
|
7831
|
-
]),
|
|
7831
|
+
]), Jd = ".pdf,.png,.jpg,.jpeg,.webp", Ns = 64e3, Vt = 4e3, Bs = 30, ic = 2e3, nc = 1e3, Rn = "Image is too large for model vision input.", rc = "pluno.productAgent.state.", ws = "pluno.productAgent.pendingEvents.", wt = "pluno.productAgent.activeToolCalls.", oc = 100, ht = /* @__PURE__ */ new Set();
|
|
7832
7832
|
let Ye = null;
|
|
7833
|
-
function
|
|
7834
|
-
const t = Math.min(bs,
|
|
7833
|
+
function ac(s, e = Math.random) {
|
|
7834
|
+
const t = Math.min(bs, Ya * 2 ** s), i = 1 - Ei + e() * Ei * 2;
|
|
7835
7835
|
return Math.min(bs, Math.round(t * i));
|
|
7836
7836
|
}
|
|
7837
|
-
function
|
|
7837
|
+
function cc(s) {
|
|
7838
7838
|
const e = s.split(".")[1];
|
|
7839
7839
|
if (!e)
|
|
7840
7840
|
return null;
|
|
@@ -7881,8 +7881,8 @@ class _t {
|
|
|
7881
7881
|
authenticationFailure: () => this.authenticationFailure,
|
|
7882
7882
|
pendingAuthentication: () => this.credentialRecovery ?? (this.credentialRecoveryFailure ? Promise.reject(this.credentialRecoveryFailure) : null),
|
|
7883
7883
|
recoverAuthentication: (n, r, a) => this.recoverHttpAuthentication(n, r, a),
|
|
7884
|
-
executorConnection: () => this.socket instanceof
|
|
7885
|
-
restoreExecutor: (n) => this.socket instanceof
|
|
7884
|
+
executorConnection: () => this.socket instanceof D ? this.socket.connectionId : null,
|
|
7885
|
+
restoreExecutor: (n) => this.socket instanceof D ? this.socket.restoreExecutor(n) : Promise.reject(new b("Browser is reconnecting.", "executor_not_ready")),
|
|
7886
7886
|
auth: {
|
|
7887
7887
|
protocol: 1,
|
|
7888
7888
|
token: e.token ?? "",
|
|
@@ -7896,7 +7896,7 @@ class _t {
|
|
|
7896
7896
|
}
|
|
7897
7897
|
});
|
|
7898
7898
|
const i = this;
|
|
7899
|
-
this.clientRuntime = new
|
|
7899
|
+
this.clientRuntime = new ea(Co({
|
|
7900
7900
|
http: this.directoryHttp,
|
|
7901
7901
|
get authority() {
|
|
7902
7902
|
return i.directoryAuthority;
|
|
@@ -7905,10 +7905,10 @@ class _t {
|
|
|
7905
7905
|
pageUrl: () => location.href,
|
|
7906
7906
|
now: () => Date.now(),
|
|
7907
7907
|
onError: (n) => this.handleDirectoryTransportError(n)
|
|
7908
|
-
}), void 0,
|
|
7908
|
+
}), void 0, or(async () => {
|
|
7909
7909
|
if (!this.token || !this.state.user || this.state.status === "closed") throw new Error("Product Agent is not authenticated");
|
|
7910
|
-
return this.options.activeUsersLoader ? (await this.options.activeUsersLoader()).count :
|
|
7911
|
-
})), this.modelClientScopeId =
|
|
7910
|
+
return this.options.activeUsersLoader ? (await this.options.activeUsersLoader()).count : ar(this.options.backendUrl);
|
|
7911
|
+
})), this.modelClientScopeId = Aa(e.clientId, () => crypto.randomUUID()), this.directoryConversationScopeId = `conversation:${this.modelClientScopeId}`, this.createDirectoryAdapters(), this.clientRuntime.engine.dispatch({
|
|
7912
7912
|
type: "model.scope_open",
|
|
7913
7913
|
clientScopeId: this.modelClientScopeId,
|
|
7914
7914
|
sessionId: null,
|
|
@@ -7916,10 +7916,10 @@ class _t {
|
|
|
7916
7916
|
defaultModel: e.productVariant === "personal" ? void 0 : "gpt-5.6-terra",
|
|
7917
7917
|
selectedModel: e.model
|
|
7918
7918
|
}), this.state = {
|
|
7919
|
-
starterPrompts:
|
|
7920
|
-
}, this.account = e.initialAccount ? { ...e.initialAccount } : null, this.queuedClientEvents =
|
|
7921
|
-
|
|
7922
|
-
|
|
7919
|
+
starterPrompts: Bc(e.initialStarterPrompts)
|
|
7920
|
+
}, this.account = e.initialAccount ? { ...e.initialAccount } : null, this.queuedClientEvents = ld(
|
|
7921
|
+
od(e.clientId),
|
|
7922
|
+
ad(e.clientId)
|
|
7923
7923
|
);
|
|
7924
7924
|
}
|
|
7925
7925
|
options;
|
|
@@ -7976,7 +7976,7 @@ class _t {
|
|
|
7976
7976
|
accountRefresh = null;
|
|
7977
7977
|
runtimeInteractions = [];
|
|
7978
7978
|
interactionListeners = /* @__PURE__ */ new Set();
|
|
7979
|
-
interactionManager = new
|
|
7979
|
+
interactionManager = new qa(
|
|
7980
7980
|
{ load: async () => [], save: async () => {
|
|
7981
7981
|
} },
|
|
7982
7982
|
[]
|
|
@@ -8051,17 +8051,17 @@ class _t {
|
|
|
8051
8051
|
t in e && Object.assign(this.platformState, { [t]: e[t] });
|
|
8052
8052
|
}
|
|
8053
8053
|
static async init(e) {
|
|
8054
|
-
const t = e, i = await
|
|
8054
|
+
const t = e, i = await ya(
|
|
8055
8055
|
t.skipStoredTransportIdentityCollisionCheck === !0
|
|
8056
8056
|
), n = new _t({
|
|
8057
8057
|
...e,
|
|
8058
|
-
backendUrl:
|
|
8059
|
-
clientId: e.clientId ??
|
|
8058
|
+
backendUrl: Ac(e.backendUrl ?? Ka),
|
|
8059
|
+
clientId: e.clientId ?? zc(),
|
|
8060
8060
|
productVariant: e.productVariant ?? "customer_embedded",
|
|
8061
|
-
entrySurface:
|
|
8061
|
+
entrySurface: cr(e.entrySurface)
|
|
8062
8062
|
}, i);
|
|
8063
8063
|
try {
|
|
8064
|
-
await n.initializeDirectory(), await n.initializeConversation(),
|
|
8064
|
+
await n.initializeDirectory(), await n.initializeConversation(), ra().catch((r) => {
|
|
8065
8065
|
$("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
|
|
8066
8066
|
message: r instanceof Error ? r.message : String(r)
|
|
8067
8067
|
});
|
|
@@ -8072,15 +8072,15 @@ class _t {
|
|
|
8072
8072
|
return n;
|
|
8073
8073
|
}
|
|
8074
8074
|
createDirectoryAdapters() {
|
|
8075
|
-
this.directoryScope = new
|
|
8075
|
+
this.directoryScope = new Oo({
|
|
8076
8076
|
runtime: this.clientRuntime,
|
|
8077
8077
|
authority: this.directoryAuthority,
|
|
8078
8078
|
random: Math.random,
|
|
8079
|
-
persistence:
|
|
8079
|
+
persistence: Do(
|
|
8080
8080
|
this.modelClientScopeId,
|
|
8081
8081
|
this.directoryAuthority.authorityId
|
|
8082
8082
|
)
|
|
8083
|
-
}), this.directoryObservation = new
|
|
8083
|
+
}), this.directoryObservation = new Mo({
|
|
8084
8084
|
runtime: this.clientRuntime,
|
|
8085
8085
|
authority: this.directoryAuthority,
|
|
8086
8086
|
http: this.directoryHttp,
|
|
@@ -8109,12 +8109,12 @@ class _t {
|
|
|
8109
8109
|
const e = ++this.conversationAdapterGeneration;
|
|
8110
8110
|
this.conversationObservation?.dispose(), this.conversationUnsubscribe?.();
|
|
8111
8111
|
const t = this.directoryAuthority, i = () => e === this.conversationAdapterGeneration;
|
|
8112
|
-
this.operationTimingReporter =
|
|
8112
|
+
this.operationTimingReporter = Jn((u) => {
|
|
8113
8113
|
i() && !this.clientRuntime.isDisposed && this.reportHealthSignal("operation_timing", { timings: u.map((h) => ({ ...h, entrySurface: this.options.entrySurface })) });
|
|
8114
8114
|
});
|
|
8115
8115
|
const n = `pa.conversation.delivery:${this.modelClientScopeId}:${t.authorityId}`;
|
|
8116
8116
|
this.clientRuntime.installConversationPorts({
|
|
8117
|
-
...
|
|
8117
|
+
...gr({
|
|
8118
8118
|
authority: t,
|
|
8119
8119
|
runtime: () => this.clientRuntime,
|
|
8120
8120
|
isCurrent: i,
|
|
@@ -8154,7 +8154,7 @@ class _t {
|
|
|
8154
8154
|
throw Object.assign(new Error("Attachment files are unavailable. Attach the files again and send a new message."), { code: "attachment_source_unavailable", retryable: !1 });
|
|
8155
8155
|
return p.mark("context_ready"), { ...f, now: Date.now() };
|
|
8156
8156
|
},
|
|
8157
|
-
connectionId: () => this.socket instanceof
|
|
8157
|
+
connectionId: () => this.socket instanceof D ? this.socket.connectionId : null,
|
|
8158
8158
|
prepareUpload: this.options.prepareAttachmentUpload ?? (this.options.productVariant === "customer_embedded" ? (u) => this.prepareEmbedAttachmentUpload(u, i) : void 0),
|
|
8159
8159
|
onUploaded: async (u, h, p) => {
|
|
8160
8160
|
await yn(u, {
|
|
@@ -8187,14 +8187,14 @@ class _t {
|
|
|
8187
8187
|
h.sessionId === this.getState().sessionId && this.startNewSession({ notifyTransport: !1 });
|
|
8188
8188
|
return;
|
|
8189
8189
|
}
|
|
8190
|
-
$("web-sdk.conversation", "Conversation operation failed", { ...h, ...
|
|
8190
|
+
$("web-sdk.conversation", "Conversation operation failed", { ...h, ...nr(u) }), this.handleDirectoryTransportError(u);
|
|
8191
8191
|
}
|
|
8192
8192
|
}),
|
|
8193
8193
|
"conversation.interactions": this.createConversationInteractionPort()
|
|
8194
8194
|
});
|
|
8195
8195
|
const r = this.clientRuntime.engine.getState().slices.conversation, a = this.options.restorePersistedState === !1 || !this.authenticatedUserId ? null : Ys(n);
|
|
8196
8196
|
if (this.authenticatedUserId && !r.submissionOrder.length && !Object.keys(r.operations).length) {
|
|
8197
|
-
const u = this.queuedClientEvents.filter((p) => p.type === "chat.user_message"), h = a ? JSON.parse(a) : u.length ?
|
|
8197
|
+
const u = this.queuedClientEvents.filter((p) => p.type === "chat.user_message"), h = a ? JSON.parse(a) : u.length ? dr(r, u.map((p) => {
|
|
8198
8198
|
const { type: f, ...m } = p, y = this.clientRuntime.engine.getState().slices.directory, g = y.clients[this.modelClientScopeId];
|
|
8199
8199
|
return {
|
|
8200
8200
|
command: { type: f, request_id: p.clientMessageId, payload: JSON.parse(JSON.stringify(m)) },
|
|
@@ -8210,7 +8210,7 @@ class _t {
|
|
|
8210
8210
|
h && await this.clientRuntime.engine.dispatch({ ...t, type: "conversation.restore_delivery", checkpoint: h });
|
|
8211
8211
|
}
|
|
8212
8212
|
if (this.authenticatedUserId && (this.queuedClientEvents = this.queuedClientEvents.filter((u) => !["chat.user_message", "chat.retry_last_user_message", "run.stop", "runtime.warmup", "session.reset", "attachment.upload_completed"].includes(u.type))), ge(this.options.clientId, this.queuedClientEvents), !i()) return;
|
|
8213
|
-
this.conversationObservation = new
|
|
8213
|
+
this.conversationObservation = new yr({
|
|
8214
8214
|
authority: t,
|
|
8215
8215
|
now: () => Date.now(),
|
|
8216
8216
|
runtime: () => this.clientRuntime,
|
|
@@ -8219,13 +8219,13 @@ class _t {
|
|
|
8219
8219
|
socket: {
|
|
8220
8220
|
retain: async (u, h) => {
|
|
8221
8221
|
const p = this.socket;
|
|
8222
|
-
p instanceof
|
|
8222
|
+
p instanceof D && await p.directoryRooms.retain(u, h).catch((f) => {
|
|
8223
8223
|
if (this.socket === p) throw f;
|
|
8224
8224
|
});
|
|
8225
8225
|
},
|
|
8226
8226
|
release: async (u, h) => {
|
|
8227
8227
|
const p = this.socket;
|
|
8228
|
-
p instanceof
|
|
8228
|
+
p instanceof D && await p.directoryRooms.release(u, h).catch((f) => {
|
|
8229
8229
|
if (this.socket === p) throw f;
|
|
8230
8230
|
});
|
|
8231
8231
|
}
|
|
@@ -8239,7 +8239,7 @@ class _t {
|
|
|
8239
8239
|
let o = new Map(this.getState().messages.map((u) => [u.id, u])), c = this.clientRuntime.engine.getState().slices.conversation, d = this.clientRuntime.engine.getState().slices.directory.selections, l = this.clientRuntime.engine.getState().slices.directory.clients[this.modelClientScopeId];
|
|
8240
8240
|
this.conversationUnsubscribe = this.clientRuntime.engine.subscribe(() => {
|
|
8241
8241
|
const u = this.clientRuntime.engine.getState().slices, h = c;
|
|
8242
|
-
c = u.conversation,
|
|
8242
|
+
c = u.conversation, Xn(h, u.conversation, this.operationTimingReporter, "sdk");
|
|
8243
8243
|
const p = l !== u.directory.clients[this.modelClientScopeId];
|
|
8244
8244
|
l = u.directory.clients[this.modelClientScopeId], d !== u.directory.selections && (d = u.directory.selections, this.directoryScope.persist());
|
|
8245
8245
|
for (const m of Object.values(u.conversation.submissions)) {
|
|
@@ -8276,7 +8276,7 @@ class _t {
|
|
|
8276
8276
|
type: "directory.authority_replace",
|
|
8277
8277
|
expectedGeneration: 0
|
|
8278
8278
|
}), !(this.options.restorePersistedState !== !1 && await this.directoryScope.restore(this.options.expectedPersistedSessionId))) {
|
|
8279
|
-
const t = this.options.restorePersistedState === !1 ? null :
|
|
8279
|
+
const t = this.options.restorePersistedState === !1 ? null : rd(this.options.clientId, this.options.expectedPersistedSessionId)?.sessionId;
|
|
8280
8280
|
t ? await this.directoryScope.bind(
|
|
8281
8281
|
this.modelClientScopeId,
|
|
8282
8282
|
this.directoryConversationScopeId,
|
|
@@ -8322,7 +8322,7 @@ class _t {
|
|
|
8322
8322
|
return i.add(t), this.listeners[e] = i, () => i.delete(t);
|
|
8323
8323
|
}
|
|
8324
8324
|
getState() {
|
|
8325
|
-
const e = this.clientRuntime.engine.getState().slices, t = e.directory.clients[this.modelClientScopeId] ?? this.directoryConversationScopeId, i = Re(e.conversation, e.directory, t), n =
|
|
8325
|
+
const e = this.clientRuntime.engine.getState().slices, t = e.directory.clients[this.modelClientScopeId] ?? this.directoryConversationScopeId, i = Re(e.conversation, e.directory, t), n = _r(
|
|
8326
8326
|
i,
|
|
8327
8327
|
i.sessionId ? e.conversation.sessions[i.sessionId]?.queries.current : void 0,
|
|
8328
8328
|
this.options.backendUrl,
|
|
@@ -8362,7 +8362,7 @@ class _t {
|
|
|
8362
8362
|
if (!this.options.tokenProvider)
|
|
8363
8363
|
return this.token;
|
|
8364
8364
|
if (this.tokenRequest) return await this.tokenRequest;
|
|
8365
|
-
const i = Date.now(), n = this.token !== null && this.tokenExpiresAtMs !== null && this.tokenExpiresAtMs -
|
|
8365
|
+
const i = Date.now(), n = this.token !== null && this.tokenExpiresAtMs !== null && this.tokenExpiresAtMs - Qa > i;
|
|
8366
8366
|
if (!t.forceRefresh && (n || t.preferCached && this.token !== null))
|
|
8367
8367
|
return this.token;
|
|
8368
8368
|
t.forceRefresh && this.invalidateProviderToken();
|
|
@@ -8373,7 +8373,7 @@ class _t {
|
|
|
8373
8373
|
const c = new Promise((d, l) => {
|
|
8374
8374
|
o = window.setTimeout(() => {
|
|
8375
8375
|
r.abort(), l(new ne("Pluno token provider timed out", !0));
|
|
8376
|
-
},
|
|
8376
|
+
}, Ga);
|
|
8377
8377
|
});
|
|
8378
8378
|
try {
|
|
8379
8379
|
const d = await Promise.race([
|
|
@@ -8384,7 +8384,7 @@ class _t {
|
|
|
8384
8384
|
throw new ne("Pluno token request was cancelled", !0);
|
|
8385
8385
|
if (typeof d != "string" || !d.trim())
|
|
8386
8386
|
throw new ne("Chat setup did not return a session. Contact your app administrator, then try again.", !1);
|
|
8387
|
-
return this.token = d, this.tokenExpiresAtMs =
|
|
8387
|
+
return this.token = d, this.tokenExpiresAtMs = cc(d), d;
|
|
8388
8388
|
} finally {
|
|
8389
8389
|
o !== null && window.clearTimeout(o);
|
|
8390
8390
|
}
|
|
@@ -8398,42 +8398,36 @@ class _t {
|
|
|
8398
8398
|
}
|
|
8399
8399
|
async connect() {
|
|
8400
8400
|
return this.clientRuntime.route("conversation", { core: async () => {
|
|
8401
|
-
if (this.socket instanceof
|
|
8402
|
-
const
|
|
8403
|
-
this.clearEmbeddedRecoveryBudget(), this.startEmbeddedRecoveryBudget()
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
}, o = (c) => {
|
|
8407
|
-
const d = Pi(c.data);
|
|
8408
|
-
(d.type === "auth.ok" || d.type === "error") && a();
|
|
8409
|
-
};
|
|
8410
|
-
n.addEventListener("message", o), n.addEventListener("close", a), this.setState({ status: "reconnecting" }), n.retryReadiness();
|
|
8411
|
-
});
|
|
8401
|
+
if (this.socket instanceof D && (this.socket.initialReadinessExpired || this.state.lastErrorCode === "connection_failed" && this.state.status !== "connected" && this.socket.readyState !== WebSocket.CLOSED)) {
|
|
8402
|
+
const r = this.socket;
|
|
8403
|
+
this.clearEmbeddedRecoveryBudget(), this.startEmbeddedRecoveryBudget();
|
|
8404
|
+
const a = Li(r);
|
|
8405
|
+
this.setState({ status: "reconnecting" }), r.retryReadiness(), await a;
|
|
8412
8406
|
return;
|
|
8413
8407
|
}
|
|
8414
8408
|
if (this.connectionInProgress || this.socket?.readyState === WebSocket.OPEN || this.socket?.readyState === WebSocket.CONNECTING)
|
|
8415
8409
|
return;
|
|
8416
8410
|
this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null, this.reconnectAttempts = 0);
|
|
8417
|
-
const e = this.authenticationFailure !== null;
|
|
8411
|
+
const e = this.authenticationFailure !== null, t = e && this.state.lastErrorCode === "connection_failed";
|
|
8418
8412
|
this.authenticationFailure = null, this.startEmbeddedRecoveryBudget(), this.credentialRecoveryFailure = null, this.connectionInProgress = !0;
|
|
8419
|
-
const
|
|
8413
|
+
const i = ++this.connectionAttemptId, n = this.state.lastError;
|
|
8420
8414
|
this.setState(
|
|
8421
|
-
this.state.status === "reconnecting" ? { status: "reconnecting" } : { status: "connecting", lastError: null }
|
|
8415
|
+
this.state.status === "reconnecting" || t ? { status: "reconnecting" } : { status: "connecting", lastError: null }
|
|
8422
8416
|
);
|
|
8423
8417
|
try {
|
|
8424
|
-
if (this.lastRecoveryStage = "token_provider", this.token = await this.acquireToken("connect", { forceRefresh: e }), this.token && (this.directoryHttp.auth.token = this.token),
|
|
8418
|
+
if (this.lastRecoveryStage = "token_provider", this.token = await this.acquireToken("connect", { forceRefresh: e }), this.token && (this.directoryHttp.auth.token = this.token), i !== this.connectionAttemptId || this.state.status === "closed")
|
|
8425
8419
|
return;
|
|
8426
8420
|
if (this.lastRecoveryStage = "socket_admission", !this.token && !this.options.webSocketFactory)
|
|
8427
8421
|
throw new ne("Pluno requires a token or tokenProvider", !1);
|
|
8428
8422
|
if (!this.options.webSocketFactory && this.rejectedTransportToken !== null && this.rejectedTransportToken === this.token) {
|
|
8429
|
-
this.clearEmbeddedRecoveryBudget(), this.setState({ status: "error", lastError:
|
|
8423
|
+
this.clearEmbeddedRecoveryBudget(), this.setState({ status: "error", lastError: n });
|
|
8430
8424
|
return;
|
|
8431
8425
|
}
|
|
8432
|
-
if (this.socket instanceof
|
|
8426
|
+
if (this.socket instanceof D) {
|
|
8433
8427
|
await this.replaceDefaultTransportCredentials(this.socket);
|
|
8434
8428
|
return;
|
|
8435
8429
|
}
|
|
8436
|
-
const
|
|
8430
|
+
const r = Tc(this.options.backendUrl), a = this.options.webSocketFactory?.(r) ?? new D({
|
|
8437
8431
|
displaySchema: "canonical",
|
|
8438
8432
|
backendUrl: this.options.backendUrl,
|
|
8439
8433
|
entrySurface: this.options.entrySurface,
|
|
@@ -8452,12 +8446,12 @@ class _t {
|
|
|
8452
8446
|
currentSession: () => this.state.sessionId,
|
|
8453
8447
|
sessionReferences: () => []
|
|
8454
8448
|
});
|
|
8455
|
-
this.socket =
|
|
8456
|
-
this.socket ===
|
|
8457
|
-
},
|
|
8458
|
-
this.socket ===
|
|
8459
|
-
}),
|
|
8460
|
-
this.socket !==
|
|
8449
|
+
this.socket = a, this.options.webSocketFactory && (this.socketConnectTimer = window.setTimeout(() => {
|
|
8450
|
+
this.socket === a && a.readyState === WebSocket.CONNECTING && ($("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.reportTransportDiagnostic("connect_timeout"), this.replaceTimedOutSocket(a));
|
|
8451
|
+
}, Ja)), a.addEventListener("reconnecting", (o) => {
|
|
8452
|
+
this.socket === a && this.state.status !== "closed" && (this.refreshingDefaultCredentials || this.reportTransportDiagnostic("socket_closed", { disconnectReason: o.detail.reason }), this.setReconnectingState());
|
|
8453
|
+
}), a.addEventListener("open", () => {
|
|
8454
|
+
this.socket !== a || (this.clearSocketConnectTimer(), this.directoryObservation.reconnect().catch(() => {
|
|
8461
8455
|
}), this.conversationObservation?.wake(), $("web-sdk.agent", "Pluno socket opened", {
|
|
8462
8456
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
8463
8457
|
isThinking: this.state.isThinking
|
|
@@ -8468,67 +8462,67 @@ class _t {
|
|
|
8468
8462
|
transportId: this.transportIdentity.transportId,
|
|
8469
8463
|
pageUrl: location.href
|
|
8470
8464
|
}) : !0)) || this.options.webSocketFactory && (this.socketAuthTimer = window.setTimeout(() => {
|
|
8471
|
-
this.socket ===
|
|
8472
|
-
},
|
|
8473
|
-
}),
|
|
8474
|
-
if (this.socket !==
|
|
8465
|
+
this.socket === a && ($("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.reportTransportDiagnostic("auth_timeout"), this.replaceTimedOutSocket(a));
|
|
8466
|
+
}, Xa));
|
|
8467
|
+
}), a.addEventListener("message", (o) => {
|
|
8468
|
+
if (this.socket !== a)
|
|
8475
8469
|
return;
|
|
8476
|
-
const
|
|
8477
|
-
if (
|
|
8470
|
+
const c = qn(o.data);
|
|
8471
|
+
if (a instanceof D && c.type === "tool.call" && !Nc(c)) {
|
|
8478
8472
|
this.setState({ status: "error", lastError: "Invalid tool-call envelope", lastErrorCode: "invalid_tool_call" });
|
|
8479
8473
|
return;
|
|
8480
8474
|
}
|
|
8481
|
-
const
|
|
8482
|
-
|
|
8483
|
-
}),
|
|
8484
|
-
this.socket ===
|
|
8485
|
-
}),
|
|
8475
|
+
const d = this.handleServerEvent(c);
|
|
8476
|
+
a instanceof D && c.type === "tool.call" && d === !0 && a.acceptMessage(o);
|
|
8477
|
+
}), a.addEventListener("sendfailure", (o) => {
|
|
8478
|
+
this.socket === a && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(), a.readyState !== WebSocket.CLOSED && a.readyState !== WebSocket.CLOSING && a.close());
|
|
8479
|
+
}), a.addEventListener("diagnosticpending", (o) => {
|
|
8486
8480
|
if (this.clientRuntime.isDisposed || this.state.status === "closed") return;
|
|
8487
|
-
const
|
|
8488
|
-
this.pendingTransportDiagnostics = [...this.pendingTransportDiagnostics.filter((
|
|
8489
|
-
}),
|
|
8490
|
-
this.socket ===
|
|
8491
|
-
code: typeof
|
|
8492
|
-
reason: typeof
|
|
8493
|
-
wasClean: typeof
|
|
8481
|
+
const c = o.detail, d = new Set(c.map((l) => l.id));
|
|
8482
|
+
this.pendingTransportDiagnostics = [...this.pendingTransportDiagnostics.filter((l) => !d.has(l.id)), ...c].slice(-20), this.flushClientDiagnostics();
|
|
8483
|
+
}), a.addEventListener("close", (o) => {
|
|
8484
|
+
this.socket === a && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && ($("web-sdk.agent", "Pluno socket closed; scheduling reconnect", {
|
|
8485
|
+
code: typeof o?.code == "number" ? o.code : null,
|
|
8486
|
+
reason: typeof o?.reason == "string" ? o.reason : "",
|
|
8487
|
+
wasClean: typeof o?.wasClean == "boolean" ? o.wasClean : null,
|
|
8494
8488
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
8495
8489
|
isThinking: this.state.isThinking
|
|
8496
|
-
}), (typeof
|
|
8497
|
-
closeCode: typeof
|
|
8498
|
-
wasClean: typeof
|
|
8490
|
+
}), (typeof o?.code != "number" || o.code !== 1e3) && this.reportTransportDiagnostic("socket_closed", {
|
|
8491
|
+
closeCode: typeof o?.code == "number" ? o.code : void 0,
|
|
8492
|
+
wasClean: typeof o?.wasClean == "boolean" ? o.wasClean : void 0
|
|
8499
8493
|
}), this.setReconnectingState(), this.scheduleReconnect()));
|
|
8500
|
-
}),
|
|
8501
|
-
this.socket !==
|
|
8494
|
+
}), a.addEventListener("error", () => {
|
|
8495
|
+
this.socket !== a || this.state.status === "closed" || ($("web-sdk.agent", "Pluno socket error; scheduling reconnect", {
|
|
8502
8496
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
8503
8497
|
isThinking: this.state.isThinking
|
|
8504
|
-
}), this.reportTransportDiagnostic("socket_error"), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(),
|
|
8505
|
-
});
|
|
8506
|
-
} catch (
|
|
8507
|
-
if (
|
|
8498
|
+
}), this.reportTransportDiagnostic("socket_error"), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(), a.readyState !== WebSocket.CLOSED && a.readyState !== WebSocket.CLOSING && a.close());
|
|
8499
|
+
}), t && a instanceof D && await Li(a);
|
|
8500
|
+
} catch (r) {
|
|
8501
|
+
if (i !== this.connectionAttemptId || this.state.status === "closed")
|
|
8508
8502
|
return;
|
|
8509
|
-
if (
|
|
8510
|
-
this.handleDirectoryTransportError(
|
|
8503
|
+
if (r instanceof b && (r.code === "unauthorized" || r.code === "update_required")) {
|
|
8504
|
+
this.handleDirectoryTransportError(r);
|
|
8511
8505
|
return;
|
|
8512
8506
|
}
|
|
8513
|
-
const
|
|
8514
|
-
if (Gt(
|
|
8507
|
+
const a = Oe(r);
|
|
8508
|
+
if (Gt(r)) {
|
|
8515
8509
|
$("web-sdk.agent", "Pluno connection attempt failed; retrying", {
|
|
8516
|
-
message:
|
|
8510
|
+
message: a.message,
|
|
8517
8511
|
reconnectAttempt: this.reconnectAttempts
|
|
8518
|
-
}), this.reportTransportDiagnostic("auth_timeout", this.connectionFailureDiagnostic(
|
|
8512
|
+
}), this.reportTransportDiagnostic("auth_timeout", this.connectionFailureDiagnostic(r, "token_provider")), this.setState({
|
|
8519
8513
|
status: "reconnecting",
|
|
8520
8514
|
lastError: Ti,
|
|
8521
8515
|
lastErrorCode: "connection_failed"
|
|
8522
|
-
}), this.emit("error",
|
|
8523
|
-
|
|
8516
|
+
}), this.emit("error", a), this.scheduleReconnect(
|
|
8517
|
+
r instanceof ne ? r.retryAfterMs : void 0
|
|
8524
8518
|
);
|
|
8525
8519
|
return;
|
|
8526
8520
|
}
|
|
8527
|
-
throw this.options.productVariant === "customer_embedded" ? (this.reportTransportDiagnostic("auth_rejected", this.connectionFailureDiagnostic(
|
|
8521
|
+
throw this.options.productVariant === "customer_embedded" ? (this.reportTransportDiagnostic("auth_rejected", this.connectionFailureDiagnostic(r, "token_provider")), this.stopAuthentication(new b(a.message, "connection_failed", !1), !0), this.emit("error", a), a) : (this.setState({
|
|
8528
8522
|
status: "error",
|
|
8529
|
-
lastError:
|
|
8523
|
+
lastError: a.message,
|
|
8530
8524
|
lastErrorCode: "connection_failed"
|
|
8531
|
-
}), this.emit("error",
|
|
8525
|
+
}), this.emit("error", a), a);
|
|
8532
8526
|
} finally {
|
|
8533
8527
|
this.connectionInProgress = !1;
|
|
8534
8528
|
}
|
|
@@ -8541,7 +8535,7 @@ class _t {
|
|
|
8541
8535
|
}
|
|
8542
8536
|
destroy() {
|
|
8543
8537
|
if (!this.clientRuntime.isDisposed) {
|
|
8544
|
-
this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(),
|
|
8538
|
+
this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), ud(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [];
|
|
8545
8539
|
for (const e of Object.values(this.listeners))
|
|
8546
8540
|
e?.clear();
|
|
8547
8541
|
this.accountListeners.clear(), this.interactionListeners.clear(), this.conversationAdapterGeneration++, this.conversationObservation?.dispose(), this.conversationUnsubscribe?.(), this.directoryObservation.dispose(), this.directoryHttp.dispose(), this.clientRuntime.dispose();
|
|
@@ -8602,7 +8596,7 @@ class _t {
|
|
|
8602
8596
|
if (this.clientRuntime.isDisposed) return null;
|
|
8603
8597
|
const i = e.trim(), n = t.attachments ?? [];
|
|
8604
8598
|
if (!i && !n.length) return null;
|
|
8605
|
-
if (this.options.productVariant === "customer_embedded" && (n.forEach(
|
|
8599
|
+
if (this.options.productVariant === "customer_embedded" && (n.forEach(Dn), n.reduce((y, g) => y + g.sizeBytes, 0) > Sn))
|
|
8606
8600
|
throw new Error("Embedded attachments must total at most 50 MB per message");
|
|
8607
8601
|
const r = t.clientMessageId ?? j(), a = J(this.operationTimingReporter, {
|
|
8608
8602
|
operation: "send",
|
|
@@ -8650,7 +8644,7 @@ class _t {
|
|
|
8650
8644
|
...t.proactiveSuggestionQuestion ? { proactiveSuggestionQuestion: t.proactiveSuggestionQuestion } : {},
|
|
8651
8645
|
metadata: { ...qi(this.options.metadata), ...t.automationOnboarding ? { automationOnboarding: !0 } : {} }
|
|
8652
8646
|
})),
|
|
8653
|
-
invocation:
|
|
8647
|
+
invocation: Ec(t.invocation ?? t.initiatedBy),
|
|
8654
8648
|
entrySurface: this.options.entrySurface,
|
|
8655
8649
|
submittedAt: t.submittedAt ?? Date.now()
|
|
8656
8650
|
});
|
|
@@ -8672,7 +8666,7 @@ class _t {
|
|
|
8672
8666
|
});
|
|
8673
8667
|
}
|
|
8674
8668
|
reportResponseVisibility(e) {
|
|
8675
|
-
|
|
8669
|
+
Uo(this, this.options.entrySurface, e);
|
|
8676
8670
|
}
|
|
8677
8671
|
reportInvalidStateTransition(e, t, i) {
|
|
8678
8672
|
i !== void 0 && !As(i) || this.reportHealthSignal("invalid_state_transition", {
|
|
@@ -8698,7 +8692,7 @@ class _t {
|
|
|
8698
8692
|
}
|
|
8699
8693
|
getModel() {
|
|
8700
8694
|
return this.clientRuntime.project("modelSelection", {
|
|
8701
|
-
core: () =>
|
|
8695
|
+
core: () => Ta(this.clientRuntime, this.modelClientScopeId)
|
|
8702
8696
|
});
|
|
8703
8697
|
}
|
|
8704
8698
|
setModel(e) {
|
|
@@ -8710,7 +8704,7 @@ class _t {
|
|
|
8710
8704
|
const t = this.clientRuntime.engine.getState().slices, i = t.directory.clients[this.modelClientScopeId], n = Re(t.conversation, t.directory, i), r = Xi(n, e);
|
|
8711
8705
|
if (!r) return !1;
|
|
8712
8706
|
if (r.type === "preparation") {
|
|
8713
|
-
const a = j(), o =
|
|
8707
|
+
const a = j(), o = Sr(r.submission);
|
|
8714
8708
|
return Lt(this.clientRuntime, this.modelClientScopeId, a, r.submission.requestedModel), this.sendMessage(o.content, { clientMessageId: a, attachments: o.attachments, proactiveSuggestionQuestion: o.proactiveSuggestionQuestion }).catch((c) => this.emit("error", Oe(c))), !0;
|
|
8715
8709
|
}
|
|
8716
8710
|
return r.type === "delivery" ? (this.clientRuntime.engine.dispatch({ ...this.directoryAuthority, type: "conversation.submit", userMessageId: r.userMessageId, now: Date.now(), manualRetry: !0 }), !0) : (this.clientRuntime.engine.dispatch({ ...this.directoryAuthority, type: "conversation.operation", command: {
|
|
@@ -8724,13 +8718,13 @@ class _t {
|
|
|
8724
8718
|
} }), !0);
|
|
8725
8719
|
}
|
|
8726
8720
|
createLocalAttachment(e) {
|
|
8727
|
-
this.options.productVariant === "customer_embedded" &&
|
|
8721
|
+
this.options.productVariant === "customer_embedded" && hd(e);
|
|
8728
8722
|
const t = j(), i = {
|
|
8729
8723
|
id: t,
|
|
8730
8724
|
name: e.name || "attachment",
|
|
8731
|
-
mimeType:
|
|
8725
|
+
mimeType: xn(e),
|
|
8732
8726
|
sizeBytes: e.size
|
|
8733
|
-
}, n = Date.now(), r =
|
|
8727
|
+
}, n = Date.now(), r = na({
|
|
8734
8728
|
attachmentId: t,
|
|
8735
8729
|
name: i.name,
|
|
8736
8730
|
mimeType: i.mimeType,
|
|
@@ -8774,7 +8768,7 @@ class _t {
|
|
|
8774
8768
|
return;
|
|
8775
8769
|
}
|
|
8776
8770
|
const w = m.result.attachment;
|
|
8777
|
-
d(
|
|
8771
|
+
d(On({
|
|
8778
8772
|
id: w.id,
|
|
8779
8773
|
name: w.name,
|
|
8780
8774
|
mimeType: w.mime_type,
|
|
@@ -8804,9 +8798,9 @@ class _t {
|
|
|
8804
8798
|
});
|
|
8805
8799
|
};
|
|
8806
8800
|
let a = !1;
|
|
8807
|
-
return
|
|
8801
|
+
return Ed(async () => {
|
|
8808
8802
|
let o = await r(!1);
|
|
8809
|
-
if (n(), !o.ok &&
|
|
8803
|
+
if (n(), !o.ok && Cd(o.status) && this.options.tokenProvider && !a && (a = !0, o = await r(!0), n()), !o.ok) throw new Bn("Failed to prepare attachment upload", o.status);
|
|
8810
8804
|
return await o.json();
|
|
8811
8805
|
}, "Failed to prepare attachment upload");
|
|
8812
8806
|
}
|
|
@@ -8827,7 +8821,7 @@ class _t {
|
|
|
8827
8821
|
const n = t.selections[i]?.sessionId;
|
|
8828
8822
|
for (const [r, a] of this.activeBrowserToolCalls)
|
|
8829
8823
|
a.event.sessionId === n && this.activeBrowserToolCalls.delete(r);
|
|
8830
|
-
|
|
8824
|
+
Di(this.options.clientId, this.activeBrowserToolCalls.values()), this.clientRuntime.engine.dispatch({
|
|
8831
8825
|
...this.directoryAuthority,
|
|
8832
8826
|
type: "conversation.stop",
|
|
8833
8827
|
clientScopeId: this.modelClientScopeId,
|
|
@@ -8867,7 +8861,7 @@ class _t {
|
|
|
8867
8861
|
}
|
|
8868
8862
|
getSessionHistoryState() {
|
|
8869
8863
|
return this.clientRuntime.project("directory", { core: () => {
|
|
8870
|
-
const e = this.clientRuntime.engine.getProjection().directory, t = e.queries[x(this.getDirectoryQuery())], i = Qt(this.options.entrySurface).map((l) => this.getDirectoryQuery(l)).map((l) => e.queries[x(l)]).filter((l) => l !== void 0), n = Object.values(e.optimisticEntries).reverse(), r =
|
|
8864
|
+
const e = this.clientRuntime.engine.getProjection().directory, t = e.queries[x(this.getDirectoryQuery())], i = Qt(this.options.entrySurface).map((l) => this.getDirectoryQuery(l)).map((l) => e.queries[x(l)]).filter((l) => l !== void 0), n = Object.values(e.optimisticEntries).reverse(), r = qo(i), a = new Set(n.flatMap((l) => l.sessionId ? [l.sessionId] : [])), o = [...n.map((l) => l.id), ...r.filter((l) => !a.has(l))], c = Object.fromEntries([
|
|
8871
8865
|
...n.map((l) => [l.id, {
|
|
8872
8866
|
id: l.id,
|
|
8873
8867
|
title: null,
|
|
@@ -8881,7 +8875,7 @@ class _t {
|
|
|
8881
8875
|
isPinned: !1
|
|
8882
8876
|
}]),
|
|
8883
8877
|
...r.filter((l) => !a.has(l)).map((l) => [l, this.toSessionHistoryEntry(e.entities[l])])
|
|
8884
|
-
]), d =
|
|
8878
|
+
]), d = ko(i);
|
|
8885
8879
|
return {
|
|
8886
8880
|
key: `${this.options.clientId}:recent`,
|
|
8887
8881
|
status: d?.status ?? "not_requested",
|
|
@@ -8983,7 +8977,7 @@ class _t {
|
|
|
8983
8977
|
throw new Error("This interaction is no longer available.");
|
|
8984
8978
|
if (!r.allowedActions.includes(t))
|
|
8985
8979
|
throw new Error("This action is not available for the interaction.");
|
|
8986
|
-
if (
|
|
8980
|
+
if (za(t) && await this.interactionManager.act(
|
|
8987
8981
|
{
|
|
8988
8982
|
key: r.id,
|
|
8989
8983
|
category: r.category,
|
|
@@ -9018,7 +9012,7 @@ class _t {
|
|
|
9018
9012
|
} });
|
|
9019
9013
|
}
|
|
9020
9014
|
createConversationInteractionPort() {
|
|
9021
|
-
return
|
|
9015
|
+
return Rr({
|
|
9022
9016
|
authority: this.directoryAuthority,
|
|
9023
9017
|
runtime: () => this.clientRuntime,
|
|
9024
9018
|
manager: this.interactionManager,
|
|
@@ -9035,7 +9029,7 @@ class _t {
|
|
|
9035
9029
|
this.tabGroupsPermissionNeeded = (await e.getState()).permissionNeeded;
|
|
9036
9030
|
} catch {
|
|
9037
9031
|
}
|
|
9038
|
-
for (const t of this.interactionManager.getConversationInputs(this.state.sessionId) === void 0 ?
|
|
9032
|
+
for (const t of this.interactionManager.getConversationInputs(this.state.sessionId) === void 0 ? ji(this.state.messages) : []) {
|
|
9039
9033
|
if (!this.options.runtimeAdapters?.integrationAuthStatusLoader) break;
|
|
9040
9034
|
const i = this.integrationAuthStatusByRequestId.get(t.authRequestId);
|
|
9041
9035
|
if (!(i !== void 0 && i !== "pending")) {
|
|
@@ -9051,7 +9045,7 @@ class _t {
|
|
|
9051
9045
|
this.rebuildRuntimeInteractions();
|
|
9052
9046
|
}
|
|
9053
9047
|
rebuildRuntimeInteractions(e = !0) {
|
|
9054
|
-
const t = [], i = this.interactionManager.getConversationInputs(this.state.sessionId), n = this.options.productVariant === "personal" && (this.options.entrySurface === "main_web_chat" || this.options.entrySurface === "automation") ? i === void 0 ?
|
|
9048
|
+
const t = [], i = this.interactionManager.getConversationInputs(this.state.sessionId), n = this.options.productVariant === "personal" && (this.options.entrySurface === "main_web_chat" || this.options.entrySurface === "automation") ? i === void 0 ? aa(this.state.messages) : i.share?.candidate ?? null : null;
|
|
9055
9049
|
if (n) {
|
|
9056
9050
|
const a = {
|
|
9057
9051
|
key: n.id,
|
|
@@ -9079,7 +9073,7 @@ class _t {
|
|
|
9079
9073
|
revision: i?.share?.revision ?? 0
|
|
9080
9074
|
});
|
|
9081
9075
|
}
|
|
9082
|
-
for (const a of i === void 0 ?
|
|
9076
|
+
for (const a of i === void 0 ? ji(this.state.messages) : i.integrations.map((o) => o.request)) {
|
|
9083
9077
|
if (!this.options.runtimeAdapters?.integrationAuthHandler) break;
|
|
9084
9078
|
const o = i?.integrations.find((l) => l.request.authRequestId === a.authRequestId)?.lifecycle, c = o && o !== "pending" ? o : this.integrationAuthStatusByRequestId.get(a.authRequestId) ?? "pending", d = c === "completed";
|
|
9085
9079
|
t.push({
|
|
@@ -9199,7 +9193,7 @@ class _t {
|
|
|
9199
9193
|
if (!this.socket || this.socket.readyState !== WebSocket.OPEN)
|
|
9200
9194
|
return !1;
|
|
9201
9195
|
const t = this.socket;
|
|
9202
|
-
if ((e.type === "tool.result" || e.type === "run.stop") && t instanceof
|
|
9196
|
+
if ((e.type === "tool.result" || e.type === "run.stop") && t instanceof D) {
|
|
9203
9197
|
const i = this.queuedClientEvents.find((n) => "sessionId" in n && n.sessionId === e.sessionId && (e.type === "tool.result" && n.type === "tool.result" && n.callId === e.callId || e.type === "run.stop" && n.type === "run.stop" && n.expectedUserMessageId === e.expectedUserMessageId)) ?? e;
|
|
9204
9198
|
return this.queuedClientEvents.includes(i) || this.queuedClientEvents.push(i), ge(this.options.clientId, this.queuedClientEvents), this.pendingRetainedCommandDeliveries.has(i) || (this.pendingRetainedCommandDeliveries.add(i), t.sendRetainedCommand(Q(i)).then((n) => {
|
|
9205
9199
|
this.pendingRetainedCommandDeliveries.delete(i), n && (this.queuedClientEvents = this.queuedClientEvents.filter((r) => r !== i), ge(this.options.clientId, this.queuedClientEvents));
|
|
@@ -9231,7 +9225,7 @@ class _t {
|
|
|
9231
9225
|
occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9232
9226
|
source: "web_sdk",
|
|
9233
9227
|
entrySurface: this.options.entrySurface,
|
|
9234
|
-
...e === "first_response_slow" ? { responseDiagnostics:
|
|
9228
|
+
...e === "first_response_slow" ? { responseDiagnostics: Bo(
|
|
9235
9229
|
this,
|
|
9236
9230
|
this.options.entrySurface,
|
|
9237
9231
|
i.sessionId,
|
|
@@ -9325,7 +9319,7 @@ class _t {
|
|
|
9325
9319
|
reportTransportDiagnostic(e, t = {}) {
|
|
9326
9320
|
const i = typeof navigator > "u" ? "unknown" : navigator.onLine === !1 ? "offline" : "online";
|
|
9327
9321
|
t.stage && (this.lastRecoveryStage = t.stage);
|
|
9328
|
-
const n = t.connectionAttemptId ?? (this.socket instanceof
|
|
9322
|
+
const n = t.connectionAttemptId ?? (this.socket instanceof D ? this.socket.connectionAttempt?.connectionAttemptId ?? this.recoveryDiagnosticId : this.recoveryDiagnosticId), r = `${t.stage ?? "socket_admission"}:${e}:${t.recoveryOutcome ?? "none"}:${t.httpStatus ?? "none"}:${t.requestId ?? n}:${t.closeCode ?? "none"}:${t.disconnectReason ?? "none"}:${i}`, a = (/* @__PURE__ */ new Date()).toISOString(), o = this.transportDiagnosticEpisodes.get(r), c = {
|
|
9329
9323
|
id: o?.id ?? crypto.randomUUID(),
|
|
9330
9324
|
phase: e,
|
|
9331
9325
|
entrySurface: this.options.entrySurface,
|
|
@@ -9422,7 +9416,7 @@ class _t {
|
|
|
9422
9416
|
if (this.state.starterPromptsLoading || this.transientStarterPromptsRequestInFlight || this.transientStarterPromptsRequestAttempted)
|
|
9423
9417
|
return;
|
|
9424
9418
|
this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
|
|
9425
|
-
const e =
|
|
9419
|
+
const e = kc();
|
|
9426
9420
|
this.sendNow(
|
|
9427
9421
|
Q({
|
|
9428
9422
|
type: "starter_prompts.page_context",
|
|
@@ -9433,13 +9427,13 @@ class _t {
|
|
|
9433
9427
|
) || (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !1, this.setState({ starterPromptsLoading: !1 }));
|
|
9434
9428
|
}
|
|
9435
9429
|
startStarterPromptUrlWatcher() {
|
|
9436
|
-
this.locationChangeCleanup || (this.locationChangeCleanup =
|
|
9430
|
+
this.locationChangeCleanup || (this.locationChangeCleanup = qc(() => this.handleStarterPromptUrlChange()));
|
|
9437
9431
|
}
|
|
9438
9432
|
handleStarterPromptUrlChange() {
|
|
9439
9433
|
const e = location.href;
|
|
9440
9434
|
e !== this.lastStarterPromptPageUrl && (this.lastStarterPromptPageUrl = e, this.clearStarterPromptUrlRefreshTimer(), this.starterPromptUrlRefreshTimer = window.setTimeout(() => {
|
|
9441
9435
|
this.starterPromptUrlRefreshTimer = null, this.refreshStarterPromptsForCurrentUrl();
|
|
9442
|
-
},
|
|
9436
|
+
}, oc));
|
|
9443
9437
|
}
|
|
9444
9438
|
refreshStarterPromptsForCurrentUrl() {
|
|
9445
9439
|
this.socket?.readyState !== WebSocket.OPEN || this.state.status === "closed" || (this.setState({ starterPromptsLoading: this.state.messages.length === 0 }), this.sendNow({
|
|
@@ -9452,7 +9446,7 @@ class _t {
|
|
|
9452
9446
|
}
|
|
9453
9447
|
flushQueuedClientEvents() {
|
|
9454
9448
|
const e = [...this.queuedClientEvents];
|
|
9455
|
-
this.queuedClientEvents = this.queuedClientEvents.filter((t) => (t.type === "tool.result" || t.type === "run.stop") && this.socket instanceof
|
|
9449
|
+
this.queuedClientEvents = this.queuedClientEvents.filter((t) => (t.type === "tool.result" || t.type === "run.stop") && this.socket instanceof D), ge(this.options.clientId, this.queuedClientEvents);
|
|
9456
9450
|
for (let t = 0; t < e.length; t++)
|
|
9457
9451
|
if (!this.sendNow(Q(e[t]))) {
|
|
9458
9452
|
this.queuedClientEvents.unshift(...e.slice(t).filter((i) => !this.queuedClientEvents.includes(i)));
|
|
@@ -9464,10 +9458,10 @@ class _t {
|
|
|
9464
9458
|
this.resetConversationSelection({ notifyTransport: !1 }), this.queuedClientEvents = [], ge(this.options.clientId, this.queuedClientEvents);
|
|
9465
9459
|
}
|
|
9466
9460
|
applyAuthenticatedDirectoryIdentity(e) {
|
|
9467
|
-
const t =
|
|
9461
|
+
const t = Oi(e);
|
|
9468
9462
|
if (!t) return !1;
|
|
9469
9463
|
const i = Yt(e, "runtimeCommunityId") ?? this.directoryHttp.auth.community_id, n = `${this.options.clientId}:${t.id}:${i ?? this.options.productVariant}`, r = this.directoryAuthority.authorityId !== n, a = this.authenticatedUserId === null, o = a ? Object.values(this.clientRuntime.engine.getState().slices.conversation.operations).filter((d) => ["waiting", "running", "uncertain"].includes(d.phase) && (d.command.type === "run.stop" || d.command.type === "session.reset")).map((d) => d.command) : [], c = a && this.directoryAuthority.authorityId === `${this.options.clientId}:${this.options.runtimeCommunityId ?? this.options.productVariant}` ? this.state.sessionId : null;
|
|
9470
|
-
if (this.authenticatedUserId = t.id, this.directoryHttp.auth.community_id = i,
|
|
9464
|
+
if (this.authenticatedUserId = t.id, this.directoryHttp.auth.community_id = i, lr(this.options.clientId, n), r) {
|
|
9471
9465
|
const d = this.directoryAuthority;
|
|
9472
9466
|
this.directoryObservation.dispose(), this.conversationAdapterGeneration++, this.conversationObservation?.dispose(), this.directoryAuthority = { authorityId: n, generation: d.generation + 1 }, this.clientRuntime.engine.dispatch({ ...this.directoryAuthority, type: "directory.authority_replace", expectedGeneration: d.generation }), this.createDirectoryAdapters();
|
|
9473
9467
|
const l = this.getModel();
|
|
@@ -9529,16 +9523,16 @@ class _t {
|
|
|
9529
9523
|
}
|
|
9530
9524
|
if (e.type === "auth.ok") {
|
|
9531
9525
|
this.clearSocketAuthTimer(), this.clearEmbeddedRecoveryBudget(), this.rejectedDiagnosticsToken = null, this.clientDiagnosticsRetryTimer !== null && window.clearTimeout(this.clientDiagnosticsRetryTimer), this.clientDiagnosticsRetryTimer = null, this.options.productVariant === "customer_embedded" && (this.pendingTransportDiagnostics.length > 0 || this.state.lastErrorCode === "connection_failed") && this.reportTransportDiagnostic("ready_applied", { recoveryOutcome: "recovered", stage: "bootstrap" }), this.reconnectAttempts = 0, this.transportDiagnosticEpisodes.clear(), this.flushClientDiagnostics();
|
|
9532
|
-
const t =
|
|
9526
|
+
const t = Oi(e.user);
|
|
9533
9527
|
this.applyAuthenticatedDirectoryIdentity(e.user), this.authenticatedSocket = this.socket, this.directoryObservation.reconnect().catch(() => {
|
|
9534
9528
|
}), this.conversationObservation?.wake(), this.flushPendingWidgetLifecycleEvents(), this.flushQueuedClientEvents(), this.startHeartbeat();
|
|
9535
|
-
const i =
|
|
9529
|
+
const i = jc(e), n = Object.prototype.hasOwnProperty.call(e, "appearance");
|
|
9536
9530
|
$("web-sdk.agent", "Received auth.ok appearance", {
|
|
9537
9531
|
hasAppearance: n,
|
|
9538
9532
|
rawAppearance: e.appearance,
|
|
9539
9533
|
normalizedAppearance: i
|
|
9540
|
-
}), this.runtimeHelperJavascript =
|
|
9541
|
-
const r =
|
|
9534
|
+
}), this.runtimeHelperJavascript = Lc(e.runtimeHelpers)?.javascript ?? null;
|
|
9535
|
+
const r = Pi(e, "starterPrompts"), a = Object.prototype.hasOwnProperty.call(e, "starterPrompts"), o = e.starterPromptsLoading === !0, c = {
|
|
9542
9536
|
user: t,
|
|
9543
9537
|
status: "connected",
|
|
9544
9538
|
...this.state.lastErrorCode === "connection_failed" ? { lastError: null, lastErrorCode: null } : {}
|
|
@@ -9547,7 +9541,7 @@ class _t {
|
|
|
9547
9541
|
type: "runtime.auth_ack",
|
|
9548
9542
|
connectionAttempt: this.connectionAttemptId,
|
|
9549
9543
|
entrySurface: this.options.entrySurface
|
|
9550
|
-
}), a && r.length === 0 && !o && !
|
|
9544
|
+
}), a && r.length === 0 && !o && !Mc() && this.requestTransientStarterPrompts(), this.state.sessionId && this.send({
|
|
9551
9545
|
type: "page.upsert",
|
|
9552
9546
|
sessionId: this.state.sessionId,
|
|
9553
9547
|
page: Z(),
|
|
@@ -9557,7 +9551,7 @@ class _t {
|
|
|
9557
9551
|
}
|
|
9558
9552
|
if (e.type === "starterPrompts.updated") {
|
|
9559
9553
|
this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0, this.setState({
|
|
9560
|
-
...Object.prototype.hasOwnProperty.call(e, "starterPrompts") ? { starterPrompts:
|
|
9554
|
+
...Object.prototype.hasOwnProperty.call(e, "starterPrompts") ? { starterPrompts: Pi(e, "starterPrompts") } : {},
|
|
9561
9555
|
starterPromptsLoading: e.starterPromptsLoading === !0
|
|
9562
9556
|
});
|
|
9563
9557
|
return;
|
|
@@ -9592,7 +9586,7 @@ class _t {
|
|
|
9592
9586
|
}
|
|
9593
9587
|
if (!this.options.webSocketFactory && (e.code === "unauthorized" || e.code === "401") && e.reason === "invalid_token" && (this.canRefreshInvalidCredential() || this.credentialRecovery !== null)) {
|
|
9594
9588
|
const t = this.socket;
|
|
9595
|
-
if (t instanceof
|
|
9589
|
+
if (t instanceof D) {
|
|
9596
9590
|
this.credentialRecovery || this.refreshCredentials(
|
|
9597
9591
|
t,
|
|
9598
9592
|
!0,
|
|
@@ -9609,7 +9603,7 @@ class _t {
|
|
|
9609
9603
|
}
|
|
9610
9604
|
if ((e.code === "unauthorized" || e.code === "401") && e.reason === "token_expired" && e.retryable === !0 && this.options.tokenProvider) {
|
|
9611
9605
|
const t = this.socket;
|
|
9612
|
-
t instanceof
|
|
9606
|
+
t instanceof D ? this.refreshDefaultTransportCredentials(t) : (this.invalidateProviderToken(), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.setReconnectingState(), this.socket = null, this.scheduleReconnect(), t?.close());
|
|
9613
9607
|
return;
|
|
9614
9608
|
}
|
|
9615
9609
|
if (this.options.productVariant === "customer_embedded" && /^4[0-9]{2}$/.test(String(e.code)) && !["401", "408", "425", "429"].includes(String(e.code)) && e.retryable !== !0 && (e.stage === "executor_registration" || e.stage === "socket_admission" || e.stage === "bootstrap")) {
|
|
@@ -9649,7 +9643,7 @@ class _t {
|
|
|
9649
9643
|
});
|
|
9650
9644
|
}
|
|
9651
9645
|
updateAccountFallbackFromSession(e) {
|
|
9652
|
-
const t = e && typeof e == "object" ? e.metadata : null, i =
|
|
9646
|
+
const t = e && typeof e == "object" ? e.metadata : null, i = Tr(t);
|
|
9653
9647
|
if (this.usingPaidCreditFallback !== i && (this.usingPaidCreditFallback = i, !!this.account)) {
|
|
9654
9648
|
this.account = { ...this.account, usingPaidCreditFallback: i };
|
|
9655
9649
|
for (const n of this.accountListeners) n(this.getAccount());
|
|
@@ -9668,7 +9662,7 @@ class _t {
|
|
|
9668
9662
|
}
|
|
9669
9663
|
if (this.activeBrowserToolCalls.has(i)) return;
|
|
9670
9664
|
const c = n === "execute_code", d = n === "execute_code_in_browser_tab" && a !== null && typeof a == "object" && a.tabId === "local:current";
|
|
9671
|
-
if (!c && !d || !
|
|
9665
|
+
if (!c && !d || !yd(a)) {
|
|
9672
9666
|
this.send({
|
|
9673
9667
|
type: "tool.result",
|
|
9674
9668
|
sessionId: t,
|
|
@@ -9717,7 +9711,7 @@ class _t {
|
|
|
9717
9711
|
let l = null, u;
|
|
9718
9712
|
l = await this.executeRuntimeHelper(), u = await Ci(
|
|
9719
9713
|
a,
|
|
9720
|
-
|
|
9714
|
+
Sc(e.runtimeContext, this.options.backendUrl)
|
|
9721
9715
|
).catch((h) => ({
|
|
9722
9716
|
ok: !1,
|
|
9723
9717
|
exception: {
|
|
@@ -9730,24 +9724,24 @@ class _t {
|
|
|
9730
9724
|
toolName: n,
|
|
9731
9725
|
summary: a.summary,
|
|
9732
9726
|
rawInput: Q(a),
|
|
9733
|
-
rawOutput: Q(
|
|
9734
|
-
}),
|
|
9727
|
+
rawOutput: Q($c(u, l))
|
|
9728
|
+
}), Di(this.options.clientId, this.activeBrowserToolCalls.values()));
|
|
9735
9729
|
}
|
|
9736
9730
|
startPageLifecycleRecovery() {
|
|
9737
9731
|
if (this.pageLifecycleCleanup)
|
|
9738
9732
|
return;
|
|
9739
9733
|
const e = () => {
|
|
9740
|
-
|
|
9734
|
+
Mn(this.options.clientId, this.activeBrowserToolCalls.values());
|
|
9741
9735
|
};
|
|
9742
9736
|
window.addEventListener("pagehide", e), window.addEventListener("beforeunload", e), this.pageLifecycleCleanup = () => {
|
|
9743
9737
|
window.removeEventListener("pagehide", e), window.removeEventListener("beforeunload", e);
|
|
9744
9738
|
};
|
|
9745
9739
|
}
|
|
9746
9740
|
installSessionBrowserApis() {
|
|
9747
|
-
this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup =
|
|
9741
|
+
this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup = pc();
|
|
9748
9742
|
}
|
|
9749
9743
|
cleanupSessionBrowserApis() {
|
|
9750
|
-
this.sessionBrowserApisCleanup && (
|
|
9744
|
+
this.sessionBrowserApisCleanup && (wc(this.sessionBrowserApisCleanup), this.sessionBrowserApisCleanup = null);
|
|
9751
9745
|
}
|
|
9752
9746
|
async executeRuntimeHelper() {
|
|
9753
9747
|
if (!this.runtimeHelperJavascript?.trim())
|
|
@@ -9755,15 +9749,15 @@ class _t {
|
|
|
9755
9749
|
const e = await Ci({
|
|
9756
9750
|
javascript: this.runtimeHelperJavascript
|
|
9757
9751
|
});
|
|
9758
|
-
return e.ok === !1 ?
|
|
9752
|
+
return e.ok === !1 ? Fc(e) : null;
|
|
9759
9753
|
}
|
|
9760
9754
|
enableNetworkCapture() {
|
|
9761
|
-
this.networkCaptureCleanup || (this.networkCaptureCleanup =
|
|
9762
|
-
|
|
9755
|
+
this.networkCaptureCleanup || (this.networkCaptureCleanup = dc((e) => {
|
|
9756
|
+
Sd(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
|
|
9763
9757
|
}));
|
|
9764
9758
|
}
|
|
9765
9759
|
enqueueNetworkEvent(e) {
|
|
9766
|
-
this.queuedNetworkEvents.length >=
|
|
9760
|
+
this.queuedNetworkEvents.length >= ec || (this.queuedNetworkEvents.push(_d(e)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
|
|
9767
9761
|
this.networkBatchTimer = null;
|
|
9768
9762
|
const t = this.queuedNetworkEvents.splice(0, this.queuedNetworkEvents.length);
|
|
9769
9763
|
t.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
|
|
@@ -9772,10 +9766,13 @@ class _t {
|
|
|
9772
9766
|
page: Z(),
|
|
9773
9767
|
events: t
|
|
9774
9768
|
});
|
|
9775
|
-
},
|
|
9769
|
+
}, Za)));
|
|
9776
9770
|
}
|
|
9777
9771
|
startEmbeddedRecoveryBudget() {
|
|
9778
|
-
this.options.productVariant !== "customer_embedded" || this.embeddedRecoveryTimer !== null || this.authenticationFailure
|
|
9772
|
+
if (this.options.productVariant !== "customer_embedded" || this.embeddedRecoveryTimer !== null || this.authenticationFailure) return;
|
|
9773
|
+
this.recoveryDiagnosticId = crypto.randomUUID();
|
|
9774
|
+
const e = this.authenticatedUserId ? 10 * 6e4 : 12e4;
|
|
9775
|
+
this.embeddedRecoveryTimer = window.setTimeout(() => {
|
|
9779
9776
|
this.embeddedRecoveryTimer = null, this.connectionAttemptId += 1, this.tokenAbortController?.abort(), this.tokenAbortController = null, this.tokenRequest = null, this.connectionInProgress = !1, this.reportTransportDiagnostic("auth_refresh_failed", {
|
|
9780
9777
|
stage: this.lastRecoveryStage,
|
|
9781
9778
|
recoveryOutcome: "exhausted",
|
|
@@ -9785,7 +9782,7 @@ class _t {
|
|
|
9785
9782
|
"connection_failed",
|
|
9786
9783
|
!1
|
|
9787
9784
|
), !0);
|
|
9788
|
-
},
|
|
9785
|
+
}, e);
|
|
9789
9786
|
}
|
|
9790
9787
|
clearEmbeddedRecoveryBudget() {
|
|
9791
9788
|
this.embeddedRecoveryTimer !== null && window.clearTimeout(this.embeddedRecoveryTimer), this.embeddedRecoveryTimer = null;
|
|
@@ -9804,10 +9801,10 @@ class _t {
|
|
|
9804
9801
|
return;
|
|
9805
9802
|
const t = Math.min(
|
|
9806
9803
|
bs,
|
|
9807
|
-
Math.max(
|
|
9804
|
+
Math.max(ac(this.reconnectAttempts), e)
|
|
9808
9805
|
);
|
|
9809
9806
|
this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
|
|
9810
|
-
this.reconnectTimer = null, (this.refreshingDefaultCredentials && this.socket instanceof
|
|
9807
|
+
this.reconnectTimer = null, (this.refreshingDefaultCredentials && this.socket instanceof D ? this.refreshDefaultTransportCredentials(this.socket) : this.connect()).catch((n) => {
|
|
9811
9808
|
$("web-sdk.agent", "Pluno reconnect failed; retrying", {
|
|
9812
9809
|
message: n instanceof Error ? n.message : String(n),
|
|
9813
9810
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
@@ -9852,7 +9849,7 @@ class _t {
|
|
|
9852
9849
|
authReason: ["invalid_token", "token_expired", "missing_token", "user_not_found"].includes(t?.reason ?? "") ? t.reason : "unknown",
|
|
9853
9850
|
authTransport: t?.authTransport === "http" ? "http" : "socket",
|
|
9854
9851
|
...t?.requestId && /^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/.test(t.requestId) ? { requestId: t.requestId, .../^(runtime|embed|extension|conversations):(snapshot|me|bootstrap|commands|activity|session-history|other)$/.test(t.authEndpoint ?? "") ? { authEndpoint: t.authEndpoint } : {} } : {},
|
|
9855
|
-
...this.socket instanceof
|
|
9852
|
+
...this.socket instanceof D ? { connectionAttemptId: this.socket.connectionAttempt?.connectionAttemptId } : {}
|
|
9856
9853
|
};
|
|
9857
9854
|
}
|
|
9858
9855
|
stopAuthentication(e, t = !1) {
|
|
@@ -9876,7 +9873,7 @@ class _t {
|
|
|
9876
9873
|
if (this.credentialRecovery) return this.credentialRecovery;
|
|
9877
9874
|
if (this.directoryHttp.auth.token !== e) return;
|
|
9878
9875
|
const a = this.socket;
|
|
9879
|
-
if (a instanceof
|
|
9876
|
+
if (a instanceof D) return this.refreshCredentials(a, r, t);
|
|
9880
9877
|
if (this.options.webSocketFactory) throw t;
|
|
9881
9878
|
}
|
|
9882
9879
|
throw this.stopAuthentication(t), t;
|
|
@@ -9924,8 +9921,8 @@ class _t {
|
|
|
9924
9921
|
const e = this.socket;
|
|
9925
9922
|
!e || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
|
|
9926
9923
|
this.socket === e && ($("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
|
|
9927
|
-
},
|
|
9928
|
-
},
|
|
9924
|
+
}, Va));
|
|
9925
|
+
}, Wa));
|
|
9929
9926
|
}
|
|
9930
9927
|
stopHeartbeat() {
|
|
9931
9928
|
this.heartbeatTimer !== null && (window.clearInterval(this.heartbeatTimer), this.heartbeatTimer = null), this.clearHeartbeatAckTimer();
|
|
@@ -9949,7 +9946,7 @@ class _t {
|
|
|
9949
9946
|
this.clientRuntime.isDisposed || (this.state = e, this.clientRuntime.engine.dispatch({ type: "activeUsers.authenticate", authenticated: !!(this.token && this.state.user && this.state.status !== "closed") }), this.rebuildRuntimeInteractions(), this.emit("state", this.getState()));
|
|
9950
9947
|
}
|
|
9951
9948
|
setReconnectingState() {
|
|
9952
|
-
if (this.authenticationFailure || this.state.status === "closed" || (this.startEmbeddedRecoveryBudget(), this.socket instanceof
|
|
9949
|
+
if (this.authenticationFailure || this.state.status === "closed" || (this.startEmbeddedRecoveryBudget(), this.socket instanceof D && this.socket.initialReadinessExpired)) return;
|
|
9953
9950
|
this.conversationObservation?.wake();
|
|
9954
9951
|
const e = this.state.lastError !== null && (!this.state.isThinking || this.state.lastErrorCode === "connection_failed");
|
|
9955
9952
|
this.setState({
|
|
@@ -9961,13 +9958,13 @@ class _t {
|
|
|
9961
9958
|
}
|
|
9962
9959
|
}
|
|
9963
9960
|
const Jt = /* @__PURE__ */ new WeakMap();
|
|
9964
|
-
function
|
|
9965
|
-
const e = window.__plunoProductAgentNetworkCapture ??
|
|
9961
|
+
function dc(s) {
|
|
9962
|
+
const e = window.__plunoProductAgentNetworkCapture ?? lc();
|
|
9966
9963
|
return e.subscribers.add(s), () => {
|
|
9967
9964
|
e.subscribers.delete(s), !(e.subscribers.size > 0) && (e.destroy(), window.__plunoProductAgentNetworkCapture === e && delete window.__plunoProductAgentNetworkCapture);
|
|
9968
9965
|
};
|
|
9969
9966
|
}
|
|
9970
|
-
function
|
|
9967
|
+
function lc() {
|
|
9971
9968
|
const s = /* @__PURE__ */ new Set(), e = (h) => {
|
|
9972
9969
|
s.forEach((p) => {
|
|
9973
9970
|
try {
|
|
@@ -9984,20 +9981,20 @@ function dc() {
|
|
|
9984
9981
|
throw g;
|
|
9985
9982
|
}
|
|
9986
9983
|
try {
|
|
9987
|
-
const g = p instanceof Request ? p : null, w =
|
|
9984
|
+
const g = p instanceof Request ? p : null, w = vd(p, g), I = Un(f?.headers ?? g?.headers);
|
|
9988
9985
|
if (!_e(w, I, f?.body)) {
|
|
9989
9986
|
const E = {
|
|
9990
9987
|
requestId: Zt("fetch"),
|
|
9991
9988
|
url: ae(w, Vt),
|
|
9992
9989
|
method: (f?.method ?? g?.method ?? "GET").toUpperCase(),
|
|
9993
9990
|
requestHeaders: I,
|
|
9994
|
-
requestBody:
|
|
9991
|
+
requestBody: Ni(f?.body),
|
|
9995
9992
|
resourceType: "fetch",
|
|
9996
9993
|
startedAt: new Date(m).toISOString()
|
|
9997
9994
|
};
|
|
9998
9995
|
y.then(
|
|
9999
9996
|
(C) => {
|
|
10000
|
-
|
|
9997
|
+
Id(C, E, m, e).catch(() => {
|
|
10001
9998
|
e({
|
|
10002
9999
|
...E,
|
|
10003
10000
|
responseStatus: C.status,
|
|
@@ -10034,12 +10031,12 @@ function dc() {
|
|
|
10034
10031
|
}, d = function(p) {
|
|
10035
10032
|
try {
|
|
10036
10033
|
const f = Jt.get(this);
|
|
10037
|
-
f && (f.excluded = f.excluded || _e(f.url, f.requestHeaders, p), f.requestBody =
|
|
10034
|
+
f && (f.excluded = f.excluded || _e(f.url, f.requestHeaders, p), f.requestBody = Ni(p), f.excluded || this.addEventListener(
|
|
10038
10035
|
"loadend",
|
|
10039
10036
|
() => {
|
|
10040
10037
|
queueMicrotask(() => {
|
|
10041
10038
|
try {
|
|
10042
|
-
const m =
|
|
10039
|
+
const m = Ad(this.getAllResponseHeaders());
|
|
10043
10040
|
e({
|
|
10044
10041
|
requestId: f.requestId,
|
|
10045
10042
|
url: f.url,
|
|
@@ -10049,7 +10046,7 @@ function dc() {
|
|
|
10049
10046
|
resourceType: "xhr",
|
|
10050
10047
|
responseStatus: this.status,
|
|
10051
10048
|
responseHeaders: m,
|
|
10052
|
-
responseBody:
|
|
10049
|
+
responseBody: wd(this, m),
|
|
10053
10050
|
errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
|
|
10054
10051
|
startedAt: f.startedAt,
|
|
10055
10052
|
durationMs: Date.now() - f.startedAtMs
|
|
@@ -10145,27 +10142,27 @@ function qi(s) {
|
|
|
10145
10142
|
const e = typeof s == "function" ? s() : s;
|
|
10146
10143
|
return e && Object.keys(e).length > 0 ? e : void 0;
|
|
10147
10144
|
}
|
|
10148
|
-
const
|
|
10149
|
-
function
|
|
10145
|
+
const uc = 5e3, hc = 12e4;
|
|
10146
|
+
function pc() {
|
|
10150
10147
|
const s = [
|
|
10151
|
-
|
|
10152
|
-
|
|
10148
|
+
mc(),
|
|
10149
|
+
fc()
|
|
10153
10150
|
].filter((e) => typeof e == "function");
|
|
10154
10151
|
return () => {
|
|
10155
10152
|
for (const e of s.reverse())
|
|
10156
10153
|
e();
|
|
10157
10154
|
};
|
|
10158
10155
|
}
|
|
10159
|
-
function
|
|
10156
|
+
function fc() {
|
|
10160
10157
|
return In(globalThis, "getPageSnapshot", async () => js());
|
|
10161
10158
|
}
|
|
10162
|
-
function
|
|
10159
|
+
function mc() {
|
|
10163
10160
|
return In(globalThis, "pageImages", {
|
|
10164
|
-
inspectImage: async (e, t) => await
|
|
10161
|
+
inspectImage: async (e, t) => await gc(e, t)
|
|
10165
10162
|
});
|
|
10166
10163
|
}
|
|
10167
|
-
async function
|
|
10168
|
-
const t =
|
|
10164
|
+
async function gc(s, e = {}) {
|
|
10165
|
+
const t = bc(e.name), i = await yc(s);
|
|
10169
10166
|
return i.ok ? i.sizeBytes > 8 * 1024 * 1024 ? {
|
|
10170
10167
|
type: "pluno.pageImages.inspectImage",
|
|
10171
10168
|
imageAttached: !1,
|
|
@@ -10183,15 +10180,15 @@ async function mc(s, e = {}) {
|
|
|
10183
10180
|
imageAttachmentError: i.error
|
|
10184
10181
|
};
|
|
10185
10182
|
}
|
|
10186
|
-
async function
|
|
10183
|
+
async function yc(s) {
|
|
10187
10184
|
return s instanceof Blob ? s.type.startsWith("image/") ? s.size === 0 ? { ok: !1, error: "Page image is empty." } : s.size > 8 * 1024 * 1024 ? { ok: !1, error: Rn } : {
|
|
10188
10185
|
ok: !0,
|
|
10189
10186
|
mimeType: s.type,
|
|
10190
10187
|
sizeBytes: s.size,
|
|
10191
|
-
dataUrl: await
|
|
10192
|
-
} : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof s != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } :
|
|
10188
|
+
dataUrl: await _c(s)
|
|
10189
|
+
} : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof s != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : vc(s);
|
|
10193
10190
|
}
|
|
10194
|
-
function
|
|
10191
|
+
function vc(s) {
|
|
10195
10192
|
if (!s.startsWith("data:") || !s.includes(","))
|
|
10196
10193
|
return { ok: !1, error: "Page image must be a complete data:image/* URL, not bare base64." };
|
|
10197
10194
|
const [e, t] = s.slice(5).split(",", 2), i = e.split(";").map((o) => o.trim()).filter(Boolean), n = i[0] ?? "";
|
|
@@ -10202,7 +10199,7 @@ function yc(s) {
|
|
|
10202
10199
|
const r = t.replace(/[ \t\r\n\f]+/g, "");
|
|
10203
10200
|
if (!/^[A-Za-z0-9+/]*={0,2}$/.test(r))
|
|
10204
10201
|
return { ok: !1, error: "Page image data URL has invalid base64." };
|
|
10205
|
-
const a =
|
|
10202
|
+
const a = Ic(r);
|
|
10206
10203
|
return a === null ? { ok: !1, error: "Page image data URL has invalid base64." } : a === 0 ? { ok: !1, error: "Page image is empty." } : {
|
|
10207
10204
|
ok: !0,
|
|
10208
10205
|
mimeType: n,
|
|
@@ -10210,22 +10207,22 @@ function yc(s) {
|
|
|
10210
10207
|
dataUrl: `data:${n};base64,${r}`
|
|
10211
10208
|
};
|
|
10212
10209
|
}
|
|
10213
|
-
function
|
|
10210
|
+
function Ic(s) {
|
|
10214
10211
|
if (s.length === 0 || s.length % 4 !== 0)
|
|
10215
10212
|
return null;
|
|
10216
10213
|
const e = s.length - s.replace(/=+$/, "").length;
|
|
10217
10214
|
return e > 2 ? null : s.length / 4 * 3 - e;
|
|
10218
10215
|
}
|
|
10219
|
-
function
|
|
10216
|
+
function bc(s) {
|
|
10220
10217
|
return (typeof s == "string" ? s.trim() : "") || "Page image";
|
|
10221
10218
|
}
|
|
10222
|
-
function
|
|
10219
|
+
function wc(s) {
|
|
10223
10220
|
try {
|
|
10224
10221
|
s();
|
|
10225
10222
|
} catch {
|
|
10226
10223
|
}
|
|
10227
10224
|
}
|
|
10228
|
-
function
|
|
10225
|
+
function _c(s) {
|
|
10229
10226
|
return new Promise((e, t) => {
|
|
10230
10227
|
const i = new FileReader();
|
|
10231
10228
|
i.onload = () => {
|
|
@@ -10239,7 +10236,7 @@ function wc(s) {
|
|
|
10239
10236
|
}
|
|
10240
10237
|
async function Ci(s, e) {
|
|
10241
10238
|
const t = Object.getPrototypeOf(async function() {
|
|
10242
|
-
}).constructor, i = s.timeoutMs ??
|
|
10239
|
+
}).constructor, i = s.timeoutMs ?? uc, n = Date.now(), r = [];
|
|
10243
10240
|
let a;
|
|
10244
10241
|
const o = {
|
|
10245
10242
|
log: console.log,
|
|
@@ -10257,7 +10254,7 @@ async function Ci(s, e) {
|
|
|
10257
10254
|
a = window.setTimeout(() => u(d), i);
|
|
10258
10255
|
})
|
|
10259
10256
|
]);
|
|
10260
|
-
return l === d ?
|
|
10257
|
+
return l === d ? Rc(i) : {
|
|
10261
10258
|
ok: !0,
|
|
10262
10259
|
result: l,
|
|
10263
10260
|
console: r,
|
|
@@ -10286,7 +10283,7 @@ async function Ci(s, e) {
|
|
|
10286
10283
|
e?.deactivate(), a !== void 0 && window.clearTimeout(a), console.log = o.log, console.info = o.info, console.warn = o.warn, console.error = o.error;
|
|
10287
10284
|
}
|
|
10288
10285
|
}
|
|
10289
|
-
function
|
|
10286
|
+
function Sc(s, e) {
|
|
10290
10287
|
if (!s || typeof s != "object")
|
|
10291
10288
|
return;
|
|
10292
10289
|
const t = s.sandboxFilesToken;
|
|
@@ -10296,7 +10293,7 @@ function _c(s, e) {
|
|
|
10296
10293
|
const n = () => {
|
|
10297
10294
|
if (!i)
|
|
10298
10295
|
throw new Error("sandboxFiles is only available during browser-code execution");
|
|
10299
|
-
}, r = async (o, c) => await
|
|
10296
|
+
}, r = async (o, c) => await Ba(`${e.replace(/\/$/, "")}${o}`, c);
|
|
10300
10297
|
return {
|
|
10301
10298
|
value: Object.freeze({
|
|
10302
10299
|
upload: async (o) => {
|
|
@@ -10330,7 +10327,7 @@ function _c(s, e) {
|
|
|
10330
10327
|
}
|
|
10331
10328
|
};
|
|
10332
10329
|
}
|
|
10333
|
-
function
|
|
10330
|
+
function Rc(s) {
|
|
10334
10331
|
return {
|
|
10335
10332
|
ok: !1,
|
|
10336
10333
|
exception: {
|
|
@@ -10344,16 +10341,16 @@ function Sc(s) {
|
|
|
10344
10341
|
}
|
|
10345
10342
|
};
|
|
10346
10343
|
}
|
|
10347
|
-
function
|
|
10344
|
+
function Ac(s) {
|
|
10348
10345
|
return s.replace(/\/+$/, "");
|
|
10349
10346
|
}
|
|
10350
|
-
function
|
|
10347
|
+
function Ec(s) {
|
|
10351
10348
|
return s === "pluno" ? "scheduled_continuation" : s ?? "user";
|
|
10352
10349
|
}
|
|
10353
|
-
function
|
|
10350
|
+
function Xd(s, e = location.origin) {
|
|
10354
10351
|
return /origin (?:is not allowed|does not match browser origin)/i.test(s) ? `Pluno widget blocked on ${e}: this domain is not allowed. Add ${e} in Pluno under Integration > Domains.` : null;
|
|
10355
10352
|
}
|
|
10356
|
-
function
|
|
10353
|
+
function Tc(s) {
|
|
10357
10354
|
const e = new URL("/api/product-agent/embed/ws", s);
|
|
10358
10355
|
return e.protocol = e.protocol === "https:" ? "wss:" : "ws:", e.toString();
|
|
10359
10356
|
}
|
|
@@ -10366,19 +10363,19 @@ function Z() {
|
|
|
10366
10363
|
...s ? { plunoProductAgentUi: s } : {}
|
|
10367
10364
|
};
|
|
10368
10365
|
}
|
|
10369
|
-
function
|
|
10366
|
+
function kc() {
|
|
10370
10367
|
return {
|
|
10371
10368
|
pageUrl: location.href,
|
|
10372
10369
|
pageTitle: document.title,
|
|
10373
10370
|
htmlContent: js()
|
|
10374
10371
|
};
|
|
10375
10372
|
}
|
|
10376
|
-
function
|
|
10377
|
-
return ht.add(s), Ye || (Ye =
|
|
10373
|
+
function qc(s) {
|
|
10374
|
+
return ht.add(s), Ye || (Ye = Cc()), () => {
|
|
10378
10375
|
ht.delete(s), ht.size === 0 && (Ye?.(), Ye = null);
|
|
10379
10376
|
};
|
|
10380
10377
|
}
|
|
10381
|
-
function
|
|
10378
|
+
function Cc() {
|
|
10382
10379
|
const s = () => {
|
|
10383
10380
|
for (const r of Array.from(ht))
|
|
10384
10381
|
r();
|
|
@@ -10393,7 +10390,7 @@ function qc() {
|
|
|
10393
10390
|
window.history.pushState === i && (window.history.pushState = e), window.history.replaceState === n && (window.history.replaceState = t), window.removeEventListener("popstate", s), window.removeEventListener("hashchange", s);
|
|
10394
10391
|
};
|
|
10395
10392
|
}
|
|
10396
|
-
function
|
|
10393
|
+
function Mc() {
|
|
10397
10394
|
return kn()?.surface === "browser_extension_sdk_preview";
|
|
10398
10395
|
}
|
|
10399
10396
|
function js() {
|
|
@@ -10409,12 +10406,12 @@ function js() {
|
|
|
10409
10406
|
);
|
|
10410
10407
|
for (const m of n.slice(0, 3))
|
|
10411
10408
|
t("Active overlay", Xt(Be(m), e));
|
|
10412
|
-
const r =
|
|
10409
|
+
const r = Pc(), a = r ? Xt(Be(r), e) : "";
|
|
10413
10410
|
t("Main page content", a), t("Additional visible page text", Xt(Be(document.body), e));
|
|
10414
10411
|
const o = s.map(([m, y]) => `${m}:
|
|
10415
10412
|
${y}`).join(`
|
|
10416
10413
|
|
|
10417
|
-
`).trim().slice(0, 12e3), c =
|
|
10414
|
+
`).trim().slice(0, 12e3), c = Oc(n, r).trim(), d = `Simplified DOM outline:
|
|
10418
10415
|
`, l = `
|
|
10419
10416
|
|
|
10420
10417
|
Visible page text:
|
|
@@ -10442,10 +10439,10 @@ function An(s) {
|
|
|
10442
10439
|
const e = window.getComputedStyle(s);
|
|
10443
10440
|
return e.display !== "none" && e.visibility !== "hidden" && s.getClientRects().length > 0;
|
|
10444
10441
|
}
|
|
10445
|
-
function
|
|
10442
|
+
function Pc() {
|
|
10446
10443
|
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(An).sort((s, e) => Be(e).length - Be(s).length)[0] ?? null;
|
|
10447
10444
|
}
|
|
10448
|
-
function
|
|
10445
|
+
function Oc(s, e) {
|
|
10449
10446
|
const t = /* @__PURE__ */ new Set([
|
|
10450
10447
|
"main",
|
|
10451
10448
|
"nav",
|
|
@@ -10525,7 +10522,7 @@ function Pc(s, e) {
|
|
|
10525
10522
|
"data-test",
|
|
10526
10523
|
"data-qa",
|
|
10527
10524
|
"data-cy"
|
|
10528
|
-
], d = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: l, priorityTargets: u } =
|
|
10525
|
+
], d = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: l, priorityTargets: u } = xc(), h = new Set(s);
|
|
10529
10526
|
e && h.add(e);
|
|
10530
10527
|
let p = 0;
|
|
10531
10528
|
const f = (I) => {
|
|
@@ -10542,19 +10539,19 @@ function Pc(s, e) {
|
|
|
10542
10539
|
p += 1;
|
|
10543
10540
|
const q = f(M), A = Tn(M), v = o.has(q) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(B) || B === "a" && M.hasAttribute("href"), T = Array.from(M.children).filter((k) => k instanceof HTMLElement), O = /* @__PURE__ */ new Map();
|
|
10544
10541
|
for (const k of T) {
|
|
10545
|
-
const
|
|
10546
|
-
O.set(
|
|
10542
|
+
const N = m(k);
|
|
10543
|
+
O.set(N, (O.get(N) ?? 0) + 1);
|
|
10547
10544
|
}
|
|
10548
10545
|
const L = /* @__PURE__ */ new Map(), ke = /* @__PURE__ */ new Map();
|
|
10549
10546
|
for (const k of T) {
|
|
10550
|
-
const
|
|
10551
|
-
ke.set(
|
|
10547
|
+
const N = m(k), le = ke.get(N) ?? 0;
|
|
10548
|
+
ke.set(N, le + 1), (O.get(N) ?? 0) > 8 && le >= 6 && !l.has(k) && L.set(N, (L.get(N) ?? 0) + 1);
|
|
10552
10549
|
}
|
|
10553
10550
|
const Ke = /* @__PURE__ */ new Map(), zs = /* @__PURE__ */ new Set(), Rt = [], Hs = [];
|
|
10554
10551
|
for (const k of T) {
|
|
10555
|
-
const
|
|
10556
|
-
if (Ke.set(
|
|
10557
|
-
zs.has(
|
|
10552
|
+
const N = m(k), le = O.get(N) ?? 0, Vs = Ke.get(N) ?? 0;
|
|
10553
|
+
if (Ke.set(N, Vs + 1), le > 8 && Vs >= 6 && !l.has(k)) {
|
|
10554
|
+
zs.has(N) || (Rt.push([`… ${L.get(N) ?? 0} similar siblings omitted`]), zs.add(N));
|
|
10558
10555
|
continue;
|
|
10559
10556
|
}
|
|
10560
10557
|
const Gs = C(k, te);
|
|
@@ -10566,10 +10563,10 @@ function Pc(s, e) {
|
|
|
10566
10563
|
k instanceof HTMLElement && At.push(C(k, te + 1));
|
|
10567
10564
|
const We = [...Hs, ...At], Et = A.length > 0 || v || We.some((k) => k.hasUsefulContent), Ks = Ee(
|
|
10568
10565
|
[A, ...We.map((k) => k.textPreview)].filter(Boolean).join(" ")
|
|
10569
|
-
).slice(0, 180),
|
|
10566
|
+
).slice(0, 180), Kn = M.hasAttribute("contenteditable") && (A.length > 0 || !M.querySelector("[contenteditable]")), Ws = d.some((k) => M.hasAttribute(k)) || !!q || Kn, Tt = (M.getClientRects().length > 0 || V.display === "contents") && (t.has(B) || Ws || S) && (Et || S) && (!n.has(B) || Et || Ws || S), kt = Tt ? 1 : 0, qe = [];
|
|
10570
10567
|
if (Tt) {
|
|
10571
|
-
const k = We.some((le) => le.containsTextElement),
|
|
10572
|
-
qe.push(En(M, c, a,
|
|
10568
|
+
const k = We.some((le) => le.containsTextElement), N = i.has(B) && !k ? Ks : A;
|
|
10569
|
+
qe.push(En(M, c, a, N.slice(0, 180)));
|
|
10573
10570
|
}
|
|
10574
10571
|
for (const k of Rt)
|
|
10575
10572
|
qe.push(...Ze(k, kt));
|
|
@@ -10577,8 +10574,8 @@ function Pc(s, e) {
|
|
|
10577
10574
|
if (qt.length > 0) {
|
|
10578
10575
|
const k = qt.slice(0, 20);
|
|
10579
10576
|
qt.length > k.length && k.push("… shadow DOM omitted");
|
|
10580
|
-
const
|
|
10581
|
-
if (te < 2 && !
|
|
10577
|
+
const N = B.includes("tooltip") || B.includes("popper") || B.includes("loader");
|
|
10578
|
+
if (te < 2 && !N) {
|
|
10582
10579
|
const le = Tt ? "#shadow-root" : `${B} #shadow-root`;
|
|
10583
10580
|
qe.push(...Ze([le, ...Ze(k, 1)], kt));
|
|
10584
10581
|
} else
|
|
@@ -10595,7 +10592,7 @@ function Pc(s, e) {
|
|
|
10595
10592
|
`);
|
|
10596
10593
|
}, g = [], w = Ee(window.getSelection()?.toString() ?? "");
|
|
10597
10594
|
w && g.push(`--- selected text ---
|
|
10598
|
-
${JSON.stringify(w)}`), u.length > 0 && g.push(
|
|
10595
|
+
${JSON.stringify(w)}`), u.length > 0 && g.push(Dc(u, t, c, a));
|
|
10599
10596
|
for (const I of s.slice(0, 3))
|
|
10600
10597
|
g.push(y(I, "active overlay DOM", /* @__PURE__ */ new Set()));
|
|
10601
10598
|
if (e && g.push(y(e, "main DOM", /* @__PURE__ */ new Set())), document.body) {
|
|
@@ -10610,7 +10607,7 @@ function En(s, e, t, i) {
|
|
|
10610
10607
|
const n = s.tagName.toLowerCase();
|
|
10611
10608
|
let r = n;
|
|
10612
10609
|
const a = s.getAttribute("id");
|
|
10613
|
-
a &&
|
|
10610
|
+
a && Uc(a) && (r += `#${a}`);
|
|
10614
10611
|
for (const o of e) {
|
|
10615
10612
|
const c = s.getAttribute(o);
|
|
10616
10613
|
c && c.length <= 160 && (o !== "role" || !t.has(c)) && (r += `[${o}=${JSON.stringify(c)}]`);
|
|
@@ -10623,7 +10620,7 @@ function En(s, e, t, i) {
|
|
|
10623
10620
|
s.hasAttribute(o) && (r += `[${o}]`);
|
|
10624
10621
|
return `${r}${i ? ` ${JSON.stringify(i)}` : ""}`;
|
|
10625
10622
|
}
|
|
10626
|
-
function
|
|
10623
|
+
function xc() {
|
|
10627
10624
|
const s = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Map(), t = (o, c) => {
|
|
10628
10625
|
if (!o)
|
|
10629
10626
|
return;
|
|
@@ -10666,7 +10663,7 @@ function Oc() {
|
|
|
10666
10663
|
priorityTargets: Array.from(e, ([o, c]) => ({ element: o, labels: Array.from(c) }))
|
|
10667
10664
|
};
|
|
10668
10665
|
}
|
|
10669
|
-
function
|
|
10666
|
+
function Dc(s, e, t, i) {
|
|
10670
10667
|
const n = ["--- active/current elements ---"];
|
|
10671
10668
|
for (const r of s) {
|
|
10672
10669
|
const a = [];
|
|
@@ -10702,12 +10699,12 @@ function Tn(s) {
|
|
|
10702
10699
|
Array.from(s.childNodes).filter((e) => e.nodeType === Node.TEXT_NODE).map((e) => e.textContent ?? "").join(" ")
|
|
10703
10700
|
);
|
|
10704
10701
|
}
|
|
10705
|
-
function
|
|
10702
|
+
function Uc(s) {
|
|
10706
10703
|
return s.length <= 64 && /^[A-Za-z_][A-Za-z0-9_:.-]*$/.test(s) && !/[a-f0-9]{12,}/i.test(s) && !/:r[0-9a-z]+:/i.test(s);
|
|
10707
10704
|
}
|
|
10708
10705
|
function kn() {
|
|
10709
10706
|
const s = Array.from(document.querySelectorAll(Ai)), e = s.find(
|
|
10710
|
-
(r) => typeof r[
|
|
10707
|
+
(r) => typeof r[Fa] == "string"
|
|
10711
10708
|
);
|
|
10712
10709
|
if (!(e ?? s[0]))
|
|
10713
10710
|
return;
|
|
@@ -10723,23 +10720,23 @@ function kn() {
|
|
|
10723
10720
|
},
|
|
10724
10721
|
{
|
|
10725
10722
|
name: "widget_root",
|
|
10726
|
-
selector:
|
|
10723
|
+
selector: ja,
|
|
10727
10724
|
description: "Finds Pluno's widget root inside the widget host shadow root."
|
|
10728
10725
|
},
|
|
10729
10726
|
{
|
|
10730
10727
|
name: "widget_panel",
|
|
10731
|
-
selector:
|
|
10728
|
+
selector: La,
|
|
10732
10729
|
description: "Finds Pluno's open chat panel inside the widget host shadow root."
|
|
10733
10730
|
},
|
|
10734
10731
|
{
|
|
10735
10732
|
name: "widget_timeline",
|
|
10736
|
-
selector:
|
|
10733
|
+
selector: $a,
|
|
10737
10734
|
description: "Finds Pluno's chat timeline inside the widget host shadow root."
|
|
10738
10735
|
}
|
|
10739
10736
|
]
|
|
10740
10737
|
};
|
|
10741
10738
|
}
|
|
10742
|
-
function
|
|
10739
|
+
function Nc(s) {
|
|
10743
10740
|
if (s.runtimeContext !== void 0) {
|
|
10744
10741
|
if (!s.runtimeContext || typeof s.runtimeContext != "object" || Array.isArray(s.runtimeContext)) return !1;
|
|
10745
10742
|
const e = s.runtimeContext;
|
|
@@ -10753,7 +10750,7 @@ function Uc(s) {
|
|
|
10753
10750
|
return t === void 0 || typeof t == "number" && Number.isInteger(t) && t >= 0;
|
|
10754
10751
|
});
|
|
10755
10752
|
}
|
|
10756
|
-
function
|
|
10753
|
+
function qn(s) {
|
|
10757
10754
|
try {
|
|
10758
10755
|
const e = JSON.parse(s);
|
|
10759
10756
|
return e && typeof e == "object" ? e : { type: "error", message: "Invalid server event" };
|
|
@@ -10761,16 +10758,16 @@ function Pi(s) {
|
|
|
10761
10758
|
return { type: "error", message: "Invalid server event" };
|
|
10762
10759
|
}
|
|
10763
10760
|
}
|
|
10764
|
-
function
|
|
10761
|
+
function Pi(s, e) {
|
|
10765
10762
|
if (!s || typeof s != "object")
|
|
10766
10763
|
return [];
|
|
10767
10764
|
const t = s[e];
|
|
10768
10765
|
return Array.isArray(t) ? t.filter((i) => typeof i == "string" && i.trim().length > 0) : [];
|
|
10769
10766
|
}
|
|
10770
|
-
function
|
|
10767
|
+
function Bc(s) {
|
|
10771
10768
|
return Array.isArray(s) ? s.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
|
|
10772
10769
|
}
|
|
10773
|
-
function
|
|
10770
|
+
function jc(s) {
|
|
10774
10771
|
if (!s || typeof s != "object")
|
|
10775
10772
|
return null;
|
|
10776
10773
|
const e = s, t = e.appearance, i = t && typeof t == "object" ? t : e, n = typeof i.accentColor == "string" ? i.accentColor : null, r = i.colorScheme === "dark" ? "dark" : i.colorScheme === "light" ? "light" : null, a = typeof i.fontFamily == "string" && i.fontFamily.trim() ? i.fontFamily : null, o = typeof i.scribbleStyle == "boolean" ? i.scribbleStyle : null;
|
|
@@ -10781,13 +10778,13 @@ function Bc(s) {
|
|
|
10781
10778
|
...o !== null ? { scribbleStyle: o } : {}
|
|
10782
10779
|
};
|
|
10783
10780
|
}
|
|
10784
|
-
function
|
|
10781
|
+
function Lc(s) {
|
|
10785
10782
|
if (!s || typeof s != "object")
|
|
10786
10783
|
return null;
|
|
10787
10784
|
const e = s.javascript;
|
|
10788
10785
|
return typeof e != "string" || !e.trim() ? null : { javascript: e };
|
|
10789
10786
|
}
|
|
10790
|
-
function
|
|
10787
|
+
function $c(s, e) {
|
|
10791
10788
|
return e ? s && typeof s == "object" ? {
|
|
10792
10789
|
...s,
|
|
10793
10790
|
helperError: e
|
|
@@ -10797,13 +10794,13 @@ function Lc(s, e) {
|
|
|
10797
10794
|
helperError: e
|
|
10798
10795
|
} : s;
|
|
10799
10796
|
}
|
|
10800
|
-
function
|
|
10797
|
+
function Fc(s) {
|
|
10801
10798
|
if (!s || typeof s != "object")
|
|
10802
10799
|
return s;
|
|
10803
10800
|
const e = s;
|
|
10804
10801
|
return typeof e.exception?.message == "string" ? e.exception.message : typeof e.error == "string" ? e.error : s;
|
|
10805
10802
|
}
|
|
10806
|
-
function
|
|
10803
|
+
function zc() {
|
|
10807
10804
|
const s = "pluno.productAgent.clientId", e = window.localStorage.getItem(s);
|
|
10808
10805
|
if (e)
|
|
10809
10806
|
return e;
|
|
@@ -10813,7 +10810,7 @@ function Fc() {
|
|
|
10813
10810
|
function j() {
|
|
10814
10811
|
return crypto.randomUUID();
|
|
10815
10812
|
}
|
|
10816
|
-
function
|
|
10813
|
+
function Oi(s) {
|
|
10817
10814
|
if (!s || typeof s != "object")
|
|
10818
10815
|
return null;
|
|
10819
10816
|
const e = s, t = typeof e.id == "string" ? e.id : null;
|
|
@@ -10824,19 +10821,19 @@ function xi(s) {
|
|
|
10824
10821
|
avatarUrl: typeof e.avatarUrl == "string" ? e.avatarUrl : null
|
|
10825
10822
|
} : null;
|
|
10826
10823
|
}
|
|
10827
|
-
function
|
|
10828
|
-
return Array.isArray(s) ?
|
|
10829
|
-
s.map((t) =>
|
|
10824
|
+
function Yd(s, e) {
|
|
10825
|
+
return Array.isArray(s) ? Jc(
|
|
10826
|
+
s.map((t) => Cn(t, e)).filter((t) => t !== null)
|
|
10830
10827
|
) : [];
|
|
10831
10828
|
}
|
|
10832
|
-
function
|
|
10829
|
+
function Cn(s, e) {
|
|
10833
10830
|
if (!s || typeof s != "object")
|
|
10834
10831
|
return null;
|
|
10835
10832
|
const t = s, i = t.data;
|
|
10836
10833
|
if (!i || typeof i != "object")
|
|
10837
10834
|
return null;
|
|
10838
10835
|
const n = i;
|
|
10839
|
-
if (n.hiddenFromTranscript === !0 ||
|
|
10836
|
+
if (n.hiddenFromTranscript === !0 || ha(n) || n.type === "tab_lifecycle_decision" && n.decision === "keep")
|
|
10840
10837
|
return null;
|
|
10841
10838
|
if (n.type === "assistant_draft")
|
|
10842
10839
|
return {
|
|
@@ -10844,7 +10841,7 @@ function qn(s, e) {
|
|
|
10844
10841
|
role: "assistant",
|
|
10845
10842
|
...n.phase === "commentary" || n.phase === "final_answer" ? { phase: n.phase } : {},
|
|
10846
10843
|
content: Se(
|
|
10847
|
-
|
|
10844
|
+
xi(n.content),
|
|
10848
10845
|
e
|
|
10849
10846
|
),
|
|
10850
10847
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -10861,7 +10858,7 @@ function qn(s, e) {
|
|
|
10861
10858
|
role: r,
|
|
10862
10859
|
...n.phase === "commentary" || n.phase === "final_answer" ? { phase: n.phase } : {},
|
|
10863
10860
|
content: Se(
|
|
10864
|
-
|
|
10861
|
+
xi(n.content),
|
|
10865
10862
|
e
|
|
10866
10863
|
),
|
|
10867
10864
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -10869,7 +10866,7 @@ function qn(s, e) {
|
|
|
10869
10866
|
...G(n) !== null ? { causalSequence: G(n) } : {},
|
|
10870
10867
|
respondsToUserMessageId: ue(n) ?? void 0,
|
|
10871
10868
|
...z(n) ? { runId: z(n) } : {},
|
|
10872
|
-
attachments:
|
|
10869
|
+
attachments: Pn(n.attachments, e),
|
|
10873
10870
|
...n.steered === !0 ? { steered: !0 } : {}
|
|
10874
10871
|
};
|
|
10875
10872
|
return r === "assistant" && typeof n.id == "string" && Object.defineProperty(a, "assistantDraftItemId", {
|
|
@@ -10884,7 +10881,7 @@ function qn(s, e) {
|
|
|
10884
10881
|
}), a;
|
|
10885
10882
|
}
|
|
10886
10883
|
if (n.type === "function_call_output") {
|
|
10887
|
-
const r =
|
|
10884
|
+
const r = ca(n.output);
|
|
10888
10885
|
if (r !== null)
|
|
10889
10886
|
return {
|
|
10890
10887
|
id: String(t.id ?? crypto.randomUUID()),
|
|
@@ -10899,7 +10896,7 @@ function qn(s, e) {
|
|
|
10899
10896
|
callId: xe(n) ?? void 0,
|
|
10900
10897
|
sharePromptAllowed: r
|
|
10901
10898
|
};
|
|
10902
|
-
const a =
|
|
10899
|
+
const a = _a(n.output);
|
|
10903
10900
|
if (a)
|
|
10904
10901
|
return {
|
|
10905
10902
|
id: String(t.id ?? crypto.randomUUID()),
|
|
@@ -10915,7 +10912,7 @@ function qn(s, e) {
|
|
|
10915
10912
|
scheduledCheckInId: a.id ?? void 0,
|
|
10916
10913
|
scheduledCheckInAt: a.dueAt
|
|
10917
10914
|
};
|
|
10918
|
-
const o =
|
|
10915
|
+
const o = Kc(n.output), c = Wc(n.output);
|
|
10919
10916
|
return o ? {
|
|
10920
10917
|
id: String(t.id ?? crypto.randomUUID()),
|
|
10921
10918
|
role: "tool",
|
|
@@ -10947,7 +10944,7 @@ function qn(s, e) {
|
|
|
10947
10944
|
return n.type === "function_call" || n.type === "tool_call" || n.type === "web_search_call" || n.type === "mcp_call" || n.type === "tab_lifecycle_decision" ? {
|
|
10948
10945
|
id: String(t.id ?? crypto.randomUUID()),
|
|
10949
10946
|
role: "tool",
|
|
10950
|
-
content: n.type === "mcp_call" ?
|
|
10947
|
+
content: n.type === "mcp_call" ? Hc(n) : Gc(n),
|
|
10951
10948
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
10952
10949
|
...F(n) !== null ? { displaySequence: F(n) } : {},
|
|
10953
10950
|
...G(n) !== null ? { causalSequence: G(n) } : {},
|
|
@@ -10961,7 +10958,7 @@ function qn(s, e) {
|
|
|
10961
10958
|
} : n.type === "run_status" || n.type === "run_error" ? n.type === "run_error" && n.stage === "tool_execution" ? null : {
|
|
10962
10959
|
id: String(t.id ?? crypto.randomUUID()),
|
|
10963
10960
|
role: "system",
|
|
10964
|
-
content:
|
|
10961
|
+
content: Vc(n),
|
|
10965
10962
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
10966
10963
|
...F(n) !== null ? { displaySequence: F(n) } : {},
|
|
10967
10964
|
...G(n) !== null ? { causalSequence: G(n) } : {},
|
|
@@ -10974,11 +10971,11 @@ function qn(s, e) {
|
|
|
10974
10971
|
...typeof n.securitySettingsUrl == "string" ? { securitySettingsUrl: n.securitySettingsUrl } : {}
|
|
10975
10972
|
} : null;
|
|
10976
10973
|
}
|
|
10977
|
-
function
|
|
10974
|
+
function Hc(s) {
|
|
10978
10975
|
const t = (typeof s.server_label == "string" ? s.server_label : "").replace(/^pipedream_/, "").split(/[_-]+/).filter(Boolean).map((i) => `${i.charAt(0).toUpperCase()}${i.slice(1)}`).join(" ");
|
|
10979
10976
|
return t ? `🔌 Using ${t}` : "🔌 Using connected integration";
|
|
10980
10977
|
}
|
|
10981
|
-
function
|
|
10978
|
+
function Kc(s) {
|
|
10982
10979
|
if (typeof s != "string")
|
|
10983
10980
|
return null;
|
|
10984
10981
|
try {
|
|
@@ -10995,7 +10992,7 @@ function Hc(s) {
|
|
|
10995
10992
|
return null;
|
|
10996
10993
|
}
|
|
10997
10994
|
}
|
|
10998
|
-
function
|
|
10995
|
+
function Wc(s) {
|
|
10999
10996
|
if (typeof s != "string")
|
|
11000
10997
|
return null;
|
|
11001
10998
|
try {
|
|
@@ -11010,10 +11007,10 @@ function Kc(s) {
|
|
|
11010
11007
|
return null;
|
|
11011
11008
|
}
|
|
11012
11009
|
}
|
|
11013
|
-
function
|
|
11010
|
+
function Vc(s) {
|
|
11014
11011
|
return s.type === "run_status" && s.status === "steered" ? "Steered" : typeof s.message == "string" && s.message.trim().length > 0 ? s.message : "";
|
|
11015
11012
|
}
|
|
11016
|
-
function
|
|
11013
|
+
function Gc(s) {
|
|
11017
11014
|
if (s.type === "web_search_call") {
|
|
11018
11015
|
const e = s.action;
|
|
11019
11016
|
if (e && typeof e == "object") {
|
|
@@ -11025,9 +11022,9 @@ function Vc(s) {
|
|
|
11025
11022
|
}
|
|
11026
11023
|
return "🔎 Searching the web";
|
|
11027
11024
|
}
|
|
11028
|
-
return
|
|
11025
|
+
return Qc(s);
|
|
11029
11026
|
}
|
|
11030
|
-
function
|
|
11027
|
+
function Qc(s) {
|
|
11031
11028
|
if (typeof s.summary == "string" && s.summary.trim().length > 0)
|
|
11032
11029
|
return Ne(s.summary);
|
|
11033
11030
|
if (typeof s.arguments == "string")
|
|
@@ -11054,7 +11051,7 @@ function G(s) {
|
|
|
11054
11051
|
function F(s) {
|
|
11055
11052
|
return typeof s.displaySequence == "number" && Number.isSafeInteger(s.displaySequence) ? s.displaySequence : null;
|
|
11056
11053
|
}
|
|
11057
|
-
function
|
|
11054
|
+
function xi(s) {
|
|
11058
11055
|
return typeof s == "string" ? s : Array.isArray(s) ? s.map((e) => {
|
|
11059
11056
|
if (!e || typeof e != "object")
|
|
11060
11057
|
return "";
|
|
@@ -11062,25 +11059,25 @@ function Di(s) {
|
|
|
11062
11059
|
return typeof t.text == "string" ? t.text : typeof t.content == "string" ? t.content : "";
|
|
11063
11060
|
}).filter(Boolean).join("") : "";
|
|
11064
11061
|
}
|
|
11065
|
-
function Qc(s) {
|
|
11066
|
-
return s.filter((e, t) => Ls(e) ? !id(s, t) && !Xc(s, t) && !td(s, t) && !sd(s, t) : Jc(e) ? e.retryable === !0 && ed(s, t) ? !1 : !Zc(s, t) : !0);
|
|
11067
|
-
}
|
|
11068
11062
|
function Jc(s) {
|
|
11063
|
+
return s.filter((e, t) => Ls(e) ? !nd(s, t) && !Yc(s, t) && !sd(s, t) && !id(s, t) : Xc(e) ? e.retryable === !0 && td(s, t) ? !1 : !ed(s, t) : !0);
|
|
11064
|
+
}
|
|
11065
|
+
function Xc(s) {
|
|
11069
11066
|
return s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.steered !== !0);
|
|
11070
11067
|
}
|
|
11071
11068
|
function Ls(s) {
|
|
11072
11069
|
return s.role === "system" && s.dataType === "run_status" && s.loading === !0;
|
|
11073
11070
|
}
|
|
11074
|
-
function
|
|
11071
|
+
function Yc(s, e) {
|
|
11075
11072
|
return s.some(
|
|
11076
|
-
(t, i) => i !== e && t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0 && t.steered !== !0) &&
|
|
11073
|
+
(t, i) => i !== e && t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0 && t.steered !== !0) && Zc(
|
|
11077
11074
|
s,
|
|
11078
11075
|
e,
|
|
11079
11076
|
i
|
|
11080
11077
|
)
|
|
11081
11078
|
);
|
|
11082
11079
|
}
|
|
11083
|
-
function
|
|
11080
|
+
function Zc(s, e, t) {
|
|
11084
11081
|
const i = s[e], n = s[t];
|
|
11085
11082
|
if (He(i, n))
|
|
11086
11083
|
return !0;
|
|
@@ -11091,7 +11088,7 @@ function Yc(s, e, t) {
|
|
|
11091
11088
|
return s[r].id === i.respondsToUserMessageId;
|
|
11092
11089
|
return !1;
|
|
11093
11090
|
}
|
|
11094
|
-
function
|
|
11091
|
+
function ed(s, e) {
|
|
11095
11092
|
const t = s[e];
|
|
11096
11093
|
for (let i = e + 1; i < s.length; i += 1) {
|
|
11097
11094
|
const n = s[i];
|
|
@@ -11100,7 +11097,7 @@ function Zc(s, e) {
|
|
|
11100
11097
|
}
|
|
11101
11098
|
return !1;
|
|
11102
11099
|
}
|
|
11103
|
-
function
|
|
11100
|
+
function td(s, e) {
|
|
11104
11101
|
const t = s[e];
|
|
11105
11102
|
if (!t.respondsToUserMessageId)
|
|
11106
11103
|
return !1;
|
|
@@ -11113,19 +11110,19 @@ function ed(s, e) {
|
|
|
11113
11110
|
}
|
|
11114
11111
|
return !1;
|
|
11115
11112
|
}
|
|
11116
|
-
function
|
|
11113
|
+
function sd(s, e) {
|
|
11117
11114
|
const t = s[e];
|
|
11118
11115
|
return s.some(
|
|
11119
11116
|
(i, n) => n !== e && i.role === "assistant" && He(t, i)
|
|
11120
11117
|
);
|
|
11121
11118
|
}
|
|
11122
|
-
function
|
|
11119
|
+
function id(s, e) {
|
|
11123
11120
|
const t = s[e];
|
|
11124
11121
|
return s.some(
|
|
11125
11122
|
(i, n) => n !== e && i.role === "tool" && He(t, i)
|
|
11126
11123
|
);
|
|
11127
11124
|
}
|
|
11128
|
-
function
|
|
11125
|
+
function nd(s, e) {
|
|
11129
11126
|
const t = s[e];
|
|
11130
11127
|
for (let i = e + 1; i < s.length; i += 1)
|
|
11131
11128
|
if (Ls(s[i]) && He(t, s[i]))
|
|
@@ -11138,15 +11135,15 @@ function He(s, e) {
|
|
|
11138
11135
|
function Yt(s, e) {
|
|
11139
11136
|
return s && typeof s == "object" && typeof s[e] == "string" ? s[e] : null;
|
|
11140
11137
|
}
|
|
11141
|
-
function
|
|
11138
|
+
function rd(s, e) {
|
|
11142
11139
|
try {
|
|
11143
|
-
const t = window.localStorage.getItem(`${
|
|
11140
|
+
const t = window.localStorage.getItem(`${rc}${s}`);
|
|
11144
11141
|
if (!t)
|
|
11145
11142
|
return null;
|
|
11146
11143
|
const i = JSON.parse(t), n = typeof i.sessionId == "string" ? i.sessionId : null;
|
|
11147
11144
|
if (e !== void 0 && n !== e)
|
|
11148
11145
|
return null;
|
|
11149
|
-
const r = Array.isArray(i.messages) ? i.messages.map(
|
|
11146
|
+
const r = Array.isArray(i.messages) ? i.messages.map(md).filter((a) => !!a) : [];
|
|
11150
11147
|
return {
|
|
11151
11148
|
sessionId: n,
|
|
11152
11149
|
messages: r
|
|
@@ -11155,7 +11152,7 @@ function nd(s, e) {
|
|
|
11155
11152
|
return null;
|
|
11156
11153
|
}
|
|
11157
11154
|
}
|
|
11158
|
-
function
|
|
11155
|
+
function od(s) {
|
|
11159
11156
|
try {
|
|
11160
11157
|
const e = window.localStorage.getItem(`${ws}${s}`);
|
|
11161
11158
|
if (!e)
|
|
@@ -11181,7 +11178,7 @@ function ge(s, e) {
|
|
|
11181
11178
|
return;
|
|
11182
11179
|
}
|
|
11183
11180
|
}
|
|
11184
|
-
function
|
|
11181
|
+
function Mn(s, e) {
|
|
11185
11182
|
try {
|
|
11186
11183
|
const t = `${wt}${s}`, i = location.href, n = location.origin, r = Array.from(e, (a) => ({
|
|
11187
11184
|
...a,
|
|
@@ -11197,28 +11194,28 @@ function Cn(s, e) {
|
|
|
11197
11194
|
} catch {
|
|
11198
11195
|
}
|
|
11199
11196
|
}
|
|
11200
|
-
function
|
|
11197
|
+
function Di(s, e) {
|
|
11201
11198
|
try {
|
|
11202
11199
|
if (window.sessionStorage.getItem(`${wt}${s}`) === null)
|
|
11203
11200
|
return;
|
|
11204
11201
|
} catch {
|
|
11205
11202
|
return;
|
|
11206
11203
|
}
|
|
11207
|
-
|
|
11204
|
+
Mn(s, e);
|
|
11208
11205
|
}
|
|
11209
|
-
function
|
|
11206
|
+
function ad(s) {
|
|
11210
11207
|
try {
|
|
11211
11208
|
const e = `${wt}${s}`, t = window.sessionStorage.getItem(e);
|
|
11212
11209
|
if (window.sessionStorage.removeItem(e), !t)
|
|
11213
11210
|
return [];
|
|
11214
11211
|
const i = JSON.parse(t);
|
|
11215
|
-
return Array.isArray(i) ? i.flatMap((n) =>
|
|
11212
|
+
return Array.isArray(i) ? i.flatMap((n) => dd(n) ? [{
|
|
11216
11213
|
...n.event,
|
|
11217
11214
|
page: Z(),
|
|
11218
11215
|
rawOutput: {
|
|
11219
11216
|
pageContextRestarted: !0,
|
|
11220
11217
|
outcome: "unknown",
|
|
11221
|
-
message:
|
|
11218
|
+
message: cd(location.href),
|
|
11222
11219
|
currentUrl: location.href,
|
|
11223
11220
|
console: [],
|
|
11224
11221
|
metadata: {
|
|
@@ -11235,17 +11232,17 @@ function od(s) {
|
|
|
11235
11232
|
return [];
|
|
11236
11233
|
}
|
|
11237
11234
|
}
|
|
11238
|
-
function
|
|
11235
|
+
function cd(s) {
|
|
11239
11236
|
return `The page context restarted. This is expected when the action included page navigation. Otherwise, it's unknown whether the action completed.
|
|
11240
11237
|
Current URL: ${s}`;
|
|
11241
11238
|
}
|
|
11242
|
-
function
|
|
11239
|
+
function dd(s) {
|
|
11243
11240
|
if (!s || typeof s != "object")
|
|
11244
11241
|
return !1;
|
|
11245
11242
|
const e = s, t = e.event;
|
|
11246
11243
|
return typeof e.startedAtMs == "number" && typeof e.startedAtUrl == "string" && e.startedAtOrigin === location.origin && e.unloadOrigin === location.origin && typeof e.unloadUrl == "string" && $s(t) && t.type === "tool.result";
|
|
11247
11244
|
}
|
|
11248
|
-
function
|
|
11245
|
+
function ld(s, e) {
|
|
11249
11246
|
const t = new Set(
|
|
11250
11247
|
s.flatMap((i) => i.type === "tool.result" ? [i.callId] : [])
|
|
11251
11248
|
);
|
|
@@ -11254,7 +11251,7 @@ function dd(s, e) {
|
|
|
11254
11251
|
...e.filter((i) => !t.has(i.callId))
|
|
11255
11252
|
];
|
|
11256
11253
|
}
|
|
11257
|
-
function
|
|
11254
|
+
function ud(s) {
|
|
11258
11255
|
try {
|
|
11259
11256
|
window.sessionStorage.removeItem(`${wt}${s}`);
|
|
11260
11257
|
} catch {
|
|
@@ -11265,15 +11262,15 @@ function $s(s) {
|
|
|
11265
11262
|
if (!s || typeof s != "object")
|
|
11266
11263
|
return !1;
|
|
11267
11264
|
const e = s;
|
|
11268
|
-
return e.type === "chat.user_message" ? typeof e.content == "string" &&
|
|
11265
|
+
return e.type === "chat.user_message" ? typeof e.content == "string" && Ui(e.page) : e.type === "page.upsert" || e.type === "session.reset" || e.type === "network.batch" ? Ui(e.page) : e.type === "tool.result" ? typeof e.sessionId == "string" && typeof e.callId == "string" && (e.toolName === "execute_code" || e.toolName === "execute_code_in_browser_tab") : e.type === "chat.retry_last_user_message" ? typeof e.sessionId == "string" && typeof e.clientMessageId == "string" : e.type === "run.stop" ? typeof e.sessionId == "string" && (e.reason === "user_requested" || e.reason === "new_chat" || e.reason === "session_switch") : !1;
|
|
11269
11266
|
}
|
|
11270
|
-
function
|
|
11267
|
+
function Ui(s) {
|
|
11271
11268
|
if (!s || typeof s != "object")
|
|
11272
11269
|
return !1;
|
|
11273
11270
|
const e = s;
|
|
11274
11271
|
return typeof e.url == "string" && typeof e.title == "string" && typeof e.origin == "string";
|
|
11275
11272
|
}
|
|
11276
|
-
function
|
|
11273
|
+
function Pn(s, e) {
|
|
11277
11274
|
if (!Array.isArray(s))
|
|
11278
11275
|
return;
|
|
11279
11276
|
const t = s.filter((n) => {
|
|
@@ -11281,41 +11278,41 @@ function Mn(s, e) {
|
|
|
11281
11278
|
return !1;
|
|
11282
11279
|
const r = n;
|
|
11283
11280
|
return typeof r.name == "string" && typeof r.mimeType == "string" && typeof r.sizeBytes == "number";
|
|
11284
|
-
}), i = e ? t.map((n) =>
|
|
11281
|
+
}), i = e ? t.map((n) => On(n, e)) : t;
|
|
11285
11282
|
return i.length > 0 ? i : void 0;
|
|
11286
11283
|
}
|
|
11287
|
-
function
|
|
11284
|
+
function On(s, e) {
|
|
11288
11285
|
return s.fileUrl?.startsWith("/") ? {
|
|
11289
11286
|
...s,
|
|
11290
11287
|
fileUrl: new URL(s.fileUrl, e).toString()
|
|
11291
11288
|
} : s;
|
|
11292
11289
|
}
|
|
11293
|
-
function
|
|
11294
|
-
return s.type ||
|
|
11290
|
+
function xn(s) {
|
|
11291
|
+
return s.type || fd(s.name) || "application/octet-stream";
|
|
11295
11292
|
}
|
|
11296
|
-
function
|
|
11297
|
-
|
|
11293
|
+
function hd(s) {
|
|
11294
|
+
Dn({
|
|
11298
11295
|
name: s.name,
|
|
11299
|
-
mimeType:
|
|
11296
|
+
mimeType: xn(s),
|
|
11300
11297
|
sizeBytes: s.size
|
|
11301
11298
|
});
|
|
11302
11299
|
}
|
|
11303
|
-
function
|
|
11304
|
-
const e =
|
|
11305
|
-
if (!
|
|
11300
|
+
function Dn(s) {
|
|
11301
|
+
const e = pd(s.name), t = s.mimeType.trim().toLowerCase();
|
|
11302
|
+
if (!sc.has(`${e}:${t}`))
|
|
11306
11303
|
throw new Error("This attachment type is not supported by the embedded model provider");
|
|
11307
11304
|
if (s.sizeBytes <= 0 || s.sizeBytes >= Sn)
|
|
11308
11305
|
throw new Error("Embedded attachments must be between 1 byte and less than 50 MB");
|
|
11309
11306
|
}
|
|
11310
|
-
function
|
|
11307
|
+
function pd(s) {
|
|
11311
11308
|
const e = s.trim().toLowerCase(), t = e.lastIndexOf(".");
|
|
11312
11309
|
return t >= 0 ? e.slice(t) : "";
|
|
11313
11310
|
}
|
|
11314
|
-
function
|
|
11311
|
+
function fd(s) {
|
|
11315
11312
|
const e = s.toLowerCase();
|
|
11316
11313
|
return e.endsWith(".png") ? "image/png" : e.endsWith(".jpg") || e.endsWith(".jpeg") ? "image/jpeg" : e.endsWith(".webp") ? "image/webp" : e.endsWith(".gif") ? "image/gif" : e.endsWith(".pdf") ? "application/pdf" : null;
|
|
11317
11314
|
}
|
|
11318
|
-
function
|
|
11315
|
+
function md(s) {
|
|
11319
11316
|
if (!s || typeof s != "object")
|
|
11320
11317
|
return null;
|
|
11321
11318
|
const e = s;
|
|
@@ -11333,11 +11330,11 @@ function fd(s) {
|
|
|
11333
11330
|
scheduledCheckInId: typeof e.scheduledCheckInId == "string" ? e.scheduledCheckInId : void 0,
|
|
11334
11331
|
scheduledCheckInAt: typeof e.scheduledCheckInAt == "string" ? e.scheduledCheckInAt : void 0,
|
|
11335
11332
|
securitySettingsUrl: typeof e.securitySettingsUrl == "string" ? e.securitySettingsUrl : void 0,
|
|
11336
|
-
attachments:
|
|
11333
|
+
attachments: Pn(e.attachments)?.map(gd),
|
|
11337
11334
|
loading: typeof e.loading == "boolean" ? e.loading : void 0
|
|
11338
11335
|
};
|
|
11339
11336
|
}
|
|
11340
|
-
function
|
|
11337
|
+
function gd(s) {
|
|
11341
11338
|
const {
|
|
11342
11339
|
dataUrl: e,
|
|
11343
11340
|
objectUrl: t,
|
|
@@ -11355,11 +11352,11 @@ function z(s) {
|
|
|
11355
11352
|
const e = s.runId;
|
|
11356
11353
|
return typeof e == "string" && e ? e : null;
|
|
11357
11354
|
}
|
|
11358
|
-
function
|
|
11355
|
+
function yd(s) {
|
|
11359
11356
|
const e = s?.timeoutMs;
|
|
11360
|
-
return !!s && typeof s == "object" && typeof s.summary == "string" && typeof s.javascript == "string" && (e === void 0 || typeof e == "number" && Number.isInteger(e) && e > 0 && e <=
|
|
11357
|
+
return !!s && typeof s == "object" && typeof s.summary == "string" && typeof s.javascript == "string" && (e === void 0 || typeof e == "number" && Number.isInteger(e) && e > 0 && e <= hc);
|
|
11361
11358
|
}
|
|
11362
|
-
function
|
|
11359
|
+
function Un(s) {
|
|
11363
11360
|
const e = {};
|
|
11364
11361
|
try {
|
|
11365
11362
|
new Headers(s).forEach((t, i) => {
|
|
@@ -11371,23 +11368,23 @@ function Dn(s) {
|
|
|
11371
11368
|
return e;
|
|
11372
11369
|
}
|
|
11373
11370
|
function Fs(s, e) {
|
|
11374
|
-
return
|
|
11371
|
+
return zn(s) ? St : ae(gt(e), ic);
|
|
11375
11372
|
}
|
|
11376
|
-
function
|
|
11373
|
+
function vd(s, e) {
|
|
11377
11374
|
return typeof s == "string" ? s : s instanceof URL ? s.toString() : e?.url ?? "";
|
|
11378
11375
|
}
|
|
11379
|
-
async function
|
|
11380
|
-
const n =
|
|
11376
|
+
async function Id(s, e, t, i) {
|
|
11377
|
+
const n = Un(s.headers);
|
|
11381
11378
|
i({
|
|
11382
11379
|
...e,
|
|
11383
11380
|
responseStatus: s.status,
|
|
11384
11381
|
responseHeaders: n,
|
|
11385
|
-
responseBody: await
|
|
11382
|
+
responseBody: await bd(s),
|
|
11386
11383
|
durationMs: Date.now() - t
|
|
11387
11384
|
});
|
|
11388
11385
|
}
|
|
11389
|
-
async function
|
|
11390
|
-
if (!
|
|
11386
|
+
async function bd(s) {
|
|
11387
|
+
if (!Nn(s.headers))
|
|
11391
11388
|
return;
|
|
11392
11389
|
let e = null, t = null;
|
|
11393
11390
|
try {
|
|
@@ -11396,7 +11393,7 @@ async function Id(s) {
|
|
|
11396
11393
|
const i = new Promise((o) => {
|
|
11397
11394
|
t = window.setTimeout(() => {
|
|
11398
11395
|
e?.cancel(), o("timeout");
|
|
11399
|
-
},
|
|
11396
|
+
}, nc);
|
|
11400
11397
|
}), n = new TextDecoder();
|
|
11401
11398
|
let r = "", a = 0;
|
|
11402
11399
|
for (; ; ) {
|
|
@@ -11418,26 +11415,26 @@ async function Id(s) {
|
|
|
11418
11415
|
t !== null && window.clearTimeout(t);
|
|
11419
11416
|
}
|
|
11420
11417
|
}
|
|
11421
|
-
function
|
|
11422
|
-
if (
|
|
11418
|
+
function wd(s, e) {
|
|
11419
|
+
if (Nn(new Headers(e)))
|
|
11423
11420
|
try {
|
|
11424
11421
|
return s.responseType === "" || s.responseType === "text" ? ae(s.responseText ?? "") : void 0;
|
|
11425
11422
|
} catch {
|
|
11426
11423
|
return;
|
|
11427
11424
|
}
|
|
11428
11425
|
}
|
|
11429
|
-
function
|
|
11426
|
+
function Ni(s) {
|
|
11430
11427
|
if (typeof s == "string")
|
|
11431
11428
|
return ae(s);
|
|
11432
11429
|
}
|
|
11433
|
-
function
|
|
11430
|
+
function _d(s) {
|
|
11434
11431
|
return Q({
|
|
11435
11432
|
...s,
|
|
11436
|
-
requestBody:
|
|
11437
|
-
responseBody:
|
|
11433
|
+
requestBody: Bi(s.requestBody),
|
|
11434
|
+
responseBody: Bi(s.responseBody)
|
|
11438
11435
|
});
|
|
11439
11436
|
}
|
|
11440
|
-
function
|
|
11437
|
+
function Bi(s) {
|
|
11441
11438
|
if (typeof s != "string")
|
|
11442
11439
|
return s;
|
|
11443
11440
|
const e = s.trim();
|
|
@@ -11449,14 +11446,14 @@ function ji(s) {
|
|
|
11449
11446
|
return gt(s);
|
|
11450
11447
|
}
|
|
11451
11448
|
}
|
|
11452
|
-
function
|
|
11449
|
+
function Nn(s) {
|
|
11453
11450
|
if (!s)
|
|
11454
11451
|
return !1;
|
|
11455
11452
|
const e = s.get("content-type")?.toLowerCase() ?? "", t = s.get("content-length"), i = Number(t);
|
|
11456
11453
|
return t !== null && Number.isInteger(i) && i >= 0 && i <= Ns && (e.startsWith("text/") || e.includes("json") || e.includes("javascript"));
|
|
11457
11454
|
}
|
|
11458
11455
|
function _e(s, e = {}, t) {
|
|
11459
|
-
if (
|
|
11456
|
+
if (Rd(t))
|
|
11460
11457
|
return !0;
|
|
11461
11458
|
const i = Object.entries(e).find(([n]) => n.toLowerCase() === "content-type")?.[1]?.toLowerCase();
|
|
11462
11459
|
if (i?.includes("multipart/form-data") || i?.includes("application/octet-stream"))
|
|
@@ -11471,7 +11468,7 @@ function _e(s, e = {}, t) {
|
|
|
11471
11468
|
return !0;
|
|
11472
11469
|
}
|
|
11473
11470
|
}
|
|
11474
|
-
function
|
|
11471
|
+
function Sd(s, e) {
|
|
11475
11472
|
if (_e(s))
|
|
11476
11473
|
return !0;
|
|
11477
11474
|
try {
|
|
@@ -11481,10 +11478,10 @@ function _d(s, e) {
|
|
|
11481
11478
|
return !0;
|
|
11482
11479
|
}
|
|
11483
11480
|
}
|
|
11484
|
-
function
|
|
11481
|
+
function Rd(s) {
|
|
11485
11482
|
return s instanceof FormData || s instanceof Blob || s instanceof ArrayBuffer || ArrayBuffer.isView(s) || typeof ReadableStream < "u" && s instanceof ReadableStream;
|
|
11486
11483
|
}
|
|
11487
|
-
function
|
|
11484
|
+
function Ad(s) {
|
|
11488
11485
|
const e = {};
|
|
11489
11486
|
for (const t of s.trim().split(/[\r\n]+/)) {
|
|
11490
11487
|
const i = t.indexOf(":");
|
|
@@ -11503,40 +11500,40 @@ function ae(s, e = Ns) {
|
|
|
11503
11500
|
function Zt(s) {
|
|
11504
11501
|
return `${s}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
11505
11502
|
}
|
|
11506
|
-
class
|
|
11503
|
+
class Bn extends Error {
|
|
11507
11504
|
constructor(e, t) {
|
|
11508
11505
|
super(`${e} (${t})`), this.status = t, this.name = "AttachmentUploadHttpError", this.code = String(t);
|
|
11509
11506
|
}
|
|
11510
11507
|
status;
|
|
11511
11508
|
code;
|
|
11512
11509
|
}
|
|
11513
|
-
async function
|
|
11510
|
+
async function Ed(s, e) {
|
|
11514
11511
|
let t = null;
|
|
11515
11512
|
for (let i = 0; i < ki; i += 1)
|
|
11516
11513
|
try {
|
|
11517
11514
|
return await s();
|
|
11518
11515
|
} catch (n) {
|
|
11519
|
-
if (t = n, i >= ki - 1 || !
|
|
11516
|
+
if (t = n, i >= ki - 1 || !kd(n))
|
|
11520
11517
|
throw n;
|
|
11521
|
-
await
|
|
11518
|
+
await Td(i);
|
|
11522
11519
|
}
|
|
11523
11520
|
throw t instanceof Error ? t : new Error(e);
|
|
11524
11521
|
}
|
|
11525
|
-
function
|
|
11522
|
+
function Td(s) {
|
|
11526
11523
|
return new Promise((e) => {
|
|
11527
|
-
window.setTimeout(e,
|
|
11524
|
+
window.setTimeout(e, tc[s] ?? 0);
|
|
11528
11525
|
});
|
|
11529
11526
|
}
|
|
11530
|
-
function Td(s) {
|
|
11531
|
-
return s instanceof Nn ? kd(s.status) : s instanceof TypeError;
|
|
11532
|
-
}
|
|
11533
11527
|
function kd(s) {
|
|
11534
|
-
return s
|
|
11528
|
+
return s instanceof Bn ? qd(s.status) : s instanceof TypeError;
|
|
11535
11529
|
}
|
|
11536
11530
|
function qd(s) {
|
|
11531
|
+
return s === 408 || s === 409 || s === 429 || s >= 500;
|
|
11532
|
+
}
|
|
11533
|
+
function Cd(s) {
|
|
11537
11534
|
return s === 401 || s === 403;
|
|
11538
11535
|
}
|
|
11539
|
-
const St = "[REDACTED_SECRET]", ce = "[REDACTED_TOKEN]",
|
|
11536
|
+
const St = "[REDACTED_SECRET]", ce = "[REDACTED_TOKEN]", Md = "[REDACTED_SIGNED_URL]", Pd = 20, Od = /^(access_token|accessToken|refresh_token|refreshToken|id_token|idToken|authToken|token|api_key|apiKey|apikey|key|secret|signature|sig|password|passwd|pwd|code|state|session|jwt|csrf|csrfToken|xsrf|xsrfToken)$/i, jn = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, Ln = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, $n = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, Fn = /\b(access_token|accessToken|refresh_token|refreshToken|id_token|idToken|authToken|api_key|apiKey|apikey|client_secret|clientSecret|password|secret|token|jwt|csrf|csrfToken|xsrf|xsrfToken)\b\s*[:=]\s*["']?[^"',&\s}]+/gi, xd = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Dd = /\bhttps?:\/\/[^\s"'<>]+/gi, Ud = /[),.;\]]+$/;
|
|
11540
11537
|
function Q(s) {
|
|
11541
11538
|
return mt(s, 0, /* @__PURE__ */ new WeakSet());
|
|
11542
11539
|
}
|
|
@@ -11545,7 +11542,7 @@ function mt(s, e, t) {
|
|
|
11545
11542
|
return s.startsWith("data:image/") || s.startsWith("data:application/pdf;") ? s : gt(s);
|
|
11546
11543
|
if (s === null || typeof s != "object")
|
|
11547
11544
|
return s;
|
|
11548
|
-
if (e >=
|
|
11545
|
+
if (e >= Pd)
|
|
11549
11546
|
return "[REDACTED_MAX_DEPTH]";
|
|
11550
11547
|
if (t.has(s))
|
|
11551
11548
|
return "[REDACTED_CIRCULAR]";
|
|
@@ -11553,43 +11550,43 @@ function mt(s, e, t) {
|
|
|
11553
11550
|
return s.map((n) => mt(n, e + 1, t));
|
|
11554
11551
|
const i = {};
|
|
11555
11552
|
for (const [n, r] of Object.entries(s))
|
|
11556
|
-
n === "pageContent" ? i[n] = r :
|
|
11553
|
+
n === "pageContent" ? i[n] = r : zn(n) ? i[n] = St : i[n] = n.toLowerCase() === "url" ? Nd(r) : mt(r, e + 1, t);
|
|
11557
11554
|
return i;
|
|
11558
11555
|
}
|
|
11559
|
-
function
|
|
11556
|
+
function zn(s) {
|
|
11560
11557
|
const e = s.replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
11561
11558
|
return e.includes("authorization") || e.includes("cookie") || e.includes("password") || e.includes("passwd") || e === "pwd" || e.includes("secret") || e === "token" || e.endsWith("token") || e.includes("apikey") || e.includes("csrf") || e.includes("xsrf") || e === "jwt" || e === "session" || e === "signature" || e.includes("privatekey");
|
|
11562
11559
|
}
|
|
11563
|
-
function
|
|
11564
|
-
return typeof s == "string" ?
|
|
11560
|
+
function Nd(s) {
|
|
11561
|
+
return typeof s == "string" ? Hn(s) : mt(s, 0, /* @__PURE__ */ new WeakSet());
|
|
11565
11562
|
}
|
|
11566
|
-
function
|
|
11563
|
+
function Hn(s) {
|
|
11567
11564
|
try {
|
|
11568
11565
|
const e = new URL(s, location.href);
|
|
11569
11566
|
for (const t of Array.from(e.searchParams.keys()))
|
|
11570
|
-
|
|
11567
|
+
Od.test(t) && e.searchParams.set(t, ce);
|
|
11571
11568
|
return e.username && (e.username = ce), e.password && (e.password = ce), e.toString();
|
|
11572
11569
|
} catch {
|
|
11573
|
-
return
|
|
11570
|
+
return Bd(s);
|
|
11574
11571
|
}
|
|
11575
11572
|
}
|
|
11576
11573
|
function gt(s) {
|
|
11577
|
-
return s.replace(
|
|
11578
|
-
}
|
|
11579
|
-
function Nd(s) {
|
|
11580
|
-
return s.replace(Bn, `Bearer ${ce}`).replace(jn, `Basic ${ce}`).replace(Ln, ce).replace($n, (e, t) => `${t}: ${St}`);
|
|
11574
|
+
return s.replace(xd, Md).replace(Dd, jd).replace(jn, `Bearer ${ce}`).replace(Ln, `Basic ${ce}`).replace($n, ce).replace(Fn, (e, t) => `${t}: ${St}`);
|
|
11581
11575
|
}
|
|
11582
11576
|
function Bd(s) {
|
|
11583
|
-
|
|
11584
|
-
|
|
11577
|
+
return s.replace(jn, `Bearer ${ce}`).replace(Ln, `Basic ${ce}`).replace($n, ce).replace(Fn, (e, t) => `${t}: ${St}`);
|
|
11578
|
+
}
|
|
11579
|
+
function jd(s) {
|
|
11580
|
+
const e = s.match(Ud)?.[0] ?? "", t = e ? s.slice(0, -e.length) : s;
|
|
11581
|
+
return `${Hn(t)}${e}`;
|
|
11585
11582
|
}
|
|
11586
|
-
const
|
|
11583
|
+
const Zd = Object.freeze({
|
|
11587
11584
|
init: (s) => _t.init(s)
|
|
11588
11585
|
});
|
|
11589
|
-
function
|
|
11586
|
+
function el(s) {
|
|
11590
11587
|
return _t.init(s);
|
|
11591
11588
|
}
|
|
11592
|
-
function
|
|
11589
|
+
function ji(s) {
|
|
11593
11590
|
const e = /* @__PURE__ */ new Map();
|
|
11594
11591
|
for (const t of [...s].reverse()) {
|
|
11595
11592
|
const i = t.integrationAuthRequest;
|
|
@@ -11597,38 +11594,49 @@ function Li(s) {
|
|
|
11597
11594
|
}
|
|
11598
11595
|
return [...e.values()];
|
|
11599
11596
|
}
|
|
11597
|
+
function Li(s) {
|
|
11598
|
+
return new Promise((e) => {
|
|
11599
|
+
const t = () => {
|
|
11600
|
+
s.removeEventListener("message", i), s.removeEventListener("close", t), e();
|
|
11601
|
+
}, i = (n) => {
|
|
11602
|
+
const r = qn(n.data);
|
|
11603
|
+
(r.type === "auth.ok" || r.type === "error") && t();
|
|
11604
|
+
};
|
|
11605
|
+
s.addEventListener("message", i), s.addEventListener("close", t);
|
|
11606
|
+
});
|
|
11607
|
+
}
|
|
11600
11608
|
export {
|
|
11601
11609
|
Ai as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
|
|
11602
|
-
|
|
11603
|
-
|
|
11604
|
-
|
|
11605
|
-
|
|
11606
|
-
|
|
11607
|
-
|
|
11608
|
-
|
|
11610
|
+
La as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
|
|
11611
|
+
ja as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
|
|
11612
|
+
$a as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
|
|
11613
|
+
kr as PRODUCT_AGENT_AUTH_RECONNECTING_ERROR_MESSAGE,
|
|
11614
|
+
Jd as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
|
|
11615
|
+
Zd as PlunoProductAgent,
|
|
11616
|
+
qa as ProductAgentInteractionManager,
|
|
11609
11617
|
ii as ProductAgentQueryController,
|
|
11610
|
-
|
|
11618
|
+
Qd as ProductAgentRemoteRuntimeClient,
|
|
11611
11619
|
_t as ProductAgentSessionEngine,
|
|
11612
|
-
|
|
11613
|
-
|
|
11620
|
+
Kd as ProductAgentSessionHistoryManager,
|
|
11621
|
+
Wd as ProductAgentTaskPageTitleController,
|
|
11614
11622
|
ne as ProductAgentTokenProviderError,
|
|
11615
|
-
|
|
11616
|
-
|
|
11617
|
-
|
|
11623
|
+
ac as calculateReconnectDelay,
|
|
11624
|
+
$d as canSubmitPersonalProductAgentMessage,
|
|
11625
|
+
Hd as createLocalStorageInteractionDecisionStorage,
|
|
11618
11626
|
st as createProductAgentQueryState,
|
|
11619
|
-
|
|
11620
|
-
|
|
11621
|
-
|
|
11622
|
-
|
|
11623
|
-
|
|
11624
|
-
|
|
11625
|
-
|
|
11626
|
-
|
|
11627
|
+
el as createProductAgentRuntime,
|
|
11628
|
+
Vd as createProductAgentTaskPageTitleDocument,
|
|
11629
|
+
Zd as default,
|
|
11630
|
+
xa as formatProductAgentTaskPageTitle,
|
|
11631
|
+
Xd as getProductAgentOriginAccessErrorMessage,
|
|
11632
|
+
qr as isProductAgentAuthReconnectError,
|
|
11633
|
+
Gd as isProductAgentRuntimeCommand,
|
|
11634
|
+
Ar as mergeProductAgentEntityPages,
|
|
11627
11635
|
it as normalizeProductAgentEntityPage,
|
|
11628
|
-
|
|
11629
|
-
|
|
11630
|
-
|
|
11631
|
-
|
|
11632
|
-
|
|
11633
|
-
|
|
11636
|
+
Yd as normalizeProductAgentSessionItems,
|
|
11637
|
+
Ca as readLocalStorageInteractionDecisions,
|
|
11638
|
+
Fd as resolveProductAgentComposerAction,
|
|
11639
|
+
Ld as resolveProductAgentWidgetPresentation,
|
|
11640
|
+
Er as selectProductAgentQueryEntities,
|
|
11641
|
+
hd as validateProductAgentProviderInputFile
|
|
11634
11642
|
};
|