@paymanai/payman-ask-sdk 1.2.8 → 1.2.9

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.
@@ -576,6 +576,16 @@ function ThinkingBlock({ text }) {
576
576
  isOpen && /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: ts.thinkingContent, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: ts.thinkingContentText, children: text }) })
577
577
  ] });
578
578
  }
579
+ var WORKFLOW_FAILED = "WORKFLOW_FAILED";
580
+ var STREAM_NOT_STARTED = "STREAM_NOT_STARTED";
581
+ function isFriendlyError(errorDetails) {
582
+ if (!errorDetails) return false;
583
+ return errorDetails === WORKFLOW_FAILED || errorDetails === STREAM_NOT_STARTED || errorDetails.includes(WORKFLOW_FAILED);
584
+ }
585
+ function looksLikeRawError(text) {
586
+ if (!text || text.length < 10) return false;
587
+ return text.includes("errorType=") || /failed:\s*\{/.test(text);
588
+ }
579
589
  function AgentMessage({
580
590
  message,
581
591
  animated = false,
@@ -593,7 +603,6 @@ function AgentMessage({
593
603
  const isStreaming = message.isStreaming ?? false;
594
604
  const hasSteps = !!message.steps && message.steps.length > 0;
595
605
  const hasTraceData = !!(message.tracingData || message.executionId) && !isStreaming;
596
- const isError = message.isError ?? (message.streamProgress === "error" || !!message.errorDetails);
597
606
  const isCancelled = message.isCancelled ?? false;
598
607
  const currentExecutingStepId = message.currentExecutingStepId;
599
608
  const [isStepsExpanded, setIsStepsExpanded] = React.useState(
@@ -609,6 +618,9 @@ function AgentMessage({
609
618
  const currentMessage = message.currentMessage;
610
619
  const rawContent = message.streamingContent || message.content || "";
611
620
  const content = rawContent.replace(/\\n/g, "\n");
621
+ const hasMeaningfulContent = content.length > 0 && !looksLikeRawError(content);
622
+ const completedWithNoContent = !isStreaming && !isCancelled && content.length === 0 && (message.streamProgress === "completed" || message.streamProgress === "error");
623
+ const isError = (isFriendlyError(message.errorDetails) || looksLikeRawError(content)) && !hasMeaningfulContent || completedWithNoContent;
612
624
  const activeThinkingText = message.activeThinkingText;
613
625
  const allThinkingText = message.allThinkingText;
614
626
  const currentStep = React.useMemo(
@@ -816,8 +828,9 @@ var s2 = reactNative.StyleSheet.create({
816
828
  alignItems: "center"
817
829
  },
818
830
  // Bubble column
819
- bubbleCol: { minWidth: 0, maxWidth: "80%", flexShrink: 1 },
820
- bubbleColCentered: { maxWidth: "85%" },
831
+ // Bubble column flex: 1 so it fills available width on mobile (still capped by maxWidth)
832
+ bubbleCol: { flex: 1, minWidth: 0, maxWidth: "92%", flexShrink: 1 },
833
+ bubbleColCentered: { maxWidth: "95%" },
821
834
  // Badge
822
835
  badgeWrap: { marginBottom: 6 },
823
836
  badge: {