feat(graph): FSRS memory-state colour mode + legend overlay

Closes Agent 1's audit gap #4: FSRS memory state (Active / Dormant /
Silent / Unavailable) was computed server-side per query but never
rendered in the 3D graph. Spheres always tinted by node type.

The new colour mode adds a second channel that users can toggle
between at runtime — Type (default, existing behaviour) and State
(new). The toggle is a radio-pair pill in the graph page's top-right
control bar next to the node-count selector + Dream button.

Buckets + palette:
- Active    ≥ 70%  emerald #10b981  easily retrievable
- Dormant  40-70%  amber   #f59e0b  retrievable with effort
- Silent   10-40%  violet  #8b5cf6  difficult, needs cues
- Unavail.  < 10%  slate   #6b7280  needs reinforcement

Thresholds match `execute_system_status` at the backend so the graph
colour bands line up exactly with what the Stats page reports in its
stateDistribution block. Using retention as the proxy for the full
accessibility formula (retention × 0.5 + retrieval × 0.3 + storage ×
0.2) is an approximation — retention is the dominant 0.5 weight and
it is the only FSRS channel the current GraphNode DTO carries. Swap
to the full formula in a future release if the DTO grows.

Implementation:
- `apps/dashboard/src/lib/graph/nodes.ts` — new `MemoryState` type,
  `getMemoryState(retention)`, `MEMORY_STATE_COLORS`,
  `MEMORY_STATE_DESCRIPTIONS`, `ColorMode`, `getNodeColor(node, mode)`.
- `NodeManager.colorMode` field (default `'type'`). `createNodeMeshes`
  now calls `getNodeColor(node, this.colorMode)` so newly-added nodes
  during the session follow the toggled mode.
- New `NodeManager.setColorMode(mode)` mutates every live mesh's
  material + glow sprite colour in place. Idempotent; cheap. Does NOT
  touch opacity/emissive-intensity so the v2.0.5 suppression dimming
  layer keeps working unchanged.
- New `MemoryStateLegend.svelte` floating overlay in the bottom-right
  when state mode is active (hidden in type mode so the legend doesn't
  compete with the node-type palette).
- `Graph3D.svelte` accepts a new `colorMode` prop (default `'type'`)
  and runs a `$effect` that calls `setColorMode` on every toggle.
- Dashboard rebuild picks up the new component + wiring.

Tests: 171 vitest, svelte-check 581 files / 0 errors. No backend
changes; this is pure dashboard code.
This commit is contained in:
Sam Valladares 2026-04-19 20:45:08 -05:00
parent 40b963e15b
commit 4c2016596c
208 changed files with 464 additions and 253 deletions

View file

@ -1 +1 @@
import"../chunks/Bzak7iHL.js";import"../chunks/D_N1HvA5.js";import{p as h,f as g,t as d,a as l,d as v,e as s,r as o}from"../chunks/nyjtQ1Ok.js";import{s as p}from"../chunks/C4L78yoI.js";import{a as _,f as x}from"../chunks/B0IenmM-.js";import{i as $}from"../chunks/Ck7jSX2P.js";import{p as m}from"../chunks/DLW_bV71.js";import{s as k}from"../chunks/Bmuqs8iK.js";const b={get error(){return m.error},get status(){return m.status}};k.updated.check;const i=b;var E=x("<h1> </h1> <p> </p>",1);function D(f,n){h(n,!1),$();var t=E(),r=g(t),c=s(r,!0);o(r);var a=v(r,2),u=s(a,!0);o(a),d(()=>{var e;p(c,i.status),p(u,(e=i.error)==null?void 0:e.message)}),_(f,t),l()}export{D as component};
import"../chunks/Bzak7iHL.js";import"../chunks/CrlWs-6R.js";import{p as h,f as g,t as d,a as l,d as v,e as s,r as o}from"../chunks/VE8Jor13.js";import{s as p}from"../chunks/DHnEMX8z.js";import{a as _,f as x}from"../chunks/7UNxJI5L.js";import{i as $}from"../chunks/jyeIy8pa.js";import{p as m}from"../chunks/FMdNDkar.js";import{s as k}from"../chunks/00s_zK56.js";const b={get error(){return m.error},get status(){return m.status}};k.updated.check;const i=b;var E=x("<h1> </h1> <p> </p>",1);function D(f,n){h(n,!1),$();var t=E(),r=g(t),c=s(r,!0);o(r);var a=v(r,2),u=s(a,!0);o(a),d(()=>{var e;p(c,i.status),p(u,(e=i.error)==null?void 0:e.message)}),_(f,t),l()}export{D as component};

View file

@ -1 +1 @@
import"../chunks/Bzak7iHL.js";import{o as pe}from"../chunks/DeTA_5mp.js";import{p as ce,s as b,c as me,g as e,a as _e,d as i,e as a,h as c,r as t,t as g}from"../chunks/nyjtQ1Ok.js";import{d as ue,a as K,s as m}from"../chunks/C4L78yoI.js";import{i as M}from"../chunks/B17metm1.js";import{e as h,i as P}from"../chunks/BilMa3tw.js";import{a as l,f as v}from"../chunks/B0IenmM-.js";import{s as Q}from"../chunks/D2QmVWrb.js";import{b as xe}from"../chunks/J2LZW-kP.js";import{a as fe}from"../chunks/DcQGRi49.js";import{N as U}from"../chunks/BNytumrp.js";var be=v('<div class="h-16 glass-subtle rounded-xl animate-pulse"></div>'),ge=v('<div class="space-y-4"></div>'),he=v('<div class="text-center py-20 text-dim"><p>No memories in the selected time range.</p></div>'),ye=v('<div class="w-2 h-2 rounded-full"></div>'),we=v('<span class="text-xs text-muted"> </span>'),ke=v('<div class="flex items-start gap-2 text-sm"><div class="w-2 h-2 mt-1.5 rounded-full flex-shrink-0"></div> <div class="flex-1 min-w-0"><span class="text-dim line-clamp-1"> </span></div> <span class="text-xs text-muted flex-shrink-0"> </span></div>'),Te=v('<div class="mt-3 pt-3 border-t border-synapse/10 space-y-2"></div>'),je=v('<div class="relative pl-14"><div class="absolute left-4 top-3 w-5 h-5 rounded-full border-2 border-synapse bg-void flex items-center justify-center"><div class="w-2 h-2 rounded-full bg-synapse"></div></div> <button class="w-full text-left p-4 glass-subtle rounded-xl hover:bg-white/[0.03] transition-all"><div class="flex items-center justify-between"><div><span class="text-sm text-bright font-medium"> </span> <span class="text-xs text-dim ml-2"> </span></div> <div class="flex gap-1"><!> <!></div></div> <!></button></div>'),Ae=v('<div class="relative"><div class="absolute left-6 top-0 bottom-0 w-px bg-synapse/15"></div> <div class="space-y-4"></div></div>'),Ne=v('<div class="p-6 max-w-4xl mx-auto space-y-6"><div class="flex items-center justify-between"><h1 class="text-xl text-bright font-semibold">Timeline</h1> <select class="px-3 py-2 bg-white/[0.03] border border-synapse/10 rounded-xl text-dim text-sm focus:outline-none backdrop-blur-sm"><option>7 days</option><option>14 days</option><option>30 days</option><option>90 days</option></select></div> <!></div>');function Re(V,W){ce(W,!0);let _=b(me([])),y=b(!0),w=b(14),k=b(null);pe(()=>R());async function R(){c(y,!0);try{const s=await fe.timeline(e(w),500);c(_,s.timeline,!0)}catch{c(_,[],!0)}finally{c(y,!1)}}var T=Ne(),j=a(T),u=i(a(j),2),A=a(u);A.value=A.__value=7;var N=i(A);N.value=N.__value=14;var O=i(N);O.value=O.__value=30;var Y=i(O);Y.value=Y.__value=90,t(u),t(j);var X=i(j,2);{var Z=s=>{var d=ge();h(d,20,()=>Array(7),P,(x,f)=>{var r=be();l(x,r)}),t(d),l(s,d)},ee=s=>{var d=he();l(s,d)},te=s=>{var d=Ae(),x=i(a(d),2);h(x,21,()=>e(_),f=>f.date,(f,r)=>{var S=je(),B=i(a(S),2),D=a(B),E=a(D),$=a(E),ae=a($,!0);t($);var q=i($,2),se=a(q);t(q),t(E);var z=i(E,2),G=a(z);h(G,17,()=>e(r).memories.slice(0,10),P,(n,o)=>{var p=ye();g(()=>Q(p,`background: ${(U[e(o).nodeType]||"#8B95A5")??""}; opacity: ${.3+e(o).retentionStrength*.7}`)),l(n,p)});var ie=i(G,2);{var re=n=>{var o=we(),p=a(o);t(o),g(()=>m(p,`+${e(r).memories.length-10}`)),l(n,o)};M(ie,n=>{e(r).memories.length>10&&n(re)})}t(z),t(D);var oe=i(D,2);{var le=n=>{var o=Te();h(o,21,()=>e(r).memories,P,(p,C)=>{var F=ke(),H=a(F),L=i(H,2),I=a(L),ve=a(I,!0);t(I),t(L);var J=i(L,2),de=a(J);t(J),t(F),g(ne=>{Q(H,`background: ${(U[e(C).nodeType]||"#8B95A5")??""}`),m(ve,e(C).content),m(de,`${ne??""}%`)},[()=>(e(C).retentionStrength*100).toFixed(0)]),l(p,F)}),t(o),l(n,o)};M(oe,n=>{e(k)===e(r).date&&n(le)})}t(B),t(S),g(()=>{m(ae,e(r).date),m(se,`${e(r).count??""} memories`)}),K("click",B,()=>c(k,e(k)===e(r).date?null:e(r).date,!0)),l(f,S)}),t(x),t(d),l(s,d)};M(X,s=>{e(y)?s(Z):e(_).length===0?s(ee,1):s(te,!1)})}t(T),K("change",u,R),xe(u,()=>e(w),s=>c(w,s)),l(V,T),_e()}ue(["change","click"]);export{Re as component};
import"../chunks/Bzak7iHL.js";import{o as pe}from"../chunks/DWVWfZUn.js";import{p as ce,s as b,c as me,g as e,a as _e,d as i,e as a,h as c,r as t,t as g}from"../chunks/VE8Jor13.js";import{d as ue,a as K,s as m}from"../chunks/DHnEMX8z.js";import{i as M}from"../chunks/JkhlGLjU.js";import{e as h,i as P}from"../chunks/ByItJEsC.js";import{a as l,f as v}from"../chunks/7UNxJI5L.js";import{s as Q}from"../chunks/ussr1V5_.js";import{b as xe}from"../chunks/B5Pq2mnD.js";import{a as fe}from"../chunks/DcQGRi49.js";import{N as U}from"../chunks/BNytumrp.js";var be=v('<div class="h-16 glass-subtle rounded-xl animate-pulse"></div>'),ge=v('<div class="space-y-4"></div>'),he=v('<div class="text-center py-20 text-dim"><p>No memories in the selected time range.</p></div>'),ye=v('<div class="w-2 h-2 rounded-full"></div>'),we=v('<span class="text-xs text-muted"> </span>'),ke=v('<div class="flex items-start gap-2 text-sm"><div class="w-2 h-2 mt-1.5 rounded-full flex-shrink-0"></div> <div class="flex-1 min-w-0"><span class="text-dim line-clamp-1"> </span></div> <span class="text-xs text-muted flex-shrink-0"> </span></div>'),Te=v('<div class="mt-3 pt-3 border-t border-synapse/10 space-y-2"></div>'),je=v('<div class="relative pl-14"><div class="absolute left-4 top-3 w-5 h-5 rounded-full border-2 border-synapse bg-void flex items-center justify-center"><div class="w-2 h-2 rounded-full bg-synapse"></div></div> <button class="w-full text-left p-4 glass-subtle rounded-xl hover:bg-white/[0.03] transition-all"><div class="flex items-center justify-between"><div><span class="text-sm text-bright font-medium"> </span> <span class="text-xs text-dim ml-2"> </span></div> <div class="flex gap-1"><!> <!></div></div> <!></button></div>'),Ae=v('<div class="relative"><div class="absolute left-6 top-0 bottom-0 w-px bg-synapse/15"></div> <div class="space-y-4"></div></div>'),Ne=v('<div class="p-6 max-w-4xl mx-auto space-y-6"><div class="flex items-center justify-between"><h1 class="text-xl text-bright font-semibold">Timeline</h1> <select class="px-3 py-2 bg-white/[0.03] border border-synapse/10 rounded-xl text-dim text-sm focus:outline-none backdrop-blur-sm"><option>7 days</option><option>14 days</option><option>30 days</option><option>90 days</option></select></div> <!></div>');function Re(V,W){ce(W,!0);let _=b(me([])),y=b(!0),w=b(14),k=b(null);pe(()=>R());async function R(){c(y,!0);try{const s=await fe.timeline(e(w),500);c(_,s.timeline,!0)}catch{c(_,[],!0)}finally{c(y,!1)}}var T=Ne(),j=a(T),u=i(a(j),2),A=a(u);A.value=A.__value=7;var N=i(A);N.value=N.__value=14;var O=i(N);O.value=O.__value=30;var Y=i(O);Y.value=Y.__value=90,t(u),t(j);var X=i(j,2);{var Z=s=>{var d=ge();h(d,20,()=>Array(7),P,(x,f)=>{var r=be();l(x,r)}),t(d),l(s,d)},ee=s=>{var d=he();l(s,d)},te=s=>{var d=Ae(),x=i(a(d),2);h(x,21,()=>e(_),f=>f.date,(f,r)=>{var S=je(),B=i(a(S),2),D=a(B),E=a(D),$=a(E),ae=a($,!0);t($);var q=i($,2),se=a(q);t(q),t(E);var z=i(E,2),G=a(z);h(G,17,()=>e(r).memories.slice(0,10),P,(n,o)=>{var p=ye();g(()=>Q(p,`background: ${(U[e(o).nodeType]||"#8B95A5")??""}; opacity: ${.3+e(o).retentionStrength*.7}`)),l(n,p)});var ie=i(G,2);{var re=n=>{var o=we(),p=a(o);t(o),g(()=>m(p,`+${e(r).memories.length-10}`)),l(n,o)};M(ie,n=>{e(r).memories.length>10&&n(re)})}t(z),t(D);var oe=i(D,2);{var le=n=>{var o=Te();h(o,21,()=>e(r).memories,P,(p,C)=>{var F=ke(),H=a(F),L=i(H,2),I=a(L),ve=a(I,!0);t(I),t(L);var J=i(L,2),de=a(J);t(J),t(F),g(ne=>{Q(H,`background: ${(U[e(C).nodeType]||"#8B95A5")??""}`),m(ve,e(C).content),m(de,`${ne??""}%`)},[()=>(e(C).retentionStrength*100).toFixed(0)]),l(p,F)}),t(o),l(n,o)};M(oe,n=>{e(k)===e(r).date&&n(le)})}t(B),t(S),g(()=>{m(ae,e(r).date),m(se,`${e(r).count??""} memories`)}),K("click",B,()=>c(k,e(k)===e(r).date?null:e(r).date,!0)),l(f,S)}),t(x),t(d),l(s,d)};M(X,s=>{e(y)?s(Z):e(_).length===0?s(ee,1):s(te,!1)})}t(T),K("change",u,R),xe(u,()=>e(w),s=>c(w,s)),l(V,T),_e()}ue(["change","click"]);export{Re as component};

View file

@ -0,0 +1 @@
import"../chunks/Bzak7iHL.js";import{f as m}from"../chunks/VE8Jor13.js";import{c as n,a as p}from"../chunks/7UNxJI5L.js";import{s as i}from"../chunks/BZYVQ1d5.js";function d(r,t){var o=n(),a=m(o);i(a,()=>t.children),p(r,o)}export{d as component};

View file

@ -1 +0,0 @@
import"../chunks/Bzak7iHL.js";import{f as m}from"../chunks/nyjtQ1Ok.js";import{c as n,a as p}from"../chunks/B0IenmM-.js";import{s as i}from"../chunks/Ckx7gB9J.js";function d(r,t){var o=n(),a=m(o);i(a,()=>t.children),p(r,o)}export{d as component};

View file

@ -0,0 +1 @@
import"../chunks/Bzak7iHL.js";import"../chunks/CrlWs-6R.js";import{o as p}from"../chunks/DWVWfZUn.js";import{p as r,a as t}from"../chunks/VE8Jor13.js";import{i as a}from"../chunks/jyeIy8pa.js";import{g as m}from"../chunks/00s_zK56.js";function u(i,o){r(o,!1),p(()=>m("/graph",{replaceState:!0})),a(),t()}export{u as component};

View file

@ -1 +0,0 @@
import"../chunks/Bzak7iHL.js";import"../chunks/D_N1HvA5.js";import{o as p}from"../chunks/DeTA_5mp.js";import{p as r,a as t}from"../chunks/nyjtQ1Ok.js";import{i as a}from"../chunks/Ck7jSX2P.js";import{g as m}from"../chunks/Bmuqs8iK.js";function u(i,o){r(o,!1),p(()=>m("/graph",{replaceState:!0})),a(),t()}export{u as component};

View file

@ -1,4 +1,4 @@
import"../chunks/Bzak7iHL.js";import{p as ze,s as I,c as Ae,g as e,a as Pe,d as a,e as r,h as b,r as t,i as Qe,t as y,f as ge,u as se,j as qe}from"../chunks/nyjtQ1Ok.js";import{d as Be,a as q,s as o}from"../chunks/C4L78yoI.js";import{a as c,f as m,c as De}from"../chunks/B0IenmM-.js";import{i as k}from"../chunks/B17metm1.js";import{e as ie,i as ne}from"../chunks/BilMa3tw.js";import{r as ye}from"../chunks/BBOOwRwQ.js";import{s as oe}from"../chunks/BgOFZ9jq.js";import{s as Ke}from"../chunks/D2QmVWrb.js";import{b as de}from"../chunks/BOVu8he9.js";import{a as X}from"../chunks/DcQGRi49.js";var Re=m('<button><span class="text-xl"> </span> <span class="font-medium"> </span> <span class="text-[10px] text-muted text-center"> </span></button>'),Ue=m('<div class="p-3 glass rounded-xl !border-synapse/20"><div class="text-[10px] text-synapse-glow mb-1 uppercase tracking-wider">Source</div> <p class="text-sm text-text"> </p> <div class="flex gap-2 mt-1.5 text-[10px] text-muted"><span> </span> <span> </span></div></div>'),Ve=m('<div class="p-3 glass rounded-xl !border-dream/20"><div class="text-[10px] text-dream-glow mb-1 uppercase tracking-wider">Target</div> <p class="text-sm text-text"> </p> <div class="flex gap-2 mt-1.5 text-[10px] text-muted"><span> </span> <span> </span></div></div>'),Ge=m(`<div class="space-y-3"><span class="text-xs text-dim font-medium">Target Memory <span class="text-muted"> </span></span> <div class="flex gap-2"><input type="text" placeholder="Search for the target memory..." class="flex-1 px-4 py-2.5 bg-white/[0.03] border border-synapse/10 rounded-xl text-text text-sm
import"../chunks/Bzak7iHL.js";import{p as ze,s as I,c as Ae,g as e,a as Pe,d as a,e as r,h as b,r as t,i as Qe,t as y,f as ge,u as se,j as qe}from"../chunks/VE8Jor13.js";import{d as Be,a as q,s as o}from"../chunks/DHnEMX8z.js";import{a as c,f as m,c as De}from"../chunks/7UNxJI5L.js";import{i as k}from"../chunks/JkhlGLjU.js";import{e as ie,i as ne}from"../chunks/ByItJEsC.js";import{r as ye}from"../chunks/Cu3VmnGp.js";import{s as oe}from"../chunks/BR2EHpd7.js";import{s as Ke}from"../chunks/ussr1V5_.js";import{b as de}from"../chunks/BRHZEveZ.js";import{a as X}from"../chunks/DcQGRi49.js";var Re=m('<button><span class="text-xl"> </span> <span class="font-medium"> </span> <span class="text-[10px] text-muted text-center"> </span></button>'),Ue=m('<div class="p-3 glass rounded-xl !border-synapse/20"><div class="text-[10px] text-synapse-glow mb-1 uppercase tracking-wider">Source</div> <p class="text-sm text-text"> </p> <div class="flex gap-2 mt-1.5 text-[10px] text-muted"><span> </span> <span> </span></div></div>'),Ve=m('<div class="p-3 glass rounded-xl !border-dream/20"><div class="text-[10px] text-dream-glow mb-1 uppercase tracking-wider">Target</div> <p class="text-sm text-text"> </p> <div class="flex gap-2 mt-1.5 text-[10px] text-muted"><span> </span> <span> </span></div></div>'),Ge=m(`<div class="space-y-3"><span class="text-xs text-dim font-medium">Target Memory <span class="text-muted"> </span></span> <div class="flex gap-2"><input type="text" placeholder="Search for the target memory..." class="flex-1 px-4 py-2.5 bg-white/[0.03] border border-synapse/10 rounded-xl text-text text-sm
placeholder:text-muted focus:outline-none focus:border-dream/40 transition backdrop-blur-sm"/> <button class="px-4 py-2.5 bg-dream/20 border border-dream/40 text-dream-glow text-sm rounded-xl hover:bg-dream/30 transition">Find</button></div></div> <!>`,1),He=m('<div class="text-center py-8 text-dim"><div class="text-lg animate-pulse mb-2">◎</div> <p> </p></div>'),Je=m('<span class="px-1.5 py-0.5 bg-white/[0.04] rounded"> </span>'),Le=m("<span> </span>"),We=m("<span> </span>"),Xe=m("<span> </span>"),Ye=m('<span class="text-synapse-glow"> </span>'),Ze=m('<div class="p-3 glass-subtle rounded-xl flex items-start gap-3 hover:bg-white/[0.03] transition"><div class="w-6 h-6 rounded-full bg-synapse/15 text-synapse-glow text-xs flex items-center justify-center flex-shrink-0 mt-0.5"></div> <div class="flex-1 min-w-0"><p class="text-sm text-text line-clamp-2"> </p> <div class="flex flex-wrap gap-3 mt-1.5 text-xs text-muted"><!> <!> <!> <!> <!></div></div></div>'),et=m('<div class="space-y-4"><div class="flex items-center justify-between"><h2 class="text-sm text-bright font-semibold"> </h2></div> <div class="space-y-2"></div></div>'),tt=m('<div class="text-center py-8 text-dim"><div class="text-3xl mb-3 opacity-20"></div> <p>No connections found for this query.</p></div>'),rt=m('<div><div class="text-xs text-dim mb-1.5 capitalize"> </div> <div class="h-2 bg-deep rounded-full overflow-hidden"><div></div></div> <div class="text-xs text-muted mt-1"> </div></div>'),at=m('<div class="grid grid-cols-4 gap-3"></div>'),st=m('<div class="mt-4 p-4 glass rounded-xl"><div class="flex items-center gap-3 mb-4"><span class="text-3xl text-bright font-bold"> </span> <span> </span></div> <!></div>'),it=m(`<div class="p-6 max-w-5xl mx-auto space-y-8"><h1 class="text-xl text-bright font-semibold">Explore Connections</h1> <div class="grid grid-cols-3 gap-2"></div> <div class="space-y-3"><span class="text-xs text-dim font-medium">Source Memory</span> <div class="flex gap-2"><input type="text" placeholder="Search for a memory to explore from..." class="flex-1 px-4 py-2.5 bg-white/[0.03] border border-synapse/10 rounded-xl text-text text-sm
placeholder:text-muted focus:outline-none focus:border-synapse/40 transition backdrop-blur-sm"/> <button class="px-4 py-2.5 bg-synapse/20 border border-synapse/40 text-synapse-glow text-sm rounded-xl hover:bg-synapse/30 transition">Find</button></div></div> <!> <!> <!> <div class="pt-8 border-t border-synapse/10"><h2 class="text-lg text-bright font-semibold mb-4">Importance Scorer</h2> <p class="text-xs text-muted mb-3">4-channel neuroscience scoring: novelty, arousal, reward, attention</p> <textarea placeholder="Paste any text to score its importance..." class="w-full h-24 px-4 py-3 bg-white/[0.03] border border-synapse/10 rounded-xl text-text text-sm
placeholder:text-muted resize-none focus:outline-none focus:border-synapse/40 transition backdrop-blur-sm"></textarea> <button class="mt-2 px-4 py-2 bg-dream/20 border border-dream/40 text-dream-glow text-sm rounded-xl hover:bg-dream/30 transition">Score</button> <!></div></div>`);function ft(he,we){ze(we,!0);let V=I(""),G=I(""),F=I(null),C=I(null),B=I(Ae([])),$=I("associations"),O=I(!1),H=I(""),D=I(null);const le={associations:{icon:"",desc:"Spreading activation find related memories via graph traversal"},chains:{icon:"",desc:"Build reasoning path from source to target memory"},bridges:{icon:"",desc:"Find connecting memories between two concepts"}};async function ve(){if(e(V).trim()){b(O,!0);try{const s=await X.search(e(V),1);s.results.length>0&&(b(F,s.results[0],!0),await Y())}catch{}finally{b(O,!1)}}}async function pe(){if(e(G).trim()){b(O,!0);try{const s=await X.search(e(G),1);s.results.length>0&&(b(C,s.results[0],!0),e(F)&&await Y())}catch{}finally{b(O,!1)}}}async function Y(){if(e(F)){b(O,!0);try{const s=(e($)==="chains"||e($)==="bridges")&&e(C)?e(C).id:void 0,i=await X.explore(e(F).id,e($),s);b(B,i.results||i.nodes||i.chain||i.bridges||[],!0)}catch{b(B,[],!0)}finally{b(O,!1)}}}async function ke(){e(H).trim()&&b(D,await X.importance(e(H)),!0)}function Se(s){b($,s,!0),e(F)&&Y()}var Z=it(),ee=a(r(Z),2);ie(ee,20,()=>["associations","chains","bridges"],ne,(s,i)=>{var d=Re(),_=r(d),h=r(_,!0);t(_);var f=a(_,2),p=r(f,!0);t(f);var n=a(f,2),g=r(n,!0);t(n),t(d),y(w=>{oe(d,1,`flex flex-col items-center gap-1 p-3 rounded-xl text-sm transition

View file

@ -1,8 +1,8 @@
import"../chunks/Bzak7iHL.js";import"../chunks/D_N1HvA5.js";import{p as ee,m as oe,g as e,h as M,e as o,d,r as s,f as ie,t as $,a as te,s as K,u as X,L as Z}from"../chunks/nyjtQ1Ok.js";import{s as x,d as ne,a as de}from"../chunks/C4L78yoI.js";import{a as l,f as m}from"../chunks/B0IenmM-.js";import{i as w}from"../chunks/B17metm1.js";import{e as re,i as ae}from"../chunks/BilMa3tw.js";import{s as C}from"../chunks/D2QmVWrb.js";import{i as ce}from"../chunks/Ck7jSX2P.js";import{s as le,a as me}from"../chunks/C3ZC25l2.js";import{w as ve,e as ue}from"../chunks/pCfQwaBQ.js";import{E as L}from"../chunks/BNytumrp.js";import{s as pe}from"../chunks/BBOOwRwQ.js";import{s as fe}from"../chunks/BgOFZ9jq.js";import{p as Q}from"../chunks/BPtVz5jm.js";var xe=m('<span class="text-[10px] text-recall"> </span>'),_e=m('<div class="h-px flex-shrink-0 w-2 mt-[-12px] transition-all duration-300"></div>'),ge=m('<div class="flex flex-col items-center gap-1 flex-1 min-w-0"><div> </div> <span class="text-[8px] truncate w-full text-center transition-colors duration-300"> </span></div> <!>',1),he=m('<div class="h-full rounded-full transition-all ease-out"></div>'),ye=m('<div class="flex items-center gap-2 pt-1 animate-fade-in svelte-1n9p0vm"><div class="w-1.5 h-1.5 rounded-full bg-recall animate-pulse-glow"></div> <span class="text-[10px] text-dim"> </span></div>'),$e=m('<div class="glass-subtle rounded-xl p-4 space-y-3"><div class="flex items-center justify-between"><span class="text-[10px] text-synapse-glow uppercase tracking-wider font-medium">Cognitive Search Pipeline</span> <!></div> <div class="flex items-center gap-0.5"></div> <div class="h-1 bg-white/[0.03] rounded-full overflow-hidden"><!></div> <!></div>');function be(O,F){ee(F,!0);let S=Q(F,"resultCount",3,0),j=Q(F,"durationMs",3,0),q=Q(F,"active",3,!1);const p=[{name:"Overfetch",icon:"◎",color:"#818CF8",desc:"Pull 3x results from hybrid search"},{name:"Rerank",icon:"⟿",color:"#00A8FF",desc:"Re-score by relevance quality"},{name:"Temporal",icon:"◷",color:"#00D4FF",desc:"Recent memories get recency bonus"},{name:"Access",icon:"◇",color:"#00FFD1",desc:"FSRS-6 retention threshold filter"},{name:"Context",icon:"◬",color:"#FFB800",desc:"Encoding specificity matching"},{name:"Compete",icon:"⬡",color:"#FF3CAC",desc:"Retrieval-induced forgetting"},{name:"Activate",icon:"◈",color:"#9D00FF",desc:"Spreading activation cascade"}];let _=K(-1),g=K(!1),u=K(!1);oe(()=>{q()&&!e(g)&&P()});function P(){M(g,!0),M(_,-1),M(u,!1);const t=Math.max(1500,(j()||50)*2),a=t/(p.length+1);p.forEach((i,v)=>{setTimeout(()=>{M(_,v,!0)},a*(v+1))}),setTimeout(()=>{M(u,!0),M(g,!1)},t)}var D=$e(),b=o(D),I=d(o(b),2);{var V=t=>{var a=xe(),i=o(a);s(a),$(()=>x(i,`${S()??""} results in ${j()??""}ms`)),l(t,a)};w(I,t=>{e(u)&&t(V)})}s(b);var A=d(b,2);re(A,21,()=>p,ae,(t,a,i)=>{const v=X(()=>i<=e(_)),E=X(()=>i===e(_)&&e(g));var k=ge(),h=ie(k),y=o(h),J=o(y,!0);s(y);var R=d(y,2),T=o(R,!0);s(R),s(h);var U=d(h,2);{var W=B=>{var c=_e();$(()=>C(c,`background: ${i<e(_)?p[i+1].color+"60":"rgba(255,255,255,0.06)"}`)),l(B,c)};w(U,B=>{i<p.length-1&&B(W)})}$(()=>{fe(y,1,`w-8 h-8 rounded-full flex items-center justify-center text-xs transition-all duration-300
import"../chunks/Bzak7iHL.js";import"../chunks/CrlWs-6R.js";import{p as ee,I as oe,g as e,h as M,e as o,d,r as s,f as ie,t as $,a as te,s as K,u as X,C as Z}from"../chunks/VE8Jor13.js";import{s as x,d as ne,a as de}from"../chunks/DHnEMX8z.js";import{a as l,f as m}from"../chunks/7UNxJI5L.js";import{i as w}from"../chunks/JkhlGLjU.js";import{e as re,i as ae}from"../chunks/ByItJEsC.js";import{s as C}from"../chunks/ussr1V5_.js";import{i as ce}from"../chunks/jyeIy8pa.js";import{s as le,a as me}from"../chunks/AcZBvMXu.js";import{w as ve,e as ue}from"../chunks/XIUN5r_Y.js";import{E as I}from"../chunks/BNytumrp.js";import{s as pe}from"../chunks/Cu3VmnGp.js";import{s as fe}from"../chunks/BR2EHpd7.js";import{p as Q}from"../chunks/ykT2B6d3.js";var xe=m('<span class="text-[10px] text-recall"> </span>'),_e=m('<div class="h-px flex-shrink-0 w-2 mt-[-12px] transition-all duration-300"></div>'),ge=m('<div class="flex flex-col items-center gap-1 flex-1 min-w-0"><div> </div> <span class="text-[8px] truncate w-full text-center transition-colors duration-300"> </span></div> <!>',1),he=m('<div class="h-full rounded-full transition-all ease-out"></div>'),ye=m('<div class="flex items-center gap-2 pt-1 animate-fade-in svelte-1n9p0vm"><div class="w-1.5 h-1.5 rounded-full bg-recall animate-pulse-glow"></div> <span class="text-[10px] text-dim"> </span></div>'),$e=m('<div class="glass-subtle rounded-xl p-4 space-y-3"><div class="flex items-center justify-between"><span class="text-[10px] text-synapse-glow uppercase tracking-wider font-medium">Cognitive Search Pipeline</span> <!></div> <div class="flex items-center gap-0.5"></div> <div class="h-1 bg-white/[0.03] rounded-full overflow-hidden"><!></div> <!></div>');function be(O,F){ee(F,!0);let S=Q(F,"resultCount",3,0),j=Q(F,"durationMs",3,0),q=Q(F,"active",3,!1);const p=[{name:"Overfetch",icon:"◎",color:"#818CF8",desc:"Pull 3x results from hybrid search"},{name:"Rerank",icon:"⟿",color:"#00A8FF",desc:"Re-score by relevance quality"},{name:"Temporal",icon:"◷",color:"#00D4FF",desc:"Recent memories get recency bonus"},{name:"Access",icon:"◇",color:"#00FFD1",desc:"FSRS-6 retention threshold filter"},{name:"Context",icon:"◬",color:"#FFB800",desc:"Encoding specificity matching"},{name:"Compete",icon:"⬡",color:"#FF3CAC",desc:"Retrieval-induced forgetting"},{name:"Activate",icon:"◈",color:"#9D00FF",desc:"Spreading activation cascade"}];let _=K(-1),g=K(!1),u=K(!1);oe(()=>{q()&&!e(g)&&P()});function P(){M(g,!0),M(_,-1),M(u,!1);const t=Math.max(1500,(j()||50)*2),a=t/(p.length+1);p.forEach((i,v)=>{setTimeout(()=>{M(_,v,!0)},a*(v+1))}),setTimeout(()=>{M(u,!0),M(g,!1)},t)}var D=$e(),b=o(D),L=d(o(b),2);{var V=t=>{var a=xe(),i=o(a);s(a),$(()=>x(i,`${S()??""} results in ${j()??""}ms`)),l(t,a)};w(L,t=>{e(u)&&t(V)})}s(b);var A=d(b,2);re(A,21,()=>p,ae,(t,a,i)=>{const v=X(()=>i<=e(_)),E=X(()=>i===e(_)&&e(g));var k=ge(),h=ie(k),y=o(h),J=o(y,!0);s(y);var R=d(y,2),T=o(R,!0);s(R),s(h);var U=d(h,2);{var W=B=>{var c=_e();$(()=>C(c,`background: ${i<e(_)?p[i+1].color+"60":"rgba(255,255,255,0.06)"}`)),l(B,c)};w(U,B=>{i<p.length-1&&B(W)})}$(()=>{fe(y,1,`w-8 h-8 rounded-full flex items-center justify-center text-xs transition-all duration-300
${e(E)?"scale-125":""}`),C(y,`background: ${e(v)?e(a).color+"25":"rgba(255,255,255,0.03)"};
border: 1.5px solid ${(e(v)?e(a).color:"rgba(255,255,255,0.06)")??""};
color: ${(e(v)?e(a).color:"#4a4a7a")??""};
box-shadow: ${e(E)?"0 0 12px "+e(a).color+"40":"none"}`),pe(y,"title",e(a).desc),x(J,e(a).icon),C(R,`color: ${(e(v)?e(a).color:"#4a4a7a")??""}`),x(T,e(a).name)}),l(t,k)}),s(A);var N=d(A,2),z=o(N);{var n=t=>{var a=he();$(i=>C(a,`width: ${i??""}%;
background: linear-gradient(90deg, #818CF8, #00FFD1, #9D00FF);
transition-duration: ${e(g)?"300ms":"500ms"}`),[()=>e(u)?"100":((e(_)+1)/p.length*100).toFixed(0)]),l(t,a)};w(z,t=>{(e(g)||e(u))&&t(n)})}s(N);var r=d(N,2);{var H=t=>{var a=ye(),i=d(o(a),2),v=o(i);s(i),s(a),$(()=>x(v,`Pipeline complete: ${S()??""} memories surfaced from ${p.length??""}-stage cognitive cascade`)),l(t,a)};w(r,t=>{e(u)&&t(H)})}s(D),l(O,D),te()}var we=m('<div class="text-center py-20 text-dim"><div class="text-4xl mb-4">◉</div> <p>Waiting for cognitive events...</p> <p class="text-sm text-muted mt-2">Events appear here in real-time as Vestige thinks.</p></div>'),Ce=m('<span class="text-xs text-muted"> </span>'),Fe=m('<div class="mt-2"><!></div>'),Se=m(`<div class="flex items-start gap-3 p-3 glass-subtle rounded-xl
hover:bg-white/[0.03] transition-all duration-200"><div class="w-6 h-6 rounded flex items-center justify-center text-xs flex-shrink-0"> </div> <div class="flex-1 min-w-0"><div class="flex items-center gap-2 mb-0.5"><span class="text-xs font-medium"> </span> <!></div> <p class="text-sm text-dim"> </p> <!></div></div>`),De=m('<div class="space-y-2"></div>'),ke=m('<div class="p-6 max-w-4xl mx-auto space-y-6"><div class="flex items-center justify-between"><h1 class="text-xl text-bright font-semibold">Live Feed</h1> <div class="flex gap-3"><span class="text-dim text-sm"> </span> <button class="text-xs text-muted hover:text-text transition">Clear</button></div></div> <!></div>');function He(O,F){ee(F,!1);const S=()=>me(ue,"$eventFeed",j),[j,q]=le();function p(n){return new Date(n).toLocaleTimeString()}function _(n){return{MemoryCreated:"+",MemoryUpdated:"~",MemoryDeleted:"×",MemoryPromoted:"",MemoryDemoted:"",SearchPerformed:"",DreamStarted:"",DreamProgress:"",DreamCompleted:"",ConsolidationStarted:"",ConsolidationCompleted:"",RetentionDecayed:"",ConnectionDiscovered:"",ActivationSpread:"",ImportanceScored:"",Heartbeat:""}[n]||"·"}function g(n){const r=n.data;switch(n.type){case"MemoryCreated":return`New ${r.node_type}: "${String(r.content_preview).slice(0,60)}..."`;case"SearchPerformed":return`Searched "${r.query}" → ${r.result_count} results (${r.duration_ms}ms)`;case"DreamStarted":return`Dream started with ${r.memory_count} memories`;case"DreamCompleted":return`Dream complete: ${r.connections_found} connections, ${r.insights_generated} insights (${r.duration_ms}ms)`;case"ConsolidationStarted":return"Consolidation cycle started";case"ConsolidationCompleted":return`Consolidated ${r.nodes_processed} nodes, ${r.decay_applied} decayed (${r.duration_ms}ms)`;case"ConnectionDiscovered":return`Connection: ${String(r.connection_type)} (weight: ${Number(r.weight).toFixed(2)})`;case"ImportanceScored":return`Scored ${Number(r.composite_score).toFixed(2)}: "${String(r.content_preview).slice(0,50)}..."`;case"MemoryPromoted":return`Promoted → ${(Number(r.new_retention)*100).toFixed(0)}% retention`;case"MemoryDemoted":return`Demoted → ${(Number(r.new_retention)*100).toFixed(0)}% retention`;default:return JSON.stringify(r).slice(0,100)}}ce();var u=ke(),P=o(u),D=d(o(P),2),b=o(D),I=o(b);s(b);var V=d(b,2);s(D),s(P);var A=d(P,2);{var N=n=>{var r=we();l(n,r)},z=n=>{var r=De();re(r,5,S,ae,(H,t)=>{var a=Se(),i=o(a),v=o(i,!0);s(i);var E=d(i,2),k=o(E),h=o(k),y=o(h,!0);s(h);var J=d(h,2);{var R=c=>{var f=Ce(),Y=o(f,!0);s(f),$(G=>x(Y,G),[()=>p(String(e(t).data.timestamp))]),l(c,f)};w(J,c=>{e(t).data.timestamp&&c(R)})}s(k);var T=d(k,2),U=o(T,!0);s(T);var W=d(T,2);{var B=c=>{var f=Fe(),Y=o(f);{let G=Z(()=>Number(e(t).data.result_count)||0),se=Z(()=>Number(e(t).data.duration_ms)||0);be(Y,{get resultCount(){return e(G)},get durationMs(){return e(se)},active:!0})}s(f),l(c,f)};w(W,c=>{e(t).type==="SearchPerformed"&&c(B)})}s(E),s(a),$((c,f)=>{C(a,`border-left: 3px solid ${(L[e(t).type]||"#8B95A5")??""}`),C(i,`background: ${(L[e(t).type]||"#8B95A5")??""}15; color: ${(L[e(t).type]||"#8B95A5")??""}`),x(v,c),C(h,`color: ${(L[e(t).type]||"#8B95A5")??""}`),x(y,e(t).type),x(U,f)},[()=>_(e(t).type),()=>g(e(t))]),l(H,a)}),s(r),l(n,r)};w(A,n=>{S().length===0?n(N):n(z,!1)})}s(u),$(()=>x(I,`${S().length??""} events`)),de("click",V,()=>ve.clearEvents()),l(O,u),te(),q()}ne(["click"]);export{He as component};
hover:bg-white/[0.03] transition-all duration-200"><div class="w-6 h-6 rounded flex items-center justify-center text-xs flex-shrink-0"> </div> <div class="flex-1 min-w-0"><div class="flex items-center gap-2 mb-0.5"><span class="text-xs font-medium"> </span> <!></div> <p class="text-sm text-dim"> </p> <!></div></div>`),De=m('<div class="space-y-2"></div>'),ke=m('<div class="p-6 max-w-4xl mx-auto space-y-6"><div class="flex items-center justify-between"><h1 class="text-xl text-bright font-semibold">Live Feed</h1> <div class="flex gap-3"><span class="text-dim text-sm"> </span> <button class="text-xs text-muted hover:text-text transition">Clear</button></div></div> <!></div>');function He(O,F){ee(F,!1);const S=()=>me(ue,"$eventFeed",j),[j,q]=le();function p(n){return new Date(n).toLocaleTimeString()}function _(n){return{MemoryCreated:"+",MemoryUpdated:"~",MemoryDeleted:"×",MemoryPromoted:"",MemoryDemoted:"",SearchPerformed:"",DreamStarted:"",DreamProgress:"",DreamCompleted:"",ConsolidationStarted:"",ConsolidationCompleted:"",RetentionDecayed:"",ConnectionDiscovered:"",ActivationSpread:"",ImportanceScored:"",Heartbeat:""}[n]||"·"}function g(n){const r=n.data;switch(n.type){case"MemoryCreated":return`New ${r.node_type}: "${String(r.content_preview).slice(0,60)}..."`;case"SearchPerformed":return`Searched "${r.query}" → ${r.result_count} results (${r.duration_ms}ms)`;case"DreamStarted":return`Dream started with ${r.memory_count} memories`;case"DreamCompleted":return`Dream complete: ${r.connections_found} connections, ${r.insights_generated} insights (${r.duration_ms}ms)`;case"ConsolidationStarted":return"Consolidation cycle started";case"ConsolidationCompleted":return`Consolidated ${r.nodes_processed} nodes, ${r.decay_applied} decayed (${r.duration_ms}ms)`;case"ConnectionDiscovered":return`Connection: ${String(r.connection_type)} (weight: ${Number(r.weight).toFixed(2)})`;case"ImportanceScored":return`Scored ${Number(r.composite_score).toFixed(2)}: "${String(r.content_preview).slice(0,50)}..."`;case"MemoryPromoted":return`Promoted → ${(Number(r.new_retention)*100).toFixed(0)}% retention`;case"MemoryDemoted":return`Demoted → ${(Number(r.new_retention)*100).toFixed(0)}% retention`;default:return JSON.stringify(r).slice(0,100)}}ce();var u=ke(),P=o(u),D=d(o(P),2),b=o(D),L=o(b);s(b);var V=d(b,2);s(D),s(P);var A=d(P,2);{var N=n=>{var r=we();l(n,r)},z=n=>{var r=De();re(r,5,S,ae,(H,t)=>{var a=Se(),i=o(a),v=o(i,!0);s(i);var E=d(i,2),k=o(E),h=o(k),y=o(h,!0);s(h);var J=d(h,2);{var R=c=>{var f=Ce(),Y=o(f,!0);s(f),$(G=>x(Y,G),[()=>p(String(e(t).data.timestamp))]),l(c,f)};w(J,c=>{e(t).data.timestamp&&c(R)})}s(k);var T=d(k,2),U=o(T,!0);s(T);var W=d(T,2);{var B=c=>{var f=Fe(),Y=o(f);{let G=Z(()=>Number(e(t).data.result_count)||0),se=Z(()=>Number(e(t).data.duration_ms)||0);be(Y,{get resultCount(){return e(G)},get durationMs(){return e(se)},active:!0})}s(f),l(c,f)};w(W,c=>{e(t).type==="SearchPerformed"&&c(B)})}s(E),s(a),$((c,f)=>{C(a,`border-left: 3px solid ${(I[e(t).type]||"#8B95A5")??""}`),C(i,`background: ${(I[e(t).type]||"#8B95A5")??""}15; color: ${(I[e(t).type]||"#8B95A5")??""}`),x(v,c),C(h,`color: ${(I[e(t).type]||"#8B95A5")??""}`),x(y,e(t).type),x(U,f)},[()=>_(e(t).type),()=>g(e(t))]),l(H,a)}),s(r),l(n,r)};w(A,n=>{S().length===0?n(N):n(z,!1)})}s(u),$(()=>x(L,`${S().length??""} events`)),de("click",V,()=>ve.clearEvents()),l(O,u),te(),q()}ne(["click"]);export{He as component};

View file

@ -1,4 +1,4 @@
import"../chunks/Bzak7iHL.js";import{o as Be}from"../chunks/DeTA_5mp.js";import{p as Qe,s as b,c as Ye,t as D,g as e,a as ze,d as t,e as o,h as x,r as a}from"../chunks/nyjtQ1Ok.js";import{d as Ge,a as n,s as v}from"../chunks/C4L78yoI.js";import{i as ue}from"../chunks/B17metm1.js";import{e as ee,i as xe}from"../chunks/BilMa3tw.js";import{a as g,f}from"../chunks/B0IenmM-.js";import{r as _e}from"../chunks/BBOOwRwQ.js";import{s as He}from"../chunks/BgOFZ9jq.js";import{s as ge}from"../chunks/D2QmVWrb.js";import{b as fe}from"../chunks/BOVu8he9.js";import{b as Ie}from"../chunks/J2LZW-kP.js";import{a as u}from"../chunks/DcQGRi49.js";import{N as Je}from"../chunks/BNytumrp.js";var Ke=f('<div class="h-24 glass-subtle rounded-xl animate-pulse"></div>'),Ue=f('<div class="grid gap-3"></div>'),Ve=f('<span class="text-xs px-1.5 py-0.5 bg-white/[0.04] rounded text-muted"> </span>'),We=f('<div class="mt-4 pt-4 border-t border-synapse/10 space-y-3"><p class="text-sm text-text whitespace-pre-wrap"> </p> <div class="grid grid-cols-3 gap-3 text-xs text-dim"><div> </div> <div> </div> <div> </div></div> <div class="flex gap-2"><span role="button" tabindex="0" class="px-3 py-1.5 bg-recall/20 text-recall text-xs rounded-lg hover:bg-recall/30 cursor-pointer select-none">Promote</span> <span role="button" tabindex="0" class="px-3 py-1.5 bg-decay/20 text-decay text-xs rounded-lg hover:bg-decay/30 cursor-pointer select-none">Demote</span> <span role="button" tabindex="0" title="Top-down inhibition (Anderson 2025). Compounds. Reversible for 24h." class="px-3 py-1.5 bg-purple-500/20 text-purple-400 text-xs rounded-lg hover:bg-purple-500/30 cursor-pointer select-none">Suppress</span> <span role="button" tabindex="0" class="px-3 py-1.5 bg-decay/10 text-decay/60 text-xs rounded-lg hover:bg-decay/20 ml-auto cursor-pointer select-none">Delete</span></div></div>'),Xe=f('<button><div class="flex items-start justify-between gap-4"><div class="flex-1 min-w-0"><div class="flex items-center gap-2 mb-2"><span class="w-2 h-2 rounded-full"></span> <span class="text-xs text-dim"> </span> <!></div> <p class="text-sm text-text leading-relaxed line-clamp-2"> </p></div> <div class="flex flex-col items-end gap-1 flex-shrink-0"><div class="w-12 h-1.5 bg-deep rounded-full overflow-hidden"><div class="h-full rounded-full"></div></div> <span class="text-xs text-muted"> </span></div></div> <!></button>'),Ze=f('<div class="grid gap-3"></div>'),et=f(`<div class="p-6 max-w-6xl mx-auto space-y-6"><div class="flex items-center justify-between"><h1 class="text-xl text-bright font-semibold">Memories</h1> <span class="text-dim text-sm"> </span></div> <div class="flex gap-3 flex-wrap"><input type="text" placeholder="Search memories..." class="flex-1 min-w-64 px-4 py-2.5 bg-white/[0.03] border border-synapse/10 rounded-xl text-text text-sm
import"../chunks/Bzak7iHL.js";import{o as Be}from"../chunks/DWVWfZUn.js";import{p as Qe,s as b,c as Ye,t as D,g as e,a as ze,d as t,e as o,h as x,r as a}from"../chunks/VE8Jor13.js";import{d as Ge,a as n,s as v}from"../chunks/DHnEMX8z.js";import{i as ue}from"../chunks/JkhlGLjU.js";import{e as ee,i as xe}from"../chunks/ByItJEsC.js";import{a as g,f}from"../chunks/7UNxJI5L.js";import{r as _e}from"../chunks/Cu3VmnGp.js";import{s as He}from"../chunks/BR2EHpd7.js";import{s as ge}from"../chunks/ussr1V5_.js";import{b as fe}from"../chunks/BRHZEveZ.js";import{b as Ie}from"../chunks/B5Pq2mnD.js";import{a as u}from"../chunks/DcQGRi49.js";import{N as Je}from"../chunks/BNytumrp.js";var Ke=f('<div class="h-24 glass-subtle rounded-xl animate-pulse"></div>'),Ue=f('<div class="grid gap-3"></div>'),Ve=f('<span class="text-xs px-1.5 py-0.5 bg-white/[0.04] rounded text-muted"> </span>'),We=f('<div class="mt-4 pt-4 border-t border-synapse/10 space-y-3"><p class="text-sm text-text whitespace-pre-wrap"> </p> <div class="grid grid-cols-3 gap-3 text-xs text-dim"><div> </div> <div> </div> <div> </div></div> <div class="flex gap-2"><span role="button" tabindex="0" class="px-3 py-1.5 bg-recall/20 text-recall text-xs rounded-lg hover:bg-recall/30 cursor-pointer select-none">Promote</span> <span role="button" tabindex="0" class="px-3 py-1.5 bg-decay/20 text-decay text-xs rounded-lg hover:bg-decay/30 cursor-pointer select-none">Demote</span> <span role="button" tabindex="0" title="Top-down inhibition (Anderson 2025). Compounds. Reversible for 24h." class="px-3 py-1.5 bg-purple-500/20 text-purple-400 text-xs rounded-lg hover:bg-purple-500/30 cursor-pointer select-none">Suppress</span> <span role="button" tabindex="0" class="px-3 py-1.5 bg-decay/10 text-decay/60 text-xs rounded-lg hover:bg-decay/20 ml-auto cursor-pointer select-none">Delete</span></div></div>'),Xe=f('<button><div class="flex items-start justify-between gap-4"><div class="flex-1 min-w-0"><div class="flex items-center gap-2 mb-2"><span class="w-2 h-2 rounded-full"></span> <span class="text-xs text-dim"> </span> <!></div> <p class="text-sm text-text leading-relaxed line-clamp-2"> </p></div> <div class="flex flex-col items-end gap-1 flex-shrink-0"><div class="w-12 h-1.5 bg-deep rounded-full overflow-hidden"><div class="h-full rounded-full"></div></div> <span class="text-xs text-muted"> </span></div></div> <!></button>'),Ze=f('<div class="grid gap-3"></div>'),et=f(`<div class="p-6 max-w-6xl mx-auto space-y-6"><div class="flex items-center justify-between"><h1 class="text-xl text-bright font-semibold">Memories</h1> <span class="text-dim text-sm"> </span></div> <div class="flex gap-3 flex-wrap"><input type="text" placeholder="Search memories..." class="flex-1 min-w-64 px-4 py-2.5 bg-white/[0.03] border border-synapse/10 rounded-xl text-text text-sm
placeholder:text-muted focus:outline-none focus:border-synapse/40 focus:ring-1 focus:ring-synapse/20 transition backdrop-blur-sm"/> <select class="px-3 py-2.5 bg-white/[0.03] border border-synapse/10 rounded-xl text-dim text-sm focus:outline-none backdrop-blur-sm"><option>All types</option><option>Fact</option><option>Concept</option><option>Event</option><option>Person</option><option>Place</option><option>Note</option><option>Pattern</option><option>Decision</option></select> <div class="flex items-center gap-2 text-xs text-dim"><span>Min retention:</span> <input type="range" min="0" max="1" step="0.1" class="w-24 accent-synapse"/> <span> </span></div></div> <!></div>`);function _t(me,be){Qe(be,!0);let k=b(Ye([])),P=b(""),S=b(""),he="",h=b(0),A=b(!0),T=b(null),te;Be(()=>m());async function m(){x(A,!0);try{const i={};e(P)&&(i.q=e(P)),e(S)&&(i.node_type=e(S)),e(h)>0&&(i.min_retention=String(e(h)));const c=await u.memories.list(i);x(k,c.memories,!0)}catch{x(k,[],!0)}finally{x(A,!1)}}function ye(){clearTimeout(te),te=setTimeout(m,300)}function we(i){return i>.7?"#10b981":i>.4?"#f59e0b":"#ef4444"}var C=et(),F=o(C),ae=t(o(F),2),ke=o(ae);a(ae),a(F);var M=t(F,2),$=o(M);_e($);var y=t($,2),R=o(y);R.value=R.__value="";var N=t(R);N.value=N.__value="fact";var O=t(N);O.value=O.__value="concept";var j=t(O);j.value=j.__value="event";var L=t(j);L.value=L.__value="person";var q=t(L);q.value=q.__value="place";var B=t(q);B.value=B.__value="note";var Q=t(B);Q.value=Q.__value="pattern";var se=t(Q);se.value=se.__value="decision",a(y);var oe=t(y,2),E=t(o(oe),2);_e(E);var ie=t(E,2),Pe=o(ie);a(ie),a(oe),a(M);var Se=t(M,2);{var Te=i=>{var c=Ue();ee(c,20,()=>Array(8),xe,(w,s)=>{var _=Ke();g(w,_)}),a(c),g(i,c)},$e=i=>{var c=Ze();ee(c,21,()=>e(k),w=>w.id,(w,s)=>{var _=Xe(),Y=o(_),z=o(Y),G=o(z),re=o(G),H=t(re,2),Ee=o(H,!0);a(H);var De=t(H,2);ee(De,17,()=>e(s).tags.slice(0,3),xe,(p,d)=>{var l=Ve(),J=o(l,!0);a(l),D(()=>v(J,e(d))),g(p,l)}),a(G);var ne=t(G,2),Ae=o(ne,!0);a(ne),a(z);var pe=t(z,2),I=o(pe),Ce=o(I);a(I);var de=t(I,2),Fe=o(de);a(de),a(pe),a(Y);var Me=t(Y,2);{var Re=p=>{var d=We(),l=o(d),J=o(l,!0);a(l);var K=t(l,2),U=o(K),Ne=o(U);a(U);var V=t(U,2),Oe=o(V);a(V);var le=t(V,2),je=o(le);a(le),a(K);var ve=t(K,2),W=o(ve),X=t(W,2),Z=t(X,2),ce=t(Z,2);a(ve),a(d),D((r,Le,qe)=>{v(J,e(s).content),v(Ne,`Storage: ${r??""}%`),v(Oe,`Retrieval: ${Le??""}%`),v(je,`Created: ${qe??""}`)},[()=>(e(s).storageStrength*100).toFixed(1),()=>(e(s).retrievalStrength*100).toFixed(1),()=>new Date(e(s).createdAt).toLocaleDateString()]),n("click",W,r=>{r.stopPropagation(),u.memories.promote(e(s).id)}),n("keydown",W,r=>{r.key==="Enter"&&(r.stopPropagation(),u.memories.promote(e(s).id))}),n("click",X,r=>{r.stopPropagation(),u.memories.demote(e(s).id)}),n("keydown",X,r=>{r.key==="Enter"&&(r.stopPropagation(),u.memories.demote(e(s).id))}),n("click",Z,async r=>{r.stopPropagation(),await u.memories.suppress(e(s).id,"dashboard trigger")}),n("keydown",Z,async r=>{r.key==="Enter"&&(r.stopPropagation(),await u.memories.suppress(e(s).id,"dashboard trigger"))}),n("click",ce,async r=>{r.stopPropagation(),await u.memories.delete(e(s).id),m()}),n("keydown",ce,async r=>{r.key==="Enter"&&(r.stopPropagation(),await u.memories.delete(e(s).id),m())}),g(p,d)};ue(Me,p=>{var d;((d=e(T))==null?void 0:d.id)===e(s).id&&p(Re)})}a(_),D((p,d)=>{var l;He(_,1,`text-left p-4 glass-subtle rounded-xl hover:bg-white/[0.04]
transition-all duration-200 group
${((l=e(T))==null?void 0:l.id)===e(s).id?"!border-synapse/40 glow-synapse":""}`),ge(re,`background: ${(Je[e(s).nodeType]||"#8B95A5")??""}`),v(Ee,e(s).nodeType),v(Ae,e(s).content),ge(Ce,`width: ${e(s).retentionStrength*100}%; background: ${p??""}`),v(Fe,`${d??""}%`)},[()=>we(e(s).retentionStrength),()=>(e(s).retentionStrength*100).toFixed(0)]),n("click",_,()=>{var p;return x(T,((p=e(T))==null?void 0:p.id)===e(s).id?null:e(s),!0)}),g(w,_)}),a(c),g(i,c)};ue(Se,i=>{e(A)?i(Te):i($e,!1)})}a(C),D(i=>{v(ke,`${e(k).length??""} results`),v(Pe,`${i??""}%`)},[()=>(e(h)*100).toFixed(0)]),n("input",$,ye),fe($,()=>e(P),i=>x(P,i)),n("change",y,m),Ie(y,()=>e(S),i=>x(S,i)),n("change",E,m),fe(E,()=>e(h),i=>x(h,i)),g(me,C),ze()}Ge(["input","change","click","keydown"]);export{_t as component};