vestige/apps/dashboard/build/_app/immutable/nodes/7.2YrTacps.js
2026-05-25 01:44:52 -05:00

5 lines
14 KiB
JavaScript

import"../chunks/Bzak7iHL.js";import{o as Ce,a as Re}from"../chunks/GG5zm9kr.js";import{p as _e,f as we,g as e,a as ke,u as I,d as r,r as n,e as o,t as S,h as w,s as K,c as xe,n as he}from"../chunks/CpWkWWOo.js";import{d as Te,s as g,a as z}from"../chunks/BlVfL1ME.js";import{i as G}from"../chunks/B4yTwGkE.js";import{e as oe,i as Ae}from"../chunks/CGEBXrjl.js";import{c as Le,a as v,f as m}from"../chunks/CHOnp4oo.js";import{s as se,r as Fe}from"../chunks/A7po6GxK.js";import{b as Ne}from"../chunks/sZcqyNBA.js";import{s as pe}from"../chunks/aVbAZ-t7.js";import{s as re}from"../chunks/Cx-f-Pzo.js";import{N as Ze}from"../chunks/CcUbQ_Wl.js";function De(s){return s>=.92?"near-identical":s>=.8?"strong":"weak"}function ge(s){const i=De(s);return i==="near-identical"?"var(--color-decay)":i==="strong"?"var(--color-warning)":"#fde047"}function Ee(s){const i=De(s);return i==="near-identical"?"Near-identical":i==="strong"?"Strong match":"Weak match"}function Pe(s){return s>.7?"#10b981":s>.4?"#f59e0b":"#ef4444"}function Be(s){if(!s||s.length===0)return null;let i=s[0],d=Number.isFinite(i.retention)?i.retention:-1/0;for(let u=1;u<s.length;u++){const b=s[u],_=Number.isFinite(b.retention)?b.retention:-1/0;_>d&&(i=b,d=_)}return i}function Ie(s,i){return s.filter(d=>d.similarity>=i)}function be(s){return s.map(i=>i.id).slice().sort().join("|")}function Oe(s,i=80){if(!s)return"";const d=s.trim().replace(/\s+/g," ");return d.length<=i?d:d.slice(0,i)+"…"}function ye(s){if(!s||typeof s!="string")return"";const i=new Date(s);return Number.isNaN(i.getTime())?"":i.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function He(s,i=4){return Array.isArray(s)?s.slice(0,i):[]}var Ue=m('<span class="rounded bg-recall/15 px-1.5 py-0.5 text-[10px] font-medium text-recall">WINNER</span>'),We=m('<span class="rounded bg-white/[0.04] px-1.5 py-0.5 text-[10px] text-muted"> </span>'),je=m('<div class="text-[11px] text-muted"> </div>'),Ke=m('<div><span class="mt-1.5 h-2 w-2 flex-shrink-0 rounded-full"></span> <div class="flex-1 min-w-0 space-y-1.5"><div class="flex flex-wrap items-center gap-1.5"><span class="text-xs text-dim"> </span> <!> <!></div> <p> </p> <!></div> <div class="flex flex-shrink-0 flex-col items-end gap-1"><div class="h-1.5 w-12 overflow-hidden rounded-full bg-deep"><div class="h-full rounded-full"></div></div> <span class="text-[11px] text-muted"> </span></div></div>'),ze=m('<div class="glass-panel rounded-2xl p-5 space-y-4 transition-all duration-300 hover:border-synapse/20"><div class="flex items-start justify-between gap-4"><div class="flex-1 min-w-0 space-y-1.5"><div class="flex items-center gap-3"><span class="text-sm font-semibold"> </span> <span class="text-xs text-dim"> </span> <span class="text-xs text-muted"> </span></div> <div class="h-2 w-full overflow-hidden rounded-full bg-deep/60" role="progressbar" aria-label="Cosine similarity" aria-valuemin="0" aria-valuemax="100"><div class="h-full rounded-full transition-all duration-500"></div></div></div> <span> </span></div> <div class="space-y-2"></div> <div class="flex flex-wrap items-center gap-2 pt-1"><button type="button" aria-label="Merge all memories into the highest-retention winner" class="rounded-lg bg-recall/20 px-3 py-1.5 text-xs font-medium text-recall transition hover:bg-recall/30 focus:outline-none focus-visible:ring-2 focus-visible:ring-recall/60">Merge all → winner</button> <button type="button" class="rounded-lg bg-dream/20 px-3 py-1.5 text-xs font-medium text-dream-glow transition hover:bg-dream/30 focus:outline-none focus-visible:ring-2 focus-visible:ring-dream-glow/60"> </button> <button type="button" aria-label="Dismiss cluster for this session" class="ml-auto rounded-lg bg-white/[0.04] px-3 py-1.5 text-xs text-dim transition hover:bg-white/[0.08] hover:text-text focus:outline-none focus-visible:ring-2 focus-visible:ring-synapse/60">Dismiss cluster</button></div></div>');function Ge(s,i){_e(i,!0);let d=K(!1);const u=I(()=>Be(i.memories)),b=I(()=>e(u)?i.memories.filter(x=>x.id!==e(u).id).map(x=>x.id):[]);function _(){i.onMerge&&e(u)&&i.onMerge(e(u).id,e(b))}var A=Le(),V=we(A);{var le=x=>{var X=ze(),O=r(X),Y=r(O),h=r(Y),C=r(h),ee=r(C);n(C);var H=o(C,2),de=r(H,!0);n(H);var U=o(H,2),q=r(U);n(U),n(h);var R=o(h,2),W=r(R);n(R),n(Y);var j=o(Y,2),ce=r(j);n(j),n(O);var L=o(O,2);oe(L,21,()=>i.memories,k=>k.id,(k,c)=>{var D=Ke(),N=r(D),Z=o(N,2),t=r(Z),a=r(t),l=r(a,!0);n(a);var p=o(a,2);{var E=y=>{var T=Ue();v(y,T)};G(p,y=>{e(c).id===e(u).id&&y(E)})}var M=o(p,2);oe(M,17,()=>He(e(c).tags,4),Ae,(y,T)=>{var B=We(),me=r(B,!0);n(B),S(()=>g(me,e(T))),v(y,B)}),n(t);var f=o(t,2),P=r(f,!0);n(f);var ae=o(f,2);{var Q=y=>{var T=je(),B=r(T,!0);n(T),S(me=>g(B,me),[()=>ye(e(c).createdAt)]),v(y,T)},ve=I(()=>ye(e(c).createdAt));G(ae,y=>{e(ve)&&y(Q)})}n(Z);var ne=o(Z,2),$=r(ne),Me=r($);n($);var fe=o($,2),Se=r(fe);n(fe),n(ne),n(D),S((y,T,B)=>{pe(D,1,`group flex items-start gap-3 rounded-xl border border-synapse/5 bg-white/[0.02] p-3 transition-all duration-200 hover:border-synapse/20 hover:bg-white/[0.04] ${e(c).id===e(u).id?"ring-1 ring-recall/30":""}`),re(N,`background: ${(Ze[e(c).nodeType]||"#8B95A5")??""}`),se(N,"title",e(c).nodeType),g(l,e(c).nodeType),pe(f,1,`text-sm text-text leading-relaxed ${e(d)?"whitespace-pre-wrap":""}`),g(P,y),re(Me,`width: ${e(c).retention*100}%; background: ${T??""}`),g(Se,`${B??""}%`)},[()=>e(d)?e(c).content:Oe(e(c).content),()=>Pe(e(c).retention),()=>(e(c).retention*100).toFixed(0)]),v(k,D)}),n(L);var te=o(L,2),J=r(te),F=o(J,2),ue=r(F,!0);n(F);var ie=o(F,2);n(te),n(X),S((k,c,D,N,Z,t,a,l)=>{re(C,`color: ${k??""}`),g(ee,`${c??""}%`),g(de,D),g(q,`· ${i.memories.length??""} memories`),se(R,"aria-valuenow",N),re(W,`width: ${Z??""}%; background: ${t??""}; box-shadow: 0 0 12px ${a??""}66`),pe(j,1,`flex-shrink-0 rounded-full border px-3 py-1 text-xs font-medium ${i.suggestedAction==="merge"?"border-recall/40 bg-recall/10 text-recall":"border-dream-glow/40 bg-dream/10 text-dream-glow"}`),g(ce,`Suggested: ${i.suggestedAction==="merge"?"Merge":"Review"}`),se(J,"title",`Merge all into highest-retention memory (${l??""}%)`),se(F,"aria-expanded",e(d)),g(ue,e(d)?"Collapse":"Review")},[()=>ge(i.similarity),()=>(i.similarity*100).toFixed(1),()=>Ee(i.similarity),()=>Math.round(i.similarity*100),()=>(i.similarity*100).toFixed(1),()=>ge(i.similarity),()=>ge(i.similarity),()=>(e(u).retention*100).toFixed(0)]),z("click",J,_),z("click",F,()=>w(d,!e(d))),z("click",ie,function(...k){var c;(c=i.onDismiss)==null||c.apply(this,k)}),v(x,X)};G(V,x=>{i.memories.length>0&&e(u)&&x(le)})}v(s,A),ke()}Te(["click"]);var Ve=m('<span class="h-2 w-2 animate-pulse rounded-full bg-synapse-glow"></span> <span>Detecting…</span>',1),Xe=m('<span class="h-2 w-2 rounded-full bg-decay"></span> <span class="text-decay">Error</span>',1),Ye=m('<span class="h-2 w-2 rounded-full bg-synapse-glow"></span> <span> </span>',1),qe=m(`<div class="glass-panel flex flex-col items-center gap-3 rounded-2xl p-10 text-center"><div class="text-sm text-decay">Couldn't detect duplicates</div> <div class="max-w-md text-xs text-muted"> </div> <button type="button" class="mt-2 rounded-lg bg-synapse/20 px-4 py-2 text-xs font-medium text-synapse-glow transition hover:bg-synapse/30 focus:outline-none focus-visible:ring-2 focus-visible:ring-synapse/60">Retry</button></div>`),Je=m('<div class="glass-subtle h-40 animate-pulse rounded-2xl"></div>'),Qe=m('<div class="space-y-3"></div>'),$e=m('<div class="glass-panel flex flex-col items-center gap-2 rounded-2xl p-12 text-center"><div class="text-3xl">·</div> <div class="text-sm font-medium text-bright">No duplicates found above threshold.</div> <div class="text-xs text-muted">Memory is clean.</div></div>'),et=m('<div class="glass-subtle rounded-xl border border-warning/30 bg-warning/5 px-4 py-2 text-xs text-dim"> </div>'),tt=m('<div class="animate-[fadeSlide_0.35s_ease-out_both]"><!></div>'),it=m('<div class="space-y-4"><!> <!></div>'),at=m(`<div class="relative mx-auto max-w-5xl space-y-6 p-6"><header class="space-y-2"><h1 class="text-xl font-semibold text-bright">Memory Hygiene — Duplicate Detection</h1> <p class="text-sm text-dim">Cosine-similarity clustering over embeddings. Merges reinforce the winner's FSRS state;
losers inherit into the merged node. Dismissed clusters are hidden for this session only.</p></header> <div class="glass-panel flex flex-wrap items-center gap-5 rounded-2xl p-4"><label class="flex flex-1 min-w-64 items-center gap-3 text-xs text-dim"><span class="whitespace-nowrap">Similarity threshold</span> <input type="range" min="0.70" max="0.95" step="0.01" class="flex-1 accent-synapse" aria-label="Similarity threshold"/> <span class="w-14 text-right font-mono text-sm text-bright"> </span></label> <div class="flex items-center gap-2 rounded-full border border-synapse/20 bg-synapse/10 px-3 py-1.5 text-xs text-text" role="status" aria-live="polite"><!></div> <button type="button" class="rounded-lg bg-white/[0.04] px-3 py-1.5 text-xs text-dim transition hover:bg-white/[0.08] hover:text-text disabled:opacity-40 focus:outline-none focus-visible:ring-2 focus-visible:ring-synapse/60">Rerun</button></div> <!></div>`);function ft(s,i){_e(i,!0);let d=K(.8),u=K(xe([])),b=K(xe(new Set)),_=K(!0),A=K(null),V;async function le(t){return await new Promise(l=>setTimeout(l,450)),{clusters:Ie([{similarity:.96,suggestedAction:"merge",memories:[{id:"m-001",content:"BUG FIX: Harmony parser dropped `final` channel tokens when tool call followed. Root cause: 5-layer fallback missed the final channel marker when channel switched mid-stream. Solution: added final-channel detector before tool-call pop. Files: src/parser/harmony.rs",nodeType:"fact",tags:["bug-fix","benchmark-suite","parser"],retention:.91,createdAt:"2026-04-12T14:22:00Z"},{id:"m-002",content:"Fixed Harmony parser final-channel bug — 5-layer fallback was missing the final channel marker when a tool call followed. Added detector before tool pop.",nodeType:"fact",tags:["bug-fix","benchmark-suite"],retention:.64,createdAt:"2026-04-13T09:15:00Z"},{id:"m-003",content:"Harmony parser: final channel dropped on tool-call. Patched the fallback stack.",nodeType:"note",tags:["parser"],retention:.38,createdAt:"2026-04-14T11:02:00Z"}]},{similarity:.88,suggestedAction:"merge",memories:[{id:"m-004",content:"DECISION: Use vLLM prefix caching at 0.35 gpu_memory_utilization for benchmark suite submissions. Alternatives considered: sglang (slower cold start), TensorRT-LLM (deployment friction).",nodeType:"decision",tags:["vllm","benchmark-suite","inference"],retention:.84,createdAt:"2026-04-05T18:44:00Z"},{id:"m-005",content:"Chose vLLM with prefix caching (0.35 mem util) over sglang and TensorRT-LLM for benchmark suite inference.",nodeType:"decision",tags:["vllm","benchmark-suite"],retention:.72,createdAt:"2026-04-06T10:30:00Z"}]},{similarity:.83,suggestedAction:"review",memories:[{id:"m-006",content:"Release process prefers one change per benchmark submission — stacking changes destroyed signal in a prior run.",nodeType:"pattern",tags:["methodology","benchmark-suite"],retention:.88,createdAt:"2026-04-04T22:10:00Z"},{id:"m-007",content:"One-variable-at-a-time rule: never stack multiple changes per submission. Paper 2603.27844 proves +/-2 points is noise.",nodeType:"pattern",tags:["kaggle","methodology"],retention:.67,createdAt:"2026-04-08T16:20:00Z"},{id:"m-008",content:"Lesson: stacking many changes in one benchmark run hid the causal signal. Always isolate variables.",nodeType:"note",tags:["methodology"],retention:.42,createdAt:"2026-04-15T08:55:00Z"}]},{similarity:.78,suggestedAction:"review",memories:[{id:"m-009",content:"Dimensional Illusion performance: 7-minute flow poi set, LED config Parthenos overcook preset, tempo 128 BPM.",nodeType:"event",tags:["dimensional-illusion","poi","performance"],retention:.76,createdAt:"2026-03-28T19:45:00Z"},{id:"m-010",content:"Dimensional Illusion set: 7 min, Parthenos LED overcook, 128 BPM.",nodeType:"event",tags:["dimensional-illusion","poi"],retention:.51,createdAt:"2026-04-02T12:12:00Z"}]},{similarity:.76,suggestedAction:"review",memories:[{id:"m-011",content:"Vestige v2.0.7 shipped active forgetting via Anderson 2025 top-down inhibition + Davis Rac1 cascade. Suppress compounds, reversible 24h.",nodeType:"fact",tags:["vestige","release","active-forgetting"],retention:.93,createdAt:"2026-04-17T03:22:00Z"},{id:"m-012",content:"Active Forgetting feature: compounds on each suppress, 24h reversible labile window, violet implosion animation in graph view.",nodeType:"concept",tags:["vestige","active-forgetting"],retention:.81,createdAt:"2026-04-18T09:07:00Z"}]}],t)}}async function x(){w(_,!0),w(A,null);try{const t=await le(e(d));w(u,t.clusters,!0);const a=new Set(e(u).map(p=>be(p.memories))),l=new Set;for(const p of e(b))a.has(p)&&l.add(p);w(b,l,!0)}catch(t){w(A,t instanceof Error?t.message:"Failed to detect duplicates",!0),w(u,[],!0)}finally{w(_,!1)}}function X(){clearTimeout(V),V=setTimeout(x,250)}function O(t){const a=new Set(e(b));a.add(t),w(b,a,!0)}function Y(t,a,l){console.log("Merge cluster",t,{winnerId:a,loserIds:l}),O(t)}const h=I(()=>e(u).map(t=>({c:t,key:be(t.memories)})).filter(({key:t})=>!e(b).has(t))),C=I(()=>e(h).reduce((t,{c:a})=>t+a.memories.length,0)),ee=50,H=I(()=>e(h).length>ee),de=I(()=>e(H)?e(h).slice(0,ee):e(h));Ce(()=>x()),Re(()=>clearTimeout(V));var U=at(),q=o(r(U),2),R=r(q),W=o(r(R),2);Fe(W);var j=o(W,2),ce=r(j);n(j),n(R);var L=o(R,2),te=r(L);{var J=t=>{var a=Ve();he(2),v(t,a)},F=t=>{var a=Xe();he(2),v(t,a)},ue=t=>{var a=Ye(),l=o(we(a),2),p=r(l);n(l),S(()=>g(p,`${e(h).length??""}
${e(h).length===1?"cluster":"clusters"},
${e(C)??""} potential duplicate${e(C)===1?"":"s"}`)),v(t,a)};G(te,t=>{e(_)?t(J):e(A)?t(F,1):t(ue,!1)})}n(L);var ie=o(L,2);n(q);var k=o(q,2);{var c=t=>{var a=qe(),l=o(r(a),2),p=r(l,!0);n(l);var E=o(l,2);n(a),S(()=>g(p,e(A))),z("click",E,x),v(t,a)},D=t=>{var a=Qe();oe(a,20,()=>Array(3),Ae,(l,p)=>{var E=Je();v(l,E)}),n(a),v(t,a)},N=t=>{var a=$e();v(t,a)},Z=t=>{var a=it(),l=r(a);{var p=M=>{var f=et(),P=r(f);n(f),S(()=>g(P,`Showing first 50 of ${e(h).length??""} clusters. Raise the
threshold to narrow results.`)),v(M,f)};G(l,M=>{e(H)&&M(p)})}var E=o(l,2);oe(E,17,()=>e(de),({c:M,key:f})=>f,(M,f)=>{let P=()=>e(f).c,ae=()=>e(f).key;var Q=tt(),ve=r(Q);Ge(ve,{get similarity(){return P().similarity},get memories(){return P().memories},get suggestedAction(){return P().suggestedAction},onDismiss:()=>O(ae()),onMerge:(ne,$)=>Y(ae(),ne,$)}),n(Q),v(M,Q)}),n(a),v(t,a)};G(k,t=>{e(A)?t(c):e(_)?t(D,1):e(h).length===0?t(N,2):t(Z,!1)})}n(U),S(t=>{g(ce,`${t??""}%`),ie.disabled=e(_)},[()=>(e(d)*100).toFixed(0)]),z("input",W,X),Ne(W,()=>e(d),t=>w(d,t)),z("click",ie,x),v(s,U),ke()}Te(["input","click"]);export{ft as component};