@webless/agent 0.10.1 → 0.10.3
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/{chunk-ZYTNNMZS.js → chunk-74CSWSC5.js} +57 -50
- package/dist/chunk-74CSWSC5.js.map +1 -0
- package/dist/embed.cjs +56 -49
- package/dist/embed.cjs.map +1 -1
- package/dist/embed.css +86 -130
- package/dist/embed.css.map +1 -1
- package/dist/embed.js +1 -1
- package/dist/react.cjs +56 -49
- package/dist/react.cjs.map +1 -1
- package/dist/react.css +86 -130
- package/dist/react.css.map +1 -1
- package/dist/react.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-ZYTNNMZS.js.map +0 -1
package/dist/embed.js
CHANGED
package/dist/react.cjs
CHANGED
|
@@ -3788,6 +3788,7 @@ function joinLabels(labels) {
|
|
|
3788
3788
|
if (labels.length === 2) return `${labels[0]} and ${labels[1]}`;
|
|
3789
3789
|
return `${labels.slice(0, -1).join(", ")} and ${labels.at(-1) ?? ""}`;
|
|
3790
3790
|
}
|
|
3791
|
+
var AGENT_SOFT_REVIEW_STATUS = "Reviewing your details to find the best approach";
|
|
3791
3792
|
function workSummary(steps, failed, brandLabel) {
|
|
3792
3793
|
const activeTool = [...steps].reverse().find(
|
|
3793
3794
|
(step) => step.kind === "tool" && step.state === "active"
|
|
@@ -3802,7 +3803,7 @@ function workSummary(steps, failed, brandLabel) {
|
|
|
3802
3803
|
)}`;
|
|
3803
3804
|
const active = [...steps].reverse().find((step) => step.state === "active");
|
|
3804
3805
|
if (active?.kind === "search") return "Searching this site";
|
|
3805
|
-
if (active) return
|
|
3806
|
+
if (active) return AGENT_SOFT_REVIEW_STATUS;
|
|
3806
3807
|
if (failed) return "Couldn\u2019t complete this request";
|
|
3807
3808
|
const hasError = steps.some((step) => step.state === "error");
|
|
3808
3809
|
const specialists = steps.filter(
|
|
@@ -3896,23 +3897,32 @@ function AgentActivityBubble({
|
|
|
3896
3897
|
onRetryStep
|
|
3897
3898
|
}) {
|
|
3898
3899
|
const active = steps.some((step) => step.state === "active");
|
|
3900
|
+
const statusText = workSummary(steps, failed, brandLabel);
|
|
3901
|
+
const softReview = statusText === AGENT_SOFT_REVIEW_STATUS;
|
|
3899
3902
|
const receiptId = steps.map((step) => step.id).join(":");
|
|
3900
3903
|
const [expandedReceiptId, setExpandedReceiptId] = (0, import_react5.useState)(
|
|
3901
3904
|
null
|
|
3902
3905
|
);
|
|
3903
3906
|
const detailsOpen = !active && expandedReceiptId === receiptId;
|
|
3904
3907
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("article", { className: "agent-activity-bubble", children: [
|
|
3905
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
{
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3908
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
3909
|
+
"p",
|
|
3910
|
+
{
|
|
3911
|
+
className: `agent-activity-bubble__status${softReview ? " agent-activity-bubble__status--soft" : ""}`,
|
|
3912
|
+
"aria-live": "polite",
|
|
3913
|
+
children: [
|
|
3914
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
3915
|
+
"span",
|
|
3916
|
+
{
|
|
3917
|
+
className: `agent-activity-bubble__pulse${active ? " is-active" : failed ? " is-error" : ""}`,
|
|
3918
|
+
"aria-hidden": "true"
|
|
3919
|
+
}
|
|
3920
|
+
),
|
|
3921
|
+
statusText,
|
|
3922
|
+
active ? "..." : ""
|
|
3923
|
+
]
|
|
3924
|
+
}
|
|
3925
|
+
),
|
|
3916
3926
|
!active ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "agent-activity-bubble__details", children: [
|
|
3917
3927
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
3918
3928
|
"button",
|
|
@@ -4134,7 +4144,6 @@ function Composer({
|
|
|
4134
4144
|
if (form && form.id !== draft.form?.id) setDraft(createDraft(form));
|
|
4135
4145
|
const savedForm = allowFormResume && !draft.submitted ? draft.form : null;
|
|
4136
4146
|
const activeForm = !disabled && draft.expanded ? savedForm : null;
|
|
4137
|
-
const hasDraft = Object.values(draft.values).some((value2) => value2.trim());
|
|
4138
4147
|
const canSend = !disabled && Boolean(value.trim() || activeForm);
|
|
4139
4148
|
(0, import_react8.useEffect)(() => {
|
|
4140
4149
|
if (activeForm) firstFieldRef.current?.focus();
|
|
@@ -4250,14 +4259,14 @@ function Composer({
|
|
|
4250
4259
|
onSubmit: handleSubmit,
|
|
4251
4260
|
children: [
|
|
4252
4261
|
savedForm ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "composer__resume", children: [
|
|
4253
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children:
|
|
4262
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "Share your details and we'll reach out shortly" }),
|
|
4254
4263
|
!activeForm ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4255
4264
|
"button",
|
|
4256
4265
|
{
|
|
4257
4266
|
type: "button",
|
|
4258
4267
|
disabled,
|
|
4259
4268
|
onClick: () => setDraft((current) => ({ ...current, expanded: true })),
|
|
4260
|
-
children:
|
|
4269
|
+
children: "Request follow-up"
|
|
4261
4270
|
}
|
|
4262
4271
|
) : null
|
|
4263
4272
|
] }) : null,
|
|
@@ -4946,7 +4955,7 @@ function MessageBubble({
|
|
|
4946
4955
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4947
4956
|
import_streamdown.Streamdown,
|
|
4948
4957
|
{
|
|
4949
|
-
animated:
|
|
4958
|
+
animated: false,
|
|
4950
4959
|
caret: "circle",
|
|
4951
4960
|
className: "message-bubble__markdown",
|
|
4952
4961
|
controls: false,
|
|
@@ -6454,14 +6463,21 @@ function AgentRail({
|
|
|
6454
6463
|
const activeVisitorToolInput = [...visitorToolResults].reverse().find((result) => result.kind === "input");
|
|
6455
6464
|
const visibleVisitorToolResults = activeVisitorToolInput ? [activeVisitorToolInput] : visitorToolResults;
|
|
6456
6465
|
const activityActive = state.toolSteps.some((step) => step.state === "active");
|
|
6457
|
-
const showActivity = state.toolSteps.length > 0 && pendingInputRequests.length === 0 && !state.pendingOffer && activityActive;
|
|
6466
|
+
const showActivity = state.toolSteps.length > 0 && pendingInputRequests.length === 0 && !state.pendingOffer && (activityActive || isBusy && !state.streamingText);
|
|
6467
|
+
const activitySteps = activityActive || !isBusy || state.streamingText ? state.toolSteps : [...state.toolSteps, {
|
|
6468
|
+
id: "preparing-answer",
|
|
6469
|
+
kind: "tool",
|
|
6470
|
+
label: "Preparing your answer",
|
|
6471
|
+
detail: "Preparing your answer",
|
|
6472
|
+
state: "active"
|
|
6473
|
+
}];
|
|
6458
6474
|
const hasVisitorMessages2 = state.messages.some(
|
|
6459
6475
|
(message) => message.role === "visitor"
|
|
6460
6476
|
);
|
|
6461
6477
|
const hasAgentResponseAfterVisitor = state.messages.some(
|
|
6462
6478
|
(message) => message.role === "agent" && message.id !== "greeting"
|
|
6463
6479
|
);
|
|
6464
|
-
const showDisclaimerLabel = Boolean(resolvedDisclaimerLabel) && hasVisitorMessages2 && (hasAgentResponseAfterVisitor ||
|
|
6480
|
+
const showDisclaimerLabel = Boolean(resolvedDisclaimerLabel) && hasVisitorMessages2 && (hasAgentResponseAfterVisitor || Boolean(state.streamingText));
|
|
6465
6481
|
const showIdleFollowUps = !hasVisitorMessages2 && state.followUps.length > 0;
|
|
6466
6482
|
const greeting = state.messages.find(
|
|
6467
6483
|
(message) => message.role === "agent" && message.id === "greeting"
|
|
@@ -6484,11 +6500,11 @@ function AgentRail({
|
|
|
6484
6500
|
}
|
|
6485
6501
|
const lastIsAgent = lastMessage?.role === "agent";
|
|
6486
6502
|
const showMessageActions = state.phase === "complete" && lastIsAgent && hasVisitorMessages2 && Boolean(hideToolCardFences(lastMessage.text).trim());
|
|
6487
|
-
const streamingMessage = state.
|
|
6503
|
+
const streamingMessage = state.streamingText && !lastIsAgent ? {
|
|
6488
6504
|
createdAt: 0,
|
|
6489
6505
|
id: "streaming-response",
|
|
6490
6506
|
role: "agent",
|
|
6491
|
-
streaming:
|
|
6507
|
+
streaming: isBusy,
|
|
6492
6508
|
text: state.streamingText,
|
|
6493
6509
|
searchResults: (state.toolResults ?? []).filter(
|
|
6494
6510
|
(result) => result.kind === "search"
|
|
@@ -6500,6 +6516,7 @@ function AgentRail({
|
|
|
6500
6516
|
streaming: false,
|
|
6501
6517
|
text: "Pick a date and time that works for you."
|
|
6502
6518
|
} : null;
|
|
6519
|
+
const transcriptMessages = streamingMessage ? [...visibleMessages, streamingMessage] : visibleMessages;
|
|
6503
6520
|
const bookingReadyText = state.streamingText || (lastIsAgent && lastMessage?.role === "agent" ? lastMessage.text : "");
|
|
6504
6521
|
const waitingForBooking = !state.pendingOffer && looksLikeBookingReady(bookingReadyText) && (state.phase === "thinking" || state.phase === "running-tools" || state.phase === "streaming");
|
|
6505
6522
|
const lastAgentText = lastIsAgent && lastMessage?.role === "agent" ? lastMessage.text : "";
|
|
@@ -6732,7 +6749,7 @@ function AgentRail({
|
|
|
6732
6749
|
brandLabel: resolvedBrandLabel,
|
|
6733
6750
|
brandLogoUrl: showBrandLogo ? resolvedBrandLogoUrl : void 0,
|
|
6734
6751
|
failed: state.phase === "error",
|
|
6735
|
-
steps:
|
|
6752
|
+
steps: activitySteps
|
|
6736
6753
|
}
|
|
6737
6754
|
) : null,
|
|
6738
6755
|
visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
@@ -6753,7 +6770,7 @@ function AgentRail({
|
|
|
6753
6770
|
request.requestId
|
|
6754
6771
|
))
|
|
6755
6772
|
] }) : null,
|
|
6756
|
-
|
|
6773
|
+
transcriptMessages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
6757
6774
|
"div",
|
|
6758
6775
|
{
|
|
6759
6776
|
ref: index === lastVisitorIndex + 1 ? responseRef : void 0,
|
|
@@ -6766,7 +6783,7 @@ function AgentRail({
|
|
|
6766
6783
|
message,
|
|
6767
6784
|
bookingDisabled: isBusy,
|
|
6768
6785
|
brandLogoUrl: showBrandLogo ? resolvedBrandLogoUrl : void 0,
|
|
6769
|
-
offer: index ===
|
|
6786
|
+
offer: index === transcriptMessages.length - 1 ? state.pendingOffer : void 0,
|
|
6770
6787
|
onBook
|
|
6771
6788
|
}
|
|
6772
6789
|
),
|
|
@@ -6789,7 +6806,7 @@ function AgentRail({
|
|
|
6789
6806
|
brandLabel: resolvedBrandLabel,
|
|
6790
6807
|
brandLogoUrl: showBrandLogo ? resolvedBrandLogoUrl : void 0,
|
|
6791
6808
|
failed: state.phase === "error",
|
|
6792
|
-
steps:
|
|
6809
|
+
steps: activitySteps
|
|
6793
6810
|
}
|
|
6794
6811
|
) : null,
|
|
6795
6812
|
visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
@@ -6812,18 +6829,8 @@ function AgentRail({
|
|
|
6812
6829
|
] }) : null
|
|
6813
6830
|
]
|
|
6814
6831
|
},
|
|
6815
|
-
message.id
|
|
6832
|
+
message.role === "agent" && transcriptMessages[index - 1]?.role === "visitor" ? `answer-${transcriptMessages[index - 1]?.id}` : message.id
|
|
6816
6833
|
)),
|
|
6817
|
-
streamingMessage ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { ref: responseRef, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6818
|
-
MessageBubble,
|
|
6819
|
-
{
|
|
6820
|
-
message: streamingMessage,
|
|
6821
|
-
bookingDisabled: isBusy,
|
|
6822
|
-
brandLogoUrl: showBrandLogo ? resolvedBrandLogoUrl : void 0,
|
|
6823
|
-
offer: state.pendingOffer,
|
|
6824
|
-
onBook
|
|
6825
|
-
}
|
|
6826
|
-
) }) : null,
|
|
6827
6834
|
waitingForBooking ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BookingCardLoader, {}) : null,
|
|
6828
6835
|
state.error ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("section", { className: "agent-rail__error", role: "alert", children: [
|
|
6829
6836
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { children: [
|
|
@@ -7067,7 +7074,11 @@ function AssistEdgeTab({
|
|
|
7067
7074
|
...brandForeground ? { "--as-visitor-text": brandForeground } : {},
|
|
7068
7075
|
...resolvedBorderColor ? { "--as-border": resolvedBorderColor } : {},
|
|
7069
7076
|
...fontFamily ? { "--as-font-display": fontFamily } : {},
|
|
7070
|
-
...pill ? {
|
|
7077
|
+
...pill ? {
|
|
7078
|
+
"--as-surface": "#ffffff",
|
|
7079
|
+
"--as-text": "#171717",
|
|
7080
|
+
backgroundColor: "#ffffff"
|
|
7081
|
+
} : resolvedSurfaceColor ? { "--as-surface": resolvedSurfaceColor } : {},
|
|
7071
7082
|
...!pill && resolvedTextColor ? { "--as-text": resolvedTextColor } : {},
|
|
7072
7083
|
colorScheme: chromeScheme
|
|
7073
7084
|
};
|
|
@@ -7084,23 +7095,19 @@ function AssistEdgeTab({
|
|
|
7084
7095
|
onClick: onOpen,
|
|
7085
7096
|
children: [
|
|
7086
7097
|
pill ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
7087
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.
|
|
7098
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
7088
7099
|
"span",
|
|
7089
7100
|
{
|
|
7090
7101
|
className: `assist-edge-tab__mark assist-edge-tab__mark--chip${mobile ? " assist-edge-tab__mark--mobile" : ""}`,
|
|
7091
7102
|
"aria-hidden": "true",
|
|
7092
|
-
children:
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
},
|
|
7101
|
-
markSourceKey
|
|
7102
|
-
)
|
|
7103
|
-
]
|
|
7103
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
7104
|
+
TabMarkIcon,
|
|
7105
|
+
{
|
|
7106
|
+
customIconUrl,
|
|
7107
|
+
logoUrl
|
|
7108
|
+
},
|
|
7109
|
+
markSourceKey
|
|
7110
|
+
)
|
|
7104
7111
|
}
|
|
7105
7112
|
),
|
|
7106
7113
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "assist-edge-tab__text", children: [
|