@pluno/product-agent-web 0.1.292 → 0.1.294
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/web/directoryAdapters.d.ts +1 -0
- package/dist/core/model-selection/commands.d.ts +3 -0
- package/dist/core/model-selection/contracts.d.ts +1 -1
- package/dist/core/model-selection/selectors.d.ts +1 -1
- package/dist/core/session-directory/contracts.d.ts +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/modelSelection.d.ts +43 -30
- package/dist/product-agent-runtime.cjs +1 -1
- package/dist/product-agent-runtime.js +16 -15
- package/dist/product-agent-sdk.js +1537 -1517
- package/dist/product-agent-widget.js +3201 -3184
- package/dist/public/operationRoutes.d.ts +1 -0
- package/dist/runtime/modelSelection.d.ts +1 -1
- package/dist/runtimeClient.d.ts +1 -0
- package/dist/widget.d.ts +1 -0
- package/package.json +1 -1
|
@@ -114,10 +114,10 @@ function Me(i) {
|
|
|
114
114
|
const e = i.paidCreditFallbackModel;
|
|
115
115
|
return typeof e == "string" && e.length > 0;
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function Ee(i) {
|
|
118
118
|
return i ? i.submissionGate?.allowed === !1 ? ["credits_exhausted", "payment_issue", "onboarding_required"].includes(i.submissionGate.reason) ? { state: "action_required", reason: i.submissionGate.reason } : { state: "hidden" } : i.usingPaidCreditFallback === !0 ? { state: "paid_credit_fallback" } : i.creditLimit !== null && i.creditLimit > 0 && i.creditsRemaining !== null && i.creditsRemaining > 0 && i.creditsRemaining / i.creditLimit <= 0.2 ? { state: "low_credits" } : i.creditsUsed !== null ? { state: "usage" } : { state: "hidden" } : { state: "hidden" };
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function Te(i) {
|
|
121
121
|
return i.submissionAllowed && i.isAuthenticated && i.hasWorkspace && !i.isWebsiteBlocked && i.isCurrentPageResolved && !i.isSubmitting && !i.hasPendingMessage;
|
|
122
122
|
}
|
|
123
123
|
function Pe(i) {
|
|
@@ -463,14 +463,14 @@ class ke {
|
|
|
463
463
|
return null;
|
|
464
464
|
}
|
|
465
465
|
getDecisionKey(e) {
|
|
466
|
-
const t =
|
|
466
|
+
const t = E(e.scope);
|
|
467
467
|
return e.action === "dont_show_again" ? `${t}:category:${e.category}` : `${t}:interaction:${e.promptKey}`;
|
|
468
468
|
}
|
|
469
469
|
getExactKey(e) {
|
|
470
|
-
return `${
|
|
470
|
+
return `${E(e.scope)}:interaction:${e.key}`;
|
|
471
471
|
}
|
|
472
472
|
getCategoryKey(e) {
|
|
473
|
-
return `${
|
|
473
|
+
return `${E(e.scope)}:category:${e.category}`;
|
|
474
474
|
}
|
|
475
475
|
}
|
|
476
476
|
function qe(i, e) {
|
|
@@ -485,7 +485,7 @@ function se(i, e) {
|
|
|
485
485
|
const s = JSON.parse(t);
|
|
486
486
|
return Array.isArray(s) ? s.filter(P) : [];
|
|
487
487
|
}
|
|
488
|
-
function
|
|
488
|
+
function E(i) {
|
|
489
489
|
return `${i.level}:${i.key}`;
|
|
490
490
|
}
|
|
491
491
|
function U(i) {
|
|
@@ -564,7 +564,7 @@ function Ce(i) {
|
|
|
564
564
|
function M(i) {
|
|
565
565
|
return i.replace(ne, "");
|
|
566
566
|
}
|
|
567
|
-
const oe = "0.1.
|
|
567
|
+
const oe = "0.1.294", ae = {
|
|
568
568
|
version: oe
|
|
569
569
|
}, g = (i) => typeof i == "string" && /^[a-zA-Z0-9:_.-]{1,160}$/.test(i) ? i : null;
|
|
570
570
|
function de(i) {
|
|
@@ -812,11 +812,11 @@ function K(i, e) {
|
|
|
812
812
|
}
|
|
813
813
|
};
|
|
814
814
|
}
|
|
815
|
-
const
|
|
815
|
+
const T = (i) => i === null || typeof i == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(i);
|
|
816
816
|
function be(i) {
|
|
817
817
|
if (!i || typeof i != "object") return !1;
|
|
818
818
|
const e = i;
|
|
819
|
-
return typeof e.observedAt == "string" && e.observedAt.length <= 40 && Number.isFinite(Date.parse(e.observedAt)) &&
|
|
819
|
+
return typeof e.observedAt == "string" && e.observedAt.length <= 40 && Number.isFinite(Date.parse(e.observedAt)) && T(e.sessionId) && T(e.responseItemId) && T(e.respondsToUserMessageId) && typeof e.panelVisible == "boolean" && typeof e.documentVisible == "boolean" && typeof e.loading == "boolean";
|
|
820
820
|
}
|
|
821
821
|
function ve(i, e, t = "stopped", s, n = "Run stopped by user.") {
|
|
822
822
|
const r = new Set(s ?? [
|
|
@@ -938,6 +938,7 @@ class De {
|
|
|
938
938
|
state;
|
|
939
939
|
sessionHistoryState = S("unavailable");
|
|
940
940
|
model;
|
|
941
|
+
modelExplicit = !1;
|
|
941
942
|
initialModel;
|
|
942
943
|
interactions = [];
|
|
943
944
|
account = null;
|
|
@@ -983,11 +984,11 @@ class De {
|
|
|
983
984
|
updateProjection(e, t, s, n, r) {
|
|
984
985
|
if (this.destroyed) return;
|
|
985
986
|
const o = this.getState(), a = !this.hasBeenReady && (!o.user || o.user.id === e.user?.id), c = o.stableSelectionKey !== void 0 && o.stableSelectionKey === e.stableSelectionKey && o.user?.id === e.user?.id && o.sessionId === e.sessionId, d = c && this.pendingTransfers.size > 0 && this.submissionRetries.size === 0 && [...this.pendingTransfers.keys()].every((l) => this.readinessPendingSubmissions.has(l));
|
|
986
|
-
!a && !d && (o.user?.id !== e.user?.id || o.selectionKey !== void 0 && o.selectionKey !== e.selectionKey || o.selectionKey === void 0 && o.sessionId !== null && o.sessionId !== e.sessionId) && (c || (this.model = this.initialModel), this.cancelPendingSubmissions(), this.submissionPreviews.clear());
|
|
987
|
+
!a && !d && (o.user?.id !== e.user?.id || o.selectionKey !== void 0 && o.selectionKey !== e.selectionKey || o.selectionKey === void 0 && o.sessionId !== null && o.sessionId !== e.sessionId) && (c || (this.model = t ?? this.initialModel, this.modelExplicit = !1), this.cancelPendingSubmissions(), this.submissionPreviews.clear());
|
|
987
988
|
for (const l of e.messages)
|
|
988
989
|
l.role === "user" && e.receipts?.find((u) => u.userMessageId === l.id)?.durable !== !1 && this.submissionPreviews.delete(l.id);
|
|
989
990
|
const p = c && e.sessionId !== null && e.isLoadingSession && !e.isDraftSession;
|
|
990
|
-
this.retainedTranscript = p ? this.retainedTranscript ?? (this.state.isLoadingSession || this.state.messages.length === 0 ? null : { messages: this.state.messages, segments: this.state.segments, removedItems: this.state.removedItems }) : null, this.state = I(e), e.status === "connected" && e.submissionReady !== !1 && (this.hasBeenReady = !0);
|
|
991
|
+
this.retainedTranscript = p ? this.retainedTranscript ?? (this.state.isLoadingSession || this.state.messages.length === 0 ? null : { messages: this.state.messages, segments: this.state.segments, removedItems: this.state.removedItems }) : null, this.state = I(e), t !== void 0 && !this.modelExplicit && (this.model = t), e.status === "connected" && e.submissionReady !== !1 && (this.hasBeenReady = !0);
|
|
991
992
|
for (const [l, u] of this.stopPreviews) {
|
|
992
993
|
const h = e.activity?.executionKey;
|
|
993
994
|
(u !== void 0 && u !== "[]" && h !== void 0 && h !== "[]" && (h !== u || ["completed", "failed", "stopped"].includes(e.activity.phase)) || (u === void 0 || u === "[]") && e.messages.some((m) => m.respondsToUserMessageId === l && !m.provisional && m.loading !== !0 && (m.dataType === "run_status" || m.dataType === "run_error" || m.role === "assistant" && m.phase !== "commentary" && (m.streamState === void 0 || ["finished", "stopped", "failed"].includes(m.streamState))))) && this.stopPreviews.delete(l);
|
|
@@ -1195,7 +1196,7 @@ class De {
|
|
|
1195
1196
|
return this.model;
|
|
1196
1197
|
}
|
|
1197
1198
|
setModel(e) {
|
|
1198
|
-
return this.model === e || (this.model = e, this.emit("state", this.getState())), Promise.resolve();
|
|
1199
|
+
return this.modelExplicit = !0, this.model === e || (this.model = e, this.emit("state", this.getState())), Promise.resolve();
|
|
1199
1200
|
}
|
|
1200
1201
|
async retryLastMessage(e) {
|
|
1201
1202
|
const t = e ?? [...this.submissionPreviews].reverse().find(([, a]) => a.error)?.[0] ?? this.state.messages.filter((a) => a.role === "user").slice(-1)[0]?.id;
|
|
@@ -1324,7 +1325,7 @@ class De {
|
|
|
1324
1325
|
return t;
|
|
1325
1326
|
}
|
|
1326
1327
|
startNewSession(e = {}) {
|
|
1327
|
-
return this.cancelPendingSubmissions(), this.submissionPreviews.clear(), this.retainedTranscript = null, this.model = this.initialModel, this.emit("state", this.getState()), e.notifyTransport === !1 ? Promise.resolve() : this.navigate({ type: "session.new" });
|
|
1328
|
+
return this.cancelPendingSubmissions(), this.submissionPreviews.clear(), this.retainedTranscript = null, this.model = this.initialModel, this.modelExplicit = !1, this.emit("state", this.getState()), e.notifyTransport === !1 ? Promise.resolve() : this.navigate({ type: "session.new" });
|
|
1328
1329
|
}
|
|
1329
1330
|
async listSessions(e = {}) {
|
|
1330
1331
|
const t = await this.dispatch({ type: "session.list", ...e });
|
|
@@ -1470,7 +1471,7 @@ export {
|
|
|
1470
1471
|
De as ProductAgentRemoteRuntimeClient,
|
|
1471
1472
|
Re as ProductAgentSessionHistoryManager,
|
|
1472
1473
|
Oe as ProductAgentTaskPageTitleController,
|
|
1473
|
-
|
|
1474
|
+
Te as canSubmitPersonalProductAgentMessage,
|
|
1474
1475
|
qe as createLocalStorageInteractionDecisionStorage,
|
|
1475
1476
|
S as createProductAgentQueryState,
|
|
1476
1477
|
Ce as createProductAgentTaskPageTitleDocument,
|
|
@@ -1482,7 +1483,7 @@ export {
|
|
|
1482
1483
|
w as normalizeProductAgentEntityPage,
|
|
1483
1484
|
se as readLocalStorageInteractionDecisions,
|
|
1484
1485
|
we as reconcileProductAgentSubmissionGate,
|
|
1485
|
-
|
|
1486
|
+
Ee as resolveProductAgentBillingPresentation,
|
|
1486
1487
|
Pe as resolveProductAgentComposerAction,
|
|
1487
1488
|
Ae as resolveProductAgentWidgetPresentation,
|
|
1488
1489
|
W as selectProductAgentQueryEntities
|