@8wave/ai-elements 0.121.0-beta.52 → 0.121.0-beta.53
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/_chunks/{Agent-CtLgGLbV.js → Agent-BdoXh8b0.js} +252 -250
- package/dist/_chunks/Agent-BdoXh8b0.js.map +1 -0
- package/dist/_chunks/{PkStreamingMarkdown-BP7HK2u0.js → PkStreamingMarkdown-CR-xBRG2.js} +3 -3
- package/dist/_chunks/{PkStreamingMarkdown-BP7HK2u0.js.map → PkStreamingMarkdown-CR-xBRG2.js.map} +1 -1
- package/dist/_chunks/{PkToolEditedFile-VFnIlU4j.js → PkToolEditedFile-DAMPjKIn.js} +2 -2
- package/dist/_chunks/{PkToolEditedFile-VFnIlU4j.js.map → PkToolEditedFile-DAMPjKIn.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestGeolocation-B51_MHPQ.js → PkToolRequestGeolocation-BantUie4.js} +2 -2
- package/dist/_chunks/{PkToolRequestGeolocation-B51_MHPQ.js.map → PkToolRequestGeolocation-BantUie4.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestOAuthConnection-DfjwyGwk.js → PkToolRequestOAuthConnection-CB5ziPOE.js} +2 -2
- package/dist/_chunks/{PkToolRequestOAuthConnection-DfjwyGwk.js.map → PkToolRequestOAuthConnection-CB5ziPOE.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-B8l3G0ae.js → PkToolShowArtifact-B1J7a3o0.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-B8l3G0ae.js.map → PkToolShowArtifact-B1J7a3o0.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-wNiHeOQM.js → PkToolShowContactForm-DcNMM-j0.js} +2 -2
- package/dist/_chunks/{PkToolShowContactForm-wNiHeOQM.js.map → PkToolShowContactForm-DcNMM-j0.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-jA0SkiQC.js → PkToolShowForm-CRa9HLZo.js} +3 -3
- package/dist/_chunks/{PkToolShowForm-jA0SkiQC.js.map → PkToolShowForm-CRa9HLZo.js.map} +1 -1
- package/dist/_chunks/{PkToolShowImageGallery-B9PlDrmn.js → PkToolShowImageGallery-BisEror8.js} +2 -2
- package/dist/_chunks/{PkToolShowImageGallery-B9PlDrmn.js.map → PkToolShowImageGallery-BisEror8.js.map} +1 -1
- package/dist/_chunks/{PkToolShowProductList-DRHSe2e7.js → PkToolShowProductList-BmPdjUSS.js} +2 -2
- package/dist/_chunks/{PkToolShowProductList-DRHSe2e7.js.map → PkToolShowProductList-BmPdjUSS.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-K-cNd52t.js → PkToolShowSources-LQ0DMKM1.js} +3 -3
- package/dist/_chunks/{PkToolShowSources-K-cNd52t.js.map → PkToolShowSources-LQ0DMKM1.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSuggestedReply-BQHtnpb_.js → PkToolShowSuggestedReply-lzs6-CcI.js} +2 -2
- package/dist/_chunks/{PkToolShowSuggestedReply-BQHtnpb_.js.map → PkToolShowSuggestedReply-lzs6-CcI.js.map} +1 -1
- package/dist/_chunks/{PkToolShowVideo-B21JnsbY.js → PkToolShowVideo-BPYYn43O.js} +2 -2
- package/dist/_chunks/{PkToolShowVideo-B21JnsbY.js.map → PkToolShowVideo-BPYYn43O.js.map} +1 -1
- package/dist/_chunks/{PkToolShowWebPages-CW1Kdg6J.js → PkToolShowWebPages-CbE_bnHt.js} +2 -2
- package/dist/_chunks/{PkToolShowWebPages-CW1Kdg6J.js.map → PkToolShowWebPages-CbE_bnHt.js.map} +1 -1
- package/dist/_chunks/{chatImagePolicy-Bf-fhvf6.js → chatImagePolicy-CZeGEXvB.js} +2 -2
- package/dist/_chunks/{chatImagePolicy-Bf-fhvf6.js.map → chatImagePolicy-CZeGEXvB.js.map} +1 -1
- package/dist/_chunks/{markdown-B_eDHV3T.js → markdown-DtRRqlac.js} +2 -2
- package/dist/_chunks/{markdown-B_eDHV3T.js.map → markdown-DtRRqlac.js.map} +1 -1
- package/dist/ai-elements.es.js +19 -17
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotEmptyState.js +1 -1
- package/dist-vue/PkChatbotInput.js +1 -1
- package/dist-vue/PkChatbotMessages.js +1 -1
- package/dist-vue/PkChatbotStepPayload.js +1 -1
- package/dist-vue/PkChatbotStepToolDetail.js +1 -1
- package/dist-vue/PkChatbotSteps.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/PkChatbotViewConversations.js +1 -1
- package/dist-vue/PkChatbotViewFiles.js +1 -1
- package/dist-vue/PkChatbotViewProfile.js +1 -1
- package/dist-vue/_chunks/{Agent-BlWzW8Mg.js → Agent-B-jQOrER.js} +133 -131
- package/dist-vue/_chunks/Agent-B-jQOrER.js.map +1 -0
- package/dist-vue/_chunks/{Document-vkNbPo_T.js → Document-DQtliJu6.js} +2 -2
- package/dist-vue/_chunks/{Document-vkNbPo_T.js.map → Document-DQtliJu6.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbot-DgKkkbCs.js → PkChatbot-DKBnpYB0.js} +8 -8
- package/dist-vue/_chunks/{PkChatbot-DgKkkbCs.js.map → PkChatbot-DKBnpYB0.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotEmptyState-XWzSF0W0.js → PkChatbotEmptyState-CFCbJSjm.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotEmptyState-XWzSF0W0.js.map → PkChatbotEmptyState-CFCbJSjm.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotInput-a36iJO_a.js → PkChatbotInput-fte_uZHV.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotInput-a36iJO_a.js.map → PkChatbotInput-fte_uZHV.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotMessages-Ce7BtcBf.js → PkChatbotMessages-BVzOnfjU.js} +20 -18
- package/dist-vue/_chunks/PkChatbotMessages-BVzOnfjU.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotStepPayload-jbQd7cML.js → PkChatbotStepPayload-CgwZs9AM.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotStepPayload-jbQd7cML.js.map → PkChatbotStepPayload-CgwZs9AM.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-B1SJqhIt.js → PkChatbotStepToolDetail-BOylJhFM.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-B1SJqhIt.js.map → PkChatbotStepToolDetail-BOylJhFM.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotSteps-M7T71Lr9.js → PkChatbotSteps-Cmi5TBZM.js} +5 -5
- package/dist-vue/_chunks/{PkChatbotSteps-M7T71Lr9.js.map → PkChatbotSteps-Cmi5TBZM.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-58rvFSbr.js → PkChatbotViewChat-DuHSW8TF.js} +7 -7
- package/dist-vue/_chunks/{PkChatbotViewChat-58rvFSbr.js.map → PkChatbotViewChat-DuHSW8TF.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewConversations-DP1zMA-B.js → PkChatbotViewConversations-Bf9oJIdi.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewConversations-DP1zMA-B.js.map → PkChatbotViewConversations-Bf9oJIdi.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-DCo-erhU.js → PkChatbotViewFiles-B6R1ixAl.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewFiles-DCo-erhU.js.map → PkChatbotViewFiles-B6R1ixAl.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-Da6iqXLn.js → PkChatbotViewProfile-x0oUCbeL.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-Da6iqXLn.js.map → PkChatbotViewProfile-x0oUCbeL.js.map} +1 -1
- package/dist-vue/_chunks/{PkStreamingMarkdown-D00IssLd.js → PkStreamingMarkdown-BrBeaJes.js} +3 -3
- package/dist-vue/_chunks/{PkStreamingMarkdown-D00IssLd.js.map → PkStreamingMarkdown-BrBeaJes.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolEditedFile-ppesvE8O.js → PkToolEditedFile-BKyMjgs0.js} +2 -2
- package/dist-vue/_chunks/{PkToolEditedFile-ppesvE8O.js.map → PkToolEditedFile-BKyMjgs0.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestGeolocation-CK_AAzwh.js → PkToolRequestGeolocation-CY-NC6Rc.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestGeolocation-CK_AAzwh.js.map → PkToolRequestGeolocation-CY-NC6Rc.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-CXfvULza.js → PkToolRequestOAuthConnection-RkbnKSde.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-CXfvULza.js.map → PkToolRequestOAuthConnection-RkbnKSde.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowArtifact-BH8xgFcB.js → PkToolShowArtifact-BvvVHrP-.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-BH8xgFcB.js.map → PkToolShowArtifact-BvvVHrP-.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowContactForm-CdDx1Jxl.js → PkToolShowContactForm-Dz_IiYr1.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowContactForm-CdDx1Jxl.js.map → PkToolShowContactForm-Dz_IiYr1.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-D22AS39F.js → PkToolShowDiagram-DCSfCzrN.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowDiagram-D22AS39F.js.map → PkToolShowDiagram-DCSfCzrN.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-gUfRbKJS.js → PkToolShowForm-qMBAEKxf.js} +4 -4
- package/dist-vue/_chunks/{PkToolShowForm-gUfRbKJS.js.map → PkToolShowForm-qMBAEKxf.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowImageGallery-GEDLtNod.js → PkToolShowImageGallery-DWwUnIDq.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowImageGallery-GEDLtNod.js.map → PkToolShowImageGallery-DWwUnIDq.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowProductList-CERjht9c.js → PkToolShowProductList-DreWhhfK.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowProductList-CERjht9c.js.map → PkToolShowProductList-DreWhhfK.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-B_4taLGg.js → PkToolShowSources-DR-uaXeX.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowSources-B_4taLGg.js.map → PkToolShowSources-DR-uaXeX.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-DVYeAkEp.js → PkToolShowSuggestedReply-CThFJVUq.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-DVYeAkEp.js.map → PkToolShowSuggestedReply-CThFJVUq.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowVideo-GZ8wviqU.js → PkToolShowVideo-Xogv8wVt.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowVideo-GZ8wviqU.js.map → PkToolShowVideo-Xogv8wVt.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowWebPages-DceCOjLQ.js → PkToolShowWebPages-BHTyFyDI.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowWebPages-DceCOjLQ.js.map → PkToolShowWebPages-BHTyFyDI.js.map} +1 -1
- package/dist-vue/_chunks/{createChatbotApiClient-7i_D_crv.js → createChatbotApiClient-B3U31J_K.js} +2 -2
- package/dist-vue/_chunks/{createChatbotApiClient-7i_D_crv.js.map → createChatbotApiClient-B3U31J_K.js.map} +1 -1
- package/dist-vue/_chunks/{useChatbotStore-DhVxJwn6.js → useChatbotStore-D2L4m3iJ.js} +3 -3
- package/dist-vue/_chunks/{useChatbotStore-DhVxJwn6.js.map → useChatbotStore-D2L4m3iJ.js.map} +1 -1
- package/dist-vue/_chunks/{utils-BpnTWYko.js → utils-Df_SeBdX.js} +2 -2
- package/dist-vue/_chunks/{utils-BpnTWYko.js.map → utils-Df_SeBdX.js.map} +1 -1
- package/dist-vue/api.js +1 -1
- package/dist-vue/composables.js +4 -4
- package/dist-vue/index.js +24 -24
- package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +36 -0
- package/dist-vue/packages/models/src/schema/Agent.d.ts +55 -0
- package/dist-vue/packages/models/src/schema/ReasoningChat.d.ts +12 -0
- package/dist-vue/packages/models/src/schema/SubAgent.d.ts +12 -0
- package/package.json +1 -1
- package/dist/_chunks/Agent-CtLgGLbV.js.map +0 -1
- package/dist-vue/_chunks/Agent-BlWzW8Mg.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotMessages-Ce7BtcBf.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as e, A as t, E as n, R as r, n as i, x as a } from "./Agent-
|
|
1
|
+
import { $ as e, A as t, E as n, R as r, n as i, x as a } from "./Agent-B-jQOrER.js";
|
|
2
2
|
import "./src-B-ZKEhTU.js";
|
|
3
3
|
import { c as o, i as s, l as c, u as l } from "./message-DuibQyHy.js";
|
|
4
4
|
// ../../packages/utils/src/text.ts
|
|
@@ -332,4 +332,4 @@ function ce(e, t, n) {
|
|
|
332
332
|
}
|
|
333
333
|
export { oe as A, T as C, se as D, N as E, d as F, f as I, p as L, V as M, $ as N, h as O, m as P, P as S, E as T, F as _, te as a, H as b, U as c, B as d, x as f, ie as g, I as h, K as i, z as j, y as k, G as l, Q as m, C as n, _ as o, k as p, D as r, b as s, M as t, W as u, ce as v, L as w, J as x, Z as y };
|
|
334
334
|
|
|
335
|
-
//# sourceMappingURL=utils-
|
|
335
|
+
//# sourceMappingURL=utils-Df_SeBdX.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-BpnTWYko.js","names":["isHostToolPart","WEB_SEARCH_TOOL_KEYS","SUBAGENT_TOOL_PREFIX","isPresentationTool","API_TOOL_PREFIX","MCP_TOOL_PREFIX","isReasoningPart","getToolPartName","isTextPart","isToolPart","removeAccents","str","fromAnyCase","toKebabCase","toSnakeCase","capitalizeFirstLetter","mergeConsecutiveTextParts","merged","part","parts","prev","isWidgetPart","dropCorrectedWidgetErrors","lastDrawn","index","isStreamingPart","FILE_OUTPUT_PARTS","moveFileOutputsLast","files","feedPartKey","toolCallId","getHostCallPart","PAGE_TOOL_STEPS","HOST_STEP_TITLES","FORM_TOOL_STEP","pageToolStep","host","isHostActionPart","LIVE_REASONING_TAIL_LENGTH","FENCE_LINE","getMarkdownTail","markdown","maxLength","from","limit","boundary","length","cut","openFence","match","marker","rest","TOOL_APPROVAL_STATES","isToolApprovalPart","CONFIRM_TOOL_NAME","isToolConfirmPart","isConfirmationCardPart","getToolApprovalId","getPartState","isLoadingState","state","getContrast","hex","hexcolor","char","r","g","b","linearize","c","resolveContrastColor","textColor","mainColor","agentThemeStyle","contrastColor","formatDuration","ms","$n","stringifyPayload","value","json","hasPayload","formAnswerAsSpoken","input","answer","question","questionById","step","said","id","formStepOptions","option","formAnswerSlots","slots","output","steps","assign","list","WEB_SEARCH_TOOL_TYPES","key","RICH_DETAIL_TOOL_TYPES","hasRichToolDetail","asRecord","pickString","keys","record","getToolPartSummary","queries","valid","query","sheet","range","getPartIcon","TOOL_KEY_PREFIXES","toolLabel","te","name","prefix","p","PART_TYPE_LABELS","t","getPartTypeLabel","translator","label","PROVIDER_NAMES","providerLabel","slug","localizeSummaryLabels","summary","labels","colon","getToolPartLabel","live","hostStepTitles","page","$t"],"sources":["../../../../packages/utils/src/text.ts","../../../../packages/components/src/chat/utils.ts"],"sourcesContent":["export const removeAccents = (str: string) =>\n str.normalize('NFD').replace(/[\\u0300-\\u036f]/g, '')\n\nexport const toCamelCase = <T extends string>(str?: string): T => {\n if (!str) {\n return '' as unknown as T\n }\n return removeAccents(str)\n .replace(/[^a-zA-Z0-9]+(.)?/g, (_, c) => (c ? c.toUpperCase() : ''))\n .replace(/^(.)/, (match) => match.toLowerCase()) as unknown as T\n}\n\nexport const fromCamelCase = (str?: string): string => {\n if (!str) {\n return ''\n }\n return str.replace(/([a-z0-9])([A-Z])/g, '$1 $2')\n}\n\nexport const fromAnyCase = (str?: string): string => {\n if (!str) {\n return ''\n }\n return str\n .replace(/([a-z0-9])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/[-_]+/g, ' ')\n}\n\nexport const toPascalCase = <T extends string>(str?: string): T => {\n if (!str) {\n return '' as unknown as T\n }\n return removeAccents(str)\n .replace(/[^a-zA-Z0-9]+(.)?/g, (_, c) => (c ? c.toUpperCase() : ''))\n .replace(/^(.)/, (match) => match.toUpperCase()) as unknown as T\n}\n\nexport const toKebabCase = <T extends string>(str?: string): T => {\n if (!str) {\n return '' as unknown as T\n }\n return removeAccents(str)\n .replace(/([a-z0-9])([A-Z])/g, '$1-$2')\n .replace(/[^a-zA-Z0-9]+/g, '-')\n .toLowerCase() as unknown as T\n}\n\nexport const fromKebabCase = (str?: string): string => {\n if (!str) {\n return ''\n }\n return str.replace(/-/g, ' ')\n}\n\nexport const toSnakeCase = <T extends string>(str?: string): T => {\n if (!str) {\n return '' as unknown as T\n }\n return removeAccents(str)\n .replace(/([a-z0-9])([A-Z])/g, '$1_$2')\n .replace(/[^a-zA-Z0-9]+/g, '_')\n .toLowerCase() as unknown as T\n}\n\nexport const capitalizeFirstLetter = (str?: string) => {\n if (!str) {\n return ''\n }\n return str.charAt(0).toUpperCase() + str.slice(1)\n}\n\nexport const lowercaseFirstLetter = (str?: string) => {\n if (!str) {\n return ''\n }\n return str.charAt(0).toLowerCase() + str.slice(1)\n}\n","import type { UIMessage } from 'ai'\nimport type { InjectionKey, Ref } from 'vue'\nimport {\n API_TOOL_PREFIX,\n MCP_TOOL_PREFIX,\n SUBAGENT_TOOL_PREFIX,\n WEB_SEARCH_TOOL_KEYS,\n isHostToolPart,\n isPresentationTool,\n} from 'models'\nimport {\n isTextPart,\n isFilePart,\n isToolPart,\n isReasoningPart,\n hasPartText,\n hasTextPart,\n getTextPart,\n getMessageText,\n getToolPartName,\n capitalizeFirstLetter,\n fromAnyCase,\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\nconst isWidgetPart = (\n part: UIMessage['parts'][number],\n): part is Extract<UIMessage['parts'][number], { type: `tool-${string}` }> =>\n isToolPart(part) && isPresentationTool(getToolPartName(part))\n\n/**\n * Drops a widget call refused for its arguments when a later call of the same\n * widget in the message was drawn: the turn corrected it (the backend's\n * `correctableInputRefusals`), and the refusal would sit next to the working\n * widget, `showForm` drawing its render error above the form. A refusal with\n * nothing drawn after it stays. Only the feed reads this: the steps timeline\n * keeps every call, the refused one included.\n */\nexport function dropCorrectedWidgetErrors(\n parts: UIMessage['parts'],\n): UIMessage['parts'] {\n const lastDrawn = new Map<string, number>()\n for (const [index, part] of parts.entries()) {\n if (\n isWidgetPart(part) &&\n part.state !== 'output-error' &&\n !isStreamingPart(part)\n ) {\n lastDrawn.set(part.type, index)\n }\n }\n return parts.filter(\n (part, index) =>\n !(\n isWidgetPart(part) &&\n part.state === 'output-error' &&\n (lastDrawn.get(part.type) ?? -1) > index\n ),\n )\n}\n\n/**\n * Tool calls whose output is a file for the user to download. The feed draws\n * them after the answer, where the reader arrives, wherever in the message the\n * model made the call: a version written before a long answer sat above it,\n * out of sight.\n */\nconst FILE_OUTPUT_PARTS: ReadonlySet<string> = new Set([\n 'tool-editSpreadsheet',\n 'tool-shareDocument',\n 'tool-editWordDocument',\n])\n\n/** The parts with the file outputs moved last, in their own order. */\nexport function moveFileOutputsLast(\n parts: UIMessage['parts'],\n): UIMessage['parts'] {\n const files = parts.filter((part) => FILE_OUTPUT_PARTS.has(part.type))\n return files.length > 0\n ? [\n ...parts.filter((part) => !FILE_OUTPUT_PARTS.has(part.type)),\n ...files,\n ]\n : parts\n}\n\n/**\n * The key of a part in the feed. Its position, except for a file output: that\n * one is always last, so its position moves as the answer grows, and keyed by\n * it the card would be redrawn at every new part.\n */\nexport function feedPartKey(\n part: UIMessage['parts'][number],\n index: number,\n): string | number {\n const toolCallId = (part as { toolCallId?: string }).toolCallId\n return FILE_OUTPUT_PARTS.has(part.type) && toolCallId\n ? `file-${toolCallId}`\n : index\n}\n\n/** A call the embedding page runs, as the backend stamped it (spec `host-tools.md`). */\ninterface HostCallPart {\n toolCallId?: string\n toolName: string\n title?: string\n state?: string\n errorText?: string\n toolMetadata?: { readOnly?: boolean; provider?: 'app' | 'page' }\n}\n\nexport function getHostCallPart(\n part: UIMessage['parts'][number] | null | undefined,\n): HostCallPart | undefined {\n return isHostToolPart(part) ? (part as unknown as HostCallPart) : undefined\n}\n\n/**\n * The page tools of the widget (spec `page-tools.md`): defined by the backend,\n * so their step is ours to name, in the user's language. A tool the app\n * registered is named by its own `title`.\n */\nconst PAGE_TOOL_STEPS: Record<string, { icon: string; label: string }> = {\n page_snapshot: {\n icon: 'ri:pages-line',\n label: 'messagePart.pageTool.snapshot',\n },\n page_read: {\n icon: 'ri:file-text-line',\n label: 'messagePart.pageTool.read',\n },\n page_click: { icon: 'ri:cursor-line', label: 'messagePart.pageTool.click' },\n page_fill: { icon: 'ri:edit-line', label: 'messagePart.pageTool.fill' },\n page_scroll: {\n icon: 'ri:arrow-up-down-line',\n label: 'messagePart.pageTool.scroll',\n },\n page_find: { icon: 'ri:search-line', label: 'messagePart.pageTool.find' },\n page_wait: { icon: 'ri:time-line', label: 'messagePart.pageTool.wait' },\n page_hover: {\n icon: 'ri:cursor-line',\n label: 'messagePart.pageTool.hover',\n },\n page_press: {\n icon: 'ri:keyboard-line',\n label: 'messagePart.pageTool.press',\n },\n page_back: {\n icon: 'ri:arrow-go-back-line',\n label: 'messagePart.pageTool.back',\n },\n page_navigate: {\n icon: 'ri:links-line',\n label: 'messagePart.pageTool.navigate',\n },\n}\n\n/**\n * The titles the widget gave this page's steps, by call, naming what each\n * acts on (spec `page-tools-improvements.md`, M8): provided by the chat view\n * from its store, read by the views that list the steps.\n */\nexport const HOST_STEP_TITLES: InjectionKey<Ref<Record<string, string>>> =\n Symbol('hostStepTitles')\n\n/** A form the site annotated for agents: its tool is named `form_<toolname>`. */\nconst FORM_TOOL_STEP = {\n icon: 'ri:survey-line',\n label: 'messagePart.pageTool.form',\n}\n\nconst pageToolStep = (host: HostCallPart) =>\n host.toolMetadata?.provider === 'page'\n ? (PAGE_TOOL_STEPS[host.toolName] ??\n (host.toolName.startsWith('form_') ? FORM_TOOL_STEP : undefined))\n : undefined\n\n/**\n * A host call that changes something in the app or on the page: the feed\n * shows it even without the steps timeline, because what it did stays done.\n */\nexport function isHostActionPart(\n part: UIMessage['parts'][number] | null | undefined,\n): boolean {\n return getHostCallPart(part)?.toolMetadata?.readOnly === false\n}\n\nexport function isStreamingPart(\n part: UIMessage['parts'][number] | null | undefined,\n): part is Extract<UIMessage['parts'][number], { streaming?: boolean }> {\n if (!part) {\n return false\n }\n if ('state' in part) {\n return part.state === 'streaming' || part.state === 'input-streaming'\n }\n return false\n}\n\n/**\n * How much of a reasoning still being written its live box renders. The box is\n * a few lines tall and follows the bottom, while the reasoning of one turn runs\n * to tens of kilobytes: chat `st0Eg8iG0zUX0HQN` wrote 92KB, and parsing all of\n * it at every delta froze the tab. Four thousand characters leave a few screens\n * to scroll back through, and a finished step renders all of it.\n */\nexport const LIVE_REASONING_TAIL_LENGTH = 4000\n\n// A fence opener or closer, also inside a list item or a quote, whose markers\n// and indentation are skipped. The rest of the line tells them apart: a\n// closing fence carries no info string.\nconst FENCE_LINE =\n /^[ \\t]*(?:(?:[-*+]|\\d{1,9}[.)])[ \\t]+|>[ \\t]?)*(`{3,}|~{3,})(.*)$/gm\n\n/**\n * The end of a markdown text, at most `maxLength` characters long, cut on a\n * blank line (a line break when there is none) so it does not open on half a\n * paragraph. A table or a formula can still be cut in two. An ellipsis marks\n * the cut. A cut inside a fenced code block reopens the fence, or the rest of\n * the text would render as code and the code as prose.\n */\nexport function getMarkdownTail(markdown: string, maxLength: number): string {\n if (markdown.length <= maxLength) {\n return markdown\n }\n const from = markdown.length - maxLength\n // The boundary is looked for in the first half of the window only: the one\n // blank line of the window can be the last thing written, and cutting there\n // would leave nothing to render.\n const limit = from + maxLength / 2\n const boundary = (index: number, length: number) =>\n index !== -1 && index < limit ? index + length : undefined\n const cut =\n boundary(markdown.indexOf('\\n\\n', from), 2) ??\n boundary(markdown.indexOf('\\n', from), 1) ??\n from\n let openFence: string | undefined\n for (const match of markdown.matchAll(FENCE_LINE)) {\n if (match.index >= cut) {\n break\n }\n const [, marker, rest] = match\n if (!openFence) {\n // A backtick in a backtick fence's info string makes it inline\n // code, not a fence.\n if (marker[0] === '`' && rest.includes('`')) {\n continue\n }\n openFence = marker\n } else if (\n marker[0] === openFence[0] &&\n marker.length >= openFence.length &&\n !rest.trim()\n ) {\n openFence = undefined\n }\n }\n const reopen = openFence ? `${openFence}\\n` : ''\n return `…\\n\\n${reopen}${markdown.slice(cut)}`\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) {\n return undefined\n }\n if ('state' in part) {\n return part.state\n }\n return undefined\n}\n\nexport function isLoadingState(state?: string): boolean {\n if (!state) {\n return false\n }\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 * True for a hex color with almost no hue: black, white and the grays between.\n * Anything else, a color the function cannot read included, counts as colored.\n */\nexport function isAchromaticColor(hexcolor: string | undefined): boolean {\n let hex = hexcolor?.trim().replace('#', '') ?? ''\n if (/^[0-9a-f]{3}$/i.test(hex)) {\n hex = hex\n .split('')\n .map((char) => char + char)\n .join('')\n }\n if (!/^[0-9a-f]{6}$/i.test(hex)) {\n return false\n }\n const channels = [0, 2, 4].map((at) =>\n parseInt(hex.substring(at, at + 2), 16),\n )\n return Math.max(...channels) - Math.min(...channels) < 32\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 * The style of a chat root (PkChatbot, the widget's shell): the agent's color\n * as the brand. Volver derives every role of the brand (graphic, readable,\n * contrast, tinted surface) on any element with `.theme`, which both roots\n * carry, so the focus ring, the primary buttons, the links and the checkboxes\n * take the agent's color with the contrast each theme needs, instead of the\n * platform's purple. The fields' focus takes the brand's graphic role in both\n * themes, since the dark theme's accent is the platform's too.\n */\nexport function agentThemeStyle(\n mainColor: string | undefined,\n contrastColor: 'black' | 'white',\n): Record<string, string> | undefined {\n if (!mainColor) {\n return undefined\n }\n return {\n '--chatbot-main-color': mainColor,\n '--chatbot-contrast-color': contrastColor,\n '--color-brand': mainColor,\n '--color-brand-contrast': contrastColor,\n '--input-focus-color': 'var(--color-brand-graphic)',\n }\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/**\n * The choices of a form step, as the radio and checkbox editors take them.\n *\n * The `value` is the LABEL and not the position, because it is what travels\n * back to the model as the answer: it reads the words it wrote, not an index.\n * Nothing here caps the list, and nothing should: the number of options an\n * agent configures is advice to the model, so a step can legitimately carry\n * more (see `showForm.tool.ts`).\n */\nexport function formStepOptions(\n step: { options?: { label: string; description?: string }[] } | undefined,\n): { label: string; value: string; description?: string }[] {\n if (!step?.options) {\n return []\n }\n return step.options.map((option) => ({\n label: option.label,\n value: option.label,\n description: option.description,\n }))\n}\n\n/**\n * Spreads the answers a form comes back with onto one slot PER STEP.\n *\n * A form's answers travel paired with step ids, and the tool schema does not\n * enforce that those ids are unique: a `.refine()` there would refuse the whole\n * form over a duplicate, which is the failure the schema was just cured of (see\n * the gotchas entry \"A configurable cap does not belong in an inputSchema\").\n * So the duplicate has to be survivable here. Keyed by id, two steps sharing\n * one collapsed onto a single answer: the second question showed the first\n * one's reply, and submitting sent that reply twice. Keyed by position, each\n * step keeps its own.\n *\n * A duplicated id restores the same incoming value to every step claiming it,\n * which is as much as the payload allows: the ids are all it says.\n */\nexport function formAnswerSlots(\n steps: { id: string }[],\n output: unknown,\n): Record<number, unknown> {\n const slots: Record<number, unknown> = {}\n if (output === undefined || output === null) {\n return slots\n }\n // A legacy single-choice answer is the plain string, and it can only\n // belong to a single-step form.\n if (typeof output === 'string') {\n if (steps.length === 1) {\n slots[0] = output\n }\n return slots\n }\n const assign = (id: string, value: unknown) => {\n steps.forEach((step, index) => {\n if (step.id === id) {\n slots[index] = value\n }\n })\n }\n const list = (output as { answers?: unknown }).answers\n if (Array.isArray(list)) {\n for (const answer of list as { id?: unknown; value?: unknown }[]) {\n if (typeof answer?.id === 'string') {\n assign(answer.id, answer.value)\n }\n }\n return slots\n }\n // Forms answered on a platform channel (the Teams modal) come back as a\n // flat record keyed by step id.\n for (const [id, value] of Object.entries(\n output as Record<string, unknown>,\n )) {\n if (value !== undefined) {\n assign(id, value)\n }\n }\n return slots\n}\n\n// Web search tool part types, gateway and provider-native\nexport const WEB_SEARCH_TOOL_TYPES: string[] = WEB_SEARCH_TOOL_KEYS.map(\n (key) => `tool-${key}`,\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 (\n part.type === 'tool-readDocumentFile' ||\n part.type === 'tool-readChatAttachment' ||\n part.type === 'tool-sendChatFile' ||\n part.type === 'tool-shareDocument'\n ) {\n return pickString(output, 'name')\n }\n if (part.type === 'tool-readSpreadsheet') {\n const sheet = pickString(input, 'sheet')\n const range = pickString(input, 'range')\n return sheet && range ? `${sheet}!${range}` : sheet\n }\n if (part.type === 'tool-editSpreadsheet') {\n return pickString(output, 'filename')\n }\n if (part.type === 'tool-readWordDocument') {\n return pickString(input, 'search') ?? pickString(input, 'from')\n }\n if (part.type === 'tool-editWordDocument') {\n return pickString(output, 'filename')\n }\n if (part.type === 'tool-querySpreadsheet') {\n // The file when the step asked for the schema; a query has no name.\n return pickString(output, 'file')\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 const host = getHostCallPart(part)\n if (host) {\n return pageToolStep(host)?.icon ?? 'ri:apps-line'\n }\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-scheduleWakeup') {\n return 'ri:alarm-line'\n }\n if (part.type === 'tool-fetchTeamsChannelHistory') {\n return 'ri:chat-history-line'\n }\n if (part.type === 'tool-readEarlierMessages') {\n return 'ri:history-line'\n }\n if (part.type === 'tool-readChatAttachment') {\n return 'ri:attachment-line'\n }\n if (part.type === 'tool-sendChatFile') {\n return 'ri:send-plane-line'\n }\n if (part.type === 'tool-enableTools') {\n return 'ri:toggle-line'\n }\n if (part.type.includes('tool-mcp')) {\n return 'mcp'\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-readSpreadsheet') {\n return 'ri:table-line'\n }\n if (part.type === 'tool-editSpreadsheet') {\n return 'ri:file-excel-2-line'\n }\n if (part.type === 'tool-shareDocument') {\n return 'ri:file-download-line'\n }\n if (part.type === 'tool-readWordDocument') {\n return 'ri:file-text-line'\n }\n if (part.type === 'tool-editWordDocument') {\n return 'ri:file-word-2-line'\n }\n if (part.type === 'tool-querySpreadsheet') {\n return 'ri:database-2-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 (part.type === 'tool-disconnectOAuthConnection') {\n return 'ri:link-unlink'\n }\n if (part.type === 'tool-requestAccountLink') {\n return 'ri:link'\n }\n if (part.type === 'tool-unlinkAccount') {\n return 'ri:link-unlink'\n }\n if (WEB_SEARCH_TOOL_TYPES.includes(part.type)) {\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/** What `toolLabel` and `getPartTypeLabel` need from vue-i18n. */\nexport interface LabelTranslator {\n t: (key: string) => string\n te: (key: string) => boolean\n}\n\nconst TOOL_KEY_PREFIXES = [\n API_TOOL_PREFIX,\n MCP_TOOL_PREFIX,\n SUBAGENT_TOOL_PREFIX,\n] as const\n\n/**\n * The name a person reads for a tool of the turn: the translated label of a\n * built-in tool, otherwise the name the agent configured, without its\n * tool-set prefix and in words (`api-festivita_nazionali` reads \"Festivita\n * nazionali\"). Never the raw key, and never an i18n key with no translation,\n * which vue-i18n would print as the key itself.\n */\nexport function toolLabel(name: string, { t, te }: LabelTranslator): string {\n if (te(`agent.tool.${name}`)) {\n return t(`agent.tool.${name}`)\n }\n const prefix = TOOL_KEY_PREFIXES.find((p) => name.startsWith(p))\n const bare = prefix ? name.slice(prefix.length) : name\n return capitalizeFirstLetter(fromAnyCase(bare).trim().toLowerCase())\n}\n\n/**\n * The kinds of message part a person can meet, each with its label. Written\n * as literal keys so the widget's library build, which keeps only the keys it\n * finds written out (apps/web-component/vite-plugins/chatLocales.ts), ships\n * them too.\n */\nconst PART_TYPE_LABELS: Record<string, (t: LabelTranslator['t']) => string> = {\n custom: (t) => t('messagePart.type.custom'),\n data: (t) => t('messagePart.type.data'),\n file: (t) => t('messagePart.type.file'),\n reasoning: (t) => t('messagePart.type.reasoning'),\n 'source-document': (t) => t('messagePart.type.sourceDocument'),\n 'source-url': (t) => t('messagePart.type.sourceUrl'),\n 'step-start': (t) => t('messagePart.type.stepStart'),\n text: (t) => t('messagePart.type.text'),\n}\n\n/**\n * The label of a message part in the message details: the tool for a tool\n * call, the translated kind otherwise (text, reasoning, provider data...),\n * and the kind in words for one the catalog does not know yet.\n */\nexport function getPartTypeLabel(\n part: UIMessage['parts'][number],\n translator: LabelTranslator,\n): string {\n if (isToolPart(part)) {\n return toolLabel(getToolPartName(part), translator)\n }\n if (part.type === 'dynamic-tool') {\n return toolLabel(part.toolName, translator)\n }\n const kind = part.type.startsWith('data-') ? 'data' : part.type\n const label = PART_TYPE_LABELS[kind]\n return label\n ? label(translator.t)\n : capitalizeFirstLetter(fromAnyCase(part.type))\n}\n\n/**\n * The commercial name of a provider the gateway routed a turn through, from\n * its slug (`anthropic`, `bedrock`): proper nouns, so no translation. A slug\n * not listed here shows with a capital, never as the bare id.\n */\nconst PROVIDER_NAMES: Record<string, string> = {\n alibaba: 'Alibaba Cloud',\n anthropic: 'Anthropic',\n azure: 'Microsoft Azure',\n baseten: 'Baseten',\n bedrock: 'Amazon Bedrock',\n cerebras: 'Cerebras',\n cohere: 'Cohere',\n deepinfra: 'DeepInfra',\n deepseek: 'DeepSeek',\n fireworks: 'Fireworks AI',\n google: 'Google',\n groq: 'Groq',\n mistral: 'Mistral AI',\n moonshotai: 'Moonshot AI',\n openai: 'OpenAI',\n perplexity: 'Perplexity',\n togetherai: 'Together AI',\n vertex: 'Google Vertex AI',\n xai: 'xAI',\n zai: 'Z.ai',\n}\n\n/** The name of a provider slug, see `PROVIDER_NAMES`. */\nexport function providerLabel(slug: string): string {\n return (\n PROVIDER_NAMES[slug.toLowerCase()] ??\n capitalizeFirstLetter(fromAnyCase(slug))\n )\n}\n\n/**\n * The conversation summary in the reader's language. The analysis asks the\n * model for four bold labels (`SUMMARY_FORMAT` in\n * apps/backend/src/prompts/analysis.prompt.ts) and the model copies them in\n * English whatever the conversation's language, so every stored summary\n * holds them: they are translated where a summary is read. An empty summary\n * comes back as it is, so a `??` fallback after it still works.\n */\nexport function localizeSummaryLabels<T extends string | null | undefined>(\n summary: T,\n t: (key: string) => string,\n): T {\n if (!summary) {\n return summary\n }\n const labels: Record<string, string> = {\n Intent: t('conversationSummary.intent'),\n 'Topics covered': t('conversationSummary.topicsCovered'),\n 'Key facts': t('conversationSummary.keyFacts'),\n 'Open questions': t('conversationSummary.openQuestions'),\n }\n return summary.replace(\n /\\*\\*(Intent|Topics covered|Key facts|Open questions)(:?)\\*\\*/g,\n (_, label: string, colon: string) => `**${labels[label]}${colon}**`,\n ) as T\n}\n\n// Get part label\nexport function getToolPartLabel(\n $t: (key: string) => string,\n part?: UIMessage['parts'][number] | null,\n /** The live titles of the page's steps, by call: they win when present. */\n hostStepTitles?: Record<string, string>,\n): string | undefined {\n const host = getHostCallPart(part)\n if (host) {\n const live = host.toolCallId\n ? hostStepTitles?.[host.toolCallId]\n : undefined\n if (live) {\n return live\n }\n const page = pageToolStep(host)\n return page ? $t(page.label) : host.title || host.toolName\n }\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-scheduleWakeup') {\n return $t(`messagePart.scheduleWakeup`)\n }\n if (part.type === 'tool-fetchTeamsChannelHistory') {\n return $t(`messagePart.fetchTeamsChannelHistory`)\n }\n if (part.type === 'tool-readEarlierMessages') {\n return $t(`messagePart.readEarlierMessages`)\n }\n if (part.type === 'tool-readChatAttachment') {\n return $t(`messagePart.readChatAttachment`)\n }\n if (part.type === 'tool-sendChatFile') {\n return $t(`messagePart.sendChatFile`)\n }\n if (part.type === 'tool-enableTools') {\n return $t(`messagePart.enableTools`)\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-readSpreadsheet') {\n return $t(`messagePart.readSpreadsheet`)\n }\n if (part.type === 'tool-editSpreadsheet') {\n return $t(`messagePart.editSpreadsheet`)\n }\n if (part.type === 'tool-shareDocument') {\n return $t(`messagePart.shareDocument`)\n }\n if (part.type === 'tool-readWordDocument') {\n return $t(`messagePart.readWordDocument`)\n }\n if (part.type === 'tool-editWordDocument') {\n return $t(`messagePart.editWordDocument`)\n }\n if (part.type === 'tool-querySpreadsheet') {\n return $t(`messagePart.querySpreadsheet`)\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 (part.type === 'tool-disconnectOAuthConnection') {\n return $t(`messagePart.disconnectOAuthConnection`)\n }\n if (part.type === 'tool-requestAccountLink') {\n return $t(`messagePart.requestAccountLink`)\n }\n if (part.type === 'tool-unlinkAccount') {\n return $t(`messagePart.unlinkAccount`)\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":";;;;AAAA,IAAaU,KAAiB,MAC1BC,EAAI,UAAU,KAAK,CAAC,CAAC,QAAQ,oBAAoB,EAAE,GAkB1CC,KAAe,MACnBD,IAGEA,EACF,QAAQ,sBAAsB,OAAO,CAAC,CACtC,QAAQ,yBAAyB,OAAO,CAAC,CACzC,QAAQ,UAAU,GAAG,IALf,IAiBFE,KAAiC,MACrCF,IAGED,EAAcC,CAAG,CAAC,CACpB,QAAQ,sBAAsB,OAAO,CAAC,CACtC,QAAQ,kBAAkB,GAAG,CAAC,CAC9B,YAAY,IALN,IAeFG,KAAiC,MACr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ACPqH,EAAG,0BAA0B,IAEpCrH,EAAK,SAAS,oBACPqH,EAAG,wBAAwB,IAElCrH,EAAK,SAAS,0BACPqH,EAAG,8BAA8B,IAExCrH,EAAK,SAAS,mBACPqH,EAAG,uBAAuB,IAEjCrH,EAAK,SAAS,4BACPqH,EAAG,gCAAgC,IAE1CrH,EAAK,SAAS,4BACPqH,EAAG,gCAAgC,IAE1CrH,EAAK,SAAS,mCACPqH,EAAG,uCAAuC,IAEjDrH,EAAK,SAAS,4BACPqH,EAAG,gCAAgC,IAE1CrH,EAAK,SAAS,uBACPqH,EAAG,2BAA2B,IAErCrC,EAAsB,SAAShF,EAAK,IAAI,IACjCqH,EAAG,uBAAuB,IAE9BA,EAAG,kBAAkB,IAE5BjI,EAAgBY,CAAI,IACbqH,EAAG,uBAAuB,IAE9BA,EAAG,uBAAuB;AACrC"}
|
|
1
|
+
{"version":3,"file":"utils-Df_SeBdX.js","names":["isHostToolPart","WEB_SEARCH_TOOL_KEYS","SUBAGENT_TOOL_PREFIX","isPresentationTool","API_TOOL_PREFIX","MCP_TOOL_PREFIX","isReasoningPart","getToolPartName","isTextPart","isToolPart","removeAccents","str","fromAnyCase","toKebabCase","toSnakeCase","capitalizeFirstLetter","mergeConsecutiveTextParts","merged","part","parts","prev","isWidgetPart","dropCorrectedWidgetErrors","lastDrawn","index","isStreamingPart","FILE_OUTPUT_PARTS","moveFileOutputsLast","files","feedPartKey","toolCallId","getHostCallPart","PAGE_TOOL_STEPS","HOST_STEP_TITLES","FORM_TOOL_STEP","pageToolStep","host","isHostActionPart","LIVE_REASONING_TAIL_LENGTH","FENCE_LINE","getMarkdownTail","markdown","maxLength","from","limit","boundary","length","cut","openFence","match","marker","rest","TOOL_APPROVAL_STATES","isToolApprovalPart","CONFIRM_TOOL_NAME","isToolConfirmPart","isConfirmationCardPart","getToolApprovalId","getPartState","isLoadingState","state","getContrast","hex","hexcolor","char","r","g","b","linearize","c","resolveContrastColor","textColor","mainColor","agentThemeStyle","contrastColor","formatDuration","ms","$n","stringifyPayload","value","json","hasPayload","formAnswerAsSpoken","input","answer","question","questionById","step","said","id","formStepOptions","option","formAnswerSlots","slots","output","steps","assign","list","WEB_SEARCH_TOOL_TYPES","key","RICH_DETAIL_TOOL_TYPES","hasRichToolDetail","asRecord","pickString","keys","record","getToolPartSummary","queries","valid","query","sheet","range","getPartIcon","TOOL_KEY_PREFIXES","toolLabel","te","name","prefix","p","PART_TYPE_LABELS","t","getPartTypeLabel","translator","label","PROVIDER_NAMES","providerLabel","slug","localizeSummaryLabels","summary","labels","colon","getToolPartLabel","live","hostStepTitles","page","$t"],"sources":["../../../../packages/utils/src/text.ts","../../../../packages/components/src/chat/utils.ts"],"sourcesContent":["export const removeAccents = (str: string) =>\n str.normalize('NFD').replace(/[\\u0300-\\u036f]/g, '')\n\nexport const toCamelCase = <T extends string>(str?: string): T => {\n if (!str) {\n return '' as unknown as T\n }\n return removeAccents(str)\n .replace(/[^a-zA-Z0-9]+(.)?/g, (_, c) => (c ? c.toUpperCase() : ''))\n .replace(/^(.)/, (match) => match.toLowerCase()) as unknown as T\n}\n\nexport const fromCamelCase = (str?: string): string => {\n if (!str) {\n return ''\n }\n return str.replace(/([a-z0-9])([A-Z])/g, '$1 $2')\n}\n\nexport const fromAnyCase = (str?: string): string => {\n if (!str) {\n return ''\n }\n return str\n .replace(/([a-z0-9])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/[-_]+/g, ' ')\n}\n\nexport const toPascalCase = <T extends string>(str?: string): T => {\n if (!str) {\n return '' as unknown as T\n }\n return removeAccents(str)\n .replace(/[^a-zA-Z0-9]+(.)?/g, (_, c) => (c ? c.toUpperCase() : ''))\n .replace(/^(.)/, (match) => match.toUpperCase()) as unknown as T\n}\n\nexport const toKebabCase = <T extends string>(str?: string): T => {\n if (!str) {\n return '' as unknown as T\n }\n return removeAccents(str)\n .replace(/([a-z0-9])([A-Z])/g, '$1-$2')\n .replace(/[^a-zA-Z0-9]+/g, '-')\n .toLowerCase() as unknown as T\n}\n\nexport const fromKebabCase = (str?: string): string => {\n if (!str) {\n return ''\n }\n return str.replace(/-/g, ' ')\n}\n\nexport const toSnakeCase = <T extends string>(str?: string): T => {\n if (!str) {\n return '' as unknown as T\n }\n return removeAccents(str)\n .replace(/([a-z0-9])([A-Z])/g, '$1_$2')\n .replace(/[^a-zA-Z0-9]+/g, '_')\n .toLowerCase() as unknown as T\n}\n\nexport const capitalizeFirstLetter = (str?: string) => {\n if (!str) {\n return ''\n }\n return str.charAt(0).toUpperCase() + str.slice(1)\n}\n\nexport const lowercaseFirstLetter = (str?: string) => {\n if (!str) {\n return ''\n }\n return str.charAt(0).toLowerCase() + str.slice(1)\n}\n","import type { UIMessage } from 'ai'\nimport type { InjectionKey, Ref } from 'vue'\nimport {\n API_TOOL_PREFIX,\n MCP_TOOL_PREFIX,\n SUBAGENT_TOOL_PREFIX,\n WEB_SEARCH_TOOL_KEYS,\n isHostToolPart,\n isPresentationTool,\n} from 'models'\nimport {\n isTextPart,\n isFilePart,\n isToolPart,\n isReasoningPart,\n hasPartText,\n hasTextPart,\n getTextPart,\n getMessageText,\n getToolPartName,\n capitalizeFirstLetter,\n fromAnyCase,\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\nconst isWidgetPart = (\n part: UIMessage['parts'][number],\n): part is Extract<UIMessage['parts'][number], { type: `tool-${string}` }> =>\n isToolPart(part) && isPresentationTool(getToolPartName(part))\n\n/**\n * Drops a widget call refused for its arguments when a later call of the same\n * widget in the message was drawn: the turn corrected it (the backend's\n * `correctableInputRefusals`), and the refusal would sit next to the working\n * widget, `showForm` drawing its render error above the form. A refusal with\n * nothing drawn after it stays. Only the feed reads this: the steps timeline\n * keeps every call, the refused one included.\n */\nexport function dropCorrectedWidgetErrors(\n parts: UIMessage['parts'],\n): UIMessage['parts'] {\n const lastDrawn = new Map<string, number>()\n for (const [index, part] of parts.entries()) {\n if (\n isWidgetPart(part) &&\n part.state !== 'output-error' &&\n !isStreamingPart(part)\n ) {\n lastDrawn.set(part.type, index)\n }\n }\n return parts.filter(\n (part, index) =>\n !(\n isWidgetPart(part) &&\n part.state === 'output-error' &&\n (lastDrawn.get(part.type) ?? -1) > index\n ),\n )\n}\n\n/**\n * Tool calls whose output is a file for the user to download. The feed draws\n * them after the answer, where the reader arrives, wherever in the message the\n * model made the call: a version written before a long answer sat above it,\n * out of sight.\n */\nconst FILE_OUTPUT_PARTS: ReadonlySet<string> = new Set([\n 'tool-editSpreadsheet',\n 'tool-shareDocument',\n 'tool-editWordDocument',\n])\n\n/** The parts with the file outputs moved last, in their own order. */\nexport function moveFileOutputsLast(\n parts: UIMessage['parts'],\n): UIMessage['parts'] {\n const files = parts.filter((part) => FILE_OUTPUT_PARTS.has(part.type))\n return files.length > 0\n ? [\n ...parts.filter((part) => !FILE_OUTPUT_PARTS.has(part.type)),\n ...files,\n ]\n : parts\n}\n\n/**\n * The key of a part in the feed. Its position, except for a file output: that\n * one is always last, so its position moves as the answer grows, and keyed by\n * it the card would be redrawn at every new part.\n */\nexport function feedPartKey(\n part: UIMessage['parts'][number],\n index: number,\n): string | number {\n const toolCallId = (part as { toolCallId?: string }).toolCallId\n return FILE_OUTPUT_PARTS.has(part.type) && toolCallId\n ? `file-${toolCallId}`\n : index\n}\n\n/** A call the embedding page runs, as the backend stamped it (spec `host-tools.md`). */\ninterface HostCallPart {\n toolCallId?: string\n toolName: string\n title?: string\n state?: string\n errorText?: string\n toolMetadata?: { readOnly?: boolean; provider?: 'app' | 'page' }\n}\n\nexport function getHostCallPart(\n part: UIMessage['parts'][number] | null | undefined,\n): HostCallPart | undefined {\n return isHostToolPart(part) ? (part as unknown as HostCallPart) : undefined\n}\n\n/**\n * The page tools of the widget (spec `page-tools.md`): defined by the backend,\n * so their step is ours to name, in the user's language. A tool the app\n * registered is named by its own `title`.\n */\nconst PAGE_TOOL_STEPS: Record<string, { icon: string; label: string }> = {\n page_snapshot: {\n icon: 'ri:pages-line',\n label: 'messagePart.pageTool.snapshot',\n },\n page_read: {\n icon: 'ri:file-text-line',\n label: 'messagePart.pageTool.read',\n },\n page_click: { icon: 'ri:cursor-line', label: 'messagePart.pageTool.click' },\n page_fill: { icon: 'ri:edit-line', label: 'messagePart.pageTool.fill' },\n page_scroll: {\n icon: 'ri:arrow-up-down-line',\n label: 'messagePart.pageTool.scroll',\n },\n page_find: { icon: 'ri:search-line', label: 'messagePart.pageTool.find' },\n page_wait: { icon: 'ri:time-line', label: 'messagePart.pageTool.wait' },\n page_hover: {\n icon: 'ri:cursor-line',\n label: 'messagePart.pageTool.hover',\n },\n page_press: {\n icon: 'ri:keyboard-line',\n label: 'messagePart.pageTool.press',\n },\n page_back: {\n icon: 'ri:arrow-go-back-line',\n label: 'messagePart.pageTool.back',\n },\n page_navigate: {\n icon: 'ri:links-line',\n label: 'messagePart.pageTool.navigate',\n },\n}\n\n/**\n * The titles the widget gave this page's steps, by call, naming what each\n * acts on (spec `page-tools-improvements.md`, M8): provided by the chat view\n * from its store, read by the views that list the steps.\n */\nexport const HOST_STEP_TITLES: InjectionKey<Ref<Record<string, string>>> =\n Symbol('hostStepTitles')\n\n/** A form the site annotated for agents: its tool is named `form_<toolname>`. */\nconst FORM_TOOL_STEP = {\n icon: 'ri:survey-line',\n label: 'messagePart.pageTool.form',\n}\n\nconst pageToolStep = (host: HostCallPart) =>\n host.toolMetadata?.provider === 'page'\n ? (PAGE_TOOL_STEPS[host.toolName] ??\n (host.toolName.startsWith('form_') ? FORM_TOOL_STEP : undefined))\n : undefined\n\n/**\n * A host call that changes something in the app or on the page: the feed\n * shows it even without the steps timeline, because what it did stays done.\n */\nexport function isHostActionPart(\n part: UIMessage['parts'][number] | null | undefined,\n): boolean {\n return getHostCallPart(part)?.toolMetadata?.readOnly === false\n}\n\nexport function isStreamingPart(\n part: UIMessage['parts'][number] | null | undefined,\n): part is Extract<UIMessage['parts'][number], { streaming?: boolean }> {\n if (!part) {\n return false\n }\n if ('state' in part) {\n return part.state === 'streaming' || part.state === 'input-streaming'\n }\n return false\n}\n\n/**\n * How much of a reasoning still being written its live box renders. The box is\n * a few lines tall and follows the bottom, while the reasoning of one turn runs\n * to tens of kilobytes: chat `st0Eg8iG0zUX0HQN` wrote 92KB, and parsing all of\n * it at every delta froze the tab. Four thousand characters leave a few screens\n * to scroll back through, and a finished step renders all of it.\n */\nexport const LIVE_REASONING_TAIL_LENGTH = 4000\n\n// A fence opener or closer, also inside a list item or a quote, whose markers\n// and indentation are skipped. The rest of the line tells them apart: a\n// closing fence carries no info string.\nconst FENCE_LINE =\n /^[ \\t]*(?:(?:[-*+]|\\d{1,9}[.)])[ \\t]+|>[ \\t]?)*(`{3,}|~{3,})(.*)$/gm\n\n/**\n * The end of a markdown text, at most `maxLength` characters long, cut on a\n * blank line (a line break when there is none) so it does not open on half a\n * paragraph. A table or a formula can still be cut in two. An ellipsis marks\n * the cut. A cut inside a fenced code block reopens the fence, or the rest of\n * the text would render as code and the code as prose.\n */\nexport function getMarkdownTail(markdown: string, maxLength: number): string {\n if (markdown.length <= maxLength) {\n return markdown\n }\n const from = markdown.length - maxLength\n // The boundary is looked for in the first half of the window only: the one\n // blank line of the window can be the last thing written, and cutting there\n // would leave nothing to render.\n const limit = from + maxLength / 2\n const boundary = (index: number, length: number) =>\n index !== -1 && index < limit ? index + length : undefined\n const cut =\n boundary(markdown.indexOf('\\n\\n', from), 2) ??\n boundary(markdown.indexOf('\\n', from), 1) ??\n from\n let openFence: string | undefined\n for (const match of markdown.matchAll(FENCE_LINE)) {\n if (match.index >= cut) {\n break\n }\n const [, marker, rest] = match\n if (!openFence) {\n // A backtick in a backtick fence's info string makes it inline\n // code, not a fence.\n if (marker[0] === '`' && rest.includes('`')) {\n continue\n }\n openFence = marker\n } else if (\n marker[0] === openFence[0] &&\n marker.length >= openFence.length &&\n !rest.trim()\n ) {\n openFence = undefined\n }\n }\n const reopen = openFence ? `${openFence}\\n` : ''\n return `…\\n\\n${reopen}${markdown.slice(cut)}`\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) {\n return undefined\n }\n if ('state' in part) {\n return part.state\n }\n return undefined\n}\n\nexport function isLoadingState(state?: string): boolean {\n if (!state) {\n return false\n }\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 * True for a hex color with almost no hue: black, white and the grays between.\n * Anything else, a color the function cannot read included, counts as colored.\n */\nexport function isAchromaticColor(hexcolor: string | undefined): boolean {\n let hex = hexcolor?.trim().replace('#', '') ?? ''\n if (/^[0-9a-f]{3}$/i.test(hex)) {\n hex = hex\n .split('')\n .map((char) => char + char)\n .join('')\n }\n if (!/^[0-9a-f]{6}$/i.test(hex)) {\n return false\n }\n const channels = [0, 2, 4].map((at) =>\n parseInt(hex.substring(at, at + 2), 16),\n )\n return Math.max(...channels) - Math.min(...channels) < 32\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 * The style of a chat root (PkChatbot, the widget's shell): the agent's color\n * as the brand. Volver derives every role of the brand (graphic, readable,\n * contrast, tinted surface) on any element with `.theme`, which both roots\n * carry, so the focus ring, the primary buttons, the links and the checkboxes\n * take the agent's color with the contrast each theme needs, instead of the\n * platform's purple. The fields' focus takes the brand's graphic role in both\n * themes, since the dark theme's accent is the platform's too.\n */\nexport function agentThemeStyle(\n mainColor: string | undefined,\n contrastColor: 'black' | 'white',\n): Record<string, string> | undefined {\n if (!mainColor) {\n return undefined\n }\n return {\n '--chatbot-main-color': mainColor,\n '--chatbot-contrast-color': contrastColor,\n '--color-brand': mainColor,\n '--color-brand-contrast': contrastColor,\n '--input-focus-color': 'var(--color-brand-graphic)',\n }\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/**\n * The choices of a form step, as the radio and checkbox editors take them.\n *\n * The `value` is the LABEL and not the position, because it is what travels\n * back to the model as the answer: it reads the words it wrote, not an index.\n * Nothing here caps the list, and nothing should: the number of options an\n * agent configures is advice to the model, so a step can legitimately carry\n * more (see `showForm.tool.ts`).\n */\nexport function formStepOptions(\n step: { options?: { label: string; description?: string }[] } | undefined,\n): { label: string; value: string; description?: string }[] {\n if (!step?.options) {\n return []\n }\n return step.options.map((option) => ({\n label: option.label,\n value: option.label,\n description: option.description,\n }))\n}\n\n/**\n * Spreads the answers a form comes back with onto one slot PER STEP.\n *\n * A form's answers travel paired with step ids, and the tool schema does not\n * enforce that those ids are unique: a `.refine()` there would refuse the whole\n * form over a duplicate, which is the failure the schema was just cured of (see\n * the gotchas entry \"A configurable cap does not belong in an inputSchema\").\n * So the duplicate has to be survivable here. Keyed by id, two steps sharing\n * one collapsed onto a single answer: the second question showed the first\n * one's reply, and submitting sent that reply twice. Keyed by position, each\n * step keeps its own.\n *\n * A duplicated id restores the same incoming value to every step claiming it,\n * which is as much as the payload allows: the ids are all it says.\n */\nexport function formAnswerSlots(\n steps: { id: string }[],\n output: unknown,\n): Record<number, unknown> {\n const slots: Record<number, unknown> = {}\n if (output === undefined || output === null) {\n return slots\n }\n // A legacy single-choice answer is the plain string, and it can only\n // belong to a single-step form.\n if (typeof output === 'string') {\n if (steps.length === 1) {\n slots[0] = output\n }\n return slots\n }\n const assign = (id: string, value: unknown) => {\n steps.forEach((step, index) => {\n if (step.id === id) {\n slots[index] = value\n }\n })\n }\n const list = (output as { answers?: unknown }).answers\n if (Array.isArray(list)) {\n for (const answer of list as { id?: unknown; value?: unknown }[]) {\n if (typeof answer?.id === 'string') {\n assign(answer.id, answer.value)\n }\n }\n return slots\n }\n // Forms answered on a platform channel (the Teams modal) come back as a\n // flat record keyed by step id.\n for (const [id, value] of Object.entries(\n output as Record<string, unknown>,\n )) {\n if (value !== undefined) {\n assign(id, value)\n }\n }\n return slots\n}\n\n// Web search tool part types, gateway and provider-native\nexport const WEB_SEARCH_TOOL_TYPES: string[] = WEB_SEARCH_TOOL_KEYS.map(\n (key) => `tool-${key}`,\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 (\n part.type === 'tool-readDocumentFile' ||\n part.type === 'tool-readChatAttachment' ||\n part.type === 'tool-sendChatFile' ||\n part.type === 'tool-shareDocument'\n ) {\n return pickString(output, 'name')\n }\n if (part.type === 'tool-readSpreadsheet') {\n const sheet = pickString(input, 'sheet')\n const range = pickString(input, 'range')\n return sheet && range ? `${sheet}!${range}` : sheet\n }\n if (part.type === 'tool-editSpreadsheet') {\n return pickString(output, 'filename')\n }\n if (part.type === 'tool-readWordDocument') {\n return pickString(input, 'search') ?? pickString(input, 'from')\n }\n if (part.type === 'tool-editWordDocument') {\n return pickString(output, 'filename')\n }\n if (part.type === 'tool-querySpreadsheet') {\n // The file when the step asked for the schema; a query has no name.\n return pickString(output, 'file')\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 const host = getHostCallPart(part)\n if (host) {\n return pageToolStep(host)?.icon ?? 'ri:apps-line'\n }\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-scheduleWakeup') {\n return 'ri:alarm-line'\n }\n if (part.type === 'tool-fetchTeamsChannelHistory') {\n return 'ri:chat-history-line'\n }\n if (part.type === 'tool-readEarlierMessages') {\n return 'ri:history-line'\n }\n if (part.type === 'tool-readChatAttachment') {\n return 'ri:attachment-line'\n }\n if (part.type === 'tool-sendChatFile') {\n return 'ri:send-plane-line'\n }\n if (part.type === 'tool-enableTools') {\n return 'ri:toggle-line'\n }\n if (part.type.includes('tool-mcp')) {\n return 'mcp'\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-readSpreadsheet') {\n return 'ri:table-line'\n }\n if (part.type === 'tool-editSpreadsheet') {\n return 'ri:file-excel-2-line'\n }\n if (part.type === 'tool-shareDocument') {\n return 'ri:file-download-line'\n }\n if (part.type === 'tool-readWordDocument') {\n return 'ri:file-text-line'\n }\n if (part.type === 'tool-editWordDocument') {\n return 'ri:file-word-2-line'\n }\n if (part.type === 'tool-querySpreadsheet') {\n return 'ri:database-2-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 (part.type === 'tool-disconnectOAuthConnection') {\n return 'ri:link-unlink'\n }\n if (part.type === 'tool-requestAccountLink') {\n return 'ri:link'\n }\n if (part.type === 'tool-unlinkAccount') {\n return 'ri:link-unlink'\n }\n if (WEB_SEARCH_TOOL_TYPES.includes(part.type)) {\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/** What `toolLabel` and `getPartTypeLabel` need from vue-i18n. */\nexport interface LabelTranslator {\n t: (key: string) => string\n te: (key: string) => boolean\n}\n\nconst TOOL_KEY_PREFIXES = [\n API_TOOL_PREFIX,\n MCP_TOOL_PREFIX,\n SUBAGENT_TOOL_PREFIX,\n] as const\n\n/**\n * The name a person reads for a tool of the turn: the translated label of a\n * built-in tool, otherwise the name the agent configured, without its\n * tool-set prefix and in words (`api-festivita_nazionali` reads \"Festivita\n * nazionali\"). Never the raw key, and never an i18n key with no translation,\n * which vue-i18n would print as the key itself.\n */\nexport function toolLabel(name: string, { t, te }: LabelTranslator): string {\n if (te(`agent.tool.${name}`)) {\n return t(`agent.tool.${name}`)\n }\n const prefix = TOOL_KEY_PREFIXES.find((p) => name.startsWith(p))\n const bare = prefix ? name.slice(prefix.length) : name\n return capitalizeFirstLetter(fromAnyCase(bare).trim().toLowerCase())\n}\n\n/**\n * The kinds of message part a person can meet, each with its label. Written\n * as literal keys so the widget's library build, which keeps only the keys it\n * finds written out (apps/web-component/vite-plugins/chatLocales.ts), ships\n * them too.\n */\nconst PART_TYPE_LABELS: Record<string, (t: LabelTranslator['t']) => string> = {\n custom: (t) => t('messagePart.type.custom'),\n data: (t) => t('messagePart.type.data'),\n file: (t) => t('messagePart.type.file'),\n reasoning: (t) => t('messagePart.type.reasoning'),\n 'source-document': (t) => t('messagePart.type.sourceDocument'),\n 'source-url': (t) => t('messagePart.type.sourceUrl'),\n 'step-start': (t) => t('messagePart.type.stepStart'),\n text: (t) => t('messagePart.type.text'),\n}\n\n/**\n * The label of a message part in the message details: the tool for a tool\n * call, the translated kind otherwise (text, reasoning, provider data...),\n * and the kind in words for one the catalog does not know yet.\n */\nexport function getPartTypeLabel(\n part: UIMessage['parts'][number],\n translator: LabelTranslator,\n): string {\n if (isToolPart(part)) {\n return toolLabel(getToolPartName(part), translator)\n }\n if (part.type === 'dynamic-tool') {\n return toolLabel(part.toolName, translator)\n }\n const kind = part.type.startsWith('data-') ? 'data' : part.type\n const label = PART_TYPE_LABELS[kind]\n return label\n ? label(translator.t)\n : capitalizeFirstLetter(fromAnyCase(part.type))\n}\n\n/**\n * The commercial name of a provider the gateway routed a turn through, from\n * its slug (`anthropic`, `bedrock`): proper nouns, so no translation. A slug\n * not listed here shows with a capital, never as the bare id.\n */\nconst PROVIDER_NAMES: Record<string, string> = {\n alibaba: 'Alibaba Cloud',\n anthropic: 'Anthropic',\n azure: 'Microsoft Azure',\n baseten: 'Baseten',\n bedrock: 'Amazon Bedrock',\n cerebras: 'Cerebras',\n cohere: 'Cohere',\n deepinfra: 'DeepInfra',\n deepseek: 'DeepSeek',\n fireworks: 'Fireworks AI',\n google: 'Google',\n groq: 'Groq',\n mistral: 'Mistral AI',\n moonshotai: 'Moonshot AI',\n openai: 'OpenAI',\n perplexity: 'Perplexity',\n togetherai: 'Together AI',\n vertex: 'Google Vertex AI',\n xai: 'xAI',\n zai: 'Z.ai',\n}\n\n/** The name of a provider slug, see `PROVIDER_NAMES`. */\nexport function providerLabel(slug: string): string {\n return (\n PROVIDER_NAMES[slug.toLowerCase()] ??\n capitalizeFirstLetter(fromAnyCase(slug))\n )\n}\n\n/**\n * The conversation summary in the reader's language. The analysis asks the\n * model for four bold labels (`SUMMARY_FORMAT` in\n * apps/backend/src/prompts/analysis.prompt.ts) and the model copies them in\n * English whatever the conversation's language, so every stored summary\n * holds them: they are translated where a summary is read. An empty summary\n * comes back as it is, so a `??` fallback after it still works.\n */\nexport function localizeSummaryLabels<T extends string | null | undefined>(\n summary: T,\n t: (key: string) => string,\n): T {\n if (!summary) {\n return summary\n }\n const labels: Record<string, string> = {\n Intent: t('conversationSummary.intent'),\n 'Topics covered': t('conversationSummary.topicsCovered'),\n 'Key facts': t('conversationSummary.keyFacts'),\n 'Open questions': t('conversationSummary.openQuestions'),\n }\n return summary.replace(\n /\\*\\*(Intent|Topics covered|Key facts|Open questions)(:?)\\*\\*/g,\n (_, label: string, colon: string) => `**${labels[label]}${colon}**`,\n ) as T\n}\n\n// Get part label\nexport function getToolPartLabel(\n $t: (key: string) => string,\n part?: UIMessage['parts'][number] | null,\n /** The live titles of the page's steps, by call: they win when present. */\n hostStepTitles?: Record<string, string>,\n): string | undefined {\n const host = getHostCallPart(part)\n if (host) {\n const live = host.toolCallId\n ? hostStepTitles?.[host.toolCallId]\n : undefined\n if (live) {\n return live\n }\n const page = pageToolStep(host)\n return page ? $t(page.label) : host.title || host.toolName\n }\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-scheduleWakeup') {\n return $t(`messagePart.scheduleWakeup`)\n }\n if (part.type === 'tool-fetchTeamsChannelHistory') {\n return $t(`messagePart.fetchTeamsChannelHistory`)\n }\n if (part.type === 'tool-readEarlierMessages') {\n return $t(`messagePart.readEarlierMessages`)\n }\n if (part.type === 'tool-readChatAttachment') {\n return $t(`messagePart.readChatAttachment`)\n }\n if (part.type === 'tool-sendChatFile') {\n return $t(`messagePart.sendChatFile`)\n }\n if (part.type === 'tool-enableTools') {\n return $t(`messagePart.enableTools`)\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-readSpreadsheet') {\n return $t(`messagePart.readSpreadsheet`)\n }\n if (part.type === 'tool-editSpreadsheet') {\n return $t(`messagePart.editSpreadsheet`)\n }\n if (part.type === 'tool-shareDocument') {\n return $t(`messagePart.shareDocument`)\n }\n if (part.type === 'tool-readWordDocument') {\n return $t(`messagePart.readWordDocument`)\n }\n if (part.type === 'tool-editWordDocument') {\n return $t(`messagePart.editWordDocument`)\n }\n if (part.type === 'tool-querySpreadsheet') {\n return $t(`messagePart.querySpreadsheet`)\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 (part.type === 'tool-disconnectOAuthConnection') {\n return $t(`messagePart.disconnectOAuthConnection`)\n }\n if (part.type === 'tool-requestAccountLink') {\n return $t(`messagePart.requestAccountLink`)\n }\n if (part.type === 'tool-unlinkAccount') {\n return $t(`messagePart.unlinkAccount`)\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":";;;;AAAA,IAAaU,KAAiB,MAC1BC,EAAI,UAAU,KAAK,CAAC,CAAC,QAAQ,oBAAoB,EAAE,GAkB1CC,KAAe,MACnBD,IAGEA,EACF,QAAQ,sBAAsB,OAAO,CAAC,CACtC,QAAQ,yBAAyB,OAAO,CAAC,CACzC,QAAQ,UAAU,GAAG,IALf,IAiBFE,KAAiC,MACrCF,IAGED,EAAcC,CAAG,CAAC,CACpB,QAAQ,sBAAsB,OAAO,CAAC,CACtC,QAAQ,kBAAkB,GAAG,CAAC,CAC9B,YAAY,IALN,IAeFG,KAAiC,MACrCH,IAGED,EAAcC,CAAG,CAAC,CACpB,QAAQ,sBAAsB,OAAO,CAAC,CACtC,QAAQ,kBAAkB,GAAG,CAAC,CAC9B,YAAY,IALN,IAQFI,KAAyB,MAC7BJ,IAGEA,EAAI,OAAO,CAAC,CAAC,CAAC,YAAY,IAAIA,EAAI,MAAM,CAAC,IAFrC;;AC3Bf,SAAgBK,EACZ,GACkB;CAClB,IAAMC,IAA6B,CAAC;CACpC,KAAK,IAAMC,KAAQC,GAAO;EACtB,IAAI,CAACX,EAAWU,CAAI,GAAG;GACnB,EAAO,KAAKA,CAAI;GAChB;EACJ;EACA,IAAME,IAAOH,EAAOA,EAAO,SAAS;EACpC,AAAIG,KAAQZ,EAAWY,CAAI,IACvB,EAAOH,EAAO,SAAS,KAAK;GAAE,GAAGG;GAAM,MAAMA,EAAK,OAAOF,EAAK;EAAK,IAEnED,EAAO,KAAKC,CAAI;CAExB;CACA,OAAOD;AACX;AAEA,IAAMI,KACF,MAEAZ,EAAWS,CAAI,KA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-
|
|
1
|
+
export { t as createChatbotApiClient } from "./_chunks/createChatbotApiClient-B3U31J_K.js";
|
package/dist-vue/composables.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { g as e, h as t } from "./_chunks/Agent-
|
|
2
|
-
import { t as n } from "./_chunks/createChatbotApiClient-
|
|
3
|
-
import { n as r } from "./_chunks/useChatbotStore-
|
|
1
|
+
import { g as e, h as t } from "./_chunks/Agent-B-jQOrER.js";
|
|
2
|
+
import { t as n } from "./_chunks/createChatbotApiClient-B3U31J_K.js";
|
|
3
|
+
import { n as r } from "./_chunks/useChatbotStore-D2L4m3iJ.js";
|
|
4
4
|
import { n as i } from "./_chunks/src-B-ZKEhTU.js";
|
|
5
|
-
import { a, j as o } from "./_chunks/utils-
|
|
5
|
+
import { a, j as o } from "./_chunks/utils-Df_SeBdX.js";
|
|
6
6
|
import { t as s } from "./_chunks/useLocalizedString-Dmn92nix.js";
|
|
7
7
|
import { computed as c, getCurrentInstance as l, getCurrentScope as u, onBeforeUnmount as d, onMounted as f, onScopeDispose as p, ref as m, toValue as h, watch as g } from "vue";
|
|
8
8
|
import { createI18n as _ } from "vue-i18n";
|
package/dist-vue/index.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { t as e } from "./_chunks/rolldown-runtime-CGnMp29N.js";
|
|
2
|
-
import { i as t, r as n, t as r } from "./_chunks/PkToolShowForm-
|
|
2
|
+
import { i as t, r as n, t as r } from "./_chunks/PkToolShowForm-qMBAEKxf.js";
|
|
3
3
|
import { E as i, S as a, T as o, _ as s, f as c, m as l, o as u, r as d, s as f, u as p, v as m, w as h, x as g, y as _ } from "./_chunks/schemas-BO5QlXAp.js";
|
|
4
|
-
import { t as v } from "./_chunks/PkChatbotMessages-
|
|
4
|
+
import { t as v } from "./_chunks/PkChatbotMessages-BVzOnfjU.js";
|
|
5
5
|
import { a as y, i as ee, l as b, n as x, r as S } from "./_chunks/Media-DylqhvaF.js";
|
|
6
|
-
import { C, F as te, G as w, I as ne, J as re, K as ie, L as ae, M as oe, N as se, P as ce, R as le, S as ue, T as de, V as fe, W as pe, Y as me, _ as he, a as ge, at as _e, b as ve, ct as ye, d as be, dt as xe, f as Se, i as Ce, it as we, j as Te, nt as Ee, ot as De, p as Oe, q as ke, r as T, rt as Ae, s as je, st as Me, t as Ne, tt as Pe, w as Fe, y as Ie } from "./_chunks/Agent-
|
|
7
|
-
import { c as Le, d as Re, l as ze, r as Be, s as Ve, t as He, u as Ue } from "./_chunks/Document-
|
|
8
|
-
import { a as We, i as Ge, n as Ke } from "./_chunks/createChatbotApiClient-
|
|
6
|
+
import { C, F as te, G as w, I as ne, J as re, K as ie, L as ae, M as oe, N as se, P as ce, R as le, S as ue, T as de, V as fe, W as pe, Y as me, _ as he, a as ge, at as _e, b as ve, ct as ye, d as be, dt as xe, f as Se, i as Ce, it as we, j as Te, nt as Ee, ot as De, p as Oe, q as ke, r as T, rt as Ae, s as je, st as Me, t as Ne, tt as Pe, w as Fe, y as Ie } from "./_chunks/Agent-B-jQOrER.js";
|
|
7
|
+
import { c as Le, d as Re, l as ze, r as Be, s as Ve, t as He, u as Ue } from "./_chunks/Document-DQtliJu6.js";
|
|
8
|
+
import { a as We, i as Ge, n as Ke } from "./_chunks/createChatbotApiClient-B3U31J_K.js";
|
|
9
9
|
import { t as qe } from "./_chunks/PkChatbotAuth-Btxg3TF0.js";
|
|
10
10
|
import { t as Je } from "./_chunks/VvButtonLocalized-C-vx25u4.js";
|
|
11
|
-
import { n as Ye, t as Xe } from "./_chunks/PkStreamingMarkdown-
|
|
12
|
-
import { a as Ze, i as Qe, n as $e, r as et } from "./_chunks/useChatbotStore-
|
|
11
|
+
import { n as Ye, t as Xe } from "./_chunks/PkStreamingMarkdown-BrBeaJes.js";
|
|
12
|
+
import { a as Ze, i as Qe, n as $e, r as et } from "./_chunks/useChatbotStore-D2L4m3iJ.js";
|
|
13
13
|
import "./_chunks/src-B-ZKEhTU.js";
|
|
14
14
|
import { a as tt, l as nt, u as rt } from "./_chunks/message-DuibQyHy.js";
|
|
15
|
-
import { A as it, D as at, F as ot, I as st, N as ct, P as lt, f as ut, g as dt, m as ft, w as pt } from "./_chunks/utils-
|
|
15
|
+
import { A as it, D as at, F as ot, I as st, N as ct, P as lt, f as ut, g as dt, m as ft, w as pt } from "./_chunks/utils-Df_SeBdX.js";
|
|
16
16
|
import { t as mt } from "./_chunks/useSafeLocalStorage-a2eHEqAi.js";
|
|
17
17
|
import { t as ht } from "./_chunks/useDialogConfirm-CyD9VTKg.js";
|
|
18
|
-
import { n as gt, r as _t, t as vt } from "./_chunks/PkChatbotViewConversations-
|
|
19
|
-
import { i as yt, n as bt, r as xt, t as St } from "./_chunks/PkChatbotViewChat-
|
|
18
|
+
import { n as gt, r as _t, t as vt } from "./_chunks/PkChatbotViewConversations-Bf9oJIdi.js";
|
|
19
|
+
import { i as yt, n as bt, r as xt, t as St } from "./_chunks/PkChatbotViewChat-DuHSW8TF.js";
|
|
20
20
|
import { t as Ct } from "./_chunks/PkChatbotError-BS84xuiu.js";
|
|
21
21
|
import { t as wt } from "./_chunks/useImageFallback-HUe4GHah.js";
|
|
22
22
|
import { t as Tt } from "./_chunks/useLocalizedString-Dmn92nix.js";
|
|
23
23
|
import { n as Et, t as Dt } from "./_chunks/PkRelativeTime-CZF5CYHv.js";
|
|
24
|
-
import { r as Ot, t as kt } from "./_chunks/PkToolShowArtifact-
|
|
24
|
+
import { r as Ot, t as kt } from "./_chunks/PkToolShowArtifact-BvvVHrP-.js";
|
|
25
25
|
import { $ as At, A as jt, B as Mt, C as Nt, Ct as Pt, D as Ft, E as It, F as Lt, G as Rt, H as zt, I as Bt, J as Vt, K as Ht, L as Ut, M as Wt, N as E, Q as Gt, S as Kt, St as qt, T as Jt, Tt as Yt, U as Xt, V as Zt, W as Qt, X as $t, _t as en, a as tn, at as nn, b as rn, bt as an, c as on, ct as sn, d as cn, dt as ln, et as un, f as dn, gt as fn, h as pn, it as mn, j as hn, k as gn, l as D, lt as O, mt as _n, nt as vn, o as yn, ot as bn, pt as xn, q as Sn, rt as Cn, st as wn, tt as Tn, u as En, ut as Dn, vt as On, w as kn, wt as An, x as jn, xt as Mn, y as Nn, yt as Pn, z as Fn } from "./_chunks/dist-DtxVAOxm.js";
|
|
26
26
|
import { n as In, t as Ln } from "./_chunks/dist-CKKe4gMX.js";
|
|
27
27
|
import { n as Rn, r as zn } from "./_chunks/dist-DTy4614p.js";
|
|
@@ -31,26 +31,26 @@ import { t as Wn } from "./_chunks/PkSvgViewer-BckH8MdR.js";
|
|
|
31
31
|
import { t as Gn } from "./_chunks/PkUrl-IFszepUi.js";
|
|
32
32
|
import { t as Kn } from "./_chunks/PkAvatar-uVRs_DD9.js";
|
|
33
33
|
import { t as qn } from "./_chunks/PkChatbotFeedbackForm-Bh3tvNUW.js";
|
|
34
|
-
import { n as Jn, t as Yn } from "./_chunks/PkChatbotSteps-
|
|
35
|
-
import { t as Xn } from "./_chunks/PkChatbotStepPayload-
|
|
36
|
-
import { t as Zn } from "./_chunks/PkChatbotStepToolDetail-
|
|
37
|
-
import { n as Qn, t as $n } from "./_chunks/PkChatbotInput-
|
|
38
|
-
import { t as er } from "./_chunks/PkChatbotEmptyState-
|
|
39
|
-
import { t as tr } from "./_chunks/PkChatbotViewProfile-
|
|
40
|
-
import { t as nr } from "./_chunks/PkChatbot-
|
|
41
|
-
import { i as rr, r as ir, t as ar } from "./_chunks/PkToolShowSources-
|
|
34
|
+
import { n as Jn, t as Yn } from "./_chunks/PkChatbotSteps-Cmi5TBZM.js";
|
|
35
|
+
import { t as Xn } from "./_chunks/PkChatbotStepPayload-CgwZs9AM.js";
|
|
36
|
+
import { t as Zn } from "./_chunks/PkChatbotStepToolDetail-BOylJhFM.js";
|
|
37
|
+
import { n as Qn, t as $n } from "./_chunks/PkChatbotInput-fte_uZHV.js";
|
|
38
|
+
import { t as er } from "./_chunks/PkChatbotEmptyState-CFCbJSjm.js";
|
|
39
|
+
import { t as tr } from "./_chunks/PkChatbotViewProfile-x0oUCbeL.js";
|
|
40
|
+
import { t as nr } from "./_chunks/PkChatbot-DKBnpYB0.js";
|
|
41
|
+
import { i as rr, r as ir, t as ar } from "./_chunks/PkToolShowSources-DR-uaXeX.js";
|
|
42
42
|
import { t as or } from "./_chunks/mcpOAuthReport-aR-W09MX.js";
|
|
43
43
|
import { t as sr } from "./_chunks/PkToolShowEmail-BehvoNsz.js";
|
|
44
44
|
import { t as cr } from "./_chunks/PkToolShowMessage-Cca7K7GQ.js";
|
|
45
|
-
import { t as lr } from "./_chunks/PkToolShowWebPages-
|
|
46
|
-
import { t as ur } from "./_chunks/PkToolShowProductList-
|
|
47
|
-
import { t as dr } from "./_chunks/PkToolShowContactForm-
|
|
45
|
+
import { t as lr } from "./_chunks/PkToolShowWebPages-BHTyFyDI.js";
|
|
46
|
+
import { t as ur } from "./_chunks/PkToolShowProductList-DreWhhfK.js";
|
|
47
|
+
import { t as dr } from "./_chunks/PkToolShowContactForm-Dz_IiYr1.js";
|
|
48
48
|
import { t as fr } from "./_chunks/PkToolShowCalendarEvent-C16j-Cto.js";
|
|
49
49
|
import { t as pr } from "./_chunks/PkToolShowComparison-BEHyRNXE.js";
|
|
50
50
|
import { t as mr } from "./_chunks/PkToolShowLocation-Cq0IXye1.js";
|
|
51
51
|
import { t as hr } from "./_chunks/PkToolShowQrCode-skWaARYV.js";
|
|
52
|
-
import { t as gr } from "./_chunks/PkToolShowImageGallery-
|
|
53
|
-
import { t as _r } from "./_chunks/PkToolShowSuggestedReply-
|
|
52
|
+
import { t as gr } from "./_chunks/PkToolShowImageGallery-DWwUnIDq.js";
|
|
53
|
+
import { t as _r } from "./_chunks/PkToolShowSuggestedReply-CThFJVUq.js";
|
|
54
54
|
import { t as vr } from "./_chunks/PkToolShareDocument-CRghPfep.js";
|
|
55
55
|
import { VvAccordion as yr, VvAccordionGroup as br, VvAlert as xr, VvAlertGroup as Sr, VvBadge as Cr, VvButtonGroup as wr, VvCheckbox as Tr, VvCombobox as Er, VvDialog as Dr, VvDropdown as Or, VvDropdownAction as kr, VvIcon as Ar, VvInputFile as jr, VvInputRange as Mr, VvInputText as Nr, VvTab as Pr, VvTooltip as Fr } from "@volverjs/ui-vue/components";
|
|
56
56
|
import { Fragment as k, Teleport as Ir, Transition as Lr, TransitionGroup as Rr, cloneVNode as zr, computed as A, createApp as Br, createBlock as j, createCommentVNode as M, createElementBlock as N, createElementVNode as P, createSlots as Vr, createStaticVNode as Hr, createTextVNode as F, createVNode as I, defineComponent as L, guardReactiveProps as Ur, h as Wr, inject as R, isRef as Gr, isVNode as Kr, mergeModels as qr, mergeProps as Jr, nextTick as Yr, normalizeClass as Xr, normalizeProps as Zr, normalizeStyle as Qr, onBeforeUnmount as $r, onMounted as ei, onUnmounted as ti, openBlock as z, provide as ni, reactive as ri, readonly as ii, ref as B, renderList as ai, renderSlot as oi, resolveComponent as si, resolveDynamicComponent as ci, shallowRef as li, toDisplayString as V, toRef as ui, toRefs as di, unref as H, useId as fi, useModel as U, useSlots as pi, useTemplateRef as mi, vModelSelect as hi, vModelText as gi, watch as W, withCtx as G, withDirectives as _i, withKeys as vi, withModifiers as yi } from "vue";
|
|
@@ -432,6 +432,12 @@ export declare function useChatbotStore(agentId: string): Store<`chatbot-${strin
|
|
|
432
432
|
shareDocument: {
|
|
433
433
|
enabled: boolean;
|
|
434
434
|
};
|
|
435
|
+
createSpreadsheet: {
|
|
436
|
+
enabled: boolean;
|
|
437
|
+
};
|
|
438
|
+
createWordDocument: {
|
|
439
|
+
enabled: boolean;
|
|
440
|
+
};
|
|
435
441
|
approval: {
|
|
436
442
|
tools: string[];
|
|
437
443
|
};
|
|
@@ -495,6 +501,12 @@ export declare function useChatbotStore(agentId: string): Store<`chatbot-${strin
|
|
|
495
501
|
shareDocument: {
|
|
496
502
|
enabled: boolean;
|
|
497
503
|
};
|
|
504
|
+
createSpreadsheet: {
|
|
505
|
+
enabled: boolean;
|
|
506
|
+
};
|
|
507
|
+
createWordDocument: {
|
|
508
|
+
enabled: boolean;
|
|
509
|
+
};
|
|
498
510
|
approval: {
|
|
499
511
|
tools: string[];
|
|
500
512
|
};
|
|
@@ -2355,6 +2367,12 @@ export declare function useChatbotStore(agentId: string): Store<`chatbot-${strin
|
|
|
2355
2367
|
shareDocument: {
|
|
2356
2368
|
enabled: boolean;
|
|
2357
2369
|
};
|
|
2370
|
+
createSpreadsheet: {
|
|
2371
|
+
enabled: boolean;
|
|
2372
|
+
};
|
|
2373
|
+
createWordDocument: {
|
|
2374
|
+
enabled: boolean;
|
|
2375
|
+
};
|
|
2358
2376
|
approval: {
|
|
2359
2377
|
tools: string[];
|
|
2360
2378
|
};
|
|
@@ -2418,6 +2436,12 @@ export declare function useChatbotStore(agentId: string): Store<`chatbot-${strin
|
|
|
2418
2436
|
shareDocument: {
|
|
2419
2437
|
enabled: boolean;
|
|
2420
2438
|
};
|
|
2439
|
+
createSpreadsheet: {
|
|
2440
|
+
enabled: boolean;
|
|
2441
|
+
};
|
|
2442
|
+
createWordDocument: {
|
|
2443
|
+
enabled: boolean;
|
|
2444
|
+
};
|
|
2421
2445
|
approval: {
|
|
2422
2446
|
tools: string[];
|
|
2423
2447
|
};
|
|
@@ -4278,6 +4302,12 @@ export declare function useChatbotStore(agentId: string): Store<`chatbot-${strin
|
|
|
4278
4302
|
shareDocument: {
|
|
4279
4303
|
enabled: boolean;
|
|
4280
4304
|
};
|
|
4305
|
+
createSpreadsheet: {
|
|
4306
|
+
enabled: boolean;
|
|
4307
|
+
};
|
|
4308
|
+
createWordDocument: {
|
|
4309
|
+
enabled: boolean;
|
|
4310
|
+
};
|
|
4281
4311
|
approval: {
|
|
4282
4312
|
tools: string[];
|
|
4283
4313
|
};
|
|
@@ -4341,6 +4371,12 @@ export declare function useChatbotStore(agentId: string): Store<`chatbot-${strin
|
|
|
4341
4371
|
shareDocument: {
|
|
4342
4372
|
enabled: boolean;
|
|
4343
4373
|
};
|
|
4374
|
+
createSpreadsheet: {
|
|
4375
|
+
enabled: boolean;
|
|
4376
|
+
};
|
|
4377
|
+
createWordDocument: {
|
|
4378
|
+
enabled: boolean;
|
|
4379
|
+
};
|
|
4344
4380
|
approval: {
|
|
4345
4381
|
tools: string[];
|
|
4346
4382
|
};
|
|
@@ -342,6 +342,18 @@ export declare enum AgentBuiltInTool {
|
|
|
342
342
|
QuerySpreadsheet = "querySpreadsheet",
|
|
343
343
|
/** `readWordDocument` and `editWordDocument`, on a chat with an attached .docx. */
|
|
344
344
|
WordDocument = "wordDocument",
|
|
345
|
+
/**
|
|
346
|
+
* `createSpreadsheet`: a new Excel workbook written by the agent. Switched
|
|
347
|
+
* by `tools.createSpreadsheet.enabled` and only with
|
|
348
|
+
* {@link AgentBuiltInTool.Spreadsheet} on: see {@link AgentFileCreationSchema}.
|
|
349
|
+
*/
|
|
350
|
+
CreateSpreadsheet = "createSpreadsheet",
|
|
351
|
+
/**
|
|
352
|
+
* `createWordDocument`: a new Word document written by the agent. Switched
|
|
353
|
+
* by `tools.createWordDocument.enabled` and only with
|
|
354
|
+
* {@link AgentBuiltInTool.WordDocument} on.
|
|
355
|
+
*/
|
|
356
|
+
CreateWordDocument = "createWordDocument",
|
|
345
357
|
RunWorker = "runWorker",
|
|
346
358
|
/** `scheduleWakeup`: the agent resumes this chat by itself after a delay. */
|
|
347
359
|
ScheduleWakeup = "scheduleWakeup",
|
|
@@ -767,6 +779,19 @@ export declare const AgentShareDocumentSchema: z.ZodObject<{
|
|
|
767
779
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
768
780
|
}, z.core.$strip>;
|
|
769
781
|
export type AgentShareDocument = z.infer<typeof AgentShareDocumentSchema>;
|
|
782
|
+
/**
|
|
783
|
+
* The creation of new Excel or Word files (spec `chat-office-files.md`, "La
|
|
784
|
+
* creazione"): off unless switched on here, for the same reasons as
|
|
785
|
+
* {@link AgentShareDocumentSchema}. Switching it on is the administrator's
|
|
786
|
+
* consent to the agent putting in a new file what it reads in the
|
|
787
|
+
* conversation, in the knowledge base and from its tools. It holds only while
|
|
788
|
+
* the tool of the format is on, because a created file is read and edited
|
|
789
|
+
* afterwards with that tool.
|
|
790
|
+
*/
|
|
791
|
+
export declare const AgentFileCreationSchema: z.ZodObject<{
|
|
792
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
793
|
+
}, z.core.$strip>;
|
|
794
|
+
export type AgentFileCreation = z.infer<typeof AgentFileCreationSchema>;
|
|
770
795
|
/**
|
|
771
796
|
* Human-in-the-loop approval settings. Lists the tools whose calls must be
|
|
772
797
|
* approved by the user before they execute. Names are matched against the tool
|
|
@@ -849,6 +874,12 @@ export declare const AgentToolsSchema: z.ZodObject<{
|
|
|
849
874
|
shareDocument: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
850
875
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
851
876
|
}, z.core.$strip>>>;
|
|
877
|
+
createSpreadsheet: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
878
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
879
|
+
}, z.core.$strip>>>;
|
|
880
|
+
createWordDocument: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
881
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
882
|
+
}, z.core.$strip>>>;
|
|
852
883
|
approval: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
853
884
|
tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
854
885
|
}, z.core.$strip>>>;
|
|
@@ -1220,6 +1251,12 @@ export declare const isToolEditedFile: (mimeType: string | undefined) => boolean
|
|
|
1220
1251
|
* that no tool takes.
|
|
1221
1252
|
*/
|
|
1222
1253
|
export declare const isEditedFileToolOff: (mimeType: string | undefined, disabled: readonly AgentBuiltInTool[]) => boolean;
|
|
1254
|
+
/**
|
|
1255
|
+
* `media.metadata.origin` of a chat file the agent created, where an upload
|
|
1256
|
+
* or a version carries none: a created file has no original, and it counts
|
|
1257
|
+
* only while the call that wrote it is in the conversation.
|
|
1258
|
+
*/
|
|
1259
|
+
export declare const AGENT_CREATED_FILE_ORIGIN = "agent";
|
|
1223
1260
|
/**
|
|
1224
1261
|
* What a "My files" row is: a document of the knowledge base (a copy of the
|
|
1225
1262
|
* upload), or a tool-edited file of a chat, the attachment itself with the
|
|
@@ -1749,6 +1786,12 @@ export declare const AgentSettingsSchema: z.ZodObject<{
|
|
|
1749
1786
|
shareDocument: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
1750
1787
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
1751
1788
|
}, z.core.$strip>>>;
|
|
1789
|
+
createSpreadsheet: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
1790
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
1791
|
+
}, z.core.$strip>>>;
|
|
1792
|
+
createWordDocument: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
1793
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
1794
|
+
}, z.core.$strip>>>;
|
|
1752
1795
|
approval: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
1753
1796
|
tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1754
1797
|
}, z.core.$strip>>>;
|
|
@@ -2171,6 +2214,12 @@ export declare const AgentDtoSchema: z.ZodObject<{
|
|
|
2171
2214
|
shareDocument: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
2172
2215
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
2173
2216
|
}, z.core.$strip>>>;
|
|
2217
|
+
createSpreadsheet: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
2218
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
2219
|
+
}, z.core.$strip>>>;
|
|
2220
|
+
createWordDocument: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
2221
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
2222
|
+
}, z.core.$strip>>>;
|
|
2174
2223
|
approval: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
2175
2224
|
tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
2176
2225
|
}, z.core.$strip>>>;
|
|
@@ -2594,6 +2643,12 @@ export declare const AgentSchema: z.ZodLazy<z.ZodObject<{
|
|
|
2594
2643
|
shareDocument: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
2595
2644
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
2596
2645
|
}, z.core.$strip>>>;
|
|
2646
|
+
createSpreadsheet: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
2647
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
2648
|
+
}, z.core.$strip>>>;
|
|
2649
|
+
createWordDocument: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
2650
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
2651
|
+
}, z.core.$strip>>>;
|
|
2597
2652
|
approval: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
2598
2653
|
tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
2599
2654
|
}, z.core.$strip>>>;
|