@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.
@@ -9580,7 +9580,13 @@ function StreamingBubble({ content, normalizedContent }) {
9580
9580
  ] })
9581
9581
  ] });
9582
9582
  }
9583
- function MessageList({ renderUserTurn, renderAssistantTurn, thinkingVerbs, readOnly }) {
9583
+ function MessageList({
9584
+ renderUserTurn,
9585
+ renderAssistantTurn,
9586
+ historyArtifactSlot,
9587
+ thinkingVerbs,
9588
+ readOnly
9589
+ }) {
9584
9590
  const { t } = useTranslation();
9585
9591
  const { session, currentSessionId, fetching } = useChatSession();
9586
9592
  const {
@@ -9626,6 +9632,7 @@ function MessageList({ renderUserTurn, renderAssistantTurn, thinkingVerbs, readO
9626
9632
  )
9627
9633
  ] }, turn.id);
9628
9634
  }),
9635
+ historyArtifactSlot && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-0", "data-bichat-history-artifact": true, children: historyArtifactSlot }),
9629
9636
  isStreaming && streamingContent && /* @__PURE__ */ jsxRuntime.jsx(StreamingBubble, { content: streamingContent, normalizedContent: normalizedStreaming }),
9630
9637
  /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: showEphemeral && /* @__PURE__ */ jsxRuntime.jsxs(
9631
9638
  framerMotion.motion.div,
@@ -12432,6 +12439,103 @@ function SessionMembersModal({ isOpen, sessionId, dataSource, onClose }) {
12432
12439
 
12433
12440
  // ui/src/bichat/components/StreamError.tsx
12434
12441
  init_useTranslation();
12442
+ var OPENAI_BILLING_URL = "https://platform.openai.com/settings/organization/billing/overview";
12443
+ var OPENAI_API_KEYS_URL = "https://platform.openai.com/api-keys";
12444
+ var OPENAI_STATUS_URL = "https://status.openai.com";
12445
+ function providerErrorPresentation(error) {
12446
+ if (error.includes("provider_billing_balance_exhausted")) {
12447
+ return {
12448
+ titleKey: "BiChat.StreamError.ProviderBalance.Title",
12449
+ descriptionKey: "BiChat.StreamError.ProviderBalance.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_billing_") || error.includes("provider_quota_exhausted") || error.includes("insufficient_quota") || error.includes("credit_balance_exhausted")) {
12459
+ return {
12460
+ titleKey: "BiChat.StreamError.ProviderBilling.Title",
12461
+ descriptionKey: "BiChat.StreamError.ProviderBilling.Details",
12462
+ retryable: false,
12463
+ adminAction: true,
12464
+ action: {
12465
+ href: OPENAI_BILLING_URL,
12466
+ labelKey: "BiChat.StreamError.OpenBilling"
12467
+ }
12468
+ };
12469
+ }
12470
+ if (error.includes("provider_auth_") || error.includes("provider_ip_not_authorized")) {
12471
+ return {
12472
+ titleKey: "BiChat.StreamError.ProviderAuth.Title",
12473
+ descriptionKey: "BiChat.StreamError.ProviderAuth.Details",
12474
+ retryable: false,
12475
+ adminAction: true,
12476
+ action: {
12477
+ href: OPENAI_API_KEYS_URL,
12478
+ labelKey: "BiChat.StreamError.OpenAPIKeys"
12479
+ }
12480
+ };
12481
+ }
12482
+ if (error.includes("provider_permission_denied") || error.includes("provider_region_unsupported")) {
12483
+ return {
12484
+ titleKey: "BiChat.StreamError.ProviderAccess.Title",
12485
+ descriptionKey: "BiChat.StreamError.ProviderAccess.Details",
12486
+ retryable: false,
12487
+ adminAction: true
12488
+ };
12489
+ }
12490
+ if (error.includes("provider_rate_limited") || error.includes("provider_slow_down")) {
12491
+ return {
12492
+ titleKey: "BiChat.StreamError.ProviderRateLimit.Title",
12493
+ descriptionKey: "BiChat.StreamError.ProviderRateLimit.Details",
12494
+ retryable: true
12495
+ };
12496
+ }
12497
+ if (error.includes("provider_context_limit")) {
12498
+ return {
12499
+ titleKey: "BiChat.StreamError.ProviderContextLimit.Title",
12500
+ descriptionKey: "BiChat.StreamError.ProviderContextLimit.Details",
12501
+ retryable: false
12502
+ };
12503
+ }
12504
+ if (error.includes("provider_bad_request") || error.includes("provider_unprocessable") || error.includes("provider_not_found")) {
12505
+ return {
12506
+ titleKey: "BiChat.StreamError.ProviderRequest.Title",
12507
+ descriptionKey: "BiChat.StreamError.ProviderRequest.Details",
12508
+ retryable: false,
12509
+ adminAction: true
12510
+ };
12511
+ }
12512
+ if (error.includes("provider_timeout") || error.includes("provider_connection")) {
12513
+ return {
12514
+ titleKey: "BiChat.StreamError.ProviderConnection.Title",
12515
+ descriptionKey: "BiChat.StreamError.ProviderConnection.Details",
12516
+ retryable: true
12517
+ };
12518
+ }
12519
+ if (error.includes("provider_server_error") || error.includes("provider_overloaded") || error.includes("provider_response_failed") || error.includes("provider_conflict")) {
12520
+ return {
12521
+ titleKey: "BiChat.StreamError.ProviderUnavailable.Title",
12522
+ descriptionKey: "BiChat.StreamError.ProviderUnavailable.Details",
12523
+ retryable: true,
12524
+ action: {
12525
+ href: OPENAI_STATUS_URL,
12526
+ labelKey: "BiChat.StreamError.OpenStatus"
12527
+ }
12528
+ };
12529
+ }
12530
+ if (error.includes("provider_response_incomplete")) {
12531
+ return {
12532
+ titleKey: "BiChat.StreamError.ProviderIncomplete.Title",
12533
+ descriptionKey: "BiChat.StreamError.ProviderIncomplete.Details",
12534
+ retryable: true
12535
+ };
12536
+ }
12537
+ return null;
12538
+ }
12435
12539
  function StreamError({
12436
12540
  error,
12437
12541
  onRetry,
@@ -12440,6 +12544,8 @@ function StreamError({
12440
12544
  compact = false
12441
12545
  }) {
12442
12546
  const { t } = useTranslation();
12547
+ const normalizedError = error.toLowerCase();
12548
+ const providerError = providerErrorPresentation(normalizedError);
12443
12549
  return /* @__PURE__ */ jsxRuntime.jsxs(
12444
12550
  framerMotion.motion.div,
12445
12551
  {
@@ -12457,10 +12563,24 @@ function StreamError({
12457
12563
  }
12458
12564
  ) }),
12459
12565
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
12460
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-red-800 dark:text-red-200 leading-snug", children: t("BiChat.Error.Generic") }),
12461
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-0.5 text-xs text-red-600/80 dark:text-red-400/70 break-words leading-relaxed", children: error }),
12566
+ /* @__PURE__ */ jsxRuntime.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") }),
12567
+ /* @__PURE__ */ jsxRuntime.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 }),
12568
+ providerError?.adminAction && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-xs font-medium text-red-700 dark:text-red-300 leading-relaxed", children: t("BiChat.StreamError.AdminAction") }),
12462
12569
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mt-2", children: [
12463
- onRetry && /* @__PURE__ */ jsxRuntime.jsxs(
12570
+ providerError?.action && /* @__PURE__ */ jsxRuntime.jsxs(
12571
+ "a",
12572
+ {
12573
+ href: providerError.action.href,
12574
+ target: "_blank",
12575
+ rel: "noreferrer",
12576
+ 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",
12577
+ children: [
12578
+ /* @__PURE__ */ jsxRuntime.jsx(react.ArrowSquareOut, { className: "w-3.5 h-3.5" }),
12579
+ t(providerError.action.labelKey)
12580
+ ]
12581
+ }
12582
+ ),
12583
+ onRetry && providerError?.retryable !== false && /* @__PURE__ */ jsxRuntime.jsxs(
12464
12584
  "button",
12465
12585
  {
12466
12586
  onClick: onRetry,
@@ -12512,6 +12632,7 @@ function ChatSessionCore({
12512
12632
  className = "",
12513
12633
  headerSlot,
12514
12634
  welcomeSlot,
12635
+ historyArtifactSlot,
12515
12636
  logoSlot,
12516
12637
  actionsSlot,
12517
12638
  inputHeaderSlot,
@@ -12856,6 +12977,7 @@ function ChatSessionCore({
12856
12977
  {
12857
12978
  renderUserTurn,
12858
12979
  renderAssistantTurn,
12980
+ historyArtifactSlot,
12859
12981
  thinkingVerbs,
12860
12982
  readOnly: effectiveReadOnly
12861
12983
  }