@pluno/product-agent-web 0.1.260 → 0.1.262
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/web/accountPresentation.d.ts +4 -0
- package/dist/adapters/web/contextHttpError.d.ts +1 -0
- package/dist/adapters/web/conversationAdapters.d.ts +3 -1
- package/dist/adapters/web/deviceHints.d.ts +2 -0
- package/dist/adapters/web/featureHttp.d.ts +30 -0
- package/dist/adapters/web/featureLifecycle.d.ts +18 -0
- package/dist/adapters/web/featureOwner.d.ts +15 -0
- package/dist/adapters/web/featurePresentation.d.ts +5 -0
- package/dist/core/account/contracts.d.ts +56 -0
- package/dist/core/account/presentation.d.ts +49 -0
- package/dist/core/account/reducer.d.ts +2 -0
- package/dist/core/account/selectors.d.ts +3 -0
- package/dist/core/account/state.d.ts +2 -0
- package/dist/core/conversation/contracts.d.ts +1 -5
- package/dist/core/conversation/delivery.d.ts +1 -0
- package/dist/core/conversation/reducer.d.ts +4 -2
- package/dist/core/features/appearance.d.ts +10 -0
- package/dist/core/features/contracts.d.ts +492 -0
- package/dist/core/features/reducer.d.ts +16 -0
- package/dist/core/features/selectors.d.ts +15 -0
- package/dist/core/features/state.d.ts +2 -0
- package/dist/core/features/uiFlightEvidence.d.ts +29 -0
- package/dist/core/index.d.ts +11 -0
- package/dist/core/interactions/actions.d.ts +12 -0
- package/dist/core/interactions/contracts.d.ts +139 -0
- package/dist/core/interactions/preferenceOpenings.d.ts +22 -0
- package/dist/core/interactions/reducer.d.ts +6 -0
- package/dist/core/interactions/selectors.d.ts +25 -0
- package/dist/core/interactions/state.d.ts +2 -0
- package/dist/core/session-directory/membership.d.ts +3 -2
- package/dist/core/session-directory/reducer.d.ts +2 -1
- package/dist/index.d.ts +28 -16
- package/dist/product-agent-runtime.cjs +1 -1
- package/dist/product-agent-runtime.js +34 -26
- package/dist/product-agent-sdk.js +6711 -5098
- package/dist/product-agent-widget.js +6804 -5403
- package/dist/public/operationRoutes.d.ts +4 -1
- package/dist/runtime/composition.d.ts +10 -7
- package/dist/runtimeClient.d.ts +15 -0
- package/dist/runtimeState.d.ts +7 -51
- package/dist/themeColors.d.ts +7 -0
- package/dist/uiFlightRecorder.d.ts +2 -29
- package/package.json +1 -1
- package/dist/adapters/web/conversationInteractionAdapter.d.ts +0 -11
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
function _e(s, e) {
|
|
2
|
+
return e === "limit_exceeded" ? { allowed: !1, reason: "credits_exhausted", actions: ["upgrade", "earn_credits"] } : e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required" ? { allowed: !1, reason: "payment_issue", actions: ["upgrade"] } : s ?? { allowed: !0, reason: "allowed", actions: [] };
|
|
3
|
+
}
|
|
1
4
|
function m(s) {
|
|
2
5
|
return {
|
|
3
6
|
key: s,
|
|
@@ -106,16 +109,13 @@ function Q(s) {
|
|
|
106
109
|
function Ie(s) {
|
|
107
110
|
return s.visible ? s.minimized ? { state: "minimized" } : { state: s.open ? "visible_open" : "visible_closed" } : { state: "hidden" };
|
|
108
111
|
}
|
|
109
|
-
function _e(s, e) {
|
|
110
|
-
return e === "limit_exceeded" ? { allowed: !1, reason: "credits_exhausted", actions: ["upgrade", "earn_credits"] } : e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required" ? { allowed: !1, reason: "payment_issue", actions: ["upgrade"] } : s ?? { allowed: !0, reason: "allowed", actions: [] };
|
|
111
|
-
}
|
|
112
112
|
function Se(s) {
|
|
113
113
|
if (!s || typeof s != "object") return !1;
|
|
114
114
|
const e = s.paidCreditFallbackModel;
|
|
115
115
|
return typeof e == "string" && e.length > 0;
|
|
116
116
|
}
|
|
117
117
|
function Ae(s) {
|
|
118
|
-
return s ? s.submissionGate?.allowed === !1 ? { state: "action_required", reason: s.submissionGate.reason } : s.usingPaidCreditFallback === !0 ? { state: "paid_credit_fallback" } : s.creditLimit !== null && s.creditLimit > 0 && s.creditsRemaining !== null && s.creditsRemaining > 0 && s.creditsRemaining / s.creditLimit <= 0.2 ? { state: "low_credits" } : s.creditsUsed !== null ? { state: "usage" } : { state: "hidden" } : { state: "hidden" };
|
|
118
|
+
return s ? s.submissionGate?.allowed === !1 ? ["credits_exhausted", "payment_issue", "onboarding_required"].includes(s.submissionGate.reason) ? { state: "action_required", reason: s.submissionGate.reason } : { state: "hidden" } : s.usingPaidCreditFallback === !0 ? { state: "paid_credit_fallback" } : s.creditLimit !== null && s.creditLimit > 0 && s.creditsRemaining !== null && s.creditsRemaining > 0 && s.creditsRemaining / s.creditLimit <= 0.2 ? { state: "low_credits" } : s.creditsUsed !== null ? { state: "usage" } : { state: "hidden" } : { state: "hidden" };
|
|
119
119
|
}
|
|
120
120
|
function we(s) {
|
|
121
121
|
return s.submissionAllowed && s.isAuthenticated && s.hasWorkspace && !s.isWebsiteBlocked && s.isCurrentPageResolved && !s.isSubmitting && !s.hasPendingMessage;
|
|
@@ -131,7 +131,7 @@ function Me(s) {
|
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
133
|
const H = "Pluno is reconnecting. Try again in a moment.";
|
|
134
|
-
function
|
|
134
|
+
function V(s) {
|
|
135
135
|
return (s instanceof Error ? s.message : s) === H;
|
|
136
136
|
}
|
|
137
137
|
class Te {
|
|
@@ -177,7 +177,7 @@ class Te {
|
|
|
177
177
|
}) : null;
|
|
178
178
|
return {
|
|
179
179
|
key: e.key.slice(0, -7),
|
|
180
|
-
status:
|
|
180
|
+
status: Z(e, t),
|
|
181
181
|
data: a,
|
|
182
182
|
error: e.error ?? t.error,
|
|
183
183
|
requestId: Math.max(e.requestId, t.requestId),
|
|
@@ -286,7 +286,7 @@ class Te {
|
|
|
286
286
|
function f(s) {
|
|
287
287
|
return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function Z(s, e) {
|
|
290
290
|
return s.status === "error" || e.status === "error" ? "error" : s.status === "loading" || e.status === "loading" ? "loading" : s.status === "refreshing" || e.status === "refreshing" ? "refreshing" : s.status === "loading_more" ? "loading_more" : s.status === "ready" || e.status === "ready" ? "ready" : "not_requested";
|
|
291
291
|
}
|
|
292
292
|
function q(s) {
|
|
@@ -463,14 +463,14 @@ class Ee {
|
|
|
463
463
|
return null;
|
|
464
464
|
}
|
|
465
465
|
getDecisionKey(e) {
|
|
466
|
-
const t =
|
|
466
|
+
const t = I(e.scope);
|
|
467
467
|
return e.action === "dont_show_again" ? `${t}:category:${e.category}` : `${t}:interaction:${e.promptKey}`;
|
|
468
468
|
}
|
|
469
469
|
getExactKey(e) {
|
|
470
|
-
return `${
|
|
470
|
+
return `${I(e.scope)}:interaction:${e.key}`;
|
|
471
471
|
}
|
|
472
472
|
getCategoryKey(e) {
|
|
473
|
-
return `${
|
|
473
|
+
return `${I(e.scope)}:category:${e.category}`;
|
|
474
474
|
}
|
|
475
475
|
}
|
|
476
476
|
function Pe(s, e) {
|
|
@@ -485,7 +485,7 @@ function Y(s, e) {
|
|
|
485
485
|
const i = JSON.parse(t);
|
|
486
486
|
return Array.isArray(i) ? i.filter(w) : [];
|
|
487
487
|
}
|
|
488
|
-
function
|
|
488
|
+
function I(s) {
|
|
489
489
|
return `${s.level}:${s.key}`;
|
|
490
490
|
}
|
|
491
491
|
function z(s) {
|
|
@@ -503,8 +503,8 @@ const X = {
|
|
|
503
503
|
stopped: "⏹️"
|
|
504
504
|
}, ee = /^(?:⌛|⏳|✅|❗|⏹️) Pluno(?:: )?/;
|
|
505
505
|
function te(s, e) {
|
|
506
|
-
if (!e) return
|
|
507
|
-
const t =
|
|
506
|
+
if (!e) return _(s);
|
|
507
|
+
const t = _(s), i = `${X[e]} Pluno`;
|
|
508
508
|
return t ? `${i}: ${t}` : i;
|
|
509
509
|
}
|
|
510
510
|
class Oe {
|
|
@@ -529,10 +529,10 @@ class Oe {
|
|
|
529
529
|
}
|
|
530
530
|
applyStatus(e) {
|
|
531
531
|
const t = this.titleDocument.getTitle();
|
|
532
|
-
t !== this.lastAppliedTitle && (this.baseTitle =
|
|
532
|
+
t !== this.lastAppliedTitle && (this.baseTitle = _(t)), this.status = e, this.stopObserving || (this.stopObserving = this.titleDocument.observeTitle(() => this.handleTitleChanged())), this.applyTitle();
|
|
533
533
|
}
|
|
534
534
|
applyClear() {
|
|
535
|
-
const e = this.titleDocument.getTitle(), t = this.lastAppliedTitle !== null && e === this.lastAppliedTitle, i = this.lastAppliedTitle === null ?
|
|
535
|
+
const e = this.titleDocument.getTitle(), t = this.lastAppliedTitle !== null && e === this.lastAppliedTitle, i = this.lastAppliedTitle === null ? _(e) : e;
|
|
536
536
|
this.status = null, this.lastAppliedTitle = null, this.stopObserving?.(), this.stopObserving = null, t ? this.titleDocument.setTitle(this.baseTitle) : i !== e && this.titleDocument.setTitle(i);
|
|
537
537
|
}
|
|
538
538
|
handleTitleChanged() {
|
|
@@ -561,10 +561,10 @@ function qe(s) {
|
|
|
561
561
|
}
|
|
562
562
|
};
|
|
563
563
|
}
|
|
564
|
-
function
|
|
564
|
+
function _(s) {
|
|
565
565
|
return s.replace(ee, "");
|
|
566
566
|
}
|
|
567
|
-
const se = "0.1.
|
|
567
|
+
const se = "0.1.262", ie = {
|
|
568
568
|
version: se
|
|
569
569
|
}, p = (s) => typeof s == "string" && /^[a-zA-Z0-9:_.-]{1,160}$/.test(s) ? s : null;
|
|
570
570
|
function ne(s) {
|
|
@@ -641,6 +641,7 @@ function le(s) {
|
|
|
641
641
|
}
|
|
642
642
|
function g(s, e = "runtime_error", t = "runtime") {
|
|
643
643
|
const i = s !== null && typeof s == "object" ? s : null, n = typeof s == "string" ? s : i && "message" in i && typeof i.message == "string" ? i.message : "", r = i && "code" in i && typeof i.code == "string" && i.code.trim() ? i.code : e, o = i && "details" in i ? i.details : null, a = o && typeof o == "object" ? o : {}, d = {
|
|
644
|
+
...typeof a.httpStatus == "number" && Number.isInteger(a.httpStatus) && a.httpStatus >= 100 && a.httpStatus <= 599 ? { httpStatus: a.httpStatus } : {},
|
|
644
645
|
// Preserve the first boundary's shape after normalization replaces the original message/prototype.
|
|
645
646
|
errorNormalization: T(a.errorNormalization) ? a.errorNormalization : {
|
|
646
647
|
boundary: t,
|
|
@@ -662,7 +663,7 @@ function g(s, e = "runtime_error", t = "runtime") {
|
|
|
662
663
|
...Object.keys(d).length ? { details: d } : {}
|
|
663
664
|
});
|
|
664
665
|
}
|
|
665
|
-
function
|
|
666
|
+
function G(s) {
|
|
666
667
|
if (!s || typeof s != "object") return !1;
|
|
667
668
|
const e = s, t = (i) => Number.isSafeInteger(i) && i >= 0;
|
|
668
669
|
return Object.keys(e).every((i) => [
|
|
@@ -729,7 +730,7 @@ const ue = [
|
|
|
729
730
|
"acceptance_applied",
|
|
730
731
|
"cancellation_queue",
|
|
731
732
|
"cancellation_write"
|
|
732
|
-
],
|
|
733
|
+
], F = [
|
|
733
734
|
"request_timed_out",
|
|
734
735
|
"delivery_unknown",
|
|
735
736
|
"invalid_ack",
|
|
@@ -747,7 +748,7 @@ const ue = [
|
|
|
747
748
|
];
|
|
748
749
|
function pe(s) {
|
|
749
750
|
const e = s, t = e?.code;
|
|
750
|
-
return e?.backendRefusal === !0 ? "backend_refusal" : typeof t == "string" && t !== "backend_refusal" &&
|
|
751
|
+
return e?.backendRefusal === !0 ? "backend_refusal" : typeof t == "string" && t !== "backend_refusal" && F.includes(t) ? t : e?.name === "AbortError" ? "aborted" : e?.name === "TypeError" ? "type_error" : "unknown";
|
|
751
752
|
}
|
|
752
753
|
const he = Math.random().toString(36).slice(2);
|
|
753
754
|
let ge = 0;
|
|
@@ -755,7 +756,7 @@ const C = () => `timing:${he}:${++ge}`, y = (s) => typeof s == "string" && /^[a-
|
|
|
755
756
|
function E(s) {
|
|
756
757
|
if (!s || typeof s != "object") return !1;
|
|
757
758
|
const e = s;
|
|
758
|
-
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" &&
|
|
759
|
+
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" && F.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) && ue.includes(e.stage) && ["started", "completed", "failed", "observed"].includes(e.status) && y(e.spanId) && y(e.requestId) && (e.clientMessageId === null || y(e.clientMessageId)) && (e.sessionId === null || y(e.sessionId)) && typeof e.occurredAt == "string" && e.occurredAt.length <= 40 && Number.isFinite(Date.parse(e.occurredAt)) && Number.isSafeInteger(e.durationMs) && e.durationMs >= 0;
|
|
759
760
|
}
|
|
760
761
|
function x(s, e) {
|
|
761
762
|
if (!s) return {
|
|
@@ -870,9 +871,11 @@ function ke(s) {
|
|
|
870
871
|
case "runtime.report_operation_timing":
|
|
871
872
|
return E(e.timing);
|
|
872
873
|
case "runtime.report_displayed_error":
|
|
873
|
-
return (e.errorDiagnostic === void 0 || de(e.errorDiagnostic)) && (e.httpRequest === void 0 ||
|
|
874
|
+
return (e.errorDiagnostic === void 0 || de(e.errorDiagnostic)) && (e.httpRequest === void 0 || G(e.httpRequest)) && (e.historyRefreshFailure === void 0 || $(e.historyRefreshFailure)) && (e.renderedError === void 0 || K(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);
|
|
874
875
|
case "runtime.report_invalid_state_transition":
|
|
875
876
|
return (e.uiInvariant === void 0 || U(e.uiInvariant)) && (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll" || ve(e.reason)) && (e.clientMessageId === void 0 || typeof e.clientMessageId == "string");
|
|
877
|
+
case "runtime.prompt_presented":
|
|
878
|
+
return (e.feature === "notifications" || e.feature === "tab_grouping") && typeof e.openingGeneration == "number" && Number.isSafeInteger(e.openingGeneration) && e.openingGeneration > 0;
|
|
876
879
|
case "runtime.widget_lifecycle":
|
|
877
880
|
return (e.action === "opened" || e.action === "closed" || e.action === "minimized") && typeof e.trigger == "string";
|
|
878
881
|
case "session.load":
|
|
@@ -985,6 +988,9 @@ class Re {
|
|
|
985
988
|
return this.adapter.dispatch({ type: "runtime.warmup", reason: e }).then(() => {
|
|
986
989
|
});
|
|
987
990
|
}
|
|
991
|
+
recordPromptPresented(e, t) {
|
|
992
|
+
this.dispatch({ type: "runtime.prompt_presented", feature: e, openingGeneration: t });
|
|
993
|
+
}
|
|
988
994
|
recordWidgetLifecycle(e, t) {
|
|
989
995
|
this.dispatch({ type: "runtime.widget_lifecycle", action: e, trigger: t });
|
|
990
996
|
}
|
|
@@ -1017,7 +1023,7 @@ class Re {
|
|
|
1017
1023
|
errorFingerprint: t,
|
|
1018
1024
|
...n ? { renderedError: n } : {},
|
|
1019
1025
|
...r ? { historyRefreshFailure: r } : {},
|
|
1020
|
-
...
|
|
1026
|
+
...G(o) ? { httpRequest: o } : {},
|
|
1021
1027
|
...i ? { displayedMessage: L(i) } : {}
|
|
1022
1028
|
}).catch(() => {
|
|
1023
1029
|
});
|
|
@@ -1100,7 +1106,7 @@ class Re {
|
|
|
1100
1106
|
return r === this.stagedProactiveSuggestionClientMessageId && (this.stagedProactiveSuggestionClientMessageId = null), r;
|
|
1101
1107
|
} catch (c) {
|
|
1102
1108
|
if (i !== this.submissionGeneration) return null;
|
|
1103
|
-
if (
|
|
1109
|
+
if (V(c))
|
|
1104
1110
|
for (const u of t.attachments ?? [])
|
|
1105
1111
|
u.id && this.attachmentFiles.delete(u.id);
|
|
1106
1112
|
const l = this.submissionPreviews.get(r);
|
|
@@ -1234,12 +1240,14 @@ class Re {
|
|
|
1234
1240
|
return this.interactionListeners.add(e), e(this.getInteractions()), () => this.interactionListeners.delete(e);
|
|
1235
1241
|
}
|
|
1236
1242
|
actOnInteraction(e, t, i, n = {}) {
|
|
1243
|
+
const r = n.expectedSourceVersion === void 0 ? this.getInteractions().find((o) => o.id === e)?.sourceVersion ?? null : n.expectedSourceVersion;
|
|
1237
1244
|
return this.dispatch({
|
|
1238
1245
|
type: "interaction.act",
|
|
1239
1246
|
interactionId: e,
|
|
1240
1247
|
action: t,
|
|
1241
1248
|
expectedRevision: i,
|
|
1242
|
-
...n
|
|
1249
|
+
...n,
|
|
1250
|
+
expectedSourceVersion: r
|
|
1243
1251
|
}).then(() => {
|
|
1244
1252
|
});
|
|
1245
1253
|
}
|
|
@@ -1343,7 +1351,7 @@ export {
|
|
|
1343
1351
|
qe as createProductAgentTaskPageTitleDocument,
|
|
1344
1352
|
te as formatProductAgentTaskPageTitle,
|
|
1345
1353
|
Se as hasProductAgentPaidCreditFallback,
|
|
1346
|
-
|
|
1354
|
+
V as isProductAgentAuthReconnectError,
|
|
1347
1355
|
ke as isProductAgentRuntimeCommand,
|
|
1348
1356
|
B as mergeProductAgentEntityPages,
|
|
1349
1357
|
v as normalizeProductAgentEntityPage,
|