@8wave/ai-elements 0.126.0-beta.20 → 0.126.0-beta.22
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/{PkChatbotFilePreview-DHcHcy4x.js → PkChatbotFilePreview-jN3SAlut.js} +2 -2
- package/dist/_chunks/{PkChatbotFilePreview-DHcHcy4x.js.map → PkChatbotFilePreview-jN3SAlut.js.map} +1 -1
- package/dist/_chunks/{PkStreamingMarkdown-0lzE-l9f.js → PkStreamingMarkdown-qoTgaVHP.js} +2 -2
- package/dist/_chunks/{PkStreamingMarkdown-0lzE-l9f.js.map → PkStreamingMarkdown-qoTgaVHP.js.map} +1 -1
- package/dist/_chunks/{PkToolChatFile-x50rORrq.js → PkToolChatFile-uAyCds1k.js} +2 -2
- package/dist/_chunks/{PkToolChatFile-x50rORrq.js.map → PkToolChatFile-uAyCds1k.js.map} +1 -1
- package/dist/_chunks/{PkToolShareDocument-Cv7uBr5Z.js → PkToolShareDocument-NUMXFQ2e.js} +2 -2
- package/dist/_chunks/{PkToolShareDocument-Cv7uBr5Z.js.map → PkToolShareDocument-NUMXFQ2e.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-DMIADTQ6.js → PkToolShowArtifact-D1p76r2a.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-DMIADTQ6.js.map → PkToolShowArtifact-D1p76r2a.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-B5DCcFqt.js → PkToolShowContactForm-B4S4qtxp.js} +2 -2
- package/dist/_chunks/{PkToolShowContactForm-B5DCcFqt.js.map → PkToolShowContactForm-B4S4qtxp.js.map} +1 -1
- package/dist/_chunks/{PkToolShowDiagram-DEFJr7zY.js → PkToolShowDiagram-CauQT97Z.js} +2 -2
- package/dist/_chunks/{PkToolShowDiagram-DEFJr7zY.js.map → PkToolShowDiagram-CauQT97Z.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-BBxcDLyR.js → PkToolShowForm-1sJBr8KY.js} +2 -2
- package/dist/_chunks/{PkToolShowForm-BBxcDLyR.js.map → PkToolShowForm-1sJBr8KY.js.map} +1 -1
- package/dist/_chunks/{PkToolShowImageGallery-BYvCAUFX.js → PkToolShowImageGallery-DFhYCp-v.js} +2 -2
- package/dist/_chunks/{PkToolShowImageGallery-BYvCAUFX.js.map → PkToolShowImageGallery-DFhYCp-v.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-DxZoqWZd.js → PkToolShowSources-DFHejVc0.js} +2 -2
- package/dist/_chunks/{PkToolShowSources-DxZoqWZd.js.map → PkToolShowSources-DFHejVc0.js.map} +1 -1
- package/dist/_chunks/{useLightbox-BlHExsUm.js → useLightbox-CUT_xmuZ.js} +100 -95
- package/dist/_chunks/useLightbox-CUT_xmuZ.js.map +1 -0
- package/dist/ai-elements.es.js +2316 -2153
- 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/PkChatbotFilePreview.js +1 -1
- package/dist-vue/PkChatbotInput.js +1 -1
- package/dist-vue/PkChatbotMessages.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/{PkChatbot-CxphD_YU.js → PkChatbot-VJorpNbU.js} +7 -7
- package/dist-vue/_chunks/{PkChatbot-CxphD_YU.js.map → PkChatbot-VJorpNbU.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotEmptyState-Jxc1HNJ5.js → PkChatbotEmptyState-B9dYpXZm.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotEmptyState-Jxc1HNJ5.js.map → PkChatbotEmptyState-B9dYpXZm.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotFilePreview-BDU2vY0F.js → PkChatbotFilePreview-5_bih_vc.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotFilePreview-BDU2vY0F.js.map → PkChatbotFilePreview-5_bih_vc.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotInput-DSdGtBTs.js → PkChatbotInput-BLKhf3WD.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotInput-DSdGtBTs.js.map → PkChatbotInput-BLKhf3WD.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotMessages-C7WSS6sd.js → PkChatbotMessages-Dx_IIX0J.js} +17 -17
- package/dist-vue/_chunks/{PkChatbotMessages-C7WSS6sd.js.map → PkChatbotMessages-Dx_IIX0J.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotSteps-BMWrHfC9.js → PkChatbotSteps-BAQ1LriG.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotSteps-BMWrHfC9.js.map → PkChatbotSteps-BAQ1LriG.js.map} +1 -1
- package/dist-vue/_chunks/PkChatbotViewChat-1RqLcPl4.js +1336 -0
- package/dist-vue/_chunks/PkChatbotViewChat-1RqLcPl4.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewConversations-BbCnRdv4.js → PkChatbotViewConversations-D0vDYTyo.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewConversations-BbCnRdv4.js.map → PkChatbotViewConversations-D0vDYTyo.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-gwoZqmza.js → PkChatbotViewFiles-Bj5Nkzst.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewFiles-gwoZqmza.js.map → PkChatbotViewFiles-Bj5Nkzst.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-B7DroVld.js → PkChatbotViewProfile-GW0WuMOy.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-B7DroVld.js.map → PkChatbotViewProfile-GW0WuMOy.js.map} +1 -1
- package/dist-vue/_chunks/{PkFilePreview-N0kWPuFh.js → PkFilePreview-Dkm34tMI.js} +2 -2
- package/dist-vue/_chunks/{PkFilePreview-N0kWPuFh.js.map → PkFilePreview-Dkm34tMI.js.map} +1 -1
- package/dist-vue/_chunks/{PkFilePreviewDialog-DqBESOIS.js → PkFilePreviewDialog-CZg7uqHL.js} +2 -2
- package/dist-vue/_chunks/{PkFilePreviewDialog-DqBESOIS.js.map → PkFilePreviewDialog-CZg7uqHL.js.map} +1 -1
- package/dist-vue/_chunks/{PkStreamingMarkdown-BFBv_HdF.js → PkStreamingMarkdown-D6Qxwf47.js} +2 -2
- package/dist-vue/_chunks/{PkStreamingMarkdown-BFBv_HdF.js.map → PkStreamingMarkdown-D6Qxwf47.js.map} +1 -1
- package/dist-vue/_chunks/{PkSvgViewer-CRNwb6Yn.js → PkSvgViewer-jCi13HSd.js} +2 -2
- package/dist-vue/_chunks/{PkSvgViewer-CRNwb6Yn.js.map → PkSvgViewer-jCi13HSd.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolChatFile-BntAINfN.js → PkToolChatFile-uO6r1l6t.js} +2 -2
- package/dist-vue/_chunks/{PkToolChatFile-BntAINfN.js.map → PkToolChatFile-uO6r1l6t.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShareDocument-Bf7OE8XA.js → PkToolShareDocument-B7mMJJfn.js} +2 -2
- package/dist-vue/_chunks/{PkToolShareDocument-Bf7OE8XA.js.map → PkToolShareDocument-B7mMJJfn.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowArtifact-PTyAPKlR.js → PkToolShowArtifact-VOfSN9nc.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-PTyAPKlR.js.map → PkToolShowArtifact-VOfSN9nc.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowContactForm-CGIA743D.js → PkToolShowContactForm-D9J0B3C-.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowContactForm-CGIA743D.js.map → PkToolShowContactForm-D9J0B3C-.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-CppjE7Vr.js → PkToolShowDiagram-BlV7ktLW.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowDiagram-CppjE7Vr.js.map → PkToolShowDiagram-BlV7ktLW.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-DLlcs1c4.js → PkToolShowForm-BCvqIlt_.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowForm-DLlcs1c4.js.map → PkToolShowForm-BCvqIlt_.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowImageGallery-KP_ptp0w.js → PkToolShowImageGallery-D2DrAB9v.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowImageGallery-KP_ptp0w.js.map → PkToolShowImageGallery-D2DrAB9v.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowLocation-Nhh_LwmN.js → PkToolShowLocation-BhVcLnkV.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowLocation-Nhh_LwmN.js.map → PkToolShowLocation-BhVcLnkV.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowProductList-CbI-ncWs.js → PkToolShowProductList--MBQ_ztM.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowProductList-CbI-ncWs.js.map → PkToolShowProductList--MBQ_ztM.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-E02Gy3vC.js → PkToolShowSources-D_KfNZ_Q.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSources-E02Gy3vC.js.map → PkToolShowSources-D_KfNZ_Q.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowVideo-DBqMV0U7.js → PkToolShowVideo-CS6iDwjn.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowVideo-DBqMV0U7.js.map → PkToolShowVideo-CS6iDwjn.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowWebPages-2023cqa1.js → PkToolShowWebPages-y3sajjCP.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowWebPages-2023cqa1.js.map → PkToolShowWebPages-y3sajjCP.js.map} +1 -1
- package/dist-vue/_chunks/{createChatbotApiClient-BACnmIzY.js → createChatbotApiClient-Pb7_cU2s.js} +105 -75
- package/dist-vue/_chunks/createChatbotApiClient-Pb7_cU2s.js.map +1 -0
- package/dist-vue/_chunks/{useChatbotStore-B-WenuyB.js → useChatbotStore-ChrZVIDt.js} +1172 -1141
- package/dist-vue/_chunks/useChatbotStore-ChrZVIDt.js.map +1 -0
- package/dist-vue/_chunks/{useLightbox-DmtNa8bJ.js → useLightbox-BZN3tRGu.js} +100 -95
- package/dist-vue/_chunks/useLightbox-BZN3tRGu.js.map +1 -0
- package/dist-vue/api.js +1 -1
- package/dist-vue/composables.js +76 -2
- package/dist-vue/composables.js.map +1 -1
- package/dist-vue/index.js +4304 -3590
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +78 -2
- package/dist-vue/packages/components/src/PkSchemaField.d.ts +2 -2
- package/dist-vue/packages/components/src/chat/PkChatProjectDialog.d.ts +50 -0
- package/dist-vue/packages/components/src/chat/PkChatProjectMoveDialog.d.ts +23 -0
- package/dist-vue/packages/components/src/chat/PkChatSidebar.d.ts +5 -2
- package/dist-vue/packages/components/src/chat/PkChatSidebarConversationItem.d.ts +12 -0
- package/dist-vue/packages/components/src/chat/PkChatbot.d.ts +9 -3
- package/dist-vue/packages/components/src/chat/PkChatbotFeedbackForm.d.ts +2 -2
- package/dist-vue/packages/composable/src/chatbot/api/createChatbotApiClient.d.ts +20 -1
- package/dist-vue/packages/composable/src/chatbot/index.d.ts +1 -0
- package/dist-vue/packages/composable/src/chatbot/useChatProjectsStore.d.ts +4005 -0
- package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +36 -6
- package/dist-vue/packages/models/src/schema/ChatProject.d.ts +10 -0
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/useLightbox-BlHExsUm.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewChat-2J6g9Etg.js +0 -1307
- package/dist-vue/_chunks/PkChatbotViewChat-2J6g9Etg.js.map +0 -1
- package/dist-vue/_chunks/createChatbotApiClient-BACnmIzY.js.map +0 -1
- package/dist-vue/_chunks/useChatbotStore-B-WenuyB.js.map +0 -1
- package/dist-vue/_chunks/useLightbox-DmtNa8bJ.js.map +0 -1
package/dist-vue/_chunks/{PkToolShowVideo-DBqMV0U7.js.map → PkToolShowVideo-CS6iDwjn.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PkToolShowVideo-DBqMV0U7.js","names":["$t","_openBlock","_createElementBlock","_createElementVNode","_createVNode","_toDisplayString","_Fragment","_renderList","_normalizeClass","PkHeldImage","_unref","useChatImageGate","sanitizeId","raw","hostMatches","host","domain","youtubeId","u","v","m","vimeoId","parseVideoSource","url","id","hint","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","IFRAME_ALLOW","PkToolShowVideo_default","defineComponent","props","__props","PLAYER_HOSTS","imageGate","videos","computed","source","video","gated","src","release","urls","_component_VvIcon","VvIcon","openBlock","createElementBlock","createElementVNode","createVNode","toDisplayString","_ctx","Fragment","renderList","normalizeClass","index","PkHeldImage_default","unref","createCommentVNode"],"sources":["../../../../packages/utils/src/video-source.ts","../../../../packages/components/src/chat/PkToolShowVideo.vue"],"sourcesContent":["/**\n * Video source parsing shared by the backend platform renderer and the frontend\n * player component, so both classify a video URL the same way.\n *\n * A URL is either a known provider (YouTube/Vimeo), which plays through the\n * provider's iframe embed, or a direct media file (`file`), which plays in a\n * native `<video>` element. Detection is by URL shape; an explicit `hint` is\n * used only as a fallback when the URL alone is inconclusive.\n */\n\nexport type VideoProvider = 'youtube' | 'vimeo' | 'file'\n\nexport interface ParsedVideoSource {\n provider: VideoProvider\n /** The original URL, unchanged. */\n url: string\n /**\n * The URL to actually load: the provider iframe embed URL for\n * YouTube/Vimeo, or the direct file URL for `file`.\n */\n embedUrl: string\n /** The provider video id (providers only). */\n videoId?: string\n /**\n * A preview image URL derived from the provider, when one is available\n * without an extra API call (currently YouTube only). Lets a link-only\n * surface (e.g. a Teams card) show a thumbnail instead of a bare link.\n */\n thumbnailUrl?: string\n}\n\n/** Keep only characters that are legal in a provider video id. */\nconst sanitizeId = (raw: string): string => raw.replace(/[^a-zA-Z0-9_-]/g, '')\n\n/**\n * True when `host` is exactly `domain` or a subdomain of it. Guards against\n * lookalike hosts (e.g. `notyoutube.com`) that a bare substring check would\n * misclassify.\n */\nconst hostMatches = (host: string, domain: string): boolean =>\n host === domain || host.endsWith(`.${domain}`)\n\n/** Extract the YouTube video id from any of its URL shapes, or null. */\nconst youtubeId = (u: URL): string | null => {\n // youtu.be/<id>\n if (u.hostname.endsWith('youtu.be')) {\n return sanitizeId(u.pathname.split('/')[1] ?? '') || null\n }\n // youtube.com/watch?v=<id>\n const v = u.searchParams.get('v')\n if (v) {\n return sanitizeId(v) || null\n }\n // youtube.com/shorts/<id>, /live/<id>, /embed/<id>, /v/<id>\n const m = u.pathname.match(/^\\/(?:shorts|live|embed|v)\\/([^/?#]+)/)\n return m ? sanitizeId(m[1]) || null : null\n}\n\n/** Extract the Vimeo (numeric) video id, or null. */\nconst vimeoId = (u: URL): string | null => {\n // player.vimeo.com/video/<id> or vimeo.com/<id>\n const m = u.pathname.match(/(?:^|\\/)(\\d+)(?:$|[/?#])/)\n return m ? m[1] : null\n}\n\n/**\n * Classify a video URL into a provider + a loadable embed/file URL.\n * Falls back to `file` (native `<video>`) for anything not recognized as a\n * supported provider, or when a provider is matched but no id can be extracted.\n */\nexport function parseVideoSource(\n url: string,\n hint?: VideoProvider,\n): ParsedVideoSource {\n let u: URL | undefined\n try {\n u = new URL(url)\n } catch {\n // Not an absolute URL: treat as a direct file reference.\n return { provider: 'file', url, embedUrl: url }\n }\n\n const host = u.hostname.toLowerCase()\n\n const isYouTube =\n hostMatches(host, 'youtube.com') ||\n hostMatches(host, 'youtu.be') ||\n hostMatches(host, 'youtube-nocookie.com')\n if (isYouTube) {\n const id = youtubeId(u)\n if (id) {\n return {\n provider: 'youtube',\n url,\n videoId: id,\n embedUrl: `https://www.youtube-nocookie.com/embed/${id}`,\n thumbnailUrl: `https://img.youtube.com/vi/${id}/hqdefault.jpg`,\n }\n }\n }\n\n if (hostMatches(host, 'vimeo.com')) {\n const id = vimeoId(u)\n if (id) {\n return {\n provider: 'vimeo',\n url,\n videoId: id,\n // `dnt=1`: the player sets no cookies and records no session\n // data, the Vimeo counterpart of youtube-nocookie above.\n embedUrl: `https://player.vimeo.com/video/${id}?dnt=1`,\n }\n }\n }\n\n // Honor an explicit provider hint only if we could not extract an id from a\n // provider URL (so a caller-tagged provider link still routes to an iframe\n // via its original URL rather than a broken native <video>).\n if (hint && hint !== 'file') {\n return { provider: hint, url, embedUrl: url }\n }\n\n return { provider: 'file', url, embedUrl: url }\n}\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { parseVideoSource, type VideoProvider } from 'utils'\n import { useChatImageGate } from './chatImagePolicy'\n import PkHeldImage from './PkHeldImage.vue'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n interface VideoInput {\n url: string\n title?: string\n description?: string\n poster?: string\n provider?: VideoProvider\n }\n\n // Permissions granted to provider embeds (YouTube/Vimeo players).\n const IFRAME_ALLOW =\n 'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share'\n\n /**\n * Where a YouTube or Vimeo player lives: the url is built here from the\n * video id, so nothing the model wrote reaches these hosts but the id.\n */\n const PLAYER_HOSTS = ['www.youtube-nocookie.com', 'player.vimeo.com']\n\n // A file, its poster, or an embed this card does not recognize, fetch the\n // url the model wrote as soon as they render: from a host the agent does\n // not list they wait for a click, like an image (chatImagePolicy.ts).\n const imageGate = useChatImageGate()\n\n const videos = computed(() => {\n const part = props.part as { input?: { videos?: VideoInput[] } }\n return (part.input?.videos ?? []).map((video) => {\n const source = parseVideoSource(video.url, video.provider)\n const fetched =\n source.provider === 'file'\n ? [source.embedUrl, video.poster]\n : [source.embedUrl]\n const gated = fetched.filter(\n (src): src is string =>\n !!src &&\n !PLAYER_HOSTS.includes(imageGate.hostOf(src) ?? ''),\n )\n return {\n ...video,\n source,\n gated,\n held: gated.some((src) => !imageGate.canLoad(src)),\n }\n })\n })\n\n function release(urls: string[]) {\n for (const url of urls) {\n imageGate.release(url)\n }\n }\n</script>\n\n<template>\n <div\n v-if=\"videos.length\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden bg-surface\">\n <div\n class=\"px-sm py-6 bg-surface-1 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8 min-h-40\">\n <VvIcon name=\"ri:film-line\" class=\"text-16\" />\n <strong class=\"font-bold\">\n {{ $t('label.video') }}\n </strong>\n </div>\n <!-- Each video bleeds to the card's edges, like the map of the\n location card: the card's overflow clips the bottom corners. -->\n <div\n v-for=\"(video, index) in videos\"\n :key=\"video.url\"\n class=\"flex flex-col\"\n :class=\"{ 'border-t border-surface-3': index > 0 }\">\n <!-- Direct file: native player. Handles MP4/WebM/OGG and works\n inside the widget's Shadow DOM without any extra CSS. -->\n <div\n v-if=\"video.held\"\n class=\"w-full overflow-hidden\"\n style=\"aspect-ratio: 16 / 9\">\n <PkHeldImage\n :host=\"imageGate.hostOf(video.gated[0])\"\n kind=\"video\"\n fill\n @release=\"release(video.gated)\" />\n </div>\n <video\n v-else-if=\"video.source.provider === 'file'\"\n :src=\"video.source.embedUrl\"\n :poster=\"video.poster\"\n controls\n preload=\"metadata\"\n playsinline\n class=\"w-full bg-black\"\n style=\"aspect-ratio: 16 / 9; max-height: 480px\">\n <a :href=\"video.url\" target=\"_blank\" rel=\"noopener noreferrer\">\n {{ video.title ?? video.url }}\n </a>\n </video>\n <!-- Provider (YouTube/Vimeo): iframe embed, 16:9 responsive. -->\n <div\n v-else\n class=\"relative w-full overflow-hidden bg-black\"\n style=\"aspect-ratio: 16 / 9\">\n <iframe\n :src=\"video.source.embedUrl\"\n :title=\"video.title ?? video.url\"\n loading=\"lazy\"\n referrerpolicy=\"strict-origin-when-cross-origin\"\n :allow=\"IFRAME_ALLOW\"\n allowfullscreen\n class=\"absolute inset-0 w-full h-full border-0\"></iframe>\n </div>\n <div\n v-if=\"video.title || video.description\"\n class=\"p-sm flex flex-col gap-4 border-t border-surface-3\">\n <strong v-if=\"video.title\" class=\"font-bold text-14\">\n {{ video.title }}\n </strong>\n <span v-if=\"video.description\" class=\"text-12 text-word-3\">\n {{ video.description }}\n </span>\n </div>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;AAgCA,IAAMY,KAAc,MAAwBC,EAAI,QAAQ,mBAAmB,EAAE,GAOvEC,KAAe,GAAc,MAC/BC,MAASC,KAAUD,EAAK,SAAS,IAAIC,GAAQ,GAG3CC,KAAa,MAA0B;CAEzC,IAAIC,EAAE,SAAS,SAAS,UAAU,GAC9B,OAAON,EAAWM,EAAE,SAAS,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK;CAGzD,IAAMC,IAAID,EAAE,aAAa,IAAI,GAAG;CAChC,IAAIC,GACA,OAAOP,EAAWO,CAAC,KAAK;CAG5B,IAAMC,IAAIF,EAAE,SAAS,MAAM,uCAAuC;CAClE,OAAOE,KAAIR,EAAWQ,EAAE,EAAE,KAAK;AACnC,GAGMC,KAAW,MAA0B;CAEvC,IAAMD,IAAIF,EAAE,SAAS,MAAM,0BAA0B;CACrD,OAAOE,IAAIA,EAAE,KAAK;AACtB;AAOA,SAAgBE,EACZ,GACA,GACiB;CACjB,IAAIJ;CACJ,IAAI;EACA,IAAI,IAAI,IAAIK,CAAG;CACnB,QAAQ;EAEJ,OAAO;GAAE,UAAU;GAAQ;GAAK,UAAUA;EAAI;CAClD;CAEA,IAAMR,IAAOG,EAAE,SAAS,YAAY;CAMpC,IAHIJ,EAAYC,GAAM,aAAa,KAC/BD,EAAYC,GAAM,UAAU,KAC5BD,EAAYC,GAAM,sBAAsB,GAC7B;EACX,IAAMS,IAAKP,EAAUC,CAAC;EACtB,IA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"file":"PkToolShowVideo-CS6iDwjn.js","names":["$t","_openBlock","_createElementBlock","_createElementVNode","_createVNode","_toDisplayString","_Fragment","_renderList","_normalizeClass","PkHeldImage","_unref","useChatImageGate","sanitizeId","raw","hostMatches","host","domain","youtubeId","u","v","m","vimeoId","parseVideoSource","url","id","hint","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","IFRAME_ALLOW","PkToolShowVideo_default","defineComponent","props","__props","PLAYER_HOSTS","imageGate","videos","computed","source","video","gated","src","release","urls","_component_VvIcon","VvIcon","openBlock","createElementBlock","createElementVNode","createVNode","toDisplayString","_ctx","Fragment","renderList","normalizeClass","index","PkHeldImage_default","unref","createCommentVNode"],"sources":["../../../../packages/utils/src/video-source.ts","../../../../packages/components/src/chat/PkToolShowVideo.vue"],"sourcesContent":["/**\n * Video source parsing shared by the backend platform renderer and the frontend\n * player component, so both classify a video URL the same way.\n *\n * A URL is either a known provider (YouTube/Vimeo), which plays through the\n * provider's iframe embed, or a direct media file (`file`), which plays in a\n * native `<video>` element. Detection is by URL shape; an explicit `hint` is\n * used only as a fallback when the URL alone is inconclusive.\n */\n\nexport type VideoProvider = 'youtube' | 'vimeo' | 'file'\n\nexport interface ParsedVideoSource {\n provider: VideoProvider\n /** The original URL, unchanged. */\n url: string\n /**\n * The URL to actually load: the provider iframe embed URL for\n * YouTube/Vimeo, or the direct file URL for `file`.\n */\n embedUrl: string\n /** The provider video id (providers only). */\n videoId?: string\n /**\n * A preview image URL derived from the provider, when one is available\n * without an extra API call (currently YouTube only). Lets a link-only\n * surface (e.g. a Teams card) show a thumbnail instead of a bare link.\n */\n thumbnailUrl?: string\n}\n\n/** Keep only characters that are legal in a provider video id. */\nconst sanitizeId = (raw: string): string => raw.replace(/[^a-zA-Z0-9_-]/g, '')\n\n/**\n * True when `host` is exactly `domain` or a subdomain of it. Guards against\n * lookalike hosts (e.g. `notyoutube.com`) that a bare substring check would\n * misclassify.\n */\nconst hostMatches = (host: string, domain: string): boolean =>\n host === domain || host.endsWith(`.${domain}`)\n\n/** Extract the YouTube video id from any of its URL shapes, or null. */\nconst youtubeId = (u: URL): string | null => {\n // youtu.be/<id>\n if (u.hostname.endsWith('youtu.be')) {\n return sanitizeId(u.pathname.split('/')[1] ?? '') || null\n }\n // youtube.com/watch?v=<id>\n const v = u.searchParams.get('v')\n if (v) {\n return sanitizeId(v) || null\n }\n // youtube.com/shorts/<id>, /live/<id>, /embed/<id>, /v/<id>\n const m = u.pathname.match(/^\\/(?:shorts|live|embed|v)\\/([^/?#]+)/)\n return m ? sanitizeId(m[1]) || null : null\n}\n\n/** Extract the Vimeo (numeric) video id, or null. */\nconst vimeoId = (u: URL): string | null => {\n // player.vimeo.com/video/<id> or vimeo.com/<id>\n const m = u.pathname.match(/(?:^|\\/)(\\d+)(?:$|[/?#])/)\n return m ? m[1] : null\n}\n\n/**\n * Classify a video URL into a provider + a loadable embed/file URL.\n * Falls back to `file` (native `<video>`) for anything not recognized as a\n * supported provider, or when a provider is matched but no id can be extracted.\n */\nexport function parseVideoSource(\n url: string,\n hint?: VideoProvider,\n): ParsedVideoSource {\n let u: URL | undefined\n try {\n u = new URL(url)\n } catch {\n // Not an absolute URL: treat as a direct file reference.\n return { provider: 'file', url, embedUrl: url }\n }\n\n const host = u.hostname.toLowerCase()\n\n const isYouTube =\n hostMatches(host, 'youtube.com') ||\n hostMatches(host, 'youtu.be') ||\n hostMatches(host, 'youtube-nocookie.com')\n if (isYouTube) {\n const id = youtubeId(u)\n if (id) {\n return {\n provider: 'youtube',\n url,\n videoId: id,\n embedUrl: `https://www.youtube-nocookie.com/embed/${id}`,\n thumbnailUrl: `https://img.youtube.com/vi/${id}/hqdefault.jpg`,\n }\n }\n }\n\n if (hostMatches(host, 'vimeo.com')) {\n const id = vimeoId(u)\n if (id) {\n return {\n provider: 'vimeo',\n url,\n videoId: id,\n // `dnt=1`: the player sets no cookies and records no session\n // data, the Vimeo counterpart of youtube-nocookie above.\n embedUrl: `https://player.vimeo.com/video/${id}?dnt=1`,\n }\n }\n }\n\n // Honor an explicit provider hint only if we could not extract an id from a\n // provider URL (so a caller-tagged provider link still routes to an iframe\n // via its original URL rather than a broken native <video>).\n if (hint && hint !== 'file') {\n return { provider: hint, url, embedUrl: url }\n }\n\n return { provider: 'file', url, embedUrl: url }\n}\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { parseVideoSource, type VideoProvider } from 'utils'\n import { useChatImageGate } from './chatImagePolicy'\n import PkHeldImage from './PkHeldImage.vue'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n interface VideoInput {\n url: string\n title?: string\n description?: string\n poster?: string\n provider?: VideoProvider\n }\n\n // Permissions granted to provider embeds (YouTube/Vimeo players).\n const IFRAME_ALLOW =\n 'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share'\n\n /**\n * Where a YouTube or Vimeo player lives: the url is built here from the\n * video id, so nothing the model wrote reaches these hosts but the id.\n */\n const PLAYER_HOSTS = ['www.youtube-nocookie.com', 'player.vimeo.com']\n\n // A file, its poster, or an embed this card does not recognize, fetch the\n // url the model wrote as soon as they render: from a host the agent does\n // not list they wait for a click, like an image (chatImagePolicy.ts).\n const imageGate = useChatImageGate()\n\n const videos = computed(() => {\n const part = props.part as { input?: { videos?: VideoInput[] } }\n return (part.input?.videos ?? []).map((video) => {\n const source = parseVideoSource(video.url, video.provider)\n const fetched =\n source.provider === 'file'\n ? [source.embedUrl, video.poster]\n : [source.embedUrl]\n const gated = fetched.filter(\n (src): src is string =>\n !!src &&\n !PLAYER_HOSTS.includes(imageGate.hostOf(src) ?? ''),\n )\n return {\n ...video,\n source,\n gated,\n held: gated.some((src) => !imageGate.canLoad(src)),\n }\n })\n })\n\n function release(urls: string[]) {\n for (const url of urls) {\n imageGate.release(url)\n }\n }\n</script>\n\n<template>\n <div\n v-if=\"videos.length\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden bg-surface\">\n <div\n class=\"px-sm py-6 bg-surface-1 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8 min-h-40\">\n <VvIcon name=\"ri:film-line\" class=\"text-16\" />\n <strong class=\"font-bold\">\n {{ $t('label.video') }}\n </strong>\n </div>\n <!-- Each video bleeds to the card's edges, like the map of the\n location card: the card's overflow clips the bottom corners. -->\n <div\n v-for=\"(video, index) in videos\"\n :key=\"video.url\"\n class=\"flex flex-col\"\n :class=\"{ 'border-t border-surface-3': index > 0 }\">\n <!-- Direct file: native player. Handles MP4/WebM/OGG and works\n inside the widget's Shadow DOM without any extra CSS. -->\n <div\n v-if=\"video.held\"\n class=\"w-full overflow-hidden\"\n style=\"aspect-ratio: 16 / 9\">\n <PkHeldImage\n :host=\"imageGate.hostOf(video.gated[0])\"\n kind=\"video\"\n fill\n @release=\"release(video.gated)\" />\n </div>\n <video\n v-else-if=\"video.source.provider === 'file'\"\n :src=\"video.source.embedUrl\"\n :poster=\"video.poster\"\n controls\n preload=\"metadata\"\n playsinline\n class=\"w-full bg-black\"\n style=\"aspect-ratio: 16 / 9; max-height: 480px\">\n <a :href=\"video.url\" target=\"_blank\" rel=\"noopener noreferrer\">\n {{ video.title ?? video.url }}\n </a>\n </video>\n <!-- Provider (YouTube/Vimeo): iframe embed, 16:9 responsive. -->\n <div\n v-else\n class=\"relative w-full overflow-hidden bg-black\"\n style=\"aspect-ratio: 16 / 9\">\n <iframe\n :src=\"video.source.embedUrl\"\n :title=\"video.title ?? video.url\"\n loading=\"lazy\"\n referrerpolicy=\"strict-origin-when-cross-origin\"\n :allow=\"IFRAME_ALLOW\"\n allowfullscreen\n class=\"absolute inset-0 w-full h-full border-0\"></iframe>\n </div>\n <div\n v-if=\"video.title || video.description\"\n class=\"p-sm flex flex-col gap-4 border-t border-surface-3\">\n <strong v-if=\"video.title\" class=\"font-bold text-14\">\n {{ video.title }}\n </strong>\n <span v-if=\"video.description\" class=\"text-12 text-word-3\">\n {{ video.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OATN2B,GASM,CALFzB,EAIsCK,GAAA;IAHjC,MAAMC,EAAAiC,CAAA,CAAS,CAAC,OAAOI,EAAM,MAAK,EAAA;IACnC,MAAK;IACL,MAAA;IACC,YAAO,MAAEG,EAAQH,EAAM,KAAK;G,wCAGtBA,EAAM,OAAO,aAAQ,UADpC9C,EAAA,GAAAC,EAYQ,SAAA;;IAVH,KAAK6C,EAAM,OAAO;IAClB,QAAQA,EAAM;IACf,UAAA;IACA,SAAQ;IACR,aAAA;IACA,OAAM;IACN,OAAA;KAAA,gBAAA;KAAA,cAAA;IAAA;G,IACA5C,EAEI,KAAA;IAFA,MAAM4C,EAAM;IAAK,QAAO;IAAS,KAAI;GAClC,GAAA1C,EAAA0C,EAAM,SAASA,EAAM,GAAG,GAAA,GAAAhB,CAAA,C,aAInC9B,EAAA,GAAAC,EAYM,OAZN8B,GAYM,CARF7B,EAO6D,UAAA;IANxD,KAAK4C,EAAM,OAAO;IAClB,OAAOA,EAAM,SAASA,EAAM;IAC7B,SAAQ;IACR,gBAAe;IACd,OAAOV;IACR,iBAAA;IACA,OAAM;G,mBAGJU,EAAM,SAASA,EAAM,eAD/B9C,EAAA,GAAAC,EASM,OATNgC,GASM,CANYa,EAAM,SAApB9C,EAAA,GAAAC,EAES,UAFTiC,GAES9B,EADF0C,EAAM,KAAK,GAAA,CAAA,K,WAENA,EAAM,eAAlB9C,EAAA,GAAAC,EAEO,QAFPkC,GAEO/B,EADA0C,EAAM,WAAW,GAAA,CAAA,K"}
|
|
@@ -2,7 +2,7 @@ import { t as e } from "./rolldown-runtime-CGnMp29N.js";
|
|
|
2
2
|
import "./src-nb8MU1sh.js";
|
|
3
3
|
import { t } from "./PkLazyImg-D_Tmtfz3.js";
|
|
4
4
|
import { n } from "./url-validation-CJV9pp4v.js";
|
|
5
|
-
import { r } from "./PkStreamingMarkdown-
|
|
5
|
+
import { r } from "./PkStreamingMarkdown-D6Qxwf47.js";
|
|
6
6
|
import { t as i } from "./PkHeldImage-CK1xwkvq.js";
|
|
7
7
|
import { t as a } from "./PkUrl-IFszepUi.js";
|
|
8
8
|
import { VvIcon as o } from "@volverjs/ui-vue/components";
|
|
@@ -82,4 +82,4 @@ var x = {
|
|
|
82
82
|
}), k = /* @__PURE__ */ e({ default: () => A }), A = O;
|
|
83
83
|
export { k as n, A as t };
|
|
84
84
|
|
|
85
|
-
//# sourceMappingURL=PkToolShowWebPages-
|
|
85
|
+
//# sourceMappingURL=PkToolShowWebPages-y3sajjCP.js.map
|
package/dist-vue/_chunks/{PkToolShowWebPages-2023cqa1.js.map → PkToolShowWebPages-y3sajjCP.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PkToolShowWebPages-
|
|
1
|
+
{"version":3,"file":"PkToolShowWebPages-y3sajjCP.js","names":["$t","_openBlock","_createElementBlock","_Fragment","_renderList","_createElementVNode","_unref","_createBlock","PkHeldImage","PkLazyImg","_toDisplayString","_createVNode","PkUrl","_createTextVNode","__exportAll","PkHeldImage_default","PkUrl_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","PkToolShowWebPages_vue_vue_type_script_setup_true_lang_default","props","__props","toolPart","computed","imageGate","useChatImageGate","normalizeUrl","u","url","uniquePages","seen","result","page","key","showMore","ref","pages","hasMore","_component_VvIcon","VvIcon","openBlock","createElementBlock","Fragment","renderList","index","createElementVNode","_ctx","unref","isSameSite","createBlock","PkLazyImg_default","createCommentVNode","toDisplayString","createVNode","_cache","createTextVNode","PkToolShowWebPages_exports","PkToolShowWebPages_default"],"sources":["../../../../packages/components/src/chat/PkToolShowWebPages.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, ref } from 'vue'\n import { isSameSite } from 'utils'\n import PkLazyImg from '../PkLazyImg.vue'\n import { useChatImageGate } from './chatImagePolicy'\n import PkHeldImage from './PkHeldImage.vue'\n import PkUrl from '../PkUrl.vue'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n pages: Array<{\n title: string\n url: string\n image?: string\n description?: string\n }>\n }\n }\n return part\n })\n\n // The model writes these urls: one from a host the agent does not list\n // waits for a click (chatImagePolicy.ts).\n const imageGate = useChatImageGate()\n\n // The model often passes the same URL several times (e.g. multiple KB\n // chunks from one page), so collapse duplicates, keeping the first (richest)\n // entry. Normalize by dropping the hash and any trailing slash.\n const normalizeUrl = (url: string) => {\n try {\n const u = new URL(url)\n u.hash = ''\n return u.toString().replace(/\\/$/, '')\n } catch {\n return url.trim().replace(/\\/$/, '')\n }\n }\n const uniquePages = computed(() => {\n const seen = new Set<string>()\n const result: NonNullable<typeof toolPart.value.input>['pages'] = []\n for (const page of toolPart.value.input?.pages || []) {\n const key = normalizeUrl(page.url)\n if (seen.has(key)) {\n continue\n }\n seen.add(key)\n result.push(page)\n }\n return result\n })\n\n const showMore = ref(false)\n const pages = computed(() => {\n if (showMore.value) {\n return uniquePages.value\n }\n return uniquePages.value.slice(0, 2)\n })\n const hasMore = computed(() => uniquePages.value.length > 2)\n</script>\n\n<template>\n <ul\n v-if=\"pages?.length\"\n class=\"vv-item-group vv-item-group--framed w-full shrink-0\">\n <li\n v-for=\"(page, index) in pages\"\n :key=\"index\"\n class=\"vv-item vv-item--top vv-item--roomy\">\n <a\n :href=\"page.url\"\n :title=\"$t('action.open')\"\n :target=\"isSameSite(page.url) ? undefined : '_blank'\"\n :rel=\"isSameSite(page.url) ? undefined : 'noopener noreferrer'\"\n class=\"vv-item__entry\">\n <!-- og:images the model scraped are third-party urls: a dead one\n degrades to an icon instead of breaking the card layout -->\n <PkHeldImage\n v-if=\"page.image && !imageGate.canLoad(page.image)\"\n :host=\"imageGate.hostOf(page.image)\"\n class=\"w-48 h-48 rounded-lg shrink-0 border border-surface-3 bg-surface\"\n @release=\"imageGate.release(page.image)\" />\n <PkLazyImg\n v-else-if=\"page.image\"\n :src=\"page.image\"\n :alt=\"page.title\"\n fallback-icon=\"ri:image-off-line\"\n class=\"w-48 h-48 object-contain rounded-lg shrink-0 border border-surface-3 bg-surface\" />\n <div class=\"flex flex-col gap-4 min-w-0 flex-1\">\n <strong\n class=\"vv-item__title font-medium text-12 text-word-1\">\n {{ page.title }}\n </strong>\n <span\n class=\"text-10 text-word-4 truncate flex items-center gap-4\">\n <VvIcon name=\"ri:link\" class=\"shrink-0 text-12\" />\n <PkUrl :url=\"page.url\" />\n </span>\n <p\n v-if=\"page.description\"\n class=\"text-12 text-word-3 line-clamp-2\">\n {{ page.description }}\n </p>\n </div>\n </a>\n </li>\n <li v-if=\"hasMore\" class=\"vv-item\">\n <button\n class=\"vv-item__entry justify-center cursor-pointer\"\n @click=\"showMore = !showMore\">\n <VvIcon\n :name=\"\n showMore ? 'ri:arrow-up-s-line' : 'ri:arrow-down-s-line'\n \"\n class=\"text-16\" />\n {{\n showMore\n ? $t('action.showLess')\n : $t('action.showMore', {\n count: uniquePages.length - 2,\n })\n }}\n </button>\n </li>\n </ul>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQI,IAAMyB,IAAQC,GAIRC,IAAWC,QACAH,EAAM,IAWtB,GAIKI,IAAYC,EAAiB,GAK7BC,KAAgB,MAAgB;GAClC,IAAI;IACA,IAAMC,IAAI,IAAI,IAAIC,CAAG;IAErB,OADA,EAAE,OAAO,IACFD,EAAE,SAAS,CAAC,CAAC,QAAQ,OAAO,EAAE;GACzC,QAAQ;IACJ,OAAOC,EAAI,KAAK,CAAC,CAAC,QAAQ,OAAO,EAAE;GACvC;EACJ,GACMC,IAAcN,QAAe;GAC/B,IAAMO,oBAAO,IAAI,IAAY,GACvBC,IAA4D,CAAC;GACnE,KAAK,IAAMC,KAAQV,EAAS,MAAM,OAAO,SAAS,CAAC,GAAG;IAClD,IAAMW,IAAMP,EAAaM,EAAK,GAAG;IACjC,AAAIF,EAAK,IAAIG,CAAG,MAGhBH,EAAK,IAAIG,CAAG,GACZF,EAAO,KAAKC,CAAI;GACpB;G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,EAAA,GAAAC,EAII,KAJJoB,GAIIZ,EADG2B,EAAK,WAAW,GAAA,CAAA,K;G,uBAKzBK,EAAA,SAAVzC,EAAA,GAAAC,EAiBK,MAjBLqB,GAiBK,CAhBDlB,EAeS,UAAA;IAdL,OAAM;IACL,SAAK,AAAAsD,EAAA,QAAA,MAAE,EAAA,QAAQ,CAAIpB,EAAA;G,IACpB5B,EAIsBgC,GAAA;IAHjB,MAA+BJ,EAAA,QAAQ,uBAAA;IAGxC,OAAM;G,uBAAY1B,EAAA,MACtBH,EACI6B,EAAA,QAAmCvC,EAAAA,GAAE,iBAAA,IAA8CA,EAAAA,GAAE,mBAAA,EAA2D,OAAAkC,EAAA,MAAY,SAAM,E"}
|
package/dist-vue/_chunks/{createChatbotApiClient-BACnmIzY.js → createChatbotApiClient-Pb7_cU2s.js}
RENAMED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { C as e, S as t, b as n, g as r, h as i, m as a, o, r as s, s as c, u as l, w as u, x as ee, y as d } from "./schemas-CwcNxjnD.js";
|
|
2
2
|
import { l as f, t as te } from "./Media-0U2B_qCS.js";
|
|
3
|
-
import { Dt as p, Et as m, c as
|
|
4
|
-
import { t as
|
|
3
|
+
import { Dt as p, Et as m, c as h, ct as ne, j as re, l as ie, m as ae, o as oe, r as se, u as ce, v as le } from "./Agent-CRwhrv5Z.js";
|
|
4
|
+
import { t as ue } from "./StreamError-FMgvyJMX.js";
|
|
5
5
|
import "./src-nb8MU1sh.js";
|
|
6
|
-
import { r as
|
|
7
|
-
import { buildMongoQueryMatcher as
|
|
8
|
-
import { createAccessControl as
|
|
9
|
-
import { adminAc as
|
|
6
|
+
import { r as g, t as de } from "./url-validation-CJV9pp4v.js";
|
|
7
|
+
import { buildMongoQueryMatcher as fe, createAliasResolver as pe } from "@casl/ability";
|
|
8
|
+
import { createAccessControl as me } from "better-auth/plugins";
|
|
9
|
+
import { adminAc as he, defaultStatements as ge, memberAc as _, ownerAc as _e } from "better-auth/plugins/organization/access";
|
|
10
10
|
// ../../packages/models/src/schema/ConversationAnalysis.ts
|
|
11
|
-
var
|
|
11
|
+
var ve = /* @__PURE__ */ function(e) {
|
|
12
12
|
return e.Harassment = "harassment", e.HateSpeech = "hate_speech", e.SexualContent = "sexual_content", e.SelfHarm = "self_harm", e.Violence = "violence", e.PromptInjection = "prompt_injection", e.DataExtraction = "data_extraction", e.Spam = "spam", e.OffTopicPersistent = "off_topic_persistent", e.Impersonation = "impersonation", e;
|
|
13
|
-
}({}),
|
|
13
|
+
}({}), ye = /* @__PURE__ */ function(e) {
|
|
14
14
|
return e.Low = "low", e.Medium = "medium", e.High = "high", e;
|
|
15
15
|
}({}), v = /* @__PURE__ */ function(e) {
|
|
16
16
|
return e.FalseSuccess = "false_success", e.Hallucination = "hallucination", e.OffBrand = "off_brand", e.DataLeak = "data_leak", e.InappropriateTone = "inappropriate_tone", e.RefusalLoop = "refusal_loop", e.Repetition = "repetition", e.FailedAction = "failed_action", e.EmptyReply = "empty_reply", e.StuckFlow = "stuck_flow", e;
|
|
@@ -33,8 +33,8 @@ var ye = /* @__PURE__ */ function(e) {
|
|
|
33
33
|
language: n().max(10).describe("ISO 639-1 language code of the conversation (e.g. \"en\", \"it\")."),
|
|
34
34
|
topics: o(n().max(100)).max(10).describe("Main topics discussed, as short lowercase labels."),
|
|
35
35
|
userAbuseDetected: c().describe("Whether user abuse was detected. If false, userAbuseCategories MUST be empty."),
|
|
36
|
-
userAbuseCategories: o(s(
|
|
37
|
-
userAbuseConfidence: s(
|
|
36
|
+
userAbuseCategories: o(s(ve)).default([]).describe("Abuse categories detected. Non-empty only if userAbuseDetected is true."),
|
|
37
|
+
userAbuseConfidence: s(ye).optional().describe("Confidence level of the abuse detection. Set only if userAbuseDetected is true."),
|
|
38
38
|
userAbuseSummary: n().max(w).optional().describe("Brief description of the abusive behavior detected. Always write in English. Set only if userAbuseDetected is true."),
|
|
39
39
|
llmIssueDetected: c().describe("Whether an LLM quality issue was detected. If false, llmIssueCategories MUST be empty."),
|
|
40
40
|
llmIssueCategories: o(s(v)).default([]).describe("LLM issue categories detected. Non-empty only if llmIssueDetected is true."),
|
|
@@ -67,21 +67,21 @@ r({
|
|
|
67
67
|
maxOutputTokens: i().positive().optional(),
|
|
68
68
|
presencePenalty: i().min(-2).max(2).optional(),
|
|
69
69
|
frequencyPenalty: i().min(-2).max(2).optional(),
|
|
70
|
-
searchMode: s(
|
|
70
|
+
searchMode: s(ce).optional(),
|
|
71
71
|
limit: i().optional(),
|
|
72
|
-
ranking:
|
|
73
|
-
reasoning:
|
|
74
|
-
webSearch:
|
|
72
|
+
ranking: h.optional(),
|
|
73
|
+
reasoning: ie,
|
|
74
|
+
webSearch: ae.optional(),
|
|
75
75
|
maxStepCount: i().int().min(1).max(40).optional(),
|
|
76
|
-
disabledTools: o(s(
|
|
76
|
+
disabledTools: o(s(se)).optional(),
|
|
77
77
|
fallbackModels: o(n()).optional(),
|
|
78
|
-
gatewayOptions:
|
|
79
|
-
deviceContext:
|
|
78
|
+
gatewayOptions: oe.partial().optional(),
|
|
79
|
+
deviceContext: ne.optional(),
|
|
80
80
|
externalContext: d(n(), t()).optional(),
|
|
81
81
|
smoothStream: c().optional(),
|
|
82
82
|
hostTools: o(t()).optional(),
|
|
83
83
|
pageTools: t().optional(),
|
|
84
|
-
confirmations:
|
|
84
|
+
confirmations: le.optional(),
|
|
85
85
|
projectId: u().optional()
|
|
86
86
|
}), r({
|
|
87
87
|
id: n().min(1),
|
|
@@ -109,7 +109,7 @@ function A(e) {
|
|
|
109
109
|
continue;
|
|
110
110
|
}
|
|
111
111
|
let n = m(e, r.keys()), s = n && r.get(n);
|
|
112
|
-
s && (t.state === "output-error" &&
|
|
112
|
+
s && (t.state === "output-error" && ue.test(t.errorText ?? "") ? o.add(s) : a.add(s));
|
|
113
113
|
}
|
|
114
114
|
let s = new Set(n.selected), c = new Set(n.seeded), l = t.groups.map((e) => ({
|
|
115
115
|
id: e.id,
|
|
@@ -370,17 +370,17 @@ function ze(e, t, n) {
|
|
|
370
370
|
var Z = /* @__PURE__ */ function(e) {
|
|
371
371
|
return e.Backoffice = "backoffice", e.Frontoffice = "frontoffice", e.System = "system", e.Public = "public", e;
|
|
372
372
|
}({});
|
|
373
|
-
|
|
373
|
+
pe({ modify: [
|
|
374
374
|
"read",
|
|
375
375
|
"update",
|
|
376
376
|
"delete"
|
|
377
|
-
] }),
|
|
378
|
-
var Q =
|
|
379
|
-
Q.newRole(
|
|
377
|
+
] }), fe({ $or: V });
|
|
378
|
+
var Q = me(ge);
|
|
379
|
+
Q.newRole(he.statements), Q.newRole(_e.statements), Q.newRole(_.statements), Q.newRole(_.statements);
|
|
380
380
|
// ../../packages/composable/src/chatbot/api/resolveShortUrls.ts
|
|
381
381
|
async function Be(e, t, n = {}) {
|
|
382
382
|
try {
|
|
383
|
-
let r =
|
|
383
|
+
let r = g(e), i = await fetch(`${r}/api/r/resolve`, {
|
|
384
384
|
method: "POST",
|
|
385
385
|
credentials: n.credentials ?? "include",
|
|
386
386
|
headers: {
|
|
@@ -410,26 +410,30 @@ async function He(e) {
|
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
412
|
function Ue(e) {
|
|
413
|
-
let t = e.basePath ?
|
|
414
|
-
|
|
415
|
-
|
|
413
|
+
let t = e.basePath ? de(e.basePath) : `/api/v1/${Z.Public}`, n = g(e.baseUrl), r = `${n}${t}`, i = `${g(e.baseUrl)}${t.replace(/\/[^/]+$/, `/${Z.Frontoffice}`)}`, a = (e, n = "") => `${t.replace(/\/[^/]+$/, `/${Z.Public}`)}/agents/${encodeURIComponent(e)}/chat-projects${n}`, o = (e, t) => ({
|
|
414
|
+
method: e,
|
|
415
|
+
headers: { "Content-Type": "application/json" },
|
|
416
|
+
body: JSON.stringify(t)
|
|
417
|
+
});
|
|
418
|
+
async function s(t, n, i = "json", a = r) {
|
|
419
|
+
let o = await fetch(`${a}${t}`, {
|
|
416
420
|
credentials: e.credentials ?? "include",
|
|
417
|
-
...
|
|
421
|
+
...n,
|
|
418
422
|
headers: {
|
|
419
423
|
...e.headers?.(),
|
|
420
|
-
...
|
|
424
|
+
...n?.headers
|
|
421
425
|
}
|
|
422
426
|
});
|
|
423
|
-
if (!
|
|
424
|
-
if (i !== "void" &&
|
|
427
|
+
if (!o.ok) throw Error(await He(o));
|
|
428
|
+
if (i !== "void" && o.status !== 204) return o.json();
|
|
425
429
|
}
|
|
426
430
|
return {
|
|
427
431
|
async getConversations(e, t, n) {
|
|
428
|
-
let r = t ? `&filter[userId]=${encodeURIComponent(t)}` : "", a = n?.page ? `&page[number]=${n.page}` : "",
|
|
429
|
-
return (await
|
|
432
|
+
let r = n?.projectId, i = t && (r === void 0 || r === "none") ? `&filter[userId]=${encodeURIComponent(t)}` : "", a = r ? `&filter[projectId]=${encodeURIComponent(r)}` : "", o = n?.page ? `&page[number]=${n.page}` : "", c = n?.search ? `&search=${encodeURIComponent(n.search)}` : "";
|
|
433
|
+
return (await s(`/agents/${encodeURIComponent(e)}/chats?sort=-lastMessageAt&page[size]=100${o}${i}${a}${c}`)).map($);
|
|
430
434
|
},
|
|
431
435
|
async getChatFiles(t) {
|
|
432
|
-
let n = await fetch(`${
|
|
436
|
+
let n = await fetch(`${i}/me/documents?filter[chatId]=${encodeURIComponent(t)}&page[size]=100`, {
|
|
433
437
|
credentials: e.credentials ?? "include",
|
|
434
438
|
headers: { ...e.headers?.() }
|
|
435
439
|
});
|
|
@@ -438,13 +442,13 @@ function Ue(e) {
|
|
|
438
442
|
},
|
|
439
443
|
getChatFileDownloadUrl(e, t) {
|
|
440
444
|
let n = t ? "?inline=true" : "";
|
|
441
|
-
return this.appendAuthToken(`${
|
|
445
|
+
return this.appendAuthToken(`${i}/me/documents/${encodeURIComponent(e)}/download${n}`);
|
|
442
446
|
},
|
|
443
447
|
getChatFilePreviewUrl(e) {
|
|
444
|
-
return this.appendAuthToken(`${
|
|
448
|
+
return this.appendAuthToken(`${i}/me/documents/${encodeURIComponent(e)}/download?preview=true`);
|
|
445
449
|
},
|
|
446
450
|
async deleteChatFile(t) {
|
|
447
|
-
let n = await fetch(`${
|
|
451
|
+
let n = await fetch(`${i}/me/documents/${encodeURIComponent(t)}`, {
|
|
448
452
|
method: "DELETE",
|
|
449
453
|
credentials: e.credentials ?? "include",
|
|
450
454
|
headers: { ...e.headers?.() }
|
|
@@ -452,23 +456,23 @@ function Ue(e) {
|
|
|
452
456
|
if (!n.ok) throw Error(`API error: ${n.status} ${n.statusText}`);
|
|
453
457
|
},
|
|
454
458
|
async getChat(e, t) {
|
|
455
|
-
let n = await
|
|
459
|
+
let n = await s(`/agents/${encodeURIComponent(e)}/chats/${encodeURIComponent(t)}`);
|
|
456
460
|
return n ? $(n) : null;
|
|
457
461
|
},
|
|
458
462
|
async getChatWakeup(e, t) {
|
|
459
|
-
return
|
|
463
|
+
return s(`/agents/${encodeURIComponent(e)}/chats/${encodeURIComponent(t)}/wakeup`);
|
|
460
464
|
},
|
|
461
465
|
async stopChatWakeup(e, t) {
|
|
462
|
-
return
|
|
466
|
+
return s(`/agents/${encodeURIComponent(e)}/chats/${encodeURIComponent(t)}/wakeup`, { method: "DELETE" });
|
|
463
467
|
},
|
|
464
468
|
async deleteChatTask(e, t, n) {
|
|
465
|
-
return
|
|
469
|
+
return s(`/agents/${encodeURIComponent(e)}/chats/${encodeURIComponent(t)}/tasks/${encodeURIComponent(n)}`, { method: "DELETE" });
|
|
466
470
|
},
|
|
467
471
|
async markChatWakeupPresence(e, t) {
|
|
468
|
-
await
|
|
472
|
+
await s(`/agents/${encodeURIComponent(e)}/chats/${encodeURIComponent(t)}/wakeup/presence`, { method: "PUT" }, "void");
|
|
469
473
|
},
|
|
470
474
|
async stopChatTurn(e, t, n) {
|
|
471
|
-
return (await
|
|
475
|
+
return (await s(`/agents/${encodeURIComponent(e)}/chats/${encodeURIComponent(t)}/stop`, n ? {
|
|
472
476
|
method: "POST",
|
|
473
477
|
headers: { "Content-Type": "application/json" },
|
|
474
478
|
body: JSON.stringify({ streamId: n })
|
|
@@ -476,49 +480,75 @@ function Ue(e) {
|
|
|
476
480
|
},
|
|
477
481
|
async getRunningTurns(e, t) {
|
|
478
482
|
if (t.length === 0) return [];
|
|
479
|
-
let n = await
|
|
483
|
+
let n = await s(`/agents/${encodeURIComponent(e)}/chats/turns?ids=${t.map(encodeURIComponent).join(",")}`);
|
|
480
484
|
return Array.isArray(n?.running) ? n.running : [];
|
|
481
485
|
},
|
|
482
486
|
async updateChatTitle(e, t, n) {
|
|
483
|
-
return $(await
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
487
|
+
return $(await s(`/agents/${encodeURIComponent(e)}/chats/${encodeURIComponent(t)}`, o("PATCH", { title: n })));
|
|
488
|
+
},
|
|
489
|
+
async moveChat(e, t, n) {
|
|
490
|
+
return $(await s(`/agents/${encodeURIComponent(e)}/chats/${encodeURIComponent(t)}`, o("PATCH", { projectId: n })));
|
|
491
|
+
},
|
|
492
|
+
async getChatProjects(e) {
|
|
493
|
+
return s(a(e), void 0, "json", n);
|
|
494
|
+
},
|
|
495
|
+
async createChatProject(e, t) {
|
|
496
|
+
return s(a(e), o("POST", t), "json", n);
|
|
497
|
+
},
|
|
498
|
+
async updateChatProject(e, t, r) {
|
|
499
|
+
return s(a(e, `/${encodeURIComponent(t)}`), o("PATCH", r), "json", n);
|
|
500
|
+
},
|
|
501
|
+
async deleteChatProject(e, t) {
|
|
502
|
+
return s(a(e, `/${encodeURIComponent(t)}`), { method: "DELETE" }, "json", n);
|
|
503
|
+
},
|
|
504
|
+
async getChatProjectMembers(e, t) {
|
|
505
|
+
return s(a(e, `/${encodeURIComponent(t)}/members`), void 0, "json", n);
|
|
506
|
+
},
|
|
507
|
+
async getChatProjectCandidates(e, t) {
|
|
508
|
+
return s(a(e, `/${encodeURIComponent(t)}/candidates`), void 0, "json", n);
|
|
509
|
+
},
|
|
510
|
+
async addChatProjectMember(e, t, r) {
|
|
511
|
+
return s(a(e, `/${encodeURIComponent(t)}/members`), o("POST", { userId: r }), "json", n);
|
|
512
|
+
},
|
|
513
|
+
async transferChatProjectOwnership(e, t, r) {
|
|
514
|
+
return s(a(e, `/${encodeURIComponent(t)}/members/${encodeURIComponent(r)}`), o("PATCH", { role: "owner" }), "json", n);
|
|
515
|
+
},
|
|
516
|
+
async removeChatProjectMember(e, t, r) {
|
|
517
|
+
await s(a(e, `/${encodeURIComponent(t)}/members/${encodeURIComponent(r)}`), { method: "DELETE" }, "void", n);
|
|
488
518
|
},
|
|
489
519
|
async deleteChat(e, t) {
|
|
490
|
-
await
|
|
520
|
+
await s(`/agents/${encodeURIComponent(e)}/chats/${encodeURIComponent(t)}`, { method: "DELETE" }, "void");
|
|
491
521
|
},
|
|
492
522
|
async getMessageFeedbacks(e) {
|
|
493
|
-
return
|
|
523
|
+
return s(`/message-feedbacks?filter[chatId]=${encodeURIComponent(e)}&page[size]=200`);
|
|
494
524
|
},
|
|
495
525
|
async submitMessageFeedback(e) {
|
|
496
|
-
return
|
|
526
|
+
return s("/message-feedbacks", {
|
|
497
527
|
method: "POST",
|
|
498
528
|
headers: { "Content-Type": "application/json" },
|
|
499
529
|
body: JSON.stringify(e)
|
|
500
530
|
});
|
|
501
531
|
},
|
|
502
532
|
async submitLead(e) {
|
|
503
|
-
await
|
|
533
|
+
await s("/leads", {
|
|
504
534
|
method: "POST",
|
|
505
535
|
headers: { "Content-Type": "application/json" },
|
|
506
536
|
body: JSON.stringify(e)
|
|
507
537
|
}, "void");
|
|
508
538
|
},
|
|
509
539
|
async getAgent(e, t) {
|
|
510
|
-
return
|
|
540
|
+
return s(`/organizations/${encodeURIComponent(e)}/agents/${encodeURIComponent(t)}`);
|
|
511
541
|
},
|
|
512
542
|
async getChatFilePreview(e, t, n) {
|
|
513
|
-
return
|
|
543
|
+
return s(`/agents/${encodeURIComponent(e)}/chats/${encodeURIComponent(t)}/media/${encodeURIComponent(n)}/preview`);
|
|
514
544
|
},
|
|
515
545
|
async getAgentAccess(e, t) {
|
|
516
|
-
return
|
|
546
|
+
return s(`/organizations/${encodeURIComponent(e)}/agents/${encodeURIComponent(t)}/access`);
|
|
517
547
|
},
|
|
518
|
-
async uploadMedia(t,
|
|
548
|
+
async uploadMedia(t, n, i) {
|
|
519
549
|
let a = new FormData();
|
|
520
550
|
a.append("file", i);
|
|
521
|
-
let o = await fetch(`${
|
|
551
|
+
let o = await fetch(`${r}/agents/${encodeURIComponent(t)}/chats/${encodeURIComponent(n)}/media/upload`, {
|
|
522
552
|
method: "POST",
|
|
523
553
|
credentials: e.credentials ?? "include",
|
|
524
554
|
headers: e.headers?.(),
|
|
@@ -534,32 +564,32 @@ function Ue(e) {
|
|
|
534
564
|
return o.json();
|
|
535
565
|
},
|
|
536
566
|
async discardMedia(e) {
|
|
537
|
-
await
|
|
567
|
+
await s("/medias/discard", {
|
|
538
568
|
method: "POST",
|
|
539
569
|
headers: { "Content-Type": "application/json" },
|
|
540
570
|
body: JSON.stringify(e)
|
|
541
571
|
}, "void");
|
|
542
572
|
},
|
|
543
573
|
getChatEndpoint(e, t = "chat") {
|
|
544
|
-
return `${
|
|
574
|
+
return `${r}/agents/${encodeURIComponent(e)}/${t === "reasoning" ? "reasoning-chat" : "chat"}`;
|
|
545
575
|
},
|
|
546
576
|
getChatStreamEndpoint(e, t) {
|
|
547
|
-
return `${
|
|
577
|
+
return `${r}/agents/${encodeURIComponent(e)}/chats/${encodeURIComponent(t)}/stream`;
|
|
548
578
|
},
|
|
549
579
|
appendAuthToken(t) {
|
|
550
580
|
let n = e.headers?.()?.Authorization?.slice(7);
|
|
551
581
|
return n ? `${t}${t.includes("?") ? "&" : "?"}token=${encodeURIComponent(n)}` : t;
|
|
552
582
|
},
|
|
553
|
-
getMediaUrl(e, t,
|
|
554
|
-
let i = `${
|
|
583
|
+
getMediaUrl(e, t, n) {
|
|
584
|
+
let i = `${r}/agents/${encodeURIComponent(e)}/chats/${encodeURIComponent(t)}/media/${encodeURIComponent(n)}/view`;
|
|
555
585
|
return this.appendAuthToken(i);
|
|
556
586
|
},
|
|
557
|
-
getMediaDownloadUrl(e, t,
|
|
558
|
-
let i = `${
|
|
587
|
+
getMediaDownloadUrl(e, t, n) {
|
|
588
|
+
let i = `${r}/agents/${encodeURIComponent(e)}/chats/${encodeURIComponent(t)}/media/${encodeURIComponent(n)}/download`;
|
|
559
589
|
return this.appendAuthToken(i);
|
|
560
590
|
},
|
|
561
591
|
async expandSourceContext(e, t, n, r = 2) {
|
|
562
|
-
return
|
|
592
|
+
return s(`/agents/${encodeURIComponent(e)}/sources/expand-context`, {
|
|
563
593
|
method: "POST",
|
|
564
594
|
headers: { "Content-Type": "application/json" },
|
|
565
595
|
body: JSON.stringify({
|
|
@@ -570,7 +600,7 @@ function Ue(e) {
|
|
|
570
600
|
});
|
|
571
601
|
},
|
|
572
602
|
async downloadSourceDocument(e, t) {
|
|
573
|
-
return
|
|
603
|
+
return s(`/agents/${encodeURIComponent(e)}/sources/documents/${encodeURIComponent(t)}/download`);
|
|
574
604
|
},
|
|
575
605
|
async reverseGeocode(e, t, n) {
|
|
576
606
|
let r = new URLSearchParams({
|
|
@@ -579,7 +609,7 @@ function Ue(e) {
|
|
|
579
609
|
});
|
|
580
610
|
n && r.set("lang", n);
|
|
581
611
|
try {
|
|
582
|
-
return (await
|
|
612
|
+
return (await s(`/geocoder/reverse?${r}`)).displayName;
|
|
583
613
|
} catch {
|
|
584
614
|
return;
|
|
585
615
|
}
|
|
@@ -588,21 +618,21 @@ function Ue(e) {
|
|
|
588
618
|
let n = new URLSearchParams({ q: e });
|
|
589
619
|
t && n.set("lang", t);
|
|
590
620
|
try {
|
|
591
|
-
return await
|
|
621
|
+
return await s(`/geocoder/forward?${n}`);
|
|
592
622
|
} catch {
|
|
593
623
|
return;
|
|
594
624
|
}
|
|
595
625
|
},
|
|
596
626
|
async getOAuthAuthorizeUrl(e, t) {
|
|
597
627
|
let n = new URLSearchParams({ serverName: t });
|
|
598
|
-
return
|
|
628
|
+
return s(`/agents/${encodeURIComponent(e)}/mcp-oauth/authorize?${n}`);
|
|
599
629
|
},
|
|
600
630
|
async getOAuthConnectionStatus(e, t) {
|
|
601
631
|
let n = new URLSearchParams({ serverName: t });
|
|
602
|
-
return
|
|
632
|
+
return s(`/agents/${encodeURIComponent(e)}/mcp-oauth/status?${n}`);
|
|
603
633
|
},
|
|
604
634
|
async createVoiceSession(e, t, n) {
|
|
605
|
-
return
|
|
635
|
+
return re.parse(await s(`/agents/${encodeURIComponent(e)}/voice/session`, {
|
|
606
636
|
method: "POST",
|
|
607
637
|
headers: { "Content-Type": "application/json" },
|
|
608
638
|
body: JSON.stringify({
|
|
@@ -615,7 +645,7 @@ function Ue(e) {
|
|
|
615
645
|
}));
|
|
616
646
|
},
|
|
617
647
|
async closeVoiceSession(e, t) {
|
|
618
|
-
await
|
|
648
|
+
await s(`/agents/${encodeURIComponent(e)}/voice/session/${encodeURIComponent(t)}`, {
|
|
619
649
|
method: "DELETE",
|
|
620
650
|
keepalive: !0
|
|
621
651
|
}, "void");
|
|
@@ -628,6 +658,6 @@ function Ue(e) {
|
|
|
628
658
|
}
|
|
629
659
|
};
|
|
630
660
|
}
|
|
631
|
-
export {
|
|
661
|
+
export { j as a, M as i, Z as n, A as o, P as r, Ue as t };
|
|
632
662
|
|
|
633
|
-
//# sourceMappingURL=createChatbotApiClient-
|
|
663
|
+
//# sourceMappingURL=createChatbotApiClient-Pb7_cU2s.js.map
|