diff --git a/veadk/cli/main.py b/veadk/cli/main.py index 5406dd73..6587d410 100644 --- a/veadk/cli/main.py +++ b/veadk/cli/main.py @@ -24,7 +24,6 @@ import typer import uvicorn -from veadk.cli.studio.fast_api import get_fast_api_app from veadk.utils.logger import get_logger from veadk.version import VERSION @@ -153,6 +152,8 @@ def web( def studio( path: str = typer.Option(".", "--path", help="Project path"), ): + from veadk.cli.studio.fast_api import get_fast_api_app + path = Path(path).resolve() agent_py_path = os.path.join(path, "agent.py") diff --git a/veadk/cli/services/vefaas/vefaas.py b/veadk/cli/services/vefaas/vefaas.py index 4c44805d..60f6cb2d 100644 --- a/veadk/cli/services/vefaas/vefaas.py +++ b/veadk/cli/services/vefaas/vefaas.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import importlib.util import json import time @@ -28,7 +27,6 @@ ) from veadk.cli.services.veapig.apig import APIGateway -from veadk.config import veadk_environments from veadk.utils.logger import get_logger from veadk.utils.misc import formatted_timestamp from veadk.utils.volcengine_sign import ve_request @@ -60,36 +58,6 @@ def __init__(self, access_key: str, secret_key: str, region: str = "cn-beijing") self.template_id = "6874f3360bdbc40008ecf8c7" - def _pre_check(self, path: str): - if not path.exists(): - raise ValueError(f"Path {path} does not exist.") - - index_py_path = path / "index.py" - if not index_py_path.exists(): - raise ValueError( - "The project directory must include the `index.py` file. See: https://www.volcengine.com/docs/6662/107432" - ) - typer.echo( - typer.style( - "Check `index.py` file pass.", - fg=typer.colors.BRIGHT_BLACK, - ), - ) - - spec = importlib.util.spec_from_file_location("index", index_py_path) - module = importlib.util.module_from_spec(spec) - spec.loader.exec_module(module) - if not (hasattr(module, "handler") and callable(module.handler)): - raise ValueError( - "The `index.py` file must include a `handler` function. See: https://www.volcengine.com/docs/6662/107432" - ) - typer.echo( - typer.style( - "Check `handler` function pass.", - fg=typer.colors.BRIGHT_BLACK, - ), - ) - def _create_function(self, name: str, path: str): function_name = f"{name}-fn-{formatted_timestamp()}" @@ -99,7 +67,10 @@ def _create_function(self, name: str, path: str): ) envs = [] - for key, value in veadk_environments.items(): + + import veadk.config + + for key, value in veadk.config.veadk_environments.items(): envs.append(EnvForCreateFunctionInput(key=key, value=value)) typer.echo( typer.style( @@ -166,9 +137,6 @@ def _create_function(self, name: str, path: str): return function_name, function_id - def _get_template(self): - pass - def _create_application( self, application_name: str, diff --git a/veadk/cli/studio/web/404.html b/veadk/cli/studio/web/404.html index c86be35a..45051b0f 100644 --- a/veadk/cli/studio/web/404.html +++ b/veadk/cli/studio/web/404.html @@ -1 +1 @@ -
");d(await (0,C.Yz)(t,{lang:s,theme:r}))}()},[t,s,r]);let u=(0,n.cn)("w-full overflow-x-auto text-[13px] [&>pre]:px-4 [&>pre]:py-4",i);return c?(0,a.jsx)("div",{className:u,dangerouslySetInnerHTML:{__html:c},...l}):(0,a.jsx)("div",{className:u,...l,children:(0,a.jsx)("pre",{children:(0,a.jsx)("code",{children:t})})})}let S={code:function(e){var t,s,r,i,l,o;let{className:c,children:d,...u}=e;if(!(null==(s=u.node)||null==(t=s.position)?void 0:t.start.line)||(null==(i=u.node)||null==(r=i.position)?void 0:r.start.line)===(null==(o=u.node)||null==(l=o.position)?void 0:l.end.line))return(0,a.jsx)("span",{className:(0,n.cn)("bg-primary-foreground rounded-sm px-1 font-mono text-sm",c),...u,children:d});let x=function(e){if(!e)return"plaintext";let t=e.match(/language-(\w+)/);return t?t[1]:"plaintext"}(c);return(0,a.jsx)(z,{className:c,children:(0,a.jsx)(A,{code:d,language:x})})},pre:function(e){let{children:t}=e;return(0,a.jsx)(a.Fragment,{children:t})}},R=(0,o.memo)(function(e){let{content:t,components:s=S}=e;return(0,a.jsx)(w.oz,{remarkPlugins:[k.A,_.A],components:s,children:t})},function(e,t){return e.content===t.content});R.displayName="MemoizedMarkdownBlock";let L=(0,o.memo)(function(e){let{children:t,id:s,className:n,components:r=S}=e,i=(0,o.useId)(),l=null!=s?s:i,c=(0,o.useMemo)(()=>y.xI.lexer(t).map(e=>e.raw),[t]);return(0,a.jsx)("div",{className:n,children:c.map((e,t)=>(0,a.jsx)(R,{content:e,components:r},"".concat(l,"-block-").concat(t)))})});L.displayName="Markdown";var P=s(58953);function M(e){let{delayDuration:t=0,...s}=e;return(0,a.jsx)(P.Provider,{"data-slot":"tooltip-provider",delayDuration:t,...s})}function I(e){let{...t}=e;return(0,a.jsx)(M,{children:(0,a.jsx)(P.Root,{"data-slot":"tooltip",...t})})}function E(e){let{...t}=e;return(0,a.jsx)(P.Trigger,{"data-slot":"tooltip-trigger",...t})}function O(e){let{className:t,sideOffset:s=0,children:r,...i}=e;return(0,a.jsx)(P.Portal,{children:(0,a.jsxs)(P.Content,{"data-slot":"tooltip-content",sideOffset:s,className:(0,n.cn)("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...i,children:[r,(0,a.jsx)(P.Arrow,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}let D=e=>{let{children:t,className:s,...r}=e;return(0,a.jsx)("div",{className:(0,n.cn)("flex gap-3",s),...r,children:t})},T=e=>{let{children:t,markdown:s=!1,className:r,...i}=e,l=(0,n.cn)("rounded-lg p-2 text-foreground bg-secondary prose break-words whitespace-normal",r);return s?(0,a.jsx)(L,{className:l,...i,children:t}):(0,a.jsx)("div",{className:l,...i,children:t})},$=e=>{let{children:t,className:s,...r}=e;return(0,a.jsx)("div",{className:(0,n.cn)("text-muted-foreground flex items-center gap-2",s),...r,children:t})};var V=s(12456),B=s(53235);function F(e){let{className:t,variant:s="outline",size:i="sm",...l}=e,{isAtBottom:o,scrollToBottom:c}=(0,r.B)();return(0,a.jsx)(V.$,{variant:s,size:i,className:(0,n.cn)("h-10 w-10 rounded-full transition-all duration-150 ease-out",o?"pointer-events-none translate-y-4 scale-95 opacity-0":"translate-y-0 scale-100 opacity-100",t),onClick:()=>c(),...l,children:(0,a.jsx)(B.A,{className:"h-5 w-5"})})}var J=s(34371);function G(e){let{...t}=e;return(0,a.jsx)(J.Root,{"data-slot":"collapsible",...t})}function H(e){let{...t}=e;return(0,a.jsx)(J.CollapsibleTrigger,{"data-slot":"collapsible-trigger",...t})}function U(e){let{...t}=e;return(0,a.jsx)(J.CollapsibleContent,{"data-slot":"collapsible-content",...t})}var W=s(51677),Y=s(78264),X=s(35003),K=s(35976);let Q=e=>{let{toolPart:t,defaultOpen:s=!1,className:r}=e,[i,l]=(0,o.useState)(s),{state:c,input:d,output:u,toolCallId:x}=t,m=e=>null===e?"null":void 0===e?"undefined":"string"==typeof e?e:"object"==typeof e?JSON.stringify(e,null,2):String(e);return(0,a.jsx)("div",{className:(0,n.cn)("border-border mt-3 overflow-hidden rounded-lg border",r),children:(0,a.jsxs)(G,{open:i,onOpenChange:l,children:[(0,a.jsx)(H,{asChild:!0,children:(0,a.jsxs)(V.$,{variant:"ghost",className:"bg-background h-auto w-full justify-between rounded-b-none px-3 py-2 font-normal",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(()=>{switch(c){case"input-streaming":return(0,a.jsx)(W.A,{className:"h-4 w-4 animate-spin text-blue-500"});case"input-available":return(0,a.jsx)(Y.A,{className:"h-4 w-4 text-orange-500"});case"output-available":return(0,a.jsx)(X.A,{className:"h-4 w-4 text-green-500"});case"output-error":return(0,a.jsx)(K.A,{className:"h-4 w-4 text-red-500"});default:return(0,a.jsx)(Y.A,{className:"text-muted-foreground h-4 w-4"})}})(),(0,a.jsx)("span",{className:"font-mono text-sm font-medium",children:t.type}),(()=>{let e="px-2 py-1 rounded-full text-xs font-medium";switch(c){case"input-streaming":return(0,a.jsx)("span",{className:(0,n.cn)(e,"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400"),children:"Processing"});case"input-available":return(0,a.jsx)("span",{className:(0,n.cn)(e,"bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400"),children:"Ready"});case"output-available":return(0,a.jsx)("span",{className:(0,n.cn)(e,"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400"),children:"Completed"});case"output-error":return(0,a.jsx)("span",{className:(0,n.cn)(e,"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400"),children:"Error"});default:return(0,a.jsx)("span",{className:(0,n.cn)(e,"bg-gray-100 text-gray-700 dark:bg-gray-900/30 dark:text-gray-400"),children:"Pending"})}})()]}),(0,a.jsx)(B.A,{className:(0,n.cn)("h-4 w-4 transition-transform",i&&"rotate-180")})]})}),(0,a.jsx)(U,{className:"border-border border-t",children:(0,a.jsxs)("div",{className:"bg-background space-y-3 p-3",children:[d&&Object.keys(d).length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-muted-foreground mb-2 text-sm font-medium",children:"Input"}),(0,a.jsx)("div",{className:"bg-background rounded border p-2 font-mono text-sm",children:Object.entries(d).map(e=>{let[t,s]=e;return(0,a.jsxs)("div",{className:"mb-1",children:[(0,a.jsxs)("span",{className:"text-muted-foreground",children:[t,":"]})," ",(0,a.jsx)("span",{children:m(s)})]},t)})})]}),u&&(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-muted-foreground mb-2 text-sm font-medium",children:"Output"}),(0,a.jsx)("div",{className:"bg-background max-h-60 overflow-auto rounded border p-2 font-mono text-sm",children:(0,a.jsx)("pre",{className:"whitespace-pre-wrap",children:m(u)})})]}),"output-error"===c&&t.errorText&&(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"mb-2 text-sm font-medium text-red-500",children:"Error"}),(0,a.jsx)("div",{className:"bg-background rounded border border-red-200 p-2 text-sm dark:border-red-950 dark:bg-red-900/20",children:t.errorText})]}),"input-streaming"===c&&(0,a.jsx)("div",{className:"text-muted-foreground text-sm",children:"Processing tool call..."}),x&&(0,a.jsx)("div",{className:"text-muted-foreground border-t border-blue-200 pt-2 text-xs",children:(0,a.jsxs)("span",{className:"font-mono",children:["Call ID: ",x]})})]})})]})})};function q(e){let{messages:t}=e;return(0,a.jsx)("div",{className:"flex flex-1 h-full w-full flex-col overflow-hidden relative",children:(0,a.jsxs)(i,{className:"flex-1",children:[(0,a.jsx)(l,{className:"space-y-4 py-4 px-2",children:t.map(e=>{var t,s;let n="assistant"===e.role;return(0,a.jsx)(D,{className:"user"===e.role?"justify-end":"justify-start",children:(0,a.jsx)("div",{className:"min-w-0 max-w-[85%] flex-1 sm:max-w-[75%]",children:n?(0,a.jsx)(a.Fragment,{children:e.parts&&e.parts.length>0&&(null==(t=e.parts[0])?void 0:t.text)!==void 0&&(null==(s=e.parts[0])?void 0:s.text)!==""?e.parts.map(t=>"text"===t.type?(0,a.jsx)("div",{className:"mr-auto max-w-fit min-w-0 text-foreground bg-muted prose rounded-lg px-3 py-2",children:(0,a.jsx)(L,{children:t.text})},t.id||"".concat(e.id,"-text")):t.type.startsWith("tool-")?(0,a.jsx)(Q,{className:"w-full max-w-md",toolPart:{type:t.type.replace("tool-",""),state:t.state,input:t.input,output:t.output,errorText:t.errorText}},t.id||"".concat(e.id,"-tool-").concat(t.type)):void 0):(0,a.jsx)(N,{variant:"pulse-dot",size:"md"})}):(0,a.jsxs)("div",{className:"flex flex-col group gap-1",children:[(0,a.jsx)(T,{className:"ml-auto max-w-fit min-w-0 rounded-lg bg-primary text-primary-foreground px-3 py-2",children:e.parts[0].text}),(0,a.jsx)($,{className:"justify-end ml-2.5 flex gap-0 opacity-0 transition-opacity duration-150 group-hover:opacity-100",children:(0,a.jsx)("span",{className:"text-sm text-muted-foreground",children:"51 tokens"})})]})})},e.id)})}),(0,a.jsx)("div",{className:"absolute right-7 bottom-4",children:(0,a.jsx)(F,{className:"shadow-sm"})})]})})}var Z=s(4891);let ee=(0,s(79932).F)("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function et(e){let{className:t,variant:s,asChild:r=!1,...i}=e,l=r?Z.DX:"span";return(0,a.jsx)(l,{"data-slot":"badge",className:(0,n.cn)(ee({variant:s}),t),...i})}let es=e=>{let{className:t,status:s,...r}=e;return(0,a.jsx)(et,{className:(0,n.cn)("flex items-center gap-2","group",s,t),variant:"secondary",...r})},ea=e=>{let{className:t,...s}=e;return(0,a.jsxs)("span",{className:"relative flex h-2 w-2",...s,children:[(0,a.jsx)("span",{className:(0,n.cn)("absolute inline-flex h-full w-full animate-ping rounded-full opacity-75","group-[.online]:bg-emerald-500","group-[.offline]:bg-red-500","group-[.maintenance]:bg-blue-500","group-[.degraded]:bg-amber-500")}),(0,a.jsx)("span",{className:(0,n.cn)("relative inline-flex h-2 w-2 rounded-full","group-[.online]:bg-emerald-500","group-[.offline]:bg-red-500","group-[.maintenance]:bg-blue-500","group-[.degraded]:bg-amber-500")})]})},en=e=>{let{className:t,children:s,...r}=e;return(0,a.jsx)("span",{className:(0,n.cn)("text-muted-foreground",t),...r,children:null!=s?s:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"hidden group-[.online]:block",children:"Online"}),(0,a.jsx)("span",{className:"hidden group-[.offline]:block",children:"Offline"}),(0,a.jsx)("span",{className:"hidden group-[.maintenance]:block",children:"Maintenance"}),(0,a.jsx)("span",{className:"hidden group-[.degraded]:block",children:"Degraded"})]})})};function er(e){let{className:t,...s}=e;return(0,a.jsx)("textarea",{"data-slot":"textarea",className:(0,n.cn)("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),...s})}let ei=(0,o.createContext)({isLoading:!1,value:"",setValue:()=>{},maxHeight:240,onSubmit:void 0,disabled:!1,textareaRef:o.createRef()});function el(){let e=(0,o.useContext)(ei);if(!e)throw Error("usePromptInput must be used within a PromptInput");return e}function eo(e){let{className:t,isLoading:s=!1,maxHeight:r=240,value:i,onValueChange:l,onSubmit:c,children:d}=e,[u,x]=(0,o.useState)(i||""),m=(0,o.useRef)(null);return(0,a.jsx)(M,{children:(0,a.jsx)(ei.Provider,{value:{isLoading:s,value:null!=i?i:u,setValue:null!=l?l:e=>{x(e),null==l||l(e)},maxHeight:r,onSubmit:c,textareaRef:m},children:(0,a.jsx)("div",{className:(0,n.cn)("border-input bg-background cursor-text rounded-3xl border p-2 shadow-xs",t),onClick:()=>{var e;return null==(e=m.current)?void 0:e.focus()},children:d})})})}function ec(e){let{className:t,onKeyDown:s,disableAutosize:r=!1,...i}=e,{value:l,setValue:c,maxHeight:d,onSubmit:u,disabled:x,textareaRef:m}=el();return(0,o.useEffect)(()=>{!r&&m.current&&(m.current.style.height="auto",m.current.style.height="number"==typeof d?"".concat(Math.min(m.current.scrollHeight,d),"px"):"min(".concat(m.current.scrollHeight,"px, ").concat(d,")"))},[l,d,r]),(0,a.jsx)(er,{ref:m,value:l,onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),null==u||u()),null==s||s(e)},className:(0,n.cn)("text-primary min-h-[44px] w-full resize-none border-none bg-transparent shadow-none outline-none focus-visible:ring-0 focus-visible:ring-offset-0",t),rows:1,disabled:x,...i})}function ed(e){let{children:t,className:s,...r}=e;return(0,a.jsx)("div",{className:(0,n.cn)("flex items-center gap-2",s),...r,children:t})}function eu(e){let{tooltip:t,children:s,className:n,side:r="top",...i}=e,{disabled:l}=el();return(0,a.jsxs)(I,{...i,children:[(0,a.jsx)(E,{asChild:!0,disabled:l,onClick:e=>e.stopPropagation(),children:s}),(0,a.jsx)(O,{side:r,className:n,children:t})]})}var ex=s(64393);let em=(0,ex.v)(e=>({agent:{name:"",description:"",instruction:"",model_name:"",short_term_memory_backend:"",short_term_memory_db_url:"",long_term_memory_backend:"",knowledgebase_backend:""},setAgent:t=>e(e=>({agent:{...e.agent,...t}}))}));var ep=s(73570),eh=s(78044);function ef(e){let{sendMessage:t}=e,{agent:s,setAgent:n}=em(),[r,i]=(0,o.useState)(!1),[l,c]=(0,o.useState)("");return(0,a.jsxs)(eo,{value:l,onValueChange:e=>{c(e)},isLoading:r,onSubmit:()=>{t({text:l}),c("")},className:"w-full",children:[(0,a.jsx)(ec,{placeholder:"Ask me anything...",className:"min-h-[66px]"}),(0,a.jsxs)(ed,{className:"flex pt-2 justify-between",children:[(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsx)(eu,{tooltip:"Active agent",children:(0,a.jsxs)(es,{status:"online",children:[(0,a.jsx)(ea,{}),(0,a.jsx)(en,{children:s.name})]})})}),(0,a.jsx)(eu,{tooltip:r?"Stop generation":"Send message",children:(0,a.jsx)(V.$,{variant:"default",size:"icon",className:"h-8 w-8 rounded-full ml-auto cursor-pointer",onClick:()=>{t({text:l}),c("")},children:r?(0,a.jsx)(ep.A,{className:"size-5 fill-current"}):(0,a.jsx)(eh.A,{className:"size-5"})})})]})]})}var eg=s(78446),ej=s(46148),ev=s(73250),eb=s(96159),eN=s(48367),ey=s(19779);let ew=(0,o.forwardRef)((e,t)=>{let{onMouseEnter:s,onMouseLeave:r,className:i,size:l=28,...c}=e,d=(0,eN.s)(),u=(0,o.useRef)(!1);(0,o.useImperativeHandle)(t,()=>(u.current=!0,{startAnimation:()=>d.start("animate"),stopAnimation:()=>d.start("normal")}));let x=(0,o.useCallback)(e=>{u.current?null==s||s(e):d.start("animate")},[d,s]),m=(0,o.useCallback)(e=>{u.current?null==r||r(e):d.start("normal")},[d,r]);return(0,a.jsx)("div",{className:(0,n.cn)(i),onMouseEnter:x,onMouseLeave:m,...c,children:(0,a.jsxs)(ey.P.svg,{xmlns:"http://www.w3.org/2000/svg",width:l,height:l,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",transition:{type:"spring",stiffness:50,damping:10},variants:{normal:{rotate:0},animate:{rotate:180}},animate:d,children:[(0,a.jsx)("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),(0,a.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})})});ew.displayName="SettingsGearIcon";let e_=(0,ex.v)(e=>({runnerConfig:{app_name:"",user_id:"",session_id:""},setRunnerConfig:t=>e(e=>({runnerConfig:{...e.runnerConfig,...t}}))}));var ek=s(54426),eC=s(77603),ez=s(64784),eA=s(86408);let eS={normal:{pathLength:1,opacity:1},animate:{pathLength:[0,1],opacity:[0,1],transition:{delay:.15,duration:.3,opacity:{delay:.1}}}},eR=(0,o.forwardRef)((e,t)=>{let{onMouseEnter:s,onMouseLeave:r,className:i,size:l=28,...c}=e,d=(0,eN.s)(),u=(0,o.useRef)(!1);(0,o.useImperativeHandle)(t,()=>(u.current=!0,{startAnimation:()=>d.start("animate"),stopAnimation:()=>d.start("normal")}));let x=(0,o.useCallback)(e=>{u.current?null==s||s(e):d.start("animate")},[d,s]),m=(0,o.useCallback)(e=>{u.current?null==r||r(e):d.start("normal")},[d,r]);return(0,a.jsx)("div",{className:(0,n.cn)(i),onMouseEnter:x,onMouseLeave:m,...c,children:(0,a.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:l,height:l,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),(0,a.jsx)(ey.P.path,{d:"M7 16c.5-2 1.5-7 4-7 2 0 2 3 4 3 2.5 0 4.5-5 5-7",variants:eS,animate:d})]})})});eR.displayName="ChartSplineIcon";var eL=s(8520);function eP(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:(0,a.jsx)("table",{"data-slot":"table",className:(0,n.cn)("w-full caption-bottom text-sm",t),...s})})}function eM(e){let{className:t,...s}=e;return(0,a.jsx)("thead",{"data-slot":"table-header",className:(0,n.cn)("[&_tr]:border-b",t),...s})}function eI(e){let{className:t,...s}=e;return(0,a.jsx)("tbody",{"data-slot":"table-body",className:(0,n.cn)("[&_tr:last-child]:border-0",t),...s})}function eE(e){let{className:t,...s}=e;return(0,a.jsx)("tr",{"data-slot":"table-row",className:(0,n.cn)("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",t),...s})}function eO(e){let{className:t,...s}=e;return(0,a.jsx)("th",{"data-slot":"table-head",className:(0,n.cn)("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...s})}function eD(e){let{className:t,...s}=e;return(0,a.jsx)("td",{"data-slot":"table-cell",className:(0,n.cn)("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...s})}function eT(e){let{className:t,...s}=e;return(0,a.jsx)("caption",{"data-slot":"table-caption",className:(0,n.cn)("text-muted-foreground mt-4 text-sm",t),...s})}let e$=(0,ex.v)(e=>({feedback:"",refineButtonRef:null,setFeedback:t=>e({feedback:t}),setRefineButtonRef:t=>e({refineButtonRef:t})}));function eV(e){let{testCases:t}=e,{setFeedback:s,refineButtonRef:n}=e$();async function r(e){s(e),null==n||n.current.click()}return(0,a.jsx)("div",{className:"flex w-full",children:(0,a.jsxs)(eP,{className:"table-fixed",children:[(0,a.jsx)(eT,{children:"A list of available test cases."}),(0,a.jsx)(eM,{children:(0,a.jsxs)(eE,{children:[(0,a.jsx)(eO,{className:"w-1/12 text-ellipsis",children:"Input"}),(0,a.jsx)(eO,{className:"w-2/12 text-ellipsis",children:"Expected output"}),(0,a.jsx)(eO,{className:"w-3/12 text-ellipsis",children:"Actual output"}),(0,a.jsx)(eO,{className:"w-3/12 text-ellipsis",children:"Reason"}),(0,a.jsx)(eO,{className:"w-1/12 text-ellipsis",children:"Score"}),(0,a.jsx)(eO,{className:"w-2/12 text-ellipsis"})]})}),(0,a.jsx)(eI,{children:t&&t.map((e,t)=>e.map((e,s)=>(0,a.jsxs)(eE,{children:[(0,a.jsx)(eD,{className:"w-1/12 truncate",children:e.input}),(0,a.jsx)(eD,{className:"w-2/12 truncate",children:e.expected_output}),(0,a.jsx)(eD,{className:"w-3/12 truncate",title:e.actual_output,children:e.actual_output}),(0,a.jsx)(eD,{className:"w-3/12 truncate",title:e.reason,children:e.reason}),(0,a.jsx)(eD,{className:"w-1/12",children:e.score}),(0,a.jsx)(eD,{className:"w-2/12",children:(0,a.jsx)(V.$,{variant:"secondary",className:"cursor-pointer",disabled:""===e.reason,onClick:()=>r(e.reason),children:"Refine prompt"})})]},(t+1)*(s+1))))})]})})}function eB(){let[e,t]=(0,o.useState)(null),[s,n]=(0,o.useState)(!1);async function r(){t((await ek.Ay.get("http://127.0.0.1:8000/get_testcases").json()).test_cases)}async function i(){n(!0),t((await ek.Ay.get("http://127.0.0.1:8000/evaluate",{timeout:6e5}).json()).test_cases),n(!1)}return(0,a.jsxs)(eL.lG,{onOpenChange:r,children:[(0,a.jsxs)(I,{children:[(0,a.jsx)(E,{asChild:!0,children:(0,a.jsx)(eL.zM,{asChild:!0,children:(0,a.jsx)(V.$,{size:"icon",variant:"secondary",className:"cursor-pointer",onClick:()=>{},children:(0,a.jsx)(eR,{className:"text-blue-500"})})})}),(0,a.jsx)(O,{children:"Evaluate"})]}),(0,a.jsxs)(eL.Cf,{className:"flex flex-col min-w-4/5 max-w-4/5 max-h-3/4",children:[(0,a.jsxs)(eL.c7,{className:"flex",children:[(0,a.jsx)(eL.L3,{children:"Evaluation invocations"}),(0,a.jsx)(eL.rr,{children:"with DeepEval"})]}),(0,a.jsxs)("div",{className:"flex flex-col flex-1 min-h-0 gap-3",children:[(0,a.jsx)("div",{className:"flex-1 min-h-0 overflow-y-scroll",children:(0,a.jsx)(eV,{testCases:e})}),(0,a.jsx)("div",{className:"flex justify-end",children:(0,a.jsx)(V.$,{className:"cursor-pointer",disabled:s,onClick:i,children:"Evaluate"})})]})]})]})}var eF=s(26020),eJ=s(36663);function eG(){let{agent:e,setAgent:t}=em(),s=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useRef)(null),i=(0,o.useRef)(null),{feedback:l,setFeedback:c,setRefineButtonRef:d}=e$(),[u,x]=(0,o.useState)(e.instruction),[m,p]=(0,o.useState)(""),[h,f]=(0,o.useState)(!1);async function g(){await ek.Ay.get("http://127.0.0.1:8000/set_prompt?prompt="+u),t({...e,instruction:u}),(0,eA.oR)("Agent instruction has been updated",{action:{label:"Got it",onClick:()=>console.log("Undo")}})}async function j(){f(!0),p((await ek.Ay.get("http://127.0.0.1:8000/refine_prompt?feedback="+l,{timeout:6e5}).json()).prompt),f(!0)}async function v(){await ek.Ay.get("http://127.0.0.1:8000/set_prompt?prompt="+m,{timeout:6e4}),x(m),c(""),p(""),t({...e,instruction:m}),(0,eA.oR)("Agent instruction has been updated",{action:{label:"Got it",onClick:()=>console.log("Undo")}})}return(0,o.useEffect)(()=>{x(e.instruction)},[e.instruction]),(0,o.useEffect)(()=>{d(i)},[]),(0,a.jsxs)(eL.lG,{children:[(0,a.jsxs)(I,{children:[(0,a.jsx)(E,{asChild:!0,children:(0,a.jsx)(eL.zM,{asChild:!0,children:(0,a.jsx)(V.$,{size:"icon",variant:"secondary",className:"cursor-pointer",ref:i,children:(0,a.jsx)(eJ.YhQ,{className:"text-blue-500"})})})}),(0,a.jsx)(O,{children:"Refine prompt"})]}),(0,a.jsxs)(eL.Cf,{className:"flex flex-col min-w-4/5 max-w-4/5 min-h-1/2 max-h-full gap-1",style:{zIndex:9999},children:[(0,a.jsxs)(eL.c7,{className:"flex",children:[(0,a.jsx)(eL.L3,{children:"Refine instruction"}),(0,a.jsx)(eL.rr,{children:"make your agent system prompt powerful with Volcengine AgentPilot"})]}),(0,a.jsxs)("div",{className:"flex flex-1 flex-row gap-5 min-h-0",children:[(0,a.jsxs)("div",{className:"flex flex-1 flex-col min-h-0 mt-3 w-full gap-3",children:[(0,a.jsx)("span",{className:"flex text-sm font-medium",children:"Current prompt"}),(0,a.jsx)(er,{ref:s,className:"flex-1 w-full resize-none min-h-0",value:u,onChange:e=>x(e.target.value)}),(0,a.jsx)(V.$,{type:"button",className:"w-1/3 ml-auto cursor-pointer",onClick:g,children:"Update"})]}),(0,a.jsxs)("div",{className:"flex flex-1 flex-col min-h-0 mt-3 w-full gap-3 min-h-0",children:[(0,a.jsx)("span",{className:"flex text-sm font-medium",children:"Optimizer prompt"}),(0,a.jsx)(er,{ref:n,className:"w-full flex-1 min-h-0 resize-none",value:l,onChange:e=>c(e.target.value),placeholder:"Make my prompt more clearer ...",rows:5}),(0,a.jsx)(V.$,{type:"button",className:"w-1/3 ml-auto cursor-pointer",onClick:j,disabled:h,children:"Optimize"})]}),(0,a.jsxs)("div",{className:"flex flex-1 flex-col min-h-0 mt-3 w-full gap-3",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:"Optimized prompt"}),(0,a.jsx)(er,{ref:r,className:"w-full flex-1 min-h-0 resize-none",value:m,onChange:e=>p(e.target.value),rows:5,placeholder:"Optimized prompt will be rendered here."}),(0,a.jsxs)(V.$,{type:"button",className:"w-1/3 ml-auto cursor-pointer",onClick:v,children:[(0,a.jsx)(eF.A,{})," Use this"]})]})]})]})]})}var eH=s(2472);function eU(){let{agent:e}=em();async function t(){console.log(await ek.Ay.get("http://127.0.0.1:8000/save_session").json())}return(0,a.jsxs)(eL.lG,{children:[(0,a.jsxs)(I,{children:[(0,a.jsx)(E,{asChild:!0,children:(0,a.jsx)(eL.zM,{asChild:!0,children:(0,a.jsx)(V.$,{size:"icon",variant:"secondary",className:"cursor-pointer",disabled:!e.long_term_memory_backend,children:(0,a.jsx)(eH.A,{className:"size-5 text-blue-500"})})})}),(0,a.jsx)(O,{children:(0,a.jsx)("p",{children:"Save session"})})]}),(0,a.jsxs)(eL.Cf,{className:"min-w-3xl max-w-3xl",children:[(0,a.jsxs)(eL.c7,{children:[(0,a.jsx)(eL.L3,{children:"Save session"}),(0,a.jsx)(eL.rr,{children:"Are you sure saving session to your long-term memory?"})]}),(0,a.jsxs)("div",{className:"flex flex-row w-full gap-4 justify-end",children:[(0,a.jsx)(eL.HM,{asChild:!0,children:(0,a.jsx)(V.$,{className:"flex w-1/5 cursor-pointer",variant:"outline",children:"No"})}),(0,a.jsx)(V.$,{className:"flex w-1/5 cursor-pointer",onClick:t,children:"Yes"})]})]})]})}var eW=s(39403),eY=s(81223),eX=s(4972),eK=s(20610),eQ=s(9430);function eq(e){let{data:t,rootName:s="root",defaultExpanded:r=!0,className:i}=e;return(0,a.jsx)(M,{children:(0,a.jsx)("div",{className:(0,n.cn)("font-mono text-sm",i),children:(0,a.jsx)(eZ,{name:s,data:t,isRoot:!0,defaultExpanded:r})})})}function eZ(e){let{name:t,data:s,isRoot:r=!1,defaultExpanded:i=!0,level:l=0}=e,[c,d]=o.useState(i),[u,x]=o.useState(!1),m=null===s?"null":Array.isArray(s)?"array":typeof s,p=null!=s&&!(s instanceof Date)&&("object"===m||"array"===m),h=p&&null!=s?Object.keys(s).length:0;return(0,a.jsxs)("div",{className:(0,n.cn)("pl-4 group/object",l>0&&"border-l border-border"),children:[(0,a.jsxs)("div",{className:(0,n.cn)("flex items-center gap-1 py-1 hover:bg-muted/50 rounded px-1 -ml-4 cursor-pointer group/property",r&&"text-primary font-semibold"),onClick:p?()=>{d(!c)}:void 0,children:[p?(0,a.jsx)("div",{className:"w-4 h-4 flex items-center justify-center",children:c?(0,a.jsx)(B.A,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,a.jsx)(eW.A,{className:"h-3.5 w-3.5 text-muted-foreground"})}):(0,a.jsx)("div",{className:"w-4"}),(0,a.jsx)("span",{className:"text-primary",children:t}),(0,a.jsx)("span",{className:"text-muted-foreground",children:p?(0,a.jsxs)(a.Fragment,{children:["array"===m?"[":"{",!c&&(0,a.jsxs)("span",{className:"text-muted-foreground",children:[" ",h," ",1===h?"item":"items"," ","array"===m?"]":"}"]})]}):":"}),!p&&(0,a.jsx)(e0,{data:s}),!p&&(0,a.jsx)("div",{className:"w-3.5"}),(0,a.jsx)("button",{onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(JSON.stringify(s,null,2)),x(!0),setTimeout(()=>x(!1),2e3)},className:"ml-auto opacity-0 group-hover/property:opacity-100 hover:bg-muted p-1 rounded",title:"Copy to clipboard",children:u?(0,a.jsx)(eY.A,{className:"h-3.5 w-3.5 text-green-500"}):(0,a.jsx)(eX.A,{className:"h-3.5 w-3.5 text-muted-foreground"})})]}),p&&c&&null!=s&&(0,a.jsxs)("div",{className:"pl-4",children:[Object.keys(s).map(e=>(0,a.jsx)(eZ,{name:"array"===m?"".concat(e):e,data:s[e],level:l+1,defaultExpanded:l<1},e)),(0,a.jsx)("div",{className:"text-muted-foreground pl-4 py-1",children:"array"===m?"]":"}"})]})]})}function e0(e){let{data:t}=e,[s,n]=o.useState(!1),r=typeof t;if(null===t)return(0,a.jsx)("span",{className:"text-rose-500",children:"null"});if(void 0===t)return(0,a.jsx)("span",{className:"text-muted-foreground",children:"undefined"});if(t instanceof Date)return(0,a.jsx)("span",{className:"text-purple-500",children:t.toISOString()});switch(r){case"string":if(t.length>80)return(0,a.jsxs)("div",{className:"text-emerald-500 flex-1 flex items-center relative group cursor-pointer",onClick:e=>{e.stopPropagation(),n(!s)},children:['"',s?(0,a.jsx)("span",{className:"inline-block max-w-full",children:t}):(0,a.jsxs)(I,{delayDuration:300,children:[(0,a.jsx)(E,{asChild:!0,children:(0,a.jsxs)("span",{className:"inline-block max-w-full",children:[t.substring(0,80),"..."]})}),(0,a.jsx)(O,{side:"bottom",className:"max-w-md text-xs p-2 break-words",children:t})]}),'"',(0,a.jsx)("div",{className:"absolute right-0 top-1/2 -translate-y-1/2 translate-x-[calc(100%+4px)] opacity-0 group-hover:opacity-100 transition-opacity",children:s?(0,a.jsx)(eK.A,{className:"h-3 w-3 text-muted-foreground"}):(0,a.jsx)(eQ.A,{className:"h-3 w-3 text-muted-foreground"})})]});return(0,a.jsx)("span",{className:"text-emerald-500",children:'"'.concat(t,'"')});case"number":return(0,a.jsx)("span",{className:"text-amber-500",children:t});case"boolean":return(0,a.jsx)("span",{className:"text-blue-500",children:t.toString()});default:return(0,a.jsx)("span",{children:String(t)})}}let e2={normal:{opacity:1,pathLength:1,pathOffset:0,transition:{duration:.4,opacity:{duration:.1}}},animate:{opacity:[0,1],pathLength:[0,1],pathOffset:[1,0],transition:{duration:.6,ease:"linear",opacity:{duration:.1}}}},e1=(0,o.forwardRef)((e,t)=>{let{onMouseEnter:s,onMouseLeave:r,className:i,size:l=28,...c}=e,d=(0,eN.s)(),u=(0,o.useRef)(!1);(0,o.useImperativeHandle)(t,()=>(u.current=!0,{startAnimation:()=>d.start("animate"),stopAnimation:()=>d.start("normal")}));let x=(0,o.useCallback)(e=>{u.current?null==s||s(e):d.start("animate")},[d,s]),m=(0,o.useCallback)(e=>{u.current?null==r||r(e):d.start("normal")},[d,r]);return(0,a.jsx)("div",{className:(0,n.cn)(i),onMouseEnter:x,onMouseLeave:m,...c,children:(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:l,height:l,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)(ey.P.path,{variants:e2,animate:d,initial:"normal",d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"})})})});e1.displayName="ActivityIcon";var e5=s(41940);function e3(e){let{className:t,...s}=e;return(0,a.jsx)(e5.Root,{"data-slot":"tabs",className:(0,n.cn)("flex flex-col gap-2",t),...s})}function e4(e){let{className:t,...s}=e;return(0,a.jsx)(e5.List,{"data-slot":"tabs-list",className:(0,n.cn)("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",t),...s})}function e7(e){let{className:t,...s}=e;return(0,a.jsx)(e5.Trigger,{"data-slot":"tabs-trigger",className:(0,n.cn)("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...s})}function e9(e){let{className:t,...s}=e;return(0,a.jsx)(e5.Content,{"data-slot":"tabs-content",className:(0,n.cn)("flex-1 outline-none",t),...s})}function e6(e){let{spans:t,setEventData:s,setAttributes:n}=e;return(0,a.jsx)("div",{className:"flex flex-col gap-3",children:t.map((e,t)=>(0,a.jsx)("div",{className:"pb-2 border-b border-gray-200",children:(0,a.jsx)(e8,{span:e,indent:0,setEventData:s,setAttributes:n},e.span_id)},e.span_id+t))})}function e8(e){let{span:t,indent:s,setEventData:n,setAttributes:r}=e;async function i(e){n(JSON.parse((await ek.Ay.get("http://127.0.0.1:8000/get_event?event_id=".concat(e)).json()).event)),r(t.attributes)}return(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex flex-row items-center gap-2 hover:bg-gray-100 hover:rounded-sm px-2 py-1 cursor-pointer",onClick:()=>i(t.event_id),children:[(0,a.jsx)("div",{className:"w-1/2 font-mono text-sm",style:{paddingLeft:"".concat(s,"rem")},children:t.name}),(0,a.jsx)("div",{className:"flex w-1/4 justify-end",children:(0,a.jsx)("div",{className:" bg-blue-500 h-4 rounded",style:{width:"".concat(t.latency_proportion,"%")}})}),(0,a.jsx)("div",{className:"flex w-1/4 justify-end",children:(0,a.jsxs)("span",{className:"text-sm text-muted-foreground",children:[t.latency," ms"]})})]}),t.childs&&t.childs.length>0&&(0,a.jsx)("div",{children:t.childs.map(e=>(0,a.jsx)(e8,{span:e,indent:s+1,setEventData:n,setAttributes:r},e.span_id))})]})}function te(){var e;let[t,s]=(0,o.useState)([]),[n,r]=(0,o.useState)(),[i,l]=(0,o.useState)(),[c,d]=(0,o.useState)(),[u,x]=(0,o.useState)(!1);async function m(e){if(e){let e=await ek.Ay.get("http://127.0.0.1:8000/get_tracing").json();r(e),s(e.root_spans)}x(e)}return(0,a.jsxs)(eL.lG,{open:u,onOpenChange:m,children:[(0,a.jsxs)(I,{children:[(0,a.jsx)(E,{asChild:!0,children:(0,a.jsx)(eL.zM,{asChild:!0,children:(0,a.jsx)(V.$,{size:"icon",variant:"secondary",className:"cursor-pointer",children:(0,a.jsx)(e1,{className:"text-blue-500"})})})}),(0,a.jsx)(O,{children:"Tracing"})]}),(0,a.jsxs)(eL.Cf,{className:"flex flex-col max-w-3/4 min-w-3/4 min-h-[80vh] max-h-[80vh]",children:[(0,a.jsxs)(eL.c7,{className:"flex",children:[(0,a.jsx)(eL.L3,{children:"Tracing for your agent"}),(0,a.jsxs)(eL.rr,{children:["Trace ID: ",null==n||null==(e=n.root_spans[0])?void 0:e.trace_id]})]}),(0,a.jsxs)("div",{className:"flex flex-row flex-1 min-h-0",children:[(0,a.jsx)("div",{className:"overflow-auto w-1/2 pr-2 border-r border-gray-200",children:(0,a.jsxs)(e3,{defaultValue:"graph",className:"",children:[(0,a.jsxs)(e4,{children:[(0,a.jsx)(e7,{value:"graph",children:"Graph"}),(0,a.jsx)(e7,{value:"text",children:"Text"})]}),(0,a.jsx)(e9,{value:"graph",children:t&&t.length>0?(0,a.jsx)(e6,{spans:t,setEventData:l,setAttributes:d}):(0,a.jsx)("span",{className:"text-muted-foreground text-sm",children:"No conversation founded."})}),(0,a.jsx)(e9,{value:"text",children:(0,a.jsx)(eq,{data:n,rootName:""})})]})}),(0,a.jsx)("div",{className:"overflow-auto w-1/2 pl-2",children:(0,a.jsxs)(e3,{defaultValue:"event",className:"",children:[(0,a.jsxs)(e4,{children:[(0,a.jsx)(e7,{value:"event",children:"Event"}),(0,a.jsx)(e7,{value:"attr",children:"Attributions"})]}),(0,a.jsx)(e9,{value:"event",children:i?(0,a.jsx)(eq,{data:i,rootName:""}):(0,a.jsx)("span",{className:"text-muted-foreground text-sm",children:"Choose an event from left side"})}),(0,a.jsx)(e9,{value:"attr",children:(0,a.jsx)(eq,{data:c,rootName:""})})]})})]})]})]})}function tt(){let{agent:e,setAgent:t}=em(),{runnerConfig:s,setRunnerConfig:n}=e_(),r=(0,eC.mN)({defaultValues:{app_name:s.app_name,user_id:s.user_id,session_id:s.session_id}});async function i(e){n(await ek.Ay.get("http://127.0.0.1:8000/set_runner_config?app_name=".concat(e.app_name,"&user_id=").concat(e.user_id,"&session_id=").concat(e.session_id)).json()),(0,eA.oR)("Runner config has been updated",{action:{label:"Got it",onClick:()=>console.log("Undo")}})}return(0,o.useEffect)(()=>{r.reset({app_name:s.app_name,user_id:s.user_id,session_id:s.session_id})},[s,r]),(0,a.jsxs)("div",{className:"flex flex-row gap-3 items-center",children:[(0,a.jsxs)("div",{className:"flex flex-1 mr-auto gap-3 border-r border-r-border items-center",children:[(0,a.jsx)("img",{src:"https://avatar.iran.liara.run/username?username=".concat(e.name),className:"size-10 rounded-full shadow-md"}),(0,a.jsx)("div",{className:"font-bold",children:e.name})]}),(0,a.jsxs)("div",{className:"flex ml-auto gap-3",children:[(0,a.jsxs)(eb.Popover,{children:[(0,a.jsx)(eb.PopoverTrigger,{asChild:!0,children:(0,a.jsx)(V.$,{size:"icon",variant:"secondary",className:"cursor-pointer",children:(0,a.jsx)(ew,{})})}),(0,a.jsx)(eb.PopoverContent,{children:(0,a.jsx)(eg.lV,{...r,children:(0,a.jsxs)("form",{onSubmit:r.handleSubmit(i),className:"flex flex-col gap-3",children:[(0,a.jsx)(eg.zB,{control:r.control,name:"app_name",render:e=>{let{field:t}=e;return(0,a.jsxs)(eg.eI,{children:[(0,a.jsx)(eg.lR,{children:"APP name"}),(0,a.jsx)(eg.MJ,{children:(0,a.jsx)(ej.p,{...t})})]})}}),(0,a.jsx)(eg.zB,{control:r.control,name:"user_id",render:e=>{let{field:t}=e;return(0,a.jsxs)(eg.eI,{children:[(0,a.jsx)(eg.lR,{children:"User ID"}),(0,a.jsx)(eg.MJ,{children:(0,a.jsx)(ej.p,{...t})})]})}}),(0,a.jsx)(eg.zB,{control:r.control,name:"session_id",render:e=>{let{field:t}=e;return(0,a.jsxs)(eg.eI,{children:[(0,a.jsx)(eg.lR,{children:"Session ID"}),(0,a.jsx)(eg.MJ,{children:(0,a.jsx)(ej.p,{...t})})]})}}),(0,a.jsx)("div",{className:"ml-auto",children:(0,a.jsx)(V.$,{type:"submit",className:"cursor-pointer",children:"Submit"})})]})})})]}),(0,a.jsxs)(eb.Popover,{children:[(0,a.jsx)(eb.PopoverTrigger,{asChild:!0,children:(0,a.jsx)(V.$,{size:"icon",variant:"secondary",className:"cursor-pointer",children:(0,a.jsx)(ez.mYn,{})})}),(0,a.jsxs)(eb.PopoverContent,{className:"flex flex-col gap-3 w-256",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)(ev.J,{children:"Name"}),(0,a.jsx)("span",{className:"text-sm text-text-2",children:e.name})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)(ev.J,{children:"Description"}),(0,a.jsx)("span",{className:"text-sm text-text-2",children:e.description})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)(ev.J,{children:"Instruction"}),(0,a.jsx)("span",{className:"text-sm text-text-2",children:e.instruction})]})]})]}),(0,a.jsx)(eG,{}),(0,a.jsx)(te,{}),(0,a.jsx)(eB,{}),(0,a.jsx)(eU,{})]})]})}var ts=s(64200),ta=s(48702);function tn(){let{setAgent:e}=em(),{setRunnerConfig:t}=e_(),{messages:s,setMessages:n,sendMessage:r}=(0,ts.Y_)({transport:new ta.rL({api:"http://127.0.0.1:8000/run_sse"})});return(0,o.useEffect)(()=>{let s=async()=>{e(await ek.Ay.get("http://127.0.0.1:8000/get_agent").json())},a=async()=>{t(await ek.Ay.get("http://127.0.0.1:8000/get_runner_config").json())};(async()=>{n((await ek.Ay.get("http://127.0.0.1:8000/get_history_messages").json()).messages)})(),s(),a()},[]),(0,a.jsxs)("div",{className:"flex flex-col min-w-3xl max-w-3xl mx-auto min-h-0 w-full px-4 md:px-6 pb-3 gap-3",children:[(0,a.jsx)(tt,{}),(0,a.jsx)(q,{messages:s}),(0,a.jsx)(ef,{sendMessage:r})]})}},73250:(e,t,s)=>{"use strict";s.d(t,{J:()=>i});var a=s(69005);s(33369);var n=s(89803),r=s(78791);function i(e){let{className:t,...s}=e;return(0,a.jsx)(n.Root,{"data-slot":"label",className:(0,r.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...s})}},78446:(e,t,s)=>{"use strict";s.d(t,{MJ:()=>f,Rr:()=>g,eI:()=>p,lR:()=>h,lV:()=>c,zB:()=>u});var a=s(69005),n=s(33369),r=s(4891),i=s(77603),l=s(78791),o=s(73250);let c=i.Op,d=n.createContext({}),u=e=>{let{...t}=e;return(0,a.jsx)(d.Provider,{value:{name:t.name},children:(0,a.jsx)(i.xI,{...t})})},x=()=>{let e=n.useContext(d),t=n.useContext(m),{getFieldState:s}=(0,i.xW)(),a=(0,i.lN)({name:e.name}),r=s(e.name,a);if(!e)throw Error("useFormField should be used within ");d(await (0,C.Yz)(t,{lang:s,theme:r}))}()},[t,s,r]);let u=(0,n.cn)("w-full overflow-x-auto text-[13px] [&>pre]:px-4 [&>pre]:py-4",i);return c?(0,a.jsx)("div",{className:u,dangerouslySetInnerHTML:{__html:c},...l}):(0,a.jsx)("div",{className:u,...l,children:(0,a.jsx)("pre",{children:(0,a.jsx)("code",{children:t})})})}let S={code:function(e){var t,s,r,i,l,o;let{className:c,children:d,...u}=e;if(!(null==(s=u.node)||null==(t=s.position)?void 0:t.start.line)||(null==(i=u.node)||null==(r=i.position)?void 0:r.start.line)===(null==(o=u.node)||null==(l=o.position)?void 0:l.end.line))return(0,a.jsx)("span",{className:(0,n.cn)("bg-primary-foreground rounded-sm px-1 font-mono text-sm",c),...u,children:d});let x=function(e){if(!e)return"plaintext";let t=e.match(/language-(\w+)/);return t?t[1]:"plaintext"}(c);return(0,a.jsx)(z,{className:c,children:(0,a.jsx)(A,{code:d,language:x})})},pre:function(e){let{children:t}=e;return(0,a.jsx)(a.Fragment,{children:t})}},R=(0,o.memo)(function(e){let{content:t,components:s=S}=e;return(0,a.jsx)(y.oz,{remarkPlugins:[k.A,_.A],components:s,children:t})},function(e,t){return e.content===t.content});R.displayName="MemoizedMarkdownBlock";let L=(0,o.memo)(function(e){let{children:t,id:s,className:n,components:r=S}=e,i=(0,o.useId)(),l=null!=s?s:i,c=(0,o.useMemo)(()=>w.xI.lexer(t).map(e=>e.raw),[t]);return(0,a.jsx)("div",{className:n,children:c.map((e,t)=>(0,a.jsx)(R,{content:e,components:r},"".concat(l,"-block-").concat(t)))})});L.displayName="Markdown";var P=s(58953);function M(e){let{delayDuration:t=0,...s}=e;return(0,a.jsx)(P.Provider,{"data-slot":"tooltip-provider",delayDuration:t,...s})}function I(e){let{...t}=e;return(0,a.jsx)(M,{children:(0,a.jsx)(P.Root,{"data-slot":"tooltip",...t})})}function E(e){let{...t}=e;return(0,a.jsx)(P.Trigger,{"data-slot":"tooltip-trigger",...t})}function O(e){let{className:t,sideOffset:s=0,children:r,...i}=e;return(0,a.jsx)(P.Portal,{children:(0,a.jsxs)(P.Content,{"data-slot":"tooltip-content",sideOffset:s,className:(0,n.cn)("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...i,children:[r,(0,a.jsx)(P.Arrow,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}let D=e=>{let{children:t,className:s,...r}=e;return(0,a.jsx)("div",{className:(0,n.cn)("flex gap-3",s),...r,children:t})},T=e=>{let{children:t,markdown:s=!1,className:r,...i}=e,l=(0,n.cn)("rounded-lg p-2 text-foreground bg-secondary prose break-words whitespace-normal",r);return s?(0,a.jsx)(L,{className:l,...i,children:t}):(0,a.jsx)("div",{className:l,...i,children:t})},$=e=>{let{children:t,className:s,...r}=e;return(0,a.jsx)("div",{className:(0,n.cn)("text-muted-foreground flex items-center gap-2",s),...r,children:t})};var V=s(12456),B=s(53235);function F(e){let{className:t,variant:s="outline",size:i="sm",...l}=e,{isAtBottom:o,scrollToBottom:c}=(0,r.B)();return(0,a.jsx)(V.$,{variant:s,size:i,className:(0,n.cn)("h-10 w-10 rounded-full transition-all duration-150 ease-out",o?"pointer-events-none translate-y-4 scale-95 opacity-0":"translate-y-0 scale-100 opacity-100",t),onClick:()=>c(),...l,children:(0,a.jsx)(B.A,{className:"h-5 w-5"})})}var J=s(34371);function G(e){let{...t}=e;return(0,a.jsx)(J.Root,{"data-slot":"collapsible",...t})}function H(e){let{...t}=e;return(0,a.jsx)(J.CollapsibleTrigger,{"data-slot":"collapsible-trigger",...t})}function U(e){let{...t}=e;return(0,a.jsx)(J.CollapsibleContent,{"data-slot":"collapsible-content",...t})}var W=s(51677),Y=s(78264),X=s(35003),K=s(35976);let Q=e=>{let{toolPart:t,defaultOpen:s=!1,className:r}=e,[i,l]=(0,o.useState)(s),{state:c,input:d,output:u,toolCallId:x}=t,m=e=>null===e?"null":void 0===e?"undefined":"string"==typeof e?e:"object"==typeof e?JSON.stringify(e,null,2):String(e);return(0,a.jsx)("div",{className:(0,n.cn)("border-border mt-3 overflow-hidden rounded-lg border",r),children:(0,a.jsxs)(G,{open:i,onOpenChange:l,children:[(0,a.jsx)(H,{asChild:!0,children:(0,a.jsxs)(V.$,{variant:"ghost",className:"bg-background h-auto w-full justify-between rounded-b-none px-3 py-2 font-normal",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(()=>{switch(c){case"input-streaming":return(0,a.jsx)(W.A,{className:"h-4 w-4 animate-spin text-blue-500"});case"input-available":return(0,a.jsx)(Y.A,{className:"h-4 w-4 text-orange-500"});case"output-available":return(0,a.jsx)(X.A,{className:"h-4 w-4 text-green-500"});case"output-error":return(0,a.jsx)(K.A,{className:"h-4 w-4 text-red-500"});default:return(0,a.jsx)(Y.A,{className:"text-muted-foreground h-4 w-4"})}})(),(0,a.jsx)("span",{className:"font-mono text-sm font-medium",children:t.type}),(()=>{let e="px-2 py-1 rounded-full text-xs font-medium";switch(c){case"input-streaming":return(0,a.jsx)("span",{className:(0,n.cn)(e,"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400"),children:"Processing"});case"input-available":return(0,a.jsx)("span",{className:(0,n.cn)(e,"bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400"),children:"Ready"});case"output-available":return(0,a.jsx)("span",{className:(0,n.cn)(e,"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400"),children:"Completed"});case"output-error":return(0,a.jsx)("span",{className:(0,n.cn)(e,"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400"),children:"Error"});default:return(0,a.jsx)("span",{className:(0,n.cn)(e,"bg-gray-100 text-gray-700 dark:bg-gray-900/30 dark:text-gray-400"),children:"Pending"})}})()]}),(0,a.jsx)(B.A,{className:(0,n.cn)("h-4 w-4 transition-transform",i&&"rotate-180")})]})}),(0,a.jsx)(U,{className:"border-border border-t",children:(0,a.jsxs)("div",{className:"bg-background space-y-3 p-3",children:[d&&Object.keys(d).length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-muted-foreground mb-2 text-sm font-medium",children:"Input"}),(0,a.jsx)("div",{className:"bg-background rounded border p-2 font-mono text-sm",children:Object.entries(d).map(e=>{let[t,s]=e;return(0,a.jsxs)("div",{className:"mb-1",children:[(0,a.jsxs)("span",{className:"text-muted-foreground",children:[t,":"]})," ",(0,a.jsx)("span",{children:m(s)})]},t)})})]}),u&&(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-muted-foreground mb-2 text-sm font-medium",children:"Output"}),(0,a.jsx)("div",{className:"bg-background max-h-60 overflow-auto rounded border p-2 font-mono text-sm",children:(0,a.jsx)("pre",{className:"whitespace-pre-wrap",children:m(u)})})]}),"output-error"===c&&t.errorText&&(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"mb-2 text-sm font-medium text-red-500",children:"Error"}),(0,a.jsx)("div",{className:"bg-background rounded border border-red-200 p-2 text-sm dark:border-red-950 dark:bg-red-900/20",children:t.errorText})]}),"input-streaming"===c&&(0,a.jsx)("div",{className:"text-muted-foreground text-sm",children:"Processing tool call..."}),x&&(0,a.jsx)("div",{className:"text-muted-foreground border-t border-blue-200 pt-2 text-xs",children:(0,a.jsxs)("span",{className:"font-mono",children:["Call ID: ",x]})})]})})]})})};function q(e){let{messages:t}=e;return(0,a.jsx)("div",{className:"flex flex-1 h-full w-full flex-col overflow-hidden relative",children:(0,a.jsxs)(i,{className:"flex-1",children:[(0,a.jsx)(l,{className:"space-y-4 py-4 px-2",children:t.map(e=>{var t,s;let n="assistant"===e.role;return(0,a.jsx)(D,{className:"user"===e.role?"justify-end":"justify-start",children:(0,a.jsx)("div",{className:"min-w-0 max-w-[85%] flex-1 sm:max-w-[75%]",children:n?(0,a.jsx)(a.Fragment,{children:e.parts&&e.parts.length>0&&(null==(t=e.parts[0])?void 0:t.text)!==void 0&&(null==(s=e.parts[0])?void 0:s.text)!==""?e.parts.map(t=>"text"===t.type?(0,a.jsx)("div",{className:"mr-auto max-w-fit min-w-0 text-foreground bg-muted prose rounded-lg px-3 py-2",children:(0,a.jsx)(L,{children:t.text})},t.id||"".concat(e.id,"-text")):t.type.startsWith("tool-")?(0,a.jsx)(Q,{className:"w-full max-w-md",toolPart:{type:t.type.replace("tool-",""),state:t.state,input:t.input,output:t.output,errorText:t.errorText}},t.id||"".concat(e.id,"-tool-").concat(t.type)):void 0):(0,a.jsx)(N,{variant:"pulse-dot",size:"md"})}):(0,a.jsxs)("div",{className:"flex flex-col group gap-1",children:[(0,a.jsx)(T,{className:"ml-auto max-w-fit min-w-0 rounded-lg bg-primary text-primary-foreground px-3 py-2",children:e.parts[0].text}),(0,a.jsx)($,{className:"justify-end ml-2.5 flex gap-0 opacity-0 transition-opacity duration-150 group-hover:opacity-100",children:(0,a.jsx)("span",{className:"text-sm text-muted-foreground",children:"51 tokens"})})]})})},e.id)})}),(0,a.jsx)("div",{className:"absolute right-7 bottom-4",children:(0,a.jsx)(F,{className:"shadow-sm"})})]})})}var Z=s(4891);let ee=(0,s(79932).F)("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function et(e){let{className:t,variant:s,asChild:r=!1,...i}=e,l=r?Z.DX:"span";return(0,a.jsx)(l,{"data-slot":"badge",className:(0,n.cn)(ee({variant:s}),t),...i})}let es=e=>{let{className:t,status:s,...r}=e;return(0,a.jsx)(et,{className:(0,n.cn)("flex items-center gap-2","group",s,t),variant:"secondary",...r})},ea=e=>{let{className:t,...s}=e;return(0,a.jsxs)("span",{className:"relative flex h-2 w-2",...s,children:[(0,a.jsx)("span",{className:(0,n.cn)("absolute inline-flex h-full w-full animate-ping rounded-full opacity-75","group-[.online]:bg-emerald-500","group-[.offline]:bg-red-500","group-[.maintenance]:bg-blue-500","group-[.degraded]:bg-amber-500")}),(0,a.jsx)("span",{className:(0,n.cn)("relative inline-flex h-2 w-2 rounded-full","group-[.online]:bg-emerald-500","group-[.offline]:bg-red-500","group-[.maintenance]:bg-blue-500","group-[.degraded]:bg-amber-500")})]})},en=e=>{let{className:t,children:s,...r}=e;return(0,a.jsx)("span",{className:(0,n.cn)("text-muted-foreground",t),...r,children:null!=s?s:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"hidden group-[.online]:block",children:"Online"}),(0,a.jsx)("span",{className:"hidden group-[.offline]:block",children:"Offline"}),(0,a.jsx)("span",{className:"hidden group-[.maintenance]:block",children:"Maintenance"}),(0,a.jsx)("span",{className:"hidden group-[.degraded]:block",children:"Degraded"})]})})};function er(e){let{className:t,...s}=e;return(0,a.jsx)("textarea",{"data-slot":"textarea",className:(0,n.cn)("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),...s})}let ei=(0,o.createContext)({isLoading:!1,value:"",setValue:()=>{},maxHeight:240,onSubmit:void 0,disabled:!1,textareaRef:o.createRef()});function el(){let e=(0,o.useContext)(ei);if(!e)throw Error("usePromptInput must be used within a PromptInput");return e}function eo(e){let{className:t,isLoading:s=!1,maxHeight:r=240,value:i,onValueChange:l,onSubmit:c,children:d}=e,[u,x]=(0,o.useState)(i||""),m=(0,o.useRef)(null);return(0,a.jsx)(M,{children:(0,a.jsx)(ei.Provider,{value:{isLoading:s,value:null!=i?i:u,setValue:null!=l?l:e=>{x(e),null==l||l(e)},maxHeight:r,onSubmit:c,textareaRef:m},children:(0,a.jsx)("div",{className:(0,n.cn)("border-input bg-background cursor-text rounded-3xl border p-2 shadow-xs",t),onClick:()=>{var e;return null==(e=m.current)?void 0:e.focus()},children:d})})})}function ec(e){let{className:t,onKeyDown:s,disableAutosize:r=!1,...i}=e,{value:l,setValue:c,maxHeight:d,onSubmit:u,disabled:x,textareaRef:m}=el();return(0,o.useEffect)(()=>{!r&&m.current&&(m.current.style.height="auto",m.current.style.height="number"==typeof d?"".concat(Math.min(m.current.scrollHeight,d),"px"):"min(".concat(m.current.scrollHeight,"px, ").concat(d,")"))},[l,d,r]),(0,a.jsx)(er,{ref:m,value:l,onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),null==u||u()),null==s||s(e)},className:(0,n.cn)("text-primary min-h-[44px] w-full resize-none border-none bg-transparent shadow-none outline-none focus-visible:ring-0 focus-visible:ring-offset-0",t),rows:1,disabled:x,...i})}function ed(e){let{children:t,className:s,...r}=e;return(0,a.jsx)("div",{className:(0,n.cn)("flex items-center gap-2",s),...r,children:t})}function eu(e){let{tooltip:t,children:s,className:n,side:r="top",...i}=e,{disabled:l}=el();return(0,a.jsxs)(I,{...i,children:[(0,a.jsx)(E,{asChild:!0,disabled:l,onClick:e=>e.stopPropagation(),children:s}),(0,a.jsx)(O,{side:r,className:n,children:t})]})}var ex=s(64393);let em=(0,ex.v)(e=>({agent:{name:"",description:"",instruction:"",model_name:"",short_term_memory_backend:"",short_term_memory_db_url:"",long_term_memory_backend:"",knowledgebase_backend:""},setAgent:t=>e(e=>({agent:{...e.agent,...t}}))}));var ep=s(73570),eh=s(78044);function ef(e){let{sendMessage:t}=e,{agent:s,setAgent:n}=em(),[r,i]=(0,o.useState)(!1),[l,c]=(0,o.useState)("");return(0,a.jsxs)(eo,{value:l,onValueChange:e=>{c(e)},isLoading:r,onSubmit:()=>{t({text:l}),c("")},className:"w-full",children:[(0,a.jsx)(ec,{placeholder:"Ask me anything...",className:"min-h-[66px]"}),(0,a.jsxs)(ed,{className:"flex pt-2 justify-between",children:[(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsx)(eu,{tooltip:"Active agent",children:(0,a.jsxs)(es,{status:"online",children:[(0,a.jsx)(ea,{}),(0,a.jsx)(en,{children:s.name})]})})}),(0,a.jsx)(eu,{tooltip:r?"Stop generation":"Send message",children:(0,a.jsx)(V.$,{variant:"default",size:"icon",className:"h-8 w-8 rounded-full ml-auto cursor-pointer",onClick:()=>{t({text:l}),c("")},children:r?(0,a.jsx)(ep.A,{className:"size-5 fill-current"}):(0,a.jsx)(eh.A,{className:"size-5"})})})]})]})}var eg=s(78446),ej=s(46148),ev=s(73250),eb=s(96159),eN=s(48367),ew=s(19779);let ey=(0,o.forwardRef)((e,t)=>{let{onMouseEnter:s,onMouseLeave:r,className:i,size:l=28,...c}=e,d=(0,eN.s)(),u=(0,o.useRef)(!1);(0,o.useImperativeHandle)(t,()=>(u.current=!0,{startAnimation:()=>d.start("animate"),stopAnimation:()=>d.start("normal")}));let x=(0,o.useCallback)(e=>{u.current?null==s||s(e):d.start("animate")},[d,s]),m=(0,o.useCallback)(e=>{u.current?null==r||r(e):d.start("normal")},[d,r]);return(0,a.jsx)("div",{className:(0,n.cn)(i),onMouseEnter:x,onMouseLeave:m,...c,children:(0,a.jsxs)(ew.P.svg,{xmlns:"http://www.w3.org/2000/svg",width:l,height:l,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",transition:{type:"spring",stiffness:50,damping:10},variants:{normal:{rotate:0},animate:{rotate:180}},animate:d,children:[(0,a.jsx)("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),(0,a.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})})});ey.displayName="SettingsGearIcon";var e_=s(54426);let ek="http://127.0.0.1:8000",eC=e_.Ay.create({prefixUrl:ek,timeout:6e5}),ez=(0,ex.v)(e=>({runnerConfig:{app_name:"",user_id:"",session_id:""},setRunnerConfig:t=>e(e=>({runnerConfig:{...e.runnerConfig,...t}}))}));var eA=s(77603),eS=s(64784),eR=s(86408);let eL={normal:{pathLength:1,opacity:1},animate:{pathLength:[0,1],opacity:[0,1],transition:{delay:.15,duration:.3,opacity:{delay:.1}}}},eP=(0,o.forwardRef)((e,t)=>{let{onMouseEnter:s,onMouseLeave:r,className:i,size:l=28,...c}=e,d=(0,eN.s)(),u=(0,o.useRef)(!1);(0,o.useImperativeHandle)(t,()=>(u.current=!0,{startAnimation:()=>d.start("animate"),stopAnimation:()=>d.start("normal")}));let x=(0,o.useCallback)(e=>{u.current?null==s||s(e):d.start("animate")},[d,s]),m=(0,o.useCallback)(e=>{u.current?null==r||r(e):d.start("normal")},[d,r]);return(0,a.jsx)("div",{className:(0,n.cn)(i),onMouseEnter:x,onMouseLeave:m,...c,children:(0,a.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:l,height:l,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),(0,a.jsx)(ew.P.path,{d:"M7 16c.5-2 1.5-7 4-7 2 0 2 3 4 3 2.5 0 4.5-5 5-7",variants:eL,animate:d})]})})});eP.displayName="ChartSplineIcon";var eM=s(8520);function eI(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:(0,a.jsx)("table",{"data-slot":"table",className:(0,n.cn)("w-full caption-bottom text-sm",t),...s})})}function eE(e){let{className:t,...s}=e;return(0,a.jsx)("thead",{"data-slot":"table-header",className:(0,n.cn)("[&_tr]:border-b",t),...s})}function eO(e){let{className:t,...s}=e;return(0,a.jsx)("tbody",{"data-slot":"table-body",className:(0,n.cn)("[&_tr:last-child]:border-0",t),...s})}function eD(e){let{className:t,...s}=e;return(0,a.jsx)("tr",{"data-slot":"table-row",className:(0,n.cn)("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",t),...s})}function eT(e){let{className:t,...s}=e;return(0,a.jsx)("th",{"data-slot":"table-head",className:(0,n.cn)("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...s})}function e$(e){let{className:t,...s}=e;return(0,a.jsx)("td",{"data-slot":"table-cell",className:(0,n.cn)("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...s})}function eV(e){let{className:t,...s}=e;return(0,a.jsx)("caption",{"data-slot":"table-caption",className:(0,n.cn)("text-muted-foreground mt-4 text-sm",t),...s})}let eB=(0,ex.v)(e=>({feedback:"",refineButtonRef:null,setFeedback:t=>e({feedback:t}),setRefineButtonRef:t=>e({refineButtonRef:t})}));function eF(e){let{testCases:t}=e,{setFeedback:s,refineButtonRef:n}=eB();async function r(e){s(e),null==n||n.current.click()}return(0,a.jsx)("div",{className:"flex w-full",children:(0,a.jsxs)(eI,{className:"table-fixed",children:[(0,a.jsx)(eV,{children:"A list of available test cases."}),(0,a.jsx)(eE,{children:(0,a.jsxs)(eD,{children:[(0,a.jsx)(eT,{className:"w-1/12 text-ellipsis",children:"Input"}),(0,a.jsx)(eT,{className:"w-2/12 text-ellipsis",children:"Expected output"}),(0,a.jsx)(eT,{className:"w-3/12 text-ellipsis",children:"Actual output"}),(0,a.jsx)(eT,{className:"w-3/12 text-ellipsis",children:"Reason"}),(0,a.jsx)(eT,{className:"w-1/12 text-ellipsis",children:"Score"}),(0,a.jsx)(eT,{className:"w-2/12 text-ellipsis"})]})}),(0,a.jsx)(eO,{children:t&&t.map((e,t)=>e.map((e,s)=>(0,a.jsxs)(eD,{children:[(0,a.jsx)(e$,{className:"w-1/12 truncate",children:e.input}),(0,a.jsx)(e$,{className:"w-2/12 truncate",children:e.expected_output}),(0,a.jsx)(e$,{className:"w-3/12 truncate",title:e.actual_output,children:e.actual_output}),(0,a.jsx)(e$,{className:"w-3/12 truncate",title:e.reason,children:e.reason}),(0,a.jsx)(e$,{className:"w-1/12",children:e.score}),(0,a.jsx)(e$,{className:"w-2/12",children:(0,a.jsx)(V.$,{variant:"secondary",className:"cursor-pointer",disabled:""===e.reason,onClick:()=>r(e.reason),children:"Refine prompt"})})]},(t+1)*(s+1))))})]})})}function eJ(){let[e,t]=(0,o.useState)(null),[s,n]=(0,o.useState)(!1);async function r(){t((await eC.get("get_testcases").json()).test_cases)}async function i(){n(!0),t((await eC.get("evaluate",{timeout:6e5}).json()).test_cases),n(!1)}return(0,a.jsxs)(eM.lG,{onOpenChange:r,children:[(0,a.jsxs)(I,{children:[(0,a.jsx)(E,{asChild:!0,children:(0,a.jsx)(eM.zM,{asChild:!0,children:(0,a.jsx)(V.$,{size:"icon",variant:"secondary",className:"cursor-pointer",onClick:()=>{},children:(0,a.jsx)(eP,{className:"text-blue-500"})})})}),(0,a.jsx)(O,{children:"Evaluate"})]}),(0,a.jsxs)(eM.Cf,{className:"flex flex-col min-w-4/5 max-w-4/5 max-h-3/4",children:[(0,a.jsxs)(eM.c7,{className:"flex",children:[(0,a.jsx)(eM.L3,{children:"Evaluation invocations"}),(0,a.jsx)(eM.rr,{children:"with DeepEval"})]}),(0,a.jsxs)("div",{className:"flex flex-col flex-1 min-h-0 gap-3",children:[(0,a.jsx)("div",{className:"flex-1 min-h-0 overflow-y-scroll",children:(0,a.jsx)(eF,{testCases:e})}),(0,a.jsx)("div",{className:"flex justify-end",children:(0,a.jsx)(V.$,{className:"cursor-pointer",disabled:s,onClick:i,children:"Evaluate"})})]})]})]})}var eG=s(26020),eH=s(36663);function eU(){let{agent:e,setAgent:t}=em(),s=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useRef)(null),i=(0,o.useRef)(null),{feedback:l,setFeedback:c,setRefineButtonRef:d}=eB(),[u,x]=(0,o.useState)(e.instruction),[m,p]=(0,o.useState)(""),[h,f]=(0,o.useState)(!1);async function g(){await eC.get("set_prompt?prompt="+u),t({...e,instruction:u}),(0,eR.oR)("Agent instruction has been updated",{action:{label:"Got it",onClick:()=>console.log("Undo")}})}async function j(){f(!0),p((await eC.get("refine_prompt?feedback="+l,{timeout:6e5}).json()).prompt),f(!0)}async function v(){await eC.get("set_prompt?prompt="+m,{timeout:6e5}),x(m),c(""),p(""),t({...e,instruction:m}),(0,eR.oR)("Agent instruction has been updated",{action:{label:"Got it",onClick:()=>console.log("Undo")}})}return(0,o.useEffect)(()=>{x(e.instruction)},[e.instruction]),(0,o.useEffect)(()=>{d(i)},[]),(0,a.jsxs)(eM.lG,{children:[(0,a.jsxs)(I,{children:[(0,a.jsx)(E,{asChild:!0,children:(0,a.jsx)(eM.zM,{asChild:!0,children:(0,a.jsx)(V.$,{size:"icon",variant:"secondary",className:"cursor-pointer",ref:i,children:(0,a.jsx)(eH.YhQ,{className:"text-blue-500"})})})}),(0,a.jsx)(O,{children:"Refine prompt"})]}),(0,a.jsxs)(eM.Cf,{className:"flex flex-col min-w-4/5 max-w-4/5 min-h-1/2 max-h-full gap-1",style:{zIndex:9999},children:[(0,a.jsxs)(eM.c7,{className:"flex",children:[(0,a.jsx)(eM.L3,{children:"Refine instruction"}),(0,a.jsx)(eM.rr,{children:"make your agent system prompt powerful with Volcengine AgentPilot"})]}),(0,a.jsxs)("div",{className:"flex flex-1 flex-row gap-5 min-h-0",children:[(0,a.jsxs)("div",{className:"flex flex-1 flex-col min-h-0 mt-3 w-full gap-3",children:[(0,a.jsx)("span",{className:"flex text-sm font-medium",children:"Current prompt"}),(0,a.jsx)(er,{ref:s,className:"flex-1 w-full resize-none min-h-0",value:u,onChange:e=>x(e.target.value)}),(0,a.jsx)(V.$,{type:"button",className:"w-1/3 ml-auto cursor-pointer",onClick:g,children:"Update"})]}),(0,a.jsxs)("div",{className:"flex flex-1 flex-col min-h-0 mt-3 w-full gap-3 min-h-0",children:[(0,a.jsx)("span",{className:"flex text-sm font-medium",children:"Optimizer prompt"}),(0,a.jsx)(er,{ref:n,className:"w-full flex-1 min-h-0 resize-none",value:l,onChange:e=>c(e.target.value),placeholder:"Make my prompt more clearer ...",rows:5}),(0,a.jsx)(V.$,{type:"button",className:"w-1/3 ml-auto cursor-pointer",onClick:j,disabled:h,children:"Optimize"})]}),(0,a.jsxs)("div",{className:"flex flex-1 flex-col min-h-0 mt-3 w-full gap-3",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:"Optimized prompt"}),(0,a.jsx)(er,{ref:r,className:"w-full flex-1 min-h-0 resize-none",value:m,onChange:e=>p(e.target.value),rows:5,placeholder:"Optimized prompt will be rendered here."}),(0,a.jsxs)(V.$,{type:"button",className:"w-1/3 ml-auto cursor-pointer",onClick:v,children:[(0,a.jsx)(eG.A,{})," Use this"]})]})]})]})]})}var eW=s(2472);function eY(){let{agent:e}=em();async function t(){console.log(await eC.get("save_session").json())}return(0,a.jsxs)(eM.lG,{children:[(0,a.jsxs)(I,{children:[(0,a.jsx)(E,{asChild:!0,children:(0,a.jsx)(eM.zM,{asChild:!0,children:(0,a.jsx)(V.$,{size:"icon",variant:"secondary",className:"cursor-pointer",disabled:!e.long_term_memory_backend,children:(0,a.jsx)(eW.A,{className:"size-5 text-blue-500"})})})}),(0,a.jsx)(O,{children:(0,a.jsx)("p",{children:"Save session"})})]}),(0,a.jsxs)(eM.Cf,{className:"min-w-3xl max-w-3xl",children:[(0,a.jsxs)(eM.c7,{children:[(0,a.jsx)(eM.L3,{children:"Save session"}),(0,a.jsx)(eM.rr,{children:"Are you sure saving session to your long-term memory?"})]}),(0,a.jsxs)("div",{className:"flex flex-row w-full gap-4 justify-end",children:[(0,a.jsx)(eM.HM,{asChild:!0,children:(0,a.jsx)(V.$,{className:"flex w-1/5 cursor-pointer",variant:"outline",children:"No"})}),(0,a.jsx)(V.$,{className:"flex w-1/5 cursor-pointer",onClick:t,children:"Yes"})]})]})]})}var eX=s(39403),eK=s(81223),eQ=s(4972),eq=s(20610),eZ=s(9430);function e0(e){let{data:t,rootName:s="root",defaultExpanded:r=!0,className:i}=e;return(0,a.jsx)(M,{children:(0,a.jsx)("div",{className:(0,n.cn)("font-mono text-sm",i),children:(0,a.jsx)(e2,{name:s,data:t,isRoot:!0,defaultExpanded:r})})})}function e2(e){let{name:t,data:s,isRoot:r=!1,defaultExpanded:i=!0,level:l=0}=e,[c,d]=o.useState(i),[u,x]=o.useState(!1),m=null===s?"null":Array.isArray(s)?"array":typeof s,p=null!=s&&!(s instanceof Date)&&("object"===m||"array"===m),h=p&&null!=s?Object.keys(s).length:0;return(0,a.jsxs)("div",{className:(0,n.cn)("pl-4 group/object",l>0&&"border-l border-border"),children:[(0,a.jsxs)("div",{className:(0,n.cn)("flex items-center gap-1 py-1 hover:bg-muted/50 rounded px-1 -ml-4 cursor-pointer group/property",r&&"text-primary font-semibold"),onClick:p?()=>{d(!c)}:void 0,children:[p?(0,a.jsx)("div",{className:"w-4 h-4 flex items-center justify-center",children:c?(0,a.jsx)(B.A,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,a.jsx)(eX.A,{className:"h-3.5 w-3.5 text-muted-foreground"})}):(0,a.jsx)("div",{className:"w-4"}),(0,a.jsx)("span",{className:"text-primary",children:t}),(0,a.jsx)("span",{className:"text-muted-foreground",children:p?(0,a.jsxs)(a.Fragment,{children:["array"===m?"[":"{",!c&&(0,a.jsxs)("span",{className:"text-muted-foreground",children:[" ",h," ",1===h?"item":"items"," ","array"===m?"]":"}"]})]}):":"}),!p&&(0,a.jsx)(e1,{data:s}),!p&&(0,a.jsx)("div",{className:"w-3.5"}),(0,a.jsx)("button",{onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(JSON.stringify(s,null,2)),x(!0),setTimeout(()=>x(!1),2e3)},className:"ml-auto opacity-0 group-hover/property:opacity-100 hover:bg-muted p-1 rounded",title:"Copy to clipboard",children:u?(0,a.jsx)(eK.A,{className:"h-3.5 w-3.5 text-green-500"}):(0,a.jsx)(eQ.A,{className:"h-3.5 w-3.5 text-muted-foreground"})})]}),p&&c&&null!=s&&(0,a.jsxs)("div",{className:"pl-4",children:[Object.keys(s).map(e=>(0,a.jsx)(e2,{name:"array"===m?"".concat(e):e,data:s[e],level:l+1,defaultExpanded:l<1},e)),(0,a.jsx)("div",{className:"text-muted-foreground pl-4 py-1",children:"array"===m?"]":"}"})]})]})}function e1(e){let{data:t}=e,[s,n]=o.useState(!1),r=typeof t;if(null===t)return(0,a.jsx)("span",{className:"text-rose-500",children:"null"});if(void 0===t)return(0,a.jsx)("span",{className:"text-muted-foreground",children:"undefined"});if(t instanceof Date)return(0,a.jsx)("span",{className:"text-purple-500",children:t.toISOString()});switch(r){case"string":if(t.length>80)return(0,a.jsxs)("div",{className:"text-emerald-500 flex-1 flex items-center relative group cursor-pointer",onClick:e=>{e.stopPropagation(),n(!s)},children:['"',s?(0,a.jsx)("span",{className:"inline-block max-w-full",children:t}):(0,a.jsxs)(I,{delayDuration:300,children:[(0,a.jsx)(E,{asChild:!0,children:(0,a.jsxs)("span",{className:"inline-block max-w-full",children:[t.substring(0,80),"..."]})}),(0,a.jsx)(O,{side:"bottom",className:"max-w-md text-xs p-2 break-words",children:t})]}),'"',(0,a.jsx)("div",{className:"absolute right-0 top-1/2 -translate-y-1/2 translate-x-[calc(100%+4px)] opacity-0 group-hover:opacity-100 transition-opacity",children:s?(0,a.jsx)(eq.A,{className:"h-3 w-3 text-muted-foreground"}):(0,a.jsx)(eZ.A,{className:"h-3 w-3 text-muted-foreground"})})]});return(0,a.jsx)("span",{className:"text-emerald-500",children:'"'.concat(t,'"')});case"number":return(0,a.jsx)("span",{className:"text-amber-500",children:t});case"boolean":return(0,a.jsx)("span",{className:"text-blue-500",children:t.toString()});default:return(0,a.jsx)("span",{children:String(t)})}}let e5={normal:{opacity:1,pathLength:1,pathOffset:0,transition:{duration:.4,opacity:{duration:.1}}},animate:{opacity:[0,1],pathLength:[0,1],pathOffset:[1,0],transition:{duration:.6,ease:"linear",opacity:{duration:.1}}}},e3=(0,o.forwardRef)((e,t)=>{let{onMouseEnter:s,onMouseLeave:r,className:i,size:l=28,...c}=e,d=(0,eN.s)(),u=(0,o.useRef)(!1);(0,o.useImperativeHandle)(t,()=>(u.current=!0,{startAnimation:()=>d.start("animate"),stopAnimation:()=>d.start("normal")}));let x=(0,o.useCallback)(e=>{u.current?null==s||s(e):d.start("animate")},[d,s]),m=(0,o.useCallback)(e=>{u.current?null==r||r(e):d.start("normal")},[d,r]);return(0,a.jsx)("div",{className:(0,n.cn)(i),onMouseEnter:x,onMouseLeave:m,...c,children:(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:l,height:l,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)(ew.P.path,{variants:e5,animate:d,initial:"normal",d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"})})})});e3.displayName="ActivityIcon";var e4=s(41940);function e7(e){let{className:t,...s}=e;return(0,a.jsx)(e4.Root,{"data-slot":"tabs",className:(0,n.cn)("flex flex-col gap-2",t),...s})}function e9(e){let{className:t,...s}=e;return(0,a.jsx)(e4.List,{"data-slot":"tabs-list",className:(0,n.cn)("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",t),...s})}function e6(e){let{className:t,...s}=e;return(0,a.jsx)(e4.Trigger,{"data-slot":"tabs-trigger",className:(0,n.cn)("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...s})}function e8(e){let{className:t,...s}=e;return(0,a.jsx)(e4.Content,{"data-slot":"tabs-content",className:(0,n.cn)("flex-1 outline-none",t),...s})}function te(e){let{spans:t,setEventData:s,setAttributes:n}=e;return(0,a.jsx)("div",{className:"flex flex-col gap-3",children:t.map((e,t)=>(0,a.jsx)("div",{className:"pb-2 border-b border-gray-200",children:(0,a.jsx)(tt,{span:e,indent:0,setEventData:s,setAttributes:n},e.span_id)},e.span_id+t))})}function tt(e){let{span:t,indent:s,setEventData:n,setAttributes:r}=e;async function i(e){n(JSON.parse((await eC.get("get_event?event_id=".concat(e)).json()).event)),r(t.attributes)}return(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex flex-row items-center gap-2 hover:bg-gray-100 hover:rounded-sm px-2 py-1 cursor-pointer",onClick:()=>i(t.event_id),children:[(0,a.jsx)("div",{className:"w-1/2 font-mono text-sm",style:{paddingLeft:"".concat(s,"rem")},children:t.name}),(0,a.jsx)("div",{className:"flex w-1/4 justify-end",children:(0,a.jsx)("div",{className:" bg-blue-500 h-4 rounded",style:{width:"".concat(t.latency_proportion,"%")}})}),(0,a.jsx)("div",{className:"flex w-1/4 justify-end",children:(0,a.jsxs)("span",{className:"text-sm text-muted-foreground",children:[t.latency," ms"]})})]}),t.childs&&t.childs.length>0&&(0,a.jsx)("div",{children:t.childs.map(e=>(0,a.jsx)(tt,{span:e,indent:s+1,setEventData:n,setAttributes:r},e.span_id))})]})}function ts(){var e;let[t,s]=(0,o.useState)([]),[n,r]=(0,o.useState)(),[i,l]=(0,o.useState)(),[c,d]=(0,o.useState)(),[u,x]=(0,o.useState)(!1);async function m(e){if(e){let e=await eC.get("get_tracing").json();r(e),s(e.root_spans)}x(e)}return(0,a.jsxs)(eM.lG,{open:u,onOpenChange:m,children:[(0,a.jsxs)(I,{children:[(0,a.jsx)(E,{asChild:!0,children:(0,a.jsx)(eM.zM,{asChild:!0,children:(0,a.jsx)(V.$,{size:"icon",variant:"secondary",className:"cursor-pointer",children:(0,a.jsx)(e3,{className:"text-blue-500"})})})}),(0,a.jsx)(O,{children:"Tracing"})]}),(0,a.jsxs)(eM.Cf,{className:"flex flex-col max-w-3/4 min-w-3/4 min-h-[80vh] max-h-[80vh]",children:[(0,a.jsxs)(eM.c7,{className:"flex",children:[(0,a.jsx)(eM.L3,{children:"Tracing for your agent"}),(0,a.jsxs)(eM.rr,{children:["Trace ID: ",null==n||null==(e=n.root_spans[0])?void 0:e.trace_id]})]}),(0,a.jsxs)("div",{className:"flex flex-row flex-1 min-h-0",children:[(0,a.jsx)("div",{className:"overflow-auto w-1/2 pr-2 border-r border-gray-200",children:(0,a.jsxs)(e7,{defaultValue:"graph",className:"",children:[(0,a.jsxs)(e9,{children:[(0,a.jsx)(e6,{value:"graph",children:"Graph"}),(0,a.jsx)(e6,{value:"text",children:"Text"})]}),(0,a.jsx)(e8,{value:"graph",children:t&&t.length>0?(0,a.jsx)(te,{spans:t,setEventData:l,setAttributes:d}):(0,a.jsx)("span",{className:"text-muted-foreground text-sm",children:"No conversation founded."})}),(0,a.jsx)(e8,{value:"text",children:(0,a.jsx)(e0,{data:n,rootName:""})})]})}),(0,a.jsx)("div",{className:"overflow-auto w-1/2 pl-2",children:(0,a.jsxs)(e7,{defaultValue:"event",className:"",children:[(0,a.jsxs)(e9,{children:[(0,a.jsx)(e6,{value:"event",children:"Event"}),(0,a.jsx)(e6,{value:"attr",children:"Attributions"})]}),(0,a.jsx)(e8,{value:"event",children:i?(0,a.jsx)(e0,{data:i,rootName:""}):(0,a.jsx)("span",{className:"text-muted-foreground text-sm",children:"Choose an event from left side"})}),(0,a.jsx)(e8,{value:"attr",children:(0,a.jsx)(e0,{data:c,rootName:""})})]})})]})]})]})}function ta(){let{agent:e,setAgent:t}=em(),{runnerConfig:s,setRunnerConfig:n}=ez(),r=(0,eA.mN)({defaultValues:{app_name:s.app_name,user_id:s.user_id,session_id:s.session_id}});async function i(e){n(await eC.get("set_runner_config?app_name=".concat(e.app_name,"&user_id=").concat(e.user_id,"&session_id=").concat(e.session_id)).json()),(0,eR.oR)("Runner config has been updated",{action:{label:"Got it",onClick:()=>console.log("Undo")}})}return(0,o.useEffect)(()=>{r.reset({app_name:s.app_name,user_id:s.user_id,session_id:s.session_id})},[s,r]),(0,a.jsxs)("div",{className:"flex flex-row gap-3 items-center",children:[(0,a.jsxs)("div",{className:"flex flex-1 mr-auto gap-3 border-r border-r-border items-center",children:[(0,a.jsx)("img",{src:"https://avatar.iran.liara.run/username?username=".concat(e.name),className:"size-10 rounded-full shadow-md"}),(0,a.jsx)("div",{className:"font-bold",children:e.name})]}),(0,a.jsxs)("div",{className:"flex ml-auto gap-3",children:[(0,a.jsxs)(eb.Popover,{children:[(0,a.jsx)(eb.PopoverTrigger,{asChild:!0,children:(0,a.jsx)(V.$,{size:"icon",variant:"secondary",className:"cursor-pointer",children:(0,a.jsx)(ey,{})})}),(0,a.jsx)(eb.PopoverContent,{children:(0,a.jsx)(eg.lV,{...r,children:(0,a.jsxs)("form",{onSubmit:r.handleSubmit(i),className:"flex flex-col gap-3",children:[(0,a.jsx)(eg.zB,{control:r.control,name:"app_name",render:e=>{let{field:t}=e;return(0,a.jsxs)(eg.eI,{children:[(0,a.jsx)(eg.lR,{children:"APP name"}),(0,a.jsx)(eg.MJ,{children:(0,a.jsx)(ej.p,{...t})})]})}}),(0,a.jsx)(eg.zB,{control:r.control,name:"user_id",render:e=>{let{field:t}=e;return(0,a.jsxs)(eg.eI,{children:[(0,a.jsx)(eg.lR,{children:"User ID"}),(0,a.jsx)(eg.MJ,{children:(0,a.jsx)(ej.p,{...t})})]})}}),(0,a.jsx)(eg.zB,{control:r.control,name:"session_id",render:e=>{let{field:t}=e;return(0,a.jsxs)(eg.eI,{children:[(0,a.jsx)(eg.lR,{children:"Session ID"}),(0,a.jsx)(eg.MJ,{children:(0,a.jsx)(ej.p,{...t})})]})}}),(0,a.jsx)("div",{className:"ml-auto",children:(0,a.jsx)(V.$,{type:"submit",className:"cursor-pointer",children:"Submit"})})]})})})]}),(0,a.jsxs)(eb.Popover,{children:[(0,a.jsx)(eb.PopoverTrigger,{asChild:!0,children:(0,a.jsx)(V.$,{size:"icon",variant:"secondary",className:"cursor-pointer",children:(0,a.jsx)(eS.mYn,{})})}),(0,a.jsxs)(eb.PopoverContent,{className:"flex flex-col gap-3 w-256",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)(ev.J,{children:"Name"}),(0,a.jsx)("span",{className:"text-sm text-text-2",children:e.name})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)(ev.J,{children:"Description"}),(0,a.jsx)("span",{className:"text-sm text-text-2",children:e.description})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)(ev.J,{children:"Instruction"}),(0,a.jsx)("span",{className:"text-sm text-text-2",children:e.instruction})]})]})]}),(0,a.jsx)(eU,{}),(0,a.jsx)(ts,{}),(0,a.jsx)(eJ,{}),(0,a.jsx)(eY,{})]})]})}var tn=s(64200),tr=s(48702);function ti(){let{setAgent:e}=em(),{setRunnerConfig:t}=ez(),{messages:s,setMessages:n,sendMessage:r}=(0,tn.Y_)({transport:new tr.rL({api:"".concat(ek,"/run_sse")})});return(0,o.useEffect)(()=>{let s=async()=>{e(await eC.get("get_agent").json())},a=async()=>{t(await eC.get("get_runner_config").json())};(async()=>{n((await eC.get("get_history_messages").json()).messages)})(),s(),a()},[]),(0,a.jsxs)("div",{className:"flex flex-col min-w-3xl max-w-3xl mx-auto min-h-0 w-full px-4 md:px-6 pb-3 gap-3",children:[(0,a.jsx)(ta,{}),(0,a.jsx)(q,{messages:s}),(0,a.jsx)(ef,{sendMessage:r})]})}},96159:(e,t,s)=>{"use strict";s.d(t,{Popover:()=>i,PopoverContent:()=>o,PopoverTrigger:()=>l});var a=s(69005);s(33369);var n=s(12431),r=s(78791);function i(e){let{...t}=e;return(0,a.jsx)(n.Root,{"data-slot":"popover",...t})}function l(e){let{...t}=e;return(0,a.jsx)(n.Trigger,{"data-slot":"popover-trigger",...t})}function o(e){let{className:t,align:s="center",sideOffset:i=4,showArrow:l=!1,...o}=e;return(0,a.jsx)(n.Portal,{children:(0,a.jsxs)(n.Content,{"data-slot":"popover-content",align:s,sideOffset:i,className:(0,r.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-hidden",t),...o,children:[o.children,l&&(0,a.jsx)(n.Arrow,{className:"fill-popover -my-px drop-shadow-[0_1px_0_var(--border)]"})]})})}}},e=>{e.O(0,[5719,3169,8358,527,4357,2067,4491,7540,7358],()=>e(e.s=15056)),_N_E=e.O()}]);
\ No newline at end of file
diff --git a/veadk/cli/studio/web/index.html b/veadk/cli/studio/web/index.html
index 916b72bf..6921e020 100644
--- a/veadk/cli/studio/web/index.html
+++ b/veadk/cli/studio/web/index.html
@@ -1 +1 @@
-An agent development and cloud platform
An agent development and cloud platform