vendor: 4,441 bytes, lines 1-11
1import{c as ce,r as c,aX as we,az as Re,j as e,aY as Ie,P as J,ay as ne,aZ as ke,aA as L,a_ as ie,aB as Ae,aD as de,aC as Ee,d as le,I as F,e as me,o as I,H as Te,a$ as R,aQ as Z,B as U,t as G,k as De}from"./index-OkXy-d5Y.js";import{B as D}from"./badge-D70DEMXH.js";import{C as B,a as ee,c as se,b as V}from"./card-BOYNs0rn.js";import{L as b}from"./label-B8fcy5Qd.js";import{u as Pe,S as q,a as z,b as W,c as K,d as P}from"./select-Dpk4TeIL.js";import{S as H}from"./skeleton-CTnX7jIE.js";import{T as Me,a as _e,b as ae,c as te}from"./tabs-DOaoAkMM.js";import{s as ue,f as pe}from"./appsSlice-B3WyvwFA.js";import{f as Fe}from"./apiKeysSlice-CHmcOGx4.js";import{p as Ge,d as Oe,s as Le,a as Ue,b as Be,e as Ve,f as qe,g as ze}from"./memoriesSlice-ClQDWo33.js";import{b as $,u as We,a as Ke}from"./useUrlState-BpAdUcU0.js";import{g as He,h as $e,a as Je,b as Qe,e as Xe,f as Ye,D as Ze,d as es}from"./drawer-BKNRAhtm.js";import{E as re}from"./EmptyState-B-dhNU1x.js";import{S as ss}from"./search-Bi7-eThi.js";import{f as _}from"./date-utils-BapGj4Cw.js";import{M as as,C as ts}from"./MemoryRow-Bzu-xJPf.js";import{B as rs}from"./brain-miUL15Zz.js";import{C as os}from"./chevron-right-KD1l2-eL.js";import"./chevron-down-D6eBPoHA.js";/** 2 * @license lucide-react v0.487.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const cs=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ns=ce("circle",cs);/** 7 * @license lucide-react v0.487.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const is=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],ds=ce("play",is);var Q="Radio",[ls,xe]=de(Q),[ms,us]=ls(Q),he=c.forwardRef((a,d)=>{const{__scopeRadio:r,name:n,checked:o=!1,required:s,disabled:p,value:l="on",onCheck:f,form:g,...j}=a,[i,m]=c.useState(null),x=ne(d,v=>m(v)),h=c.useRef(!1),N=i?g||!!i.closest("form"):!0;return e.jsxs(ms,{scope:r,checked:o,disabled:p,children:[e.jsx(J.button,{type:"button",role:"radio","aria-checked":o,"data-state":je(o),"data-disabled":p?"":void 0,disabled:p,value:l,...j,ref:x,onClick:L(a.onClick,v=>{o||f==null||f(),N&&(h.current=v.isPropagationStopped(),h.current||v.stopPropagation())})}),N&&e.jsx(ps,{control:i,bubbles:!h.current,name:n,value:l,checked:o,required:s,disabled:p,form:g,style:{transform:"translateX(-100%)"}})]})});he.displayName=Q;var fe="RadioIndicator",ge=c.forwardRef((a,d)=>{const{__scopeRadio:r,forceMount:n,...o}=a,s=us(fe,r);return e.jsx(Ae,{present:n||s.checked,children:e.jsx(J.span,{"data-state":je(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:d})})});ge.displayName=fe;var ps=a=>{const{control:d,checked:r,bubbles:n=!0,...o}=a,s=c.useRef(null),p=Pe(r),l=Ee(d);return c.useEffect(()=>{const f=s.current,g=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(g,"checked").set;if(p!==r&&i){const m=new Event("click",{bubbles:n});i.call(f,r),f.dispatchEvent(m)}},[p,r,n]),e.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:r,...o,tabIndex:-1,ref:s,style:{...a.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function je(a){return a?"checked":"unchecked"}var xs=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],X="RadioGroup",[hs]=de(X,[ie,xe]),ve=ie(),Ne=xe(),[fs,gs]=hs(X),ye=c.forwardRef((a,d)=>{const{__scopeRadioGroup:r,name:n,defaultValue:o,value:s,required:p=!1,disabled:l=!1,orientation:f,dir:g,loop:j=!0,onValueChange:i,...m}=a,x=ve(r),h=we(g),[N,v]=Re({prop:s,defaultProp:o,onChange:i});return e.jsx(fs,{scope:r,name:n,required:p,disabled:l,value:N,onValueChange:v,children:e.jsx(Ie,{asChild:!0,...x,orientation:f,dir:h,loop:j,children:e.jsx(J.div,{role:"radiogroup","aria-required":p,"aria-orientation":f,"data-disabled":l?"":void 0,dir:h,...m,ref:d})})})});ye.displayName=X;var be="RadioGroupItem",Se=c.forwardRef((a,d)=>{const{__scopeRadioGroup:r,disabled:n,...o}=a,s=gs(be,r),p=s.disabled||n,l=ve(r),f=Ne(r),g=c.useRef(null),j=ne(d,g),i=s.value===o.value,m=c.useRef(!1);return c.useEffect(()=>{const x=N=>{xs.includes(N.key)&&(m.current=!0)},h=()=>m.current=!1;return document.addEventListener("keydown",x),document.addEventListener("keyup",h),()=>{document.removeEventListener("keydown",x),document.removeEventListener("keyup",h)}},[]),e.jsx(ke,{asChild:!0,...l,focusable:!p,active:i,children:e.jsx(he,{disabled:p,required:s.required,
11checked:i,...f,...o,name:s.name,ref:j,onCheck:()=>s.onValueChange(o.value),onKeyDown:L(x=>{x.key==="Enter"&&x.preventDefault()}),onFocus:L(o.onFocus,()=>{var x;m.current&&((x=g.current)==null||x.click())})})})});Se.displayName=be;var js="RadioGroupIndicator",Ce=c.forwardRef((a,d)=>{const{__scopeRadioGroup:r,...n}=a,o=Ne(r);return e.jsx(ge,{...o,...n,ref:d})});Ce.displayName=js;var vs=ye,Ns=Se,ys=Ce;function bs({className:a,...d}){return e.jsx(vs,{"data-slot":"radio-group",className:le("grid gap-3",a),...d})}function O({className:a,...d}){return e.jsx(Ns,{"data-slot":"radio-group-item",className:le("border-input bg-input-background text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 aria-invalid:border-destructive aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",a),...d,children:e.jsx(ys,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:e.jsx(ns,{className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})})})}function Ss({value:a,onChange:d,placeholder:r="Search...",className:n}){return e.jsxs("div",{className:`relative ${n||""}`,children:[e.jsx(ss,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(F,{value:a,onChange:o=>d(o.target.value),placeholder:r,className:"pl-9"})]})}function oe(a){return a.trim().toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_-]/g,"")}function Cs(){const a=me(),d=I(ue),r=I(Te),[n,o]=$("appId",""),[s,p]=We("create","method"),l=s==="search"?"search":"create",[f,g]=c.useState(""),[j,i]=c.useState(""),[m,x]=c.useState(""),[h,N]=c.useState(R.User);c.useEffect(()=>{if(r&&!m){const t=r.name??"";x(t),i(oe(t))}},[r,m]);const[v,M]=c.useState(""),[A,S]=c.useState(""),[k,E]=c.useState(!1),[C,w]=c.useState(null);c.useEffect(()=>{a(pe())},[a]),c.useEffect(()=>{n&&a(Fe({appId:n}))},[a,n]);const u=async()=>{if(!n){G({title:"Error",description:"Please select an application",variant:"destructive"});return}E(!0),S(""),w(null);try{if(l==="create"){const t=await a(Ge({appId:n,content:f,actorId:j||(r==null?void 0:r.email)||"playground_user",actorName:m||void 0,actorType:h})).unwrap();S(JSON.stringify(t,null,2)),w(201),G({title:"Memory created"})}else{const t=await a(Oe({appId:n,query:v,actorId:j||void 0,actorType:j?h:void 0})).unwrap();S(JSON.stringify(t,null,2)),w(200)}}catch(t){const y=t instanceof Error?t.message:typeof t=="string"?t:"Request failed";S(JSON.stringify({error:y},null,2)),w(500),G({title:"Error",description:y,variant:"destructive"})}finally{E(!1)}};return e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs(B,{children:[e.jsx(ee,{children:e.jsx(se,{className:"text-base",children:"Request"})}),e.jsxs(V,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{children:"Application"}),e.jsxs(q,{value:n,onValueChange:o,children:[e.jsx(z,{children:e.jsx(W,{placeholder:"Select app"})}),e.jsx(K,{children:d.map(t=>{var y,T,Y;return e.jsx(P,{value:(y=t.response)==null?void 0:y.id,children:(T=t.response)==null?void 0:T.name},(Y=t.response)==null?void 0:Y.id)})})]})]}),e.jsxs(Me,{value:l,onValueChange:t=>p(t),children:[e.jsxs(_e,{className:"w-full",children:[e.jsx(ae,{value:"create",className:"flex-1",children:"Create Memory"}),e.jsx(ae,{value:"search",className:"flex-1",children:"Search"})]}),e.jsxs(te,{value:"create",className:"space-y-4 mt-3",children:[e.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4 space-y-3",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Actor"}),e.jsxs(bs,{value:h,onValueChange:t=>N(t),className:"flex gap-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(O,{value:R.User,id:"actor-user"}),e.jsx(b,{htmlFor:"actor-user",className:"font-normal cursor-pointer",children:"User"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(O,{value:R.Agent,id:"actor-agent"}),e.jsx(b,{htmlFor:"actor-agent",className:"font-normal cursor-pointer",children:"Agent"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(O,{value:R.System,id:"actor-system"}),e.jsx(b,{htmlFor:"actor-system",className:"font-normal cursor-pointer",children:"System"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-xs",children:"Name"}),e.jsx(F,{value:m,onChange:t=>{const y=t.target.value;x(y),i(oe(y))},placeholder:"Tushar Dwivedi"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-xs",children:"ID"}),e.jsx(F,{value:j,onChange:t=>i(t.target.value),placeholder:"tushar_dwivedi"})]})]})]}),e.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4 space-y-1.5",children:[e.jsx(b,{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Content"}),e.jsx(Z,{value:f,onChange:t=>g(t.target.value),placeholder:"The user mentioned they prefer dark mode and use TypeScript...",rows:4,className:"bg-background"})]})]}
11),e.jsxs(te,{value:"search",className:"space-y-4 mt-3",children:[e.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4 space-y-3",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Filter"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-xs",children:"Actor ID (optional)"}),e.jsx(F,{value:j,onChange:t=>i(t.target.value),placeholder:"tushar_dwivedi"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-xs",children:"Actor Type"}),e.jsxs(q,{value:h,onValueChange:t=>N(t),children:[e.jsx(z,{children:e.jsx(W,{})}),e.jsxs(K,{children:[e.jsx(P,{value:R.User,children:"User"}),e.jsx(P,{value:R.Agent,children:"Agent"}),e.jsx(P,{value:R.System,children:"System"})]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4 space-y-1.5",children:[e.jsx(b,{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Query"}),e.jsx(Z,{value:v,onChange:t=>M(t.target.value),placeholder:"What programming language does the user prefer?",rows:3,className:"bg-background"})]})]})]}),e.jsxs(U,{onClick:u,disabled:k,className:"w-full",children:[e.jsx(ds,{className:"mr-2 h-4 w-4"}),k?"Executing...":"Execute"]})]})]}),e.jsxs(B,{children:[e.jsxs(ee,{className:"flex flex-row items-center justify-between",children:[e.jsx(se,{className:"text-base",children:"Response"}),C!==null&&e.jsxs(D,{variant:C<400?"secondary":"destructive",children:[C," ",C<400?"OK":"Error"]})]}),e.jsx(V,{children:k?e.jsx(H,{className:"h-64 rounded-lg"}):A?e.jsx("pre",{className:"bg-muted p-4 rounded-lg text-sm font-mono overflow-auto max-h-[500px]",children:A}):e.jsx("div",{className:"flex items-center justify-center h-64 text-muted-foreground text-sm",children:"Execute a request to see the response"})})]})]})})}function ws(){var A,S,k,E,C,w;const a=me(),d=I(ue),r=I(Le),n=I(Ue),o=I(Be),s=I(Ve),p=De(),[l,f]=$("appId",""),[g,j]=$("actor",""),[i,m]=Ke(),[x,h]=c.useState(!1);c.useEffect(()=>{a(pe())},[a]),c.useEffect(()=>{l&&a(qe({appId:l,page:i,pageSize:20,actorId:g||void 0}))},[a,l,i,g]);const N=u=>{a(ze({appId:l,memoryId:u})),h(!0)},v=(o==null?void 0:o.totalPages)??1,M=e.jsxs(e.Fragment,{children:[p?e.jsx(He,{children:e.jsx($e,{children:"Memory Detail"})}):e.jsx(Je,{children:e.jsx(Qe,{children:"Memory Detail"})}),s?e.jsxs("div",{className:"overflow-y-auto max-h-[80vh] space-y-5 pr-1",children:[e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"text-muted-foreground mb-0.5",children:"ID"}),e.jsx("code",{className:"font-mono text-xs",children:s.id??"â"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-2",children:"When"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-xs mb-0.5",children:"Active From"}),e.jsx("p",{children:_(s.activeFrom,"mediumWithTime",{fallback:"â"})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-xs mb-0.5",children:"Active To"}),e.jsx("p",{children:_(s.activeTo,"mediumWithTime",{fallback:"No expiry"})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-xs mb-0.5",children:"Created"}),e.jsx("p",{children:_(s.createdAt,"mediumWithTime",{fallback:"â"})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-xs mb-0.5",children:"Updated"}),e.jsx("p",{children:_(s.updatedAt,"mediumWithTime",{fallback:"â"})})]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-2",children:"Who"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-xs mb-0.5",children:"Actor ID"}),e.jsx("code",{className:"font-mono text-xs",children:((A=s.scope)==null?void 0:A.actorId)??"â"})]}),((S=s.scope)==null?void 0:S.actorName)&&e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-xs mb-0.5",children:"Actor Name"}),e.jsx("p",{children:s.scope.actorName})]}),((k=s.scope)==null?void 0:k.actorType)&&e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-xs mb-0.5",children:"Actor Type"}),e.jsx(D,{variant:"outline",children:s.scope.actorType})]}
11),((E=s.scope)==null?void 0:E.conversationId)&&e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-xs mb-0.5",children:"Conversation ID"}),e.jsx("code",{className:"font-mono text-xs",children:s.scope.conversationId})]}),((C=s.scope)==null?void 0:C.sourceType)&&e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-xs mb-0.5",children:"Source Type"}),e.jsx(D,{variant:"outline",children:s.scope.sourceType})]}),((w=s.scope)==null?void 0:w.participantIds)&&s.scope.participantIds.length>0&&e.jsxs("div",{className:"col-span-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs mb-0.5",children:"Participants"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:s.scope.participantIds.map(u=>e.jsx(D,{variant:"outline",className:"font-mono text-xs",children:u},u))})]})]})]}),s.relativeStanding&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-2",children:"Relevance"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 text-sm",children:[s.relativeStanding.importance!==void 0&&e.jsxs("div",{className:"col-span-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs mb-1",children:"Importance"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1 bg-muted rounded-full h-1.5",children:e.jsx("div",{className:"bg-primary rounded-full h-1.5",style:{width:`${(s.relativeStanding.importance*100).toFixed(0)}%`}})}),e.jsx("span",{className:"text-xs tabular-nums",children:s.relativeStanding.importance.toFixed(2)})]})]}),s.relativeStanding.decayFunction&&e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-xs mb-0.5",children:"Decay Function"}),e.jsx(D,{variant:"outline",children:s.relativeStanding.decayFunction})]}),s.relativeStanding.decayFactor!==void 0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-xs mb-0.5",children:"Decay Factor"}),e.jsx("p",{children:s.relativeStanding.decayFactor.toFixed(2)})]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-sm mb-1",children:"Content"}),e.jsx("div",{className:"bg-muted p-3 rounded-lg text-sm",children:s.content??""})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-sm mb-1",children:"Metadata"}),e.jsx("pre",{className:"bg-muted p-3 rounded-lg text-xs font-mono overflow-auto max-h-48",children:JSON.stringify(s.metadata??{},null,2)})]})]}):e.jsx(H,{className:"h-48"})]});return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl",children:"Memory Explorer"}),e.jsx("p",{className:"text-muted-foreground",children:"Browse and inspect stored memories"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsxs(q,{value:l,onValueChange:u=>{f(u),m(1)},children:[e.jsx(z,{className:"w-full sm:w-64",children:e.jsx(W,{placeholder:"Select an application"})}),e.jsx(K,{children:d.map(u=>{var t,y,T;return e.jsx(P,{value:((t=u.response)==null?void 0:t.id)??"",children:(y=u.response)==null?void 0:y.name},((T=u.response)==null?void 0:T.id)??"")})})]}),e.jsx(Ss,{value:g,onChange:u=>{j(u),m(1)},placeholder:"Filter by actor ID...",className:"flex-1"})]}),l?n?e.jsx("div",{className:"space-y-2",children:[1,2,3,4,5].map(u=>e.jsx(H,{className:"h-14 rounded-lg"},u))}):r.length===0?e.jsx(re,{imageName:"smonku_empty_shelf",title:"Nothing here yet",description:g?"No memories match the current filter.":"Smonku is sitting by the shelf, waiting for your first memory."}):e.jsxs(e.Fragment,{children:[e.jsx(B,{children:e.jsx(V,{className:"py-0",children:r.map(u=>e.jsx(as,{memory:u,onClick:N},u.id))})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Page ",i," of ",v]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(U,{variant:"outline",size:"sm",disabled:i<=1,onClick:()=>m(i-1),children:e.jsx(ts,{className:"h-4 w-4"})}),e.jsx(U,{variant:"outline",size:"sm",disabled:i>=v,onClick:()=>m(i+1),children:e.jsx(os,{className:"h-4 w-4"})})]})]})]}):e.jsx(re,{icon:rs,title:"Select an application",description:"Choose an application above to browse its memories."}),p?e.jsx(Xe,{open:x,onOpenChange:h,children:e.jsx(Ye,{children:M})}):e.jsx(Ze,{open:x,onOpenChange:h,children:e.jsx(es,{className:"max-w-2xl",children:M})})]})}function Ws(){return e.jsxs("div",{className:"space-y-8",children:[e.jsx(Cs,{}),e.jsx(ws,{})]})}
11export{Ws as MemoryExplorerPage};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.