@iota-uz/sdk 0.4.43 → 0.4.44

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.
@@ -826,6 +826,11 @@ interface ChatSessionProps {
826
826
  headerSlot?: ReactNode;
827
827
  /** Custom welcome screen component (replaces default WelcomeContent) */
828
828
  welcomeSlot?: ReactNode;
829
+ /**
830
+ * Host-owned durable content rendered as part of the scrollable conversation
831
+ * history after persisted turns (for example, a workflow or task artifact).
832
+ */
833
+ historyArtifactSlot?: ReactNode;
829
834
  /** Custom logo for the header */
830
835
  logoSlot?: ReactNode;
831
836
  /** Custom action buttons for the header */
@@ -894,10 +899,12 @@ declare function ChatHeader({ session, onBack, readOnly, logoSlot, actionsSlot,
894
899
  interface MessageListProps {
895
900
  renderUserTurn?: (turn: ConversationTurn$1) => ReactNode;
896
901
  renderAssistantTurn?: (turn: ConversationTurn$1) => ReactNode;
902
+ /** Host-owned workflow/artifact placed in the scrollable conversation history. */
903
+ historyArtifactSlot?: ReactNode;
897
904
  thinkingVerbs?: string[];
898
905
  readOnly?: boolean;
899
906
  }
900
- declare function MessageList({ renderUserTurn, renderAssistantTurn, thinkingVerbs, readOnly }: MessageListProps): react_jsx_runtime.JSX.Element;
907
+ declare function MessageList({ renderUserTurn, renderAssistantTurn, historyArtifactSlot, thinkingVerbs, readOnly, }: MessageListProps): react_jsx_runtime.JSX.Element;
901
908
 
902
909
  interface UserMessageAvatarSlotProps {
903
910
  /** Default initials */
@@ -826,6 +826,11 @@ interface ChatSessionProps {
826
826
  headerSlot?: ReactNode;
827
827
  /** Custom welcome screen component (replaces default WelcomeContent) */
828
828
  welcomeSlot?: ReactNode;
829
+ /**
830
+ * Host-owned durable content rendered as part of the scrollable conversation
831
+ * history after persisted turns (for example, a workflow or task artifact).
832
+ */
833
+ historyArtifactSlot?: ReactNode;
829
834
  /** Custom logo for the header */
830
835
  logoSlot?: ReactNode;
831
836
  /** Custom action buttons for the header */
@@ -894,10 +899,12 @@ declare function ChatHeader({ session, onBack, readOnly, logoSlot, actionsSlot,
894
899
  interface MessageListProps {
895
900
  renderUserTurn?: (turn: ConversationTurn$1) => ReactNode;
896
901
  renderAssistantTurn?: (turn: ConversationTurn$1) => ReactNode;
902
+ /** Host-owned workflow/artifact placed in the scrollable conversation history. */
903
+ historyArtifactSlot?: ReactNode;
897
904
  thinkingVerbs?: string[];
898
905
  readOnly?: boolean;
899
906
  }
900
- declare function MessageList({ renderUserTurn, renderAssistantTurn, thinkingVerbs, readOnly }: MessageListProps): react_jsx_runtime.JSX.Element;
907
+ declare function MessageList({ renderUserTurn, renderAssistantTurn, historyArtifactSlot, thinkingVerbs, readOnly, }: MessageListProps): react_jsx_runtime.JSX.Element;
901
908
 
902
909
  interface UserMessageAvatarSlotProps {
903
910
  /** Default initials */
@@ -9568,7 +9568,13 @@ function StreamingBubble({ content, normalizedContent }) {
9568
9568
  ] })
9569
9569
  ] });
9570
9570
  }
9571
- function MessageList({ renderUserTurn, renderAssistantTurn, thinkingVerbs, readOnly }) {
9571
+ function MessageList({
9572
+ renderUserTurn,
9573
+ renderAssistantTurn,
9574
+ historyArtifactSlot,
9575
+ thinkingVerbs,
9576
+ readOnly
9577
+ }) {
9572
9578
  const { t } = useTranslation();
9573
9579
  const { session, currentSessionId, fetching } = useChatSession();
9574
9580
  const {
@@ -9614,6 +9620,7 @@ function MessageList({ renderUserTurn, renderAssistantTurn, thinkingVerbs, readO
9614
9620
  )
9615
9621
  ] }, turn.id);
9616
9622
  }),
9623
+ historyArtifactSlot && /* @__PURE__ */ jsx("div", { className: "min-w-0", "data-bichat-history-artifact": true, children: historyArtifactSlot }),
9617
9624
  isStreaming && streamingContent && /* @__PURE__ */ jsx(StreamingBubble, { content: streamingContent, normalizedContent: normalizedStreaming }),
9618
9625
  /* @__PURE__ */ jsx(AnimatePresence, { children: showEphemeral && /* @__PURE__ */ jsxs(
9619
9626
  motion.div,
@@ -12420,6 +12427,103 @@ function SessionMembersModal({ isOpen, sessionId, dataSource, onClose }) {
12420
12427
 
12421
12428
  // ui/src/bichat/components/StreamError.tsx
12422
12429
  init_useTranslation();
12430
+ var OPENAI_BILLING_URL = "https://platform.openai.com/settings/organization/billing/overview";
12431
+ var OPENAI_API_KEYS_URL = "https://platform.openai.com/api-keys";
12432
+ var OPENAI_STATUS_URL = "https://status.openai.com";
12433
+ function providerErrorPresentation(error) {
12434
+ if (error.includes("provider_billing_balance_exhausted")) {
12435
+ return {
12436
+ titleKey: "BiChat.StreamError.ProviderBalance.Title",
12437
+ descriptionKey: "BiChat.StreamError.ProviderBalance.Details",
12438
+ retryable: false,
12439
+ adminAction: true,
12440
+ action: {
12441
+ href: OPENAI_BILLING_URL,
12442
+ labelKey: "BiChat.StreamError.OpenBilling"
12443
+ }
12444
+ };
12445
+ }
12446
+ if (error.includes("provider_billing_") || error.includes("provider_quota_exhausted") || error.includes("insufficient_quota") || error.includes("credit_balance_exhausted")) {
12447
+ return {
12448
+ titleKey: "BiChat.StreamError.ProviderBilling.Title",
12449
+ descriptionKey: "BiChat.StreamError.ProviderBilling.Details",
12450
+ retryable: false,
12451
+ adminAction: true,
12452
+ action: {
12453
+ href: OPENAI_BILLING_URL,
12454
+ labelKey: "BiChat.StreamError.OpenBilling"
12455
+ }
12456
+ };
12457
+ }
12458
+ if (error.includes("provider_auth_") || error.includes("provider_ip_not_authorized")) {
12459
+ return {
12460
+ titleKey: "BiChat.StreamError.ProviderAuth.Title",
12461
+ descriptionKey: "BiChat.StreamError.ProviderAuth.Details",
12462
+ retryable: false,
12463
+ adminAction: true,
12464
+ action: {
12465
+ href: OPENAI_API_KEYS_URL,
12466
+ labelKey: "BiChat.StreamError.OpenAPIKeys"
12467
+ }
12468
+ };
12469
+ }
12470
+ if (error.includes("provider_permission_denied") || error.includes("provider_region_unsupported")) {
12471
+ return {
12472
+ titleKey: "BiChat.StreamError.ProviderAccess.Title",
12473
+ descriptionKey: "BiChat.StreamError.ProviderAccess.Details",
12474
+ retryable: false,
12475
+ adminAction: true
12476
+ };
12477
+ }
12478
+ if (error.includes("provider_rate_limited") || error.includes("provider_slow_down")) {
12479
+ return {
12480
+ titleKey: "BiChat.StreamError.ProviderRateLimit.Title",
12481
+ descriptionKey: "BiChat.StreamError.ProviderRateLimit.Details",
12482
+ retryable: true
12483
+ };
12484
+ }
12485
+ if (error.includes("provider_context_limit")) {
12486
+ return {
12487
+ titleKey: "BiChat.StreamError.ProviderContextLimit.Title",
12488
+ descriptionKey: "BiChat.StreamError.ProviderContextLimit.Details",
12489
+ retryable: false
12490
+ };
12491
+ }
12492
+ if (error.includes("provider_bad_request") || error.includes("provider_unprocessable") || error.includes("provider_not_found")) {
12493
+ return {
12494
+ titleKey: "BiChat.StreamError.ProviderRequest.Title",
12495
+ descriptionKey: "BiChat.StreamError.ProviderRequest.Details",
12496
+ retryable: false,
12497
+ adminAction: true
12498
+ };
12499
+ }
12500
+ if (error.includes("provider_timeout") || error.includes("provider_connection")) {
12501
+ return {
12502
+ titleKey: "BiChat.StreamError.ProviderConnection.Title",
12503
+ descriptionKey: "BiChat.StreamError.ProviderConnection.Details",
12504
+ retryable: true
12505
+ };
12506
+ }
12507
+ if (error.includes("provider_server_error") || error.includes("provider_overloaded") || error.includes("provider_response_failed") || error.includes("provider_conflict")) {
12508
+ return {
12509
+ titleKey: "BiChat.StreamError.ProviderUnavailable.Title",
12510
+ descriptionKey: "BiChat.StreamError.ProviderUnavailable.Details",
12511
+ retryable: true,
12512
+ action: {
12513
+ href: OPENAI_STATUS_URL,
12514
+ labelKey: "BiChat.StreamError.OpenStatus"
12515
+ }
12516
+ };
12517
+ }
12518
+ if (error.includes("provider_response_incomplete")) {
12519
+ return {
12520
+ titleKey: "BiChat.StreamError.ProviderIncomplete.Title",
12521
+ descriptionKey: "BiChat.StreamError.ProviderIncomplete.Details",
12522
+ retryable: true
12523
+ };
12524
+ }
12525
+ return null;
12526
+ }
12423
12527
  function StreamError({
12424
12528
  error,
12425
12529
  onRetry,
@@ -12428,6 +12532,8 @@ function StreamError({
12428
12532
  compact = false
12429
12533
  }) {
12430
12534
  const { t } = useTranslation();
12535
+ const normalizedError = error.toLowerCase();
12536
+ const providerError = providerErrorPresentation(normalizedError);
12431
12537
  return /* @__PURE__ */ jsxs(
12432
12538
  motion.div,
12433
12539
  {
@@ -12445,10 +12551,24 @@ function StreamError({
12445
12551
  }
12446
12552
  ) }),
12447
12553
  /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
12448
- /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-red-800 dark:text-red-200 leading-snug", children: t("BiChat.Error.Generic") }),
12449
- /* @__PURE__ */ jsx("p", { className: "mt-0.5 text-xs text-red-600/80 dark:text-red-400/70 break-words leading-relaxed", children: error }),
12554
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-red-800 dark:text-red-200 leading-snug", children: providerError ? t(providerError.titleKey) : t("BiChat.Error.Generic") }),
12555
+ /* @__PURE__ */ jsx("p", { className: "mt-0.5 text-xs text-red-600/80 dark:text-red-400/70 break-words leading-relaxed", children: providerError ? t(providerError.descriptionKey) : error }),
12556
+ providerError?.adminAction && /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs font-medium text-red-700 dark:text-red-300 leading-relaxed", children: t("BiChat.StreamError.AdminAction") }),
12450
12557
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mt-2", children: [
12451
- onRetry && /* @__PURE__ */ jsxs(
12558
+ providerError?.action && /* @__PURE__ */ jsxs(
12559
+ "a",
12560
+ {
12561
+ href: providerError.action.href,
12562
+ target: "_blank",
12563
+ rel: "noreferrer",
12564
+ className: "cursor-pointer inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-white bg-red-600 hover:bg-red-700 active:bg-red-800 dark:bg-red-700 dark:hover:bg-red-600 rounded-lg transition-colors shadow-sm",
12565
+ children: [
12566
+ /* @__PURE__ */ jsx(ArrowSquareOut, { className: "w-3.5 h-3.5" }),
12567
+ t(providerError.action.labelKey)
12568
+ ]
12569
+ }
12570
+ ),
12571
+ onRetry && providerError?.retryable !== false && /* @__PURE__ */ jsxs(
12452
12572
  "button",
12453
12573
  {
12454
12574
  onClick: onRetry,
@@ -12500,6 +12620,7 @@ function ChatSessionCore({
12500
12620
  className = "",
12501
12621
  headerSlot,
12502
12622
  welcomeSlot,
12623
+ historyArtifactSlot,
12503
12624
  logoSlot,
12504
12625
  actionsSlot,
12505
12626
  inputHeaderSlot,
@@ -12844,6 +12965,7 @@ function ChatSessionCore({
12844
12965
  {
12845
12966
  renderUserTurn,
12846
12967
  renderAssistantTurn,
12968
+ historyArtifactSlot,
12847
12969
  thinkingVerbs,
12848
12970
  readOnly: effectiveReadOnly
12849
12971
  }