fix(dashboard): audit pass — clickable field cells, empty-data substrate, reduced-motion

Full multi-team audit of the living-field work (adversarial fleet + fresh-eyes
pass + foundation deep-dive). 11 real bugs found and fixed; 7 false positives
adversarially refuted. All re-verified live on the real brain.

Pick contract: field cells were unclickable in intentions/schedule/memory-prs/
importance — the click handlers read the old text-item id off a node payload.
Read the id from either shape; importance now also picks the field pass;
intentions gets a dedicated filter toggle instead of flipping the filter on every
click. RouteStage now picks passes top-down (front-rendered text before
back-rendered field) so a background cell can't steal a foreground control's
click. Proven live: cell clicks fire real promote/act with real memory ids.

Empty data: /patterns went black when the cross-project set is empty (it is
recomputed). Seeded a real memory-pool substrate it falls back to, like
contradictions — alive at zero patterns.

Correctness: memories unsuppress now honors UnsuppressResult.stillSuppressed
(compounded suppression stays scarred). LivingFieldPass no longer writes the
shared params[2] node_count lane (was corrupting the co-resident scene renderer
on graph/observatory/memories). Finite-guard every value reaching the GPU buffer
so a bad mapper can't NaN-out the field. blackbox selected-cell highlight tracks
selectedRunId. graph nulls its field handle when leaving field mode.

Accessibility: /memories and /importance (direct ObservatoryCanvas mounts) now
honor prefers-reduced-motion via engine.setPaused — the field freezes for
reduce-motion users. Gate pins reducedMotion:'no-preference' so the motion
assertion is stable.

Gates green: check 0/0, build ok, palace-launch-gate 22/22 + curated tour,
all-routes-smoke 20/20, ChangelogResponse gains totalEvents.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Sam Valladares 2026-07-12 06:57:19 +07:00
parent 844b91a804
commit e60e568160
188 changed files with 300 additions and 101 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
var K=Object.defineProperty;var Y=(d,c,a)=>c in d?K(d,c,{enumerable:!0,configurable:!0,writable:!0,value:a}):d[c]=a;var T=(d,c,a)=>Y(d,typeof c!="symbol"?c+"":c,a);import"../chunks/Bzak7iHL.js";import{p as G,j as U,b as X,h as q,g as w,u as x,$ as H}from"../chunks/CGq8RnJq.js";import{h as Q}from"../chunks/De_e6MzK.js";import{s as Z,a as R}from"../chunks/DV6OI5iy.js";import{w as ee,i as te,a as ne,e as ie}from"../chunks/Ch9vNiEl.js";import{R as se}from"../chunks/BpEKQwpr.js";import{r as h,e as re}from"../chunks/BMB5u1EX.js";import{T as oe}from"../chunks/D7ozXiSB.js";import{L as ae,l as ce}from"../chunks/DETSv_kY.js";function _e(d,c){G(c,!0);const a=()=>R(ie,"$eventFeed",y),l=()=>R(ne,"$isConnected",y),p=()=>R(te,"$isReconnecting",y),[y,N]=Z(),P=[...h("#22C7DE"),1],S=[...h("#FFB000"),.9],C=[...h("#FF3B30"),.92],L=[...h("#29F2A9"),.62],f=42;let u=null,m=null,v=x(()=>O(a()));U(()=>{u==null||u.setText(D(a(),l(),p()))});function I(t,e){const n=new j(t);n.uploadScene(e);const i=new oe(t);return u=i,i.init().then(()=>i.setText(D(a(),l(),p()))),[n,{render(o){i.render(o)},pickAt(o,r){const s=i.pickAt(o,r);return s?(s.id!==m&&(m=s.id,i.setRunDepth(s.id,1)),s):(m&&(m=null,i.setRunDepth(null)),null)},dispose(){i.dispose(),u===i&&(u=null)}}]}class j{constructor(e){T(this,"field");this.field=new ae(e)}uploadScene(e){const i=e.nodes.map((r,s)=>({node:r,event:a()[s]})).filter(r=>r.event).map(({node:r,event:s})=>({id:r.source.id,score:r.retention,hue:re(s.type),energy:r.activation,metric2:r.trust,scar:s.type.includes("Deleted")||s.type.includes("Demoted")||s.type.includes("Verdict"),kind:"feed-event",payload:s})),o=i.length<4;this.field.setCells(ce(i,{maxRadius:o?.78:.92,minCellR:o?.24:.018,maxCellR:o?.32:.06}))}compute(e){this.field.compute(e)}render(e){this.field.render(e)}pickAt(e,n){return this.field.pickAt(e,n)}dispose(){this.field.dispose()}}function O(t){const e=t.slice(0,f);return{organ:"feed",nodes:e.map((n,i)=>({source:{kind:"event",id:$(n,i)},index:i,label:n.type,retention:g(n),activation:A(e,n,i),trust:g(n),tags:Object.keys(n.data).slice(0,6),type:n.type})),edges:[],events:e.map((n,i)=>({source:{kind:"event",id:$(n,i)},type:n.type,targetIndex:i,frame:i,energy:g(n)})),receipts:[],scalars:{eventCount:t.length,connected:l()?1:0,reconnecting:p()?1:0},alive:e.length>0}}function D(t,e,n){const i=t.slice(0,f);if(i.length===0)return[z(M(e,n),n?S:e?L:C)];const o=.72,r=1.5/Math.max(1,f-1);return i.map((s,b)=>{const k=$(s,b);return{id:`feed:${k}`,kind:"feed-event",event:s,eventKey:k,text:B(s,k),x:-.9,y:o-b*r,size:.024,color:W(s),depth:.6+.4*A(i,s,b),weight:g(s),startFrame:0,revealSpan:1,maxWidthEm:58,hitPadX:.03,hitPadY:.013}})}function z(t,e){return{id:"feed:connection-state",kind:"feed-state",text:_(t),x:-.52,y:.03,size:.038,color:e,depth:.72,weight:.62,revealSpan:24,maxWidthEm:48}}function B(t,e){const n=V(t.data);return _(`${t.type} | ${e.slice(0,24)} | ${n}`.slice(0,138))}function V(t){const e=Object.entries(t).filter(([,n])=>n!=null&&typeof n!="object").slice(0,5).map(([n,i])=>`${n}=${String(i).replace(/\s+/g," ").slice(0,32)}`);return e.length?e.join(" "):JSON.stringify(t).replace(/\s+/g," ").slice(0,82)}function $(t,e){const n=t.data,i=n.id??n.event_id??n.memory_id??n.trace_id??n.run_id??n.receipt_id??n.pr_id??n.timestamp??n.at??`${t.type}:${e}`;return _(String(i))}function M(t,e){return JSON.stringify({connected:t,reconnecting:e,events:0})}function g(t){const e=t.data,i=[e.energy,e.confidence,e.strength,e.weight,e.composite_score,e.new_retention,e.retention,e.result_count,e.connections_found,e.insights_generated,e.nodes_processed,e.duration_ms].map(Number).find(o=>Number.isFinite(o));return i===void 0?.5:i<0?0:i<=1?i:F(Math.log10(i+1)/3)}function A(t,e,n){const i=t.map(E).filter(r=>r!==null),o=E(e);if(o!==null&&i.length>1){const r=Math.min(...i),s=Math.max(...i);if(s>r)return F((o-r)/(s-r))}return F(1-n/Math.max(1,f-1))}function E(t){const e=t.data.timestamp??t.data.at??t.data.created_at;if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){const n=Date.parse(e);return Number.isFinite(n)?n:null}return null}function W(t){return t.type.includes("Deleted")||t.type.includes("Demoted")||t.type.includes("Verdict")?C:t.type.includes("Progress")||t.type.includes("Started")?S:P}function _(t){return t.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function F(t){return Math.min(1,Math.max(0,Number.isFinite(t)?t:.5))}function J(t){t.kind==="feed-event"&&ee.clearEvents()}Q("1o4vd58",t=>{q(()=>{H.title="Feed · Vestige"})});{let t=x(()=>`live-event-stream:${a().length}:${l()?1:0}:${p()?1:0}`),e=x(()=>M(l(),p()));se(d,{organ:"feed",get seed(){return w(t)},get scene(){return w(v)},passes:I,loading:!1,error:null,get emptyLabel(){return w(e)},onpick:J})}X(),N()}export{_e as component};

View file

@ -1 +0,0 @@
var K=Object.defineProperty;var Y=(d,c,a)=>c in d?K(d,c,{enumerable:!0,configurable:!0,writable:!0,value:a}):d[c]=a;var T=(d,c,a)=>Y(d,typeof c!="symbol"?c+"":c,a);import"../chunks/Bzak7iHL.js";import{p as G,j as U,b as X,h as q,g as w,u as x,$ as H}from"../chunks/CGq8RnJq.js";import{h as Q}from"../chunks/De_e6MzK.js";import{s as Z,a as R}from"../chunks/DV6OI5iy.js";import{w as ee,i as te,a as ne,e as ie}from"../chunks/Ch9vNiEl.js";import{R as se}from"../chunks/Cqe0su6e.js";import{r as h,e as re}from"../chunks/BMB5u1EX.js";import{T as oe}from"../chunks/D7ozXiSB.js";import{L as ae,l as ce}from"../chunks/BeGBxCGK.js";function _e(d,c){G(c,!0);const a=()=>R(ie,"$eventFeed",y),l=()=>R(ne,"$isConnected",y),p=()=>R(te,"$isReconnecting",y),[y,N]=Z(),P=[...h("#22C7DE"),1],S=[...h("#FFB000"),.9],C=[...h("#FF3B30"),.92],L=[...h("#29F2A9"),.62],f=42;let u=null,m=null,v=x(()=>O(a()));U(()=>{u==null||u.setText(D(a(),l(),p()))});function I(t,e){const n=new j(t);n.uploadScene(e);const i=new oe(t);return u=i,i.init().then(()=>i.setText(D(a(),l(),p()))),[n,{render(s){i.render(s)},pickAt(s,r){const o=i.pickAt(s,r);return o?(o.id!==m&&(m=o.id,i.setRunDepth(o.id,1)),o):(m&&(m=null,i.setRunDepth(null)),null)},dispose(){i.dispose(),u===i&&(u=null)}}]}class j{constructor(e){T(this,"field");this.field=new ae(e)}uploadScene(e){const i=e.nodes.map((s,r)=>({node:s,event:a()[r]})).filter(s=>s.event).map(({node:s,event:r})=>({id:s.source.id,score:s.retention,hue:re(r.type),energy:s.activation,metric2:s.trust,scar:r.type.includes("Deleted")||r.type.includes("Demoted")||r.type.includes("Verdict"),kind:"feed-event",payload:r}));this.field.setCells(ce(i,{maxRadius:.78,minCellR:.24,maxCellR:.32}))}compute(e){this.field.compute(e)}render(e){this.field.render(e)}pickAt(e,n){return this.field.pickAt(e,n)}dispose(){this.field.dispose()}}function O(t){const e=t.slice(0,f);return{organ:"feed",nodes:e.map((n,i)=>({source:{kind:"event",id:$(n,i)},index:i,label:n.type,retention:g(n),activation:A(e,n,i),trust:g(n),tags:Object.keys(n.data).slice(0,6),type:n.type})),edges:[],events:e.map((n,i)=>({source:{kind:"event",id:$(n,i)},type:n.type,targetIndex:i,frame:i,energy:g(n)})),receipts:[],scalars:{eventCount:t.length,connected:l()?1:0,reconnecting:p()?1:0},alive:e.length>0}}function D(t,e,n){const i=t.slice(0,f);if(i.length===0)return[z(M(e,n),n?S:e?L:C)];const s=.72,r=1.5/Math.max(1,f-1);return i.map((o,b)=>{const k=$(o,b);return{id:`feed:${k}`,kind:"feed-event",event:o,eventKey:k,text:B(o,k),x:-.9,y:s-b*r,size:.024,color:W(o),depth:.6+.4*A(i,o,b),weight:g(o),startFrame:0,revealSpan:1,maxWidthEm:58,hitPadX:.03,hitPadY:.013}})}function z(t,e){return{id:"feed:connection-state",kind:"feed-state",text:_(t),x:-.52,y:.03,size:.038,color:e,depth:.72,weight:.62,revealSpan:24,maxWidthEm:48}}function B(t,e){const n=V(t.data);return _(`${t.type} | ${e.slice(0,24)} | ${n}`.slice(0,138))}function V(t){const e=Object.entries(t).filter(([,n])=>n!=null&&typeof n!="object").slice(0,5).map(([n,i])=>`${n}=${String(i).replace(/\s+/g," ").slice(0,32)}`);return e.length?e.join(" "):JSON.stringify(t).replace(/\s+/g," ").slice(0,82)}function $(t,e){const n=t.data,i=n.id??n.event_id??n.memory_id??n.trace_id??n.run_id??n.receipt_id??n.pr_id??n.timestamp??n.at??`${t.type}:${e}`;return _(String(i))}function M(t,e){return JSON.stringify({connected:t,reconnecting:e,events:0})}function g(t){const e=t.data,i=[e.energy,e.confidence,e.strength,e.weight,e.composite_score,e.new_retention,e.retention,e.result_count,e.connections_found,e.insights_generated,e.nodes_processed,e.duration_ms].map(Number).find(s=>Number.isFinite(s));return i===void 0?.5:i<0?0:i<=1?i:F(Math.log10(i+1)/3)}function A(t,e,n){const i=t.map(E).filter(r=>r!==null),s=E(e);if(s!==null&&i.length>1){const r=Math.min(...i),o=Math.max(...i);if(o>r)return F((s-r)/(o-r))}return F(1-n/Math.max(1,f-1))}function E(t){const e=t.data.timestamp??t.data.at??t.data.created_at;if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){const n=Date.parse(e);return Number.isFinite(n)?n:null}return null}function W(t){return t.type.includes("Deleted")||t.type.includes("Demoted")||t.type.includes("Verdict")?C:t.type.includes("Progress")||t.type.includes("Started")?S:P}function _(t){return t.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function F(t){return Math.min(1,Math.max(0,Number.isFinite(t)?t:.5))}function J(t){t.kind==="feed-event"&&ee.clearEvents()}Q("1o4vd58",t=>{q(()=>{H.title="Feed · Vestige"})});{let t=x(()=>`live-event-stream:${a().length}:${l()?1:0}:${p()?1:0}`),e=x(()=>M(l(),p()));se(d,{organ:"feed",get seed(){return w(t)},get scene(){return w(v)},passes:I,loading:!1,error:null,get emptyLabel(){return w(e)},onpick:J})}X(),N()}export{_e as component};

File diff suppressed because one or more lines are too long

View file

@ -1 +0,0 @@
import"../chunks/Bzak7iHL.js";import{d as q,o as J,a as Q,b as F,e as Z}from"../chunks/DAau0uzT.js";import{p as tt,d as g,e as et,a as nt,b as ot,h as rt,g as i,f as it,u as st,c as at,s as l,$ as lt,r as ct}from"../chunks/CGq8RnJq.js";import{h as mt}from"../chunks/De_e6MzK.js";import{b as ut}from"../chunks/Ccqjq5DS.js";import{r as E,O as pt}from"../chunks/BMB5u1EX.js";import{a as v}from"../chunks/D35IQVqe.js";import{T as dt}from"../chunks/D7ozXiSB.js";import{L as ht,F as L,l as ft}from"../chunks/BeGBxCGK.js";var yt=it('<div class="fixed inset-0 bg-[#020307]"><!></div>');function Nt($,D){tt(D,!0);const N=[...E("#22C7DE"),1],b=[...E("#FF3B30"),.92],O=[...E("#29F2A9"),.62],_=[...E("#FFB020"),.86],k=36,w=30,P=-1e5,B=.62;let c=g(null),m=null,o=null,u=null,x=null,p=g(et([])),R=g(0),M=g(!0),h=g(null),C=null;J(()=>{W()}),Q(()=>{o==null||o.dispose(),u==null||u.dispose(),o=null,u=null,m=null});async function U(t){m=t;const e=new ht(t);u=e,e.setCells(A()),t.addPass(e);const n=new dt(t);o=n,await n.init(),n.setText(y()),t.addPass(n),t.demoClock.reset()}async function W(){l(M,!0),l(h,null),o==null||o.setText(y());try{const t=await v.memories.list({limit:String(k)});l(R,t.total,!0);const e=await Promise.allSettled(t.memories.map(async n=>({memory:n,score:await v.importance(n.content)})));l(p,e.filter(n=>n.status==="fulfilled").map(n=>n.value).sort((n,r)=>r.score.composite-n.score.composite),!0),t.memories.length>0&&i(p).length===0&&l(h,"API IMPORTANCE RETURNED NO SCORES")}catch(t){l(p,[],!0),l(R,0),l(h,t instanceof Error?t.message:"UNKNOWN IMPORTANCE FETCH ERROR",!0)}finally{l(M,!1),o==null||o.setText(y()),u==null||u.setCells(A()),m==null||m.demoClock.reset()}}function A(){const t=i(p).map(e=>({id:e.memory.id,score:f(e.score.composite),hue:e.score.recommendation==="save"?L.oxygen:L.caution,energy:Math.max(.35,f(e.score.composite)),metric2:f(e.memory.retentionStrength),kind:"importance",payload:e}));return ft(t,{maxRadius:.9,minCellR:.04,maxCellR:.1})}function I(t){return typeof t!="string"?"":t.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function Y(t){const{memory:e,score:n}=t,r=I(e.content??"").replace(/\s+/g," ").trim().slice(0,44),s=H(n);return I(`${r} | ${e.id.slice(0,8)} | ${Math.round(n.composite*100)}% | ${Math.round(e.retentionStrength*100)}% | ${n.recommendation} | ${s}`)}function H(t){return Object.entries(t.channels).sort((e,n)=>n[1]-e[1])[0][0]}function f(t){return Math.min(1,Math.max(0,Number.isFinite(t)?t:.5))}function T(t,e=O){return{id:"importance:status",kind:"importance-status",text:I(t),x:-.58,y:.02,size:.044,color:e,depth:.78,weight:.62,revealSpan:32,maxWidthEm:50}}function y(){if(i(M))return[T("LOADING IMPORTANCE FIELD...",N)];if(i(h))return[T(`ERROR - ${i(h)}`.slice(0,72),b)];if(i(p).length===0)return[T("EMPTY IMPORTANCE FIELD",O)];const t=i(p).slice(0,w),e=.72,n=1.5/Math.max(1,w-1);return t.map((r,s)=>{const a=Math.max(B,f(r.score.composite)),j=f(r.memory.retentionStrength);return{id:`importance:${r.memory.id}`,kind:"importance",memoryId:r.memory.id,text:Y(r),x:-.9,y:e-s*n,size:.025,color:r.score.recommendation==="save"?N:_,depth:a,weight:j,startFrame:P+s*2,revealSpan:1,maxWidthEm:54,hitPadX:.03,hitPadY:.018}})}function S(t){if(!i(c))return null;const e=i(c).getBoundingClientRect();return e.width<=0||e.height<=0?null:{x:(t.clientX-e.left)/e.width*2-1,y:-((t.clientY-e.top)/e.height*2-1)}}function z(t){if(!i(c)||!m)return;const e=i(c).getBoundingClientRect(),n=Math.max(1e-4,e.width/Math.max(1,e.height)),r={x:t.x*Math.max(n,1),y:t.y/Math.min(n,1)},s=x??r,a={x:s.x+(r.x-s.x)*.35,y:s.y+(r.y-s.y)*.35};x=a,m.setCursorPreNdc(a.x,a.y,a.x-s.x,a.y-s.y)}function V(t){const e=S(t);if(!e)return;z(e);const n=(o==null?void 0:o.pickAt(e.x,e.y))??null,r=(n==null?void 0:n.kind)==="importance"?n.id:null;r!==C&&(C=r,o==null||o.setRunDepth(r,1)),i(c)&&(i(c).style.cursor=r?"crosshair":"default")}function G(){x=null,C=null,m==null||m.setCursorPreNdc(999,999,0,0),o==null||o.setRunDepth(null),i(c)&&(i(c).style.cursor="default")}async function K(t){const e=S(t);if(!e||!o)return;const n=o.pickAt(e.x,e.y);if((n==null?void 0:n.kind)!=="importance")return;const r=n.payload;if(r.memoryId)try{const s=await v.memories.promote(r.memoryId);l(p,i(p).map(a=>a.memory.id===s.id?{...a,memory:{...a.memory,retentionStrength:s.retentionStrength??a.memory.retentionStrength}}:a),!0),o.setText(y())}catch(s){l(h,s instanceof Error?s.message:"UNKNOWN IMPORTANCE PROMOTE ERROR",!0),o.setText(y())}}var d=yt();mt("mhrd3u",t=>{rt(()=>{lt.title="Importance · Vestige"})});var X=at(d);{let t=st(()=>`real-importance-field:${i(R)}`);pt(X,{demo:"recall-path",get seed(){return i(t)},onready:U})}ct(d),ut(d,t=>l(c,t),()=>i(c)),F("pointerdown",d,K),F("pointermove",d,V),Z("pointerleave",d,G),nt($,d),ot()}q(["pointerdown","pointermove"]);export{Nt as component};

View file

@ -1 +0,0 @@
var J=Object.defineProperty;var K=(d,c,p)=>c in d?J(d,c,{enumerable:!0,configurable:!0,writable:!0,value:p}):d[c]=p;var S=(d,c,p)=>K(d,typeof c!="symbol"?c+"":c,p);import"../chunks/Bzak7iHL.js";import{o as X,a as q}from"../chunks/DAau0uzT.js";import{p as Q,d as g,e as w,b as Z,h as ee,g as r,s as i,u as v,$ as te}from"../chunks/CGq8RnJq.js";import{h as re}from"../chunks/De_e6MzK.js";import{a as D}from"../chunks/D35IQVqe.js";import{R as se}from"../chunks/Cqe0su6e.js";import{r as R,C as ne,R as P,I as ie}from"../chunks/BMB5u1EX.js";import{T as ae}from"../chunks/D7ozXiSB.js";import{L as oe,F as ce,l as le}from"../chunks/BeGBxCGK.js";function Te(d,c){Q(c,!0);const p=[...R(ne.forward),1],U=[...R(P.luciferin),.88],z=[...R(ie.veto),.92],C=[...R(P.recall),.62],b=36,I="active",F="all";let a=g(w([])),N=g(w([])),y=g(0),m=g(I),T=g(!0),f=g(null),E=g(null),u=null;X(()=>{A(I)}),q(()=>{u==null||u.dispose(),u=null});async function A(e=r(m)){i(m,e,!0),i(T,!0),i(f,null),L();try{const[t,n]=await Promise.all([D.intentions(e),D.predict()]);i(a,t.intentions||[],!0),i(N,n.predictions??[],!0),i(y,t.total??r(a).length,!0)}catch(t){i(a,[],!0),i(N,[],!0),i(y,0),i(f,t instanceof Error?t.message:"UNKNOWN INTENTION FETCH ERROR",!0)}finally{i(T,!1),L()}}function W(e,t){const n=new Y(e);n.uploadScene(t);const s=new ae(e);return u=s,s.init().then(()=>L()),s.setText(O()),[n,s]}class Y{constructor(t){S(this,"field");this.field=new oe(t)}uploadScene(t){const n=t.nodes.map(o=>({id:o.source.id,score:o.activation??o.retention,hue:ce.forward,energy:o.activation,metric2:o.retention,selected:o.source.id===r(E),kind:"intention",payload:o})),s=n.length<4;this.field.setCells(le(n,{maxRadius:.82,minCellR:s?.24:.025,maxCellR:s?.32:.075}))}compute(t){this.field.compute(t)}render(t){this.field.render(t)}pickAt(t,n){return this.field.pickAt(t,n)}dispose(){this.field.dispose()}}function L(){u==null||u.setText(O())}function l(e){return e.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function h(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:.5))}function k(e,t){return typeof e=="number"?h(e):t}function M(e){const t=k(e.retention??e.retentionStrength,Number.NaN);if(Number.isFinite(t))return t;const n=typeof e.reminder_count=="number"?e.reminder_count:0,s=Array.isArray(e.related_memories)?e.related_memories.length:0;return h((n+s+1)/6)}function $(e){return k(e.confidence,h((e.priority||2)/4))}function G(e){try{const t=JSON.parse(e.trigger_data||"{}"),n=t.condition??t.topic??t.at??t.in_minutes??t.inMinutes??t.codebase;return l(String(n??e.trigger_type)).replace(/\s+/g," ").slice(0,26)}catch{return l(e.trigger_type).slice(0,26)}}function H(e){const t=l(e.content).replace(/\s+/g," ").trim().slice(0,48),n=l(e.status).slice(0,12),s=G(e);return l(`${t} | ${e.id.slice(0,8)} | p${e.priority} | ${n} | ${s}`)}function x(e,t=C){return{id:"intentions:status",kind:"intention-status",text:l(e),x:-.58,y:.02,size:.044,color:t,depth:.78,weight:.62,revealSpan:32,maxWidthEm:50}}function O(){if(r(T))return[x("LOADING INTENTION FIELD...",p)];if(r(f))return[x(`ERROR - ${r(f)}`.slice(0,72),z)];if(r(a).length===0)return[x(`EMPTY ${r(m).toUpperCase()} INTENTION FIELD`,C)];const e=r(a).slice(0,b),t=.72,n=1.5/Math.max(1,b-1);return e.map((s,o)=>{const B=`intent:${s.id}`,_=r(E)===s.id;return{id:B,kind:"intention",intentionId:s.id,text:H(s),x:-.88,y:t-o*n,size:_?.031:.026,color:_?U:p,depth:_?1:$(s),weight:M(s),startFrame:o*2,revealSpan:20,maxWidthEm:52,hitPadX:.03,hitPadY:.015}})}const V=v(()=>({organ:"intentions",nodes:[...r(a).map((e,t)=>({source:{kind:"receipt",id:e.id},index:t,label:l(e.content).slice(0,48),retention:M(e),activation:$(e),trust:$(e),tags:e.tags??[e.status,e.trigger_type].filter(Boolean),type:e.trigger_type})),...r(N).map((e,t)=>({source:{kind:"memory",id:e.id},index:r(a).length+t,label:l(e.content).slice(0,48),retention:h(e.retention),activation:e.predictedNeed==="high"?1:e.predictedNeed==="medium"?.65:.35,trust:h(e.retention),tags:[e.predictedNeed],type:e.nodeType}))],edges:[],events:[],receipts:r(a).map((e,t)=>({source:{kind:"receipt",id:e.id},label:l(e.status),nodeIndices:[t]})),scalars:{total:r(y),visible:r(a).length,predicted:r(N).length,filter:r(m)===F?1:0},alive:r(a).length>0}));function j(e){if(e.kind!=="intention")return;const t=e.payload;i(E,t.intentionId??null,!0),L(),A(r(m)===I?F:I)}re("16y0tkj",e=>{ee(()=>{te.title="Intentions · Vestige"})});{let e=v(()=>`real-intention-field:${r(m)}:${r(y)}:${r(E)??"none"}`),t=v(()=>`EMPTY ${r(m).toUpperCase()} INTENTION FIELD`);se(d,{organ:"intentions",get seed(){return r(e)},get scene(){return r(V)},passes:W,get loading(){return r(T)},get error(){return r(f)},get emptyLabel(){return r(t)},onpick:j})}Z()}export{Te as component};

File diff suppressed because one or more lines are too long

View file

@ -1 +0,0 @@
import"../chunks/Bzak7iHL.js";import{d as j,o as J,a as Q,b as $,e as Z}from"../chunks/DAau0uzT.js";import{p as P,d as f,e as b,a as ee,b as te,h as re,g as i,f as ne,u as oe,c as ie,s as a,$ as se,r as ae}from"../chunks/CGq8RnJq.js";import{h as le}from"../chunks/De_e6MzK.js";import{b as ue}from"../chunks/Ccqjq5DS.js";import{r as T,O as ce,a as de}from"../chunks/BMB5u1EX.js";import{a as M}from"../chunks/D35IQVqe.js";import{T as me}from"../chunks/D7ozXiSB.js";import{L as pe,l as he}from"../chunks/BeGBxCGK.js";var fe=ne('<div class="fixed inset-0 bg-[#020307]"><!></div>');function Ie(k,A){P(A,!0);const O=[...T("#22C7DE"),1],F=[...T("#FF3B30"),.92],N=[...T("#29F2A9"),.62],Y=40,L=36,_=.62,W=-1e5;let c=f(null),d=null,r=null,l=null,E=null,y=f(b(new Set)),m=f(b([])),R=f(0),v=f(!0),h=f(null),w=null;J(()=>{K()}),Q(()=>{r==null||r.dispose(),l==null||l.dispose(),r=null,l=null,d=null});async function B(e){d=e;const t=new pe(e);l=t,t.setCells(C()),e.addPass(t);const n=new me(e);r=n,await n.init(),n.setText(x()),e.addPass(n),e.demoClock.reset()}function C(){const e=i(m).map(t=>{const n=g(t.retentionStrength);return{id:t.id,score:g(t.retrievalStrength??n),hue:de(n),energy:.4+.6*g(t.retrievalStrength??n),metric2:n,scar:i(y).has(t.id),kind:"memory",payload:t}});return he(e,{maxRadius:.95,minCellR:.014,maxCellR:.05})}async function K(){a(v,!0),a(h,null),r==null||r.setText(x());try{const e=await M.memories.list({limit:String(Y)});a(m,e.memories,!0),a(R,e.total,!0)}catch(e){a(m,[],!0),a(R,0),a(h,e instanceof Error?e.message:"UNKNOWN MEMORY FETCH ERROR",!0)}finally{a(v,!1),r==null||r.setText(x()),l==null||l.setCells(C()),d==null||d.demoClock.reset()}}function I(e){return e.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function z(e){const t=I(e.content).replace(/\s+/g," ").trim().slice(0,52);return I(`${t} | ${e.id.slice(0,8)} | ${Math.round(e.retentionStrength*100)}%`)}function g(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:.5))}function S(e,t=N){return{id:"memories:status",kind:"memory-status",text:I(e),x:-.58,y:.02,size:.044,color:t,depth:.78,weight:.62,revealSpan:32,maxWidthEm:50}}function x(){if(i(v))return[S("LOADING MEMORY FIELD...",O)];if(i(h))return[S(`ERROR - ${i(h)}`.slice(0,72),F)];if(i(m).length===0)return[S("EMPTY MEMORY FIELD",N)];const e=i(m).slice(0,L),t=.72,n=1.5/Math.max(1,L-1);return e.map((o,s)=>{const u=g(o.retrievalStrength),q=g(o.retentionStrength);return{id:`mem:${o.id}`,kind:"memory",memoryId:o.id,text:z(o),x:-.88,y:t-s*n,size:.026,color:O,depth:Math.max(_,u),weight:q,startFrame:W+s*2,revealSpan:20,maxWidthEm:46,hitPadX:.03,hitPadY:.015}})}function D(e){if(!i(c))return null;const t=i(c).getBoundingClientRect();return t.width<=0||t.height<=0?null:{x:(e.clientX-t.left)/t.width*2-1,y:-((e.clientY-t.top)/t.height*2-1)}}function H(e){if(!i(c)||!d)return;const t=i(c).getBoundingClientRect(),n=Math.max(1e-4,t.width/Math.max(1,t.height)),o={x:e.x*Math.max(n,1),y:e.y/Math.min(n,1)},s=E??o,u={x:s.x+(o.x-s.x)*.35,y:s.y+(o.y-s.y)*.35};E=u,d.setCursorPreNdc(u.x,u.y,u.x-s.x,u.y-s.y)}function U(e){const t=D(e);if(!t)return;H(t);const n=(r==null?void 0:r.pickAt(t.x,t.y))??null,o=(n==null?void 0:n.kind)==="memory"?n.id:null;o!==w&&(w=o,r==null||r.setRunDepth(o,1)),i(c)&&(i(c).style.cursor=o?"crosshair":"default")}function V(){E=null,w=null,d==null||d.setCursorPreNdc(999,999,0,0),r==null||r.setRunDepth(null),i(c)&&(i(c).style.cursor="default")}async function G(e){const t=D(e);if(!t||!r)return;const n=r.pickAt(t.x,t.y);if((n==null?void 0:n.kind)!=="memory")return;const o=n.payload;if(o.memoryId)try{if(e.shiftKey)await M.memories.suppress(o.memoryId,"suppressed from memories field"),a(y,new Set(i(y)).add(o.memoryId),!0);else if(e.altKey){await M.memories.unsuppress(o.memoryId);const s=new Set(i(y));s.delete(o.memoryId),a(y,s,!0)}else{const s=await M.memories.promote(o.memoryId);a(m,i(m).map(u=>u.id===s.id?{...u,retentionStrength:s.retentionStrength}:u),!0)}a(h,null),r.setText(x()),l==null||l.setCells(C())}catch(s){a(h,s instanceof Error?s.message:"UNKNOWN MEMORY ACTION ERROR",!0),r.setText(x())}}var p=fe();le("1mq4kpt",e=>{re(()=>{se.title="Memories · Vestige"})});var X=ie(p);{let e=oe(()=>`real-memory-field:${i(R)}`);ce(X,{demo:"recall-path",get seed(){return i(e)},onready:B})}ae(p),ue(p,e=>a(c,e),()=>i(c)),$("pointerdown",p,G),$("pointermove",p,U),Z("pointerleave",p,V),ee(k,p),te()}j(["pointerdown","pointermove"]);export{Ie as component};

View file

@ -0,0 +1 @@
import"../chunks/Bzak7iHL.js";import{d as Q,o as Z,a as P,b,e as ee}from"../chunks/DAau0uzT.js";import{p as te,d as f,e as k,a as re,b as ne,h as oe,g as s,f as se,u as ie,c as ae,s as l,$ as le,r as ue}from"../chunks/CGq8RnJq.js";import{h as ce}from"../chunks/De_e6MzK.js";import{b as de}from"../chunks/Ccqjq5DS.js";import{r as L,O as me,a as pe}from"../chunks/BMB5u1EX.js";import{a as v}from"../chunks/D35IQVqe.js";import{T as he}from"../chunks/D7ozXiSB.js";import{L as fe,l as ye}from"../chunks/DETSv_kY.js";var ge=se('<div class="fixed inset-0 bg-[#020307]"><!></div>');function Te(A,F){te(F,!0);const O=[...L("#22C7DE"),1],Y=[...L("#FF3B30"),.92],N=[...L("#29F2A9"),.62],_=40,D=36,W=.62,B=-1e5;let c=f(null),d=null,n=null,u=null,E=null,y=f(k(new Set)),m=f(k([])),w=f(0),R=f(!0),h=f(null),C=null,M=null;Z(()=>{H()}),P(()=>{M==null||M(),n==null||n.dispose(),u==null||u.dispose(),n=null,u=null,d=null});function K(e){if(typeof window>"u")return()=>{};const t=window.matchMedia("(prefers-reduced-motion: reduce)");e.setPaused(t.matches);const r=o=>e.setPaused(o.matches);return t.addEventListener("change",r),()=>t.removeEventListener("change",r)}async function z(e){d=e,M=K(e);const t=new fe(e);u=t,t.setCells(I()),e.addPass(t);const r=new he(e);n=r,await r.init(),r.setText(x()),e.addPass(r),e.demoClock.reset()}function I(){const e=s(m).map(t=>{const r=g(t.retentionStrength);return{id:t.id,score:g(t.retrievalStrength??r),hue:pe(r),energy:.4+.6*g(t.retrievalStrength??r),metric2:r,scar:s(y).has(t.id),kind:"memory",payload:t}});return ye(e,{maxRadius:.95,minCellR:.014,maxCellR:.05})}async function H(){l(R,!0),l(h,null),n==null||n.setText(x());try{const e=await v.memories.list({limit:String(_)});l(m,e.memories,!0),l(w,e.total,!0)}catch(e){l(m,[],!0),l(w,0),l(h,e instanceof Error?e.message:"UNKNOWN MEMORY FETCH ERROR",!0)}finally{l(R,!1),n==null||n.setText(x()),u==null||u.setCells(I()),d==null||d.demoClock.reset()}}function S(e){return e.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function U(e){const t=S(e.content).replace(/\s+/g," ").trim().slice(0,52);return S(`${t} | ${e.id.slice(0,8)} | ${Math.round(e.retentionStrength*100)}%`)}function g(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:.5))}function T(e,t=N){return{id:"memories:status",kind:"memory-status",text:S(e),x:-.58,y:.02,size:.044,color:t,depth:.78,weight:.62,revealSpan:32,maxWidthEm:50}}function x(){if(s(R))return[T("LOADING MEMORY FIELD...",O)];if(s(h))return[T(`ERROR - ${s(h)}`.slice(0,72),Y)];if(s(m).length===0)return[T("EMPTY MEMORY FIELD",N)];const e=s(m).slice(0,D),t=.72,r=1.5/Math.max(1,D-1);return e.map((o,i)=>{const a=g(o.retrievalStrength),J=g(o.retentionStrength);return{id:`mem:${o.id}`,kind:"memory",memoryId:o.id,text:U(o),x:-.88,y:t-i*r,size:.026,color:O,depth:Math.max(W,a),weight:J,startFrame:B+i*2,revealSpan:20,maxWidthEm:46,hitPadX:.03,hitPadY:.015}})}function $(e){if(!s(c))return null;const t=s(c).getBoundingClientRect();return t.width<=0||t.height<=0?null:{x:(e.clientX-t.left)/t.width*2-1,y:-((e.clientY-t.top)/t.height*2-1)}}function V(e){if(!s(c)||!d)return;const t=s(c).getBoundingClientRect(),r=Math.max(1e-4,t.width/Math.max(1,t.height)),o={x:e.x*Math.max(r,1),y:e.y/Math.min(r,1)},i=E??o,a={x:i.x+(o.x-i.x)*.35,y:i.y+(o.y-i.y)*.35};E=a,d.setCursorPreNdc(a.x,a.y,a.x-i.x,a.y-i.y)}function q(e){const t=$(e);if(!t)return;V(t);const r=(n==null?void 0:n.pickAt(t.x,t.y))??null,o=(r==null?void 0:r.kind)==="memory"?r.id:null;o!==C&&(C=o,n==null||n.setRunDepth(o,1)),s(c)&&(s(c).style.cursor=o?"crosshair":"default")}function G(){E=null,C=null,d==null||d.setCursorPreNdc(999,999,0,0),n==null||n.setRunDepth(null),s(c)&&(s(c).style.cursor="default")}async function X(e){const t=$(e);if(!t||!n)return;const r=n.pickAt(t.x,t.y);if((r==null?void 0:r.kind)!=="memory")return;const o=r.payload;if(o.memoryId)try{if(e.shiftKey)await v.memories.suppress(o.memoryId,"suppressed from memories field"),l(y,new Set(s(y)).add(o.memoryId),!0);else if(e.altKey){if(!(await v.memories.unsuppress(o.memoryId)).stillSuppressed){const a=new Set(s(y));a.delete(o.memoryId),l(y,a,!0)}}else{const i=await v.memories.promote(o.memoryId);l(m,s(m).map(a=>a.id===i.id?{...a,retentionStrength:i.retentionStrength}:a),!0)}l(h,null),n.setText(x()),u==null||u.setCells(I())}catch(i){l(h,i instanceof Error?i.message:"UNKNOWN MEMORY ACTION ERROR",!0),n.setText(x())}}var p=ge();ce("1mq4kpt",e=>{oe(()=>{le.title="Memories · Vestige"})});var j=ae(p);{let e=ie(()=>`real-memory-field:${s(w)}`);me(j,{demo:"recall-path",get seed(){return s(e)},onready:z})}ue(p),de(p,e=>l(c,e),()=>s(c)),b("pointerdown",p,X),b("pointermove",p,q),ee("pointerleave",p,G),re(A,p),ne()}Q(["pointerdown","pointermove"]);export{Te as component};

View file

@ -0,0 +1 @@
var Y=Object.defineProperty;var z=(m,c,u)=>c in m?Y(m,c,{enumerable:!0,configurable:!0,writable:!0,value:u}):m[c]=u;var I=(m,c,u)=>z(m,typeof c!="symbol"?c+"":c,u);import"../chunks/Bzak7iHL.js";import{o as j}from"../chunks/DAau0uzT.js";import{p as H,d as g,e as b,j as K,b as V,s as a,h as B,g as i,u as O,$ as G}from"../chunks/CGq8RnJq.js";import{h as X}from"../chunks/De_e6MzK.js";import{a as q,s as J}from"../chunks/DV6OI5iy.js";import{a as T}from"../chunks/D35IQVqe.js";import{m as Q}from"../chunks/Ch9vNiEl.js";import{R as Z}from"../chunks/BpEKQwpr.js";import{r as P,I as ee,R as te}from"../chunks/BMB5u1EX.js";import{T as re}from"../chunks/D7ozXiSB.js";import{L as se,F as ne,l as ie}from"../chunks/DETSv_kY.js";function Re(m,c){H(c,!0);const u=()=>q(Q,"$memoryPrEvents",k),[k,_]=J(),v=[...P("#22C7DE"),1],F=[...P(ee.caution),.9],S=[...P(te.recall),.62],f=28,A=100,$=-1e5;let l=g(b([])),d=g(b([])),R=g(!0),y=g(null);j(()=>{x()});async function x(){a(R,!0),a(y,null);try{const e=await T.memoryPrs.list(void 0,A);a(l,e.prs,!0),a(d,[],!0)}catch(e){a(l,[],!0),a(d,[],!0),a(y,e instanceof Error?e.message:"UNKNOWN MEMORY PR FETCH ERROR",!0)}finally{a(R,!1)}}K(()=>{u().length&&x()});function h(e){return e.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function C(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:.5))}function M(e,t){if(typeof e=="number"&&Number.isFinite(e))return e;if(!e||typeof e!="object")return null;const n=e;for(const r of t){const s=n[r];if(typeof s=="number"&&Number.isFinite(s))return s}for(const r of Object.values(n)){const s=M(r,t);if(s!==null)return s}return null}function E(e){const t=M(e.diff,["confidence","trust","contradictsTrust","contradicts_trust"]);return t!==null?C(t>1?t/100:t):.5}function w(e){return h(`${e.title} | ${e.id.slice(0,8)} | ${e.status}`).replace(/\s+/g," ").trim().slice(0,96)}function N(){const e=i(l).slice(0,f),t=.74,n=1.46/Math.max(1,f-1),r=e.map((o,p)=>({id:`memory-pr:${o.id}`,kind:"memory-pr",prId:o.id,text:w(o),x:-.9,y:t-p*n,size:.025,color:o.status==="pending"?v:S,depth:E(o),weight:1,startFrame:$+p*2,revealSpan:20,maxWidthEm:54,hitPadX:.03,hitPadY:.019})),s=i(d).slice(0,5).map((o,p)=>({id:`memory-pr-why:${o.code}:${p}`,kind:"memory-pr-why",text:h(`${o.code}: ${o.detail}`).replace(/\s+/g," ").trim().slice(0,86),x:-.82,y:-.76-p*.052,size:.02,color:F,depth:.72,weight:.8,startFrame:$+(e.length+p)*2,revealSpan:18,maxWidthEm:56}));return[...r,...s]}let L=O(()=>({organ:"memory-prs",nodes:i(l).slice(0,f).map((e,t)=>({source:{kind:"pr",id:e.id},index:t,label:w(e),retention:1,activation:E(e),trust:E(e),tags:e.signals.map(n=>h(n.code)),type:h(e.kind)})),edges:[],events:[],receipts:[],scalars:{visiblePrs:Math.min(i(l).length,f),whySignals:i(d).length},alive:i(l).length>0}));function D(e,t){const n=new U(e);n.uploadScene(t);const r=new re(e);return r.init().then(()=>r.setText(N())),[n,{render:s=>r.render(s),uploadScene:()=>r.setText(N()),pickAt:(s,o)=>r.pickAt(s,o),dispose:()=>r.dispose()}]}class U{constructor(t){I(this,"field");this.field=new se(t)}uploadScene(t){const n=t.nodes.map(r=>{var s;return{id:r.source.id,score:r.activation??.5,hue:ne.caution,energy:r.activation,metric2:r.trust,scar:(((s=r.tags)==null?void 0:s.length)??0)>1,kind:"memory-pr",payload:r}});this.field.setCells(ie(n,{maxRadius:.9,minCellR:.035,maxCellR:.09}))}compute(t){this.field.compute(t)}render(t){this.field.render(t)}pickAt(t,n){return this.field.pickAt(t,n)}dispose(){this.field.dispose()}}async function W(e){var r;if(e.kind!=="memory-pr")return;const t=e.payload,n=t.prId??((r=t.source)==null?void 0:r.id);if(n)try{const s=await T.memoryPrs.act(n,"ask_agent_why");a(d,s.why??[],!0)}catch(s){a(y,s instanceof Error?s.message:"UNKNOWN MEMORY PR ACTION ERROR",!0)}}X("c1wbiz",e=>{B(()=>{G.title="Memory PRs · Vestige"})});{let e=O(()=>`memory-pr-field:${i(l).length}:${i(d).length}`);Z(m,{organ:"memory-prs",get seed(){return i(e)},get scene(){return i(L)},passes:D,get loading(){return i(R)},get error(){return i(y)},emptyLabel:"NO MEMORY PRS",onpick:W})}V(),_()}export{Re as component};

View file

@ -1 +0,0 @@
var Y=Object.defineProperty;var z=(m,c,u)=>c in m?Y(m,c,{enumerable:!0,configurable:!0,writable:!0,value:u}):m[c]=u;var I=(m,c,u)=>z(m,typeof c!="symbol"?c+"":c,u);import"../chunks/Bzak7iHL.js";import{o as j}from"../chunks/DAau0uzT.js";import{p as H,d as g,e as b,j as K,b as V,s as a,h as B,g as i,u as O,$ as G}from"../chunks/CGq8RnJq.js";import{h as X}from"../chunks/De_e6MzK.js";import{a as q,s as J}from"../chunks/DV6OI5iy.js";import{a as T}from"../chunks/D35IQVqe.js";import{m as Q}from"../chunks/Ch9vNiEl.js";import{R as Z}from"../chunks/Cqe0su6e.js";import{r as P,I as ee,R as te}from"../chunks/BMB5u1EX.js";import{T as re}from"../chunks/D7ozXiSB.js";import{L as se,F as ne,l as ie}from"../chunks/BeGBxCGK.js";function Re(m,c){H(c,!0);const u=()=>q(Q,"$memoryPrEvents",k),[k,_]=J(),v=[...P("#22C7DE"),1],F=[...P(ee.caution),.9],S=[...P(te.recall),.62],f=28,A=100,$=-1e5;let l=g(b([])),d=g(b([])),R=g(!0),h=g(null);j(()=>{x()});async function x(){a(R,!0),a(h,null);try{const e=await T.memoryPrs.list(void 0,A);a(l,e.prs,!0),a(d,[],!0)}catch(e){a(l,[],!0),a(d,[],!0),a(h,e instanceof Error?e.message:"UNKNOWN MEMORY PR FETCH ERROR",!0)}finally{a(R,!1)}}K(()=>{u().length&&x()});function y(e){return e.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function C(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:.5))}function M(e,t){if(typeof e=="number"&&Number.isFinite(e))return e;if(!e||typeof e!="object")return null;const s=e;for(const r of t){const n=s[r];if(typeof n=="number"&&Number.isFinite(n))return n}for(const r of Object.values(s)){const n=M(r,t);if(n!==null)return n}return null}function E(e){const t=M(e.diff,["confidence","trust","contradictsTrust","contradicts_trust"]);return t!==null?C(t>1?t/100:t):.5}function w(e){return y(`${e.title} | ${e.id.slice(0,8)} | ${e.status}`).replace(/\s+/g," ").trim().slice(0,96)}function N(){const e=i(l).slice(0,f),t=.74,s=1.46/Math.max(1,f-1),r=e.map((o,p)=>({id:`memory-pr:${o.id}`,kind:"memory-pr",prId:o.id,text:w(o),x:-.9,y:t-p*s,size:.025,color:o.status==="pending"?v:S,depth:E(o),weight:1,startFrame:$+p*2,revealSpan:20,maxWidthEm:54,hitPadX:.03,hitPadY:.019})),n=i(d).slice(0,5).map((o,p)=>({id:`memory-pr-why:${o.code}:${p}`,kind:"memory-pr-why",text:y(`${o.code}: ${o.detail}`).replace(/\s+/g," ").trim().slice(0,86),x:-.82,y:-.76-p*.052,size:.02,color:F,depth:.72,weight:.8,startFrame:$+(e.length+p)*2,revealSpan:18,maxWidthEm:56}));return[...r,...n]}let L=O(()=>({organ:"memory-prs",nodes:i(l).slice(0,f).map((e,t)=>({source:{kind:"pr",id:e.id},index:t,label:w(e),retention:1,activation:E(e),trust:E(e),tags:e.signals.map(s=>y(s.code)),type:y(e.kind)})),edges:[],events:[],receipts:[],scalars:{visiblePrs:Math.min(i(l).length,f),whySignals:i(d).length},alive:i(l).length>0}));function D(e,t){const s=new U(e);s.uploadScene(t);const r=new re(e);return r.init().then(()=>r.setText(N())),[s,{render:n=>r.render(n),uploadScene:()=>r.setText(N()),pickAt:(n,o)=>r.pickAt(n,o),dispose:()=>r.dispose()}]}class U{constructor(t){I(this,"field");this.field=new se(t)}uploadScene(t){const s=t.nodes.map(r=>{var n;return{id:r.source.id,score:r.activation??.5,hue:ne.caution,energy:r.activation,metric2:r.trust,scar:(((n=r.tags)==null?void 0:n.length)??0)>1,kind:"memory-pr",payload:r}});this.field.setCells(ie(s,{maxRadius:.9,minCellR:.035,maxCellR:.09}))}compute(t){this.field.compute(t)}render(t){this.field.render(t)}pickAt(t,s){return this.field.pickAt(t,s)}dispose(){this.field.dispose()}}async function W(e){if(e.kind!=="memory-pr")return;const t=e.payload;if(t.prId)try{const s=await T.memoryPrs.act(t.prId,"ask_agent_why");a(d,s.why??[],!0)}catch(s){a(h,s instanceof Error?s.message:"UNKNOWN MEMORY PR ACTION ERROR",!0)}}X("c1wbiz",e=>{B(()=>{G.title="Memory PRs · Vestige"})});{let e=O(()=>`memory-pr-field:${i(l).length}:${i(d).length}`);Z(m,{organ:"memory-prs",get seed(){return i(e)},get scene(){return i(L)},passes:D,get loading(){return i(R)},get error(){return i(h)},emptyLabel:"NO MEMORY PRS",onpick:W})}V(),_()}export{Re as component};

Some files were not shown because too many files have changed in this diff Show more