@inkeep/agents-ui 0.15.12 → 0.15.13
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 +171 -169
- package/dist/primitives/atoms/combobox.cjs +1 -0
- package/dist/primitives/atoms/combobox.js +275 -0
- package/dist/primitives/components/embedded-chat/use-stream-processor.cjs +1 -1
- package/dist/primitives/components/embedded-chat/use-stream-processor.js +74 -87
- package/dist/primitives/components/embedded-chat.cjs +4 -4
- package/dist/primitives/components/embedded-chat.d.ts +22 -1
- package/dist/primitives/components/embedded-chat.js +1249 -1137
- package/dist/primitives/hooks/use-simple-scroll.cjs +1 -1
- package/dist/primitives/hooks/use-simple-scroll.d.ts +12 -1
- package/dist/primitives/hooks/use-simple-scroll.js +45 -12
- package/dist/primitives/providers/base-events-provider.cjs +1 -1
- package/dist/primitives/providers/base-events-provider.js +1 -1
- package/dist/primitives/utils/component-ids.cjs +1 -1
- package/dist/primitives/utils/component-ids.d.ts +24 -0
- package/dist/primitives/utils/component-ids.js +12 -0
- package/dist/primitives/utils/form.cjs +1 -1
- package/dist/primitives/utils/form.d.ts +1 -1
- package/dist/primitives/utils/form.js +3 -1
- package/dist/react/chat-button-modal.cjs +1 -0
- package/dist/react/chat-button-modal.d.ts +22 -0
- package/dist/react/chat-button-modal.js +41 -0
- package/dist/react/embedded-chat.cjs +1 -1
- package/dist/react/embedded-chat.js +210 -191
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +171 -169
- package/dist/styled/components/embedded-chat.cjs +1 -1
- package/dist/styled/components/embedded-chat.d.ts +16 -1
- package/dist/styled/components/embedded-chat.js +686 -568
- package/dist/styled/components/message.cjs +1 -1
- package/dist/styled/components/message.js +191 -183
- package/dist/styled/components/ui/recipes/combobox.cjs +1 -0
- package/dist/styled/components/ui/recipes/combobox.d.ts +4 -0
- package/dist/styled/components/ui/recipes/combobox.js +57 -0
- package/dist/styled/components/ui/recipes/index.cjs +1 -1
- package/dist/styled/components/ui/recipes/index.d.ts +1 -0
- package/dist/styled/components/ui/recipes/index.js +29 -27
- package/dist/styled/components/ui/recipes/modal.d.ts +1 -1
- package/dist/styled/components/ui/recipes/scrollable.d.ts +1 -1
- package/dist/styled/components/ui/recipes/select.d.ts +1 -1
- package/dist/styled/inkeep.css.cjs +182 -2
- package/dist/styled/inkeep.css.js +182 -2
- package/dist/types/config/settings/form.d.ts +9 -1
- package/package.json +6 -5
|
@@ -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"),m=require("../../primitives/components/embedded-chat.cjs"),ee=require("../../primitives/components/embedded-chat/chat-provider.cjs"),te=require("merge-anything"),C=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"),o=require("react"),O=require("./embedded-chat.cjs"),n=require("lucide-react"),R=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(t){if(!t||typeof t!="object")return!1;const r=t;return typeof r.type=="string"&&r.type.startsWith("tool-")}const ie=t=>{if(!t||typeof t!="object"||!("status"in t))return;const r=t.status;return typeof r=="string"?r:void 0},le=()=>e.jsx("div",{className:"flex space-x-1",children:[0,1,2].map(t=>e.jsx("span",{className:"animate-bounce-dot opacity-30",style:{animationDelay:`${t*.2}s`},children:"."},t))}),z=({name:t,Icon:r,props:i,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(r,{className:"w-3 h-3 text-gray-600 dark:text-white-alpha-600"}),e.jsx("span",{children:t})]}),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(i,null,2)})]}),ce=({name:t,props:r})=>e.jsx(z,{name:t,Icon:n.ComponentIcon,props:r,componentType:"component"}),de=({name:t,props:r})=>e.jsx(z,{name:t,Icon:n.Library,props:r,componentType:"artifact"}),pe=({part:t,approve:r,isDebug:i=!1})=>{const c=t.type,k=c.startsWith("tool-")?c.slice(5):c,s=t.state,x=!!t.approval?.id,y=s==="approval-requested",N=ie(t.output),[h,S]=o.useState(x||!i),P=s?ne[s]??s:"tool";o.useEffect(()=>{y&&S(!0)},[y]);const v=()=>{switch(s){case"input-streaming":return e.jsx(n.Circle,{className:"w-3 h-3"});case"input-available":return e.jsx(n.Loader2,{className:"w-3 h-3 animate-spin"});case"approval-requested":return e.jsx(n.Clock,{className:"w-3 h-3"});case"approval-responded":return e.jsx(n.CheckCircle,{className:"w-3 h-3"});case"output-available":return e.jsx(n.CheckCircle,{className:"w-3 h-3"});case"output-error":return e.jsx(n.XCircle,{className:"w-3 h-3"});case"output-denied":return e.jsx(n.XCircle,{className:"w-3 h-3"});default:return null}};return e.jsxs("div",{className:"border rounded-lg mb-3 overflow-hidden",children:[i&&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:()=>S(!h),"data-expanded":h,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(n.Hammer,{className:"w-3 h-3 text-gray-600 dark:text-white-alpha-600"}),e.jsx("span",{children:k})]})}),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:[v(),P]}),e.jsx(n.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":h,className:C.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":h,className:C.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",x?"":"data-[expanded=true]:max-h-48 data-[expanded=true]:overflow-y-auto"),children:[t.input!=null&&i&&e.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 font-mono py-2",children:JSON.stringify(t.input,null,2)}),!i&&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:k}),"."]}),y&&t.approval?.id&&e.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[e.jsx("button",{type:"button",className:C.cn(R.button({size:"xs",variant:"outline"}),"px-2 py-1 rounded-md text-xs text-gray-700 dark:text-white-alpha-700"),onClick:()=>r(!1),children:"Deny"}),e.jsxs("button",{type:"button",className:C.cn(R.button({size:"xs",variant:"primaryFilled"}),"px-2 py-1 rounded-md text-xs gap-1"),onClick:()=>r(!0),children:[e.jsx(n.Check,{className:"w-3 h-3"}),"Approve"]})]}),s==="output-available"&&t.output!=null&&!i&&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:[N==="approved"&&e.jsx(n.Check,{className:"w-3 h-3"}),N]}),s==="output-denied"&&!i&&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(n.X,{className:"w-3 h-3"}),P]}),s==="output-available"&&t.output!=null&&i&&e.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 font-mono py-2",children:typeof t.output=="string"?t.output:JSON.stringify(t.output,null,2)})]})})]})},ue=({className:t,componentStyles:r,children:i,isLast:c,...k})=>{const{message:s}=Z.useMessage(),{logEvent:g}=Q.useBaseEvents(),{conversationId:x,isStreaming:y,isLoading:N,setError:h,addToolApprovalResponse:S,sendMessage:P}=ee.useChat(),{aiChatSettings:{components:v,artifacts:J,headers:X}}=Y.useInkeepConfig(),M=X?.["x-emit-operations"]==="true",B=s.role==="user",F=(y||N)&&c&&s.role==="assistant",{processedParts:G,summaryTimings:K,shouldShowInitialLoading:U,shouldShowStreamDelayLoading:W}=se.useStreamProcessor(s.parts,F,h),[w,I]=o.useState(null),[H,D]=o.useState(!1),d=o.useRef(null);o.useEffect(()=>{if(!w){D(!1),d.current&&(clearTimeout(d.current),d.current=null);return}return D(!1),d.current&&clearTimeout(d.current),d.current=window.setTimeout(()=>{D(!0)},1e3),()=>{d.current&&(clearTimeout(d.current),d.current=null)}},[w]),o.useEffect(()=>{w&&(!c||s.parts.length>w.partCount)&&I(null)},[w,c,s.parts.length]);const A=o.useMemo(()=>s.parts.filter(a=>a.type==="data-artifact"&&a.data?.type?.toLowerCase()==="citation"),[s.parts]),L=o.useMemo(()=>te.merge(ae.markdownStyles,r??{}),[r]),_=o.useCallback((a,l)=>{g({eventName:"assistant_message_inline_link_opened",properties:{title:l?.toString(),url:a}})},[g]),$=o.useCallback((a,l)=>{g({eventName:"assistant_code_block_copied",properties:{conversationId:x,language:a,code:l}})},[g,x]),q=o.useCallback(a=>e.jsx(m.EmbeddedChatPrimitiveMarkdown,{text:a,componentStyles:L,onLinkClick:_,onCodeCopy:$,artifacts:A}),[L,_,$,A]),V=o.useMemo(()=>C.cn("data-[role=user]:whitespace-pre-wrap mb-3 data-[role=user]:mb-0 [&[data-role=user]>p]:mb-0 max-w-full",t),[t]);return e.jsxs(e.Fragment,{children:[G.map((a,l)=>{const f={"data-role":s.role,"data-type":a?.type==="data-component"?a.data.type:a?.type,...k,className:V};switch(a?.type){case"text":return e.jsx(m.PrimitiveMessagePart,{...f,children:B?a.text:q(a.text||"")},l);case"data-component":{const{type:p}=a.data;switch(p){case"text":return e.jsx("div",{...f,children:q(a.data.text||"")},l);default:{const T=a.data,{name:u,props:b}=T,j=v?.[u],E=j?m.EmbeddedChatPrimitiveDynamicComponent:ce;return e.jsx(m.PrimitiveMessagePart,{...f,children:e.jsx(E,{name:u,props:b,componentDef:j})},`${u}-${l}`)}}}case"data-artifact":{const p=a.data,{name:T,type:u,artifactSummary:b}=p,j=J?.[u],E=j?m.EmbeddedChatPrimitiveDynamicComponent:de;return e.jsx(m.PrimitiveMessagePart,{...f,children:e.jsx(E,{name:u,props:b,componentDef:j})},`${T}-${l}`)}case"summary-group":{const p=K.get(a.groupKey)||{isCompleted:!1};return e.jsx(m.PrimitiveMessagePart,{...f,children:e.jsx(re.DataSummaryGroup,{summaries:a.summaries||[],isCompleted:p.isCompleted})},`${a.groupKey}-${l}`)}default:if(oe(a)){const p=a.approval?.id;if(!(M||p))return null;const u=async(b=!0)=>{p&&(I({partCount:s.parts.length}),S({id:p,approved:b}),await P(void 0,{body:{conversationId:x}}))};return e.jsx(m.PrimitiveMessagePart,{...f,children:v?.IkpTool?e.jsx(O.DynamicComponent,{name:"IkpTool",props:{tool:a,approve:u,renderMarkdown:q},componentDef:v.IkpTool}):e.jsx(pe,{part:a,approve:u,isDebug:M})},a.toolCallId??`${a.type}-${l}`)}return null}}),U&&e.jsx(O.MessageLoading,{}),(W||H)&&e.jsx(le,{})]})};exports.EmbeddedChatMessagePart=ue;
|
|
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,20 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as e, jsxs 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
|
|
9
|
-
import { cn as
|
|
2
|
+
import { jsx as e, jsxs as i, Fragment as ne } from "react/jsx-runtime";
|
|
3
|
+
import { useBaseEvents as oe } from "../../primitives/providers/base-events-provider.js";
|
|
4
|
+
import { useInkeepConfig as se } from "../../primitives/providers/config-provider.js";
|
|
5
|
+
import { useMessage as ie } from "../../primitives/providers/message-provider.js";
|
|
6
|
+
import { EmbeddedChatPrimitiveMarkdown as le, PrimitiveMessagePart as S } from "../../primitives/components/embedded-chat.js";
|
|
7
|
+
import { useChat as pe } from "../../primitives/components/embedded-chat/chat-provider.js";
|
|
8
|
+
import { merge as ce } from "merge-anything";
|
|
9
|
+
import { cn as T } from "../utils.js";
|
|
10
10
|
import { markdownStyles as de } from "./ui/markdown-styles.js";
|
|
11
|
-
import { useStreamProcessor as
|
|
11
|
+
import { useStreamProcessor as ue } from "../../primitives/components/embedded-chat/use-stream-processor.js";
|
|
12
12
|
import { DataSummaryGroup as me } from "./data-summary-group.js";
|
|
13
|
-
import { useState as
|
|
14
|
-
import { DynamicComponent as
|
|
15
|
-
import {
|
|
16
|
-
import { button as
|
|
17
|
-
const
|
|
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 he } from "./embedded-chat.js";
|
|
15
|
+
import { Library as fe, ComponentIcon as ge, Hammer as xe, ChevronDown as ye, Check as F, X as we, XCircle as K, CheckCircle as U, Clock as ve, Loader2 as be, Circle as Ce } from "lucide-react";
|
|
16
|
+
import { button as W } from "./ui/recipes/button.js";
|
|
17
|
+
const ke = {
|
|
18
18
|
"input-streaming": "Pending",
|
|
19
19
|
"input-available": "Running",
|
|
20
20
|
"approval-requested": "Awaiting Approval",
|
|
@@ -23,76 +23,100 @@ const Ne = {
|
|
|
23
23
|
"output-error": "Error",
|
|
24
24
|
"output-denied": "Denied"
|
|
25
25
|
};
|
|
26
|
-
function
|
|
27
|
-
if (!
|
|
28
|
-
const
|
|
29
|
-
return typeof
|
|
26
|
+
function Ne(a) {
|
|
27
|
+
if (!a || typeof a != "object") return !1;
|
|
28
|
+
const r = a;
|
|
29
|
+
return typeof r.type == "string" && r.type.startsWith("tool-");
|
|
30
30
|
}
|
|
31
|
-
const
|
|
32
|
-
if (!
|
|
33
|
-
const
|
|
34
|
-
return typeof
|
|
35
|
-
}, Te = () => /* @__PURE__ */ e("div", { className: "flex space-x-1", children: [0, 1, 2].map((
|
|
31
|
+
const Se = (a) => {
|
|
32
|
+
if (!a || typeof a != "object" || !("status" in a)) return;
|
|
33
|
+
const r = a.status;
|
|
34
|
+
return typeof r == "string" ? r : void 0;
|
|
35
|
+
}, Te = () => /* @__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",
|
|
39
39
|
style: {
|
|
40
|
-
animationDelay: `${
|
|
40
|
+
animationDelay: `${a * 0.2}s`
|
|
41
41
|
},
|
|
42
42
|
children: "."
|
|
43
43
|
},
|
|
44
|
-
|
|
45
|
-
)) }),
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
/* @__PURE__ */ e(
|
|
49
|
-
/* @__PURE__ */ e("span", { children:
|
|
44
|
+
a
|
|
45
|
+
)) }), X = ({ 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
|
+
/* @__PURE__ */ i("div", { className: "flex justify-between px-4 py-2 text-xs", children: [
|
|
47
|
+
/* @__PURE__ */ i("div", { className: "font-medium flex items-center gap-2", children: [
|
|
48
|
+
/* @__PURE__ */ e(r, { className: "w-3 h-3 text-gray-600 dark:text-white-alpha-600" }),
|
|
49
|
+
/* @__PURE__ */ e("span", { children: a })
|
|
50
50
|
] }),
|
|
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
|
-
/* @__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(
|
|
54
|
-
] }),
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
+
] }), De = ({ name: a, props: r }) => /* @__PURE__ */ e(X, { name: a, Icon: ge, props: r, componentType: "component" }), Le = ({ name: a, props: r }) => /* @__PURE__ */ e(X, { name: a, Icon: fe, props: r, componentType: "artifact" }), Pe = ({
|
|
55
|
+
tool: a,
|
|
56
|
+
componentDef: r,
|
|
57
|
+
renderText: n,
|
|
58
|
+
approvalId: l,
|
|
59
|
+
messagePartsLength: h,
|
|
60
|
+
setApprovalDelayPending: s,
|
|
61
|
+
addToolApprovalResponse: o,
|
|
62
|
+
sendMessage: c,
|
|
63
|
+
conversationId: d
|
|
64
|
+
}) => {
|
|
65
|
+
const f = D(c);
|
|
66
|
+
f.current = c;
|
|
67
|
+
const g = D(o);
|
|
68
|
+
g.current = o;
|
|
69
|
+
const u = D(s);
|
|
70
|
+
u.current = s;
|
|
71
|
+
const v = P(
|
|
72
|
+
async (A = !0) => {
|
|
73
|
+
l && (u.current({ partCount: h }), g.current({ id: l, approved: A }), await f.current(void 0, { body: { conversationId: d } }));
|
|
74
|
+
},
|
|
75
|
+
[l, h, d]
|
|
76
|
+
), x = L(() => ({ tool: a, approve: v, renderMarkdown: n }), [a]);
|
|
77
|
+
return /* @__PURE__ */ e(r ? R : Ee, { name: a.type, props: x, componentDef: r });
|
|
78
|
+
}, Ee = ({ props: a, isDebug: r = !1 }) => {
|
|
79
|
+
const { tool: n, approve: l } = a, h = n.type, s = h.startsWith("tool-") ? h.slice(5) : h, o = n.state, c = n.approval?.id, d = !!c, f = o === "approval-requested", g = Se(n.output), [u, v] = j(d || r), x = o ? ke[o] ?? o : "tool";
|
|
80
|
+
return $(() => {
|
|
81
|
+
f && v(!0);
|
|
82
|
+
}, [f]), /* @__PURE__ */ i("div", { className: "border rounded-lg mb-3 overflow-hidden", children: [
|
|
83
|
+
(!d || r) && /* @__PURE__ */ i(
|
|
60
84
|
"button",
|
|
61
85
|
{
|
|
62
86
|
type: "button",
|
|
63
87
|
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",
|
|
64
|
-
onClick: () =>
|
|
88
|
+
onClick: () => v(!u),
|
|
65
89
|
"data-expanded": u,
|
|
66
90
|
children: [
|
|
67
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: /* @__PURE__ */
|
|
68
|
-
/* @__PURE__ */ e(
|
|
69
|
-
/* @__PURE__ */ e("span", { children:
|
|
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(xe, { className: "w-3 h-3 text-gray-600 dark:text-white-alpha-600" }),
|
|
93
|
+
/* @__PURE__ */ e("span", { children: s })
|
|
70
94
|
] }) }),
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
/* @__PURE__ */
|
|
95
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
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: [
|
|
73
97
|
(() => {
|
|
74
|
-
switch (
|
|
98
|
+
switch (o) {
|
|
75
99
|
case "input-streaming":
|
|
76
|
-
return /* @__PURE__ */ e(
|
|
100
|
+
return /* @__PURE__ */ e(Ce, { className: "w-3 h-3" });
|
|
77
101
|
case "input-available":
|
|
78
|
-
return /* @__PURE__ */ e(
|
|
102
|
+
return /* @__PURE__ */ e(be, { className: "w-3 h-3 animate-spin" });
|
|
79
103
|
case "approval-requested":
|
|
80
|
-
return /* @__PURE__ */ e(
|
|
104
|
+
return /* @__PURE__ */ e(ve, { className: "w-3 h-3" });
|
|
81
105
|
case "approval-responded":
|
|
82
|
-
return /* @__PURE__ */ e(
|
|
106
|
+
return /* @__PURE__ */ e(U, { className: "w-3 h-3" });
|
|
83
107
|
case "output-available":
|
|
84
|
-
return /* @__PURE__ */ e(
|
|
108
|
+
return /* @__PURE__ */ e(U, { className: "w-3 h-3" });
|
|
85
109
|
case "output-error":
|
|
86
|
-
return /* @__PURE__ */ e(
|
|
110
|
+
return /* @__PURE__ */ e(K, { className: "w-3 h-3" });
|
|
87
111
|
case "output-denied":
|
|
88
|
-
return /* @__PURE__ */ e(
|
|
112
|
+
return /* @__PURE__ */ e(K, { className: "w-3 h-3" });
|
|
89
113
|
default:
|
|
90
114
|
return null;
|
|
91
115
|
}
|
|
92
116
|
})(),
|
|
93
|
-
|
|
117
|
+
x
|
|
94
118
|
] }),
|
|
95
|
-
/* @__PURE__ */ e(
|
|
119
|
+
/* @__PURE__ */ e(ye, { 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" })
|
|
96
120
|
] })
|
|
97
121
|
]
|
|
98
122
|
}
|
|
@@ -101,7 +125,7 @@ const De = (t) => {
|
|
|
101
125
|
"div",
|
|
102
126
|
{
|
|
103
127
|
"data-expanded": u,
|
|
104
|
-
className:
|
|
128
|
+
className: T(
|
|
105
129
|
"relative",
|
|
106
130
|
'before:content-[""] before:absolute before:inset-x-0 before:-top-px before:h-3 before:pointer-events-none before:z-10',
|
|
107
131
|
'after:content-[""] after:absolute after:inset-x-0 after:bottom-0 after:h-3 after:pointer-events-none after:z-10',
|
|
@@ -109,59 +133,59 @@ const De = (t) => {
|
|
|
109
133
|
"dark:before:bg-[linear-gradient(var(--ikp-color-gray-dark-950),_transparent)] dark:after:bg-[linear-gradient(transparent,_var(--ikp-color-gray-dark-950))]",
|
|
110
134
|
"data-[expanded=false]:before:opacity-0 data-[expanded=false]:after:opacity-0"
|
|
111
135
|
),
|
|
112
|
-
children: /* @__PURE__ */
|
|
136
|
+
children: /* @__PURE__ */ i(
|
|
113
137
|
"div",
|
|
114
138
|
{
|
|
115
139
|
"data-expanded": u,
|
|
116
|
-
className:
|
|
140
|
+
className: T(
|
|
117
141
|
"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",
|
|
118
|
-
|
|
142
|
+
d ? "" : "data-[expanded=true]:max-h-48 data-[expanded=true]:overflow-y-auto"
|
|
119
143
|
),
|
|
120
144
|
children: [
|
|
121
|
-
|
|
122
|
-
!
|
|
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
|
+
!r && d && /* @__PURE__ */ i("div", { className: "whitespace-pre-wrap text-sm text-gray-700 dark:text-white-alpha-700 py-2", children: [
|
|
123
147
|
"Approval is needed to run ",
|
|
124
|
-
/* @__PURE__ */ e("strong", { children:
|
|
148
|
+
/* @__PURE__ */ e("strong", { children: s }),
|
|
125
149
|
"."
|
|
126
150
|
] }),
|
|
127
|
-
|
|
151
|
+
f && c && /* @__PURE__ */ i("div", { className: "flex justify-end gap-2 pt-1", children: [
|
|
128
152
|
/* @__PURE__ */ e(
|
|
129
153
|
"button",
|
|
130
154
|
{
|
|
131
155
|
type: "button",
|
|
132
|
-
className:
|
|
133
|
-
|
|
156
|
+
className: T(
|
|
157
|
+
W({ size: "xs", variant: "outline" }),
|
|
134
158
|
"px-2 py-1 rounded-md text-xs text-gray-700 dark:text-white-alpha-700"
|
|
135
159
|
),
|
|
136
|
-
onClick: () =>
|
|
160
|
+
onClick: () => l(!1),
|
|
137
161
|
children: "Deny"
|
|
138
162
|
}
|
|
139
163
|
),
|
|
140
|
-
/* @__PURE__ */
|
|
164
|
+
/* @__PURE__ */ i(
|
|
141
165
|
"button",
|
|
142
166
|
{
|
|
143
167
|
type: "button",
|
|
144
|
-
className:
|
|
145
|
-
|
|
168
|
+
className: T(
|
|
169
|
+
W({ size: "xs", variant: "primaryFilled" }),
|
|
146
170
|
"px-2 py-1 rounded-md text-xs gap-1"
|
|
147
171
|
),
|
|
148
|
-
onClick: () =>
|
|
172
|
+
onClick: () => l(!0),
|
|
149
173
|
children: [
|
|
150
|
-
/* @__PURE__ */ e(
|
|
174
|
+
/* @__PURE__ */ e(F, { className: "w-3 h-3" }),
|
|
151
175
|
"Approve"
|
|
152
176
|
]
|
|
153
177
|
}
|
|
154
178
|
)
|
|
155
179
|
] }),
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
180
|
+
o === "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
|
+
g === "approved" && /* @__PURE__ */ e(F, { className: "w-3 h-3" }),
|
|
182
|
+
g
|
|
159
183
|
] }),
|
|
160
|
-
|
|
161
|
-
/* @__PURE__ */ e(
|
|
162
|
-
|
|
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" }),
|
|
186
|
+
x
|
|
163
187
|
] }),
|
|
164
|
-
|
|
188
|
+
o === "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) })
|
|
165
189
|
]
|
|
166
190
|
}
|
|
167
191
|
)
|
|
@@ -169,155 +193,139 @@ const De = (t) => {
|
|
|
169
193
|
)
|
|
170
194
|
] });
|
|
171
195
|
}, We = ({
|
|
172
|
-
className:
|
|
173
|
-
componentStyles:
|
|
174
|
-
children:
|
|
196
|
+
className: a,
|
|
197
|
+
componentStyles: r,
|
|
198
|
+
children: n,
|
|
175
199
|
isLast: l,
|
|
176
|
-
...
|
|
200
|
+
...h
|
|
177
201
|
}) => {
|
|
178
|
-
const { message:
|
|
179
|
-
aiChatSettings: { components:
|
|
180
|
-
} =
|
|
181
|
-
|
|
182
|
-
if (!
|
|
183
|
-
|
|
202
|
+
const { message: s } = ie(), { logEvent: o } = oe(), { conversationId: c, isStreaming: d, isLoading: f, setError: g, addToolApprovalResponse: u, sendMessage: v } = pe(), {
|
|
203
|
+
aiChatSettings: { components: x, artifacts: E, headers: A }
|
|
204
|
+
} = se(), G = A?.["x-emit-operations"] === "true", H = s.role === "user", V = (d || f) && l && s.role === "assistant", { processedParts: Q, summaryTimings: Y, shouldShowInitialLoading: Z, shouldShowStreamDelayLoading: ee } = ue(s.parts, V, g), [k, O] = j(null), [te, _] = j(!1), m = D(null);
|
|
205
|
+
$(() => {
|
|
206
|
+
if (!k) {
|
|
207
|
+
_(!1), m.current && (clearTimeout(m.current), m.current = null);
|
|
184
208
|
return;
|
|
185
209
|
}
|
|
186
|
-
return
|
|
187
|
-
|
|
210
|
+
return _(!1), m.current && clearTimeout(m.current), m.current = window.setTimeout(() => {
|
|
211
|
+
_(!0);
|
|
188
212
|
}, 1e3), () => {
|
|
189
|
-
|
|
213
|
+
m.current && (clearTimeout(m.current), m.current = null);
|
|
190
214
|
};
|
|
191
|
-
}, [
|
|
192
|
-
|
|
193
|
-
}, [
|
|
194
|
-
const
|
|
195
|
-
() =>
|
|
196
|
-
(
|
|
215
|
+
}, [k]), $(() => {
|
|
216
|
+
k && (!l || s.parts.length > k.partCount) && O(null);
|
|
217
|
+
}, [k, l, s.parts.length]);
|
|
218
|
+
const z = L(
|
|
219
|
+
() => s.parts.filter(
|
|
220
|
+
(t) => t.type === "data-artifact" && t.data?.type?.toLowerCase() === "citation"
|
|
197
221
|
),
|
|
198
|
-
[
|
|
199
|
-
),
|
|
200
|
-
() =>
|
|
201
|
-
[
|
|
202
|
-
),
|
|
203
|
-
(
|
|
204
|
-
|
|
222
|
+
[s.parts]
|
|
223
|
+
), q = L(
|
|
224
|
+
() => ce(de, r ?? {}),
|
|
225
|
+
[r]
|
|
226
|
+
), J = P(
|
|
227
|
+
(t, p) => {
|
|
228
|
+
o({
|
|
205
229
|
eventName: "assistant_message_inline_link_opened",
|
|
206
230
|
properties: {
|
|
207
|
-
title:
|
|
208
|
-
url:
|
|
231
|
+
title: p?.toString(),
|
|
232
|
+
url: t
|
|
209
233
|
}
|
|
210
234
|
});
|
|
211
235
|
},
|
|
212
|
-
[
|
|
213
|
-
),
|
|
214
|
-
(
|
|
215
|
-
|
|
236
|
+
[o]
|
|
237
|
+
), B = P(
|
|
238
|
+
(t, p) => {
|
|
239
|
+
o({
|
|
216
240
|
eventName: "assistant_code_block_copied",
|
|
217
241
|
properties: {
|
|
218
|
-
conversationId:
|
|
219
|
-
language:
|
|
220
|
-
code:
|
|
242
|
+
conversationId: c,
|
|
243
|
+
language: t,
|
|
244
|
+
code: p
|
|
221
245
|
}
|
|
222
246
|
});
|
|
223
247
|
},
|
|
224
|
-
[
|
|
225
|
-
),
|
|
226
|
-
(
|
|
227
|
-
|
|
248
|
+
[o, c]
|
|
249
|
+
), I = P(
|
|
250
|
+
(t) => /* @__PURE__ */ e(
|
|
251
|
+
le,
|
|
228
252
|
{
|
|
229
|
-
text:
|
|
230
|
-
componentStyles:
|
|
231
|
-
onLinkClick:
|
|
232
|
-
onCodeCopy:
|
|
233
|
-
artifacts:
|
|
253
|
+
text: t,
|
|
254
|
+
componentStyles: q,
|
|
255
|
+
onLinkClick: J,
|
|
256
|
+
onCodeCopy: B,
|
|
257
|
+
artifacts: z
|
|
234
258
|
}
|
|
235
259
|
),
|
|
236
|
-
[
|
|
237
|
-
),
|
|
238
|
-
() =>
|
|
260
|
+
[q, J, B, z]
|
|
261
|
+
), ae = L(
|
|
262
|
+
() => T(
|
|
239
263
|
"data-[role=user]:whitespace-pre-wrap mb-3 data-[role=user]:mb-0 [&[data-role=user]>p]:mb-0 max-w-full",
|
|
240
|
-
|
|
264
|
+
a
|
|
241
265
|
),
|
|
242
|
-
[
|
|
266
|
+
[a]
|
|
243
267
|
);
|
|
244
|
-
return /* @__PURE__ */
|
|
245
|
-
|
|
246
|
-
const
|
|
247
|
-
"data-role":
|
|
248
|
-
"data-type":
|
|
249
|
-
...
|
|
250
|
-
className:
|
|
268
|
+
return /* @__PURE__ */ i(ne, { children: [
|
|
269
|
+
Q.map((t, p) => {
|
|
270
|
+
const b = {
|
|
271
|
+
"data-role": s.role,
|
|
272
|
+
"data-type": t?.type === "data-component" ? t.data.type : t?.type,
|
|
273
|
+
...h,
|
|
274
|
+
className: ae
|
|
251
275
|
};
|
|
252
|
-
switch (
|
|
276
|
+
switch (t?.type) {
|
|
253
277
|
case "text":
|
|
254
|
-
return /* @__PURE__ */ e(
|
|
278
|
+
return /* @__PURE__ */ e(S, { ...b, children: H ? t.text : I(t.text || "") }, p);
|
|
255
279
|
case "data-component": {
|
|
256
|
-
const { type:
|
|
257
|
-
switch (
|
|
280
|
+
const { type: y } = t.data;
|
|
281
|
+
switch (y) {
|
|
258
282
|
case "text":
|
|
259
|
-
return /* @__PURE__ */ e("div", { ...
|
|
283
|
+
return /* @__PURE__ */ e("div", { ...b, children: I(t.data.text || "") }, p);
|
|
260
284
|
default: {
|
|
261
|
-
const
|
|
262
|
-
return /* @__PURE__ */ e(
|
|
285
|
+
const C = t.data, { name: w, props: M } = C, N = x?.[w];
|
|
286
|
+
return /* @__PURE__ */ e(S, { ...b, children: /* @__PURE__ */ e(N ? R : De, { name: w, props: M, componentDef: N }) }, `${w}-${p}`);
|
|
263
287
|
}
|
|
264
288
|
}
|
|
265
289
|
}
|
|
266
290
|
case "data-artifact": {
|
|
267
|
-
const
|
|
268
|
-
return /* @__PURE__ */ e(
|
|
291
|
+
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 : Le, { name: w, props: M, componentDef: N }) }, `${C}-${p}`);
|
|
269
293
|
}
|
|
270
294
|
case "summary-group": {
|
|
271
|
-
const
|
|
295
|
+
const y = Y.get(t.groupKey) || {
|
|
272
296
|
isCompleted: !1
|
|
273
297
|
};
|
|
274
|
-
return /* @__PURE__ */ e(
|
|
298
|
+
return /* @__PURE__ */ e(S, { ...b, children: /* @__PURE__ */ e(
|
|
275
299
|
me,
|
|
276
300
|
{
|
|
277
|
-
summaries:
|
|
278
|
-
isCompleted:
|
|
301
|
+
summaries: t.summaries || [],
|
|
302
|
+
isCompleted: y.isCompleted
|
|
279
303
|
}
|
|
280
|
-
) }, `${
|
|
304
|
+
) }, `${t.groupKey}-${p}`);
|
|
305
|
+
}
|
|
306
|
+
default: {
|
|
307
|
+
if (!Ne(t))
|
|
308
|
+
return null;
|
|
309
|
+
const y = t, C = t.approval?.id;
|
|
310
|
+
return G || C ? /* @__PURE__ */ e(S, { ...b, children: /* @__PURE__ */ e(
|
|
311
|
+
Pe,
|
|
312
|
+
{
|
|
313
|
+
tool: y,
|
|
314
|
+
componentDef: x?.IkpTool,
|
|
315
|
+
renderText: I,
|
|
316
|
+
approvalId: C,
|
|
317
|
+
messagePartsLength: s.parts.length,
|
|
318
|
+
setApprovalDelayPending: O,
|
|
319
|
+
addToolApprovalResponse: u,
|
|
320
|
+
sendMessage: v,
|
|
321
|
+
conversationId: c
|
|
322
|
+
}
|
|
323
|
+
) }, t.toolCallId ?? `${t.type}-${p}`) : null;
|
|
281
324
|
}
|
|
282
|
-
default:
|
|
283
|
-
if (Se(a)) {
|
|
284
|
-
const d = a.approval?.id;
|
|
285
|
-
if (!(M || d)) return null;
|
|
286
|
-
const c = async (y = !0) => {
|
|
287
|
-
d && (j({ partCount: r.parts.length }), N({ id: d, approved: y }), await S(void 0, {
|
|
288
|
-
body: {
|
|
289
|
-
conversationId: m
|
|
290
|
-
}
|
|
291
|
-
}));
|
|
292
|
-
};
|
|
293
|
-
return /* @__PURE__ */ e(
|
|
294
|
-
v,
|
|
295
|
-
{
|
|
296
|
-
...h,
|
|
297
|
-
children: D?.IkpTool ? /* @__PURE__ */ e(
|
|
298
|
-
he,
|
|
299
|
-
{
|
|
300
|
-
name: "IkpTool",
|
|
301
|
-
props: { tool: a, approve: c, renderMarkdown: E },
|
|
302
|
-
componentDef: D.IkpTool
|
|
303
|
-
}
|
|
304
|
-
) : /* @__PURE__ */ e(
|
|
305
|
-
Le,
|
|
306
|
-
{
|
|
307
|
-
part: a,
|
|
308
|
-
approve: c,
|
|
309
|
-
isDebug: M
|
|
310
|
-
}
|
|
311
|
-
)
|
|
312
|
-
},
|
|
313
|
-
a.toolCallId ?? `${a.type}-${i}`
|
|
314
|
-
);
|
|
315
|
-
}
|
|
316
|
-
return null;
|
|
317
325
|
}
|
|
318
326
|
}),
|
|
319
|
-
|
|
320
|
-
(
|
|
327
|
+
Z && /* @__PURE__ */ e(he, {}),
|
|
328
|
+
(ee || te) && /* @__PURE__ */ e(Te, {})
|
|
321
329
|
] });
|
|
322
330
|
};
|
|
323
331
|
export {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("class-variance-authority"),t=require("./input.cjs"),r=a.cva("",{variants:{slot:{control:[t.input({size:"md",variant:"outline"}),"!h-auto min-h-9 py-1 px-3 flex flex-wrap items-center gap-1.5 rounded-md","data-[invalid]:border-[--error-border-color] data-[invalid]:shadow-[0_0_0_1px_var(--error-border-color)]"],input:["min-w-0 flex-1 border-0 bg-transparent outline-none","placeholder:text-gray-500 dark:placeholder:text-gray-dark-500","data-[invalid]:placeholder-opacity-80"],trigger:["flex items-center justify-center shrink-0 h-full","opacity-45 text-md","data-[disabled]:opacity-30 data-[disabled]:pointer-events-none"],selectedTags:["flex flex-row flex-wrap items-center gap-1.5 min-h-0 min-w-0","flex-grow-0 flex-shrink","[&_[data-part=tag]]:inline-flex [&_[data-part=tag]]:gap-1 [&_[data-part=tag]]:flex-shrink-0 [&_[data-part=tag]]:items-center [&_[data-part=tag]]:rounded-md [&_[data-part=tag]]:whitespace-nowrap","[&_[data-part=tag]]:bg-gray-100 [&_[data-part=tag]]:dark:bg-gray-dark-800 [&_[data-part=tag]]:text-gray-800 [&_[data-part=tag]]:dark:text-gray-dark-50","[&_[data-part=tag]]:text-sm [&_[data-part=tag]]:py-0.5 [&_[data-part=tag]]:pl-2 [&_[data-part=tag]]:pr-1","[&_[data-part=tag-clear]]:flex [&_[data-part=tag-clear]]:items-center [&_[data-part=tag-clear]]:justify-center [&_[data-part=tag-clear]]:w-5 [&_[data-part=tag-clear]]:h-5 [&_[data-part=tag-clear]]:rounded-md [&_[data-part=tag-clear]]:shrink-0","[&_[data-part=tag-clear]:hover]:bg-gray-200 [&_[data-part=tag-clear]:hover]:dark:bg-gray-dark-600 [&_[data-part=tag-clear]]:text-current [&_[data-part=tag-clear]]:cursor-pointer [&_[data-part=tag-clear]]:outline-none"],content:["relative p-1 z-dropdown min-w-[var(--reference-width,8rem)] max-h-[min(24rem,var(--available-height))]","overflow-auto rounded-md border","[scrollbar-width:thin] [--scrollbar-color:var(--color-gray-300)]","dark:[--scrollbar-color:var(--color-gray-dark-600)]","[scrollbar-color:var(--scrollbar-color)_transparent]","bg-white dark:bg-gray-dark-950 shadow-md","data-[state=open]:animate-fade-in data-[state=closed]:animate-fade-out"],list:[""],item:["hover:bg-gray-100 dark:hover:bg-gray-dark-800","data-[highlighted]:bg-gray-100 dark:data-[highlighted]:bg-gray-dark-800","relative flex w-full text-sm cursor-pointer py-1.5","select-none outline-none pl-2 pr-8 rounded-md items-center","data-[disabled]:pointer-events-none data-[disabled]:opacity-50","data-[state=checked]:font-medium"],itemText:["flex-1 truncate"],itemIndicator:["absolute right-2 flex h-3.5 w-3.5","items-center justify-center"],emptyMessage:["py-2 px-3 text-center text-sm opacity-70 "]}}});exports.combobox=r;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ClassProp } from 'class-variance-authority/types';
|
|
2
|
+
export declare const combobox: (props?: ({
|
|
3
|
+
slot?: "control" | "input" | "trigger" | "selectedTags" | "content" | "list" | "item" | "itemText" | "itemIndicator" | "emptyMessage" | null | undefined;
|
|
4
|
+
} & ClassProp) | undefined) => string;
|