@8wave/ai-elements 0.104.0 → 0.105.0-beta.1

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.
Files changed (125) hide show
  1. package/dist/_chunks/{Agent-DG4nPG72.js → Agent-VhugusRf.js} +2 -2
  2. package/dist/_chunks/Agent-VhugusRf.js.map +1 -0
  3. package/dist/_chunks/{Document-DXkvvAnt.js → Document-DjNrISX1.js} +2 -2
  4. package/dist/_chunks/{Document-DXkvvAnt.js.map → Document-DjNrISX1.js.map} +1 -1
  5. package/dist/_chunks/{Media-3Mo4NRj7.js → Media-hjgDyEMr.js} +2 -2
  6. package/dist/_chunks/Media-hjgDyEMr.js.map +1 -0
  7. package/dist/_chunks/{PkStreamingMarkdown-YKd9F3xU.js → PkStreamingMarkdown-B4eMb97I.js} +2 -2
  8. package/dist/_chunks/{PkStreamingMarkdown-YKd9F3xU.js.map → PkStreamingMarkdown-B4eMb97I.js.map} +1 -1
  9. package/dist/_chunks/{PkToolRequestGeolocation-sf6LpUN_.js → PkToolRequestGeolocation-Bp-D2nDb.js} +3 -3
  10. package/{dist-vue/_chunks/PkToolRequestGeolocation-BdX5DzEN.js.map → dist/_chunks/PkToolRequestGeolocation-Bp-D2nDb.js.map} +1 -1
  11. package/dist/_chunks/{PkToolRequestOAuthConnection-BB8mlQit.js → PkToolRequestOAuthConnection-CjjyDj9A.js} +3 -3
  12. package/dist/_chunks/{PkToolRequestOAuthConnection-BB8mlQit.js.map → PkToolRequestOAuthConnection-CjjyDj9A.js.map} +1 -1
  13. package/dist/_chunks/{PkToolShowArtifact-54saXXCe.js → PkToolShowArtifact-Dl8f7Q7q.js} +2 -2
  14. package/dist/_chunks/{PkToolShowArtifact-54saXXCe.js.map → PkToolShowArtifact-Dl8f7Q7q.js.map} +1 -1
  15. package/dist/_chunks/{PkToolShowCalendarEvent-B_HPVUDk.js → PkToolShowCalendarEvent-B_QmZrlZ.js} +2 -2
  16. package/dist/_chunks/{PkToolShowCalendarEvent-B_HPVUDk.js.map → PkToolShowCalendarEvent-B_QmZrlZ.js.map} +1 -1
  17. package/dist/_chunks/{PkToolShowContactForm-BtcNCixq.js → PkToolShowContactForm-CXE0485W.js} +14 -14
  18. package/dist/_chunks/{PkToolShowContactForm-BtcNCixq.js.map → PkToolShowContactForm-CXE0485W.js.map} +1 -1
  19. package/dist/_chunks/{PkToolShowDiagram-cA64c2_N.js → PkToolShowDiagram-D-TyCkCB.js} +2 -2
  20. package/dist/_chunks/{PkToolShowDiagram-cA64c2_N.js.map → PkToolShowDiagram-D-TyCkCB.js.map} +1 -1
  21. package/dist/_chunks/{PkToolShowForm-DdBAG0Qs.js → PkToolShowForm-BzaibKAz.js} +101 -115
  22. package/dist/_chunks/PkToolShowForm-BzaibKAz.js.map +1 -0
  23. package/dist/_chunks/{PkToolShowSources-0qudS-bu.js → PkToolShowSources-CoTIoupP.js} +3 -3
  24. package/dist/_chunks/{PkToolShowSources-0qudS-bu.js.map → PkToolShowSources-CoTIoupP.js.map} +1 -1
  25. package/dist/_chunks/{PkToolShowSuggestedReply-B2IB6ioR.js → PkToolShowSuggestedReply-DA2Bi7k4.js} +2 -2
  26. package/dist/_chunks/{PkToolShowSuggestedReply-B2IB6ioR.js.map → PkToolShowSuggestedReply-DA2Bi7k4.js.map} +1 -1
  27. package/dist/_chunks/{PkToolShowWeather-Bl3Yoscl.js → PkToolShowWeather-ChDHtOLz.js} +2 -2
  28. package/dist/_chunks/{PkToolShowWeather-Bl3Yoscl.js.map → PkToolShowWeather-ChDHtOLz.js.map} +1 -1
  29. package/dist/_chunks/{browser-DuzNfJq0.js → browser-BXy4OnXA.js} +804 -779
  30. package/dist/_chunks/browser-BXy4OnXA.js.map +1 -0
  31. package/dist/_chunks/index.es-CnpsLhp_.js +1006 -0
  32. package/dist/_chunks/index.es-CnpsLhp_.js.map +1 -0
  33. package/dist/_chunks/utils-DtJdKlnF.js +185 -0
  34. package/dist/_chunks/utils-DtJdKlnF.js.map +1 -0
  35. package/dist/_chunks/{vue-i18n-_ouwlDGE.js → vue-i18n-C3J36GV4.js} +2 -2
  36. package/dist/_chunks/{vue-i18n-_ouwlDGE.js.map → vue-i18n-C3J36GV4.js.map} +1 -1
  37. package/dist/_chunks/{web-DnPxEADy.js → web-CzR5jWfC.js} +46 -45
  38. package/dist/_chunks/{web-DnPxEADy.js.map → web-CzR5jWfC.js.map} +1 -1
  39. package/dist/ai-elements.es.js +2100 -2159
  40. package/dist/ai-elements.es.js.map +1 -1
  41. package/dist-vue/PkChatbot.js +1 -1
  42. package/dist-vue/PkChatbotMessages.js +1 -1
  43. package/dist-vue/PkChatbotStepPayload.js +1 -1
  44. package/dist-vue/PkChatbotStepToolDetail.js +1 -1
  45. package/dist-vue/PkChatbotSteps.js +1 -1
  46. package/dist-vue/PkChatbotViewChat.js +1 -1
  47. package/dist-vue/PkChatbotViewConversations.js +1 -1
  48. package/dist-vue/PkChatbotViewFiles.js +1 -1
  49. package/dist-vue/PkChatbotViewProfile.js +1 -1
  50. package/dist-vue/_chunks/{Agent-gCuDMxHN.js → Agent-CpIgGdU4.js} +2 -2
  51. package/dist-vue/_chunks/Agent-CpIgGdU4.js.map +1 -0
  52. package/dist-vue/_chunks/{Document-iH61Cw06.js → Document-CiaGPYTR.js} +2 -2
  53. package/dist-vue/_chunks/{Document-iH61Cw06.js.map → Document-CiaGPYTR.js.map} +1 -1
  54. package/dist-vue/_chunks/{PkChatbot-Bg9oercD.js → PkChatbot-xmjKbljL.js} +7 -7
  55. package/dist-vue/_chunks/{PkChatbot-Bg9oercD.js.map → PkChatbot-xmjKbljL.js.map} +1 -1
  56. package/dist-vue/_chunks/{PkChatbotMessages-DUQxuYaG.js → PkChatbotMessages-tHQ2JQrb.js} +75 -75
  57. package/dist-vue/_chunks/{PkChatbotMessages-DUQxuYaG.js.map → PkChatbotMessages-tHQ2JQrb.js.map} +1 -1
  58. package/dist-vue/_chunks/{PkChatbotStepPayload-hCmy4XG9.js → PkChatbotStepPayload-BtsnkJIV.js} +2 -2
  59. package/dist-vue/_chunks/{PkChatbotStepPayload-hCmy4XG9.js.map → PkChatbotStepPayload-BtsnkJIV.js.map} +1 -1
  60. package/dist-vue/_chunks/{PkChatbotStepToolDetail-B0WU0HcD.js → PkChatbotStepToolDetail-CCa95eBO.js} +116 -101
  61. package/dist-vue/_chunks/PkChatbotStepToolDetail-CCa95eBO.js.map +1 -0
  62. package/dist-vue/_chunks/PkChatbotSteps-CPBzs7Gi.js +180 -0
  63. package/dist-vue/_chunks/PkChatbotSteps-CPBzs7Gi.js.map +1 -0
  64. package/dist-vue/_chunks/{PkChatbotViewChat-YwjWNoqf.js → PkChatbotViewChat-CdiPjQLq.js} +6 -6
  65. package/dist-vue/_chunks/{PkChatbotViewChat-YwjWNoqf.js.map → PkChatbotViewChat-CdiPjQLq.js.map} +1 -1
  66. package/dist-vue/_chunks/{PkChatbotViewConversations-vo57eSwy.js → PkChatbotViewConversations-BP-NJvlK.js} +2 -2
  67. package/dist-vue/_chunks/{PkChatbotViewConversations-vo57eSwy.js.map → PkChatbotViewConversations-BP-NJvlK.js.map} +1 -1
  68. package/dist-vue/_chunks/{PkChatbotViewFiles-DDPugn7F.js → PkChatbotViewFiles-DRUVmxU5.js} +3 -3
  69. package/dist-vue/_chunks/{PkChatbotViewFiles-DDPugn7F.js.map → PkChatbotViewFiles-DRUVmxU5.js.map} +1 -1
  70. package/dist-vue/_chunks/{PkChatbotViewProfile-Dww5KI21.js → PkChatbotViewProfile-ywvIs6N5.js} +2 -2
  71. package/dist-vue/_chunks/{PkChatbotViewProfile-Dww5KI21.js.map → PkChatbotViewProfile-ywvIs6N5.js.map} +1 -1
  72. package/dist-vue/_chunks/{PkToolRequestGeolocation-BdX5DzEN.js → PkToolRequestGeolocation-BdIyXoPQ.js} +2 -2
  73. package/{dist/_chunks/PkToolRequestGeolocation-sf6LpUN_.js.map → dist-vue/_chunks/PkToolRequestGeolocation-BdIyXoPQ.js.map} +1 -1
  74. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-BUmnRgMi.js → PkToolRequestOAuthConnection-Dnch7xAB.js} +2 -2
  75. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-BUmnRgMi.js.map → PkToolRequestOAuthConnection-Dnch7xAB.js.map} +1 -1
  76. package/dist-vue/_chunks/{PkToolShowDiagram-YMo-iVWr.js → PkToolShowDiagram-DgLxNNp7.js} +2 -2
  77. package/dist-vue/_chunks/{PkToolShowDiagram-YMo-iVWr.js.map → PkToolShowDiagram-DgLxNNp7.js.map} +1 -1
  78. package/dist-vue/_chunks/{PkToolShowForm-D2n2rA6J.js → PkToolShowForm-6eLi6Wr0.js} +103 -117
  79. package/dist-vue/_chunks/PkToolShowForm-6eLi6Wr0.js.map +1 -0
  80. package/dist-vue/_chunks/{PkToolShowSources-DUAsrrzC.js → PkToolShowSources-DTJgvDiB.js} +2 -2
  81. package/dist-vue/_chunks/{PkToolShowSources-DUAsrrzC.js.map → PkToolShowSources-DTJgvDiB.js.map} +1 -1
  82. package/dist-vue/_chunks/{PkToolShowSuggestedReply-Dm28RIJF.js → PkToolShowSuggestedReply-D9RY2h6Z.js} +2 -2
  83. package/dist-vue/_chunks/{PkToolShowSuggestedReply-Dm28RIJF.js.map → PkToolShowSuggestedReply-D9RY2h6Z.js.map} +1 -1
  84. package/dist-vue/_chunks/{createChatbotApiClient-CAX-3-oK.js → createChatbotApiClient-12eL7hul.js} +2 -2
  85. package/dist-vue/_chunks/{createChatbotApiClient-CAX-3-oK.js.map → createChatbotApiClient-12eL7hul.js.map} +1 -1
  86. package/dist-vue/_chunks/{useChatbotStore-Rj18hAUf.js → useChatbotStore-Chtzi5jc.js} +1086 -1016
  87. package/dist-vue/_chunks/useChatbotStore-Chtzi5jc.js.map +1 -0
  88. package/dist-vue/_chunks/{utils-B0jsOUqd.js → utils-DKNWwMTQ.js} +46 -23
  89. package/dist-vue/_chunks/utils-DKNWwMTQ.js.map +1 -0
  90. package/dist-vue/_chunks/{web-DnPxEADy.js → web-CzR5jWfC.js} +46 -45
  91. package/dist-vue/_chunks/{web-DnPxEADy.js.map → web-CzR5jWfC.js.map} +1 -1
  92. package/dist-vue/api.js +1 -1
  93. package/dist-vue/composables.js +3 -3
  94. package/dist-vue/index.js +259 -259
  95. package/dist-vue/index.js.map +1 -1
  96. package/dist-vue/locales.js +10 -4
  97. package/dist-vue/packages/components/src/PkEditorRepeater.d.ts +1 -1
  98. package/dist-vue/packages/components/src/chat/constants.d.ts +12 -0
  99. package/dist-vue/packages/components/src/chat/utils.d.ts +37 -0
  100. package/dist-vue/packages/models/src/schema/Agent.d.ts +24 -16
  101. package/dist-vue/packages/models/src/schema/AgentChatStatistics.d.ts +1 -1
  102. package/dist-vue/packages/models/src/schema/Chat.d.ts +9 -9
  103. package/dist-vue/packages/models/src/schema/Document.d.ts +6 -6
  104. package/dist-vue/packages/models/src/schema/DocumentFolder.d.ts +0 -1
  105. package/dist-vue/packages/models/src/schema/McpServer.d.ts +2 -2
  106. package/dist-vue/packages/models/src/schema/Member.d.ts +2 -2
  107. package/dist-vue/packages/models/src/schema/Organization.d.ts +4 -4
  108. package/dist-vue/packages/models/src/schema/ReasoningChat.d.ts +29 -29
  109. package/dist-vue/packages/models/src/schema/SubAgent.d.ts +20 -20
  110. package/dist-vue/packages/models/src/schema/User.d.ts +6 -6
  111. package/dist-vue/packages/models/src/schema/constants.d.ts +2 -0
  112. package/package.json +10 -5
  113. package/dist/_chunks/Agent-DG4nPG72.js.map +0 -1
  114. package/dist/_chunks/Media-3Mo4NRj7.js.map +0 -1
  115. package/dist/_chunks/PkToolShowForm-DdBAG0Qs.js.map +0 -1
  116. package/dist/_chunks/browser-DuzNfJq0.js.map +0 -1
  117. package/dist/_chunks/index.es-DXx8DNKf.js +0 -2986
  118. package/dist/_chunks/index.es-DXx8DNKf.js.map +0 -1
  119. package/dist-vue/_chunks/Agent-gCuDMxHN.js.map +0 -1
  120. package/dist-vue/_chunks/PkChatbotStepToolDetail-B0WU0HcD.js.map +0 -1
  121. package/dist-vue/_chunks/PkChatbotSteps-BrvTsAeZ.js +0 -177
  122. package/dist-vue/_chunks/PkChatbotSteps-BrvTsAeZ.js.map +0 -1
  123. package/dist-vue/_chunks/PkToolShowForm-D2n2rA6J.js.map +0 -1
  124. package/dist-vue/_chunks/useChatbotStore-Rj18hAUf.js.map +0 -1
  125. package/dist-vue/_chunks/utils-B0jsOUqd.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-B0jsOUqd.js","names":[],"sources":["../../../../packages/components/src/chat/utils.ts"],"sourcesContent":["import type { UIMessage } from 'ai'\nimport {\n isTextPart,\n isFilePart,\n isToolPart,\n isReasoningPart,\n hasPartText,\n hasTextPart,\n getTextPart,\n getMessageText,\n} from 'utils'\n\nexport {\n isTextPart,\n isFilePart,\n isToolPart,\n isReasoningPart,\n hasPartText,\n hasTextPart,\n getTextPart,\n getMessageText,\n}\n\n/**\n * Merges consecutive text parts into a single text part.\n * Claude (and other models) often produce multiple text parts during streaming\n * that should logically be a single block of text.\n */\nexport function mergeConsecutiveTextParts(\n parts: UIMessage['parts'],\n): UIMessage['parts'] {\n const merged: UIMessage['parts'] = []\n for (const part of parts) {\n if (!isTextPart(part)) {\n merged.push(part)\n continue\n }\n const prev = merged[merged.length - 1]\n if (prev && isTextPart(prev)) {\n merged[merged.length - 1] = { ...prev, text: prev.text + part.text }\n } else {\n merged.push(part)\n }\n }\n return merged\n}\n\nexport function isStreamingPart(\n part: UIMessage['parts'][number] | null | undefined,\n): part is Extract<UIMessage['parts'][number], { streaming?: boolean }> {\n if (!part) return false\n if ('state' in part) {\n return part.state === 'streaming' || part.state === 'input-streaming'\n }\n return false\n}\n\n/**\n * States a tool part goes through when it needs the user's approval. They are\n * rendered by `PkToolApprovalCard` whatever the tool is, so the decision (and\n * its outcome) stays visible in the transcript.\n */\nconst TOOL_APPROVAL_STATES = new Set([\n 'approval-requested',\n 'approval-responded',\n 'output-denied',\n])\n\nexport function isToolApprovalPart(\n part: UIMessage['parts'][number] | null | undefined,\n): boolean {\n if (!isToolPart(part)) {\n return false\n }\n if (TOOL_APPROVAL_STATES.has(part.state)) {\n return true\n }\n // An executed (or errored) call that went through the gate keeps its\n // verdict in `approval`: the card stays in the transcript, so the user's\n // decision remains visible in the chat and in the log viewers (parity\n // with requestConfirm, whose 'confirmed' output is persisted).\n return (part as { approval?: unknown }).approval != null\n}\n\n/**\n * The client-side tool the model uses to have an action it described approved.\n * It predates the SDK's approval gate and keeps its own round-trip (it resolves\n * through `addToolOutput`), but it asks the user the very same question, so it\n * shares `PkToolApprovalCard` instead of having a card of its own.\n */\nexport const CONFIRM_TOOL_NAME = 'requestConfirm'\n\nexport function isToolConfirmPart(\n part: UIMessage['parts'][number] | null | undefined,\n): boolean {\n return isToolPart(part) && part.type === `tool-${CONFIRM_TOOL_NAME}`\n}\n\n/** True for any part the confirmation card is responsible for. */\nexport function isConfirmationCardPart(\n part: UIMessage['parts'][number] | null | undefined,\n): boolean {\n return isToolApprovalPart(part) || isToolConfirmPart(part)\n}\n\n/** The id of the pending approval request on a tool part, if any. */\nexport function getToolApprovalId(\n part: UIMessage['parts'][number] | null | undefined,\n): string | undefined {\n if (!isToolPart(part)) {\n return undefined\n }\n return (part as { approval?: { id?: string } }).approval?.id\n}\n\nexport function getPartState(\n part: UIMessage['parts'][number] | null | undefined,\n): string | undefined {\n if (!part) return undefined\n if ('state' in part) {\n return part.state\n }\n return undefined\n}\n\nexport function isLoadingState(state?: string): boolean {\n if (!state) return false\n return ['streaming'].includes(state)\n}\n\nexport function getContrast(hexcolor: string = '000000'): 'black' | 'white' {\n let hex = hexcolor.replace('#', '')\n\n // Expand 3-character hex to 6-character (e.g., #ccc -> #cccccc)\n if (hex.length === 3) {\n hex = hex\n .split('')\n .map((char) => char + char)\n .join('')\n }\n\n // WCAG relative luminance\n const r = parseInt(hex.substring(0, 2), 16) / 255\n const g = parseInt(hex.substring(2, 4), 16) / 255\n const b = parseInt(hex.substring(4, 6), 16) / 255\n\n const linearize = (c: number) =>\n c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4\n\n const luminance =\n 0.2126 * linearize(r) + 0.7152 * linearize(g) + 0.0722 * linearize(b)\n\n return luminance > 0.179 ? 'black' : 'white'\n}\n\n/**\n * Resolves the contrast color based on the user's `textColor` preference.\n * Falls back to WCAG auto-detection via `getContrast` when set to `'auto'` or `undefined`.\n */\nexport function resolveContrastColor(\n textColor: 'auto' | 'white' | 'black' | undefined,\n mainColor: string | undefined,\n): 'black' | 'white' {\n if (textColor === 'white' || textColor === 'black') {\n return textColor\n }\n return getContrast(mainColor)\n}\n\n/**\n * Formats a duration in milliseconds using the i18n `seconds` number format\n * (e.g. \"12,4 secondi\" / \"12.4 seconds\"). Returns undefined for durations\n * that would render as \"0 seconds\" (less than 0.05s).\n */\nexport function formatDuration(\n $n: (value: number, format: string) => string,\n ms?: number,\n): string | undefined {\n if (ms === undefined || ms < 50) {\n return undefined\n }\n return $n(ms / 1000, 'seconds')\n}\n\n/**\n * Stringifies a tool payload for the raw fallback view. Returns undefined for\n * empty values so the caller can skip rendering the block entirely.\n */\nexport function stringifyPayload(value: unknown): string | undefined {\n if (value === undefined) {\n return undefined\n }\n if (typeof value === 'string') {\n return value.trim() || undefined\n }\n try {\n const json = JSON.stringify(value, null, 2)\n return json === '{}' || json === '[]' ? undefined : json\n } catch {\n return undefined\n }\n}\n\n/**\n * True when a tool payload carries something worth rendering, so a caller can\n * skip the block without stringifying the value twice.\n */\nexport function hasPayload(value: unknown): boolean {\n return stringifyPayload(value) !== undefined\n}\n\n/**\n * Turns the answers of a form into the sentence the caller would have said.\n *\n * On a call the tool loop is over by the time the form is on screen, so the\n * answers go back to the agent as a user message (see `sendUserMessage` in\n * `useVoiceSession`). Each answer is paired with its question, because that is\n * how a person would say it and because the agent hears it with no widget\n * attached.\n */\nexport function formAnswerAsSpoken(\n part: unknown,\n answer: string | { answers: { id: string; value: unknown }[] },\n): string {\n const input = (\n part as {\n input?: {\n steps?: { id: string; question?: string }[]\n question?: string\n }\n }\n )?.input\n\n if (typeof answer === 'string') {\n const question = input?.question ?? input?.steps?.[0]?.question\n return question ? `${question} ${answer}` : answer\n }\n\n const questionById = new Map(\n (input?.steps ?? []).map((step) => [step.id, step.question]),\n )\n const lines = answer.answers\n .filter(\n ({ value }) =>\n value !== null &&\n value !== '' &&\n !(Array.isArray(value) && !value.length),\n )\n .map(({ id, value }) => {\n const said = Array.isArray(value) ? value.join(', ') : String(value)\n const question = questionById.get(id)\n return question ? `${question} ${said}` : said\n })\n\n return lines.join('. ')\n}\n\n// Provider-native web search tool part types\nexport const WEB_SEARCH_TOOL_TYPES = [\n 'tool-perplexity_search',\n 'tool-parallel_search',\n 'tool-web_search',\n 'tool-google_search',\n]\n\n// Tool part types with a dedicated rich rendering in PkChatbotStepToolDetail\nconst RICH_DETAIL_TOOL_TYPES = new Set([\n 'tool-searchInKnowledgeBase',\n 'tool-retrieveRevisedAnswers',\n 'tool-expandChunkContext',\n 'tool-readDocumentFile',\n 'tool-getWeather',\n 'tool-geocode',\n 'tool-recallUserMemory',\n 'tool-saveUserMemory',\n ...WEB_SEARCH_TOOL_TYPES,\n])\n\nexport function hasRichToolDetail(\n part?: UIMessage['parts'][number] | null,\n): boolean {\n return isToolPart(part) && RICH_DETAIL_TOOL_TYPES.has(part.type)\n}\n\nconst asRecord = (value: unknown): Record<string, unknown> | undefined =>\n value && typeof value === 'object' && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : undefined\n\nconst pickString = (\n record: Record<string, unknown> | undefined,\n ...keys: string[]\n): string | undefined => {\n for (const key of keys) {\n const value = record?.[key]\n if (typeof value === 'string' && value.trim()) {\n return value\n }\n }\n return undefined\n}\n\n/**\n * Returns a short inline summary for a tool part (search queries, location,\n * document name, ...) to be shown next to the step label without expanding\n * the step body.\n */\nexport function getToolPartSummary(\n part?: UIMessage['parts'][number] | null,\n): string | undefined {\n if (!isToolPart(part)) {\n return undefined\n }\n const input = asRecord('input' in part ? part.input : undefined)\n const output = asRecord('output' in part ? part.output : undefined)\n if (\n part.type === 'tool-searchInKnowledgeBase' ||\n WEB_SEARCH_TOOL_TYPES.includes(part.type)\n ) {\n const queries = input?.queries\n if (Array.isArray(queries)) {\n const valid = queries.filter(\n (query): query is string =>\n typeof query === 'string' && Boolean(query.trim()),\n )\n return valid.length ? valid.join(' · ') : undefined\n }\n return pickString(input, 'query', 'objective')\n }\n if (part.type === 'tool-retrieveRevisedAnswers') {\n return pickString(input, 'query')\n }\n if (part.type === 'tool-getWeather') {\n return (\n pickString(output, 'location') ?? pickString(input, 'locationName')\n )\n }\n if (part.type === 'tool-geocode') {\n return pickString(input, 'locationName')\n }\n if (part.type === 'tool-expandChunkContext') {\n return pickString(output, 'documentName')\n }\n if (part.type === 'tool-readDocumentFile') {\n return pickString(output, 'name')\n }\n if (part.type === 'tool-recallUserMemory') {\n return pickString(input, 'query')\n }\n if (part.type === 'tool-saveUserMemory') {\n return pickString(input, 'content', 'query')\n }\n return undefined\n}\n\n// Get part icon\nexport function getPartIcon(\n part?: UIMessage['parts'][number] | null,\n): string | undefined {\n if (isToolPart(part)) {\n if (part.type.includes('tool-subagent')) {\n return 'ri:robot-2-line'\n }\n if (part.type === 'tool-runWorker') {\n return 'ri:flow-chart'\n }\n if (part.type === 'tool-fetchTeamsChannelHistory') {\n return 'ri:chat-history-line'\n }\n if (part.type.includes('tool-mcp')) {\n return 'octicon:mcp-16'\n }\n if (part.type === 'tool-retrieveRevisedAnswers') {\n return 'ri:file-edit-line'\n }\n if (part.type === 'tool-searchInKnowledgeBase') {\n return 'ri:search-line'\n }\n if (part.type === 'tool-expandChunkContext') {\n return 'ri:file-search-line'\n }\n if (part.type === 'tool-readDocumentFile') {\n return 'ri:file-text-line'\n }\n if (part.type === 'tool-geocode') {\n return 'ri:map-2-line'\n }\n if (part.type === 'tool-getWeather') {\n return 'ri:sun-cloudy-line'\n }\n if (part.type === 'tool-recallUserMemory') {\n return 'ri:brain-line'\n }\n if (part.type === 'tool-saveUserMemory') {\n return 'ri:save-3-line'\n }\n if (part.type === 'tool-showWeather') {\n return 'ri:sun-line'\n }\n if (part.type === 'tool-showDiagram') {\n return 'ri:flow-chart'\n }\n if (part.type === 'tool-showSources') {\n return 'ri:book-2-line'\n }\n if (part.type === 'tool-showForm') {\n return 'ri:survey-line'\n }\n if (part.type === 'tool-showMultipleChoice') {\n return 'ri:checkbox-multiple-line'\n }\n if (part.type === 'tool-showArtifact') {\n return 'ri:file-code-line'\n }\n if (part.type === 'tool-showEmail') {\n return 'ri:mail-line'\n }\n if (part.type === 'tool-showMessage') {\n return 'ri:chat-1-line'\n }\n if (part.type === 'tool-showWebPages') {\n return 'ri:pages-line'\n }\n if (part.type === 'tool-showProductList') {\n return 'ri:shopping-bag-line'\n }\n if (part.type === 'tool-showContactForm') {\n return 'ri:send-plane-2-line'\n }\n if (part.type === 'tool-showCalendarEvent') {\n return 'ri:calendar-event-line'\n }\n if (part.type === 'tool-showComparison') {\n return 'ri:scales-line'\n }\n if (part.type === 'tool-showLocation') {\n return 'ri:map-pin-line'\n }\n if (part.type === 'tool-showQrCode') {\n return 'ri:qr-code-line'\n }\n if (part.type === 'tool-showImageGallery') {\n return 'ri:image-line'\n }\n if (part.type === 'tool-showVideo') {\n return 'ri:film-line'\n }\n if (part.type === 'tool-showSuggestedReply') {\n return 'ri:corner-down-right-line'\n }\n if (part.type === 'tool-requestGeolocation') {\n return 'ri:map-pin-user-line'\n }\n if (\n part.type === 'tool-perplexity_search' ||\n part.type === 'tool-parallel_search' ||\n part.type === 'tool-web_search' ||\n part.type === 'tool-google_search'\n ) {\n return 'ri:global-line'\n }\n return 'ri:tools-line'\n }\n if (isReasoningPart(part)) {\n return 'ri:lightbulb-line'\n }\n if (isTextPart(part)) {\n return 'ri:double-quotes-r'\n }\n return undefined\n}\n\n// Get part label\nexport function getToolPartLabel(\n $t: (key: string) => string,\n part?: UIMessage['parts'][number] | null,\n): string | undefined {\n if (isToolPart(part)) {\n if (part.type.includes('tool-subagent')) {\n return $t(`messagePart.runSubagent`)\n }\n if (part.type === 'tool-runWorker') {\n return $t(`messagePart.runWorker`)\n }\n if (part.type === 'tool-fetchTeamsChannelHistory') {\n return $t(`messagePart.fetchTeamsChannelHistory`)\n }\n if (part.type === 'tool-retrieveRevisedAnswers') {\n return $t(`messagePart.revisedAnswers`)\n }\n if (part.type === 'tool-searchInKnowledgeBase') {\n return $t(`messagePart.searchingDocuments`)\n }\n if (part.type === 'tool-expandChunkContext') {\n return $t(`messagePart.expandChunkContext`)\n }\n if (part.type === 'tool-readDocumentFile') {\n return $t(`messagePart.readDocumentFile`)\n }\n if (part.type === 'tool-geocode') {\n return $t(`messagePart.geocode`)\n }\n if (part.type === 'tool-getWeather') {\n return $t(`messagePart.getWeather`)\n }\n if (part.type === 'tool-recallUserMemory') {\n return $t(`messagePart.recallUserMemory`)\n }\n if (part.type === 'tool-saveUserMemory') {\n return $t(`messagePart.saveUserMemory`)\n }\n if (part.type === 'tool-showWeather') {\n return $t(`messagePart.showWeather`)\n }\n if (part.type === 'tool-showForm') {\n return $t(`messagePart.showForm`)\n }\n if (part.type === 'tool-showDiagram') {\n return $t(`messagePart.showDiagram`)\n }\n if (part.type === 'tool-showSources') {\n return $t(`messagePart.showSources`)\n }\n if (part.type === 'tool-showMultipleChoice') {\n return $t(`messagePart.showMultipleChoice`)\n }\n if (part.type === 'tool-showArtifact') {\n return $t(`messagePart.showArtifact`)\n }\n if (part.type === 'tool-showEmail') {\n return $t(`messagePart.showEmail`)\n }\n if (part.type === 'tool-showMessage') {\n return $t(`messagePart.showMessage`)\n }\n if (part.type === 'tool-showWebPages') {\n return $t(`messagePart.showWebPages`)\n }\n if (part.type === 'tool-showProducts') {\n return $t(`messagePart.showProducts`)\n }\n if (part.type === 'tool-showContactForm') {\n return $t(`messagePart.showContactForm`)\n }\n if (part.type === 'tool-showCalendarEvent') {\n return $t(`messagePart.showCalendarEvent`)\n }\n if (part.type === 'tool-showComparison') {\n return $t(`messagePart.showComparison`)\n }\n if (part.type === 'tool-showLocation') {\n return $t(`messagePart.showLocation`)\n }\n if (part.type === 'tool-showQrCode') {\n return $t(`messagePart.showQrCode`)\n }\n if (part.type === 'tool-showImageGallery') {\n return $t(`messagePart.showImageGallery`)\n }\n if (part.type === 'tool-showVideo') {\n return $t(`messagePart.showVideo`)\n }\n if (part.type === 'tool-showSuggestedReply') {\n return $t(`messagePart.showSuggestedReply`)\n }\n if (part.type === 'tool-requestGeolocation') {\n return $t(`messagePart.requestGeolocation`)\n }\n if (WEB_SEARCH_TOOL_TYPES.includes(part.type)) {\n return $t(`messagePart.webSearch`)\n }\n return $t(`messagePart.tool`)\n }\n if (isReasoningPart(part)) {\n return $t(`messagePart.reasoning`)\n }\n return $t(`messagePart.streaming`)\n}\n"],"mappings":";;;AA4BA,SAAgB,EACZ,GACkB;CAClB,IAAM,IAA6B,CAAC;CACpC,KAAK,IAAM,KAAQ,GAAO;EACtB,IAAI,CAAC,EAAW,CAAI,GAAG;GACnB,EAAO,KAAK,CAAI;GAChB;EACJ;EACA,IAAM,IAAO,EAAO,EAAO,SAAS;EACpC,AAAI,KAAQ,EAAW,CAAI,IACvB,EAAO,EAAO,SAAS,KAAK;GAAE,GAAG;GAAM,MAAM,EAAK,OAAO,EAAK;EAAK,IAEnE,EAAO,KAAK,CAAI;CAExB;CACA,OAAO;AACX;AAEA,SAAgB,EACZ,GACoE;CAKpE,OAJK,KACD,WAAW,IACJ,EAAK,UAAU,eAAe,EAAK,UAAU,oBAEjD;AACX;AAOA,IAAM,oBAAuB,IAAI,IAAI;CACjC;CACA;CACA;AACJ,CAAC;AAED,SAAgB,EACZ,GACO;CAWP,OAVK,EAAW,CAAI,IAGhB,EAAqB,IAAI,EAAK,KAAK,IAC5B,KAMH,EAAgC,YAAY,OATzC;AAUf;AAQA,IAAa,IAAoB;AAEjC,SAAgB,EACZ,GACO;CACP,OAAO,EAAW,CAAI,KAAK,EAAK,SAAS;AAC7C;AAGA,SAAgB,EACZ,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