@inkeep/agents-ui 0.15.25 → 0.15.27
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/index.cjs +1 -1
- package/dist/index.js +166 -174
- package/dist/primitives/atoms/dialog.cjs +1 -1
- package/dist/primitives/atoms/dialog.js +110 -106
- package/dist/primitives/atoms/file-upload.cjs +1 -0
- package/dist/primitives/atoms/file-upload.d.ts +35 -0
- package/dist/primitives/atoms/file-upload.js +45 -0
- package/dist/primitives/atoms/icons/built-in-icons.cjs +1 -1
- package/dist/primitives/atoms/icons/built-in-icons.d.ts +8 -1
- package/dist/primitives/atoms/icons/built-in-icons.js +86 -79
- package/dist/primitives/atoms/icons/collections/pi.cjs +1 -1
- package/dist/primitives/atoms/icons/collections/pi.d.ts +6 -0
- package/dist/primitives/atoms/icons/collections/pi.js +103 -13
- package/dist/primitives/atoms/icons/inkeep-default-icons.cjs +1 -1
- package/dist/primitives/atoms/icons/inkeep-default-icons.js +9 -1
- package/dist/primitives/components/embedded-chat/file-upload-input.cjs +1 -0
- package/dist/primitives/components/embedded-chat/file-upload-input.d.ts +68 -0
- package/dist/primitives/components/embedded-chat/file-upload-input.js +328 -0
- package/dist/primitives/components/embedded-chat/image-preview-modal.cjs +1 -0
- package/dist/primitives/components/embedded-chat/image-preview-modal.d.ts +15 -0
- package/dist/primitives/components/embedded-chat/image-preview-modal.js +71 -0
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.cjs +3 -3
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.d.ts +7 -5
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.js +287 -247
- package/dist/primitives/components/embedded-chat.cjs +4 -4
- package/dist/primitives/components/embedded-chat.d.ts +7 -116
- package/dist/primitives/components/embedded-chat.js +1082 -1484
- package/dist/primitives/components/embedded-search.d.ts +1 -1
- package/dist/primitives/hooks/index.cjs +1 -1
- package/dist/primitives/hooks/index.js +15 -14
- package/dist/primitives/hooks/use-input-notification.cjs +1 -0
- package/dist/primitives/hooks/use-input-notification.d.ts +9 -0
- package/dist/primitives/hooks/use-input-notification.js +18 -0
- package/dist/primitives/hooks/use-scrolling-fades.cjs +1 -1
- package/dist/primitives/hooks/use-scrolling-fades.d.ts +1 -0
- package/dist/primitives/hooks/use-scrolling-fades.js +21 -5
- package/dist/primitives/index.cjs +1 -1
- package/dist/primitives/index.js +146 -154
- package/dist/primitives/providers/base-events-provider.cjs +1 -1
- package/dist/primitives/providers/base-events-provider.js +1 -1
- package/dist/primitives/providers/feedback-provider.cjs +1 -1
- package/dist/primitives/providers/feedback-provider.js +37 -38
- package/dist/primitives/providers/image-preview-provider.cjs +1 -0
- package/dist/primitives/providers/image-preview-provider.d.ts +15 -0
- package/dist/primitives/providers/image-preview-provider.js +23 -0
- package/dist/primitives/providers/index.cjs +1 -1
- package/dist/primitives/providers/index.d.ts +0 -3
- package/dist/primitives/providers/index.js +54 -63
- package/dist/primitives/utils/component-ids.cjs +1 -1
- package/dist/primitives/utils/component-ids.d.ts +54 -98
- package/dist/primitives/utils/component-ids.js +44 -66
- package/dist/primitives/utils/default-settings.cjs +1 -1
- package/dist/primitives/utils/default-settings.d.ts +0 -2
- package/dist/primitives/utils/default-settings.js +6 -8
- package/dist/react/embedded-chat.cjs +1 -1
- package/dist/react/embedded-chat.js +283 -287
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.js +166 -174
- package/dist/styled/components/chat-history.cjs +1 -1
- package/dist/styled/components/chat-history.d.ts +1 -1
- package/dist/styled/components/chat-history.js +31 -29
- package/dist/styled/components/embedded-chat/file-upload-input.cjs +1 -0
- package/dist/styled/components/embedded-chat/file-upload-input.d.ts +20 -0
- package/dist/styled/components/embedded-chat/file-upload-input.js +300 -0
- package/dist/styled/components/embedded-chat/image-preview-modal.cjs +1 -0
- package/dist/styled/components/embedded-chat/image-preview-modal.d.ts +11 -0
- package/dist/styled/components/embedded-chat/image-preview-modal.js +77 -0
- package/dist/styled/components/embedded-chat.cjs +1 -1
- package/dist/styled/components/embedded-chat.d.ts +4 -50
- package/dist/styled/components/embedded-chat.js +567 -1010
- package/dist/styled/components/message.cjs +1 -1
- package/dist/styled/components/message.js +89 -88
- package/dist/styled/components/ui/recipes/citation.d.ts +1 -1
- package/dist/styled/components/ui/recipes/index.cjs +1 -1
- package/dist/styled/components/ui/recipes/index.d.ts +0 -1
- package/dist/styled/components/ui/recipes/index.js +31 -33
- package/dist/styled/index.cjs +1 -1
- package/dist/styled/index.js +154 -162
- package/dist/styled/inkeep.css.cjs +241 -61
- package/dist/styled/inkeep.css.js +241 -61
- package/dist/types/config/ai.d.ts +1 -10
- package/dist/types/icons/built-in.d.ts +1 -1
- package/dist/types/icons/custom.d.ts +8 -0
- package/dist/types/index.d.ts +0 -1
- package/package.json +7 -6
- package/dist/primitives/providers/attachment-item-provider.cjs +0 -1
- package/dist/primitives/providers/attachment-item-provider.d.ts +0 -9
- package/dist/primitives/providers/attachment-item-provider.js +0 -13
- package/dist/primitives/providers/attachments-bar-provider.cjs +0 -1
- package/dist/primitives/providers/attachments-bar-provider.d.ts +0 -30
- package/dist/primitives/providers/attachments-bar-provider.js +0 -57
- package/dist/primitives/providers/message-attachments-provider.cjs +0 -1
- package/dist/primitives/providers/message-attachments-provider.d.ts +0 -13
- package/dist/primitives/providers/message-attachments-provider.js +0 -27
- package/dist/primitives/utils/get-message-metadata.d.ts +0 -8
- package/dist/styled/components/ui/recipes/attachment.cjs +0 -1
- package/dist/styled/components/ui/recipes/attachment.d.ts +0 -4
- package/dist/styled/components/ui/recipes/attachment.js +0 -28
- package/dist/types/config/settings/workflow.d.ts +0 -86
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),Q=require("../../primitives/providers/base-events-provider.cjs"),Y=require("../../primitives/providers/config-provider.cjs"),Z=require("../../primitives/providers/message-provider.cjs"),k=require("../../primitives/components/embedded-chat.cjs"),ee=require("../../primitives/components/embedded-chat/chat-provider.cjs"),te=require("merge-anything"),T=require("../utils.cjs"),ae=require("./ui/markdown-styles.cjs"),se=require("../../primitives/components/embedded-chat/use-stream-processor.cjs"),re=require("./data-summary-group.cjs"),r=require("react"),D=require("./embedded-chat.cjs"),l=require("lucide-react"),z=require("./ui/recipes/button.cjs"),ne={"input-streaming":"Pending","input-available":"Running","approval-requested":"Awaiting Approval","approval-responded":"Responded","output-available":"Completed","output-error":"Error","output-denied":"Denied"};function oe(a){if(!a||typeof a!="object")return!1;const s=a;return typeof s.type=="string"&&s.type.startsWith("tool-")}const ie=a=>{if(!a||typeof a!="object"||!("status"in a))return;const s=a.status;return typeof s=="string"?s:void 0},le=()=>e.jsx("div",{className:"flex space-x-1",children:[0,1,2].map(a=>e.jsx("span",{className:"animate-bounce-dot opacity-30",style:{animationDelay:`${a*.2}s`},children:"."},a))}),J=({name:a,Icon:s,props:n,componentType:c})=>e.jsxs("div",{className:"border rounded-lg bg-gray-50 dark:bg-gray-dark-800 mb-3",children:[e.jsxs("div",{className:"flex justify-between px-4 py-2 text-xs",children:[e.jsxs("div",{className:"font-medium flex items-center gap-2",children:[e.jsx(s,{className:"w-3 h-3 text-gray-600 dark:text-white-alpha-600"}),e.jsx("span",{children:a})]}),e.jsx("div",{className:"flex items-center px-1.5 py-0.5 rounded-md text-2xs uppercase tracking-wider bg-gray-200 dark:bg-white-alpha-200 font-medium text-gray-700 dark:text-white-alpha-700 font-mono",children:c})]}),e.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 font-mono px-4 py-2",children:JSON.stringify(n,null,2)})]}),ce=({name:a,props:s})=>e.jsx(J,{name:a,Icon:l.ComponentIcon,props:s,componentType:"component"}),de=({name:a,props:s})=>e.jsx(J,{name:a,Icon:l.Library,props:s,componentType:"artifact"}),pe=({tool:a,componentDef:s,renderText:n,approvalId:c,messagePartsLength:h,setApprovalDelayPending:i,addToolApprovalResponse:o,sendMessage:p,conversationId:u})=>{const f=r.useRef(p);f.current=p;const g=r.useRef(o);g.current=o;const m=r.useRef(i);m.current=i;const b=r.useCallback(async(M=!0)=>{c&&(m.current({partCount:h}),g.current({id:c,approved:M}),await f.current(void 0,{body:{conversationId:u}}))},[c,h,u]),y=r.useMemo(()=>({tool:a,approve:b,renderMarkdown:n}),[a]),N=s?D.DynamicComponent:ue;return e.jsx(N,{name:a.type,props:y,componentDef:s})},ue=({props:a,isDebug:s=!1})=>{const{tool:n,approve:c}=a,h=n.type,i=h.startsWith("tool-")?h.slice(5):h,o=n.state,p=n.approval?.id,u=!!p,f=o==="approval-requested",g=ie(n.output),[m,b]=r.useState(u||s),y=o?ne[o]??o:"tool";r.useEffect(()=>{f&&b(!0)},[f]);const N=()=>{switch(o){case"input-streaming":return e.jsx(l.Circle,{className:"w-3 h-3"});case"input-available":return e.jsx(l.Loader2,{className:"w-3 h-3 animate-spin"});case"approval-requested":return e.jsx(l.Clock,{className:"w-3 h-3"});case"approval-responded":return e.jsx(l.CheckCircle,{className:"w-3 h-3"});case"output-available":return e.jsx(l.CheckCircle,{className:"w-3 h-3"});case"output-error":return e.jsx(l.XCircle,{className:"w-3 h-3"});case"output-denied":return e.jsx(l.XCircle,{className:"w-3 h-3"});default:return null}};return e.jsxs("div",{className:"border rounded-lg mb-3 overflow-hidden",children:[(!u||s)&&e.jsxs("button",{type:"button",className:"inline-flex items-center group gap-2 text-xs text-gray-700 dark:text-white-alpha-700 hover:text-gray-800 dark:hover:text-white-alpha-800 transition-colors cursor-pointer w-full justify-between px-4 py-2",onClick:()=>b(!m),"data-expanded":m,children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("div",{className:"font-medium flex items-center gap-2",children:[e.jsx(l.Hammer,{className:"w-3 h-3 text-gray-600 dark:text-white-alpha-600"}),e.jsx("span",{children:i})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 px-1.5 py-0.5 rounded-md text-2xs uppercase tracking-wider bg-gray-100 dark:bg-white-alpha-100 font-medium text-gray-700 dark:text-white-alpha-700 font-mono",children:[N(),y]}),e.jsx(l.ChevronDown,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500 transition-all duration-200 transform rotate-0 group-data-[expanded=true]:rotate-180"})]})]}),e.jsx("div",{"data-expanded":m,className:T.cn("relative",'before:content-[""] before:absolute before:inset-x-0 before:-top-px before:h-3 before:pointer-events-none before:z-10','after:content-[""] after:absolute after:inset-x-0 after:bottom-0 after:h-3 after:pointer-events-none after:z-10',"before:bg-[linear-gradient(white,_transparent)] after:bg-[linear-gradient(transparent,_white)]","dark:before:bg-[linear-gradient(var(--ikp-color-gray-dark-950),_transparent)] dark:after:bg-[linear-gradient(transparent,_var(--ikp-color-gray-dark-950))]","data-[expanded=false]:before:opacity-0 data-[expanded=false]:after:opacity-0"),children:e.jsxs("div",{"data-expanded":m,className:T.cn("px-4 data-[expanded=true]:pb-3 [scrollbar-width:thin] overflow-hidden transition-all duration-300 ease-in-out data-[expanded=true]:opacity-100 data-[expanded=false]:max-h-0 data-[expanded=false]:opacity-0 max-w-full",u?"":"data-[expanded=true]:max-h-48 data-[expanded=true]:overflow-y-auto"),children:[n.input!=null&&e.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 font-mono py-2",children:JSON.stringify(n.input,null,2)}),!s&&u&&e.jsxs("div",{className:"whitespace-pre-wrap text-sm text-gray-700 dark:text-white-alpha-700 py-2",children:["Approval is needed to run ",e.jsx("strong",{children:i}),"."]}),f&&p&&e.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[e.jsx("button",{type:"button",className:T.cn(z.button({size:"xs",variant:"outline"}),"px-2 py-1 rounded-md text-xs text-gray-700 dark:text-white-alpha-700"),onClick:()=>c(!1),children:"Deny"}),e.jsxs("button",{type:"button",className:T.cn(z.button({size:"xs",variant:"primaryFilled"}),"px-2 py-1 rounded-md text-xs gap-1"),onClick:()=>c(!0),children:[e.jsx(l.Check,{className:"w-3 h-3"}),"Approve"]})]}),o==="output-available"&&n.output!=null&&!s&&e.jsxs("div",{className:"flex justify-end items-center gap-1 whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 capitalize",children:[g==="approved"&&e.jsx(l.Check,{className:"w-3 h-3"}),g]}),o==="output-denied"&&!s&&e.jsxs("div",{className:"flex justify-end items-center gap-1 whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 capitalize",children:[e.jsx(l.X,{className:"w-3 h-3"}),y]}),o==="output-available"&&n.output!=null&&s&&e.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 font-mono py-2",children:typeof n.output=="string"?n.output:JSON.stringify(n.output,null,2)})]})})]})},me=({className:a,componentStyles:s,children:n,isLast:c,...h})=>{const{message:i}=Z.useMessage(),{logEvent:o}=Q.useBaseEvents(),{conversationId:p,isStreaming:u,isLoading:f,setError:g,addToolApprovalResponse:m,sendMessage:b}=ee.useChat(),{aiChatSettings:{components:y,artifacts:N,headers:M}}=Y.useInkeepConfig(),X=M?.["x-emit-operations"]==="true",B=i.role==="user",F=(u||f)&&c&&i.role==="assistant",{processedParts:G,summaryTimings:K,shouldShowInitialLoading:U,shouldShowStreamDelayLoading:W}=se.useStreamProcessor(i.parts,F,g),[S,R]=r.useState(null),[H,q]=r.useState(!1),x=r.useRef(null);r.useEffect(()=>{if(!S){q(!1),x.current&&(clearTimeout(x.current),x.current=null);return}return q(!1),x.current&&clearTimeout(x.current),x.current=window.setTimeout(()=>{q(!0)},1e3),()=>{x.current&&(clearTimeout(x.current),x.current=null)}},[S]),r.useEffect(()=>{S&&(!c||i.parts.length>S.partCount)&&R(null)},[S,c,i.parts.length]);const _=r.useMemo(()=>i.parts.filter(t=>t.type==="data-artifact"&&t.data?.type?.toLowerCase()==="citation"),[i.parts]),I=r.useMemo(()=>te.merge(ae.markdownStyles,s??{}),[s]),$=r.useCallback((t,d)=>{o({eventName:"assistant_message_inline_link_opened",properties:{title:d?.toString(),url:t}})},[o]),O=r.useCallback((t,d)=>{o({eventName:"assistant_code_block_copied",properties:{conversationId:p,language:t,code:d}})},[o,p]),E=r.useCallback(t=>e.jsx(k.EmbeddedChatPrimitiveMarkdown,{text:t,componentStyles:I,onLinkClick:$,onCodeCopy:O,artifacts:_}),[I,$,O,_]),V=r.useMemo(()=>T.cn("data-[role=user]:whitespace-pre-wrap mb-3 data-[role=user]:mb-0 [&[data-role=user]>p]:mb-0 max-w-full",a),[a]);return e.jsxs(e.Fragment,{children:[G.map((t,d)=>{const j={"data-role":i.role,"data-type":t?.type==="data-component"?t.data.type:t?.type,...h,className:V};switch(t?.type){case"text":return e.jsx(k.PrimitiveMessagePart,{...j,children:B?t.text:E(t.text||"")},d);case"data-component":{const{type:v}=t.data;switch(v){case"text":return e.jsx("div",{...j,children:E(t.data.text||"")},d);default:{const C=t.data,{name:w,props:A}=C,P=y?.[w],L=P?D.DynamicComponent:ce;return e.jsx(k.PrimitiveMessagePart,{...j,children:e.jsx(L,{name:w,props:A,componentDef:P})},`${w}-${d}`)}}}case"data-artifact":{const v=t.data,{name:C,type:w,artifactSummary:A}=v,P=N?.[w],L=P?D.DynamicComponent:de;return e.jsx(k.PrimitiveMessagePart,{...j,children:e.jsx(L,{name:w,props:A,componentDef:P})},`${C}-${d}`)}case"summary-group":{const v=K.get(t.groupKey)||{isCompleted:!1};return e.jsx(k.PrimitiveMessagePart,{...j,children:e.jsx(re.DataSummaryGroup,{summaries:t.summaries||[],isCompleted:v.isCompleted})},`${t.groupKey}-${d}`)}default:{if(!oe(t))return null;const v=t,C=t.approval?.id;return X||C?e.jsx(k.PrimitiveMessagePart,{...j,children:e.jsx(pe,{tool:v,componentDef:y?.IkpTool,renderText:E,approvalId:C,messagePartsLength:i.parts.length,setApprovalDelayPending:R,addToolApprovalResponse:m,sendMessage:b,conversationId:p})},t.toolCallId??`${t.type}-${d}`):null}}}),U&&e.jsx(D.MessageLoading,{}),(W||H)&&e.jsx(le,{})]})};exports.EmbeddedChatMessagePart=me;
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),Y=require("../../primitives/providers/base-events-provider.cjs"),Z=require("../../primitives/providers/config-provider.cjs"),ee=require("../../primitives/providers/message-provider.cjs"),k=require("../../primitives/components/embedded-chat.cjs"),te=require("../../primitives/components/embedded-chat/chat-provider.cjs"),ae=require("merge-anything"),T=require("../utils.cjs"),se=require("./ui/markdown-styles.cjs"),re=require("../../primitives/components/embedded-chat/use-stream-processor.cjs"),ne=require("./data-summary-group.cjs"),r=require("react"),D=require("./embedded-chat.cjs"),l=require("lucide-react"),J=require("./ui/recipes/button.cjs"),oe={"input-streaming":"Pending","input-available":"Running","approval-requested":"Awaiting Approval","approval-responded":"Responded","output-available":"Completed","output-error":"Error","output-denied":"Denied"};function ie(a){if(!a||typeof a!="object")return!1;const s=a;return typeof s.type=="string"&&s.type.startsWith("tool-")}const le=a=>{if(!a||typeof a!="object"||!("status"in a))return;const s=a.status;return typeof s=="string"?s:void 0},ce=()=>e.jsx("div",{className:"flex space-x-1",children:[0,1,2].map(a=>e.jsx("span",{className:"animate-bounce-dot opacity-30",style:{animationDelay:`${a*.2}s`},children:"."},a))}),U=({name:a,Icon:s,props:n,componentType:c})=>e.jsxs("div",{className:"border rounded-lg bg-gray-50 dark:bg-gray-dark-800 mb-3",children:[e.jsxs("div",{className:"flex justify-between px-4 py-2 text-xs",children:[e.jsxs("div",{className:"font-medium flex items-center gap-2",children:[e.jsx(s,{className:"w-3 h-3 text-gray-600 dark:text-white-alpha-600"}),e.jsx("span",{children:a})]}),e.jsx("div",{className:"flex items-center px-1.5 py-0.5 rounded-md text-2xs uppercase tracking-wider bg-gray-200 dark:bg-white-alpha-200 font-medium text-gray-700 dark:text-white-alpha-700 font-mono",children:c})]}),e.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 font-mono px-4 py-2",children:JSON.stringify(n,null,2)})]}),de=({name:a,props:s})=>e.jsx(U,{name:a,Icon:l.ComponentIcon,props:s,componentType:"component"}),pe=({name:a,props:s})=>e.jsx(U,{name:a,Icon:l.Library,props:s,componentType:"artifact"}),ue=({tool:a,componentDef:s,renderText:n,approvalId:c,messagePartsLength:h,setApprovalDelayPending:o,addToolApprovalResponse:i,sendMessage:p,conversationId:u})=>{const f=r.useRef(p);f.current=p;const g=r.useRef(i);g.current=i;const m=r.useRef(o);m.current=o;const j=r.useCallback(async(M=!0)=>{c&&(m.current({partCount:h}),g.current({id:c,approved:M}),await f.current(void 0,{body:{conversationId:u}}))},[c,h,u]),y=r.useMemo(()=>({tool:a,approve:j,renderMarkdown:n}),[a]),N=s?D.DynamicComponent:me;return e.jsx(N,{name:a.type,props:y,componentDef:s})},me=({props:a,isDebug:s=!1})=>{const{tool:n,approve:c}=a,h=n.type,o=h.startsWith("tool-")?h.slice(5):h,i=n.state,p=n.approval?.id,u=!!p,f=i==="approval-requested",g=le(n.output),[m,j]=r.useState(u||s),y=i?oe[i]??i:"tool";r.useEffect(()=>{f&&j(!0)},[f]);const N=()=>{switch(i){case"input-streaming":return e.jsx(l.Circle,{className:"w-3 h-3"});case"input-available":return e.jsx(l.Loader2,{className:"w-3 h-3 animate-spin"});case"approval-requested":return e.jsx(l.Clock,{className:"w-3 h-3"});case"approval-responded":return e.jsx(l.CheckCircle,{className:"w-3 h-3"});case"output-available":return e.jsx(l.CheckCircle,{className:"w-3 h-3"});case"output-error":return e.jsx(l.XCircle,{className:"w-3 h-3"});case"output-denied":return e.jsx(l.XCircle,{className:"w-3 h-3"});default:return null}};return e.jsxs("div",{className:"border rounded-lg mb-3 overflow-hidden",children:[(!u||s)&&e.jsxs("button",{type:"button",className:"inline-flex items-center group gap-2 text-xs text-gray-700 dark:text-white-alpha-700 hover:text-gray-800 dark:hover:text-white-alpha-800 transition-colors cursor-pointer w-full justify-between px-4 py-2",onClick:()=>j(!m),"data-expanded":m,children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("div",{className:"font-medium flex items-center gap-2",children:[e.jsx(l.Hammer,{className:"w-3 h-3 text-gray-600 dark:text-white-alpha-600"}),e.jsx("span",{children:o})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 px-1.5 py-0.5 rounded-md text-2xs uppercase tracking-wider bg-gray-100 dark:bg-white-alpha-100 font-medium text-gray-700 dark:text-white-alpha-700 font-mono",children:[N(),y]}),e.jsx(l.ChevronDown,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500 transition-all duration-200 transform rotate-0 group-data-[expanded=true]:rotate-180"})]})]}),e.jsx("div",{"data-expanded":m,className:T.cn("relative",'before:content-[""] before:absolute before:inset-x-0 before:-top-px before:h-3 before:pointer-events-none before:z-10','after:content-[""] after:absolute after:inset-x-0 after:bottom-0 after:h-3 after:pointer-events-none after:z-10',"before:bg-[linear-gradient(white,_transparent)] after:bg-[linear-gradient(transparent,_white)]","dark:before:bg-[linear-gradient(var(--ikp-color-gray-dark-950),_transparent)] dark:after:bg-[linear-gradient(transparent,_var(--ikp-color-gray-dark-950))]","data-[expanded=false]:before:opacity-0 data-[expanded=false]:after:opacity-0"),children:e.jsxs("div",{"data-expanded":m,className:T.cn("px-4 data-[expanded=true]:pb-3 [scrollbar-width:thin] overflow-hidden transition-all duration-300 ease-in-out data-[expanded=true]:opacity-100 data-[expanded=false]:max-h-0 data-[expanded=false]:opacity-0 max-w-full",u?"":"data-[expanded=true]:max-h-48 data-[expanded=true]:overflow-y-auto"),children:[n.input!=null&&e.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 font-mono py-2",children:JSON.stringify(n.input,null,2)}),!s&&u&&e.jsxs("div",{className:"whitespace-pre-wrap text-sm text-gray-700 dark:text-white-alpha-700 py-2",children:["Approval is needed to run ",e.jsx("strong",{children:o}),"."]}),f&&p&&e.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[e.jsx("button",{type:"button",className:T.cn(J.button({size:"xs",variant:"outline"}),"px-2 py-1 rounded-md text-xs text-gray-700 dark:text-white-alpha-700"),onClick:()=>c(!1),children:"Deny"}),e.jsxs("button",{type:"button",className:T.cn(J.button({size:"xs",variant:"primaryFilled"}),"px-2 py-1 rounded-md text-xs gap-1"),onClick:()=>c(!0),children:[e.jsx(l.Check,{className:"w-3 h-3"}),"Approve"]})]}),i==="output-available"&&n.output!=null&&!s&&e.jsxs("div",{className:"flex justify-end items-center gap-1 whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 capitalize",children:[g==="approved"&&e.jsx(l.Check,{className:"w-3 h-3"}),g]}),i==="output-denied"&&!s&&e.jsxs("div",{className:"flex justify-end items-center gap-1 whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 capitalize",children:[e.jsx(l.X,{className:"w-3 h-3"}),y]}),i==="output-available"&&n.output!=null&&s&&e.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 font-mono py-2",children:typeof n.output=="string"?n.output:JSON.stringify(n.output,null,2)})]})})]})},xe=({className:a,componentStyles:s,children:n,isLast:c,...h})=>{const{message:o}=ee.useMessage(),{logEvent:i}=Y.useBaseEvents(),{conversationId:p,isStreaming:u,isLoading:f,setError:g,addToolApprovalResponse:m,sendMessage:j}=te.useChat(),{aiChatSettings:{components:y,artifacts:N,headers:M}}=Z.useInkeepConfig(),X=M?.["x-emit-operations"]==="true",R=o.role==="user",B=(u||f)&&c&&o.role==="assistant",{processedParts:F,summaryTimings:G,shouldShowInitialLoading:K,shouldShowStreamDelayLoading:W}=re.useStreamProcessor(o.parts,B,g),[S,_]=r.useState(null),[H,q]=r.useState(!1),x=r.useRef(null);r.useEffect(()=>{if(!S){q(!1),x.current&&(clearTimeout(x.current),x.current=null);return}return q(!1),x.current&&clearTimeout(x.current),x.current=window.setTimeout(()=>{q(!0)},1e3),()=>{x.current&&(clearTimeout(x.current),x.current=null)}},[S]),r.useEffect(()=>{S&&(!c||o.parts.length>S.partCount)&&_(null)},[S,c,o.parts.length]);const I=r.useMemo(()=>o.parts.filter(t=>t.type==="data-artifact"&&t.data?.type?.toLowerCase()==="citation"),[o.parts]),$=r.useMemo(()=>ae.merge(se.markdownStyles,s??{}),[s]),O=r.useCallback((t,d)=>{i({eventName:"assistant_message_inline_link_opened",properties:{title:d?.toString(),url:t}})},[i]),z=r.useCallback((t,d)=>{i({eventName:"assistant_code_block_copied",properties:{conversationId:p,language:t,code:d}})},[i,p]),E=r.useCallback(t=>e.jsx(k.EmbeddedChatPrimitiveMarkdown,{text:t,componentStyles:$,onLinkClick:O,onCodeCopy:z,artifacts:I}),[$,O,z,I]),V=r.useMemo(()=>T.cn("data-[role=user]:whitespace-pre-wrap mb-3 data-[role=user]:mb-0 [&[data-role=user]>p]:mb-0 max-w-full",a),[a]),Q=!R||o.parts.some(t=>t.type==="text"&&t.text?.trim());return e.jsxs(e.Fragment,{children:[!Q&&e.jsx("span",{className:"text-gray-500 dark:text-white-alpha-500",children:"No message content"}),F.map((t,d)=>{const b={"data-role":o.role,"data-type":t?.type==="data-component"?t.data.type:t?.type,...h,className:V};switch(t?.type){case"text":return e.jsx(k.PrimitiveMessagePart,{...b,children:R?t.text:E(t.text||"")},d);case"data-component":{const{type:v}=t.data;switch(v){case"text":return e.jsx("div",{...b,children:E(t.data.text||"")},d);default:{const C=t.data,{name:w,props:A}=C,P=y?.[w],L=P?D.DynamicComponent:de;return e.jsx(k.PrimitiveMessagePart,{...b,children:e.jsx(L,{name:w,props:A,componentDef:P})},`${w}-${d}`)}}}case"data-artifact":{const v=t.data,{name:C,type:w,artifactSummary:A}=v,P=N?.[w],L=P?D.DynamicComponent:pe;return e.jsx(k.PrimitiveMessagePart,{...b,children:e.jsx(L,{name:w,props:A,componentDef:P})},`${C}-${d}`)}case"summary-group":{const v=G.get(t.groupKey)||{isCompleted:!1};return e.jsx(k.PrimitiveMessagePart,{...b,children:e.jsx(ne.DataSummaryGroup,{summaries:t.summaries||[],isCompleted:v.isCompleted})},`${t.groupKey}-${d}`)}default:{if(!ie(t))return null;const v=t,C=t.approval?.id;return X||C?e.jsx(k.PrimitiveMessagePart,{...b,children:e.jsx(ue,{tool:v,componentDef:y?.IkpTool,renderText:E,approvalId:C,messagePartsLength:o.parts.length,setApprovalDelayPending:_,addToolApprovalResponse:m,sendMessage:j,conversationId:p})},t.toolCallId??`${t.type}-${d}`):null}}}),K&&e.jsx(D.MessageLoading,{}),(W||H)&&e.jsx(ce,{})]})};exports.EmbeddedChatMessagePart=xe;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as e, jsxs as i, Fragment as
|
|
3
|
-
import { useBaseEvents as
|
|
4
|
-
import { useInkeepConfig as
|
|
5
|
-
import { useMessage as
|
|
6
|
-
import { EmbeddedChatPrimitiveMarkdown as
|
|
7
|
-
import { useChat as
|
|
8
|
-
import { merge as
|
|
2
|
+
import { jsx as e, jsxs as i, Fragment as oe } from "react/jsx-runtime";
|
|
3
|
+
import { useBaseEvents as se } from "../../primitives/providers/base-events-provider.js";
|
|
4
|
+
import { useInkeepConfig as ie } from "../../primitives/providers/config-provider.js";
|
|
5
|
+
import { useMessage as le } from "../../primitives/providers/message-provider.js";
|
|
6
|
+
import { EmbeddedChatPrimitiveMarkdown as pe, PrimitiveMessagePart as S } from "../../primitives/components/embedded-chat.js";
|
|
7
|
+
import { useChat as ce } from "../../primitives/components/embedded-chat/chat-provider.js";
|
|
8
|
+
import { merge as de } from "merge-anything";
|
|
9
9
|
import { cn as T } from "../utils.js";
|
|
10
|
-
import { markdownStyles as
|
|
11
|
-
import { useStreamProcessor as
|
|
12
|
-
import { DataSummaryGroup as
|
|
10
|
+
import { markdownStyles as ue } from "./ui/markdown-styles.js";
|
|
11
|
+
import { useStreamProcessor as me } from "../../primitives/components/embedded-chat/use-stream-processor.js";
|
|
12
|
+
import { DataSummaryGroup as he } from "./data-summary-group.js";
|
|
13
13
|
import { useState as j, useRef as D, useEffect as $, useMemo as L, useCallback as P } from "react";
|
|
14
|
-
import { DynamicComponent as R, MessageLoading as
|
|
15
|
-
import { Library as
|
|
16
|
-
import { button as
|
|
17
|
-
const
|
|
14
|
+
import { DynamicComponent as R, MessageLoading as fe } from "./embedded-chat.js";
|
|
15
|
+
import { Library as xe, ComponentIcon as ge, Hammer as ye, ChevronDown as we, Check as F, X as ve, XCircle as K, CheckCircle as W, Clock as be, Loader2 as Ce, Circle as ke } from "lucide-react";
|
|
16
|
+
import { button as X } from "./ui/recipes/button.js";
|
|
17
|
+
const Ne = {
|
|
18
18
|
"input-streaming": "Pending",
|
|
19
19
|
"input-available": "Running",
|
|
20
20
|
"approval-requested": "Awaiting Approval",
|
|
@@ -23,16 +23,16 @@ const ke = {
|
|
|
23
23
|
"output-error": "Error",
|
|
24
24
|
"output-denied": "Denied"
|
|
25
25
|
};
|
|
26
|
-
function
|
|
26
|
+
function Se(a) {
|
|
27
27
|
if (!a || typeof a != "object") return !1;
|
|
28
28
|
const r = a;
|
|
29
29
|
return typeof r.type == "string" && r.type.startsWith("tool-");
|
|
30
30
|
}
|
|
31
|
-
const
|
|
31
|
+
const Te = (a) => {
|
|
32
32
|
if (!a || typeof a != "object" || !("status" in a)) return;
|
|
33
33
|
const r = a.status;
|
|
34
34
|
return typeof r == "string" ? r : void 0;
|
|
35
|
-
},
|
|
35
|
+
}, De = () => /* @__PURE__ */ e("div", { className: "flex space-x-1", children: [0, 1, 2].map((a) => /* @__PURE__ */ e(
|
|
36
36
|
"span",
|
|
37
37
|
{
|
|
38
38
|
className: "animate-bounce-dot opacity-30",
|
|
@@ -42,7 +42,7 @@ const Se = (a) => {
|
|
|
42
42
|
children: "."
|
|
43
43
|
},
|
|
44
44
|
a
|
|
45
|
-
)) }),
|
|
45
|
+
)) }), G = ({ name: a, Icon: r, props: n, componentType: l }) => /* @__PURE__ */ i("div", { className: "border rounded-lg bg-gray-50 dark:bg-gray-dark-800 mb-3", children: [
|
|
46
46
|
/* @__PURE__ */ i("div", { className: "flex justify-between px-4 py-2 text-xs", children: [
|
|
47
47
|
/* @__PURE__ */ i("div", { className: "font-medium flex items-center gap-2", children: [
|
|
48
48
|
/* @__PURE__ */ e(r, { className: "w-3 h-3 text-gray-600 dark:text-white-alpha-600" }),
|
|
@@ -51,32 +51,32 @@ const Se = (a) => {
|
|
|
51
51
|
/* @__PURE__ */ e("div", { className: "flex items-center px-1.5 py-0.5 rounded-md text-2xs uppercase tracking-wider bg-gray-200 dark:bg-white-alpha-200 font-medium text-gray-700 dark:text-white-alpha-700 font-mono", children: l })
|
|
52
52
|
] }),
|
|
53
53
|
/* @__PURE__ */ e("pre", { className: "whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 font-mono px-4 py-2", children: JSON.stringify(n, null, 2) })
|
|
54
|
-
] }),
|
|
54
|
+
] }), Le = ({ name: a, props: r }) => /* @__PURE__ */ e(G, { name: a, Icon: ge, props: r, componentType: "component" }), Pe = ({ name: a, props: r }) => /* @__PURE__ */ e(G, { name: a, Icon: xe, props: r, componentType: "artifact" }), Ee = ({
|
|
55
55
|
tool: a,
|
|
56
56
|
componentDef: r,
|
|
57
57
|
renderText: n,
|
|
58
58
|
approvalId: l,
|
|
59
59
|
messagePartsLength: h,
|
|
60
|
-
setApprovalDelayPending:
|
|
61
|
-
addToolApprovalResponse:
|
|
60
|
+
setApprovalDelayPending: o,
|
|
61
|
+
addToolApprovalResponse: s,
|
|
62
62
|
sendMessage: c,
|
|
63
63
|
conversationId: d
|
|
64
64
|
}) => {
|
|
65
65
|
const f = D(c);
|
|
66
66
|
f.current = c;
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
const u = D(
|
|
70
|
-
u.current =
|
|
67
|
+
const x = D(s);
|
|
68
|
+
x.current = s;
|
|
69
|
+
const u = D(o);
|
|
70
|
+
u.current = o;
|
|
71
71
|
const v = P(
|
|
72
72
|
async (A = !0) => {
|
|
73
|
-
l && (u.current({ partCount: h }),
|
|
73
|
+
l && (u.current({ partCount: h }), x.current({ id: l, approved: A }), await f.current(void 0, { body: { conversationId: d } }));
|
|
74
74
|
},
|
|
75
75
|
[l, h, d]
|
|
76
|
-
),
|
|
77
|
-
return /* @__PURE__ */ e(r ? R :
|
|
78
|
-
},
|
|
79
|
-
const { tool: n, approve: l } = a, h = n.type,
|
|
76
|
+
), g = L(() => ({ tool: a, approve: v, renderMarkdown: n }), [a]);
|
|
77
|
+
return /* @__PURE__ */ e(r ? R : Ae, { name: a.type, props: g, componentDef: r });
|
|
78
|
+
}, Ae = ({ props: a, isDebug: r = !1 }) => {
|
|
79
|
+
const { tool: n, approve: l } = a, h = n.type, o = h.startsWith("tool-") ? h.slice(5) : h, s = n.state, c = n.approval?.id, d = !!c, f = s === "approval-requested", x = Te(n.output), [u, v] = j(d || r), g = s ? Ne[s] ?? s : "tool";
|
|
80
80
|
return $(() => {
|
|
81
81
|
f && v(!0);
|
|
82
82
|
}, [f]), /* @__PURE__ */ i("div", { className: "border rounded-lg mb-3 overflow-hidden", children: [
|
|
@@ -89,23 +89,23 @@ const Se = (a) => {
|
|
|
89
89
|
"data-expanded": u,
|
|
90
90
|
children: [
|
|
91
91
|
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ i("div", { className: "font-medium flex items-center gap-2", children: [
|
|
92
|
-
/* @__PURE__ */ e(
|
|
93
|
-
/* @__PURE__ */ e("span", { children:
|
|
92
|
+
/* @__PURE__ */ e(ye, { className: "w-3 h-3 text-gray-600 dark:text-white-alpha-600" }),
|
|
93
|
+
/* @__PURE__ */ e("span", { children: o })
|
|
94
94
|
] }) }),
|
|
95
95
|
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
96
96
|
/* @__PURE__ */ i("div", { className: "flex items-center gap-1.5 px-1.5 py-0.5 rounded-md text-2xs uppercase tracking-wider bg-gray-100 dark:bg-white-alpha-100 font-medium text-gray-700 dark:text-white-alpha-700 font-mono", children: [
|
|
97
97
|
(() => {
|
|
98
|
-
switch (
|
|
98
|
+
switch (s) {
|
|
99
99
|
case "input-streaming":
|
|
100
|
-
return /* @__PURE__ */ e(
|
|
100
|
+
return /* @__PURE__ */ e(ke, { className: "w-3 h-3" });
|
|
101
101
|
case "input-available":
|
|
102
|
-
return /* @__PURE__ */ e(
|
|
102
|
+
return /* @__PURE__ */ e(Ce, { className: "w-3 h-3 animate-spin" });
|
|
103
103
|
case "approval-requested":
|
|
104
|
-
return /* @__PURE__ */ e(
|
|
104
|
+
return /* @__PURE__ */ e(be, { className: "w-3 h-3" });
|
|
105
105
|
case "approval-responded":
|
|
106
|
-
return /* @__PURE__ */ e(
|
|
106
|
+
return /* @__PURE__ */ e(W, { className: "w-3 h-3" });
|
|
107
107
|
case "output-available":
|
|
108
|
-
return /* @__PURE__ */ e(
|
|
108
|
+
return /* @__PURE__ */ e(W, { className: "w-3 h-3" });
|
|
109
109
|
case "output-error":
|
|
110
110
|
return /* @__PURE__ */ e(K, { className: "w-3 h-3" });
|
|
111
111
|
case "output-denied":
|
|
@@ -114,9 +114,9 @@ const Se = (a) => {
|
|
|
114
114
|
return null;
|
|
115
115
|
}
|
|
116
116
|
})(),
|
|
117
|
-
|
|
117
|
+
g
|
|
118
118
|
] }),
|
|
119
|
-
/* @__PURE__ */ e(
|
|
119
|
+
/* @__PURE__ */ e(we, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500 transition-all duration-200 transform rotate-0 group-data-[expanded=true]:rotate-180" })
|
|
120
120
|
] })
|
|
121
121
|
]
|
|
122
122
|
}
|
|
@@ -145,7 +145,7 @@ const Se = (a) => {
|
|
|
145
145
|
n.input != null && /* @__PURE__ */ e("pre", { className: "whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 font-mono py-2", children: JSON.stringify(n.input, null, 2) }),
|
|
146
146
|
!r && d && /* @__PURE__ */ i("div", { className: "whitespace-pre-wrap text-sm text-gray-700 dark:text-white-alpha-700 py-2", children: [
|
|
147
147
|
"Approval is needed to run ",
|
|
148
|
-
/* @__PURE__ */ e("strong", { children:
|
|
148
|
+
/* @__PURE__ */ e("strong", { children: o }),
|
|
149
149
|
"."
|
|
150
150
|
] }),
|
|
151
151
|
f && c && /* @__PURE__ */ i("div", { className: "flex justify-end gap-2 pt-1", children: [
|
|
@@ -154,7 +154,7 @@ const Se = (a) => {
|
|
|
154
154
|
{
|
|
155
155
|
type: "button",
|
|
156
156
|
className: T(
|
|
157
|
-
|
|
157
|
+
X({ size: "xs", variant: "outline" }),
|
|
158
158
|
"px-2 py-1 rounded-md text-xs text-gray-700 dark:text-white-alpha-700"
|
|
159
159
|
),
|
|
160
160
|
onClick: () => l(!1),
|
|
@@ -166,7 +166,7 @@ const Se = (a) => {
|
|
|
166
166
|
{
|
|
167
167
|
type: "button",
|
|
168
168
|
className: T(
|
|
169
|
-
|
|
169
|
+
X({ size: "xs", variant: "primaryFilled" }),
|
|
170
170
|
"px-2 py-1 rounded-md text-xs gap-1"
|
|
171
171
|
),
|
|
172
172
|
onClick: () => l(!0),
|
|
@@ -177,31 +177,31 @@ const Se = (a) => {
|
|
|
177
177
|
}
|
|
178
178
|
)
|
|
179
179
|
] }),
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
g
|
|
183
|
-
] }),
|
|
184
|
-
o === "output-denied" && !r && /* @__PURE__ */ i("div", { className: "flex justify-end items-center gap-1 whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 capitalize", children: [
|
|
185
|
-
/* @__PURE__ */ e(we, { className: "w-3 h-3" }),
|
|
180
|
+
s === "output-available" && n.output != null && !r && /* @__PURE__ */ i("div", { className: "flex justify-end items-center gap-1 whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 capitalize", children: [
|
|
181
|
+
x === "approved" && /* @__PURE__ */ e(F, { className: "w-3 h-3" }),
|
|
186
182
|
x
|
|
187
183
|
] }),
|
|
188
|
-
|
|
184
|
+
s === "output-denied" && !r && /* @__PURE__ */ i("div", { className: "flex justify-end items-center gap-1 whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 capitalize", children: [
|
|
185
|
+
/* @__PURE__ */ e(ve, { className: "w-3 h-3" }),
|
|
186
|
+
g
|
|
187
|
+
] }),
|
|
188
|
+
s === "output-available" && n.output != null && r && /* @__PURE__ */ e("pre", { className: "whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 font-mono py-2", children: typeof n.output == "string" ? n.output : JSON.stringify(n.output, null, 2) })
|
|
189
189
|
]
|
|
190
190
|
}
|
|
191
191
|
)
|
|
192
192
|
}
|
|
193
193
|
)
|
|
194
194
|
] });
|
|
195
|
-
},
|
|
195
|
+
}, Xe = ({
|
|
196
196
|
className: a,
|
|
197
197
|
componentStyles: r,
|
|
198
198
|
children: n,
|
|
199
199
|
isLast: l,
|
|
200
200
|
...h
|
|
201
201
|
}) => {
|
|
202
|
-
const { message:
|
|
203
|
-
aiChatSettings: { components:
|
|
204
|
-
} =
|
|
202
|
+
const { message: o } = le(), { logEvent: s } = se(), { conversationId: c, isStreaming: d, isLoading: f, setError: x, addToolApprovalResponse: u, sendMessage: v } = ce(), {
|
|
203
|
+
aiChatSettings: { components: g, artifacts: E, headers: A }
|
|
204
|
+
} = ie(), H = A?.["x-emit-operations"] === "true", O = o.role === "user", V = (d || f) && l && o.role === "assistant", { processedParts: Q, summaryTimings: Y, shouldShowInitialLoading: Z, shouldShowStreamDelayLoading: ee } = me(o.parts, V, x), [k, z] = j(null), [te, _] = j(!1), m = D(null);
|
|
205
205
|
$(() => {
|
|
206
206
|
if (!k) {
|
|
207
207
|
_(!1), m.current && (clearTimeout(m.current), m.current = null);
|
|
@@ -213,19 +213,19 @@ const Se = (a) => {
|
|
|
213
213
|
m.current && (clearTimeout(m.current), m.current = null);
|
|
214
214
|
};
|
|
215
215
|
}, [k]), $(() => {
|
|
216
|
-
k && (!l ||
|
|
217
|
-
}, [k, l,
|
|
218
|
-
const
|
|
219
|
-
() =>
|
|
216
|
+
k && (!l || o.parts.length > k.partCount) && z(null);
|
|
217
|
+
}, [k, l, o.parts.length]);
|
|
218
|
+
const q = L(
|
|
219
|
+
() => o.parts.filter(
|
|
220
220
|
(t) => t.type === "data-artifact" && t.data?.type?.toLowerCase() === "citation"
|
|
221
221
|
),
|
|
222
|
-
[
|
|
223
|
-
),
|
|
224
|
-
() =>
|
|
222
|
+
[o.parts]
|
|
223
|
+
), J = L(
|
|
224
|
+
() => de(ue, r ?? {}),
|
|
225
225
|
[r]
|
|
226
|
-
),
|
|
226
|
+
), U = P(
|
|
227
227
|
(t, p) => {
|
|
228
|
-
|
|
228
|
+
s({
|
|
229
229
|
eventName: "assistant_message_inline_link_opened",
|
|
230
230
|
properties: {
|
|
231
231
|
title: p?.toString(),
|
|
@@ -233,10 +233,10 @@ const Se = (a) => {
|
|
|
233
233
|
}
|
|
234
234
|
});
|
|
235
235
|
},
|
|
236
|
-
[
|
|
236
|
+
[s]
|
|
237
237
|
), B = P(
|
|
238
238
|
(t, p) => {
|
|
239
|
-
|
|
239
|
+
s({
|
|
240
240
|
eventName: "assistant_code_block_copied",
|
|
241
241
|
properties: {
|
|
242
242
|
conversationId: c,
|
|
@@ -245,58 +245,59 @@ const Se = (a) => {
|
|
|
245
245
|
}
|
|
246
246
|
});
|
|
247
247
|
},
|
|
248
|
-
[
|
|
248
|
+
[s, c]
|
|
249
249
|
), I = P(
|
|
250
250
|
(t) => /* @__PURE__ */ e(
|
|
251
|
-
|
|
251
|
+
pe,
|
|
252
252
|
{
|
|
253
253
|
text: t,
|
|
254
|
-
componentStyles:
|
|
255
|
-
onLinkClick:
|
|
254
|
+
componentStyles: J,
|
|
255
|
+
onLinkClick: U,
|
|
256
256
|
onCodeCopy: B,
|
|
257
|
-
artifacts:
|
|
257
|
+
artifacts: q
|
|
258
258
|
}
|
|
259
259
|
),
|
|
260
|
-
[
|
|
260
|
+
[J, U, B, q]
|
|
261
261
|
), ae = L(
|
|
262
262
|
() => T(
|
|
263
263
|
"data-[role=user]:whitespace-pre-wrap mb-3 data-[role=user]:mb-0 [&[data-role=user]>p]:mb-0 max-w-full",
|
|
264
264
|
a
|
|
265
265
|
),
|
|
266
266
|
[a]
|
|
267
|
-
);
|
|
268
|
-
return /* @__PURE__ */ i(
|
|
267
|
+
), re = !O || o.parts.some((t) => t.type === "text" && t.text?.trim());
|
|
268
|
+
return /* @__PURE__ */ i(oe, { children: [
|
|
269
|
+
!re && /* @__PURE__ */ e("span", { className: "text-gray-500 dark:text-white-alpha-500", children: "No message content" }),
|
|
269
270
|
Q.map((t, p) => {
|
|
270
271
|
const b = {
|
|
271
|
-
"data-role":
|
|
272
|
+
"data-role": o.role,
|
|
272
273
|
"data-type": t?.type === "data-component" ? t.data.type : t?.type,
|
|
273
274
|
...h,
|
|
274
275
|
className: ae
|
|
275
276
|
};
|
|
276
277
|
switch (t?.type) {
|
|
277
278
|
case "text":
|
|
278
|
-
return /* @__PURE__ */ e(S, { ...b, children:
|
|
279
|
+
return /* @__PURE__ */ e(S, { ...b, children: O ? t.text : I(t.text || "") }, p);
|
|
279
280
|
case "data-component": {
|
|
280
281
|
const { type: y } = t.data;
|
|
281
282
|
switch (y) {
|
|
282
283
|
case "text":
|
|
283
284
|
return /* @__PURE__ */ e("div", { ...b, children: I(t.data.text || "") }, p);
|
|
284
285
|
default: {
|
|
285
|
-
const C = t.data, { name: w, props: M } = C, N =
|
|
286
|
-
return /* @__PURE__ */ e(S, { ...b, children: /* @__PURE__ */ e(N ? R :
|
|
286
|
+
const C = t.data, { name: w, props: M } = C, N = g?.[w];
|
|
287
|
+
return /* @__PURE__ */ e(S, { ...b, children: /* @__PURE__ */ e(N ? R : Le, { name: w, props: M, componentDef: N }) }, `${w}-${p}`);
|
|
287
288
|
}
|
|
288
289
|
}
|
|
289
290
|
}
|
|
290
291
|
case "data-artifact": {
|
|
291
292
|
const y = t.data, { name: C, type: w, artifactSummary: M } = y, N = E?.[w];
|
|
292
|
-
return /* @__PURE__ */ e(S, { ...b, children: /* @__PURE__ */ e(N ? R :
|
|
293
|
+
return /* @__PURE__ */ e(S, { ...b, children: /* @__PURE__ */ e(N ? R : Pe, { name: w, props: M, componentDef: N }) }, `${C}-${p}`);
|
|
293
294
|
}
|
|
294
295
|
case "summary-group": {
|
|
295
296
|
const y = Y.get(t.groupKey) || {
|
|
296
297
|
isCompleted: !1
|
|
297
298
|
};
|
|
298
299
|
return /* @__PURE__ */ e(S, { ...b, children: /* @__PURE__ */ e(
|
|
299
|
-
|
|
300
|
+
he,
|
|
300
301
|
{
|
|
301
302
|
summaries: t.summaries || [],
|
|
302
303
|
isCompleted: y.isCompleted
|
|
@@ -304,18 +305,18 @@ const Se = (a) => {
|
|
|
304
305
|
) }, `${t.groupKey}-${p}`);
|
|
305
306
|
}
|
|
306
307
|
default: {
|
|
307
|
-
if (!
|
|
308
|
+
if (!Se(t))
|
|
308
309
|
return null;
|
|
309
310
|
const y = t, C = t.approval?.id;
|
|
310
|
-
return
|
|
311
|
-
|
|
311
|
+
return H || C ? /* @__PURE__ */ e(S, { ...b, children: /* @__PURE__ */ e(
|
|
312
|
+
Ee,
|
|
312
313
|
{
|
|
313
314
|
tool: y,
|
|
314
|
-
componentDef:
|
|
315
|
+
componentDef: g?.IkpTool,
|
|
315
316
|
renderText: I,
|
|
316
317
|
approvalId: C,
|
|
317
|
-
messagePartsLength:
|
|
318
|
-
setApprovalDelayPending:
|
|
318
|
+
messagePartsLength: o.parts.length,
|
|
319
|
+
setApprovalDelayPending: z,
|
|
319
320
|
addToolApprovalResponse: u,
|
|
320
321
|
sendMessage: v,
|
|
321
322
|
conversationId: c
|
|
@@ -324,10 +325,10 @@ const Se = (a) => {
|
|
|
324
325
|
}
|
|
325
326
|
}
|
|
326
327
|
}),
|
|
327
|
-
Z && /* @__PURE__ */ e(
|
|
328
|
-
(ee || te) && /* @__PURE__ */ e(
|
|
328
|
+
Z && /* @__PURE__ */ e(fe, {}),
|
|
329
|
+
(ee || te) && /* @__PURE__ */ e(De, {})
|
|
329
330
|
] });
|
|
330
331
|
};
|
|
331
332
|
export {
|
|
332
|
-
|
|
333
|
+
Xe as EmbeddedChatMessagePart
|
|
333
334
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ClassProp } from 'class-variance-authority/types';
|
|
2
2
|
export declare const citation: (props?: ({
|
|
3
|
-
slot?: "root" | "
|
|
3
|
+
slot?: "root" | "indicator" | "breadcrumbs" | "breadcrumbsIcon" | "icon" | "title" | "tag" | "description" | "descriptionPart" | null | undefined;
|
|
4
4
|
} & ClassProp) | undefined) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./ai-chat-page-wrapper.cjs"),t=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./ai-chat-page-wrapper.cjs"),t=require("./button.cjs"),r=require("./checkbox.cjs"),c=require("./citation.cjs"),i=require("./combobox.cjs"),n=require("./icon.cjs"),l=require("./input.cjs"),s=require("./link.cjs"),e=require("./markdown.cjs"),a=require("./modal.cjs"),u=require("./popover.cjs"),b=require("./scrollable.cjs"),p=require("./select.cjs"),g=require("./skeleton.cjs"),d=require("./widget-toggle.cjs");exports.aiChatPageWrapper=o.aiChatPageWrapper;exports.button=t.button;exports.checkbox=r.checkbox;exports.citation=c.citation;exports.combobox=i.combobox;exports.icon=n.icon;exports.input=l.input;exports.link=s.link;exports.code=e.code;exports.codeblock=e.codeblock;exports.heading=e.heading;exports.list=e.list;exports.sup=e.sup;exports.table=e.table;exports.modal=a.modal;exports.popover=u.popover;exports.scrollable=b.scrollable;exports.select=p.select;exports.skeleton=g.skeleton;exports.widgetToggle=d.widgetToggle;
|
|
@@ -1,39 +1,37 @@
|
|
|
1
1
|
import { aiChatPageWrapper as e } from "./ai-chat-page-wrapper.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { checkbox as a } from "./checkbox.js";
|
|
2
|
+
import { button as p } from "./button.js";
|
|
3
|
+
import { checkbox as x } from "./checkbox.js";
|
|
5
4
|
import { citation as l } from "./citation.js";
|
|
6
|
-
import { combobox as
|
|
7
|
-
import { icon as
|
|
8
|
-
import { input as
|
|
9
|
-
import { link as
|
|
10
|
-
import { code as
|
|
11
|
-
import { modal as
|
|
12
|
-
import { popover as
|
|
13
|
-
import { scrollable as
|
|
14
|
-
import { select as
|
|
15
|
-
import { skeleton as
|
|
16
|
-
import { widgetToggle as
|
|
5
|
+
import { combobox as a } from "./combobox.js";
|
|
6
|
+
import { icon as b } from "./icon.js";
|
|
7
|
+
import { input as d } from "./input.js";
|
|
8
|
+
import { link as s } from "./link.js";
|
|
9
|
+
import { code as h, codeblock as u, heading as v, list as w, sup as C, table as P } from "./markdown.js";
|
|
10
|
+
import { modal as W } from "./modal.js";
|
|
11
|
+
import { popover as q } from "./popover.js";
|
|
12
|
+
import { scrollable as z } from "./scrollable.js";
|
|
13
|
+
import { select as B } from "./select.js";
|
|
14
|
+
import { skeleton as E } from "./skeleton.js";
|
|
15
|
+
import { widgetToggle as G } from "./widget-toggle.js";
|
|
17
16
|
export {
|
|
18
17
|
e as aiChatPageWrapper,
|
|
19
|
-
p as
|
|
20
|
-
x as
|
|
21
|
-
a as checkbox,
|
|
18
|
+
p as button,
|
|
19
|
+
x as checkbox,
|
|
22
20
|
l as citation,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
21
|
+
h as code,
|
|
22
|
+
u as codeblock,
|
|
23
|
+
a as combobox,
|
|
24
|
+
v as heading,
|
|
25
|
+
b as icon,
|
|
26
|
+
d as input,
|
|
27
|
+
s as link,
|
|
28
|
+
w as list,
|
|
29
|
+
W as modal,
|
|
30
|
+
q as popover,
|
|
31
|
+
z as scrollable,
|
|
32
|
+
B as select,
|
|
33
|
+
E as skeleton,
|
|
34
|
+
C as sup,
|
|
35
|
+
P as table,
|
|
36
|
+
G as widgetToggle
|
|
39
37
|
};
|
package/dist/styled/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("./components/embedded-chat.cjs"),M=require("./components/chat-history.cjs"),k=require("./components/sidebar-chat.cjs"),F=require("./components/chat-bubble.cjs"),w=require("./components/embedded-search.cjs"),H=require("./components/modal.cjs"),f=require("./components/chat-button.cjs"),R=require("./components/searchbar.cjs"),E=require("./components/shadow.cjs"),T=require("./components/loading-indicator.cjs"),O=require("./components/ui/recipes/widget-toggle.cjs"),D=require("./components/message.cjs"),W=require("./components/data-summary-group.cjs"),c=require("../primitives/providers/base-events-provider.cjs"),i=require("../primitives/providers/chat-form-provider.cjs"),C=require("../primitives/providers/chat-history-provider.cjs"),n=require("../primitives/providers/config-provider.cjs"),l=require("../primitives/providers/feedback-item-provider.cjs"),h=require("../primitives/providers/feedback-provider.cjs"),p=require("../primitives/providers/form-field-provider.cjs"),d=require("../primitives/providers/help-menu-provider.cjs"),S=require("../primitives/providers/markdown-provider.cjs"),u=require("../primitives/providers/message-provider.cjs"),x=require("../primitives/providers/root-provider.cjs"),b=require("../primitives/providers/source-item-provider.cjs"),z=require("../primitives/providers/theme-provider.cjs"),P=require("../primitives/providers/widget-provider.cjs"),t=require("../primitives/providers/sidebar-chat-provider.cjs"),a=require("../primitives/providers/chat-bubble-provider.cjs"),v=require("../primitives/components/factory.cjs"),$=require("../primitives/components/embedded-chat.cjs"),A=require("../primitives/components/sidebar-chat/index.cjs"),I=require("../primitives/components/embedded-chat/chat-provider.cjs"),L=require("../primitives/components/embedded-search.cjs"),m=require("../primitives/components/embedded-search/search-provider.cjs"),j=require("../primitives/components/modal.cjs"),q=require("../primitives/components/modal/modal-provider.cjs"),G=require("../primitives/components/chat-button.cjs"),Q=require("../primitives/components/searchbar.cjs"),U=require("../primitives/components/chat-bubble/index.cjs"),K=require("../primitives/components/data-summaries.cjs"),N=require("../primitives/components/chat-history/index.cjs"),J=require("../primitives/hooks/use-boolean.cjs"),V=require("../primitives/hooks/use-component-classnames.cjs"),X=require("../primitives/hooks/use-container-size.cjs"),Y=require("../primitives/hooks/use-inkeep-open-state.cjs"),Z=require("../primitives/hooks/use-copy-to-clipboard.cjs"),_=require("../primitives/hooks/use-instant-update.cjs"),ee=require("../primitives/hooks/use-is-mounted.cjs"),re=require("../primitives/hooks/use-media-query.cjs"),oe=require("../primitives/hooks/use-resize-observer.cjs"),g=require("../primitives/hooks/use-scrolling-fades.cjs"),te=require("../primitives/hooks/use-settle-action.cjs"),ae=require("../primitives/hooks/use-simple-scroll.cjs"),o=require("../primitives/utils/misc.cjs"),e=require("../primitives/utils/component-ids.cjs"),y=require("../primitives/utils/compose-refs.cjs"),se=require("../primitives/utils/merge-props.cjs"),ie=require("../primitives/atoms/portal.cjs"),ne=require("../primitives/atoms/icons/custom-icon.cjs"),de=require("../primitives/atoms/icons/built-in-icon-renderer.cjs"),ue=require("../primitives/atoms/portal-with-theme.cjs"),r=require("../primitives/atoms/cmdk/index.cjs"),me=require("../primitives/atoms/error-boundary.cjs"),s=require("../primitives/atoms/shadow/context.cjs");exports.EmbeddedChat=B;exports.ChatHistory=M;exports.SidebarChat=k;exports.ChatBubble=F;exports.EmbeddedSearch=w;exports.Modal=H;exports.ChatButton=f;exports.SearchBar=R;exports.Shadow=E.Shadow;exports.LoadingIndicator=T.LoadingIndicator;exports.widgetToggle=O.widgetToggle;exports.EmbeddedChatMessagePart=D.EmbeddedChatMessagePart;exports.DataSummaryGroup=W.DataSummaryGroup;exports.BaseEventsProvider=c.BaseEventsProvider;exports.useBaseEvents=c.useBaseEvents;exports.ChatFormProvider=i.ChatFormProvider;exports.useChatForm=i.useChatForm;exports.useChatFormState=i.useChatFormState;exports.ChatHistoryProvider=C.ChatHistoryProvider;exports.useChatHistory=C.useChatHistory;exports.InkeepConfigProvider=n.InkeepConfigProvider;exports.WebWidgetInteractionType=n.WebWidgetInteractionType;exports.useInkeepConfig=n.useInkeepConfig;exports.FeedbackItemProvider=l.FeedbackItemProvider;exports.useFeedbackItem=l.useFeedbackItem;exports.FeedbackProvider=h.FeedbackProvider;exports.useMessageFeedback=h.useMessageFeedback;exports.FormFieldProvider=p.FormFieldProvider;exports.useFormField=p.useFormField;exports.HelpMenuProvider=d.HelpMenuProvider;exports.useHelpMenu=d.useHelpMenu;exports.useHelpMenuState=d.useHelpMenuState;exports.ChatMarkdownProvider=S.ChatMarkdownProvider;exports.useChatMarkdown=S.useChatMarkdown;exports.MessageProvider=u.MessageProvider;exports.useMessage=u.useMessage;exports.useOptionalMessage=u.useOptionalMessage;exports.RootProvider=x.RootProvider;exports.SourceItemProvider=b.SourceItemProvider;exports.useSourceItem=b.useSourceItem;exports.ThemeProvider=z.ThemeProvider;exports.WidgetProvider=P.WidgetProvider;exports.useWidget=P.useWidget;exports.SidebarChatProvider=t.SidebarChatProvider;exports.useInkeepSidebarChat=t.useInkeepSidebarChat;exports.useOptionalSidebarChat=t.useOptionalSidebarChat;exports.useSidebarChat=t.useSidebarChat;exports.ChatBubbleProvider=a.ChatBubbleProvider;exports.useChatBubble=a.useChatBubble;exports.useInkeepChatBubble=a.useInkeepChatBubble;exports.useOptionalChatBubble=a.useOptionalChatBubble;exports.ikp=v.ikp;exports.jsxFactory=v.jsxFactory;exports.EmbeddedChatPrimitive=$;exports.SidebarChatPrimitive=A;exports.ChatProvider=I.ChatProvider;exports.useChat=I.useChat;exports.EmbeddedSearchPrimitive=L;exports.SearchProvider=m.SearchProvider;exports.SearchProviderImpl=m.SearchProviderImpl;exports.useSearch=m.useSearch;exports.ModalPrimitive=j;exports.ModalProvider=q.ModalProvider;exports.useModal=q.useModal;exports.ChatButtonPrimitive=G;exports.SearchBarPrimitive=Q;exports.ChatBubblePrimitive=U;exports.DataSummaryPrimitive=K;exports.ChatHistoryPrimitive=N;exports.useBoolean=J.useBoolean;exports.useComponentClassNames=V.useComponentClassNames;exports.useContainerSize=X.useContainerSize;exports.useInkeepOpenState=Y.useInkeepOpenState;exports.useCopyToClipboard=Z.useCopyToClipboard;exports.useInstantUpdate=_.useInstantUpdate;exports.useIsMounted=ee.useIsMounted;exports.useMediaQuery=re.useMediaQuery;exports.useResizeObserver=oe.useResizeObserver;exports.useScrollingFades=g.useScrollingFades;exports.useScrollingFadesHorizontal=g.useScrollingFadesHorizontal;exports.useSettleAction=te.useSettleAction;exports.useSimpleScroll=ae.useSimpleScroll;exports.callAll=o.callAll;exports.dataAttr=o.dataAttr;exports.getInitials=o.getInitials;exports.getMessageContent=o.getMessageContent;exports.isString=o.isString;exports.maybeRender=o.maybeRender;exports.toKebabCase=o.toKebabCase;exports.ChatBubbleComponentIds=e.ChatBubbleComponentIds;exports.DataSummaryComponentIds=e.DataSummaryComponentIds;exports.SearchBarComponentIds=e.SearchBarComponentIds;exports.SidebarChatComponentIds=e.SidebarChatComponentIds;exports.aiChatComponentIds=e.aiChatComponentIds;exports.aiChatHistoryComponentIds=e.aiChatHistoryComponentIds;exports.aiSearchComponentIds=e.aiSearchComponentIds;exports.chatButtonComponentIds=e.chatButtonComponentIds;exports.componentIDs=e.componentIDs;exports.markDownComponentIds=e.markDownComponentIds;exports.miscellanousComponentIds=e.miscellanousComponentIds;exports.modalComponentIds=e.modalComponentIds;exports.composeRefs=y.composeRefs;exports.useComposedRefs=y.useComposedRefs;exports.mergeProps=se.mergeProps;exports.Portal=ie.Portal;exports.CustomIcon=ne.CustomIcon;exports.BuiltInIconRenderer=de.BuiltInIconRenderer;exports.PortalWithTheme=ue.PortalWithTheme;exports.Command=r.Command;exports.CommandDialog=r.CommandDialog;exports.CommandEmpty=r.CommandEmpty;exports.CommandInput=r.CommandInput;exports.CommandItem=r.CommandItem;exports.CommandList=r.CommandList;exports.CommandLoading=r.CommandLoading;exports.CommandRoot=r.CommandRoot;exports.CommandSeparator=r.CommandSeparator;exports.defaultFilter=r.defaultFilter;exports.useCommandState=r.useCommandState;exports.useCommandStore=r.useCommandStore;exports.ErrorBoundary=me.ErrorBoundary;exports.InkeepShadow=s.InkeepShadow;exports.InkeepShadowProvider=s.InkeepShadowProvider;exports.ShadowContext=s.ShadowContext;exports.useShadow=s.useShadow;
|