vestige/apps/dashboard/build/_app/immutable/nodes/15.DFbOY736.js
Sam Valladares c433ae8b8d chore(release): v2.0.8 "Pulse"
Bundled release: Reasoning Theater wired to the 8-stage deep_reference
cognitive pipeline, Pulse InsightToast, Memory Birth Ritual (v2.3
Terrarium), 7 new dashboard surfaces (/duplicates, /dreams, /schedule,
/importance, /activation, /contradictions, /patterns), 3D graph
brightness system with auto distance-compensation + user slider, and
contradiction-detection + primary-selection hardening in the
cross_reference tool. Intel Mac (x86_64-apple-darwin) also flows through
to the release matrix from PR #43.

Added:
- POST /api/deep_reference — HTTP surface for the 8-stage pipeline
- DeepReferenceCompleted WebSocket event (primary + supporting +
  contradicting memory IDs for downstream graph animation)
- /reasoning route, full UI + Cmd+K Ask palette
- 7 new dashboard surfaces exposing the cognitive engine
- Graph brightness slider + localStorage persistence + distance-based
  emissive compensation so nodes don't disappear into fog at zoom-out

Fixed:
- Contradiction-detection false positives: adjacent-domain memories no
  longer flagged as conflicts (NEGATION_PAIRS wildcards removed,
  shared-words floor 2 → 4, topic-sim floor 0.15 → 0.55, STAGE 5
  overlap floor 0.15 → 0.4)
- Primary-memory selection: unified composite 0.5 × relevance + 0.2 ×
  trust + 0.3 × term_presence with hard topic-term filter, closing the
  class of bug where off-topic high-trust memories won queries about
  specific subjects
- Graph default-load fallback from sort=recent to sort=connected when
  the newest memory is isolated, both backend and client

Changed:
- Reasoning page information hierarchy: chain renders first as hero,
  confidence meter + Primary Source citation footer below
- Cargo feature split: embeddings code-only + ort-download | ort-dynamic
  backends; defaults preserve identical behavior for existing consumers
- CI release-build now gates PRs too so multi-platform regressions
  surface pre-merge
2026-04-23 02:09:21 -05:00

5 lines
26 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import"../chunks/Bzak7iHL.js";import{o as Nt}from"../chunks/CNjeV5xa.js";import{p as We,e as s,g as e,d as a,r as t,n as Fe,t as w,a as Ke,u as Z,s as ce,c as Tt,y as Ft,h as D,bc as jt,f as rt}from"../chunks/CvjSAYrz.js";import{s as v,d as Lt,a as Ge}from"../chunks/FzvEaXMa.js";import{i as O}from"../chunks/ciN1mm2W.js";import{e as re,i as ye}from"../chunks/DTnG8poT.js";import{a as f,f as _,b as ct}from"../chunks/BsvCUYx-.js";import{h as Dt}from"../chunks/DObx9JW_.js";import{s as K,r as Ot}from"../chunks/CNfQDikv.js";import{s as b}from"../chunks/Bhad70Ss.js";import{b as It}from"../chunks/CVpUe0w3.js";import{b as it}from"../chunks/D3XWCg9-.js";import{a as Mt}from"../chunks/DNjM5a-l.js";import{s as ut}from"../chunks/DPl3NjBv.js";import{p as ie}from"../chunks/B_YDQCB6.js";import{N as zt}from"../chunks/DzfRjky4.js";var $t=_('<div class="connector svelte-9hm057"></div>'),Bt=_('<div class="stage glass-subtle rounded-xl p-3 flex items-start gap-3 relative svelte-9hm057"><!> <div class="stage-orb flex-shrink-0 svelte-9hm057"><span class="text-xs text-synapse-glow svelte-9hm057"> </span></div> <div class="flex-1 min-w-0 svelte-9hm057"><div class="flex items-center gap-2 mb-0.5 svelte-9hm057"><span class="text-[10px] font-mono text-muted svelte-9hm057"> </span> <span class="text-sm text-bright font-medium svelte-9hm057"> </span></div> <p class="text-xs text-dim leading-snug svelte-9hm057"> </p></div> <span class="stage-pulse svelte-9hm057" aria-hidden="true"></span></div>'),Gt=_("<div></div>");function lt(l,o){We(o,!0);let V=ie(o,"intent",3,"Synthesis"),$=ie(o,"memoriesAnalyzed",3,0),R=ie(o,"evidenceCount",3,0),i=ie(o,"contradictionCount",3,0),B=ie(o,"supersededCount",3,0),E=ie(o,"running",3,!1),G=ie(o,"stageHints",19,()=>({}));const I=[{key:"broad",icon:"◎",label:"Broad Retrieval",base:"Hybrid BM25 + semantic (3x overfetch) then cross-encoder rerank"},{key:"spreading",icon:"⟿",label:"Spreading Activation",base:"Collins & Loftus — expand via graph edges to surface what search missed"},{key:"fsrs",icon:"▲",label:"FSRS Trust Scoring",base:"retention × stability × reps ÷ lapses — which memories have earned trust"},{key:"intent",icon:"◆",label:"Intent Classification",base:"FactCheck / Timeline / RootCause / Comparison / Synthesis"},{key:"supersession",icon:"↗",label:"Temporal Supersession",base:"Newer high-trust memories replace older ones on the same fact"},{key:"contradiction",icon:"⚡",label:"Contradiction Analysis",base:"Only flag conflicts between memories where BOTH have trust > 0.3"},{key:"relation",icon:"⬡",label:"Relation Assessment",base:"Per pair: Supports / Contradicts / Supersedes / Irrelevant"},{key:"template",icon:"❖",label:"Template Reasoning",base:"Build the natural-language reasoning chain you validate"}],Y=Z(()=>({broad:$()?`Analyzed ${$()} memories · ${R()} survived ranking`:void 0,intent:V()?`Classified as ${V()}`:void 0,supersession:B()?`${B()} outdated memor${B()===1?"y":"ies"} superseded`:void 0,contradiction:i()?`${i()} real conflict${i()===1?"":"s"} between trusted memories`:"No conflicts between trusted memories"}));function Q(M,z){return G()[M]??e(Y)[M]??z}var P=Gt();let ue;re(P,23,()=>I,M=>M.key,(M,z,H)=>{var A=Bt(),U=s(A);{var le=n=>{var p=$t();w(()=>b(p,`animation-delay: ${e(H)*140+120}ms;`)),f(n,p)};O(U,n=>{e(H)<I.length-1&&n(le)})}var J=a(U,2),ee=s(J),te=s(ee,!0);t(ee),t(J);var se=a(J,2),ae=s(se),ne=s(ae),pe=s(ne);t(ne);var ve=a(ne,2),me=s(ve,!0);t(ve),t(ae);var xe=a(ae,2),r=s(xe,!0);t(xe),t(se),Fe(2),t(A),w(n=>{b(A,`animation-delay: ${e(H)*140}ms;`),b(J,`animation-delay: ${e(H)*140}ms;`),v(te,e(z).icon),v(pe,`0${e(H)+1}`),v(me,e(z).label),v(r,n)},[()=>Q(e(z).key,e(z).base)]),f(M,A)}),t(P),w(()=>ue=ut(P,1,"reasoning-chain space-y-2 svelte-9hm057",null,ue,{running:E()})),f(l,P),Ke()}const Pt="#10b981",Ht="#f59e0b",He="#ef4444",vt="#8B95A5",ot={primary:{label:"Primary",accent:"synapse",icon:"◈"},supporting:{label:"Supporting",accent:"recall",icon:"◇"},contradicting:{label:"Contradicting",accent:"decay",icon:"⚠"},superseded:{label:"Superseded",accent:"muted",icon:"⊘"}};function Wt(l){return ot[l]??ot.supporting}function Te(l){return Number.isFinite(l)?l>75?Pt:l>=40?Ht:He:He}function dt(l){return Number.isFinite(l)?l>75?"HIGH CONFIDENCE":l>=40?"MIXED SIGNAL":"LOW CONFIDENCE":"LOW CONFIDENCE"}function Pe(l){return Number.isFinite(l)?Te(l*100):He}function Kt(l){return!Number.isFinite(l)||l<0?0:l>1?1:l}function Vt(l){return Kt(l)*100}function Yt(l){return l?zt[l]??vt:vt}function Qt(l,o){if(l==null||typeof l!="string"||l.trim()==="")return"—";const V=new Date(l);if(Number.isNaN(V.getTime()))return l;try{return V.toLocaleDateString(o,{month:"short",day:"numeric",year:"numeric"})}catch{return l}}function Ut(l,o=8){return l?l.length>o?l.slice(0,o):l:""}var Xt=_('<span class="px-1.5 py-0.5 rounded bg-white/[0.04] svelte-ksja6x"> </span>'),Zt=_('<div><div class="flex items-center justify-between text-[10px] uppercase tracking-wider svelte-ksja6x"><div class="flex items-center gap-2 svelte-ksja6x"><span class="role-pill px-2 py-0.5 rounded text-[10px] svelte-ksja6x"><span class="mr-1 svelte-ksja6x"> </span> </span> <!></div> <span class="text-muted font-mono text-[10px] svelte-ksja6x"> </span></div> <p class="text-sm text-text leading-relaxed line-clamp-4 svelte-ksja6x"> </p> <div class="space-y-1.5 svelte-ksja6x"><div class="flex items-center justify-between text-[10px] svelte-ksja6x"><span class="text-dim uppercase tracking-wider svelte-ksja6x">Trust</span> <span class="font-mono svelte-ksja6x"> </span></div> <div class="h-1.5 bg-deep rounded-full overflow-hidden svelte-ksja6x"><div class="h-full rounded-full transition-all duration-700 trust-fill svelte-ksja6x"></div></div></div> <div class="flex items-center justify-between text-[10px] text-muted pt-1 svelte-ksja6x"><span class="svelte-ksja6x"> </span> <span class="font-mono opacity-60 svelte-ksja6x">FSRS · reps × retention</span></div></div>');function Jt(l,o){We(o,!0);let V=ie(o,"index",3,0);const $=Z(()=>Vt(o.trust)),R=Z(()=>Wt(o.role)),i=Z(()=>Ut(o.id)),B=Z(()=>Yt(o.nodeType));var E=Zt();let G;var I=s(E),Y=s(I),Q=s(Y),P=s(Q),ue=s(P,!0);t(P);var M=a(P,1,!0);t(Q);var z=a(Q,2);{var H=r=>{var n=Xt(),p=s(n,!0);t(n),w(()=>{b(n,`color: ${e(B)??""}`),v(p,o.nodeType)}),f(r,n)};O(z,r=>{o.nodeType&&r(H)})}t(Y);var A=a(Y,2),U=s(A);t(A),t(I);var le=a(I,2),J=s(le,!0);t(le);var ee=a(le,2),te=s(ee),se=a(s(te),2),ae=s(se);t(se),t(te);var ne=a(te,2),pe=s(ne);t(ne),t(ee);var ve=a(ee,2),me=s(ve),xe=s(me,!0);t(me),Fe(2),t(ve),t(E),w((r,n,p,k,x)=>{G=ut(E,1,"evidence-card glass rounded-xl p-4 space-y-3 transition relative svelte-ksja6x",null,G,{contradicting:o.role==="contradicting",primary:o.role==="primary",superseded:o.role==="superseded"}),b(E,`animation-delay: ${V()*80}ms;`),K(E,"data-evidence-id",o.id),v(ue,e(R).icon),v(M,e(R).label),K(A,"title",o.id),v(U,`#${e(i)??""}`),v(J,o.preview),b(se,`color: ${r??""}`),v(ae,`${n??""}%`),b(pe,`width: ${e($)??""}%; background: ${p??""}; box-shadow: 0 0 8px ${k??""}80;`),v(xe,x)},[()=>Pe(o.trust),()=>e($).toFixed(0),()=>Pe(o.trust),()=>Pe(o.trust),()=>Qt(o.date)]),f(l,E),Ke()}var es=_('<button class="px-2.5 py-1 rounded-full glass-subtle text-[11px] text-dim hover:text-synapse-glow hover:!border-synapse/30 transition svelte-q2v96u"> </button>'),ts=_('<div class="flex flex-wrap gap-2 pt-1 svelte-q2v96u"><span class="text-[10px] uppercase tracking-wider text-muted mr-1 self-center svelte-q2v96u">Try</span> <!></div>'),ss=_('<div class="glass rounded-xl p-4 !border-decay/40 text-decay text-sm svelte-q2v96u"><span class="font-medium svelte-q2v96u">Error:</span> </div>'),as=_('<div class="glass-panel rounded-2xl p-6 space-y-4 svelte-q2v96u"><div class="flex items-center gap-2 text-xs text-dream-glow uppercase tracking-wider svelte-q2v96u"><span class="animate-pulse-glow svelte-q2v96u">●</span> <span class="svelte-q2v96u">Running cognitive pipeline</span></div> <!></div>'),ns=_('<div class="space-y-3 svelte-q2v96u"><div class="flex items-center justify-between svelte-q2v96u"><h2 class="text-sm text-bright font-semibold flex items-center gap-2 svelte-q2v96u"><span class="text-dream-glow svelte-q2v96u">❖</span> Reasoning</h2> <div class="flex items-center gap-3 text-[10px] text-muted font-mono svelte-q2v96u"><span class="svelte-q2v96u">intent: <span class="text-dim svelte-q2v96u"> </span></span> <span class="svelte-q2v96u">·</span> <span class="svelte-q2v96u"> </span> <span class="svelte-q2v96u">·</span> <span class="svelte-q2v96u"> </span></div></div> <div class="glass-panel rounded-2xl p-6 font-mono text-sm text-bright whitespace-pre-wrap leading-relaxed svelte-q2v96u"> </div></div>'),rs=ct('<path fill="none" stroke="url(#arcGrad)" stroke-width="1.5" stroke-dasharray="4 4" class="arc-path svelte-q2v96u"></path><circle r="4" fill="#ef4444" opacity="0.8" class="arc-dot svelte-q2v96u"></circle><circle r="4" fill="#ef4444" opacity="0.8" class="arc-dot svelte-q2v96u"></circle>',1),is=ct('<svg class="contradiction-arcs pointer-events-none absolute inset-0 w-full h-full svelte-q2v96u" aria-hidden="true"><defs class="svelte-q2v96u"><linearGradient id="arcGrad" x1="0" y1="0" x2="1" y2="0" class="svelte-q2v96u"><stop offset="0%" stop-color="#ef4444" stop-opacity="0.9" class="svelte-q2v96u"></stop><stop offset="50%" stop-color="#ef4444" stop-opacity="0.4" class="svelte-q2v96u"></stop><stop offset="100%" stop-color="#ef4444" stop-opacity="0.9" class="svelte-q2v96u"></stop></linearGradient></defs><!></svg>'),ls=_('<div class="flex items-start gap-3 p-3 rounded-xl bg-decay/[0.05] border border-decay/20 svelte-q2v96u"><span class="text-decay text-lg svelte-q2v96u">⚠</span> <div class="flex-1 space-y-1 svelte-q2v96u"><div class="flex items-center gap-2 text-[10px] font-mono text-muted svelte-q2v96u"><span class="svelte-q2v96u"> </span> <span class="text-decay svelte-q2v96u">↔</span> <span class="svelte-q2v96u"> </span></div> <p class="text-sm text-text svelte-q2v96u"> </p></div> <span class="text-[10px] font-mono text-muted svelte-q2v96u"></span></div>'),vs=_('<div class="space-y-3 svelte-q2v96u"><h2 class="text-sm font-semibold flex items-center gap-2 svelte-q2v96u" style="color: #fca5a5;"><span class="svelte-q2v96u">⚡</span> Contradictions Detected <span class="font-normal text-muted svelte-q2v96u"> </span></h2> <div class="glass rounded-2xl p-4 space-y-3 !border-decay/30 svelte-q2v96u"></div></div>'),os=_('<div class="flex items-center gap-3 text-xs text-dim svelte-q2v96u"><span class="font-mono text-muted svelte-q2v96u"> </span> <span class="text-dream-glow svelte-q2v96u">⟶</span> <span class="font-mono text-synapse-glow svelte-q2v96u"> </span> <span class="text-muted svelte-q2v96u"> </span></div>'),ds=_('<div class="space-y-3 svelte-q2v96u"><h2 class="text-sm text-dim font-semibold flex items-center gap-2 svelte-q2v96u"><span class="svelte-q2v96u">⊘</span> Superseded <span class="font-normal text-muted svelte-q2v96u"> </span></h2> <div class="glass-subtle rounded-2xl p-4 space-y-2 svelte-q2v96u"></div></div>'),cs=_('<div class="flex items-start gap-3 text-xs svelte-q2v96u"><span class="text-muted font-mono whitespace-nowrap svelte-q2v96u"> </span> <span class="mt-1 w-1.5 h-1.5 rounded-full flex-shrink-0 svelte-q2v96u"></span> <span class="text-dim flex-1 svelte-q2v96u"> </span></div>'),us=_('<div class="space-y-3 svelte-q2v96u"><h2 class="text-sm text-bright font-semibold flex items-center gap-2 svelte-q2v96u"><span class="text-dream-glow svelte-q2v96u">↗</span> Evolution</h2> <div class="glass rounded-2xl p-4 space-y-2 svelte-q2v96u"></div></div>'),ps=_('<p class="text-xs text-dim leading-relaxed svelte-q2v96u"><span class="text-synapse-glow mr-2 svelte-q2v96u"></span> </p>'),ms=_('<div class="space-y-3 svelte-q2v96u"><h2 class="text-sm text-bright font-semibold flex items-center gap-2 svelte-q2v96u"><span class="text-dream-glow svelte-q2v96u">◇</span> Related Insights</h2> <div class="glass rounded-2xl p-4 space-y-2 svelte-q2v96u"></div></div>'),xs=_('<!> <div class="grid md:grid-cols-[280px_1fr] gap-4 svelte-q2v96u"><div class="glass-panel rounded-2xl p-5 flex flex-col items-center justify-center text-center space-y-2 svelte-q2v96u"><span class="text-[10px] uppercase tracking-wider text-dim svelte-q2v96u">Confidence</span> <div class="relative svelte-q2v96u"><span class="block text-6xl font-bold font-mono conf-number svelte-q2v96u"> <span class="text-2xl align-top opacity-60 svelte-q2v96u">%</span></span></div> <span class="text-[10px] font-mono tracking-wider svelte-q2v96u"> </span> <svg width="220" height="14" viewBox="0 0 220 14" class="mt-1 svelte-q2v96u"><rect x="0" y="5" width="220" height="4" rx="2" fill="rgba(255,255,255,0.05)" class="svelte-q2v96u"></rect><rect x="0" y="5" height="4" rx="2" class="svelte-q2v96u"><animate attributeName="width" from="0" dur="0.9s" fill="freeze" class="svelte-q2v96u"></animate></rect></svg> <div class="flex gap-3 pt-2 text-[10px] text-muted font-mono svelte-q2v96u"><span class="svelte-q2v96u">intent: <span class="text-dim svelte-q2v96u"> </span></span> <span class="svelte-q2v96u">·</span> <span class="svelte-q2v96u"> </span></div></div> <div class="glass-panel rounded-2xl p-5 space-y-3 !border-synapse/25 svelte-q2v96u"><div class="flex items-center justify-between svelte-q2v96u"><span class="text-[10px] uppercase tracking-wider text-synapse-glow svelte-q2v96u">Primary Source</span> <span class="text-[10px] font-mono text-muted svelte-q2v96u"> </span></div> <p class="text-base text-bright leading-relaxed svelte-q2v96u"> </p> <div class="flex items-center gap-4 text-[11px] text-muted pt-1 border-t border-synapse/10 svelte-q2v96u"><span class="flex items-center gap-1.5 svelte-q2v96u"><span class="w-2 h-2 rounded-full svelte-q2v96u"></span> </span> <span class="svelte-q2v96u">·</span> <span class="svelte-q2v96u"> </span></div></div></div> <div class="space-y-3 svelte-q2v96u"><h2 class="text-sm text-bright font-semibold flex items-center gap-2 svelte-q2v96u"><span class="text-dream-glow svelte-q2v96u">⟿</span> Cognitive Pipeline</h2> <div class="glass-panel rounded-2xl p-5 svelte-q2v96u"><!></div></div> <div class="space-y-3 svelte-q2v96u"><div class="flex items-center justify-between svelte-q2v96u"><h2 class="text-sm text-bright font-semibold flex items-center gap-2 svelte-q2v96u"><span class="text-synapse-glow svelte-q2v96u">◈</span> Evidence <span class="text-muted font-normal svelte-q2v96u"> </span></h2> <div class="flex items-center gap-3 text-[10px] text-muted svelte-q2v96u"><span class="flex items-center gap-1 svelte-q2v96u"><span class="w-2 h-2 rounded-full bg-synapse-glow svelte-q2v96u"></span>primary</span> <span class="flex items-center gap-1 svelte-q2v96u"><span class="w-2 h-2 rounded-full bg-recall svelte-q2v96u"></span>supporting</span> <span class="flex items-center gap-1 svelte-q2v96u"><span class="w-2 h-2 rounded-full bg-decay svelte-q2v96u"></span>contradicting</span> <span class="flex items-center gap-1 svelte-q2v96u"><span class="w-2 h-2 rounded-full bg-muted svelte-q2v96u"></span>superseded</span></div></div> <div class="evidence-grid relative grid sm:grid-cols-2 lg:grid-cols-3 gap-3 svelte-q2v96u"><!> <!></div></div> <!> <!> <div class="grid md:grid-cols-2 gap-4 svelte-q2v96u"><!> <!></div>',1),gs=_(`<div class="glass-subtle rounded-2xl p-12 text-center space-y-3 svelte-q2v96u"><div class="text-5xl opacity-20 svelte-q2v96u">❖</div> <p class="text-sm text-dim svelte-q2v96u">Ask anything. Vestige will run the full reasoning pipeline and show you its work.</p> <p class="text-[10px] text-muted font-mono svelte-q2v96u">8-stage pipeline: retrieval → rerank → activation → trust-score → supersession →
contradiction → relations → chain. Zero LLM calls, 100% local.</p></div>`),fs=_(`<div class="p-6 max-w-6xl mx-auto space-y-8 svelte-q2v96u"><div class="space-y-2 svelte-q2v96u"><div class="flex items-center gap-3 svelte-q2v96u"><span class="text-2xl text-dream-glow svelte-q2v96u">❖</span> <h1 class="text-xl text-bright font-semibold svelte-q2v96u">Reasoning Theater</h1> <span class="px-2 py-0.5 rounded bg-dream/15 border border-dream/30 text-[10px] text-dream-glow uppercase tracking-wider svelte-q2v96u">deep_reference</span></div> <p class="text-xs text-dim max-w-2xl svelte-q2v96u">Watch Vestige reason. Your query runs the 8-stage cognitive pipeline — broad retrieval,
spreading activation, FSRS trust scoring, intent classification, supersession, contradiction
analysis, relation assessment, template reasoning — and returns a pre-built answer with
trust-scored evidence.</p></div> <div class="glass-panel rounded-2xl p-5 space-y-4 svelte-q2v96u"><div class="flex items-center gap-3 svelte-q2v96u"><span class="text-lg text-synapse-glow svelte-q2v96u">◎</span> <input type="text" placeholder="Ask your memory anything..." class="flex-1 bg-transparent text-bright text-lg placeholder:text-muted focus:outline-none font-mono svelte-q2v96u"/> <kbd class="hidden sm:inline-flex items-center gap-1 px-2 py-1 rounded bg-white/[0.04] border border-synapse/15 text-[10px] text-dim font-mono svelte-q2v96u"><span class="svelte-q2v96u">⌘</span>K</kbd> <button class="px-4 py-2 rounded-xl bg-synapse/20 border border-synapse/40 text-synapse-glow text-sm hover:bg-synapse/30 transition disabled:opacity-40 disabled:cursor-not-allowed svelte-q2v96u"> </button></div> <!></div> <!> <!> <!> <!></div>`);function Ls(l,o){We(o,!0);async function V(r){var qe,Ee,we;const n=await Mt.deepReference(r,20),k=(Array.isArray(n.evidence)?n.evidence:[]).map(c=>{const T=typeof c.trust=="number"?c.trust:0,ke=T>1?T/100:T,Se=c.role||"supporting";return{id:String(c.id??""),trust:Math.max(0,Math.min(1,ke)),date:String(c.date??""),role:Se,preview:String(c.preview??""),nodeType:c.node_type?String(c.node_type):c.nodeType?String(c.nodeType):void 0}}),x=n.recommended,N={answer_preview:String((x==null?void 0:x.answer_preview)??((qe=k[0])==null?void 0:qe.preview)??""),memory_id:String((x==null?void 0:x.memory_id)??((Ee=k[0])==null?void 0:Ee.id)??""),trust_score:(()=>{var T;const c=x==null?void 0:x.trust_score;return typeof c=="number"?c>1?c/100:c:((T=k[0])==null?void 0:T.trust)??0})(),date:String((x==null?void 0:x.date)??((we=k[0])==null?void 0:we.date)??"")},ge=(Array.isArray(n.contradictions)?n.contradictions:[]).map(c=>({a_id:String(c.a_id??""),b_id:String(c.b_id??""),summary:String(c.summary??c.reason??"Trust-weighted conflict between high-FSRS memories.")})),he=(Array.isArray(n.superseded)?n.superseded:[]).map(c=>({old_id:String(c.old_id??""),new_id:String(c.new_id??N.memory_id??""),reason:String(c.reason??"Superseded by newer memory with higher FSRS trust.")})),fe=(Array.isArray(n.evolution)?n.evolution:[]).map(c=>({date:String(c.date??""),summary:String(c.summary??c.preview??""),trust:(()=>{const T=c.trust;return typeof T=="number"?T>1?T/100:T:0})()})),je=Array.isArray(n.related_insights)?n.related_insights:[],oe=typeof n.confidence=="number"?n.confidence:0,de=oe>1?Math.round(oe):Math.round(oe*100),Le=String(n.intent??"Synthesis"),Re=String(n.reasoning??n.guidance??""),be=typeof n.memoriesAnalyzed=="number"?n.memoriesAnalyzed:k.length;return{intent:Le,reasoning:Re,recommended:N,evidence:k,contradictions:ge,superseded:he,evolution:fe,related_insights:je,confidence:de,memoriesAnalyzed:be}}let $=ce(""),R=ce(!1),i=ce(null),B=ce(null),E=ce(null),G=ce(null),I=ce(Tt([]));async function Y(){const r=e($).trim();if(!(!r||e(R))){D(R,!0),D(B,null),D(i,null),D(I,[],!0);try{D(i,await V(r),!0),requestAnimationFrame(()=>requestAnimationFrame(Q))}catch(n){D(B,n instanceof Error?n.message:"Unknown error",!0)}finally{D(R,!1)}}}function Q(){if(!e(i)||!e(G)||e(i).contradictions.length===0){D(I,[],!0);return}const r=e(G).getBoundingClientRect(),n=[];for(const p of e(i).contradictions){const k=e(G).querySelector(`[data-evidence-id="${p.a_id}"]`),x=e(G).querySelector(`[data-evidence-id="${p.b_id}"]`);if(!k||!x)continue;const N=k.getBoundingClientRect(),W=x.getBoundingClientRect();n.push({x1:N.left-r.left+N.width/2,y1:N.top-r.top+N.height/2,x2:W.left-r.left+W.width/2,y2:W.top-r.top+W.height/2})}D(I,n,!0)}function P(r){var n,p;(r.metaKey||r.ctrlKey)&&r.key.toLowerCase()==="k"&&(r.preventDefault(),(n=e(E))==null||n.focus(),(p=e(E))==null||p.select())}Nt(()=>{var r;return(r=e(E))==null||r.focus(),window.addEventListener("keydown",P),window.addEventListener("resize",Q),()=>{window.removeEventListener("keydown",P),window.removeEventListener("resize",Q)}});const ue=["What port does the dev server use?","Should I enable prefix caching with vLLM?","Why did the AIMO3 submission score 36/50?","How does FSRS-6 trust scoring work?"];var M=fs();Dt("q2v96u",r=>{Ft(()=>{jt.title="Reasoning Theater · Vestige"})});var z=a(s(M),2),H=s(z),A=a(s(H),2);Ot(A),it(A,r=>D(E,r),()=>e(E));var U=a(A,4),le=s(U,!0);t(U),t(H);var J=a(H,2);{var ee=r=>{var n=ts(),p=a(s(n),2);re(p,17,()=>ue,ye,(k,x)=>{var N=es(),W=s(N,!0);t(N),w(()=>v(W,e(x))),Ge("click",N,()=>{D($,e(x),!0),Y()}),f(k,N)}),t(n),f(r,n)};O(J,r=>{!e(i)&&!e(R)&&r(ee)})}t(z);var te=a(z,2);{var se=r=>{var n=ss(),p=a(s(n));t(n),w(()=>v(p,` ${e(B)??""}`)),f(r,n)};O(te,r=>{e(B)&&r(se)})}var ae=a(te,2);{var ne=r=>{var n=as(),p=a(s(n),2);lt(p,{running:!0}),t(n),f(r,n)};O(ae,r=>{e(R)&&r(ne)})}var pe=a(ae,2);{var ve=r=>{const n=Z(()=>e(i).confidence),p=Z(()=>Te(e(n)));var k=xs(),x=rt(k);{var N=u=>{var d=ns(),g=s(d),S=a(s(g),2),m=s(S),y=a(s(m)),j=s(y,!0);t(y),t(m);var C=a(m,4),L=s(C);t(C);var h=a(C,4),F=s(h);t(h),t(S),t(g);var q=a(g,2),X=s(q,!0);t(q),t(d),w(_e=>{v(j,e(i).intent),v(L,`${e(i).memoriesAnalyzed??""} analyzed`),b(h,`color: ${e(p)??""}`),v(F,`${e(n)??""}% ${_e??""}`),b(q,`box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.03), 0 0 32px ${e(p)??""}20, 0 8px 32px rgba(0,0,0,0.4); border-color: ${e(p)??""}35;`),v(X,e(i).reasoning)},[()=>dt(e(n))]),f(u,d)};O(x,u=>{e(i).reasoning&&u(N)})}var W=a(x,2),ge=s(W),Ce=a(s(ge),2),he=s(Ce),Ve=s(he,!0);Fe(),t(he),t(Ce);var fe=a(Ce,2),je=s(fe,!0);t(fe);var oe=a(fe,2),de=a(s(oe)),Le=s(de);t(de),t(oe);var Re=a(oe,2),be=s(Re),qe=a(s(be)),Ee=s(qe,!0);t(qe),t(be);var we=a(be,4),c=s(we);t(we),t(Re),t(ge);var T=a(ge,2),ke=s(T),Se=a(s(ke),2),pt=s(Se);t(Se),t(ke);var De=a(ke,2),mt=s(De,!0);t(De);var Ye=a(De,2),Oe=s(Ye),Qe=s(Oe),xt=a(Qe);t(Oe);var Ue=a(Oe,4),gt=s(Ue,!0);t(Ue),t(Ye),t(T),t(W);var Ie=a(W,2),Xe=a(s(Ie),2),ft=s(Xe);lt(ft,{get intent(){return e(i).intent},get memoriesAnalyzed(){return e(i).memoriesAnalyzed},get evidenceCount(){return e(i).evidence.length},get contradictionCount(){return e(i).contradictions.length},get supersededCount(){return e(i).superseded.length}}),t(Xe),t(Ie);var Me=a(Ie,2),ze=s(Me),Ze=s(ze),Je=a(s(Ze),2),_t=s(Je);t(Je),t(Ze),Fe(2),t(ze);var $e=a(ze,2),et=s($e);re(et,19,()=>e(i).evidence,u=>u.id,(u,d,g)=>{Jt(u,{get id(){return e(d).id},get trust(){return e(d).trust},get date(){return e(d).date},get role(){return e(d).role},get preview(){return e(d).preview},get nodeType(){return e(d).nodeType},get index(){return e(g)}})});var yt=a(et,2);{var ht=u=>{var d=is(),g=a(s(d));re(g,17,()=>e(I),ye,(S,m,y)=>{const j=Z(()=>(e(m).x1+e(m).x2)/2),C=Z(()=>Math.min(e(m).y1,e(m).y2)-28);var L=rs(),h=rt(L);b(h,`animation-delay: ${y*120+600}ms;`);var F=a(h);b(F,`animation-delay: ${y*120+600}ms;`);var q=a(F);b(q,`animation-delay: ${y*120+700}ms;`),w(()=>{K(h,"d",`M ${e(m).x1??""} ${e(m).y1??""} Q ${e(j)??""} ${e(C)??""} ${e(m).x2??""} ${e(m).y2??""}`),K(F,"cx",e(m).x1),K(F,"cy",e(m).y1),K(q,"cx",e(m).x2),K(q,"cy",e(m).y2)}),f(S,L)}),t(d),f(u,d)};O(yt,u=>{e(I).length>0&&u(ht)})}t($e),it($e,u=>D(G,u),()=>e(G)),t(Me);var tt=a(Me,2);{var bt=u=>{var d=vs(),g=s(d),S=a(s(g),2),m=s(S);t(S),t(g);var y=a(g,2);re(y,21,()=>e(i).contradictions,ye,(j,C,L)=>{var h=ls(),F=a(s(h),2),q=s(F),X=s(q),_e=s(X);t(X);var Ae=a(X,4),Be=s(Ae);t(Ae),t(q);var Ne=a(q,2),Ct=s(Ne,!0);t(Ne),t(F);var Rt=a(F,2);Rt.textContent=`pair ${L+1}`,t(h),w((Et,At)=>{v(_e,`#${Et??""}`),v(Be,`#${At??""}`),v(Ct,e(C).summary)},[()=>e(C).a_id.slice(0,8),()=>e(C).b_id.slice(0,8)]),f(j,h)}),t(y),t(d),w(()=>v(m,`(${e(i).contradictions.length??""})`)),f(u,d)};O(tt,u=>{e(i).contradictions.length>0&&u(bt)})}var st=a(tt,2);{var qt=u=>{var d=ds(),g=s(d),S=a(s(g),2),m=s(S);t(S),t(g);var y=a(g,2);re(y,21,()=>e(i).superseded,ye,(j,C)=>{var L=os(),h=s(L),F=s(h);t(h);var q=a(h,4),X=s(q);t(q);var _e=a(q,2),Ae=s(_e,!0);t(_e),t(L),w((Be,Ne)=>{v(F,`#${Be??""}`),v(X,`#${Ne??""}`),v(Ae,e(C).reason)},[()=>e(C).old_id.slice(0,8),()=>e(C).new_id.slice(0,8)]),f(j,L)}),t(y),t(d),w(()=>v(m,`(${e(i).superseded.length??""})`)),f(u,d)};O(st,u=>{e(i).superseded.length>0&&u(qt)})}var at=a(st,2),nt=s(at);{var wt=u=>{var d=us(),g=a(s(d),2);re(g,21,()=>e(i).evolution,ye,(S,m)=>{var y=cs(),j=s(y),C=s(j,!0);t(j);var L=a(j,2),h=a(L,2),F=s(h,!0);t(h),t(y),w((q,X)=>{v(C,q),b(L,`background: ${X??""}`),v(F,e(m).summary)},[()=>new Date(e(m).date).toLocaleDateString(void 0,{month:"short",day:"numeric"}),()=>Te(e(m).trust*100)]),f(S,y)}),t(g),t(d),f(u,d)};O(nt,u=>{e(i).evolution.length>0&&u(wt)})}var kt=a(nt,2);{var St=u=>{var d=ms(),g=a(s(d),2);re(g,21,()=>e(i).related_insights,ye,(S,m)=>{var y=ps(),j=a(s(y),1,!0);t(y),w(()=>v(j,e(m))),f(S,y)}),t(g),t(d),f(u,d)};O(kt,u=>{e(i).related_insights.length>0&&u(St)})}t(at),w((u,d,g,S,m)=>{b(ge,`box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.03), 0 0 32px ${e(p)??""}30, 0 8px 32px rgba(0,0,0,0.4); border-color: ${e(p)??""}40;`),b(he,`color: ${e(p)??""}; text-shadow: 0 0 24px ${e(p)??""}80;`),v(Ve,e(n)),b(fe,`color: ${e(p)??""}`),v(je,u),K(de,"width",e(n)/100*220),K(de,"fill",e(p)),b(de,`filter: drop-shadow(0 0 6px ${e(p)??""});`),K(Le,"to",e(n)/100*220),v(Ee,e(i).intent),v(c,`${e(i).memoriesAnalyzed??""} analyzed`),K(Se,"title",e(i).recommended.memory_id),v(pt,`#${d??""}`),v(mt,e(i).recommended.answer_preview),b(Qe,`background: ${g??""}`),v(xt,` Trust ${S??""}%`),v(gt,m),v(_t,`(${e(i).evidence.length??""})`)},[()=>dt(e(n)),()=>e(i).recommended.memory_id.slice(0,8),()=>Te(e(i).recommended.trust_score*100),()=>(e(i).recommended.trust_score*100).toFixed(0),()=>new Date(e(i).recommended.date).toLocaleDateString()]),f(r,k)};O(pe,r=>{e(i)&&!e(R)&&r(ve)})}var me=a(pe,2);{var xe=r=>{var n=gs();f(r,n)};O(me,r=>{!e(i)&&!e(R)&&!e(B)&&r(xe)})}t(M),w(r=>{U.disabled=r,v(le,e(R)?"Reasoning…":"Reason")},[()=>!e($).trim()||e(R)]),Ge("keydown",A,r=>r.key==="Enter"&&Y()),It(A,()=>e($),r=>D($,r)),Ge("click",U,Y),f(l,M),Ke()}Lt(["keydown","click"]);export{Ls as component};