PageSourceSearch

https://vilma.ai/_next/static/chunks/25801.179ef1b063ae3dca.js

js vilma.ai collected 2026-10-05 16:20:01 UTC 12,980 bytes, 1 lines download raw bytes

1try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c3008fd2-6fa8-488b-a526-53a531534bba",e._sentryDebugIdIdentifier="sentry-dbid-c3008fd2-6fa8-488b-a526-53a531534bba")}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25801],{18514:(e,t,a)=>{a.d(t,{A:()=>s});let s=(0,a(71847).A)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},25801:(e,t,a)=>{a.r(t),a.d(t,{default:()=>N});var s=a(95155),l=a(12115),n=a(35299),r=a(89559);let i=(0,a(71847).A)("folder-closed",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M2 10h20",key:"1ir3d8"}]]);var c=a(99011),o=a(54679),d=a(97003),m=a(33789),u=a(67001),x=a(90235),p=a(47507);let h=["semantic","episodic","procedural","gap","reference"],f=["active","stale","superseded","archived","candidate"];function g(e){let{open:t,onOpenChange:a,memory:r,projectId:i,onSaved:c}=e,[g,j]=l.useState(""),[v,b]=l.useState(""),[y,N]=l.useState(""),[w,C]=l.useState("semantic"),[k,A]=l.useState("0.6"),[E,S]=l.useState("active"),[T,_]=l.useState(!1),[M,I]=l.useState(null);l.useEffect(()=>{var e,t,a,s,l,n;r&&(j(null!=(e=r.title)?e:""),b(null!=(t=r.description)?t:""),N(null!=(a=r.body_md)?a:""),C(null!=(s=r.type)?s:"semantic"),A(String(null!=(l=r.confidence)?l:.6)),S(null!=(n=r.status)?n:"active"),I(null))},[r]);let D=async()=>{if(r){if(!g.trim())return void I("El t\xedtulo no puede estar vac\xedo.");_(!0),I(null);try{let t=Math.max(0,Math.min(1,Number(k)||0)),s=await fetch("/api/projects/".concat(i,"/memories/").concat(r.id),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:g.trim(),description:v.trim()?v.trim():null,body_md:y.trim()?y.trim():null,type:w,confidence:t,status:E})});if(!s.ok){var e;let t=await s.json().catch(()=>({}));throw Error(null!=(e=t.error)?e:"HTTP ".concat(s.status))}let l=await s.json();c(l.memory),a(!1)}catch(e){I(e.message)}finally{_(!1)}}};return(0,s.jsx)(o.lG,{open:t,onOpenChange:a,children:(0,s.jsxs)(o.Cf,{className:"sm:max-w-lg",children:[(0,s.jsxs)(o.c7,{children:[(0,s.jsx)(o.L3,{children:"Editar memoria"}),(0,s.jsx)(o.rr,{children:"Ajusta el contenido. Al guardar, el t\xedtulo y la descripci\xf3n se vuelven a indexar para la recuperaci\xf3n."})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-3 py-2",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,s.jsx)(x.J,{htmlFor:"mem-title",children:"T\xedtulo"}),(0,s.jsx)(m.p,{id:"mem-title",value:g,onChange:e=>j(e.target.value),placeholder:"T\xedtulo de la memoria"})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,s.jsx)(x.J,{htmlFor:"mem-desc",children:"Descripci\xf3n"}),(0,s.jsx)(u.T,{id:"mem-desc",value:v,onChange:e=>b(e.target.value),rows:3,placeholder:"1-2 frases autocontenidas (se usa para recall)."})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,s.jsx)(x.J,{htmlFor:"mem-body",children:"Cuerpo (markdown, opcional)"}),(0,s.jsx)(u.T,{id:"mem-body",value:y,onChange:e=>N(e.target.value),rows:4,placeholder:"Detalle completo, si aplica."})]}),(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,s.jsx)(x.J,{children:"Tipo"}),(0,s.jsxs)(p.l6,{value:w,onValueChange:C,children:[(0,s.jsx)(p.bq,{children:(0,s.jsx)(p.yv,{})}),(0,s.jsx)(p.gC,{children:h.map(e=>(0,s.jsx)(p.eb,{value:e,children:e},e))})]})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,s.jsx)(x.J,{htmlFor:"mem-conf",children:"Confianza"}),(0,s.jsx)(m.p,{id:"mem-conf",type:"number",min:0,max:1,step:.05,value:k,onChange:e=>A(e.target.value)})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,s.jsx)(x.J,{children:"Estado"}),(0,s.jsxs)(p.l6,{value:E,onValueChange:S,children:[(0,s.jsx)(p.bq,{children:(0,s.jsx)(p.yv,{})}),(0,s.jsx)(p.gC,{children:f.map(e=>(0,s.jsx)(p.eb,{value:e,children:e},e))})]})]})]}),M&&(0,s.jsx)("p",{className:"text-xs text-destructive",children:M})]}),(0,s.jsxs)(o.Es,{children:[(0,s.jsx)(d.$,{variant:"outline",onClick:()=>a(!1),disabled:T,children:"Cancelar"}),(0,s.jsxs)(d.$,{onClick:D,disabled:T,children:[T?(0,s.jsx)(n.A,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Guardar cambios"]})]})]})})}var j=a(53486),v=a(33884),b=a(27346),y=a(52414);function N(e){var t,a;let{projectId:o}=e,[d,m]=l.useState([]),[u,x]=l.useState([]),[h,f]=l.useState(!1),[N,w]=l.useState(null),[C,k]=l.useState("project"),[A,E]=l.useState(null),[S,T]=l.useState(!1),[_,M]=l.useState(null),[I,D]=l.useState(!1),[P,B]=l.useState(!1),J=l.useCallback(async()=>{f(!0),w(null);try{var e;let[t,a]=await Promise.all([fetch("/api/projects/".concat(o,"/memories")),fetch("/api/projects/".concat(o,"/assistants"))]);if(!t.ok)throw Error("memorias: HTTP ".concat(t.status));let s=await t.json();if(m(null!=(e=s.memories)?e:[]),a.ok){let e=await a.json(),t=(Array.isArray(e)?e:[]).filter(e=>!!(null==e?void 0:e.id)).map(e=>{var t;let a=null!=(t=e.name)?t:"",s=a.indexOf(" - "),l=(-1===s?a:a.slice(0,s)).trim(),n=-1===s?"":a.slice(s+3).trim(),r
1="number"==typeof e.agent_id?y.VIRTUAL_TEAM_STRUCTURE.find(t=>t.id===e.agent_id):void 0,i=e.avatar||(null==r?void 0:r.avatar)||"/logo.png";return{id:e.id,name:l||a||"Agente",role:n,avatar:i}});x(t)}}catch(e){w(e.message)}finally{f(!1)}},[o]);l.useEffect(()=>{J()},[J]);let F=l.useMemo(()=>{let e={};for(let t of u)e[t.id]=t.name;return e},[u]),{projectMemories:L,byAgent:H}=l.useMemo(()=>{let e=d.filter(e=>"project_brain"===e.scope||"project_narrative"===e.scope),t=new Map;for(let e of d){var a,s;if("agent"!==e.scope)continue;let l=null!=(a=e.agent_assistant_id)?a:"(sin agente)",n=null!=(s=t.get(l))?s:[];n.push(e),t.set(l,n)}return{projectMemories:e,byAgent:t}},[d]),O=l.useCallback(e=>{E(e),T(!0)},[]),V=l.useCallback(e=>{m(t=>t.map(t=>t.id===e.id?{...t,...e}:t))},[]),R=l.useCallback(e=>{M(e),D(!0)},[]),U=l.useCallback(async()=>{if(_){B(!0);try{let t=await fetch("/api/projects/".concat(o,"/memories/").concat(_.id),{method:"DELETE"});if(!t.ok){var e;let a=await t.json().catch(()=>({}));throw Error(null!=(e=a.error)?e:"HTTP ".concat(t.status))}m(e=>e.filter(e=>e.id!==_.id)),D(!1),M(null)}catch(e){w(e.message)}finally{B(!1)}}},[_,o]);if(h)return(0,s.jsxs)("div",{className:"flex items-center justify-center py-16 gap-2 text-sm text-muted-foreground",children:[(0,s.jsx)(n.A,{className:"h-4 w-4 animate-spin"}),"Cargando memoria…"]});if(N)return(0,s.jsxs)("p",{className:"text-sm text-destructive py-8 text-center",children:["Error: ",N]});let q="project"===C,z=q?L:null!=(t=H.get(C))?t:[],G=q?"Proyecto (compartida)":"".concat(null!=(a=F[C])?a:"Agente"," \xb7 memoria de agente");return(0,s.jsxs)("div",{className:"flex w-full flex-col gap-4 md:flex-row",children:[(0,s.jsx)("div",{className:"md:hidden",children:(0,s.jsxs)(p.l6,{value:C,onValueChange:e=>k(e),children:[(0,s.jsx)(p.bq,{children:(0,s.jsx)(p.yv,{})}),(0,s.jsxs)(p.gC,{children:[(0,s.jsxs)(p.eb,{value:"project",children:["Proyecto \xb7 ",L.length]}),u.map(e=>{var t,a;return(0,s.jsxs)(p.eb,{value:e.id,children:[e.name," \xb7 ",null!=(a=null==(t=H.get(e.id))?void 0:t.length)?a:0]},e.id)})]})]})}),(0,s.jsxs)("aside",{className:"hidden w-60 shrink-0 flex-col md:flex",children:[(0,s.jsxs)("div",{className:"mb-2 flex items-center justify-between px-2",children:[(0,s.jsxs)("p",{className:"text-xs text-muted-foreground",children:[d.length," memoria(s)"]}),(0,s.jsxs)("button",{type:"button",onClick:J,className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground",children:[(0,s.jsx)(r.A,{className:"h-3.5 w-3.5"}),"Recargar"]})]}),(0,s.jsx)(b.F,{className:"h-[calc(100vh-220px)] pr-2",children:(0,s.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,s.jsx)(e=>{let{active:t,onClick:a,icon:l,label:n,count:r}=e;return(0,s.jsxs)("button",{type:"button",onClick:a,className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm transition-colors ".concat(t?"bg-accent font-medium text-foreground":"text-muted-foreground hover:bg-accent/60"),children:[l,(0,s.jsx)("span",{className:"truncate",children:n}),(0,s.jsx)("span",{className:"ml-auto text-xs tabular-nums text-muted-foreground",children:r})]})},{active:q,onClick:()=>k("project"),icon:(0,s.jsx)(i,{className:"h-4 w-4 shrink-0"}),label:"Proyecto",count:L.length}),(0,s.jsx)("div",{className:"my-1 px-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/60",children:"Agentes"}),u.map(e=>{var t,a;let l=C===e.id,n=null!=(a=null==(t=H.get(e.id))?void 0:t.length)?a:0;return(0,s.jsxs)("button",{type:"button",onClick:()=>k(e.id),className:"flex w-full items-center gap-2.5 rounded-md px-2 py-1.5 text-left transition-colors ".concat(l?"bg-accent":"hover:bg-accent/60"),children:[(0,s.jsxs)(v.Avatar,{className:"h-8 w-8 shrink-0",children:[(0,s.jsx)(v.AvatarImage,{src:e.avatar,alt:e.name}),(0,s.jsx)(v.AvatarFallback,{className:"text-[10px]",children:e.name.split(/\s+/).filter(Boolean).slice(0,2).map(e=>{var t,a;return null!=(a=null==(t=e[0])?void 0:t.toUpperCase())?a:""}).join("")})]}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("div",{className:"truncate text-sm leading-tight ".concat(l?"font-medium text-foreground":"text-foreground
1/90"),children:e.name}),e.role&&(0,s.jsx)("div",{className:"truncate text-[11px] leading-tight text-muted-foreground",children:e.role})]}),(0,s.jsx)("span",{className:"text-xs tabular-nums text-muted-foreground",children:n})]},e.id)})]})})]}),(0,s.jsxs)("section",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"mb-3 flex items-center justify-between",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold",children:G}),(0,s.jsxs)("span",{className:"text-xs text-muted-foreground",children:[z.length," memoria(s)"]})]}),(0,s.jsx)(c.a,{memories:z,agentNameById:F,emptyText:q?"A\xfan no hay memoria de proyecto. Migra el proyecto o chatea para sembrarla.":"Este agente todav\xeda no tiene memoria propia. Se crea cuando responde en el chat.",onEdit:O,onDelete:R})]}),(0,s.jsx)(g,{open:S,onOpenChange:T,memory:A,projectId:o,onSaved:V}),(0,s.jsx)(j.T,{open:I,onOpenChange:D,title:"\xbfBorrar esta memoria?",description:_?'"'.concat(_.title,'" se eliminar\xe1 permanentemente y tus agentes dejar\xe1n de usarla. Esta acci\xf3n no se puede deshacer.'):void 0,confirmLabel:"Borrar",variant:"destructive",onConfirm:U,isConfirming:P})]})}},99011:(e,t,a)=>{a.d(t,{a:()=>c});var s=a(95155);a(12115);var l=a(18514),n=a(71360);function r(e){let{className:t,children:a}=e;return(0,s.jsx)("span",{className:"inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium ".concat(null!=t?t:""),children:a})}function i(e){var t;let{m:a,agentNameById:i,onEdit:c,onDelete:o}=e,d=a.agent_assistant_id?null==i?void 0:i[a.agent_assistant_id]:null,m=!!(c||o),u="agent"===a.scope,x="conversation"===a.scope;return(0,s.jsxs)("div",{className:"group relative rounded-lg border bg-card px-3 py-2.5",children:[m&&(0,s.jsxs)("div",{className:"absolute right-2 top-2 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100",children:[c&&(0,s.jsx)("button",{type:"button",onClick:()=>c(a),"aria-label":"Editar memoria",title:"Editar",className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:(0,s.jsx)(l.A,{className:"h-3.5 w-3.5"})}),o&&(0,s.jsx)("button",{type:"button",onClick:()=>o(a),"aria-label":"Borrar memoria",title:"Borrar",className:"rounded p-1 text-muted-foreground hover:bg-destructive/10 hover:text-destructive",children:(0,s.jsx)(n.A,{className:"h-3.5 w-3.5"})})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap mb-1 ".concat(m?"pr-14":""),children:[(0,s.jsx)(r,{className:u?"bg-amber-100 text-amber-700":x?"bg-gray-100 text-gray-600":"bg-violet-100 text-violet-700",children:u?null!=d?d:"Agente":x?"Conversaci\xf3n":"Proyecto"}),(0,s.jsxs)("span",{className:"ml-auto text-[10px] text-muted-foreground",children:["conf. ",Math.round((null!=(t=a.confidence)?t:0)*100),"%"]})]}),(0,s.jsx)("div",{className:"text-sm font-medium leading-snug",children:a.title}),a.description&&(0,s.jsx)("div",{className:"mt-0.5 text-xs text-muted-foreground leading-snug break-words",children:a.description})]})}function c(e){let{memories:t,agentNameById:a,emptyText:l="A\xfan no hay memorias.",onEdit:n,onDelete:r}=e;return 0===t.length?(0,s.jsx)("div",{className:"text-xs text-muted-foreground py-4 text-center",children:l}):(0,s.jsx)("div",{className:"flex flex-col gap-2",children:t.map(e=>(0,s.jsx)(i,{m:e,agentNameById:a,onEdit:n,onDelete:r},e.id))})}}}]);

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.