@flexkit/studio 0.2.7 → 0.2.8
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/{chat-page-6IXM63AU.js → chat-page-4JZO2U2C.js} +3 -3
- package/dist/{chat-page-6IXM63AU.js.map → chat-page-4JZO2U2C.js.map} +1 -1
- package/dist/{chunk-F47EIXR2.js → chunk-63ASZMJB.js} +2 -2
- package/dist/{chunk-F47EIXR2.js.map → chunk-63ASZMJB.js.map} +1 -1
- package/dist/{chunk-E7B5FQKW.js → chunk-67GNQ5TV.js} +3 -3
- package/dist/{chunk-E7B5FQKW.js.map → chunk-67GNQ5TV.js.map} +1 -1
- package/dist/{chunk-HFL6QZIF.js → chunk-7B7JMFE7.js} +3 -3
- package/dist/{chunk-HFL6QZIF.js.map → chunk-7B7JMFE7.js.map} +1 -1
- package/dist/{chunk-FEOT7BNI.js → chunk-BWEUIULK.js} +3 -3
- package/dist/{chunk-FEOT7BNI.js.map → chunk-BWEUIULK.js.map} +1 -1
- package/dist/{chunk-RGTJVPNH.js → chunk-HAIVQ77X.js} +2 -2
- package/dist/{chunk-RGTJVPNH.js.map → chunk-HAIVQ77X.js.map} +1 -1
- package/dist/{chunk-Y4Z3P43B.js → chunk-KA2REDVO.js} +2 -2
- package/dist/{chunk-Y4Z3P43B.js.map → chunk-KA2REDVO.js.map} +1 -1
- package/dist/{chunk-QNGDJNWD.js → chunk-KK6IQSGF.js} +3 -3
- package/dist/{chunk-QNGDJNWD.js.map → chunk-KK6IQSGF.js.map} +1 -1
- package/dist/{chunk-4JWGLBGC.js → chunk-R7QIILS7.js} +2 -2
- package/dist/{chunk-4JWGLBGC.js.map → chunk-R7QIILS7.js.map} +1 -1
- package/dist/index.css +9 -0
- package/dist/index.d.ts +27 -1
- package/dist/index.js +1 -1
- package/dist/{list-GLA2XRW2.js → list-B4YH5CNC.js} +2 -2
- package/dist/{list-GLA2XRW2.js.map → list-B4YH5CNC.js.map} +1 -1
- package/dist/pages-DQLN4ACM.js +5 -0
- package/dist/pages-DQLN4ACM.js.map +1 -0
- package/dist/{plugin-pages-5TS6D4IH.js → plugin-pages-DRR2V2OU.js} +2 -2
- package/dist/{plugin-pages-5TS6D4IH.js.map → plugin-pages-DRR2V2OU.js.map} +1 -1
- package/dist/{root-GMEW7KHI.js → root-LE5OW3PB.js} +3 -3
- package/dist/{root-GMEW7KHI.js.map → root-LE5OW3PB.js.map} +1 -1
- package/dist/{root-6W74NN2R.js → root-LMIJCVGZ.js} +2 -2
- package/dist/{root-6W74NN2R.js.map → root-LMIJCVGZ.js.map} +1 -1
- package/dist/{root-O3WHSEVY.js → root-VEYLQJ37.js} +2 -2
- package/dist/{root-O3WHSEVY.js.map → root-VEYLQJ37.js.map} +1 -1
- package/dist/{root-TNGHMQHM.js → root-Z76GXKNS.js} +3 -3
- package/dist/{root-TNGHMQHM.js.map → root-Z76GXKNS.js.map} +1 -1
- package/dist/{search-ZBGHTWVD.js → search-IQC355XO.js} +2 -2
- package/dist/{search-ZBGHTWVD.js.map → search-IQC355XO.js.map} +1 -1
- package/dist/{skills-pages-UXHYS3YQ.js → skills-pages-3SCCUG2K.js} +2 -2
- package/dist/{skills-pages-UXHYS3YQ.js.map → skills-pages-3SCCUG2K.js.map} +1 -1
- package/package.json +5 -5
- package/dist/pages-PUJH4BYG.js +0 -3
- package/dist/pages-PUJH4BYG.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import'./index.css';import {a}from'./chunk-
|
|
1
|
+
import'./index.css';import {a}from'./chunk-KA2REDVO.js';import {f as f$2,b,c,g as g$1,a as a$1,e as e$1,d}from'./chunk-CSUHZFEP.js';import {t,w,s,D,m,k,j,l,n,u,q,r,o,e as e$2,C,z,x,g as g$2,h,f as f$3,v as v$1,B,E,A,p}from'./chunk-KK6IQSGF.js';import {g,f as f$1,a as a$3}from'./chunk-JK3IOLJZ.js';import {f}from'./chunk-67GNQ5TV.js';import'./chunk-TYDYAOQ7.js';import {Pb,N,Nb,_a,$a,bb,Vb,Yb,Wb,Xb,Zb,_b,ac,bc,cc,Tb,fc,gc,jc,hc,ic,Ic,ec}from'./chunk-YCCFUGWJ.js';import {v}from'./chunk-32ZU4MLE.js';import'./chunk-HDOIOXMP.js';import'./chunk-SZEGGBOC.js';import'./chunk-U45E5X3H.js';import {b as b$1,c as c$1,e}from'./chunk-USNXQOMJ.js';import {b as b$2}from'./chunk-6NRQMG26.js';import {a as a$2}from'./chunk-O2QMYUPS.js';import {useRef,useMemo,useState,useEffect,useLayoutEffect}from'react';import {LoaderCircle,CornerDownRightIcon,CheckIcon,CopyIcon,PencilIcon}from'lucide-react';import {useParams,useNavigate}from'react-router-dom';import ue,{useSWRConfig}from'swr';import {jsx,jsxs}from'react/jsx-runtime';function Et(e,t){let r=Date.parse(e.createdAt)-Date.parse(t.createdAt);return Number.isFinite(r)&&r!==0?r:e.createdAt!==t.createdAt?e.createdAt<t.createdAt?-1:1:e.id===t.id?0:e.id<t.id?-1:1}function se(e){return [...new Map(e.map(r=>[r.id,r])).values()].sort(Et)}function Ae(e,t){if(!t)return e;if(!e)return t;let r=new Set(t.messages.map(f=>f.id)),a=t.messages[t.messages.length-1],s=e.messages.filter(f=>!r.has(f.id)&&(!a||Et(f,a)>0));return s.length===0?t:{...t,messages:se([...t.messages,...s])}}var Yt="flexkit:agent:draft:";function Dt(){return typeof localStorage>"u"?null:localStorage}function Rt(e,t){return `${Yt}${e}:${t??"new"}`}function Nt(e,t=Dt()){try{return t?.getItem(e)??""}catch{return ""}}function _t(e,t,r=Dt()){try{t.trim().length===0?r?.removeItem(e):r?.setItem(e,t);}catch{}}function Vt(e){return e==="pending"||e==="streaming"||e==="awaiting_approval"}function Lt(e){return e==="queued"||e==="steering"}function ke(e){for(let t=e.length-1;t>=0;t--){let r=e[t];if(r.role==="assistant"){if(!Vt(r.status))break;return {after:e.slice(t+1),before:e.slice(0,t),live:r}}}return {after:[],before:e,live:null}}function Ut(e){return e==="steering"?"Picked up at the next step":e==="queued"?"Sends when this turn ends":null}function Ft(e){let t=new Set;for(let r of e)if(!(r.role!=="assistant"||!Array.isArray(r.parts)))for(let a of r.parts){let s=a.type==="data-mid-turn-message"?a.data?.messageId:null;typeof s=="string"&&t.add(s);}return t}function Ce(e){return e.find(t=>t.role==="user"&&t.status==="queued"&&t.kind!=="monitor_event")??null}function Kt(e){return e.streaming&&!e.hasDraft?"stop":"send"}var ln=6e4,Ht=15e3;function un(e){if(!e)return 0;if(ke(e.messages).live||Ce(e.messages))return u;if(!e.messages.some(a=>a.role==="assistant"&&a.status==="complete"))return (e.monitors?.length??0)>0?Ht:0;let r=new Date(e.chat.lastMessageAt??e.chat.updatedAt).getTime();return Date.now()-r<ln?u:(e.monitors?.length??0)>0?Ht:0}function dn(e,t,r){return {chat:{createdAt:r,id:e,lastMessageAt:r,modelId:t,title:null,updatedAt:r},messages:[],pendingApproval:null}}function Ot(e,t,r,a,s,f){return e||(t?{chat:t,messages:[],pendingApproval:null}:r||dn(a,s,f))}function Bt(e,t){let r=new Set([t.userMessage.id,t.assistantMessage.id]);return {...e,messages:se([...e.messages.filter(a=>!r.has(a.id)),t.userMessage,t.assistantMessage])}}function fn(e,t){return {...e,messages:se([...e.messages.filter(r=>r.id!==t.id),t])}}function cn(e,t,r){return t?Ae(e[t],r):r}function gn(e){return e==="awaiting_approval"?"awaiting_approval":e==="complete"?"success":e==="failed"?"failed":"running"}function Ne({attachments:e$1=[],label:t,text:r}){let{textInput:a}=Nb(),[s,f]=useState(false),u=r.trim().length>0;async function v(){await navigator.clipboard.writeText(r),f(true),setTimeout(()=>f(false),1500);}return jsxs("div",{className:"fk:group fk:ml-auto fk:flex fk:w-fit fk:max-w-[70%] fk:flex-col fk:items-end fk:gap-1",children:[jsx(p,{attachments:e$1}),u?jsx("div",{className:"fk:whitespace-pre-wrap fk:rounded-xl fk:bg-muted fk:dark:bg-white/20 fk:px-3.5 fk:py-2 fk:text-base fk:corner-squircle",children:r}):null,t?jsxs("span",{className:"fk:inline-flex fk:items-center fk:gap-1 fk:text-xs fk:text-muted-foreground",children:[jsx(CornerDownRightIcon,{className:"fk:size-3 fk:shrink-0"}),t]}):null,jsxs("div",{className:u?"fk:flex fk:gap-0.5 fk:opacity-0 fk:transition-opacity fk:group-hover:opacity-100":"fk:hidden",children:[jsxs(b$1,{children:[jsx(c$1,{asChild:true,children:jsx(b$2,{"aria-label":"Copy prompt",className:"fk:size-6 fk:text-muted-foreground",size:"icon",variant:"ghost",onClick:()=>{v();},children:s?jsx(CheckIcon,{className:"fk:size-3.5"}):jsx(CopyIcon,{className:"fk:size-3.5"})})}),jsx(e,{children:"Copy"})]}),jsxs(b$1,{children:[jsx(c$1,{asChild:true,children:jsx(b$2,{"aria-label":"Edit prompt",className:"fk:size-6 fk:text-muted-foreground",size:"icon",variant:"ghost",onClick:()=>a.setInput(r),children:jsx(PencilIcon,{className:"fk:size-3.5"})})}),jsx(e,{children:"Edit"})]})]})]})}function Gt(e){let r=e.find(a=>a.type==="data-suggested-prompt")?.data?.prompt;return typeof r=="string"&&r.trim()?r:null}function zt({prompt:e}){let{textInput:t}=Nb();return jsx("div",{className:"fk:flex fk:justify-start",children:jsxs("button",{className:"fk:inline-flex fk:max-w-full fk:items-center fk:gap-1.5 fk:rounded-full fk:border fk:border-border/70 fk:bg-muted/40 fk:px-3 fk:py-1.5 fk:text-left fk:text-sm fk:text-muted-foreground fk:transition-colors fk:hover:border-border fk:hover:bg-muted fk:hover:ext-foreground fk:corner-squircle",title:"Use as your next message",type:"button",onClick:()=>t.setInput(e),children:[jsx(CornerDownRightIcon,{className:"fk:size-3 fk:shrink-0"}),jsx("span",{className:"fk:truncate",children:e})]})})}function pn({api:e,part:t,partIndex:r,parts:a}){return t.type.startsWith("tool-")?t.state==="output-error"?jsx(C,{message:t.errorText??"The tool call failed."}):null:jsx(B,{api:e,part:t,partIndex:r,parts:a})}function jt({api:e,message:t,showSuggestion:r$1=false}){if(t.kind==="monitor_event"){let u=q(t);return u?jsx(r,{data:u,error:t.error}):null}if(t.role==="user")return jsx(Ne,{attachments:o(t.parts),label:Ut(t.status),text:t.textContent});let a=(Array.isArray(t.parts)?t.parts:[]).filter(u=>!e$2(u)&&!(u.type.startsWith("tool-")&&u.state!=="output-error")),s=a.some(u=>u.type==="data-turn-error"),f=r$1&&!t.error?Gt(a):null;return a.length===0&&!t.error?null:jsxs("div",{className:"fk:w-full fk:min-w-0 fk:space-y-8",children:[a.map((u,v)=>jsx(pn,{api:e,part:u,partIndex:v,parts:a},u.toolCallId??`${t.id}-${v.toString()}`)),t.error&&!s?jsx(C,{message:t.error}):null,f?jsx(zt,{prompt:f}):null]})}function mn({api:e,chatId:t,detail:r,message:a,onMidTurnDelivered:s,onStatusChange:f,onTurnUpdated:u}){let v=gn(a.status),S=a.workflowRunId?e.getAgentChatStreamUrl(t,a.workflowRunId):"",[j,L]=useState(0),[p,M]=useState(false),[A$1,I]=useState({}),x$1=useRef(null),{message:k,status:m}=z(S,{decidedApprovals:A$1,recordStatus:v,resumeToken:j,suppressApprovalPause:p}),U=useMemo(()=>k?[{...k,parts:k.parts.filter(g=>!e$2(g))}]:[],[k]),b=x(U),$=useRef(u);$.current=u;let X=useRef(f);X.current=f;let H=useMemo(()=>({onApprovalDecided:(g,J)=>{g&&J&&J!=="pending"&&I(B=>({...B,[g]:J})),!(g&&x$1.current===g)&&(g&&(x$1.current=g),M(true),L(B=>B+1),$.current());}}),[]);useEffect(()=>{L(0),M(false),x$1.current=null,I({});},[a.id]),useEffect(()=>{p&&a.status==="streaming"&&M(false);},[a.status,p]),useEffect(()=>{(m==="finished"||m==="paused")&&$.current();},[m]);let d=(k?.parts??[]).filter(g=>g.type==="data-mid-turn-message").map(g=>String(g.data?.messageId??"")).join(`
|
|
2
2
|
`),i=useRef(s);i.current=s,useEffect(()=>{d&&i.current(d.split(`
|
|
3
|
-
`));},[d]);let E$1=!p&&a.status!=="streaming"&&(a.status==="awaiting_approval"||m==="paused"||g$2(k)),N=useMemo(()=>new Set(h(k)),[k]),_=r.pendingApproval&&!N.has(r.pendingApproval.id)?r.pendingApproval:null,Q=k?.parts[k.parts.length-1],de=Q?.type==="text"&&Q.state==="streaming",O=E$1?"Awaiting approval":f$3(k)??"Thinking",F=E$1?m!=="finished"&&m!=="error":m==="streaming"&&!de;useEffect(()=>{X.current({label:O,visible:F});},[O,F]);let D=!!_&&E$1,z$1=m==="finished"?Gt(b.flatMap(g=>g.parts)):null;return b.length===0&&!D?jsx(v$1.Provider,{value:H,children:null}):jsx(v$1.Provider,{value:H,children:jsxs("div",{className:"fk:w-full fk:min-w-0 fk:space-y-8",children:[b.map(g=>jsx("div",{className:"fk:space-y-8 fk:min-w-0",children:g.parts.map((J,B$1)=>jsx(B,{api:e,part:J,partIndex:B$1,parts:g.parts},B$1))},g.id)),_&&D?jsx(E,{api:e,message:A(_)}):null,z$1?jsx(zt,{prompt:z$1}):null]})})}function hn({draftKey:e}){let{textInput:t}=Nb(),{setInput:r,value:a}=t,s=useRef(null);return useLayoutEffect(()=>{if(s.current===e){_t(e,a);return}s.current=e;let f=Nt(e);f!==a&&r(f);},[e,r,a]),null}function An({api:e,effort:t,modelKey:r,modelPending:a,models:s,onEffortChange:f,onError:u,onModelChange:v,onSend:S,onStop:j$1,placeholder:L,sending:p,streaming:M}){let{attachments:A,textInput:I}=Nb(),x=m(e,u),k$1=useRef(false),m$1=s.filter(i=>!i.deprecated||b(i)===r),U=c(s,r),b$1=e$1(U),$=d(U,t),X=I.value.trim().length>0||A.files.length>0,H=Kt({hasDraft:X,streaming:M}),d$1=X&&!x.isUploading&&!p&&!a;return jsxs(Vb,{accept:l,className:"fk:mx-auto fk:max-w-4xl",maxFileSize:j,maxFiles:k,multiple:true,onError:i=>u(i.message),onSubmit:({text:i})=>{let E=i?.trim()??"",N=x.getUploaded(A.files.map(_=>_.id));return !E&&N.length===0||x.isUploading||p||k$1.current||a?Promise.reject(new Error("The message cannot be sent right now.")):(k$1.current=true,I.clear(),S(E,N).catch(_=>{throw I.setInput(i),_}).finally(()=>{k$1.current=false;}))},children:[A.files.length>0?jsx(Yb,{children:jsx(n,{uploads:x})}):null,jsx(Wb,{children:jsx(Xb,{disabled:p,placeholder:L})}),jsxs(Zb,{children:[jsxs(_b,{children:[jsxs(ac,{children:[jsx(bc,{"aria-label":"Add attachments",className:"fk:border-0 fk:bg-border fk:corner-round",disabled:p,tooltip:"Add photos or files"}),jsx(cc,{children:jsx(Tb,{})})]}),m$1.length>0?jsxs(fc,{value:r??void 0,onValueChange:v,children:[jsx(gc,{"aria-label":"Model",className:"fk:min-w-44",children:jsx(jc,{placeholder:"Model"})}),jsx(hc,{children:m$1.map(i=>jsx(ic,{value:b(i),children:i.name},b(i)))})]}):null,b$1.length>1&&$?jsxs(fc,{value:$,onValueChange:f,children:[jsx(gc,{"aria-label":"Reasoning effort",className:"fk:min-w-28",children:jsx(jc,{placeholder:"Effort"})}),jsx(hc,{children:b$1.map(i=>jsx(ic,{value:i.value,children:i.label},i.value))})]}):null]}),jsxs("div",{className:"fk:flex fk:items-center fk:gap-3",children:[jsx(Ic,{disabled:p,onAudioRecorded:async(i,E)=>{let{text:N}=await e.transcribeAgentAudio(i,E);return N},onError:i=>u(i.message),onTranscriptionChange:i=>{u(null),I.setInput(a$3(I.value,i));}}),jsx(ec,{className:"fk:corner-round",disabled:H==="stop"?false:!d$1,status:H==="stop"?"streaming":void 0,onStop:()=>{j$1();}})]})]})]})}var Re={chatId:null,error:null,loading:false,older:[],page:null},kn=3e3;function Cn({api:e,chatId:t,projectId:r,pendingFollowUp:a,pendingMessage:s,resolveDetail:f}){let{data:u,mutate:v}=ue(t?g(r).agentChat(t):null,f$1,{refreshInterval:0}),S=f(u),[j,L]=useState(Re),p=j.chatId===t?j:Re,M=useRef(t);M.current=t;let A=(o,C)=>L(y=>{if(y.chatId!==o&&M.current!==o)return y;let h=y.chatId===o?y:{...Re,chatId:o};return {...h,...C(h)}}),I=useRef({chatId:null,messages:[]}),x=S?.messages;useEffect(()=>{let o=I.current,C=x??[];if(I.current={chatId:t,messages:C},!t||o.chatId!==t)return;let y=new Set(C.map(T=>T.id)),h=o.messages.filter(T=>!y.has(T.id));h.length>0&&A(t,T=>({older:se([...T.older,...h])}));},[t,x]);let k=new Set(S?.messages.map(o=>o.id)??[]),m=[...p.older.filter(o=>!k.has(o.id)),...S?.messages??[]],U=useRef(S);U.current=S;let b=useRef(void 0);ue(t?`${g(r).agentChat(t)}?view=status`:null,f$1,{refreshInterval:()=>un(U.current),onSuccess:o=>{let C=JSON.stringify(o),y=b.current;b.current=C;let{current:h}=U,T=h?[...h.messages].reverse().find(ve=>ve.role==="assistant"):void 0;(y&&y!==C||T&&o.latestMessage&&(T.id!==o.latestMessage.id||T.status!==o.latestMessage.status||T.workflowRunId!==o.latestMessage.workflowRunId||h?.chat.updatedAt!==o.chat.updatedAt))&&v();}});let $=async()=>{let o=p.page?.cursor??S?.nextCursor;if(!t||!o||p.loading)return;let C=t;A(C,()=>({error:null,loading:true}));try{let y=await f$1(`${g(r).agentChat(C)}?before=${encodeURIComponent(o)}`);A(C,h=>({loading:!1,older:se([...y.messages,...h.older]),page:{cursor:y.nextCursor??null,hasMore:y.hasMore??!1}}));}catch{A(C,()=>({error:"Could not load earlier messages. Try again.",loading:false}));}},{after:X,before:H,live:d}=ke(m),[i,E]=useState({ids:[],messageId:""}),N=Ft(m);for(let o of d&&i.messageId===d.id?i.ids:[])N.add(o);let _=X.filter(o=>Lt(o.status)&&!N.has(o.id)),Q=H.filter(o=>!N.has(o.id)),O=(!d&&!s?Ce(m):null)?.id??null,[F,D$1]=useState(0),z=useRef(null);useEffect(()=>{if(!t||!O||z.current===O)return;z.current=O;let o=false,C=null;return e.startQueuedAgentChatMessage(t,O).then(()=>{},()=>{C=setTimeout(()=>{o||D$1(y=>y+1);},kn);}).finally(()=>{z.current=null,v();}),()=>{o=true,C&&clearTimeout(C);}},[e,t,v,O,F]);let[g$1,J]=useState(null),B=d&&g$1?.messageId===d.id?g$1.status:null;if(t&&!S&&!s)return jsxs("div",{className:"fk:flex fk:flex-1 fk:items-center fk:justify-center fk:gap-2 fk:text-sm fk:text-muted-foreground",children:[jsx(LoaderCircle,{className:"fk:size-4 fk:animate-spin"}),"Loading chat..."]});let ae=!!s||!!d,Y=[...Q].reverse().find(o=>o.role==="assistant")?.id??null,V=d?B?.label??"Thinking":"Sending",te=d?B?.visible??true:true;return jsxs(_a,{className:"fk:h-0 fk:min-h-0 fk:flex-1",children:[jsx($a,{className:"fk:gap-0 fk:p-0",children:jsxs("div",{className:"fk:mx-auto fk:w-full fk:max-w-4xl fk:space-y-5 fk:pb-6 fk:pr-4",children:[p.page?.hasMore??S?.hasMore?jsx(b$2,{variant:"ghost",disabled:p.loading,onClick:()=>{$();},children:p.loading?"Loading\u2026":"Load earlier messages"}):null,p.error?jsx("p",{role:"alert",children:p.error}):null,Q.map(o=>jsx(jt,{api:e,message:o,showSuggestion:!ae&&o.id===Y},o.id)),d&&t&&S?jsx(mn,{api:e,chatId:t,detail:S,message:d,onMidTurnDelivered:o=>E({ids:o,messageId:d.id}),onStatusChange:o=>J({messageId:d.id,status:o}),onTurnUpdated:()=>{v();}}):null,s&&!d?jsx(Ne,{attachments:s.attachments,text:s.text}):null,ae?jsx(D,{label:V,visible:te}):null,_.map(o=>jsx(jt,{api:e,message:o},o.id)),a&&d?jsx(Ne,{attachments:a.attachments,text:a.text}):null]})}),jsx(bb,{})]})}var $t=["Where should we begin?","Ready when you are","What\u2019s on the agenda today?","What\u2019s on your mind today?"];function vn(e){return [`How can I help, ${e}?`,`Good to see you, ${e}.`,`Hey, ${e}. Ready to dive in?`]}function Sn(e){let t=e?[...$t,...vn(e)]:$t;return t[Math.floor(Math.random()*t.length)]??"How can I help?"}var Jt="flexkit-ai:lastModelId",_e="flexkit-ai:lastEffort";function yn(){if(typeof localStorage>"u")return null;try{let e=localStorage.getItem(Jt);return e?{effort:localStorage.getItem(_e),modelKey:e}:null}catch{return null}}function Mn(e){return e.selectedModelKey?{effort:e.selectedEffort,modelKey:e.selectedModelKey}:e.awaitingChatModel?{effort:null,modelKey:null}:e.chatSelection?{effort:e.selectedEffort??e.chatSelection.effort,modelKey:e.chatSelection.modelKey}:e.lastUsed?{effort:e.selectedEffort??e.lastUsed.effort,modelKey:e.lastUsed.modelKey}:{effort:e.selectedEffort,modelKey:e.defaultModelKey}}function In(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(Jt,e.modelKey),e.effort?localStorage.setItem(_e,e.effort):localStorage.removeItem(_e);}catch{}}function Tn({projectId:e}){let{data:t,isLoading:r}=ue(g(e).agentProfile(),f$1),a=useMemo(()=>r?null:Sn(t?.preferredName??null),[t,r]);return jsx("div",{className:"fk:flex fk:flex-col fk:items-center fk:pb-2 fk:text-center",children:jsx("h2",{className:"fk:text-2xl fk:font-semibold",children:a??"\xA0"})})}function zn(){let{api:e$1,projectId:t$1}=t(),{currentProject:r,projectSummaries:a$3}=f(),{chatId:s$1}=useParams(),f$3=useNavigate(),u=a(),{mutate:v$1}=useSWRConfig(),{data:S}=ue(t$1?g(t$1).tools():null,f$1),{data:j}=ue(t$1&&s$1?g(t$1).agentChat(s$1):null,f$1),L=useRef({});function p(l){return cn(L.current,s$1,l)}let M=p(j),A=useMemo(()=>S?.tools.models??[],[S]),[I,x]=useState(null),[k,m]=useState(null),U=useRef(null),[b$2,$]=useState(yn),[X,H]=useState(false),d=useRef(false),[i,E]=useState(null),N$1=i&&i.chatId===s$1?i:void 0,[_,Q]=useState(null),de=_&&_.chatId===s$1?_:void 0,[O,F]=useState(null),D=M?.chat.modelId??null,z=!!s$1&&M===void 0,g$2=useMemo(()=>f$2(D,A)??(D?{effort:null,modelKey:D}:null),[D,A]),J=useMemo(()=>{let l=A.find(K=>!K.deprecated);return l?b(l):null},[A]),B=useMemo(()=>{let l=c(A,b$2?.modelKey??null);return b$2&&l&&!l.deprecated?b$2:null},[A,b$2]),{effort:ae,modelKey:Y}=Mn({awaitingChatModel:z,chatSelection:g$2,defaultModelKey:J,lastUsed:B,selectedEffort:k,selectedModelKey:I}),V=Y?g$1({effort:ae,modelKey:Y},A):null,te=z&&!I;useEffect(()=>{U.current=null,x(null),m(null),F(null);},[s$1]),useEffect(()=>{I===a$1&&D&&D!==a$1&&D!==U.current&&(x(null),m(null));},[D,I]);function o(l){$(l),In(l);}function C(l){U.current=l===a$1?D:null,x(l),m(null),o({effort:null,modelKey:l});}function y(l){m(l),Y&&o({effort:l,modelKey:Y});}if(!t$1||!e$1)return jsx("div",{className:"fk:flex fk:h-full fk:items-center fk:justify-center fk:text-sm fk:text-muted-foreground",children:"Select a project to chat with the agent."});let h=e$1,T=t$1,ve=r?.title??a$3.find(l=>l.id===t$1)?.name??"your project",Le=!s$1&&!N$1,fe=!!(M&&ke(M.messages).live);async function qt(l,K,ne){Q({attachments:ne,chatId:l,text:K});try{let w=await h.sendAgentChatFollowUp(l,{attachments:ne,content:K,modelId:V});await v$1(g(T).agentChat(l),re=>{let oe=Ot(Ae(L.current[l],re),null,j,l,V,"turn"in w?w.turn.userMessage.createdAt:w.followUp.message.createdAt),Z="turn"in w?Bt(oe,w.turn):fn(oe,w.followUp.message);return L.current[l]=Z,Z},{revalidate:!1});}finally{Q(null);}}async function Ue(l,K){if(d.current)throw new Error("A message is already being sent.");if(te)throw new Error("This chat is still loading.");d.current=true,H(true),F(null);let ne=M?Ce(M.messages):null;if(s$1&&(fe||ne)){try{!fe&&ne&&await h.startQueuedAgentChatMessage(s$1,ne.id).catch(()=>{}),await qt(s$1,l,K);}catch(w){throw F(w instanceof Error?w.message:"Failed to send the message."),w}finally{d.current=false,H(false);}return}E({attachments:K,chatId:s$1,text:l});try{let w=s$1?{chat:null,turn:await h.sendAgentChatMessage(s$1,{attachments:K,content:l,modelId:V})}:await h.startAgentChat({attachments:K,content:l,modelId:V}),{chat:re,turn:oe}=w,Z=s$1??re.id;await v$1(g(T).agentChat(Z),Wt=>{let Fe=Bt(Ot(Ae(L.current[Z],Wt),re,j,Z,V,oe.userMessage.createdAt),oe);return L.current[Z]=Fe,Fe},{revalidate:!1}),re&&f$3(`${u}/chats/${re.id}`),E(null);}catch(w){throw E(null),F(w instanceof Error?w.message:"Failed to send the message."),w}finally{d.current=false,H(false);}}async function Qt(){if(s$1)try{await h.stopAgentChat(s$1);}catch(l){F(l instanceof Error?l.message:"Failed to stop the turn.");}finally{await v$1(g(T).agentChat(s$1));}}return jsxs(Pb,{children:[jsx(hn,{draftKey:Rt(T,s$1)}),jsxs("div",{className:"fk:flex fk:h-full fk:min-h-0 fk:flex-col fk:gap-2",children:[jsxs("div",{className:"fk:mb-2 fk:flex fk:shrink-0 fk:items-start fk:gap-2",children:[jsxs(b$1,{children:[jsx(c$1,{asChild:true,children:jsx(N,{className:"fk:-ml-1 fk:h-4 fk:w-4"})}),jsx(e,{children:"Toggle Sidebar"})]}),jsx(v,{orientation:"vertical",className:"fk:mt-1 fk:h-4"}),jsx("div",{className:"fk:flex fk:flex-1 fk:items-center fk:gap-2",children:jsx("h1",{className:"fk:truncate fk:text-lg fk:font-semibold fk:leading-none fk:tracking-tight",children:s$1?M?.chat.title?.trim()??"Chat":"Agent"})})]}),jsx("div",{className:"fk:flex fk:min-h-0 fk:flex-1 fk:gap-4",children:jsxs("div",{className:a$2("fk:flex fk:min-h-0 fk:min-w-0 fk:flex-1 fk:flex-col fk:gap-3",Le&&"fk:justify-center fk:pb-[12vh]"),children:[Le?jsx(Tn,{projectId:T}):jsx(w.Provider,{value:true,children:jsx(Cn,{api:h,chatId:s$1??null,pendingFollowUp:de,pendingMessage:N$1,projectId:t$1,resolveDetail:p})}),jsxs("div",{className:"fk:shrink-0 fk:pb-3",children:[s$1?jsx(s,{api:h,chatId:s$1,projectId:t$1,sending:X||te,onTurnIntoAutomation:l=>{d.current||te||Ue(`Turn the monitor \u201C${l.description}\u201D into an automation.`,[]).catch(K=>F(K instanceof Error?K.message:"Failed to send the message."));}}):null,O?jsx("p",{className:"fk:mx-auto fk:mb-2 fk:max-w-4xl fk:text-xs fk:text-destructive",children:O}):null,jsx(An,{api:h,effort:ae,modelKey:Y,modelPending:te,models:A,sending:X,streaming:fe,onEffortChange:y,onError:F,onModelChange:C,onSend:Ue,onStop:Qt,placeholder:fe?"Add context or steer the agent...":`Ask Flexkit anything about ${ve}...`})]})]})})]})]})}export{zn as AgentChatPage};//# sourceMappingURL=chat-page-6IXM63AU.js.map
|
|
4
|
-
//# sourceMappingURL=chat-page-
|
|
3
|
+
`));},[d]);let E$1=!p&&a.status!=="streaming"&&(a.status==="awaiting_approval"||m==="paused"||g$2(k)),N=useMemo(()=>new Set(h(k)),[k]),_=r.pendingApproval&&!N.has(r.pendingApproval.id)?r.pendingApproval:null,Q=k?.parts[k.parts.length-1],de=Q?.type==="text"&&Q.state==="streaming",O=E$1?"Awaiting approval":f$3(k)??"Thinking",F=E$1?m!=="finished"&&m!=="error":m==="streaming"&&!de;useEffect(()=>{X.current({label:O,visible:F});},[O,F]);let D=!!_&&E$1,z$1=m==="finished"?Gt(b.flatMap(g=>g.parts)):null;return b.length===0&&!D?jsx(v$1.Provider,{value:H,children:null}):jsx(v$1.Provider,{value:H,children:jsxs("div",{className:"fk:w-full fk:min-w-0 fk:space-y-8",children:[b.map(g=>jsx("div",{className:"fk:space-y-8 fk:min-w-0",children:g.parts.map((J,B$1)=>jsx(B,{api:e,part:J,partIndex:B$1,parts:g.parts},B$1))},g.id)),_&&D?jsx(E,{api:e,message:A(_)}):null,z$1?jsx(zt,{prompt:z$1}):null]})})}function hn({draftKey:e}){let{textInput:t}=Nb(),{setInput:r,value:a}=t,s=useRef(null);return useLayoutEffect(()=>{if(s.current===e){_t(e,a);return}s.current=e;let f=Nt(e);f!==a&&r(f);},[e,r,a]),null}function An({api:e,effort:t,modelKey:r,modelPending:a,models:s,onEffortChange:f,onError:u,onModelChange:v,onSend:S,onStop:j$1,placeholder:L,sending:p,streaming:M}){let{attachments:A,textInput:I}=Nb(),x=m(e,u),k$1=useRef(false),m$1=s.filter(i=>!i.deprecated||b(i)===r),U=c(s,r),b$1=e$1(U),$=d(U,t),X=I.value.trim().length>0||A.files.length>0,H=Kt({hasDraft:X,streaming:M}),d$1=X&&!x.isUploading&&!p&&!a;return jsxs(Vb,{accept:l,className:"fk:mx-auto fk:max-w-4xl",maxFileSize:j,maxFiles:k,multiple:true,onError:i=>u(i.message),onSubmit:({text:i})=>{let E=i?.trim()??"",N=x.getUploaded(A.files.map(_=>_.id));return !E&&N.length===0||x.isUploading||p||k$1.current||a?Promise.reject(new Error("The message cannot be sent right now.")):(k$1.current=true,I.clear(),S(E,N).catch(_=>{throw I.setInput(i),_}).finally(()=>{k$1.current=false;}))},children:[A.files.length>0?jsx(Yb,{children:jsx(n,{uploads:x})}):null,jsx(Wb,{children:jsx(Xb,{disabled:p,placeholder:L})}),jsxs(Zb,{children:[jsxs(_b,{children:[jsxs(ac,{children:[jsx(bc,{"aria-label":"Add attachments",className:"fk:border-0 fk:bg-border fk:corner-round",disabled:p,tooltip:"Add photos or files"}),jsx(cc,{children:jsx(Tb,{})})]}),m$1.length>0?jsxs(fc,{value:r??void 0,onValueChange:v,children:[jsx(gc,{"aria-label":"Model",className:"fk:min-w-44",children:jsx(jc,{placeholder:"Model"})}),jsx(hc,{children:m$1.map(i=>jsx(ic,{value:b(i),children:i.name},b(i)))})]}):null,b$1.length>1&&$?jsxs(fc,{value:$,onValueChange:f,children:[jsx(gc,{"aria-label":"Reasoning effort",className:"fk:min-w-28",children:jsx(jc,{placeholder:"Effort"})}),jsx(hc,{children:b$1.map(i=>jsx(ic,{value:i.value,children:i.label},i.value))})]}):null]}),jsxs("div",{className:"fk:flex fk:items-center fk:gap-3",children:[jsx(Ic,{disabled:p,onAudioRecorded:async(i,E)=>{let{text:N}=await e.transcribeAgentAudio(i,E);return N},onError:i=>u(i.message),onTranscriptionChange:i=>{u(null),I.setInput(a$3(I.value,i));}}),jsx(ec,{className:"fk:corner-round",disabled:H==="stop"?false:!d$1,status:H==="stop"?"streaming":void 0,onStop:()=>{j$1();}})]})]})]})}var Re={chatId:null,error:null,loading:false,older:[],page:null},kn=3e3;function Cn({api:e,chatId:t,projectId:r,pendingFollowUp:a,pendingMessage:s,resolveDetail:f}){let{data:u,mutate:v}=ue(t?g(r).agentChat(t):null,f$1,{refreshInterval:0}),S=f(u),[j,L]=useState(Re),p=j.chatId===t?j:Re,M=useRef(t);M.current=t;let A=(o,C)=>L(y=>{if(y.chatId!==o&&M.current!==o)return y;let h=y.chatId===o?y:{...Re,chatId:o};return {...h,...C(h)}}),I=useRef({chatId:null,messages:[]}),x=S?.messages;useEffect(()=>{let o=I.current,C=x??[];if(I.current={chatId:t,messages:C},!t||o.chatId!==t)return;let y=new Set(C.map(T=>T.id)),h=o.messages.filter(T=>!y.has(T.id));h.length>0&&A(t,T=>({older:se([...T.older,...h])}));},[t,x]);let k=new Set(S?.messages.map(o=>o.id)??[]),m=[...p.older.filter(o=>!k.has(o.id)),...S?.messages??[]],U=useRef(S);U.current=S;let b=useRef(void 0);ue(t?`${g(r).agentChat(t)}?view=status`:null,f$1,{refreshInterval:()=>un(U.current),onSuccess:o=>{let C=JSON.stringify(o),y=b.current;b.current=C;let{current:h}=U,T=h?[...h.messages].reverse().find(ve=>ve.role==="assistant"):void 0;(y&&y!==C||T&&o.latestMessage&&(T.id!==o.latestMessage.id||T.status!==o.latestMessage.status||T.workflowRunId!==o.latestMessage.workflowRunId||h?.chat.updatedAt!==o.chat.updatedAt))&&v();}});let $=async()=>{let o=p.page?.cursor??S?.nextCursor;if(!t||!o||p.loading)return;let C=t;A(C,()=>({error:null,loading:true}));try{let y=await f$1(`${g(r).agentChat(C)}?before=${encodeURIComponent(o)}`);A(C,h=>({loading:!1,older:se([...y.messages,...h.older]),page:{cursor:y.nextCursor??null,hasMore:y.hasMore??!1}}));}catch{A(C,()=>({error:"Could not load earlier messages. Try again.",loading:false}));}},{after:X,before:H,live:d}=ke(m),[i,E]=useState({ids:[],messageId:""}),N=Ft(m);for(let o of d&&i.messageId===d.id?i.ids:[])N.add(o);let _=X.filter(o=>Lt(o.status)&&!N.has(o.id)),Q=H.filter(o=>!N.has(o.id)),O=(!d&&!s?Ce(m):null)?.id??null,[F,D$1]=useState(0),z=useRef(null);useEffect(()=>{if(!t||!O||z.current===O)return;z.current=O;let o=false,C=null;return e.startQueuedAgentChatMessage(t,O).then(()=>{},()=>{C=setTimeout(()=>{o||D$1(y=>y+1);},kn);}).finally(()=>{z.current=null,v();}),()=>{o=true,C&&clearTimeout(C);}},[e,t,v,O,F]);let[g$1,J]=useState(null),B=d&&g$1?.messageId===d.id?g$1.status:null;if(t&&!S&&!s)return jsxs("div",{className:"fk:flex fk:flex-1 fk:items-center fk:justify-center fk:gap-2 fk:text-sm fk:text-muted-foreground",children:[jsx(LoaderCircle,{className:"fk:size-4 fk:animate-spin"}),"Loading chat..."]});let ae=!!s||!!d,Y=[...Q].reverse().find(o=>o.role==="assistant")?.id??null,V=d?B?.label??"Thinking":"Sending",te=d?B?.visible??true:true;return jsxs(_a,{className:"fk:h-0 fk:min-h-0 fk:flex-1",children:[jsx($a,{className:"fk:gap-0 fk:p-0",children:jsxs("div",{className:"fk:mx-auto fk:w-full fk:max-w-4xl fk:space-y-5 fk:pb-6 fk:pr-4",children:[p.page?.hasMore??S?.hasMore?jsx(b$2,{variant:"ghost",disabled:p.loading,onClick:()=>{$();},children:p.loading?"Loading\u2026":"Load earlier messages"}):null,p.error?jsx("p",{role:"alert",children:p.error}):null,Q.map(o=>jsx(jt,{api:e,message:o,showSuggestion:!ae&&o.id===Y},o.id)),d&&t&&S?jsx(mn,{api:e,chatId:t,detail:S,message:d,onMidTurnDelivered:o=>E({ids:o,messageId:d.id}),onStatusChange:o=>J({messageId:d.id,status:o}),onTurnUpdated:()=>{v();}}):null,s&&!d?jsx(Ne,{attachments:s.attachments,text:s.text}):null,ae?jsx(D,{label:V,visible:te}):null,_.map(o=>jsx(jt,{api:e,message:o},o.id)),a&&d?jsx(Ne,{attachments:a.attachments,text:a.text}):null]})}),jsx(bb,{})]})}var $t=["Where should we begin?","Ready when you are","What\u2019s on the agenda today?","What\u2019s on your mind today?"];function vn(e){return [`How can I help, ${e}?`,`Good to see you, ${e}.`,`Hey, ${e}. Ready to dive in?`]}function Sn(e){let t=e?[...$t,...vn(e)]:$t;return t[Math.floor(Math.random()*t.length)]??"How can I help?"}var Jt="flexkit-ai:lastModelId",_e="flexkit-ai:lastEffort";function yn(){if(typeof localStorage>"u")return null;try{let e=localStorage.getItem(Jt);return e?{effort:localStorage.getItem(_e),modelKey:e}:null}catch{return null}}function Mn(e){return e.selectedModelKey?{effort:e.selectedEffort,modelKey:e.selectedModelKey}:e.awaitingChatModel?{effort:null,modelKey:null}:e.chatSelection?{effort:e.selectedEffort??e.chatSelection.effort,modelKey:e.chatSelection.modelKey}:e.lastUsed?{effort:e.selectedEffort??e.lastUsed.effort,modelKey:e.lastUsed.modelKey}:{effort:e.selectedEffort,modelKey:e.defaultModelKey}}function In(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(Jt,e.modelKey),e.effort?localStorage.setItem(_e,e.effort):localStorage.removeItem(_e);}catch{}}function Tn({projectId:e}){let{data:t,isLoading:r}=ue(g(e).agentProfile(),f$1),a=useMemo(()=>r?null:Sn(t?.preferredName??null),[t,r]);return jsx("div",{className:"fk:flex fk:flex-col fk:items-center fk:pb-2 fk:text-center",children:jsx("h2",{className:"fk:text-2xl fk:font-semibold",children:a??"\xA0"})})}function zn(){let{api:e$1,projectId:t$1}=t(),{currentProject:r,projectSummaries:a$3}=f(),{chatId:s$1}=useParams(),f$3=useNavigate(),u=a(),{mutate:v$1}=useSWRConfig(),{data:S}=ue(t$1?g(t$1).tools():null,f$1),{data:j}=ue(t$1&&s$1?g(t$1).agentChat(s$1):null,f$1),L=useRef({});function p(l){return cn(L.current,s$1,l)}let M=p(j),A=useMemo(()=>S?.tools.models??[],[S]),[I,x]=useState(null),[k,m]=useState(null),U=useRef(null),[b$2,$]=useState(yn),[X,H]=useState(false),d=useRef(false),[i,E]=useState(null),N$1=i&&i.chatId===s$1?i:void 0,[_,Q]=useState(null),de=_&&_.chatId===s$1?_:void 0,[O,F]=useState(null),D=M?.chat.modelId??null,z=!!s$1&&M===void 0,g$2=useMemo(()=>f$2(D,A)??(D?{effort:null,modelKey:D}:null),[D,A]),J=useMemo(()=>{let l=A.find(K=>!K.deprecated);return l?b(l):null},[A]),B=useMemo(()=>{let l=c(A,b$2?.modelKey??null);return b$2&&l&&!l.deprecated?b$2:null},[A,b$2]),{effort:ae,modelKey:Y}=Mn({awaitingChatModel:z,chatSelection:g$2,defaultModelKey:J,lastUsed:B,selectedEffort:k,selectedModelKey:I}),V=Y?g$1({effort:ae,modelKey:Y},A):null,te=z&&!I;useEffect(()=>{U.current=null,x(null),m(null),F(null);},[s$1]),useEffect(()=>{I===a$1&&D&&D!==a$1&&D!==U.current&&(x(null),m(null));},[D,I]);function o(l){$(l),In(l);}function C(l){U.current=l===a$1?D:null,x(l),m(null),o({effort:null,modelKey:l});}function y(l){m(l),Y&&o({effort:l,modelKey:Y});}if(!t$1||!e$1)return jsx("div",{className:"fk:flex fk:h-full fk:items-center fk:justify-center fk:text-sm fk:text-muted-foreground",children:"Select a project to chat with the agent."});let h=e$1,T=t$1,ve=r?.title??a$3.find(l=>l.id===t$1)?.name??"your project",Le=!s$1&&!N$1,fe=!!(M&&ke(M.messages).live);async function qt(l,K,ne){Q({attachments:ne,chatId:l,text:K});try{let w=await h.sendAgentChatFollowUp(l,{attachments:ne,content:K,modelId:V});await v$1(g(T).agentChat(l),re=>{let oe=Ot(Ae(L.current[l],re),null,j,l,V,"turn"in w?w.turn.userMessage.createdAt:w.followUp.message.createdAt),Z="turn"in w?Bt(oe,w.turn):fn(oe,w.followUp.message);return L.current[l]=Z,Z},{revalidate:!1});}finally{Q(null);}}async function Ue(l,K){if(d.current)throw new Error("A message is already being sent.");if(te)throw new Error("This chat is still loading.");d.current=true,H(true),F(null);let ne=M?Ce(M.messages):null;if(s$1&&(fe||ne)){try{!fe&&ne&&await h.startQueuedAgentChatMessage(s$1,ne.id).catch(()=>{}),await qt(s$1,l,K);}catch(w){throw F(w instanceof Error?w.message:"Failed to send the message."),w}finally{d.current=false,H(false);}return}E({attachments:K,chatId:s$1,text:l});try{let w=s$1?{chat:null,turn:await h.sendAgentChatMessage(s$1,{attachments:K,content:l,modelId:V})}:await h.startAgentChat({attachments:K,content:l,modelId:V}),{chat:re,turn:oe}=w,Z=s$1??re.id;await v$1(g(T).agentChat(Z),Wt=>{let Fe=Bt(Ot(Ae(L.current[Z],Wt),re,j,Z,V,oe.userMessage.createdAt),oe);return L.current[Z]=Fe,Fe},{revalidate:!1}),re&&f$3(`${u}/chats/${re.id}`),E(null);}catch(w){throw E(null),F(w instanceof Error?w.message:"Failed to send the message."),w}finally{d.current=false,H(false);}}async function Qt(){if(s$1)try{await h.stopAgentChat(s$1);}catch(l){F(l instanceof Error?l.message:"Failed to stop the turn.");}finally{await v$1(g(T).agentChat(s$1));}}return jsxs(Pb,{children:[jsx(hn,{draftKey:Rt(T,s$1)}),jsxs("div",{className:"fk:flex fk:h-full fk:min-h-0 fk:flex-col fk:gap-2",children:[jsxs("div",{className:"fk:mb-2 fk:flex fk:shrink-0 fk:items-start fk:gap-2",children:[jsxs(b$1,{children:[jsx(c$1,{asChild:true,children:jsx(N,{className:"fk:-ml-1 fk:h-4 fk:w-4"})}),jsx(e,{children:"Toggle Sidebar"})]}),jsx(v,{orientation:"vertical",className:"fk:mt-1 fk:h-4"}),jsx("div",{className:"fk:flex fk:flex-1 fk:items-center fk:gap-2",children:jsx("h1",{className:"fk:truncate fk:text-lg fk:font-semibold fk:leading-none fk:tracking-tight",children:s$1?M?.chat.title?.trim()??"Chat":"Agent"})})]}),jsx("div",{className:"fk:flex fk:min-h-0 fk:flex-1 fk:gap-4",children:jsxs("div",{className:a$2("fk:flex fk:min-h-0 fk:min-w-0 fk:flex-1 fk:flex-col fk:gap-3",Le&&"fk:justify-center fk:pb-[12vh]"),children:[Le?jsx(Tn,{projectId:T}):jsx(w.Provider,{value:true,children:jsx(Cn,{api:h,chatId:s$1??null,pendingFollowUp:de,pendingMessage:N$1,projectId:t$1,resolveDetail:p})}),jsxs("div",{className:"fk:shrink-0 fk:pb-3",children:[s$1?jsx(s,{api:h,chatId:s$1,projectId:t$1,sending:X||te,onTurnIntoAutomation:l=>{d.current||te||Ue(`Turn the monitor \u201C${l.description}\u201D into an automation.`,[]).catch(K=>F(K instanceof Error?K.message:"Failed to send the message."));}}):null,O?jsx("p",{className:"fk:mx-auto fk:mb-2 fk:max-w-4xl fk:text-xs fk:text-destructive",children:O}):null,jsx(An,{api:h,effort:ae,modelKey:Y,modelPending:te,models:A,sending:X,streaming:fe,onEffortChange:y,onError:F,onModelChange:C,onSend:Ue,onStop:Qt,placeholder:fe?"Add context or steer the agent...":`Ask Flexkit anything about ${ve}...`})]})]})})]})]})}export{zn as AgentChatPage};//# sourceMappingURL=chat-page-4JZO2U2C.js.map
|
|
4
|
+
//# sourceMappingURL=chat-page-4JZO2U2C.js.map
|