@webless/agent 0.10.1 → 0.10.2

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/embed.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  resetAgentPanel,
10
10
  resolveAgentRuntimeConfig,
11
11
  submitAgentPanel
12
- } from "./chunk-ZYTNNMZS.js";
12
+ } from "./chunk-Q7H4RRS4.js";
13
13
 
14
14
  // src/embed/mount.tsx
15
15
  import { createRoot } from "react-dom/client";
package/dist/react.cjs CHANGED
@@ -4946,7 +4946,7 @@ function MessageBubble({
4946
4946
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4947
4947
  import_streamdown.Streamdown,
4948
4948
  {
4949
- animated: isStreaming,
4949
+ animated: false,
4950
4950
  caret: "circle",
4951
4951
  className: "message-bubble__markdown",
4952
4952
  controls: false,
@@ -6454,14 +6454,21 @@ function AgentRail({
6454
6454
  const activeVisitorToolInput = [...visitorToolResults].reverse().find((result) => result.kind === "input");
6455
6455
  const visibleVisitorToolResults = activeVisitorToolInput ? [activeVisitorToolInput] : visitorToolResults;
6456
6456
  const activityActive = state.toolSteps.some((step) => step.state === "active");
6457
- const showActivity = state.toolSteps.length > 0 && pendingInputRequests.length === 0 && !state.pendingOffer && activityActive;
6457
+ const showActivity = state.toolSteps.length > 0 && pendingInputRequests.length === 0 && !state.pendingOffer && (activityActive || isBusy && !state.streamingText);
6458
+ const activitySteps = activityActive || !isBusy || state.streamingText ? state.toolSteps : [...state.toolSteps, {
6459
+ id: "preparing-answer",
6460
+ kind: "tool",
6461
+ label: "Preparing your answer",
6462
+ detail: "Preparing your answer",
6463
+ state: "active"
6464
+ }];
6458
6465
  const hasVisitorMessages2 = state.messages.some(
6459
6466
  (message) => message.role === "visitor"
6460
6467
  );
6461
6468
  const hasAgentResponseAfterVisitor = state.messages.some(
6462
6469
  (message) => message.role === "agent" && message.id !== "greeting"
6463
6470
  );
6464
- const showDisclaimerLabel = Boolean(resolvedDisclaimerLabel) && hasVisitorMessages2 && (hasAgentResponseAfterVisitor || state.phase === "streaming" && Boolean(state.streamingText));
6471
+ const showDisclaimerLabel = Boolean(resolvedDisclaimerLabel) && hasVisitorMessages2 && (hasAgentResponseAfterVisitor || Boolean(state.streamingText));
6465
6472
  const showIdleFollowUps = !hasVisitorMessages2 && state.followUps.length > 0;
6466
6473
  const greeting = state.messages.find(
6467
6474
  (message) => message.role === "agent" && message.id === "greeting"
@@ -6484,11 +6491,11 @@ function AgentRail({
6484
6491
  }
6485
6492
  const lastIsAgent = lastMessage?.role === "agent";
6486
6493
  const showMessageActions = state.phase === "complete" && lastIsAgent && hasVisitorMessages2 && Boolean(hideToolCardFences(lastMessage.text).trim());
6487
- const streamingMessage = state.phase === "streaming" && state.streamingText && !lastIsAgent ? {
6494
+ const streamingMessage = state.streamingText && !lastIsAgent ? {
6488
6495
  createdAt: 0,
6489
6496
  id: "streaming-response",
6490
6497
  role: "agent",
6491
- streaming: true,
6498
+ streaming: isBusy,
6492
6499
  text: state.streamingText,
6493
6500
  searchResults: (state.toolResults ?? []).filter(
6494
6501
  (result) => result.kind === "search"
@@ -6500,6 +6507,7 @@ function AgentRail({
6500
6507
  streaming: false,
6501
6508
  text: "Pick a date and time that works for you."
6502
6509
  } : null;
6510
+ const transcriptMessages = streamingMessage ? [...visibleMessages, streamingMessage] : visibleMessages;
6503
6511
  const bookingReadyText = state.streamingText || (lastIsAgent && lastMessage?.role === "agent" ? lastMessage.text : "");
6504
6512
  const waitingForBooking = !state.pendingOffer && looksLikeBookingReady(bookingReadyText) && (state.phase === "thinking" || state.phase === "running-tools" || state.phase === "streaming");
6505
6513
  const lastAgentText = lastIsAgent && lastMessage?.role === "agent" ? lastMessage.text : "";
@@ -6732,7 +6740,7 @@ function AgentRail({
6732
6740
  brandLabel: resolvedBrandLabel,
6733
6741
  brandLogoUrl: showBrandLogo ? resolvedBrandLogoUrl : void 0,
6734
6742
  failed: state.phase === "error",
6735
- steps: state.toolSteps
6743
+ steps: activitySteps
6736
6744
  }
6737
6745
  ) : null,
6738
6746
  visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
@@ -6753,7 +6761,7 @@ function AgentRail({
6753
6761
  request.requestId
6754
6762
  ))
6755
6763
  ] }) : null,
6756
- visibleMessages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
6764
+ transcriptMessages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
6757
6765
  "div",
6758
6766
  {
6759
6767
  ref: index === lastVisitorIndex + 1 ? responseRef : void 0,
@@ -6766,7 +6774,7 @@ function AgentRail({
6766
6774
  message,
6767
6775
  bookingDisabled: isBusy,
6768
6776
  brandLogoUrl: showBrandLogo ? resolvedBrandLogoUrl : void 0,
6769
- offer: index === lastAgentIndex ? state.pendingOffer : void 0,
6777
+ offer: index === transcriptMessages.length - 1 ? state.pendingOffer : void 0,
6770
6778
  onBook
6771
6779
  }
6772
6780
  ),
@@ -6789,7 +6797,7 @@ function AgentRail({
6789
6797
  brandLabel: resolvedBrandLabel,
6790
6798
  brandLogoUrl: showBrandLogo ? resolvedBrandLogoUrl : void 0,
6791
6799
  failed: state.phase === "error",
6792
- steps: state.toolSteps
6800
+ steps: activitySteps
6793
6801
  }
6794
6802
  ) : null,
6795
6803
  visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
@@ -6812,18 +6820,8 @@ function AgentRail({
6812
6820
  ] }) : null
6813
6821
  ]
6814
6822
  },
6815
- message.id
6823
+ message.role === "agent" && transcriptMessages[index - 1]?.role === "visitor" ? `answer-${transcriptMessages[index - 1]?.id}` : message.id
6816
6824
  )),
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
6825
  waitingForBooking ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BookingCardLoader, {}) : null,
6828
6826
  state.error ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("section", { className: "agent-rail__error", role: "alert", children: [
6829
6827
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { children: [