signetai 0.123.21 → 0.123.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashboard/_app/immutable/chunks/{BlBUVACt.js → BGYAKIR0.js} +1 -1
- package/dashboard/_app/immutable/chunks/{DszbTkHW.js → BIwmRVDy.js} +2 -2
- package/dashboard/_app/immutable/chunks/{Bgfo4PtB.js → BUA1YtJe.js} +1 -1
- package/dashboard/_app/immutable/chunks/{Dygqj6Gg.js → BUzi7bjf.js} +1 -1
- package/dashboard/_app/immutable/chunks/{C5Pq1exV.js → BWiYF5o8.js} +1 -1
- package/dashboard/_app/immutable/chunks/{aWb058QO.js → Be-9F94Y.js} +1 -1
- package/dashboard/_app/immutable/chunks/{BKxe5Fww.js → Bhw36AiA.js} +1 -1
- package/dashboard/_app/immutable/chunks/{CWhRn94r.js → BquBtb3J.js} +2 -2
- package/dashboard/_app/immutable/chunks/{C-cLVFup.js → BuPML_Zh.js} +1 -1
- package/dashboard/_app/immutable/chunks/{CjrYc5cW.js → By5ioWwL.js} +1 -1
- package/dashboard/_app/immutable/chunks/{B-D_9HMx.js → CBc96c8a.js} +1 -1
- package/dashboard/_app/immutable/chunks/{eAsdYlua.js → CHYMOq8T.js} +1 -1
- package/dashboard/_app/immutable/chunks/{D62PL36K.js → CHlKOtDl.js} +1 -1
- package/dashboard/_app/immutable/chunks/{D_RoD3Fm.js → COR-ijTm.js} +1 -1
- package/dashboard/_app/immutable/chunks/{uGXfJGab.js → CP2U8F92.js} +1 -1
- package/dashboard/_app/immutable/chunks/{BzdFkako.js → CRxCYA-E.js} +1 -1
- package/dashboard/_app/immutable/chunks/{Tz5fiP_o.js → CYn73A_n.js} +1 -1
- package/dashboard/_app/immutable/chunks/{FHuchG3W.js → CbIbIsRt.js} +1 -1
- package/dashboard/_app/immutable/chunks/{zFKNT3R6.js → CeRwBNwS.js} +1 -1
- package/dashboard/_app/immutable/chunks/{Bef81AyL.js → ClU22icG.js} +1 -1
- package/dashboard/_app/immutable/chunks/{Cdklx1Ch.js → D8Qbdk8r.js} +1 -1
- package/dashboard/_app/immutable/chunks/{Cn4cwJ3x.js → D99FUh65.js} +1 -1
- package/dashboard/_app/immutable/chunks/{Bdyz-KHw.js → D9LU5nDF.js} +1 -1
- package/dashboard/_app/immutable/chunks/{DDK7sFBB.js → DDpB_Fmk.js} +1 -1
- package/dashboard/_app/immutable/chunks/{DJPR10ya.js → DK1iMpYR.js} +1 -1
- package/dashboard/_app/immutable/chunks/{S-KoXhHO.js → DPPwHjfF.js} +1 -1
- package/dashboard/_app/immutable/chunks/{B5VWmXrR.js → DSXxpXE5.js} +1 -1
- package/dashboard/_app/immutable/chunks/{CJhL7V_f.js → DUb_0Klf.js} +1 -1
- package/dashboard/_app/immutable/chunks/{BTHd4mw-.js → DZLbzyg5.js} +1 -1
- package/dashboard/_app/immutable/chunks/{CFILfxTj.js → Dcu_bAFz.js} +1 -1
- package/dashboard/_app/immutable/chunks/{rKstBHh_.js → De2fGr_7.js} +1 -1
- package/dashboard/_app/immutable/chunks/{CwECCOMK.js → DgLAhGLu.js} +1 -1
- package/dashboard/_app/immutable/chunks/{B2BgQFYa.js → Di__debW.js} +1 -1
- package/dashboard/_app/immutable/chunks/{Bjw4kw6i.js → Dug4ha_m.js} +1 -1
- package/dashboard/_app/immutable/chunks/{BQJKZvek.js → DumN1mSN.js} +1 -1
- package/dashboard/_app/immutable/chunks/{BkUGRIrN.js → DyneFDnl.js} +1 -1
- package/dashboard/_app/immutable/chunks/{CZiwzK6m.js → E1RL9TdD.js} +1 -1
- package/dashboard/_app/immutable/chunks/{DxJs7UOj.js → JaJ5Vuyt.js} +1 -1
- package/dashboard/_app/immutable/chunks/{B8tCxE29.js → MEW85V0A.js} +1 -1
- package/dashboard/_app/immutable/chunks/{DACH9bIh.js → OF_F4iB6.js} +1 -1
- package/dashboard/_app/immutable/chunks/{DkqyZpFf.js → VPSFHWHC.js} +1 -1
- package/dashboard/_app/immutable/chunks/{_t89H4mS.js → WVVjJNXJ.js} +1 -1
- package/dashboard/_app/immutable/chunks/{BFvR7qa3.js → Xh1zEpvg.js} +1 -1
- package/dashboard/_app/immutable/chunks/{DVCA-NXi.js → dB1bXdxI.js} +1 -1
- package/dashboard/_app/immutable/chunks/{B_a67mN5.js → g8YkOMe4.js} +1 -1
- package/dashboard/_app/immutable/chunks/{CC3kAyYu.js → gnUY2iVt.js} +1 -1
- package/dashboard/_app/immutable/chunks/{CHxfhkfa.js → wGLFQbYw.js} +3 -3
- package/dashboard/_app/immutable/chunks/{BPAFOnTI.js → wjJIHI18.js} +1 -1
- package/dashboard/_app/immutable/entry/{app.DeEt8OuH.js → app.D9HtY-sa.js} +2 -2
- package/dashboard/_app/immutable/entry/start.DRrqvaWm.js +1 -0
- package/dashboard/_app/immutable/nodes/{1.CECXH9gf.js → 1.DpvhUCOL.js} +1 -1
- package/dashboard/_app/immutable/nodes/2.Cayme9dB.js +1 -0
- package/dashboard/_app/version.json +1 -1
- package/dashboard/index.html +6 -6
- package/dist/cli.js +41 -41
- package/package.json +1 -1
- package/dashboard/_app/immutable/entry/start.B9yPrSUa.js +0 -1
- package/dashboard/_app/immutable/nodes/2.CD8l9dg7.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as ce,g as ke,t as o,j as s,l as t,w as ge,A as de,y as B,z as k,i as e,O as _e,b as c,J as we,d as ue,u as h,m as _,o as O,e as oe,q as he,v as y,k as ne,c as Ne,f as me,W as Ve,I as Ye,M as ve,N as Ae,s as Ie,a as Ce,n as Oe,r as Me,D as je,B as Se,a9 as Ke}from"./C0do9GyP.js";import{aO as Xe,aP as Je,aQ as Qe,t as qe,I as De,T as Ze,a as Re,aR as $e,n as et,aS as tt,H as Pe,aT as at,aU as st,az as nt}from"./CHxfhkfa.js";import{F as rt}from"./S-KoXhHO.js";function Le(S){return S.trim()||"default"}function lt(S,n,l){const d=new URLSearchParams({agent_id:Le(l),include_self:"true",limit:String(n)});return`${S}/api/cross-agent/presence?${d.toString()}`}function Ue(S,n){const l=Le(n);return S.filter(d=>d.agentId===l)}function it(S,n){const l=Ue(S,n).filter(d=>!Number.isNaN(new Date(d.lastSeenAt).getTime()));return l.length===0?null:[...l].sort((d,u)=>new Date(u.lastSeenAt).getTime()-new Date(d.lastSeenAt).getTime())[0]??null}async function ot(S,n,l){try{const d=await fetch(lt(S,n,l));if(!d.ok)return[];const u=await d.json();return Ue(u.sessions??[],l)}catch{return[]}}var vt=_('<div class="data-row svelte-1j3peig"><span class="data-idx svelte-1j3peig"> </span> <span class="data-label svelte-1j3peig"> </span> <span class="data-fill svelte-1j3peig"></span> <span class="data-value svelte-1j3peig"> </span></div>'),dt=_('<div class="data-row svelte-1j3peig"><span class="data-idx svelte-1j3peig"> </span> <span class="data-label svelte-1j3peig"> </span> <span class="data-fill svelte-1j3peig"></span> <span class="data-value svelte-1j3peig"> </span></div>'),ct=_('<div class="readout sig-panel svelte-1j3peig"><div class="readout-texture svelte-1j3peig" aria-hidden="true"></div> <div class="readout-content svelte-1j3peig"><div class="readout-eyebrow svelte-1j3peig"><span class="eyebrow-left svelte-1j3peig">SIGNET AGENT READOUT</span> <span class="eyebrow-right svelte-1j3peig"> </span></div> <div class="readout-hero svelte-1j3peig"><h1 class="agent-name svelte-1j3peig"> </h1> <div class="hero-stat svelte-1j3peig"><span class="hero-number svelte-1j3peig"> </span> <span class="hero-unit svelte-1j3peig">MEMORIES<br/>STORED</span></div></div> <div class="readout-divider sig-groove svelte-1j3peig" aria-hidden="true"></div> <div class="readout-grid svelte-1j3peig"><div class="readout-col svelte-1j3peig"></div> <div class="readout-col svelte-1j3peig"></div></div></div></div>');function ut(S,n){ce(n,!0);const l=ke(n,"diagnostics",3,null),d=ke(n,"pipelineStatus",3,null),u=ke(n,"memoryStats",3,null),A=h(()=>{const m=n.daemonStatus?.agentCreatedAt;if(!m)return null;const b=new Date(m).getTime();return Number.isNaN(b)?null:Math.max(0,Math.floor((Date.now()-b)/864e5))}),x=h(()=>e(A)===null?"--":e(A)===0?"TODAY":e(A)===1?"1 DAY":`${e(A)} DAYS`),I=h(()=>n.daemonStatus?.activeSessions??0),D=h(()=>n.daemonStatus?.version??"--"),R=h(()=>it(n.presence,n.agentId)),M=h(()=>{if(n.continuity.length===0)return null;const m=n.continuity.filter(g=>!Number.isNaN(new Date(g.created_at).getTime()));return m.length===0?null:[...m].sort((g,w)=>new Date(w.created_at).getTime()-new Date(g.created_at).getTime())[0]});function W(m){const b=Date.now()-new Date(m).getTime(),g=Math.floor(b/6e4);if(g<1)return"JUST NOW";if(g<60)return`${g}M AGO`;const w=Math.floor(g/60);return w<24?`${w}H AGO`:`${Math.floor(w/24)}D AGO`}const V=h(()=>e(R)?.project??e(M)?.project??null),Y=h(()=>e(R)?.lastSeenAt??e(M)?.created_at??null),K=h(()=>e(V)?.replace(/\/$/,"").split("/").pop()??"--"),re=h(()=>e(Y)?W(e(Y)):"--"),X=h(()=>n.identity.name?.trim()||"SIGNET AGENT"),H=h(()=>l()?.composite?.score??null),a=h(()=>l()?.composite?.status??"UNKNOWN"),i=h(()=>l()?.index?.embeddingCoverage!==void 0?Math.round(l().index.embeddingCoverage*100):!u()||u().total===0?null:Math.round(u().withEmbeddings/u().total*100)),p=h(()=>d()?typeof d().mode=="string"?d().mode.toUpperCase():"ACTIVE":"UNKNOWN"),C=h(()=>{if(!l())return 0;let m=0;const b=["queue","storage","index","provider","connector","predictor"];for(const g of b){const w=l()[g];if(w&&typeof w=="object"&&"status"in w){const te=w.status;(te==="degraded"||te==="unhealthy")&&m++}}return m});function f(m){return m===null?"var(--sig-text-muted)":m>=.8?"var(--sig-success)":m>=.5?"var(--sig-warning)":"var(--sig-danger)"}const J=h(()=>[{idx:"01",label:"UPTIME",value:e(x)},{idx:"02",label:"PROJECT",value:e(K)},{idx:"03",label:"LAST SEEN",value:e(re)},{idx:"04",label:"CONNECTORS",value:String(n.connectorCount)},{idx:"05",label:"SESSIONS",value:String(e(I))}]),Q=h(()=>[{idx:"06",label:"HEALTH",value:e(H)!==null?`${e(H).toFixed(2)} ${e(a).toUpperCase()}`:"--",color:f(e(H))},{idx:"07",label:"EMBEDDED",value:e(i)!==null?`${e(i)}%`:"--"},{idx:"08",label:"PIPELINE",value:e(p)},{idx:"09",label:"WARNINGS",value:String(e(C)),color:e(C)>0?"var(--sig-danger)":void 0}]);var r=ct(),E=o(s(r),2),v=s(E),P=o(s(v),2),ie=s(P);t(P),t(v);var Z=o(v,2),L=s(Z),N=s(L,!0);t(L);var T=o(L,2),z=s(T),$=s(z,!0);t(z),ge(2),t(T),t(Z);var ee=o(Z,4),U=s(ee);de(U,21,()=>e(J),we,(m,b)=>{var g=vt(),w=s(g),te=s(w,!0);t(w);var G=o(w,2),pe=s(G,!0);t(G);var le=o(G,4),j=s(le,!0);t(le),t(g),B(()=>{k(te,e(b).idx),k(pe,e(b).label),_e(le,e(b).color?`color: ${e(b).color}`:""),k(j,e(b).value)}),c(m,g)}),t(U);var F=o(U,2);de(F,21,()=>e(Q),we,(m,b)=>{var g=dt(),w=s(g),te=s(w,!0);t(w);var G=o(w,2),pe=s(G,!0);t(G);var le=o(G,4),j=s(le,!0);t(le),t(g),B(()=>{k(te,e(b).idx),k(pe,e(b).label),_e(le,e(b).color?`color: ${e(b).color}`:""),k(j,e(b).value)}),c(m,g)}),t(F),t(ee),t(E),t(r),B(m=>{k(ie,`v${e(D)??""}`),k(N,e(X)),k($,m)},[()=>n.memoryCount.toLocaleString()]),c(S,r),ue()}var pt=_('<span class="panel-date svelte-1psqkvg"> </span>'),gt=_('<div class="loading-state svelte-1psqkvg"><span class="loading-line svelte-1psqkvg"></span> <span class="loading-line short svelte-1psqkvg"></span> <span class="loading-line svelte-1psqkvg"></span></div>'),ft=_('<div class="empty-state svelte-1psqkvg"><span class="svelte-1psqkvg">No brief yet</span> <span class="empty-hint svelte-1psqkvg">No fresh memory signal found</span></div>'),mt=_('<span class="pattern-tag svelte-1psqkvg"> </span>'),_t=_('<div class="patterns svelte-1psqkvg"></div>'),ht=_('<textarea class="answer-input svelte-1psqkvg" placeholder="Type your reflection..." rows="2"></textarea> <div class="answer-actions svelte-1psqkvg"><button class="answer-submit svelte-1psqkvg"> </button> <button class="answer-cancel svelte-1psqkvg">Cancel</button></div>',1),xt=_('<button class="answer-prompt svelte-1psqkvg">Answer</button>'),yt=_('<div class="question-block svelte-1psqkvg"><!></div>'),bt=_('<div class="answered-block svelte-1psqkvg"><span class="answered-label svelte-1psqkvg">YOUR ANSWER</span> <p class="answered-text svelte-1psqkvg"> </p></div>'),kt=_('<section class="reflection-item svelte-1psqkvg"><p class="reflection-summary svelte-1psqkvg"> </p> <!> <!> <!></section>'),St=_('<div class="panel sig-panel svelte-1psqkvg"><div class="panel-header sig-panel-header svelte-1psqkvg"><span class="panel-title svelte-1psqkvg">DAILY BRIEF</span> <!></div> <div class="panel-body svelte-1psqkvg"><!></div></div>');function wt(S,n){ce(n,!0);let l=O(oe([])),d=O(!0),u=O(""),A=O(null),x=O(null);const I=h(()=>e(l)[0]??null);he(async()=>{y(d,!0);const a=await Xe(n.agentId,3);let i=a.reflections??(a.reflection?[a.reflection]:[]);if(i.length===0){const p=await Je(n.agentId);i=p.reflections??(p.reflection?[p.reflection]:[])}y(l,i,!0),y(d,!1)});async function D(a){if(!e(u).trim())return;y(A,a.id,!0);const i=await Qe(a.id,e(u),n.agentId);y(A,null),i.success?(y(l,e(l).map(p=>p.id===a.id?{...p,answer:e(u),answerMemoryId:i.memoryId??null}:p),!0),y(u,""),y(x,null),qe("Answer saved as memory","success")):qe(i.error??"Failed to save answer","error")}var R=St(),M=s(R),W=o(s(M),2);{var V=a=>{var i=pt(),p=s(i,!0);t(i),B(()=>k(p,e(I).date)),c(a,i)};ne(W,a=>{e(I)&&a(V)})}t(M);var Y=o(M,2),K=s(Y);{var re=a=>{var i=gt();c(a,i)},X=a=>{var i=ft();c(a,i)},H=a=>{var i=Ne(),p=me(i);de(p,17,()=>e(l),C=>C.id,(C,f)=>{var J=kt(),Q=s(J),r=s(Q,!0);t(Q);var E=o(Q,2);{var v=N=>{var T=_t();de(T,21,()=>e(f).patterns,we,(z,$)=>{var ee=mt(),U=s(ee,!0);t(ee),B(()=>k(U,e($))),c(z,ee)}),t(T),c(N,T)};ne(E,N=>{e(f).patterns.length>0&&N(v)})}var P=o(E,2);{var ie=N=>{var T=yt(),z=s(T);{var $=U=>{var F=ht(),m=me(F);Ve(m);var b=o(m,2),g=s(b),w=s(g,!0);t(g);var te=o(g,2);t(b),B(G=>{g.disabled=G,k(w,e(A)===e(f).id?"Saving...":"Save")},[()=>!e(u).trim()||e(A)===e(f).id]),Ye(m,()=>e(u),G=>y(u,G)),ve("click",g,()=>D(e(f))),ve("click",te,()=>y(x,null)),c(U,F)},ee=U=>{var F=xt();ve("click",F,()=>{y(u,""),y(x,e(f).id,!0)}),c(U,F)};ne(z,U=>{e(x)===e(f).id?U($):U(ee,-1)})}t(T),c(N,T)};ne(P,N=>{e(f).question&&!e(f).answer&&N(ie)})}var Z=o(P,2);{var L=N=>{var T=bt(),z=o(s(T),2),$=s(z,!0);t(z),t(T),B(()=>k($,e(f).answer)),c(N,T)};ne(Z,N=>{e(f).answer&&N(L)})}t(J),B(()=>k(r,e(f).summary)),c(C,J)}),c(a,i)};ne(K,a=>{e(d)?a(re):e(l).length===0?a(X,1):a(H,-1)})}t(Y),t(R),c(S,R),ue()}Ae(["click"]);function Nt(S,n){ce(n,!0);let l=Me(n,["$$slots","$$events","$$legacy"]);const d=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M10 9H8"}],["path",{d:"M16 13H8"}],["path",{d:"M16 17H8"}]];De(S,Ie({name:"file-text"},()=>l,{get iconNode(){return d},children:(u,A)=>{var x=Ne(),I=me(x);Ce(I,()=>n.children??Oe),c(u,x)},$$slots:{default:!0}})),ue()}var At=_('<div class="empty-state svelte-18r587h">SCANNING SOURCE MANIFEST...</div>'),Et=Ke('<line x1="50" y1="50"></line>'),Tt=_('<div class="kb-solo-note svelte-18r587h"><span class="svelte-18r587h">NO EXTERNAL SOURCES CONNECTED</span> <small class="svelte-18r587h">Connect Obsidian or documents to extend recall provenance.</small></div>'),jt=_('<img src="/logo-dark.png" alt="" class="kb-signet-logo svelte-18r587h" aria-hidden="true"/>'),qt=_('<button type="button"><span class="kb-node-icon svelte-18r587h"><!></span> <span class="kb-node-copy svelte-18r587h"><strong class="svelte-18r587h"> </strong> <small class="svelte-18r587h"> </small></span></button>'),It=_('<div><div class="kb-origin-ring svelte-18r587h" aria-hidden="true"></div> <button type="button" class="kb-core svelte-18r587h"><span class="kb-core-mark svelte-18r587h"><img src="/logo-dark.png" alt="" class="kb-signet-logo svelte-18r587h" aria-hidden="true"/></span> <span class="kb-core-copy svelte-18r587h"><strong class="svelte-18r587h">Signet Memory</strong> <small class="svelte-18r587h">native identity graph · always on</small></span></button> <svg class="kb-links svelte-18r587h" viewBox="0 0 100 100" preserveAspectRatio="none" aria-hidden="true"></svg> <!> <!></div> <div class="kb-footer svelte-18r587h"><div class="kb-stat svelte-18r587h"><span class="svelte-18r587h"> </span> <small class="svelte-18r587h">ACTIVE</small></div> <div class="kb-stat svelte-18r587h"><span class="svelte-18r587h"> </span> <small class="svelte-18r587h">EXTERNAL</small></div> <div class="kb-stat svelte-18r587h"><span class="svelte-18r587h"> </span> <small class="svelte-18r587h">CONNECTORS</small></div> <div class="kb-last svelte-18r587h"><span class="svelte-18r587h">LAST EXTERNAL INDEX</span> <small class="svelte-18r587h"> </small></div></div>',1),Ct=_('<div class="kb-panel sig-panel svelte-18r587h"><div class="kb-header sig-panel-header svelte-18r587h"><div><span class="kb-title svelte-18r587h">CONNECTED KNOWLEDGE BASES</span> <span class="kb-subtitle svelte-18r587h">PROVENANCE GRAPH / LIVE SOURCES</span></div> <button type="button" class="kb-open svelte-18r587h"><!> <span>MANAGE</span></button></div> <!></div>');function Ot(S,n){ce(n,!0);const l=[{x:18,y:72},{x:73,y:24},{x:80,y:72},{x:22,y:24},{x:88,y:48}];let d=O(!1),u=O(oe([])),A=O(oe([]));he(async()=>{const r=await Promise.allSettled([Ze(),Re()]);r[0].status==="fulfilled"&&y(u,r[0].value,!0),r[1].status==="fulfilled"&&y(A,r[1].value,!0),y(d,!0)});const x=h(()=>{const r=e(u).map((v,P)=>({id:`source:${v.id}`,name:v.name||Y(v.root),kind:"source",provider:v.kind,detail:v.root,status:v.enabled?v.lastIndexedAt||(v.stats?.indexed??0)>0?"online":"syncing":"offline",updatedAt:v.lastIndexedAt??v.updatedAt??null,...l[P%l.length]})),E=e(A).map((v,P)=>({id:`connector:${v.id}`,name:v.display_name||v.provider,kind:"connector",provider:v.provider,detail:v.last_error??`${v.provider} document connector`,status:V(v),updatedAt:v.last_sync_at??v.updated_at??null,...l[(r.length+P)%l.length]}));return[...r,...E].slice(0,l.length)}),I=h(()=>1+e(x).filter(r=>r.status==="online").length),D=h(()=>1+e(x).length),R=h(()=>e(u).length),M=h(()=>e(A).length),W=h(()=>e(R)+e(M));function V(r){return r.last_error?"warning":r.status==="syncing"?"syncing":r.status==="connected"||r.status==="active"||r.status==="ok"||r.status?"online":"offline"}function Y(r){return r.split(/[\\/]/).filter(Boolean).at(-1)??"Knowledge base"}function K(r,E){return E?.kind==="memory"?"always on":r==="online"?"indexed":r==="syncing"?"syncing":r==="warning"?"attention":"offline"}function re(r){return r.kind==="memory"?"Signet":r.kind==="source"&&r.provider==="obsidian"?"Obsidian":r.provider.replace(/[-_]/g," ")}function X(r){if(!r)return"not indexed yet";const E=new Date(r);return Number.isNaN(E.getTime())?"unknown":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(E)}function H(){et.activeTab="sources"}var a=Ct(),i=s(a),p=o(s(i),2),C=s(p);$e(C,{class:"size-3"}),ge(2),t(p),t(i);var f=o(i,2);{var J=r=>{var E=At();c(r,E)},Q=r=>{var E=It(),v=me(E);let P;var ie=o(s(v),2),Z=o(ie,2);de(Z,21,()=>e(x),j=>j.id,(j,q)=>{var ae=Et();let fe;B(()=>{je(ae,"x2",e(q).x),je(ae,"y2",e(q).y),fe=Se(ae,0,"svelte-18r587h",null,fe,{"link-muted":e(q).status!=="online"})}),c(j,ae)}),t(Z);var L=o(Z,2);{var N=j=>{var q=Tt();c(j,q)};ne(L,j=>{e(x).length===0&&j(N)})}var T=o(L,2);de(T,17,()=>e(x),j=>j.id,(j,q)=>{var ae=qt();let fe;var xe=s(ae),Ge=s(xe);{var Be=se=>{var be=jt();c(se,be)},He=se=>{rt(se,{class:"size-3.5"})},ze=se=>{Nt(se,{class:"size-3.5"})};ne(Ge,se=>{e(q).kind==="memory"?se(Be):e(q).kind==="source"?se(He,1):se(ze,-1)})}t(xe);var Ee=o(xe,2),ye=s(Ee),Fe=s(ye,!0);t(ye);var Te=o(ye,2),We=s(Te);t(Te),t(Ee),t(ae),B((se,be)=>{fe=Se(ae,1,"kb-node svelte-18r587h",null,fe,{"kb-node--memory":e(q).kind==="memory","kb-node--source":e(q).kind==="source","kb-node--warning":e(q).status==="warning","kb-node--offline":e(q).status==="offline"}),_e(ae,`left: ${e(q).x??""}%; top: ${e(q).y??""}%;`),k(Fe,e(q).name),k(We,`${se??""} · ${be??""}`)},[()=>re(e(q)),()=>K(e(q).status,e(q))]),ve("click",ae,H),c(j,ae)}),t(v);var z=o(v,2),$=s(z),ee=s($),U=s(ee);t(ee),ge(2),t($);var F=o($,2),m=s(F),b=s(m,!0);t(m),ge(2),t(F);var g=o(F,2),w=s(g),te=s(w,!0);t(w),ge(2),t(g);var G=o(g,2),pe=o(s(G),2),le=s(pe,!0);t(pe),t(G),t(z),B(j=>{P=Se(v,1,"kb-visual svelte-18r587h",null,P,{"kb-visual--solo":e(x).length===0}),k(U,`${e(I)??""}/${e(D)??""}`),k(b,e(W)),k(te,e(M)),k(le,j)},[()=>X(e(x).find(j=>j.updatedAt)?.updatedAt??null)]),ve("click",ie,H),c(r,E)};ne(f,r=>{!e(d)&&e(D)===0?r(J):r(Q,-1)})}t(a),ve("click",p,H),c(S,a),ue()}Ae(["click"]);function Mt(S,n){ce(n,!0);let l=Me(n,["$$slots","$$events","$$legacy"]);const d=[["path",{d:"M12 18V5"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77"}]];De(S,Ie({name:"brain"},()=>l,{get iconNode(){return d},children:(u,A)=>{var x=Ne(),I=me(x);Ce(I,()=>n.children??Oe),c(u,x)},$$slots:{default:!0}})),ue()}var Dt=_('<div class="empty-state svelte-1qexx7n">LOADING</div>'),Rt=_('<div class="empty-state svelte-1qexx7n"><!> <span>NO MEMORIES YET</span></div>'),Pt=_('<span class="entity-count svelte-1qexx7n" title="times recalled"> </span>'),Lt=_('<div class="entity-row svelte-1qexx7n"><span class="entity-idx svelte-1qexx7n"> </span> <span class="entity-dot svelte-1qexx7n"></span> <span class="entity-name svelte-1qexx7n"> </span> <!></div>'),Ut=_('<div class="entity-list svelte-1qexx7n"></div>'),Gt=_('<div class="panel sig-panel svelte-1qexx7n"><div class="panel-header sig-panel-header svelte-1qexx7n"><span class="panel-title svelte-1qexx7n">SPOTLIGHT</span> <span class="panel-count svelte-1qexx7n"> </span></div> <div class="panel-body svelte-1qexx7n"><!></div> <div class="panel-footer sig-panel-footer svelte-1qexx7n"><button class="panel-link svelte-1qexx7n">VIEW IN MEMORY</button></div></div>');function Bt(S,n){ce(n,!0);let l=O(oe([])),d=O(!1);async function u(){try{const a=await fetch(`${Pe}/api/memories/most-used?limit=50`);if(a.ok){const C=((await a.json()).memories??[]).filter(f=>typeof f.id=="string"&&f.id.length>0&&typeof f.content=="string").map(f=>({id:f.id,content:f.content??"",access_count:f.access_count??0,importance:f.importance??.5}));if(C.length>0){y(l,C,!0),y(d,!0);return}}}catch{}y(l,n.memories.map(a=>({id:a.id,content:a.content,access_count:0,importance:a.importance??.5})).sort((a,i)=>i.importance-a.importance).slice(0,50),!0),y(d,!0)}he(()=>{u()});function A(a){const i=a.content.trim(),p=i.split(`
|
|
1
|
+
import{p as ce,g as ke,t as o,j as s,l as t,w as ge,A as de,y as B,z as k,i as e,O as _e,b as c,J as we,d as ue,u as h,m as _,o as O,e as oe,q as he,v as y,k as ne,c as Ne,f as me,W as Ve,I as Ye,M as ve,N as Ae,s as Ie,a as Ce,n as Oe,r as Me,D as je,B as Se,a9 as Ke}from"./C0do9GyP.js";import{aO as Xe,aP as Je,aQ as Qe,t as qe,I as De,T as Ze,a as Re,aR as $e,n as et,aS as tt,H as Pe,aT as at,aU as st,az as nt}from"./wGLFQbYw.js";import{F as rt}from"./DPPwHjfF.js";function Le(S){return S.trim()||"default"}function lt(S,n,l){const d=new URLSearchParams({agent_id:Le(l),include_self:"true",limit:String(n)});return`${S}/api/cross-agent/presence?${d.toString()}`}function Ue(S,n){const l=Le(n);return S.filter(d=>d.agentId===l)}function it(S,n){const l=Ue(S,n).filter(d=>!Number.isNaN(new Date(d.lastSeenAt).getTime()));return l.length===0?null:[...l].sort((d,u)=>new Date(u.lastSeenAt).getTime()-new Date(d.lastSeenAt).getTime())[0]??null}async function ot(S,n,l){try{const d=await fetch(lt(S,n,l));if(!d.ok)return[];const u=await d.json();return Ue(u.sessions??[],l)}catch{return[]}}var vt=_('<div class="data-row svelte-1j3peig"><span class="data-idx svelte-1j3peig"> </span> <span class="data-label svelte-1j3peig"> </span> <span class="data-fill svelte-1j3peig"></span> <span class="data-value svelte-1j3peig"> </span></div>'),dt=_('<div class="data-row svelte-1j3peig"><span class="data-idx svelte-1j3peig"> </span> <span class="data-label svelte-1j3peig"> </span> <span class="data-fill svelte-1j3peig"></span> <span class="data-value svelte-1j3peig"> </span></div>'),ct=_('<div class="readout sig-panel svelte-1j3peig"><div class="readout-texture svelte-1j3peig" aria-hidden="true"></div> <div class="readout-content svelte-1j3peig"><div class="readout-eyebrow svelte-1j3peig"><span class="eyebrow-left svelte-1j3peig">SIGNET AGENT READOUT</span> <span class="eyebrow-right svelte-1j3peig"> </span></div> <div class="readout-hero svelte-1j3peig"><h1 class="agent-name svelte-1j3peig"> </h1> <div class="hero-stat svelte-1j3peig"><span class="hero-number svelte-1j3peig"> </span> <span class="hero-unit svelte-1j3peig">MEMORIES<br/>STORED</span></div></div> <div class="readout-divider sig-groove svelte-1j3peig" aria-hidden="true"></div> <div class="readout-grid svelte-1j3peig"><div class="readout-col svelte-1j3peig"></div> <div class="readout-col svelte-1j3peig"></div></div></div></div>');function ut(S,n){ce(n,!0);const l=ke(n,"diagnostics",3,null),d=ke(n,"pipelineStatus",3,null),u=ke(n,"memoryStats",3,null),A=h(()=>{const m=n.daemonStatus?.agentCreatedAt;if(!m)return null;const b=new Date(m).getTime();return Number.isNaN(b)?null:Math.max(0,Math.floor((Date.now()-b)/864e5))}),x=h(()=>e(A)===null?"--":e(A)===0?"TODAY":e(A)===1?"1 DAY":`${e(A)} DAYS`),I=h(()=>n.daemonStatus?.activeSessions??0),D=h(()=>n.daemonStatus?.version??"--"),R=h(()=>it(n.presence,n.agentId)),M=h(()=>{if(n.continuity.length===0)return null;const m=n.continuity.filter(g=>!Number.isNaN(new Date(g.created_at).getTime()));return m.length===0?null:[...m].sort((g,w)=>new Date(w.created_at).getTime()-new Date(g.created_at).getTime())[0]});function W(m){const b=Date.now()-new Date(m).getTime(),g=Math.floor(b/6e4);if(g<1)return"JUST NOW";if(g<60)return`${g}M AGO`;const w=Math.floor(g/60);return w<24?`${w}H AGO`:`${Math.floor(w/24)}D AGO`}const V=h(()=>e(R)?.project??e(M)?.project??null),Y=h(()=>e(R)?.lastSeenAt??e(M)?.created_at??null),K=h(()=>e(V)?.replace(/\/$/,"").split("/").pop()??"--"),re=h(()=>e(Y)?W(e(Y)):"--"),X=h(()=>n.identity.name?.trim()||"SIGNET AGENT"),H=h(()=>l()?.composite?.score??null),a=h(()=>l()?.composite?.status??"UNKNOWN"),i=h(()=>l()?.index?.embeddingCoverage!==void 0?Math.round(l().index.embeddingCoverage*100):!u()||u().total===0?null:Math.round(u().withEmbeddings/u().total*100)),p=h(()=>d()?typeof d().mode=="string"?d().mode.toUpperCase():"ACTIVE":"UNKNOWN"),C=h(()=>{if(!l())return 0;let m=0;const b=["queue","storage","index","provider","connector","predictor"];for(const g of b){const w=l()[g];if(w&&typeof w=="object"&&"status"in w){const te=w.status;(te==="degraded"||te==="unhealthy")&&m++}}return m});function f(m){return m===null?"var(--sig-text-muted)":m>=.8?"var(--sig-success)":m>=.5?"var(--sig-warning)":"var(--sig-danger)"}const J=h(()=>[{idx:"01",label:"UPTIME",value:e(x)},{idx:"02",label:"PROJECT",value:e(K)},{idx:"03",label:"LAST SEEN",value:e(re)},{idx:"04",label:"CONNECTORS",value:String(n.connectorCount)},{idx:"05",label:"SESSIONS",value:String(e(I))}]),Q=h(()=>[{idx:"06",label:"HEALTH",value:e(H)!==null?`${e(H).toFixed(2)} ${e(a).toUpperCase()}`:"--",color:f(e(H))},{idx:"07",label:"EMBEDDED",value:e(i)!==null?`${e(i)}%`:"--"},{idx:"08",label:"PIPELINE",value:e(p)},{idx:"09",label:"WARNINGS",value:String(e(C)),color:e(C)>0?"var(--sig-danger)":void 0}]);var r=ct(),E=o(s(r),2),v=s(E),P=o(s(v),2),ie=s(P);t(P),t(v);var Z=o(v,2),L=s(Z),N=s(L,!0);t(L);var T=o(L,2),z=s(T),$=s(z,!0);t(z),ge(2),t(T),t(Z);var ee=o(Z,4),U=s(ee);de(U,21,()=>e(J),we,(m,b)=>{var g=vt(),w=s(g),te=s(w,!0);t(w);var G=o(w,2),pe=s(G,!0);t(G);var le=o(G,4),j=s(le,!0);t(le),t(g),B(()=>{k(te,e(b).idx),k(pe,e(b).label),_e(le,e(b).color?`color: ${e(b).color}`:""),k(j,e(b).value)}),c(m,g)}),t(U);var F=o(U,2);de(F,21,()=>e(Q),we,(m,b)=>{var g=dt(),w=s(g),te=s(w,!0);t(w);var G=o(w,2),pe=s(G,!0);t(G);var le=o(G,4),j=s(le,!0);t(le),t(g),B(()=>{k(te,e(b).idx),k(pe,e(b).label),_e(le,e(b).color?`color: ${e(b).color}`:""),k(j,e(b).value)}),c(m,g)}),t(F),t(ee),t(E),t(r),B(m=>{k(ie,`v${e(D)??""}`),k(N,e(X)),k($,m)},[()=>n.memoryCount.toLocaleString()]),c(S,r),ue()}var pt=_('<span class="panel-date svelte-1psqkvg"> </span>'),gt=_('<div class="loading-state svelte-1psqkvg"><span class="loading-line svelte-1psqkvg"></span> <span class="loading-line short svelte-1psqkvg"></span> <span class="loading-line svelte-1psqkvg"></span></div>'),ft=_('<div class="empty-state svelte-1psqkvg"><span class="svelte-1psqkvg">No brief yet</span> <span class="empty-hint svelte-1psqkvg">No fresh memory signal found</span></div>'),mt=_('<span class="pattern-tag svelte-1psqkvg"> </span>'),_t=_('<div class="patterns svelte-1psqkvg"></div>'),ht=_('<textarea class="answer-input svelte-1psqkvg" placeholder="Type your reflection..." rows="2"></textarea> <div class="answer-actions svelte-1psqkvg"><button class="answer-submit svelte-1psqkvg"> </button> <button class="answer-cancel svelte-1psqkvg">Cancel</button></div>',1),xt=_('<button class="answer-prompt svelte-1psqkvg">Answer</button>'),yt=_('<div class="question-block svelte-1psqkvg"><!></div>'),bt=_('<div class="answered-block svelte-1psqkvg"><span class="answered-label svelte-1psqkvg">YOUR ANSWER</span> <p class="answered-text svelte-1psqkvg"> </p></div>'),kt=_('<section class="reflection-item svelte-1psqkvg"><p class="reflection-summary svelte-1psqkvg"> </p> <!> <!> <!></section>'),St=_('<div class="panel sig-panel svelte-1psqkvg"><div class="panel-header sig-panel-header svelte-1psqkvg"><span class="panel-title svelte-1psqkvg">DAILY BRIEF</span> <!></div> <div class="panel-body svelte-1psqkvg"><!></div></div>');function wt(S,n){ce(n,!0);let l=O(oe([])),d=O(!0),u=O(""),A=O(null),x=O(null);const I=h(()=>e(l)[0]??null);he(async()=>{y(d,!0);const a=await Xe(n.agentId,3);let i=a.reflections??(a.reflection?[a.reflection]:[]);if(i.length===0){const p=await Je(n.agentId);i=p.reflections??(p.reflection?[p.reflection]:[])}y(l,i,!0),y(d,!1)});async function D(a){if(!e(u).trim())return;y(A,a.id,!0);const i=await Qe(a.id,e(u),n.agentId);y(A,null),i.success?(y(l,e(l).map(p=>p.id===a.id?{...p,answer:e(u),answerMemoryId:i.memoryId??null}:p),!0),y(u,""),y(x,null),qe("Answer saved as memory","success")):qe(i.error??"Failed to save answer","error")}var R=St(),M=s(R),W=o(s(M),2);{var V=a=>{var i=pt(),p=s(i,!0);t(i),B(()=>k(p,e(I).date)),c(a,i)};ne(W,a=>{e(I)&&a(V)})}t(M);var Y=o(M,2),K=s(Y);{var re=a=>{var i=gt();c(a,i)},X=a=>{var i=ft();c(a,i)},H=a=>{var i=Ne(),p=me(i);de(p,17,()=>e(l),C=>C.id,(C,f)=>{var J=kt(),Q=s(J),r=s(Q,!0);t(Q);var E=o(Q,2);{var v=N=>{var T=_t();de(T,21,()=>e(f).patterns,we,(z,$)=>{var ee=mt(),U=s(ee,!0);t(ee),B(()=>k(U,e($))),c(z,ee)}),t(T),c(N,T)};ne(E,N=>{e(f).patterns.length>0&&N(v)})}var P=o(E,2);{var ie=N=>{var T=yt(),z=s(T);{var $=U=>{var F=ht(),m=me(F);Ve(m);var b=o(m,2),g=s(b),w=s(g,!0);t(g);var te=o(g,2);t(b),B(G=>{g.disabled=G,k(w,e(A)===e(f).id?"Saving...":"Save")},[()=>!e(u).trim()||e(A)===e(f).id]),Ye(m,()=>e(u),G=>y(u,G)),ve("click",g,()=>D(e(f))),ve("click",te,()=>y(x,null)),c(U,F)},ee=U=>{var F=xt();ve("click",F,()=>{y(u,""),y(x,e(f).id,!0)}),c(U,F)};ne(z,U=>{e(x)===e(f).id?U($):U(ee,-1)})}t(T),c(N,T)};ne(P,N=>{e(f).question&&!e(f).answer&&N(ie)})}var Z=o(P,2);{var L=N=>{var T=bt(),z=o(s(T),2),$=s(z,!0);t(z),t(T),B(()=>k($,e(f).answer)),c(N,T)};ne(Z,N=>{e(f).answer&&N(L)})}t(J),B(()=>k(r,e(f).summary)),c(C,J)}),c(a,i)};ne(K,a=>{e(d)?a(re):e(l).length===0?a(X,1):a(H,-1)})}t(Y),t(R),c(S,R),ue()}Ae(["click"]);function Nt(S,n){ce(n,!0);let l=Me(n,["$$slots","$$events","$$legacy"]);const d=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M10 9H8"}],["path",{d:"M16 13H8"}],["path",{d:"M16 17H8"}]];De(S,Ie({name:"file-text"},()=>l,{get iconNode(){return d},children:(u,A)=>{var x=Ne(),I=me(x);Ce(I,()=>n.children??Oe),c(u,x)},$$slots:{default:!0}})),ue()}var At=_('<div class="empty-state svelte-18r587h">SCANNING SOURCE MANIFEST...</div>'),Et=Ke('<line x1="50" y1="50"></line>'),Tt=_('<div class="kb-solo-note svelte-18r587h"><span class="svelte-18r587h">NO EXTERNAL SOURCES CONNECTED</span> <small class="svelte-18r587h">Connect Obsidian or documents to extend recall provenance.</small></div>'),jt=_('<img src="/logo-dark.png" alt="" class="kb-signet-logo svelte-18r587h" aria-hidden="true"/>'),qt=_('<button type="button"><span class="kb-node-icon svelte-18r587h"><!></span> <span class="kb-node-copy svelte-18r587h"><strong class="svelte-18r587h"> </strong> <small class="svelte-18r587h"> </small></span></button>'),It=_('<div><div class="kb-origin-ring svelte-18r587h" aria-hidden="true"></div> <button type="button" class="kb-core svelte-18r587h"><span class="kb-core-mark svelte-18r587h"><img src="/logo-dark.png" alt="" class="kb-signet-logo svelte-18r587h" aria-hidden="true"/></span> <span class="kb-core-copy svelte-18r587h"><strong class="svelte-18r587h">Signet Memory</strong> <small class="svelte-18r587h">native identity graph · always on</small></span></button> <svg class="kb-links svelte-18r587h" viewBox="0 0 100 100" preserveAspectRatio="none" aria-hidden="true"></svg> <!> <!></div> <div class="kb-footer svelte-18r587h"><div class="kb-stat svelte-18r587h"><span class="svelte-18r587h"> </span> <small class="svelte-18r587h">ACTIVE</small></div> <div class="kb-stat svelte-18r587h"><span class="svelte-18r587h"> </span> <small class="svelte-18r587h">EXTERNAL</small></div> <div class="kb-stat svelte-18r587h"><span class="svelte-18r587h"> </span> <small class="svelte-18r587h">CONNECTORS</small></div> <div class="kb-last svelte-18r587h"><span class="svelte-18r587h">LAST EXTERNAL INDEX</span> <small class="svelte-18r587h"> </small></div></div>',1),Ct=_('<div class="kb-panel sig-panel svelte-18r587h"><div class="kb-header sig-panel-header svelte-18r587h"><div><span class="kb-title svelte-18r587h">CONNECTED KNOWLEDGE BASES</span> <span class="kb-subtitle svelte-18r587h">PROVENANCE GRAPH / LIVE SOURCES</span></div> <button type="button" class="kb-open svelte-18r587h"><!> <span>MANAGE</span></button></div> <!></div>');function Ot(S,n){ce(n,!0);const l=[{x:18,y:72},{x:73,y:24},{x:80,y:72},{x:22,y:24},{x:88,y:48}];let d=O(!1),u=O(oe([])),A=O(oe([]));he(async()=>{const r=await Promise.allSettled([Ze(),Re()]);r[0].status==="fulfilled"&&y(u,r[0].value,!0),r[1].status==="fulfilled"&&y(A,r[1].value,!0),y(d,!0)});const x=h(()=>{const r=e(u).map((v,P)=>({id:`source:${v.id}`,name:v.name||Y(v.root),kind:"source",provider:v.kind,detail:v.root,status:v.enabled?v.lastIndexedAt||(v.stats?.indexed??0)>0?"online":"syncing":"offline",updatedAt:v.lastIndexedAt??v.updatedAt??null,...l[P%l.length]})),E=e(A).map((v,P)=>({id:`connector:${v.id}`,name:v.display_name||v.provider,kind:"connector",provider:v.provider,detail:v.last_error??`${v.provider} document connector`,status:V(v),updatedAt:v.last_sync_at??v.updated_at??null,...l[(r.length+P)%l.length]}));return[...r,...E].slice(0,l.length)}),I=h(()=>1+e(x).filter(r=>r.status==="online").length),D=h(()=>1+e(x).length),R=h(()=>e(u).length),M=h(()=>e(A).length),W=h(()=>e(R)+e(M));function V(r){return r.last_error?"warning":r.status==="syncing"?"syncing":r.status==="connected"||r.status==="active"||r.status==="ok"||r.status?"online":"offline"}function Y(r){return r.split(/[\\/]/).filter(Boolean).at(-1)??"Knowledge base"}function K(r,E){return E?.kind==="memory"?"always on":r==="online"?"indexed":r==="syncing"?"syncing":r==="warning"?"attention":"offline"}function re(r){return r.kind==="memory"?"Signet":r.kind==="source"&&r.provider==="obsidian"?"Obsidian":r.provider.replace(/[-_]/g," ")}function X(r){if(!r)return"not indexed yet";const E=new Date(r);return Number.isNaN(E.getTime())?"unknown":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(E)}function H(){et.activeTab="sources"}var a=Ct(),i=s(a),p=o(s(i),2),C=s(p);$e(C,{class:"size-3"}),ge(2),t(p),t(i);var f=o(i,2);{var J=r=>{var E=At();c(r,E)},Q=r=>{var E=It(),v=me(E);let P;var ie=o(s(v),2),Z=o(ie,2);de(Z,21,()=>e(x),j=>j.id,(j,q)=>{var ae=Et();let fe;B(()=>{je(ae,"x2",e(q).x),je(ae,"y2",e(q).y),fe=Se(ae,0,"svelte-18r587h",null,fe,{"link-muted":e(q).status!=="online"})}),c(j,ae)}),t(Z);var L=o(Z,2);{var N=j=>{var q=Tt();c(j,q)};ne(L,j=>{e(x).length===0&&j(N)})}var T=o(L,2);de(T,17,()=>e(x),j=>j.id,(j,q)=>{var ae=qt();let fe;var xe=s(ae),Ge=s(xe);{var Be=se=>{var be=jt();c(se,be)},He=se=>{rt(se,{class:"size-3.5"})},ze=se=>{Nt(se,{class:"size-3.5"})};ne(Ge,se=>{e(q).kind==="memory"?se(Be):e(q).kind==="source"?se(He,1):se(ze,-1)})}t(xe);var Ee=o(xe,2),ye=s(Ee),Fe=s(ye,!0);t(ye);var Te=o(ye,2),We=s(Te);t(Te),t(Ee),t(ae),B((se,be)=>{fe=Se(ae,1,"kb-node svelte-18r587h",null,fe,{"kb-node--memory":e(q).kind==="memory","kb-node--source":e(q).kind==="source","kb-node--warning":e(q).status==="warning","kb-node--offline":e(q).status==="offline"}),_e(ae,`left: ${e(q).x??""}%; top: ${e(q).y??""}%;`),k(Fe,e(q).name),k(We,`${se??""} · ${be??""}`)},[()=>re(e(q)),()=>K(e(q).status,e(q))]),ve("click",ae,H),c(j,ae)}),t(v);var z=o(v,2),$=s(z),ee=s($),U=s(ee);t(ee),ge(2),t($);var F=o($,2),m=s(F),b=s(m,!0);t(m),ge(2),t(F);var g=o(F,2),w=s(g),te=s(w,!0);t(w),ge(2),t(g);var G=o(g,2),pe=o(s(G),2),le=s(pe,!0);t(pe),t(G),t(z),B(j=>{P=Se(v,1,"kb-visual svelte-18r587h",null,P,{"kb-visual--solo":e(x).length===0}),k(U,`${e(I)??""}/${e(D)??""}`),k(b,e(W)),k(te,e(M)),k(le,j)},[()=>X(e(x).find(j=>j.updatedAt)?.updatedAt??null)]),ve("click",ie,H),c(r,E)};ne(f,r=>{!e(d)&&e(D)===0?r(J):r(Q,-1)})}t(a),ve("click",p,H),c(S,a),ue()}Ae(["click"]);function Mt(S,n){ce(n,!0);let l=Me(n,["$$slots","$$events","$$legacy"]);const d=[["path",{d:"M12 18V5"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77"}]];De(S,Ie({name:"brain"},()=>l,{get iconNode(){return d},children:(u,A)=>{var x=Ne(),I=me(x);Ce(I,()=>n.children??Oe),c(u,x)},$$slots:{default:!0}})),ue()}var Dt=_('<div class="empty-state svelte-1qexx7n">LOADING</div>'),Rt=_('<div class="empty-state svelte-1qexx7n"><!> <span>NO MEMORIES YET</span></div>'),Pt=_('<span class="entity-count svelte-1qexx7n" title="times recalled"> </span>'),Lt=_('<div class="entity-row svelte-1qexx7n"><span class="entity-idx svelte-1qexx7n"> </span> <span class="entity-dot svelte-1qexx7n"></span> <span class="entity-name svelte-1qexx7n"> </span> <!></div>'),Ut=_('<div class="entity-list svelte-1qexx7n"></div>'),Gt=_('<div class="panel sig-panel svelte-1qexx7n"><div class="panel-header sig-panel-header svelte-1qexx7n"><span class="panel-title svelte-1qexx7n">SPOTLIGHT</span> <span class="panel-count svelte-1qexx7n"> </span></div> <div class="panel-body svelte-1qexx7n"><!></div> <div class="panel-footer sig-panel-footer svelte-1qexx7n"><button class="panel-link svelte-1qexx7n">VIEW IN MEMORY</button></div></div>');function Bt(S,n){ce(n,!0);let l=O(oe([])),d=O(!1);async function u(){try{const a=await fetch(`${Pe}/api/memories/most-used?limit=50`);if(a.ok){const C=((await a.json()).memories??[]).filter(f=>typeof f.id=="string"&&f.id.length>0&&typeof f.content=="string").map(f=>({id:f.id,content:f.content??"",access_count:f.access_count??0,importance:f.importance??.5}));if(C.length>0){y(l,C,!0),y(d,!0);return}}}catch{}y(l,n.memories.map(a=>({id:a.id,content:a.content,access_count:0,importance:a.importance??.5})).sort((a,i)=>i.importance-a.importance).slice(0,50),!0),y(d,!0)}he(()=>{u()});function A(a){const i=a.content.trim(),p=i.split(`
|
|
2
2
|
`)[0]??i;return p.length>60?`${p.slice(0,57)}...`:p}function x(a){return a>=.8?"var(--sig-danger)":a>=.5?"var(--sig-warning)":"var(--sig-success)"}var I=Gt(),D=s(I),R=o(s(D),2),M=s(R);t(R),t(D);var W=o(D,2),V=s(W);{var Y=a=>{var i=Dt();c(a,i)},K=a=>{var i=Rt(),p=s(i);Mt(p,{class:"empty-icon"}),ge(2),t(i),c(a,i)},re=a=>{var i=Ut();de(i,23,()=>e(l),p=>p.id,(p,C,f)=>{var J=Lt(),Q=s(J),r=s(Q,!0);t(Q);var E=o(Q,2),v=o(E,2),P=s(v,!0);t(v);var ie=o(v,2);{var Z=L=>{var N=Pt(),T=s(N,!0);t(N),B(()=>k(T,e(C).access_count)),c(L,N)};ne(ie,L=>{e(C).access_count>0&&L(Z)})}t(J),B((L,N,T)=>{k(r,L),_e(E,`background: ${N??""}`),k(P,T)},[()=>String(e(f)+1).padStart(2,"0"),()=>x(e(C).importance),()=>A(e(C))]),c(p,J)}),t(i),c(a,i)};ne(V,a=>{e(d)?e(l).length===0?a(K,1):a(re,-1):a(Y)})}t(W);var X=o(W,2),H=s(X);t(X),t(I),B(()=>k(M,`${e(l).length??""} RECALLED`)),ve("click",H,()=>tt("cortex-memory")),c(S,I),ue()}Ae(["click"]);var Ht=_('<div class="flex flex-col flex-1 min-h-0 overflow-hidden"><div class="home-grid svelte-12c0jaj"><div class="area-banner svelte-12c0jaj"><!></div> <div class="area-spotlights svelte-12c0jaj"><!></div> <div class="area-insights svelte-12c0jaj"><!></div> <div class="area-sidebar svelte-12c0jaj"><!></div></div></div>');function Vt(S,n){ce(n,!0);let l=O(null),d=O(oe([])),u=O(oe([])),A=O(null),x=O(oe([])),I=O(!1);he(async()=>{const a=await Promise.allSettled([at(),st(),ot(Pe,10,n.agentId),nt(),Re()]);a[0].status==="fulfilled"&&a[0].value&&y(l,a[0].value,!0),a[1].status==="fulfilled"&&y(d,a[1].value,!0),a[2].status==="fulfilled"&&y(u,a[2].value,!0),a[3].status==="fulfilled"&&y(A,a[3].value,!0),a[4].status==="fulfilled"&&y(x,a[4].value,!0),y(I,!0)});var D=Ht(),R=s(D),M=s(R),W=s(M);{let a=h(()=>n.memoryStats?.total??0);ut(W,{get identity(){return n.identity},get daemonStatus(){return n.daemonStatus},get connectorCount(){return e(x).length},get continuity(){return e(d)},get presence(){return e(u)},get agentId(){return n.agentId},get memoryCount(){return e(a)},get diagnostics(){return e(l)},get pipelineStatus(){return e(A)},get memoryStats(){return n.memoryStats}})}t(M);var V=o(M,2),Y=s(V);Ot(Y,{}),t(V);var K=o(V,2),re=s(K);wt(re,{get agentId(){return n.agentId}}),t(K);var X=o(K,2),H=s(X);Bt(H,{get memories(){return n.memories}}),t(X),t(R),t(D),c(S,D),ue()}export{Vt as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./
|
|
2
|
-
import{_ as ue}from"./PPVm8Dsz.js";import{p as cn,g as dn,o as B,e as Tt,Q as Wt,i as l,q as Ti,v as x,j as T,G as Ei,t as q,l as w,k as it,y as U,z as F,B as me,D as he,O as fe,M as ct,b as D,d as un,u as ot,A as St,f as ht,X as Pi,I as zi,m as $,c as Yt,N as Ni,w as He,x as Be,T as ge,h as ve}from"./C0do9GyP.js";import{r as Ci}from"./BkUGRIrN.js";import{a2 as Li,B as Ue}from"./CHxfhkfa.js";import{f as Ai,a as Di,b as Oi,g as qi,c as $i,e as xi}from"./qiR1fnXB.js";import Ri from"./B-D_9HMx.js";class Yi{cellSize;grid=new Map;lastHash=0;constructor(e=160){this.cellSize=e}rebuild(e){const i=this.computeHash(e);if(i===this.lastHash)return!1;this.lastHash=i,this.grid.clear();for(const s of e){const a=this.keyFor(s.x,s.y),r=this.grid.get(a)??[];r.push(s),this.grid.set(a,r)}return!0}queryPoint(e,i){const s=Math.floor(e/this.cellSize),a=Math.floor(i/this.cellSize);for(let r=-1;r<=1;r++)for(let d=-1;d<=1;d++){const h=this.grid.get(`${s+r},${a+d}`);if(h)for(let f=h.length-1;f>=0;f--){const g=h[f];if(g&&this.hitTest(g,e,i))return g}}return null}keyFor(e,i){return`${Math.floor(e/this.cellSize)},${Math.floor(i/this.cellSize)}`}hitTest(e,i,s){const a=Math.max(e.size*.5,4);if(e.shape==="rect")return Math.abs(i-e.x)<=a&&Math.abs(s-e.y)<=a;const r=i-e.x,d=s-e.y;return r*r+d*d<=a*a}computeHash(e){let i=e.length;for(const s of e){let a=0;for(let r=0;r<s.id.length;r++)a=(a<<5)-a+s.id.charCodeAt(r)|0;i=i*31+a|0,i=i*31+Math.round(s.x*10)|0,i=i*31+Math.round(s.y*10)|0}return i}}class Xi{constructor(e,i,s,a){this.canvas=e,this.viewport=i,this.spatial=s,this.callbacks=a,this.pointerEventsSupported="onpointerdown"in e,this.pointerEventsSupported?(e.addEventListener("pointerdown",this.pointerDown),e.addEventListener("pointermove",this.pointerMove),e.addEventListener("pointerup",this.pointerUp),e.addEventListener("pointercancel",this.pointerCancel),e.addEventListener("lostpointercapture",this.lostPointerCapture)):(e.addEventListener("mousedown",this.mouseDown),e.addEventListener("mousemove",this.mouseMove),e.addEventListener("mouseup",this.mouseUp),e.addEventListener("mouseleave",this.mouseUp)),e.addEventListener("click",this.click),e.addEventListener("dblclick",this.doubleClick),e.addEventListener("wheel",this.wheel,{passive:!1})}canvas;viewport;spatial;callbacks;isPanning=!1;draggingNode=null;didDrag=!1;lastX=0;lastY=0;activePointerId=null;currentHoverId=null;posHistory=[];pointerEventsSupported;pointerDown=this.onPointerDown.bind(this);pointerMove=this.onPointerMove.bind(this);pointerUp=this.onPointerUp.bind(this);pointerCancel=this.onPointerCancel.bind(this);lostPointerCapture=this.onLostPointerCapture.bind(this);mouseDown=this.onMouseDown.bind(this);mouseMove=this.onMouseMove.bind(this);mouseUp=this.onMouseUp.bind(this);click=this.onClick.bind(this);doubleClick=this.onDoubleClick.bind(this);wheel=this.onWheel.bind(this);destroy(){this.pointerEventsSupported?(this.canvas.removeEventListener("pointerdown",this.pointerDown),this.canvas.removeEventListener("pointermove",this.pointerMove),this.canvas.removeEventListener("pointerup",this.pointerUp),this.canvas.removeEventListener("pointercancel",this.pointerCancel),this.canvas.removeEventListener("lostpointercapture",this.lostPointerCapture)):(this.canvas.removeEventListener("mousedown",this.mouseDown),this.canvas.removeEventListener("mousemove",this.mouseMove),this.canvas.removeEventListener("mouseup",this.mouseUp),this.canvas.removeEventListener("mouseleave",this.mouseUp)),this.canvas.removeEventListener("click",this.click),this.canvas.removeEventListener("dblclick",this.doubleClick),this.canvas.removeEventListener("wheel",this.wheel)}getDraggingNode(){return this.draggingNode}canvasPoint(e){const i=this.canvas.getBoundingClientRect();return{x:e.clientX-i.left,y:e.clientY-i.top}}nodeAt(e,i){const s=this.viewport.screenToWorld(e,i);return this.spatial.queryPoint(s.x,s.y)}beginInteraction(e){const i=this.canvasPoint(e),s=this.nodeAt(i.x,i.y);if(this.lastX=i.x,this.lastY=i.y,this.posHistory=[{...i,t:performance.now()}],this.didDrag=!1,s){this.draggingNode=s,s.fx=s.x,s.fy=s.y,this.callbacks.onNodeDragStart(s),this.canvas.style.cursor="grabbing";return}this.isPanning=!0,this.canvas.style.cursor="grabbing"}moveInteraction(e){const i=this.canvasPoint(e);if(this.draggingNode){const r=this.viewport.screenToWorld(i.x,i.y);this.draggingNode.x=r.x,this.draggingNode.y=r.y,this.draggingNode.fx=r.x,this.draggingNode.fy=r.y,this.didDrag=!0,this.callbacks.onRequestRender();return}if(this.isPanning){this.viewport.pan(i.x-this.lastX,i.y-this.lastY),this.lastX=i.x,this.lastY=i.y,this.didDrag=!0;const r=performance.now();this.posHistory.push({...i,t:r}),this.posHistory.length>4&&this.posHistory.shift(),this.callbacks.onRequestRender();return}const s=this.nodeAt(i.x,i.y),a=s?.id??null;a!==this.currentHoverId&&(this.currentHoverId=a,this.callbacks.onNodeHover(s),this.canvas.style.cursor=s?"grab":"default",this.callbacks.onRequestRender())}endInteraction(){if(this.draggingNode){const s=this.draggingNode;s.fx=null,s.fy=null,this.draggingNode=null,this.callbacks.onNodeDragEnd(s),this.canvas.style.cursor=this.currentHoverId?"grab":"default";return}if(!this.isPanning)return;this.isPanning=!1;const e=this.posHistory[0],i=this.posHistory[this.posHistory.length-1];if(e&&i){const s=i.t-e.t;s>0&&s<200&&this.viewport.releaseWithVelocity((i.x-e.x)/s*16,(i.y-e.y)/s*16)}this.canvas.style.cursor="default",this.callbacks.onRequestRender()}onPointerDown(e){!e.isPrimary||e.button!==0||(e.preventDefault(),this.activePointerId=e.pointerId,this.canvas.setPointerCapture(e.pointerId),this.beginInteraction(e))}onPointerMove(e){e.isPrimary&&(this.activePointerId!==null&&e.pointerId!==this.activePointerId||this.moveInteraction(e))}onPointerUp(e){this.activePointerId===e.pointerId&&(this.releasePointer(e.pointerId),this.endInteraction())}onPointerCancel(e){this.activePointerId===e.pointerId&&(this.releasePointer(e.pointerId),this.endInteraction())}onLostPointerCapture(e){this.activePointerId===e.pointerId&&(this.activePointerId=null,this.endInteraction())}releasePointer(e){this.activePointerId=null,this.canvas.hasPointerCapture(e)&&this.canvas.releasePointerCapture(e)}onMouseDown(e){e.button===0&&this.beginInteraction(e)}onMouseMove(e){this.moveInteraction(e)}onMouseUp(){this.endInteraction()}onClick(e){if(this.didDrag)return;const i=this.canvasPoint(e);this.callbacks.onNodeClick(this.nodeAt(i.x,i.y))}onDoubleClick(e){const i=this.canvasPoint(e);this.callbacks.onNodeDoubleClick(this.nodeAt(i.x,i.y))}onWheel(e){e.preventDefault();const i=this.canvasPoint(e);if(Math.abs(e.deltaX)>Math.abs(e.deltaY))this.viewport.pan(-e.deltaX,0);else{const s=Wi(e);this.viewport.zoomImmediate(Math.max(.86,Math.min(1.16,Math.exp(-s*.0011))),i.x,i.y)}this.callbacks.onRequestRender()}}function Wi(t){return t.deltaMode===WheelEvent.DOM_DELTA_LINE?t.deltaY*16:t.deltaMode===WheelEvent.DOM_DELTA_PAGE?t.deltaY*400:t.deltaY}const xt=new Map,Fi={entity:"/constellation-assets/entity-icon.png",aspect:"/constellation-assets/aspect-icon.png",attribute:"/constellation-assets/attribute-icon.png",memory:"/constellation-assets/attribute-icon.png"},Ke=new Map;function Gi(t,e,i,s,a,r,d,h,f){t.clearRect(0,0,a,r),Zi(t,i,s,a,r,d,h,f),ji(t,e,s,a,r,d),Ki(t,e,s,a,r,d,f)}function Zi(t,e,i,s,a,r,d,h){const g=r.selectedId!==null&&r.dimProgress>0;xt.clear();for(const m of e){const M=d.get(m.sourceId),S=d.get(m.targetId);if(!M||!S)continue;const k=Ui(m,i,d);if(!k||k.startX<-120&&k.endX<-120||k.startX>s+120&&k.endX>s+120||k.startY<-120&&k.endY<-120||k.startY>a+120&&k.endY>a+120)continue;const P=h.edges[m.kind]??h.edges.about,v=Hi(m,r);if(!Qi(m,i.zoom,v))continue;const b=!g||v,N={...k,color:P.color,alpha:(b?Math.min(P.alpha*(v?1.25:1),.85):P.alpha*(1-r.dimProgress*.92))*to(m,i.zoom,v),width:P.width*eo(m,i.zoom,v)*(v?1.1:1),dashed:m.dashed??!1,connected:b,emphasized:v},L=`${N.color}|${N.alpha.toFixed(3)}|${N.width}|${N.dashed}`,G=xt.get(L)??[];G.push(N),xt.set(L,G)}t.save();for(const m of xt.values()){const M=m[0];M&&Bi(t,m,M)}t.restore()}function Hi(t,e){const i=e.selectedId??e.hoveredId;if(!i||t.visualOnly||t.kind==="about")return!1;const s=t.sourceId===i||e.relatedIds.has(t.sourceId),a=t.targetId===i||e.relatedIds.has(t.targetId);return s&&a}function Bi(t,e,i){if(e.some(a=>a.emphasized)){t.save(),t.globalAlpha=i.alpha*.18,t.strokeStyle=i.color,t.lineWidth=i.width*2.5,t.lineCap="round",t.setLineDash(i.dashed?[7,7]:[]),t.beginPath();for(const a of e)a.emphasized&&(t.moveTo(a.startX,a.startY),t.lineTo(a.endX,a.endY));t.stroke(),t.restore()}t.globalAlpha=i.alpha,t.strokeStyle=i.color,t.lineWidth=i.width,t.lineCap="round",t.setLineDash(i.dashed?[7,7]:[]),t.beginPath();for(const a of e)t.moveTo(a.startX,a.startY),t.lineTo(a.endX,a.endY);t.stroke()}function Ui(t,e,i){const s=i.get(t.sourceId),a=i.get(t.targetId);if(!s||!a)return null;const r=e.worldToScreen(s.x,s.y),d=e.worldToScreen(a.x,a.y);return Math.hypot(d.x-r.x,d.y-r.y)<1?null:{startX:r.x,startY:r.y,endX:d.x,endY:d.y}}function Ki(t,e,i,s,a,r,d){for(const f of e){const g=i.worldToScreen(f.x,f.y),m=f.size*i.zoom,M=m*(f.iconScale??1),S=Math.max(M,3);if(g.x+S<-80||g.x-S>s+80||g.y+S<-80||g.y-S>a+80)continue;const k=f.id===r.selectedId,P=f.id===r.hoveredId,v=r.relatedIds.has(f.id),b=!1;if(!hn(f,i.zoom,k||P||v||b))continue;const N=r.selectedId!==null&&!k&&!v,L=k||P||b?"selected":v?"related":N?"dim":"normal",G=f.kind==="attribute"||f.kind==="aspect"?.34:.12,K=(L==="dim"?Math.max(G,1-r.dimProgress*.88):1)*Ji(f,i.zoom,k||P||v||b);if(t.save(),t.globalAlpha=K,M<6&&!k&&!P){no(t,g.x,g.y,Math.max(2.2,M*.45),L==="dim"?f.dimColor:f.color,f.kind,L),t.restore();continue}if(f.kind==="entity"&&!N&&!k&&!v){const st=t.createRadialGradient(g.x,g.y,M*.6,g.x,g.y,M*2.2);st.addColorStop(0,`${f.color}20`),st.addColorStop(1,"rgba(0,0,0,0)"),t.fillStyle=st,t.beginPath(),t.arc(g.x,g.y,M*2.2,0,Math.PI*2),t.fill()}io(t,g.x,g.y,M,k?d.selection:N?f.dimColor:f.color,k||v?d.selection:f.color,f.shape??"circle",f.kind,f.sprite,L),!(N&&f.kind==="attribute"&&!P&&!b)&&uo(f,i.zoom,k,P,v||b,m)&&ho(t,f.label,g.x,g.y+M*.5+4,k?d.selection:v||b?f.color:N?d.textDim:d.text,d.labelShadow,f.kind==="memory"?8:10,i.zoom),t.restore()}}function ji(t,e,i,s,a,r){if(r.selectedId!==null)return;const d=180;t.save();for(const h of e){if(h.kind!=="entity")continue;const f=Math.max(0,Math.floor(h.counts?.aspects??0)),g=Math.max(0,Math.floor(h.counts?.attributes??0));if(f===0&&g===0)continue;const m=i.worldToScreen(h.x,h.y),M=Math.max(28,Math.min(92,(h.systemRadius??h.size*5)*i.zoom/4));m.x+M<-d||m.x-M>s+d||m.y+M<-d||m.y-M>a+d||Vi(t,m.x,m.y,M,f,g,h.color,i.zoom)}t.restore()}function Vi(t,e,i,s,a,r,d,h){const f=Math.min(3,Math.max(1,Math.ceil(a/5))),g=Math.min(1,Math.sqrt(r)/13),m=t.createRadialGradient(e,i,s*.22,e,i,s*1.3);m.addColorStop(0,`rgba(96, 165, 250, ${.04+g*.04})`),m.addColorStop(.5,`rgba(96, 165, 250, ${.03+g*.06})`),m.addColorStop(1,"rgba(96, 165, 250, 0)"),t.fillStyle=m,t.beginPath(),t.arc(e,i,s*1.3,0,Math.PI*2),t.fill(),t.strokeStyle="rgba(96, 165, 250, 0.18)",t.lineWidth=Math.max(.8,h*1.2),t.setLineDash([Math.max(3,s*.04),Math.max(8,s*.12)]);for(let S=0;S<f;S++)t.beginPath(),t.arc(e,i,s*(.56+S*.26),0,Math.PI*2),t.stroke();t.setLineDash([]);const M=Math.min(18,Math.max(3,a));for(let S=0;S<M;S++){const k=-Math.PI/2+Math.PI*2*S/M,P=s*(.68+S%f*.24),v=e+Math.cos(k)*P,b=i+Math.sin(k)*P;t.save(),t.translate(v,b),t.rotate(k+Math.PI/4),t.fillStyle=S<a?d:"rgba(96, 165, 250, 0.32)",t.globalAlpha=S<a?.65:.28;const N=Math.max(2.6,Math.min(6,s*.05));t.fillRect(-N/2,-N/2,N,N),S<a&&(t.globalAlpha=.4,t.fillStyle="rgba(255, 255, 255, 0.7)",t.fillRect(-N*.25,-N*.25,N*.5,N*.5)),t.restore()}r>0&&(t.strokeStyle=`rgba(167, 139, 250, ${.08+g*.18})`,t.lineWidth=Math.max(1.2,h*1.5),t.beginPath(),t.arc(e,i,s*1.04,-Math.PI/2,-Math.PI/2+Math.PI*2*g),t.stroke())}function hn(t,e,i=!1){return i||t.kind==="entity"?!0:(t.kind==="aspect"||t.kind==="attribute"||t.kind==="memory",e>=.09)}function Qi(t,e,i=!1){return i?!0:t.kind==="mentions"?e>=.18:e>=.09}function Ji(t,e,i=!1){return i||e>=.34||t.kind==="entity"?1:t.kind==="aspect"?.88:t.kind==="attribute"?.68:t.kind==="memory"?.55:.68}function to(t,e,i=!1){return i||e>=.34?1:t.kind==="about"?.52:t.kind==="has_aspect"?.82:t.kind==="has_attribute"?.65:t.kind==="supports"?.55:.6}function eo(t,e,i=!1){return i||e>=.34?1:t.kind==="about"?.9:t.kind==="supports"?.88:.92}function no(t,e,i,s,a,r,d){if(t.save(),t.translate(e,i),d!=="dim"){const h=t.createRadialGradient(0,0,s*.5,0,0,s*2.8);h.addColorStop(0,a),h.addColorStop(1,"rgba(0,0,0,0)"),t.fillStyle=h,t.globalAlpha=d==="selected"?.45:d==="related"?.32:.18,t.beginPath(),t.arc(0,0,s*2.8,0,Math.PI*2),t.fill()}t.globalAlpha=d==="dim"?.55:1,t.fillStyle=a,t.strokeStyle=d==="selected"?"rgba(241, 245, 249, 0.96)":d==="related"?"rgba(180, 230, 255, 0.9)":a,t.lineWidth=d==="selected"?1.6:d==="related"?1.2:.8,t.beginPath(),r==="attribute"||r==="memory"?(t.rotate(Math.PI/4),t.rect(-s,-s,s*2,s*2)):r==="aspect"?t.rect(-s,-s,s*2,s*2):Et(t,0,0,s*1.15),t.fill(),t.stroke(),(d==="selected"||d==="related")&&(t.rotate(r==="attribute"||r==="memory"?0:Math.PI/4),t.strokeStyle=d==="selected"?"rgba(241, 245, 249, 0.94)":"rgba(125, 211, 252, 0.86)",t.lineWidth=d==="selected"?1.1:.85,t.strokeRect(-s*1.75,-s*1.75,s*3.5,s*3.5)),t.restore()}function io(t,e,i,s,a,r,d,h,f,g){const m=Math.max(s*.5,2),M=oo(h,f);if(M&&m>=4.6){so(t,e,i,m,M,d,g,r);return}if(d==="hex"){ao(t,e,i,m,a,r,g);return}if(d==="rect"){ro(t,e,i,m,a,r,g);return}lo(t,e,i,m,a,r,g)}function oo(t,e){const i=e??Fi[t];if(!i||typeof Image>"u")return null;const s=Ke.get(i);if(s!==void 0)return s?.complete&&s.naturalWidth>0?s:null;const a=new Image;return a.decoding="async",a.src=i,Ke.set(i,a),null}function so(t,e,i,s,a,r,d,h){const g=s*(r==="hex"?3.05:2.72);t.save(),t.imageSmoothingEnabled=!0,t.drawImage(a,e-g/2,i-g/2,g,g),(d==="selected"||d==="related")&&(t.strokeStyle=d==="selected"?"rgba(241, 245, 249, 0.96)":h,t.lineWidth=d==="selected"?1.8:1.25,r==="hex"?Et(t,e,i,s*1.55):r==="rect"?(t.beginPath(),t.rect(e-s*1.15,i-s*1.15,s*2.3,s*2.3)):(t.beginPath(),t.arc(e,i,s*1.12,0,Math.PI*2)),t.stroke()),t.restore()}function ao(t,e,i,s,a,r,d){const h=d==="selected",f=d==="related";if(t.save(),h||f){const m=t.createRadialGradient(e,i,s*.8,e,i,s*2.4);m.addColorStop(0,h?"rgba(255, 255, 255, 0.35)":"rgba(125, 211, 252, 0.22)"),m.addColorStop(1,"rgba(0, 0, 0, 0)"),t.fillStyle=m,t.beginPath(),t.arc(e,i,s*2.4,0,Math.PI*2),t.fill()}t.lineWidth=h?1.9:f?1.55:1.15,t.strokeStyle=h?"rgba(241, 245, 249, 0.96)":f?"rgba(180, 214, 255, 0.88)":"rgba(132, 166, 207, 0.68)",t.fillStyle=d==="dim"?"rgba(4, 14, 31, 0.42)":"rgba(4, 14, 31, 0.84)",Et(t,e,i,s*1.12),t.fill(),t.stroke(),t.strokeStyle=h?"rgba(217, 183, 109, 0.92)":"rgba(166, 124, 58, 0.66)",t.lineWidth=h||f?1.1:.75,Et(t,e,i,s*1.28),t.stroke();const g=t.createRadialGradient(e-s*.28,i-s*.28,1,e,i,s*.74);g.addColorStop(0,h?"rgba(255, 255, 255, 1)":"rgba(220, 238, 255, 0.82)"),g.addColorStop(.3,a),g.addColorStop(.78,h?"rgba(56, 189, 248, 0.76)":"rgba(37, 99, 235, 0.52)"),g.addColorStop(1,d==="dim"?"rgba(2, 6, 23, 0.92)":"rgba(2, 6, 23, 0.82)"),t.fillStyle=g,t.strokeStyle=h?"rgba(241, 245, 249, 0.96)":r,t.lineWidth=h?1.5:f?1.25:.95,Et(t,e,i,s*.72),t.fill(),t.stroke(),t.strokeStyle=h?"rgba(255, 255, 255, 0.92)":"rgba(191, 219, 254, 0.68)",t.lineWidth=h?1.05:.7,fn(t,e,i,s*.52),t.stroke(),t.restore()}function ro(t,e,i,s,a,r,d){const h=d==="selected",f=d==="related";if(t.save(),h||f){const m=t.createRadialGradient(e,i,s*.8,e,i,s*2.2);m.addColorStop(0,h?"rgba(255, 255, 255, 0.3)":"rgba(125, 211, 252, 0.18)"),m.addColorStop(1,"rgba(0, 0, 0, 0)"),t.fillStyle=m,t.beginPath(),t.arc(e,i,s*2.2,0,Math.PI*2),t.fill()}t.fillStyle=d==="dim"?"rgba(5, 18, 40, 0.36)":"rgba(5, 18, 40, 0.78)",t.strokeStyle=h?"rgba(241, 245, 249, 0.96)":f?"rgba(191, 219, 254, 0.86)":"rgba(137, 166, 204, 0.58)",t.lineWidth=h?1.7:f?1.35:.95,t.beginPath(),t.rect(e-s,i-s,s*2,s*2),t.fill(),t.stroke(),t.strokeStyle=h?"rgba(217, 183, 109, 0.9)":"rgba(166, 124, 58, 0.5)",t.lineWidth=h||f?1:.65,co(t,e,i,s);const g=t.createRadialGradient(e-s*.22,i-s*.22,1,e,i,s*.75);g.addColorStop(0,h?"rgba(255, 255, 255, 1)":"rgba(224, 242, 254, 0.72)"),g.addColorStop(.32,a),g.addColorStop(1,d==="dim"?"rgba(30, 41, 59, 0.48)":"rgba(30, 41, 59, 0.72)"),t.fillStyle=g,t.strokeStyle=h?"rgba(241, 245, 249, 0.94)":r,t.lineWidth=h?1.25:.9,fn(t,e,i,s*.62),t.fill(),t.stroke(),t.restore()}function lo(t,e,i,s,a,r,d){const h=d==="selected",f=d==="related";if(t.save(),h||f){const m=t.createRadialGradient(e,i,s*.8,e,i,s*2.2);m.addColorStop(0,h?"rgba(255, 255, 255, 0.3)":"rgba(125, 211, 252, 0.18)"),m.addColorStop(1,"rgba(0, 0, 0, 0)"),t.fillStyle=m,t.beginPath(),t.arc(e,i,s*2.2,0,Math.PI*2),t.fill()}const g=t.createRadialGradient(e-s*.26,i-s*.26,1,e,i,s);g.addColorStop(0,d==="selected"?"rgba(255, 255, 255, 1)":"rgba(240, 249, 255, 0.68)"),g.addColorStop(.35,a),g.addColorStop(1,d==="dim"?"rgba(2, 6, 23, 0.88)":"rgba(2, 6, 23, 0.76)"),t.fillStyle=g,t.strokeStyle=d==="selected"?"rgba(241, 245, 249, 0.94)":r,t.lineWidth=d==="selected"?1.4:d==="related"?1.2:.9,t.beginPath(),t.arc(e,i,s,0,Math.PI*2),t.fill(),t.stroke(),t.restore()}function Et(t,e,i,s){t.beginPath();for(let a=0;a<6;a++){const r=Math.PI/6+Math.PI*2*a/6,d=e+Math.cos(r)*s,h=i+Math.sin(r)*s;a===0?t.moveTo(d,h):t.lineTo(d,h)}t.closePath()}function fn(t,e,i,s){t.beginPath(),t.moveTo(e,i-s),t.lineTo(e+s,i),t.lineTo(e,i+s),t.lineTo(e-s,i),t.closePath()}function co(t,e,i,s){const a=Math.max(s*.42,4),r=s*.12,d=e-s-r,h=e+s+r,f=i-s-r,g=i+s+r;t.beginPath(),t.moveTo(d,f+a),t.lineTo(d,f),t.lineTo(d+a,f),t.moveTo(h-a,f),t.lineTo(h,f),t.lineTo(h,f+a),t.moveTo(h,g-a),t.lineTo(h,g),t.lineTo(h-a,g),t.moveTo(d+a,g),t.lineTo(d,g),t.lineTo(d,g-a),t.stroke()}function uo(t,e,i,s,a,r){return i||s?!0:t.kind==="memory"&&!a?!1:e>.58&&r>3}function ho(t,e,i,s,a,r,d,h){const f=e.length>28?`${e.slice(0,28)}...`:e,g=Math.max(7,d*Math.min(h,1.4));t.font=`${g}px var(--font-mono), monospace`,t.textAlign="center",t.textBaseline="top";const m=t.measureText(f).width+14;t.fillStyle="rgba(2, 6, 23, 0.62)",t.fillRect(i-m/2,s-2,m,g+6),t.strokeStyle="rgba(96, 165, 250, 0.18)",t.lineWidth=.7,t.beginPath(),t.moveTo(i-m/2,s-2),t.lineTo(i+m/2,s-2),t.stroke(),t.fillStyle=r,t.fillText(f,i+1,s+1),t.fillStyle=a,t.fillText(f,i,s)}const je={chargeStrength:-2e3,linkDistance:220,linkStrength:.15,collisionPadding:18,solarPadding:120,solarStrength:.34,preSettleTicks:150,maxActiveTicks:80,maxActiveMs:1e3};class fo{sim=null;opts=je;activeTicks=0;activeStartedAt=0;init(e,i,s={}){this.destroy(),this.opts={...je,...s};const a=tn(i);this.sim=Ai(e).alphaDecay(.025).alphaMin(.001).velocityDecay(.45).force("link",Di(a).id(r=>r.id).distance(r=>go(r,this.opts.linkDistance)).strength(r=>bo(r,this.opts.linkStrength))).force("charge",Oi().strength(r=>this.opts.chargeStrength*po(r))).force("collide",qi(r=>r.size*mo(r)+this.opts.collisionPadding).strength(.74)).force("solar",yo().padding(this.opts.solarPadding).strength(this.opts.solarStrength)).force("x",$i(r=>r.zoneX??0).strength(Je)).force("y",xi(r=>r.zoneY??0).strength(Je)).on("tick.signetBudget",()=>this.enforceBudget()),this.sim.stop(),this.sim.alpha(1);for(let r=0;r<this.opts.preSettleTicks;r++)this.sim.tick();this.restartWithBudget(.22,0)}update(e,i){if(!this.sim)return;this.sim.nodes(e);const s=this.sim.force("link");s&&s.links(tn(i)),this.restartWithBudget(.22,0)}reheat(){this.restartWithBudget(.18,.12)}coolDown(){this.sim?.alphaTarget(0)}pause(){this.sim?.alphaTarget(0),this.sim?.alpha(0),this.sim?.stop()}isActive(){return(this.sim?.alpha()??0)>.001}destroy(){this.sim?.stop(),this.sim=null}restartWithBudget(e,i){this.sim&&(this.activeTicks=0,this.activeStartedAt=nn(),this.sim.alpha(Math.max(this.sim.alpha(),e)).alphaTarget(i).restart())}enforceBudget(){this.sim&&(this.activeTicks+=1,(this.activeTicks>=this.opts.maxActiveTicks||nn()-this.activeStartedAt>=this.opts.maxActiveMs)&&this.pause())}}function go(t,e){const i=Qe(t.source),s=Qe(t.target),a=Math.max(i,s),r=Math.min(Math.max(Ve(t.source),Ve(t.target))*.68+a*190,290);return t.kind==="supports"?64:t.kind==="has_attribute"?115:t.kind==="has_aspect"?Math.max(230+r,vo(t.target)+170):t.kind==="contains"?170:t.kind==="about"?260+r:t.kind==="updates"||t.kind==="extends"?78:e}function Ve(t){return typeof t=="string"?0:t.size}function Qe(t){return typeof t=="string"?0:t.mass??0}function vo(t){return typeof t=="string"?0:t.systemRadius??t.size}function po(t){return t.kind==="entity"?.72+(t.mass??0)**1.18*8.2:t.kind==="aspect"?Math.min(1.16,.78+t.size/160):.62}function mo(t){return t.kind==="entity"?.62+(t.mass??0)**1.08*1.65:t.kind==="aspect"?.58:.5}function bo(t,e){return t.kind==="supports"?.34:t.kind==="has_attribute"?.44:t.kind==="has_aspect"?.34:t.kind==="contains"?.16:t.kind==="about"?Math.max(.06,Math.min(t.strength??e,.28)):t.kind==="updates"||t.kind==="extends"?.3:e}function Je(t){return t.kind==="entity"&&t.zoneX!==void 0&&t.zoneY!==void 0?.085:.028}function tn(t){return t.filter(e=>!e.visualOnly).map(e=>({...e,source:e.sourceId,target:e.targetId}))}function yo(){let t=[],e=120,i=.34;const s=(a=>{const r=t.filter(d=>d.kind==="entity");for(let d=0;d<r.length;d++){const h=r[d];if(h)for(let f=d+1;f<r.length;f++){const g=r[f];if(!g)continue;const m=en(h)+en(g)+e;let M=(g.x??0)-(h.x??0),S=(g.y??0)-(h.y??0),k=Math.hypot(M,S);if(k>=m)continue;if(k<.001){const K=((d+1)*12.9898+(f+1)*78.233)%(Math.PI*2);M=Math.cos(K),S=Math.sin(K),k=1}const P=(m-k)/k*i*a,v=1+(h.mass??0)*3,b=1+(g.mass??0)*3,N=v+b,L=b/N,G=v/N;h.vx=(h.vx??0)-M*P*L,h.vy=(h.vy??0)-S*P*L,g.vx=(g.vx??0)+M*P*G,g.vy=(g.vy??0)+S*P*G}}});return s.initialize=a=>{t=a},s.padding=a=>(e=a,s),s.strength=a=>(i=a,s),s}function en(t){return Math.max(t.systemRadius??t.size,t.size*2)}function nn(){return typeof performance>"u"?Date.now():performance.now()}class rt{panX;panY;zoom;velocityX=0;velocityY=0;friction=.92;targetZoom;zoomSpring=.075;zoomAnchorX=0;zoomAnchorY=0;targetWorldX=null;targetWorldY=null;targetScreenX=0;targetScreenY=0;panLerp=.075;static MIN_ZOOM=.1;static MAX_ZOOM=6;constructor(e=0,i=0,s=1){this.panX=e,this.panY=i,this.zoom=Rt(s,rt.MIN_ZOOM,rt.MAX_ZOOM),this.targetZoom=this.zoom}worldToScreen(e,i){return{x:e*this.zoom+this.panX,y:i*this.zoom+this.panY}}screenToWorld(e,i){return{x:(e-this.panX)/this.zoom,y:(i-this.panY)/this.zoom}}pan(e,i){this.panX+=e,this.panY+=i,this.clearFocusTarget()}releaseWithVelocity(e,i){this.velocityX=e,this.velocityY=i}zoomImmediate(e,i,s){const a=this.screenToWorld(i,s);this.zoom=Rt(this.zoom*e,rt.MIN_ZOOM,rt.MAX_ZOOM),this.targetZoom=this.zoom,this.panX=i-a.x*this.zoom,this.panY=s-a.y*this.zoom,this.clearFocusTarget()}zoomTo(e,i,s){this.targetZoom=Rt(e,rt.MIN_ZOOM,rt.MAX_ZOOM),this.zoomAnchorX=i,this.zoomAnchorY=s,this.clearFocusTarget()}fitToNodes(e,i,s,a={}){if(e.length===0||i<=0||s<=0)return;let r=Number.POSITIVE_INFINITY,d=Number.NEGATIVE_INFINITY,h=Number.POSITIVE_INFINITY,f=Number.NEGATIVE_INFINITY;for(const P of e){const v=P.size*.5;r=Math.min(r,P.x-v),d=Math.max(d,P.x+v),h=Math.min(h,P.y-v),f=Math.max(f,P.y+v)}const g=a.padding??.14,m=Math.max((d-r)*(1+g*2),1),M=Math.max((f-h)*(1+g*2),1),S=(r+d)/2,k=(h+f)/2;this.targetZoom=Rt(Math.min(i/m,s/M,a.maxZoom??1.8),rt.MIN_ZOOM,rt.MAX_ZOOM),this.targetWorldX=S,this.targetWorldY=k,this.targetScreenX=i/2,this.targetScreenY=s/2}centerOn(e,i,s,a){this.targetWorldX=e,this.targetWorldY=i,this.targetScreenX=s/2,this.targetScreenY=a/2,this.targetZoom=this.zoom}tick(){let e=!1;Math.abs(this.velocityX)>.5||Math.abs(this.velocityY)>.5?(this.panX+=this.velocityX,this.panY+=this.velocityY,this.velocityX*=this.friction,this.velocityY*=this.friction,e=!0):(this.velocityX=0,this.velocityY=0);const i=this.targetWorldX,s=this.targetWorldY;if(i!==null&&s!==null){const a=this.stepZoom(),r=this.targetScreenX-i*this.zoom,d=this.targetScreenY-s*this.zoom,h=this.stepPan(r,d);return!a||!h?e=!0:this.clearFocusTarget(),e}if(!this.stepZoom()){const a=this.screenToWorld(this.zoomAnchorX,this.zoomAnchorY);this.panX=this.zoomAnchorX-a.x*this.zoom,this.panY=this.zoomAnchorY-a.y*this.zoom,e=!0}return e}stepZoom(){const e=this.targetZoom-this.zoom;return Math.abs(e)>.001?(this.zoom+=e*this.zoomSpring,!1):(this.zoom=this.targetZoom,!0)}stepPan(e,i){const s=e-this.panX,a=i-this.panY;return Math.abs(s)>.5||Math.abs(a)>.5?(this.panX+=s*this.panLerp,this.panY+=a*this.panLerp,!1):(this.panX=e,this.panY=i,!0)}clearFocusTarget(){this.targetWorldX=null,this.targetWorldY=null}}function Rt(t,e,i){return t<e?e:t>i?i:t}const gn=600,ko=Math.PI*(3-Math.sqrt(5)),vn=new Set(["person","project","topic","system","product","organization","org","source","artifact","agent","policy","action","workflow","event","object_type","interface","observation","claim_slot","claim_value"]),Mo=new Set(["benchmark","run","file","chunk","unknown"]),on={source:"#38bdf8",document:"#60a5fa",session:"#818cf8",entity:"#7dd3fc",aspect:"#60a5fa",attribute:"#a78bfa",memory:"#22d3ee",proposal:"#f59e0b"},_o={source:"rgba(56, 189, 248, 0.38)",document:"rgba(96, 165, 250, 0.34)",session:"rgba(129, 140, 248, 0.34)",entity:"rgba(125, 211, 252, 0.38)",aspect:"rgba(96, 165, 250, 0.34)",attribute:"rgba(167, 139, 250, 0.34)",memory:"rgba(34, 211, 238, 0.32)",proposal:"rgba(245, 158, 11, 0.34)"},Io={source:"rgba(56, 189, 248, 0.14)",document:"rgba(96, 165, 250, 0.14)",session:"rgba(129, 140, 248, 0.16)",entity:"rgba(125, 211, 252, 0.16)",aspect:"rgba(96, 165, 250, 0.15)",attribute:"rgba(167, 139, 250, 0.17)",memory:"rgba(34, 211, 238, 0.16)",proposal:"rgba(245, 158, 11, 0.16)"};function wo(t,e={}){const i=So(e.limit??gn),s=t.entities.filter(To).sort((v,b)=>be(b,e.focusLabel)-be(v,e.focusLabel)).slice(0,Math.max(1,i)),a=[],r=[],d=new Set,h=new Map,f=new Map,g=[],m=[];let M=0;for(const v of s){if(a.length>=i)break;const b=Po(v,M++,s.length);a.push(b),h.set(v.id,b),d.add(v.id)}No(a);const S=s.reduce((v,b)=>Math.max(v,b.aspects.length),0);for(let v=0;v<S;v++)for(const b of s){if(a.length>=i)break;const N=h.get(b.id);if(!N)continue;const L=b.aspects.toSorted((Z,st)=>Ft(st)-Ft(Z)),G=L[v];if(!G)continue;const K=Lo(N,G,v,L.length);a.push(K),g.push({aspect:G,node:K}),f.set(`${b.id}:${pn(G.name)}`,K),r.push({id:`has_aspect:${b.id}:${K.id}`,source:b.id,target:K.id,label:"aspect",kind:"has_aspect",strength:.58})}const k=g.reduce((v,b)=>Math.max(v,sn(b.aspect).length),0);for(let v=0;v<k;v++)for(const b of g){if(a.length>=i)break;const N=sn(b.aspect),L=N[v];if(!L)continue;const G=Ao(b.node,L,v,N.length);a.push(G),m.push({attribute:L,node:G}),r.push({id:`has_attribute:${b.node.id}:${G.id}`,source:b.node.id,target:G.id,label:L.kind,kind:"has_attribute",strength:.66})}for(const v of m){if(!v.attribute.memoryId||a.length>=i)continue;const b=xo(v.node,v.attribute);a.push(b),r.push({id:`supports:${b.id}:${v.node.id}`,source:b.id,target:v.node.id,label:"evidence",kind:"supports",strength:.64})}for(const v of Do(t.proposals??[])){if(a.length>=i)break;const b=Oo(v,h,f);if(!b&&a.length>=Math.floor(i*.95))continue;const N=qo(v,b,a.length);a.push(N),b&&r.push({id:`updates:${v.id}:${b.id}`,source:N.id,target:b.id,label:v.operation,kind:"updates",strength:Math.max(.35,v.confidence)})}const P=t.metadata?.dreaming;if(P&&a.length<i&&(P.latestPass||P.lastPassId||P.tokensSinceLastPass>0)){const v=h.values().next().value??null,b=$o(P,v);a.push(b),v&&r.push({id:`updates:${b.id}:${v.id}`,source:b.id,target:v.id,label:"dreaming",kind:"updates",strength:.42,visualOnly:!0})}for(const v of t.dependencies)!d.has(v.sourceEntityId)||!d.has(v.targetEntityId)||v.strength<.35||r.push({id:`about:${v.sourceEntityId}:${v.targetEntityId}`,source:v.sourceEntityId,target:v.targetEntityId,label:v.dependencyType,kind:"about",strength:v.strength,dashed:!0,visualOnly:!0});return{nodes:a.slice(0,i),edges:r.filter(v=>ln(a,v.source)&&ln(a,v.target))}}function So(t){return Number.isFinite(t)?Math.max(1,Math.min(Math.floor(t),2200)):gn}function To(t){const e=t.entityType.toLowerCase();return t.aspects.length===0?!1:t.pinned?!0:Eo(t.name)?!1:vn.has(e)?!0:Mo.has(e)?!1:t.mentions>=3||t.aspects.some(i=>i.attributes.some(s=>s.importance>=.78))}function Eo(t){const e=t.toLowerCase();return e.includes("benchmark")||e.includes("artifact")||e.includes("fixture")||e.includes("chunk")||/\b[0-9a-f]{8,}\b/.test(e)||/\d{6,}/.test(e)}function be(t,e){const i=e?.trim().toLowerCase(),s=i&&t.name.toLowerCase().includes(i)?100:0,a=vn.has(t.entityType.toLowerCase())?25:0,r=t.pinned?40:0,d=t.aspects.reduce((h,f)=>h+f.attributes.reduce((g,m)=>g+m.importance,0),0);return s+r+a+t.mentions*1.8+d}function Ft(t){return t.weight*4+t.attributes.reduce((e,i)=>e+i.importance,0)}function sn(t){return t.attributes.filter(e=>e.content.trim().length>0).toSorted((e,i)=>i.importance-e.importance)}function Po(t,e,i){const s=320+Math.sqrt(e+1)*88,a=e*ko+(i>1?0:.35),r=t.aspects.reduce((f,g)=>f+g.attributes.length,0),d=zo(t,r),h=t.aspects.toSorted((f,g)=>Ft(g)-Ft(f)).slice(0,4).map(f=>f.name).join(", ");return{id:t.id,kind:"entity",label:t.name,sublabel:t.entityType,preview:`${t.mentions} mentions • ${t.aspects.length} aspects`,entityType:t.entityType,status:t.proposalId?"review":"current",weight:be(t),counts:{mentions:t.mentions,aspects:t.aspects.length,attributes:r,influence:d,scale:0},details:[{label:"Type",value:t.entityType},{label:"Mentions",value:String(t.mentions)},{label:"Aspects",value:String(t.aspects.length)},...t.proposalId?[{label:"Proposal",value:t.proposalId}]:[],{label:"Strongest",value:h||"None indexed"}],x:Math.cos(a)*s,y:Math.sin(a)*s,data:t}}function zo(t,e){return Math.log2(t.mentions+1)*1.85+t.aspects.length*1.45+Math.sqrt(e)*1.7}function No(t){const e=t.filter(r=>r.kind==="entity");if(e.length===0)return;const i=e.map(r=>r.counts?.influence??0).toSorted((r,d)=>r-d),s=an(i,.58),a=Math.max(an(i,.96),s+1);for(const r of e){const h=Co(((r.counts?.influence??0)-s)/(a-s))**2.15;r.counts={...r.counts,scale:h}}}function an(t,e){if(t.length===0)return 0;const i=Math.max(0,Math.min(t.length-1,Math.floor((t.length-1)*e)));return t[i]??0}function Co(t){return Math.max(0,Math.min(t,1))}function Lo(t,e,i,s){const a=Math.max(0,Math.min(t.counts?.scale??0,1)),r=mn({index:i,total:s,baseRadius:250+a*170,ringStep:128,minArc:176,offset:-Math.PI/2+Pt(t.id,"aspect-offset")*.28}),d=r.angle,h=r.radius,f=e.attributes.toSorted((g,m)=>m.importance-g.importance).slice(0,3).map(g=>g.content).join(" / ");return{id:`aspect:${e.id}`,kind:"aspect",label:e.name,searchText:`${e.name} ${f}`,sublabel:"aspect",preview:f||"No attributes indexed for this aspect yet.",parentId:t.id,status:e.proposalId?"review":"current",weight:e.weight,counts:{attributes:e.attributes.length,laneAngle:d,laneIndex:i,laneRing:r.ring},details:[{label:"Entity",value:t.label},{label:"Aspect",value:e.name},{label:"Weight",value:e.weight.toFixed(2)},{label:"Attributes",value:String(e.attributes.length)},...e.proposalId?[{label:"Proposal",value:e.proposalId}]:[],{label:"Strongest",value:f||"None indexed"}],x:t.x+Math.cos(d)*h,y:t.y+Math.sin(d)*h,data:e}}function Ao(t,e,i,s){const a=mn({index:i,total:s,baseRadius:154,ringStep:94,minArc:142,offset:Pt(t.id,"attribute-offset")*Math.PI*2}),r=Xt(t,"laneAngle")??a.angle,d=s>36?6:s>18?5:s>8?4:3,h=Math.floor(i/d),f=i%d,m=(Math.min(d,s-h*d)-1)/2,M=(f-m)*86,S=150+h*98,k=r+Math.PI/2;return{id:`attribute:${e.id}`,kind:"attribute",label:bn(e.content,58),searchText:e.content,sublabel:e.kind,preview:e.content,parentId:t.id,status:e.proposalId?"review":e.status==="deleted"?"forgotten":"current",weight:e.importance,counts:{importance:Math.round(e.importance*100),version:e.version??1,proposalEvidence:e.proposalEvidenceCount??0,laneAngle:r,laneRow:h,laneColumn:f},details:[{label:"Aspect",value:t.label},{label:"Kind",value:e.kind},{label:"Importance",value:`${Math.round(e.importance*100)}%`},{label:"Version",value:`v${e.version??1}`},...e.groupKey?[{label:"Group",value:e.groupKey}]:[],...e.claimKey?[{label:"Claim",value:e.claimKey}]:[],...e.sourceKind?[{label:"Source",value:e.sourcePath??e.sourceKind}]:[],...e.proposalId?[{label:"Proposal",value:e.proposalId}]:[],{label:"Evidence",value:e.memoryId??"No memory id"}],x:t.x+Math.cos(r)*S+Math.cos(k)*M,y:t.y+Math.sin(r)*S+Math.sin(k)*M,data:e}}function Do(t){return[...t].filter(e=>e.id.trim().length>0).toSorted((e,i)=>i.confidence-e.confidence||i.evidenceCount-e.evidenceCount)}function Oo(t,e,i){if(!t.targetEntityId)return null;const s=t.targetAspectName?.trim();if(s){const a=i.get(`${t.targetEntityId}:${pn(s)}`);if(a)return a}return e.get(t.targetEntityId)??null}function qo(t,e,i){const s=Pt(t.id,"proposal")*Math.PI*2,a=e?136+Pt(t.id,"proposal-r")*46:620+i*14,r=e?e.x+Math.cos(s)*a:Math.cos(s)*a,d=e?e.y+Math.sin(s)*a:Math.sin(s)*a,h=t.preview??t.rationale;return{id:`proposal:${t.id}`,kind:"proposal",label:rn(t.operation),searchText:`${t.operation} ${t.targetEntityName??""} ${t.targetAspectName??""} ${h}`,sublabel:t.targetEntityName??"pending",preview:h||"Pending ontology operation",parentId:e?.id,status:"review",weight:t.confidence,counts:{confidence:Math.round(t.confidence*100),evidence:t.evidenceCount},details:[{label:"Operation",value:rn(t.operation)},{label:"Confidence",value:`${Math.round(t.confidence*100)}%`},{label:"Evidence",value:String(t.evidenceCount)},...t.targetEntityName?[{label:"Target",value:t.targetEntityName}]:[],...t.targetAspectName?[{label:"Aspect",value:t.targetAspectName}]:[],...t.sourceKind?[{label:"Source",value:t.sourcePath??t.sourceKind}]:[]],x:r,y:d,data:t}}function rn(t){return t.split(/[-_\s]+/).filter(Boolean).map(e=>`${e.charAt(0).toUpperCase()}${e.slice(1)}`).join(" ")}function $o(t,e){const i=t.latestPass,s=`dreaming:${i?.id??t.lastPassId??"queued"}`,a=i?.mutationsApplied??0,r=i?.mutationsSkipped??0,d=i?.mutationsFailed??0,h=i?`${i.status} ${i.mode}`:`${pe(t.tokensSinceLastPass)} tokens queued`,f=e?e.x-260:-260,g=e?e.y-220:-220;return{id:s,kind:"session",label:"Dreaming",searchText:`dreaming ${h} ${t.lastPassMode??""}`,sublabel:h,preview:i?`${a} applied / ${r} skipped / ${d} failed`:`${pe(t.tokensSinceLastPass)} summary tokens queued for consolidation`,status:d>0||t.consecutiveFailures>0?"conflict":"current",weight:i?Math.min(1,Math.max(.2,(a+r+d)/12)):.35,counts:{applied:a,skipped:r,failed:d,tokens:t.tokensSinceLastPass},details:[{label:"Status",value:h},{label:"Tokens",value:pe(t.tokensSinceLastPass)},...t.lastPassAt?[{label:"Last pass",value:t.lastPassAt}]:[],...i?[{label:"Mutations",value:`${a} / ${r} / ${d}`}]:[]],x:f,y:g,data:t}}function pe(t){return Intl.NumberFormat(void 0,{notation:t>=1e4?"compact":"standard"}).format(t)}function pn(t){return t.trim().toLowerCase().replace(/\s+/g," ")}function Xt(t,e){const i=t.counts?.[e];return typeof i=="number"&&Number.isFinite(i)?i:null}function mn(t){let e=0,i=0;for(;;){const s=t.baseRadius+i*t.ringStep,a=Math.max(5,Math.floor(Math.PI*2*s/t.minArc)),r=t.index-e;if(r<a){const d=Math.min(a,t.total-e);return{radius:s,angle:t.offset+Math.PI*2*r/Math.max(d,1),ring:i}}e+=a,i+=1}}function xo(t,e){const i=Xt(t,"laneAngle")??Pt(e.id,"memory")*Math.PI*2,s=Xt(t,"laneRow")??0,a=Xt(t,"laneColumn")??0,r=i+Math.PI/2,d=a%2===0?1:-1,h=70+s%2*12,f=d*28;return{id:`memory:${e.memoryId??e.id}:${e.id}`,kind:"memory",label:bn(e.content,42),searchText:e.content,sublabel:e.kind,preview:e.content,parentId:t.id,weight:e.importance,counts:{importance:Math.round(e.importance*100)},details:[{label:"Supports",value:t.label},{label:"Kind",value:e.kind},{label:"Memory",value:e.memoryId??"unknown"},{label:"Claim",value:e.content}],x:t.x+Math.cos(i)*h+Math.cos(r)*f,y:t.y+Math.sin(i)*h+Math.sin(r)*f,data:e}}function Pt(t,e=""){let i=0;const s=`${t}:${e}`;for(let a=0;a<s.length;a++)i=Math.imul(31,i)+s.charCodeAt(a)|0;return(i>>>0)%1e4/1e4}function bn(t,e){return t.length>e?`${t.slice(0,e-3)}...`:t}function ln(t,e){return t.some(i=>i.id===e)}var Ro=$('<div class="legend-item svelte-c2qg3z"><span class="legend-dot svelte-c2qg3z"></span> <span class="svelte-c2qg3z"> </span></div>'),Yo=$('<div class="legend-empty svelte-c2qg3z">No entities visible</div>'),Xo=$('<div class="legend-item svelte-c2qg3z"><span class="legend-dot svelte-c2qg3z"></span> <span class="svelte-c2qg3z"> </span></div>'),Wo=$('<div class="legend-list svelte-c2qg3z"><div class="legend-section svelte-c2qg3z"><div class="legend-heading svelte-c2qg3z">Entity Type</div> <div class="legend-grid svelte-c2qg3z"><!> <!></div></div> <div class="legend-section legend-structure svelte-c2qg3z"><div class="legend-heading svelte-c2qg3z">Structure</div> <!></div></div>'),Fo=$('<div class="node-card-preview svelte-c2qg3z"> </div>'),Go=$('<div class="node-detail-row svelte-c2qg3z"><span class="svelte-c2qg3z"> </span> <strong class="svelte-c2qg3z"> </strong></div>'),Zo=$('<div class="node-detail-list svelte-c2qg3z"></div>'),Ho=$('<button type="button" class="svelte-c2qg3z">Parent</button>'),Bo=$('<button type="button" class="svelte-c2qg3z"><span class="svelte-c2qg3z"> </span> <strong class="svelte-c2qg3z"> </strong></button>'),Uo=$('<div class="popover-more svelte-c2qg3z"> </div>'),Ko=$('<div class="node-card-kind svelte-c2qg3z"> </div> <div class="node-card-title svelte-c2qg3z"> </div> <!> <!> <div class="popover-actions svelte-c2qg3z"><!> <!> <!></div>',1),jo=$('<div class="entity-navigator-empty svelte-c2qg3z">Type to locate an entity</div>'),Vo=$('<div class="entity-navigator-empty svelte-c2qg3z">No matching entities</div>'),Qo=$('<button type="button" class="svelte-c2qg3z"><span class="svelte-c2qg3z"> </span> <small class="svelte-c2qg3z"> </small></button>'),Jo=$('<div class="node-card-kind svelte-c2qg3z">Navigator</div> <div class="node-card-title entity-navigator-title svelte-c2qg3z">Entities</div> <div class="entity-navigator-subtitle svelte-c2qg3z"> </div> <label class="entity-search-label svelte-c2qg3z" for="constellation-entity-search">Search entity</label> <input id="constellation-entity-search" class="entity-search-input svelte-c2qg3z" type="search" placeholder="Name, type, or memory path" autocomplete="off"/> <div class="entity-navigator-results svelte-c2qg3z" aria-label="Entity search results"><!></div>',1),ts=$('<span> </span> <code class="svelte-c2qg3z"> </code>',1),es=$('<span>overview</span> <code class="svelte-c2qg3z"> </code>',1),ns=$('<div class="knowledge-map-zone svelte-c2qg3z"><canvas class="graph-canvas svelte-c2qg3z" aria-label="Signet knowledge graph"></canvas> <div class="graph-chrome top-left svelte-c2qg3z"><div class="map-title svelte-c2qg3z">SIGNET CONSTELLATION</div> <div class="map-subtitle svelte-c2qg3z"> </div></div> <div class="map-controls svelte-c2qg3z"><button type="button" class="svelte-c2qg3z"><span class="svelte-c2qg3z">Fit</span><kbd class="svelte-c2qg3z">Z</kbd></button> <button type="button" class="svelte-c2qg3z"><span class="svelte-c2qg3z">Center</span><kbd class="svelte-c2qg3z">C</kbd></button> <div class="zoom-row svelte-c2qg3z"><span class="svelte-c2qg3z"> </span> <button type="button" aria-label="Zoom out" class="svelte-c2qg3z">-</button> <button type="button" aria-label="Zoom in" class="svelte-c2qg3z">+</button></div> <div class="legend-shell svelte-c2qg3z"><button type="button"><span class="legend-chevron svelte-c2qg3z">›</span> <span class="svelte-c2qg3z">Legend</span></button> <!></div></div> <div><div class="node-popover-content svelte-c2qg3z"><!></div> <div class="node-card-footer svelte-c2qg3z"><!></div></div></div>');function is(t,e){cn(e,!0);const i=dn(e,"agentId",3,"default"),s={source:58,document:48,session:46,aspect:32,attribute:30,memory:28,entity:38,proposal:34},a={person:{color:"#eab308",dim:"rgba(234, 179, 8, 0.34)"},project:{color:"#06b6d4",dim:"rgba(6, 182, 212, 0.34)"},product:{color:"#14f1d9",dim:"rgba(20, 241, 217, 0.3)"},system:{color:"#a855f7",dim:"rgba(168, 85, 247, 0.32)"},tool:{color:"#10b981",dim:"rgba(16, 185, 129, 0.3)"},topic:{color:"#a78bfa",dim:"rgba(167, 139, 250, 0.32)"},concept:{color:"#f43f5e",dim:"rgba(244, 63, 94, 0.3)"},organization:{color:"#f59e0b",dim:"rgba(245, 158, 11, 0.28)"},org:{color:"#f59e0b",dim:"rgba(245, 158, 11, 0.28)"},skill:{color:"#f59e0b",dim:"rgba(245, 158, 11, 0.28)"},task:{color:"#64748b",dim:"rgba(100, 116, 139, 0.3)"},source:{color:"#38bdf8",dim:"rgba(56, 189, 248, 0.3)"},artifact:{color:"#f97316",dim:"rgba(249, 115, 22, 0.28)"},agent:{color:"#22c55e",dim:"rgba(34, 197, 94, 0.3)"},policy:{color:"#fb7185",dim:"rgba(251, 113, 133, 0.3)"},action:{color:"#84cc16",dim:"rgba(132, 204, 22, 0.28)"},workflow:{color:"#c084fc",dim:"rgba(192, 132, 252, 0.3)"},event:{color:"#facc15",dim:"rgba(250, 204, 21, 0.28)"},object_type:{color:"#2dd4bf",dim:"rgba(45, 212, 191, 0.3)"},interface:{color:"#60a5fa",dim:"rgba(96, 165, 250, 0.3)"},observation:{color:"#e879f9",dim:"rgba(232, 121, 249, 0.3)"},claim_slot:{color:"#a3e635",dim:"rgba(163, 230, 53, 0.28)"},claim_value:{color:"#f472b6",dim:"rgba(244, 114, 182, 0.3)"}},r=new Set(["person","project","product","system","tool","topic","concept","organization","org","skill","task","unknown"]),d={contains:{color:"rgb(96, 165, 250)",alpha:.14,width:1},has_aspect:{color:"rgb(96, 165, 250)",alpha:.38,width:1.25},has_attribute:{color:"rgb(167, 139, 250)",alpha:.34,width:1.1},supports:{color:"rgb(34, 211, 238)",alpha:.34,width:1.15},updates:{color:"rgb(34, 211, 238)",alpha:.48,width:1.6},extends:{color:"rgb(14, 165, 233)",alpha:.3,width:1.1},mentions:{color:"rgb(59, 130, 246)",alpha:.1,width:.85},about:{color:"rgb(59, 130, 246)",alpha:.2,width:1.1}},h={contains:{color:"rgb(10, 57, 255)",alpha:.18,width:1},has_aspect:{color:"rgb(10, 57, 255)",alpha:.42,width:1.25},has_attribute:{color:"rgb(124, 58, 237)",alpha:.38,width:1.1},supports:{color:"rgb(6, 182, 212)",alpha:.38,width:1.15},updates:{color:"rgb(6, 182, 212)",alpha:.52,width:1.6},extends:{color:"rgb(2, 132, 199)",alpha:.34,width:1.1},mentions:{color:"rgb(37, 99, 235)",alpha:.14,width:.85},about:{color:"rgb(37, 99, 235)",alpha:.26,width:1.1}},f={selection:"#7cc7ff",selectionGlow:"rgba(59, 130, 246, 0.24)",text:"rgba(226, 232, 240, 0.74)",textMuted:"rgba(148, 163, 184, 0.66)",textDim:"rgba(148, 163, 184, 0.14)",labelShadow:"rgba(0, 0, 0, 0.82)",edges:d,relatedGlow:Io},g={selection:"#0a39ff",selectionGlow:"rgba(10, 57, 255, 0.18)",text:"rgba(36, 41, 54, 0.78)",textMuted:"rgba(94, 102, 117, 0.72)",textDim:"rgba(94, 102, 117, 0.18)",labelShadow:"rgba(255, 255, 255, 0.7)",edges:h,relatedGlow:{source:"rgba(10, 57, 255, 0.18)",document:"rgba(10, 57, 255, 0.18)",session:"rgba(10, 57, 255, 0.18)",aspect:"rgba(10, 57, 255, 0.14)",attribute:"rgba(124, 58, 237, 0.14)",memory:"rgba(10, 57, 255, 0.12)",entity:"rgba(10, 57, 255, 0.18)",proposal:"rgba(10, 57, 255, 0.14)"}},m=["person","project","system","tool","concept","topic","product","org","skill","task","source","artifact","agent","policy","action","workflow","event","object_type","interface","observation","claim_slot","claim_value","extracted","unknown"],M={person:"Person",project:"Project",product:"Product",system:"System",tool:"Tool",topic:"Topic",concept:"Concept",org:"Org",skill:"Skill",task:"Task",source:"Source",artifact:"Artifact",agent:"Agent",policy:"Policy",action:"Action",workflow:"Workflow",event:"Event",object_type:"Object Type",interface:"Interface",observation:"Observation",claim_slot:"Claim Slot",claim_value:"Claim Value",extracted:"Extracted",unknown:"Other"},S=12,k=[{kind:"aspect",label:"Aspect"},{kind:"attribute",label:"Attribute"},{kind:"memory",label:"Evidence"}],P=.56,v=.72,b=.92;let N=B(null),L=B(Tt([]));const G=ot(()=>Pn(l(L)));let K=[],Z=B(Tt([])),st=B(Tt([])),H=B(null),bt=B(null),vt=B(Tt(new Set)),Gt=B(!1),yt=B(null),kt=B(!0),J=B(800),et=B(600),ye=B(50),Mt=B(""),Zt=B(!1);const R=ot(ai),yn=ot(ui),zt=ot(()=>zn(l(Z),l(Mt))),kn=ot(()=>l(Zt)?g:f);let Ht=new Map,j=new Map,lt=null;const ke=new Yi;let Nt=null;const ft=new fo;let Bt=0,pt=!0,Ct=0,Ut=!1,Mn=0;function _n(n){const o=s[n.kind],c=Math.max(0,Math.min(n.weight??0,1));if(n.kind==="entity"){const u=Math.max(0,Math.min(n.counts?.scale??0,1));return o+Math.round(108*u)}return n.kind==="aspect"||n.kind==="attribute"||n.kind==="memory"?o+c*8:o}function In(n){return n==="source"||n==="document"||n==="session"?"rect":n==="entity"?"hex":n==="aspect"||n==="attribute"?"rect":"circle"}function wn(n){const o=Ht.get(n.id),c=_n(n),u=n.kind==="entity"?Me(n.entityType):null;return{id:n.id,kind:n.kind,label:n.label,sublabel:n.sublabel,searchText:n.searchText,parentId:n.parentId,x:o?.x??n.x,y:o?.y??n.y,vx:o?.vx??0,vy:o?.vy??0,fx:o?.fx??null,fy:o?.fy??null,anchorDx:o?.anchorDx,anchorDy:o?.anchorDy,size:c,mass:n.kind==="entity"?Math.max(0,Math.min(n.counts?.scale??0,1)):void 0,systemRadius:Tn(n,c),iconScale:Sn(n.kind),counts:n.counts,color:u?.color??on[n.kind],dimColor:u?.dim??_o[n.kind],sprite:n.kind==="entity"?En(n.entityType):void 0,shape:In(n.kind),data:n}}function Sn(n){return n==="aspect"?1.35:n==="attribute"?1.45:1}function Tn(n,o){if(n.kind==="entity"){const c=n.counts?.aspects??0,u=n.counts?.attributes??0,p=Math.max(0,Math.min(n.counts?.scale??0,1));return ne(370+p*230+Math.sqrt(c)*36+Math.sqrt(u)*9,440,860)}if(n.kind==="aspect"){const c=n.counts?.attributes??0;return ne(150+Math.sqrt(c)*17,o+96,360)}}function Me(n){return a[_t(n)]??{color:"#93c5fd",dim:"rgba(147, 197, 253, 0.28)"}}function En(n){const o=_t(n);return`/constellation-assets/entity-${r.has(o)?o:"unknown"}.png`}function _t(n){const o=n?.trim().toLowerCase();return o?o==="organization"?"org":o:"unknown"}function Pn(n){const o=new Map;for(const u of n){if(u.kind!=="entity")continue;const p=_t(_e(u));o.set(p,(o.get(p)??0)+1)}const c=new Map(m.map((u,p)=>[u,p]));return[...o.entries()].sort(([u,p],[y,_])=>{const I=c.get(u),C=c.get(y);return I!==void 0||C!==void 0?(I??999)-(C??999):_-p||u.localeCompare(y)}).slice(0,S).map(([u,p])=>({type:u,label:Ie(u),count:p}))}function _e(n){const o=n.data;if(!o||typeof o!="object"||!("entityType"in o))return;const c=o.entityType;return typeof c=="string"?c:void 0}function Ie(n){const o=M[n];return o||n.split(/[-_\s]+/).filter(Boolean).map(c=>`${c.charAt(0).toUpperCase()}${c.slice(1)}`).join(" ")}function zn(n,o){const c=o.trim().toLowerCase().split(/\s+/).filter(Boolean);return c.length===0?[]:n.filter(u=>u.kind==="entity").map(u=>({node:u,score:Nn(u,c)})).filter(u=>u.score>0).sort((u,p)=>p.score-u.score||Kt(p.node)-Kt(u.node)||u.node.label.localeCompare(p.node.label)).slice(0,10).map(u=>u.node)}function Nn(n,o){const c=Cn(n);let u=0;for(const p of o)if(n.label.toLowerCase()===p)u+=80;else if(n.label.toLowerCase().startsWith(p))u+=45;else if(n.label.toLowerCase().includes(p))u+=25;else if(c.includes(p))u+=8;else return 0;return u+Math.min(Kt(n)/70,25)}function Cn(n){return[n.label,n.entityType,n.sublabel,n.preview,n.searchText].filter(o=>typeof o=="string").join(" ").toLowerCase()}function Kt(n){const o=Math.max(0,n.counts?.mentions??0),c=Math.max(0,Math.min(n.counts?.scale??0,1)),u=Math.max(0,n.counts?.aspects??0),p=Math.max(0,n.counts?.attributes??0);return o*8+c*1e3+u*10+p}function Ln(n,o){const c=n.filter(C=>C.kind==="entity");if(c.length===0)return;const u=new Map;for(const C of c){const E=_t(_e(C)),O=u.get(E)??[];O.push(C),u.set(E,O)}const p=new Map(m.map((C,E)=>[C,E])),y=[...u.entries()].sort(([C,E],[O,A])=>{const z=p.get(C),Y=p.get(O);return z!==void 0||Y!==void 0?(z??999)-(Y??999):A.length-E.length||C.localeCompare(O)}),_=Math.max(2,Math.ceil(Math.sqrt(y.length*1.45))),I=Math.max(1,Math.ceil(y.length/_));for(const[C,[,E]]of y.entries()){const O=(C%_-(_-1)/2)*1320,A=(Math.floor(C/_)-(I-1)/2)*1060;E.sort((z,Y)=>Y.size-z.size||z.label.localeCompare(Y.label));for(const[z,Y]of E.entries()){const Q=An(z,E.length,O,A,Y.systemRadius??Y.size*3);Y.zoneX=Q.x,Y.zoneY=Q.y,o&&(Y.x=Q.x,Y.y=Q.y,Y.vx=0,Y.vy=0)}}}function An(n,o,c,u,p){if(n===0)return{x:c,y:u};const y=Math.floor(Math.sqrt(n)),_=y*y,I=Math.max(1,Math.min(o-_,(y+1)*(y+1)-_)),C=n-_,E=-Math.PI/2+C/I*Math.PI*2+y*.38,O=Math.max(420,p*.42)+y*420;return{x:c+Math.cos(E)*O,y:u+Math.sin(E)*O}}function Dn(n){return{...n,id:n.id,sourceId:n.source,targetId:n.target,source:n.source,target:n.target}}function we(n,o,c=!1){const u=n.map(wn);Ln(u,c&&l(H)===null);const p=new Set(u.map(z=>z.id)),y=o.filter(z=>p.has(z.source)&&p.has(z.target)).map(Dn);x(L,u,!0),K=y;const _=l(L),I=K;Ht=new Map(_.map(z=>[z.id,z])),j=new Map(_.map(z=>[z.id,z])),jn(_),te(),ee();const C=_.filter(Kn),E=C.length>600?-900:C.length>250?-1500:C.length>90?-2200:-2800,O=new Set(C.map(z=>z.id)),A=I.filter(z=>O.has(z.sourceId)&&O.has(z.targetId));c?ft.init(C,A,{chargeStrength:E,linkDistance:_.length>1e3?210:280,collisionPadding:_.length>1e3?20:34,solarPadding:_.length>1e3?170:240,solarStrength:_.length>1e3?.42:.5,preSettleTicks:_.length>1e3?48:_.length>400?90:180,maxActiveTicks:_.length>1e3?28:_.length>400?48:90,maxActiveMs:_.length>1e3?420:_.length>400?680:1100}):ft.update(C,A),Ut=c,tt()}function jt(n=!1){const o=On();we(o.nodes,o.edges,n)}function at(n){return l(Z).filter(o=>o.parentId===n)}function On(){const n=Lt(),o=n?Se(n):qn();return{nodes:l(Z).filter(u=>o.has(u.id)),edges:l(st).filter(u=>o.has(u.source)&&o.has(u.target)&&$n(u,n))}}function qn(){const n=new Set;for(const o of l(Z))(o.kind==="entity"||o.kind==="session")&&n.add(o.id);return n}function Se(n){const o=new Set,c=Ne(n),u=n.kind==="entity"?n:c.find(y=>y.kind==="entity"),p=n.kind==="aspect"?n:c.find(y=>y.kind==="aspect");if(n.kind==="entity"&&u){o.add(u.id);for(const y of at(u.id))o.add(y.id);for(const y of l(st))y.kind==="about"&&(y.source===n.id&&o.add(y.target),y.target===n.id&&o.add(y.source));return o}if(n.kind==="aspect"&&p){u&&o.add(u.id),o.add(p.id);for(const y of at(p.id))o.add(y.id);return o}if(n.kind==="attribute"){if(u&&o.add(u.id),p&&o.add(p.id),o.add(n.id),p)for(const y of at(p.id))o.add(y.id);for(const y of at(n.id))o.add(y.id);return o}if(n.kind==="memory"){for(const y of c)o.add(y.id);return o.add(n.id),o}return o.add(n.id),o}function $n(n,o){return o?o.kind==="entity"?n.kind==="has_aspect"||n.kind==="about"||n.kind==="updates":o.kind==="aspect"?n.kind==="has_aspect"||n.kind==="has_attribute"||n.kind==="updates":o.kind==="attribute"||o.kind==="memory"?n.kind==="has_aspect"||n.kind==="has_attribute"||n.kind==="supports"||n.kind==="updates":!0:n.kind==="about"||n.kind==="updates"}async function xn(n){x(Gt,!0),x(yt,null),x(H,null),x(vt,new Set,!0);try{const o=await Li(n);if(!o){x(yt,"Could not reach daemon knowledge endpoint"),x(Z,[],!0),x(st,[],!0),we([],[],!0);return}const c=wo(o,{focusLabel:"Signet",limit:5e3});x(Z,c.nodes,!0),x(st,c.edges,!0),Ht=new Map,x(H,null),jt(!0)}catch(o){x(yt,o instanceof Error?o.message:String(o),!0)}finally{x(Gt,!1)}}function Rn(n){const o=n.getContext("2d");if(!o)return null;const c=window.devicePixelRatio||1,u=n.clientWidth,p=n.clientHeight,y=16384,_=Math.min(y/Math.max(u,1),y/Math.max(p,1),c);return(n.width!==Math.floor(u*_)||n.height!==Math.floor(p*_))&&(n.width=Math.floor(u*_),n.height=Math.floor(p*_),x(J,u,!0),x(et,p,!0),pt=!0),o.setTransform(_,0,0,_,0,0),o}function tt(){pt=!0}function Te(){Bt=requestAnimationFrame(Te);const n=l(N),o=lt;if(!n||!o)return;const c=Rn(n);if(!c)return;const u=o.tick();x(ye,Math.round(o.zoom*100),!0);const p=l(H)?1:0,y=p-Ct;let _=!1;Math.abs(y)>.01?(Ct+=y*.1,_=!0):Ct=p;const I=ft.isActive(),C=Nt?.getDraggingNode()!=null,E=Nt?.getDraggingNode();E&&Vn(E);const O=te(E),A=u||I||C||O||pt?ee(Mn++%3!==0):!1;Ut&&l(L).length>0&&l(J)>0&&l(et)>0&&(o.fitToNodes(l(L),l(J),l(et)),Ut=!1),!(!u&&!I&&!_&&!A&&!pt)&&(pt=!1,Gi(c,l(L),K,o,l(J),l(et),{selectedId:l(H),hoveredId:l(bt),relatedIds:l(vt),dimProgress:Ct},j,l(kn)))}function Yn(n){if(!n||l(H)===n.id){Ce();return}ze(n.id)}function Lt(){return l(H)?l(Z).find(o=>o.id===l(H))??null:null}function Ee(){lt?.fitToNodes(l(L),l(J),l(et)),tt()}function Pe(){if(l(H)){Le(l(H));return}if(l(L).length===0)return;let n=0,o=0;for(const c of l(L))n+=c.x,o+=c.y;lt?.centerOn(n/l(L).length,o/l(L).length,l(J),l(et)),tt()}function At(n){const o=lt;o&&(o.zoomTo(o.zoom*n,l(J)/2,l(et)/2),tt())}function dt(n){ze(n)}function ze(n){x(H,n,!0),x(vt,Xn(n),!0),jt();const o=j.get(n);o?.kind==="entity"||o?.kind==="aspect"||o?.kind==="attribute"?Wn(n):Le(n),tt()}function Xn(n){const o=l(Z).find(p=>p.id===n);if(!o)return new Set;const c=new Set([n]),u=Ne(o);for(const p of u)c.add(p.id);for(const p of at(n))c.add(p.id);if(o.kind==="entity"||o.kind==="aspect")for(const p of Se(o))c.add(p);return c}function Ne(n){const o=[];let c=n.parentId?l(Z).find(u=>u.id===n.parentId):null;for(;c;)o.push(c),c=c.parentId?l(Z).find(u=>u.id===c?.parentId):null;return o}function Ce(){x(H,null),x(vt,new Set,!0),jt(!0),tt()}function Le(n){const o=j.get(n);o&&(lt?.centerOn(o.x,o.y,l(J),l(et)),tt())}function Wn(n){const o=j.get(n);if(!o)return;const c=Vt(n);if(Gn(o,c),ft.pause(),te(),ee(),o.kind==="attribute"){tt();return}const u=o.kind==="entity"?P:o.kind==="aspect"?v:b;lt?.fitToNodes(Fn(o),l(J),l(et),{maxZoom:u,padding:o.kind==="entity"?.34:o.kind==="aspect"?.42:.58}),tt()}function Vt(n){return at(n).map(o=>j.get(o.id)).filter(o=>o!==void 0)}function Fn(n){const o=new Set([n.id]);for(const u of Vt(n.id))o.add(u.id);let c=n.parentId?j.get(n.parentId):null;for(;c;){if(o.add(c.id),n.kind==="attribute"&&c.kind==="aspect")for(const u of Vt(c.id))o.add(u.id);c=c.parentId?j.get(c.parentId):null}return[...o].map(u=>j.get(u)).filter(u=>u!==void 0)}function Gn(n,o){if(n.kind==="aspect"){if(o.length===0)return;Hn(n,o);return}if(n.kind==="attribute"){Bn(n,o);return}o.length!==0&&Zn(n,o)}function Zn(n,o){const c=n.kind==="entity"?Math.max(290,n.size*.8+190):Math.max(188,n.size*1.15+118),u=n.kind==="entity"?122:96,p=n.kind==="entity"?190:188,y=-Math.PI/2+Qt(n.id)*.4;n.vx=0,n.vy=0;for(const[_,I]of o.entries()){const C=Un(_,o.length,c,u,p,y),E=C.angle,O=C.radius;I.x=n.x+Math.cos(E)*O,I.y=n.y+Math.sin(E)*O,I.vx=0,I.vy=0,I.fx=null,I.fy=null,I.anchorDx=I.x-n.x,I.anchorDy=I.y-n.y}}function Hn(n,o){const c=n.parentId?j.get(n.parentId):null,u=c?Math.atan2(n.y-c.y,n.x-c.x):Qt(n.id),p=u+Math.PI/2,y=o.length>42?7:o.length>24?6:o.length>12?5:4;n.vx=0,n.vy=0;for(const[_,I]of o.entries()){const C=Math.floor(_/y),E=_%y,A=(Math.min(y,o.length-C*y)-1)/2,z=178+C*124,Y=(E-A)*118;I.x=n.x+Math.cos(u)*z+Math.cos(p)*Y,I.y=n.y+Math.sin(u)*z+Math.sin(p)*Y,I.vx=0,I.vy=0,I.fx=null,I.fy=null,I.anchorDx=I.x-n.x,I.anchorDy=I.y-n.y}}function Bn(n,o){const c=n.parentId?j.get(n.parentId):null,u=c?.parentId?j.get(c.parentId):null,p=c&&u?Math.atan2(c.y-u.y,c.x-u.x):Qt(n.id),y=p+Math.PI/2;n.vx=0,n.vy=0;for(const[_,I]of o.entries()){const C=_%2===0?1:-1,E=86+Math.floor(_/2)*48,O=C*(34+Math.floor(_/2)*16);I.x=n.x+Math.cos(p)*E+Math.cos(y)*O,I.y=n.y+Math.sin(p)*E+Math.sin(y)*O,I.vx=0,I.vy=0,I.fx=null,I.fy=null,I.anchorDx=I.x-n.x,I.anchorDy=I.y-n.y}}function Un(n,o,c,u,p,y){let _=0,I=0;for(;;){const C=c+I*u,E=Math.max(5,Math.floor(Math.PI*2*C/p)),O=n-_;if(O<E){const A=Math.min(E,o-_),z=y+Math.PI*2*O/Math.max(A,1);return{radius:C,angle:z}}_+=E,I+=1}}function Qt(n){let o=0;for(let c=0;c<n.length;c++)o=Math.imul(31,o)+n.charCodeAt(c)|0;return((o>>>0)%1e4/1e4-.5)*.6}function Kn(n){return n.kind==="entity"||n.kind==="aspect"}function Jt(n){return n.kind==="attribute"||n.kind==="memory"||n.kind==="proposal"}function jn(n){for(const o of n){if(!Jt(o)||!o.parentId)continue;const c=j.get(o.parentId);c&&(o.anchorDx??=o.x-c.x,o.anchorDy??=o.y-c.y)}}function te(n){let o=!1;for(const c of l(L)){if(!Jt(c)||c===n||!c.parentId)continue;const u=j.get(c.parentId);if(!u)continue;const p=u.x+(c.anchorDx??0),y=u.y+(c.anchorDy??0);(Math.abs(c.x-p)>.05||Math.abs(c.y-y)>.05)&&(c.x=p,c.y=y,o=!0)}return o}function Vn(n){if(!Jt(n)||!n.parentId)return;const o=j.get(n.parentId);o&&(n.anchorDx=n.x-o.x,n.anchorDy=n.y-o.y)}function ee(n=!1){const o=lt;if(n&&l(L).length>1e3)return!1;const c=o?.zoom??1;return ke.rebuild(l(L).filter(u=>Jn(u,c,Qn(u))))}function Qn(n){return n.id===l(H)||n.id===l(bt)||l(vt).has(n.id)}function Jn(n,o,c=!1){return c||n.kind==="entity"?!0:n.kind==="aspect"?o>=.15:n.kind==="attribute"?o>=.38:n.kind==="memory"?o>=.62:hn(n,o,c)}function Ae(n){const o=Lt();if(!o)return;const c=l(Z).filter(y=>y.parentId===o.parentId&&y.kind===o.kind);if(c.length===0)return;const u=c.findIndex(y=>y.id===o.id),p=c[(u+n+c.length)%c.length];p&&dt(p.id)}function ti(){const n=Lt();n?.parentId&&dt(n.parentId)}function ei(){if(!l(H))return;const n=l(Z).find(o=>o.parentId===l(H));n&&dt(n.id)}function De(n){return n==="memory"?"Evidence":n[0]?.toUpperCase()+n.slice(1)}function ni(n){return n.kind==="attribute"&&n.preview?n.preview:n.label}function ii(n){return n.kind!=="attribute"&&!!n.preview}function oi(n){return n.counts?.mentions?`${n.counts.mentions} mentions`:n.counts?.importance?`${n.counts.importance}% importance`:n.counts?.confidence?`${n.counts.confidence}% confidence`:n.status??"current"}function si(n){return n.parentId?l(Z).find(o=>o.id===n.parentId)??null:null}function ai(){const n=l(H)??l(bt);return n?l(Z).find(o=>o.id===n)??null:null}function ri(n){const o=Math.max(260,Math.min(330,l(J)-32)),c=ci(n),u=l(J)<700?14:24;return`right: ${u}px; bottom: ${u}px; width: ${o}px; height: ${c}px;`}function li(){const n=Math.max(300,Math.min(360,l(J)-32)),o=l(J)<700?14:24;return`right: ${o}px; bottom: ${o}px; width: ${n}px; height: auto; max-height: ${Math.min(420,l(et)-80)}px;`}function ci(n){const o=Math.min(at(n.id).length,Dt(n));return ne(236+Math.ceil(o/2)*32,270,Math.min(430,l(et)-32))}function Dt(n){return n.kind==="aspect"?8:n.kind==="entity"||n.kind==="attribute"?6:4}function di(n){return n.length>18?`${n.slice(0,10)}...${n.slice(-5)}`:n}function ne(n,o,c){return Math.max(o,Math.min(n,c))}function ui(){const n=l(L).length;if(l(Gt))return"Loading knowledge map...";if(l(yt))return l(yt);const o=Lt(),c=l(L).filter(y=>y.kind==="proposal").length,u=l(L).filter(y=>y.kind==="session").length,p=[o?`${hi(o)} focus`:"overview",c>0?`${c} proposals`:"",u>0?`${u} dreaming signals`:""].filter(Boolean);return`${n} ontology nodes • ${K.length} relationships${p.length>0?` • ${p.join(" • ")}`:""}`}function hi(n){return n.kind==="entity"?"entity":n.kind==="aspect"?"aspect":n.kind==="attribute"||n.kind==="memory"?"attribute":"overview"}function Oe(n){const o=n.target;if(!(o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.isContentEditable))switch(n.key){case"z":case"Z":Ee();break;case"c":case"C":Pe();break;case"+":case"=":At(1.3);break;case"-":case"_":At(1/1.3);break;case"Escape":Ce();break;case"ArrowRight":n.preventDefault(),Ae(1);break;case"ArrowLeft":n.preventDefault(),Ae(-1);break;case"ArrowUp":n.preventDefault(),ti();break;case"ArrowDown":n.preventDefault(),ei();break}}function fi(n){if(n.key==="Enter"){n.preventDefault();const o=l(zt)[0];o&&dt(o.id)}n.key==="Escape"&&(n.stopPropagation(),x(Mt,""))}function qe(){return typeof document<"u"&&document.documentElement.dataset.theme==="light"}Wt(()=>{i(),xn(i())}),Wt(()=>{l(H),l(bt),l(vt),tt()}),Ti(()=>{x(Zt,qe(),!0);const n=l(N);n&&(lt=new rt(n.clientWidth/2,n.clientHeight/2,.5),Nt=new Xi(n,lt,ke,{onNodeHover:c=>{x(bt,c?.id??null,!0)},onNodeClick:Yn,onNodeDragStart:()=>ft.reheat(),onNodeDragEnd:()=>{ft.coolDown(),tt()},onNodeDoubleClick:c=>{c&&dt(c.id)},onRequestRender:tt})),window.addEventListener("keydown",Oe),Bt=requestAnimationFrame(Te);const o=new MutationObserver(c=>{for(const u of c)if(u.attributeName==="data-theme"){x(Zt,qe(),!0),pt=!0;break}});return o.observe(document.documentElement,{attributes:!0}),()=>{window.removeEventListener("keydown",Oe),cancelAnimationFrame(Bt),Nt?.destroy(),ft.destroy(),o.disconnect()}});var ie=ns(),$e=T(ie);Ei($e,n=>x(N,n),()=>l(N));var oe=q($e,2),xe=q(T(oe),2),gi=T(xe,!0);w(xe),w(oe);var se=q(oe,2),Re=T(se),Ye=q(Re,2),ae=q(Ye,2),re=T(ae),vi=T(re);w(re);var Xe=q(re,2),pi=q(Xe,2);w(ae);var We=q(ae,2),Ot=T(We);let Fe;var mi=q(Ot,2);{var bi=n=>{var o=Wo(),c=T(o),u=q(T(c),2),p=T(u);St(p,17,()=>l(G),E=>E.type,(E,O)=>{var A=Ro(),z=T(A),Y=q(z,2),Q=T(Y,!0);w(Y),w(A),U(nt=>{he(A,"title",`${l(O).count} visible`),fe(z,`background: ${nt??""}`),F(Q,l(O).label)},[()=>Me(l(O).type).color]),D(E,A)});var y=q(p,2);{var _=E=>{var O=Yo();D(E,O)};it(y,E=>{l(G).length===0&&E(_)})}w(u),w(c);var I=q(c,2),C=q(T(I),2);St(C,17,()=>k,E=>E.kind,(E,O)=>{var A=Xo(),z=T(A),Y=q(z,2),Q=T(Y,!0);w(Y),w(A),U(()=>{fe(z,`background: ${on[l(O).kind]??""}`),F(Q,l(O).label)}),D(E,A)}),w(I),w(o),D(n,o)};it(mi,n=>{l(kt)&&n(bi)})}w(We),w(se);var qt=q(se,2);let Ge;var le=T(qt),yi=T(le);{var ki=n=>{var o=Ko(),c=ht(o),u=T(c);w(c);var p=q(c,2),y=T(p,!0);w(p);var _=q(p,2);{var I=X=>{var W=Fo(),V=T(W,!0);w(W),U(()=>F(V,l(R).preview)),D(X,W)},C=ot(()=>ii(l(R)));it(_,X=>{l(C)&&X(I)})}var E=q(_,2);{var O=X=>{var W=Zo();St(W,21,()=>l(R).details.slice(0,4),V=>`${V.label}:${V.value}`,(V,ut)=>{var wt=Go(),mt=T(wt),de=T(mt,!0);w(mt);var $t=q(mt,2),Si=T($t,!0);w($t),w(wt),U(()=>{F(de,l(ut).label),F(Si,l(ut).value)}),D(V,wt)}),w(W),D(X,W)};it(E,X=>{l(R).details?.length&&X(O)})}var A=q(E,2),z=T(A);{var Y=X=>{var W=Ho();ct("click",W,()=>l(R).parentId&&dt(l(R).parentId)),D(X,W)},Q=ot(()=>si(l(R)));it(z,X=>{l(Q)&&X(Y)})}var nt=q(z,2);St(nt,17,()=>at(l(R).id).slice(0,Dt(l(R))),X=>X.id,(X,W)=>{var V=Bo(),ut=T(V),wt=T(ut,!0);w(ut);var mt=q(ut,2),de=T(mt,!0);w(mt),w(V),U($t=>{F(wt,$t),F(de,l(W).label)},[()=>De(l(W).kind)]),ct("click",V,()=>dt(l(W).id)),D(X,V)});var gt=q(nt,2);{var It=X=>{var W=Uo(),V=T(W);w(W),U(ut=>F(V,`+${ut??""} more`),[()=>at(l(R).id).length-Dt(l(R))]),D(X,W)},ce=ot(()=>at(l(R).id).length>Dt(l(R)));it(gt,X=>{l(ce)&&X(It)})}w(A),U((X,W)=>{F(u,`${X??""}${l(R).sublabel?` • ${l(R).sublabel}`:""}`),F(y,W)},[()=>De(l(R).kind),()=>ni(l(R))]),D(n,o)},Mi=n=>{var o=Jo(),c=q(ht(o),4),u=T(c);w(c);var p=q(c,4);Pi(p);var y=q(p,2),_=T(y);{var I=A=>{var z=jo();D(A,z)},C=ot(()=>l(Mt).trim().length===0),E=A=>{var z=Vo();D(A,z)},O=A=>{var z=Yt(),Y=ht(z);St(Y,17,()=>l(zt),Q=>Q.id,(Q,nt)=>{var gt=Qo(),It=T(gt),ce=T(It,!0);w(It);var X=q(It,2),W=T(X);w(X),w(gt),U(V=>{he(gt,"title",l(nt).label),F(ce,l(nt).label),F(W,`${V??""} • ${l(nt).counts?.aspects??0??""} aspects • ${l(nt).counts?.attributes??0??""} attributes`)},[()=>Ie(_t(l(nt).entityType))]),ct("click",gt,()=>dt(l(nt).id)),D(Q,gt)}),D(A,z)};it(_,A=>{l(C)?A(I):l(zt).length===0?A(E,1):A(O,-1)})}w(y),U(A=>F(u,`${A??""} selectable entities`),[()=>l(Z).filter(A=>A.kind==="entity").length]),ct("keydown",p,fi),zi(p,()=>l(Mt),A=>x(Mt,A)),D(n,o)};it(yi,n=>{l(R)?n(ki):n(Mi,-1)})}w(le);var Ze=q(le,2),_i=T(Ze);{var Ii=n=>{var o=ts(),c=ht(o),u=T(c,!0);w(c);var p=q(c,2),y=T(p,!0);w(p),U((_,I)=>{F(u,_),F(y,I)},[()=>oi(l(R)),()=>di(l(R).id)]),D(n,o)},wi=n=>{var o=es(),c=q(ht(o),2),u=T(c);w(c),U(()=>F(u,`${l(zt).length??""} results`)),D(n,o)};it(_i,n=>{l(R)?n(Ii):n(wi,-1)})}w(Ze),w(qt),w(ie),U(n=>{F(gi,l(yn)),F(vi,`${l(ye)??""}%`),Fe=me(Ot,1,"legend-toggle svelte-c2qg3z",null,Fe,{"legend-toggle-open":l(kt)}),he(Ot,"aria-expanded",l(kt)),Ge=me(qt,1,"node-popover svelte-c2qg3z",null,Ge,{selected:l(R)?l(H)===l(R).id:!1,"attribute-popover":l(R)?.kind==="attribute","entity-navigator-popover":!l(R)}),fe(qt,n)},[()=>l(R)?ri(l(R)):li()]),ct("click",Re,Ee),ct("click",Ye,Pe),ct("click",Xe,()=>At(1/1.3)),ct("click",pi,()=>At(1.3)),ct("click",Ot,()=>x(kt,!l(kt))),D(t,ie),un()}Ni(["click","keydown"]);var os=$('<div class="ontology-dashboard svelte-1p7cxtr"><!></div>');function ss(t,e){const i=dn(e,"agentId",3,"default");var s=os(),a=T(s);is(a,{get agentId(){return i()}}),w(s),D(t,s)}var as=$('<div class="unified-main svelte-1vrq4s9"><!></div>'),rs=$('<div class="unified-main constellation-full svelte-1vrq4s9"><!></div>'),ls=$('<div class="unified-memory svelte-1vrq4s9"><div class="tab-header svelte-1vrq4s9"><div class="tab-header-left svelte-1vrq4s9"><span class="tab-header-title svelte-1vrq4s9">ONTOLOGY</span> <span class="tab-header-sep svelte-1vrq4s9" aria-hidden="true"></span> <span class="tab-header-count svelte-1vrq4s9">CORTEX INDEX -> CONSTELLATION</span></div> <div class="unified-actions svelte-1vrq4s9"><!> <!></div></div> <div><!></div></div>');function cs(t,e){cn(e,!0);const i=new Set(["cortex","constellation"]);function s(){if(typeof window>"u")return"cortex";const b=window.location.hash.replace("#","").split("/");return b[0]!=="cortex-memory"&&b[0]!=="ontology"?"cortex":b[1]&&i.has(b[1])?b[1]:"cortex"}let a=B(Tt(s()));Wt(()=>{if(typeof window>"u")return;const v=l(a)==="cortex"?"cortex-memory":"cortex-memory/constellation";window.location.hash!==`#${v}`&&Ci(`#${v}`,{})}),Wt(()=>{if(typeof window>"u")return;const v=()=>{const b=s();b!==l(a)&&x(a,b,!0)};return window.addEventListener("hashchange",v),()=>window.removeEventListener("hashchange",v)});var r=ls(),d=T(r),h=q(T(d),2),f=T(h);{let v=ot(()=>`tab-switch ${l(a)==="cortex"?"tab-switch-active":""}`);Ue(f,{variant:"outline",size:"sm",get class(){return l(v)},onclick:()=>x(a,"cortex"),children:(b,N)=>{He();var L=Be("CORTEX");D(b,L)},$$slots:{default:!0}})}var g=q(f,2);{let v=ot(()=>`tab-switch ${l(a)==="constellation"?"tab-switch-active":""}`);Ue(g,{variant:"outline",size:"sm",get class(){return l(v)},onclick:()=>x(a,"constellation"),children:(b,N)=>{He();var L=Be("CONSTELLATION");D(b,L)},$$slots:{default:!0}})}w(h),w(d);var m=q(d,2);let M;var S=T(m);{var k=v=>{var b=as(),N=T(b);Ri(N,{get memories(){return e.memories},get agentId(){return e.agentId},embedded:!0}),w(b),D(v,b)},P=v=>{var b=rs(),N=T(b);ss(N,{get agentId(){return e.agentId}}),w(b),D(v,b)};it(S,v=>{l(a)==="cortex"?v(k):v(P,-1)})}w(m),w(r),U(()=>M=me(m,1,"unified-body svelte-1vrq4s9",null,M,{"unified-body-flush":l(a)==="constellation"})),D(t,r),un()}var ds=$('<div class="cortex-content svelte-10uk01t"><!></div>'),us=$('<div class="cortex-error svelte-10uk01t"> </div>'),hs=$('<div class="cortex-loading svelte-10uk01t">Loading apps...</div>'),fs=$('<div class="cortex-content svelte-10uk01t"><!></div>'),gs=$('<div class="cortex-error svelte-10uk01t"> </div>'),vs=$('<div class="cortex-loading svelte-10uk01t">Loading tasks...</div>'),ps=$('<div class="cortex-content svelte-10uk01t"><!></div>'),ms=$('<div class="cortex-error svelte-10uk01t"> </div>'),bs=$('<div class="cortex-loading svelte-10uk01t">Loading troubleshooter...</div>'),ys=$('<div class="cortex-content svelte-10uk01t"><!></div>'),ks=$('<div class="cortex-tab svelte-10uk01t"><!></div>');function Es(t,e){var i=ks(),s=T(i);{var a=f=>{var g=ds(),m=T(g);cs(m,{get memories(){return e.memories},get agentId(){return e.agentId},get onopenglobalsimilar(){return e.onopenglobalsimilar}}),w(g),D(f,g)},r=f=>{var g=fs(),m=T(g);ge(m,()=>ue(()=>import("./Bgfo4PtB.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]),import.meta.url),M=>{var S=hs();D(M,S)},(M,S)=>{var k=Yt(),P=ht(k);ve(P,()=>l(S).default,(v,b)=>{b(v,{})}),D(M,k)},(M,S)=>{var k=us(),P=T(k);w(k),U(()=>F(P,`Failed to load: ${l(S)?.message??"unknown"??""}`)),D(M,k)}),w(g),D(f,g)},d=f=>{var g=ps(),m=T(g);ge(m,()=>ue(()=>import("./uGXfJGab.js"),__vite__mapDeps([15,1,2,3,4,5,6,16,17,18,19,20,10,21,22,23,24,25,8,26]),import.meta.url),M=>{var S=vs();D(M,S)},(M,S)=>{var k=Yt(),P=ht(k);ve(P,()=>l(S).default,(v,b)=>{b(v,{})}),D(M,k)},(M,S)=>{var k=gs(),P=T(k);w(k),U(()=>F(P,`Failed to load: ${l(S)?.message??"unknown"??""}`)),D(M,k)}),w(g),D(f,g)},h=f=>{var g=ys(),m=T(g);ge(m,()=>ue(()=>import("./B2BgQFYa.js"),__vite__mapDeps([27,1,2,3,4,5,6,23,24,25,7,10,28]),import.meta.url),M=>{var S=bs();D(M,S)},(M,S)=>{var k=Yt(),P=ht(k);ve(P,()=>l(S).default,(v,b)=>{b(v,{})}),D(M,k)},(M,S)=>{var k=ms(),P=T(k);w(k),U(()=>F(P,`Failed to load: ${l(S)?.message??"unknown"??""}`)),D(M,k)}),w(g),D(f,g)};it(s,f=>{e.activeTab==="cortex-memory"?f(a):e.activeTab==="cortex-apps"?f(r,1):e.activeTab==="cortex-tasks"?f(d,2):e.activeTab==="cortex-troubleshooter"&&f(h,3)})}w(i),D(t,i)}export{Es as default};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./BUA1YtJe.js","./C0do9GyP.js","../assets/vendor-ui.BHIBfuhK.css","./wGLFQbYw.js","./CppT_YPm.js","./PPVm8Dsz.js","../assets/2.BZxc-RrJ.css","./CHlKOtDl.js","./CHYMOq8T.js","./CeRwBNwS.js","./BWiYF5o8.js","./DPPwHjfF.js","./BUzi7bjf.js","./DSXxpXE5.js","../assets/OsTab.D_wVYC7y.css","./CP2U8F92.js","./Be-9F94Y.js","./De2fGr_7.js","./D8Qbdk8r.js","./Xh1zEpvg.js","./wjJIHI18.js","./Bhw36AiA.js","./DumN1mSN.js","./MEW85V0A.js","./JaJ5Vuyt.js","./D9LU5nDF.js","../assets/CortexTasksPanel.CYIUqiAj.css","./Di__debW.js","../assets/TroubleshooterPanel.CS4J0zfS.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as ue}from"./PPVm8Dsz.js";import{p as cn,g as dn,o as B,e as Tt,Q as Wt,i as l,q as Ti,v as x,j as T,G as Ei,t as q,l as w,k as it,y as U,z as F,B as me,D as he,O as fe,M as ct,b as D,d as un,u as ot,A as St,f as ht,X as Pi,I as zi,m as $,c as Yt,N as Ni,w as He,x as Be,T as ge,h as ve}from"./C0do9GyP.js";import{r as Ci}from"./DyneFDnl.js";import{a2 as Li,B as Ue}from"./wGLFQbYw.js";import{f as Ai,a as Di,b as Oi,g as qi,c as $i,e as xi}from"./qiR1fnXB.js";import Ri from"./CBc96c8a.js";class Yi{cellSize;grid=new Map;lastHash=0;constructor(e=160){this.cellSize=e}rebuild(e){const i=this.computeHash(e);if(i===this.lastHash)return!1;this.lastHash=i,this.grid.clear();for(const s of e){const a=this.keyFor(s.x,s.y),r=this.grid.get(a)??[];r.push(s),this.grid.set(a,r)}return!0}queryPoint(e,i){const s=Math.floor(e/this.cellSize),a=Math.floor(i/this.cellSize);for(let r=-1;r<=1;r++)for(let d=-1;d<=1;d++){const h=this.grid.get(`${s+r},${a+d}`);if(h)for(let f=h.length-1;f>=0;f--){const g=h[f];if(g&&this.hitTest(g,e,i))return g}}return null}keyFor(e,i){return`${Math.floor(e/this.cellSize)},${Math.floor(i/this.cellSize)}`}hitTest(e,i,s){const a=Math.max(e.size*.5,4);if(e.shape==="rect")return Math.abs(i-e.x)<=a&&Math.abs(s-e.y)<=a;const r=i-e.x,d=s-e.y;return r*r+d*d<=a*a}computeHash(e){let i=e.length;for(const s of e){let a=0;for(let r=0;r<s.id.length;r++)a=(a<<5)-a+s.id.charCodeAt(r)|0;i=i*31+a|0,i=i*31+Math.round(s.x*10)|0,i=i*31+Math.round(s.y*10)|0}return i}}class Xi{constructor(e,i,s,a){this.canvas=e,this.viewport=i,this.spatial=s,this.callbacks=a,this.pointerEventsSupported="onpointerdown"in e,this.pointerEventsSupported?(e.addEventListener("pointerdown",this.pointerDown),e.addEventListener("pointermove",this.pointerMove),e.addEventListener("pointerup",this.pointerUp),e.addEventListener("pointercancel",this.pointerCancel),e.addEventListener("lostpointercapture",this.lostPointerCapture)):(e.addEventListener("mousedown",this.mouseDown),e.addEventListener("mousemove",this.mouseMove),e.addEventListener("mouseup",this.mouseUp),e.addEventListener("mouseleave",this.mouseUp)),e.addEventListener("click",this.click),e.addEventListener("dblclick",this.doubleClick),e.addEventListener("wheel",this.wheel,{passive:!1})}canvas;viewport;spatial;callbacks;isPanning=!1;draggingNode=null;didDrag=!1;lastX=0;lastY=0;activePointerId=null;currentHoverId=null;posHistory=[];pointerEventsSupported;pointerDown=this.onPointerDown.bind(this);pointerMove=this.onPointerMove.bind(this);pointerUp=this.onPointerUp.bind(this);pointerCancel=this.onPointerCancel.bind(this);lostPointerCapture=this.onLostPointerCapture.bind(this);mouseDown=this.onMouseDown.bind(this);mouseMove=this.onMouseMove.bind(this);mouseUp=this.onMouseUp.bind(this);click=this.onClick.bind(this);doubleClick=this.onDoubleClick.bind(this);wheel=this.onWheel.bind(this);destroy(){this.pointerEventsSupported?(this.canvas.removeEventListener("pointerdown",this.pointerDown),this.canvas.removeEventListener("pointermove",this.pointerMove),this.canvas.removeEventListener("pointerup",this.pointerUp),this.canvas.removeEventListener("pointercancel",this.pointerCancel),this.canvas.removeEventListener("lostpointercapture",this.lostPointerCapture)):(this.canvas.removeEventListener("mousedown",this.mouseDown),this.canvas.removeEventListener("mousemove",this.mouseMove),this.canvas.removeEventListener("mouseup",this.mouseUp),this.canvas.removeEventListener("mouseleave",this.mouseUp)),this.canvas.removeEventListener("click",this.click),this.canvas.removeEventListener("dblclick",this.doubleClick),this.canvas.removeEventListener("wheel",this.wheel)}getDraggingNode(){return this.draggingNode}canvasPoint(e){const i=this.canvas.getBoundingClientRect();return{x:e.clientX-i.left,y:e.clientY-i.top}}nodeAt(e,i){const s=this.viewport.screenToWorld(e,i);return this.spatial.queryPoint(s.x,s.y)}beginInteraction(e){const i=this.canvasPoint(e),s=this.nodeAt(i.x,i.y);if(this.lastX=i.x,this.lastY=i.y,this.posHistory=[{...i,t:performance.now()}],this.didDrag=!1,s){this.draggingNode=s,s.fx=s.x,s.fy=s.y,this.callbacks.onNodeDragStart(s),this.canvas.style.cursor="grabbing";return}this.isPanning=!0,this.canvas.style.cursor="grabbing"}moveInteraction(e){const i=this.canvasPoint(e);if(this.draggingNode){const r=this.viewport.screenToWorld(i.x,i.y);this.draggingNode.x=r.x,this.draggingNode.y=r.y,this.draggingNode.fx=r.x,this.draggingNode.fy=r.y,this.didDrag=!0,this.callbacks.onRequestRender();return}if(this.isPanning){this.viewport.pan(i.x-this.lastX,i.y-this.lastY),this.lastX=i.x,this.lastY=i.y,this.didDrag=!0;const r=performance.now();this.posHistory.push({...i,t:r}),this.posHistory.length>4&&this.posHistory.shift(),this.callbacks.onRequestRender();return}const s=this.nodeAt(i.x,i.y),a=s?.id??null;a!==this.currentHoverId&&(this.currentHoverId=a,this.callbacks.onNodeHover(s),this.canvas.style.cursor=s?"grab":"default",this.callbacks.onRequestRender())}endInteraction(){if(this.draggingNode){const s=this.draggingNode;s.fx=null,s.fy=null,this.draggingNode=null,this.callbacks.onNodeDragEnd(s),this.canvas.style.cursor=this.currentHoverId?"grab":"default";return}if(!this.isPanning)return;this.isPanning=!1;const e=this.posHistory[0],i=this.posHistory[this.posHistory.length-1];if(e&&i){const s=i.t-e.t;s>0&&s<200&&this.viewport.releaseWithVelocity((i.x-e.x)/s*16,(i.y-e.y)/s*16)}this.canvas.style.cursor="default",this.callbacks.onRequestRender()}onPointerDown(e){!e.isPrimary||e.button!==0||(e.preventDefault(),this.activePointerId=e.pointerId,this.canvas.setPointerCapture(e.pointerId),this.beginInteraction(e))}onPointerMove(e){e.isPrimary&&(this.activePointerId!==null&&e.pointerId!==this.activePointerId||this.moveInteraction(e))}onPointerUp(e){this.activePointerId===e.pointerId&&(this.releasePointer(e.pointerId),this.endInteraction())}onPointerCancel(e){this.activePointerId===e.pointerId&&(this.releasePointer(e.pointerId),this.endInteraction())}onLostPointerCapture(e){this.activePointerId===e.pointerId&&(this.activePointerId=null,this.endInteraction())}releasePointer(e){this.activePointerId=null,this.canvas.hasPointerCapture(e)&&this.canvas.releasePointerCapture(e)}onMouseDown(e){e.button===0&&this.beginInteraction(e)}onMouseMove(e){this.moveInteraction(e)}onMouseUp(){this.endInteraction()}onClick(e){if(this.didDrag)return;const i=this.canvasPoint(e);this.callbacks.onNodeClick(this.nodeAt(i.x,i.y))}onDoubleClick(e){const i=this.canvasPoint(e);this.callbacks.onNodeDoubleClick(this.nodeAt(i.x,i.y))}onWheel(e){e.preventDefault();const i=this.canvasPoint(e);if(Math.abs(e.deltaX)>Math.abs(e.deltaY))this.viewport.pan(-e.deltaX,0);else{const s=Wi(e);this.viewport.zoomImmediate(Math.max(.86,Math.min(1.16,Math.exp(-s*.0011))),i.x,i.y)}this.callbacks.onRequestRender()}}function Wi(t){return t.deltaMode===WheelEvent.DOM_DELTA_LINE?t.deltaY*16:t.deltaMode===WheelEvent.DOM_DELTA_PAGE?t.deltaY*400:t.deltaY}const xt=new Map,Fi={entity:"/constellation-assets/entity-icon.png",aspect:"/constellation-assets/aspect-icon.png",attribute:"/constellation-assets/attribute-icon.png",memory:"/constellation-assets/attribute-icon.png"},Ke=new Map;function Gi(t,e,i,s,a,r,d,h,f){t.clearRect(0,0,a,r),Zi(t,i,s,a,r,d,h,f),ji(t,e,s,a,r,d),Ki(t,e,s,a,r,d,f)}function Zi(t,e,i,s,a,r,d,h){const g=r.selectedId!==null&&r.dimProgress>0;xt.clear();for(const m of e){const M=d.get(m.sourceId),S=d.get(m.targetId);if(!M||!S)continue;const k=Ui(m,i,d);if(!k||k.startX<-120&&k.endX<-120||k.startX>s+120&&k.endX>s+120||k.startY<-120&&k.endY<-120||k.startY>a+120&&k.endY>a+120)continue;const P=h.edges[m.kind]??h.edges.about,v=Hi(m,r);if(!Qi(m,i.zoom,v))continue;const b=!g||v,N={...k,color:P.color,alpha:(b?Math.min(P.alpha*(v?1.25:1),.85):P.alpha*(1-r.dimProgress*.92))*to(m,i.zoom,v),width:P.width*eo(m,i.zoom,v)*(v?1.1:1),dashed:m.dashed??!1,connected:b,emphasized:v},L=`${N.color}|${N.alpha.toFixed(3)}|${N.width}|${N.dashed}`,G=xt.get(L)??[];G.push(N),xt.set(L,G)}t.save();for(const m of xt.values()){const M=m[0];M&&Bi(t,m,M)}t.restore()}function Hi(t,e){const i=e.selectedId??e.hoveredId;if(!i||t.visualOnly||t.kind==="about")return!1;const s=t.sourceId===i||e.relatedIds.has(t.sourceId),a=t.targetId===i||e.relatedIds.has(t.targetId);return s&&a}function Bi(t,e,i){if(e.some(a=>a.emphasized)){t.save(),t.globalAlpha=i.alpha*.18,t.strokeStyle=i.color,t.lineWidth=i.width*2.5,t.lineCap="round",t.setLineDash(i.dashed?[7,7]:[]),t.beginPath();for(const a of e)a.emphasized&&(t.moveTo(a.startX,a.startY),t.lineTo(a.endX,a.endY));t.stroke(),t.restore()}t.globalAlpha=i.alpha,t.strokeStyle=i.color,t.lineWidth=i.width,t.lineCap="round",t.setLineDash(i.dashed?[7,7]:[]),t.beginPath();for(const a of e)t.moveTo(a.startX,a.startY),t.lineTo(a.endX,a.endY);t.stroke()}function Ui(t,e,i){const s=i.get(t.sourceId),a=i.get(t.targetId);if(!s||!a)return null;const r=e.worldToScreen(s.x,s.y),d=e.worldToScreen(a.x,a.y);return Math.hypot(d.x-r.x,d.y-r.y)<1?null:{startX:r.x,startY:r.y,endX:d.x,endY:d.y}}function Ki(t,e,i,s,a,r,d){for(const f of e){const g=i.worldToScreen(f.x,f.y),m=f.size*i.zoom,M=m*(f.iconScale??1),S=Math.max(M,3);if(g.x+S<-80||g.x-S>s+80||g.y+S<-80||g.y-S>a+80)continue;const k=f.id===r.selectedId,P=f.id===r.hoveredId,v=r.relatedIds.has(f.id),b=!1;if(!hn(f,i.zoom,k||P||v||b))continue;const N=r.selectedId!==null&&!k&&!v,L=k||P||b?"selected":v?"related":N?"dim":"normal",G=f.kind==="attribute"||f.kind==="aspect"?.34:.12,K=(L==="dim"?Math.max(G,1-r.dimProgress*.88):1)*Ji(f,i.zoom,k||P||v||b);if(t.save(),t.globalAlpha=K,M<6&&!k&&!P){no(t,g.x,g.y,Math.max(2.2,M*.45),L==="dim"?f.dimColor:f.color,f.kind,L),t.restore();continue}if(f.kind==="entity"&&!N&&!k&&!v){const st=t.createRadialGradient(g.x,g.y,M*.6,g.x,g.y,M*2.2);st.addColorStop(0,`${f.color}20`),st.addColorStop(1,"rgba(0,0,0,0)"),t.fillStyle=st,t.beginPath(),t.arc(g.x,g.y,M*2.2,0,Math.PI*2),t.fill()}io(t,g.x,g.y,M,k?d.selection:N?f.dimColor:f.color,k||v?d.selection:f.color,f.shape??"circle",f.kind,f.sprite,L),!(N&&f.kind==="attribute"&&!P&&!b)&&uo(f,i.zoom,k,P,v||b,m)&&ho(t,f.label,g.x,g.y+M*.5+4,k?d.selection:v||b?f.color:N?d.textDim:d.text,d.labelShadow,f.kind==="memory"?8:10,i.zoom),t.restore()}}function ji(t,e,i,s,a,r){if(r.selectedId!==null)return;const d=180;t.save();for(const h of e){if(h.kind!=="entity")continue;const f=Math.max(0,Math.floor(h.counts?.aspects??0)),g=Math.max(0,Math.floor(h.counts?.attributes??0));if(f===0&&g===0)continue;const m=i.worldToScreen(h.x,h.y),M=Math.max(28,Math.min(92,(h.systemRadius??h.size*5)*i.zoom/4));m.x+M<-d||m.x-M>s+d||m.y+M<-d||m.y-M>a+d||Vi(t,m.x,m.y,M,f,g,h.color,i.zoom)}t.restore()}function Vi(t,e,i,s,a,r,d,h){const f=Math.min(3,Math.max(1,Math.ceil(a/5))),g=Math.min(1,Math.sqrt(r)/13),m=t.createRadialGradient(e,i,s*.22,e,i,s*1.3);m.addColorStop(0,`rgba(96, 165, 250, ${.04+g*.04})`),m.addColorStop(.5,`rgba(96, 165, 250, ${.03+g*.06})`),m.addColorStop(1,"rgba(96, 165, 250, 0)"),t.fillStyle=m,t.beginPath(),t.arc(e,i,s*1.3,0,Math.PI*2),t.fill(),t.strokeStyle="rgba(96, 165, 250, 0.18)",t.lineWidth=Math.max(.8,h*1.2),t.setLineDash([Math.max(3,s*.04),Math.max(8,s*.12)]);for(let S=0;S<f;S++)t.beginPath(),t.arc(e,i,s*(.56+S*.26),0,Math.PI*2),t.stroke();t.setLineDash([]);const M=Math.min(18,Math.max(3,a));for(let S=0;S<M;S++){const k=-Math.PI/2+Math.PI*2*S/M,P=s*(.68+S%f*.24),v=e+Math.cos(k)*P,b=i+Math.sin(k)*P;t.save(),t.translate(v,b),t.rotate(k+Math.PI/4),t.fillStyle=S<a?d:"rgba(96, 165, 250, 0.32)",t.globalAlpha=S<a?.65:.28;const N=Math.max(2.6,Math.min(6,s*.05));t.fillRect(-N/2,-N/2,N,N),S<a&&(t.globalAlpha=.4,t.fillStyle="rgba(255, 255, 255, 0.7)",t.fillRect(-N*.25,-N*.25,N*.5,N*.5)),t.restore()}r>0&&(t.strokeStyle=`rgba(167, 139, 250, ${.08+g*.18})`,t.lineWidth=Math.max(1.2,h*1.5),t.beginPath(),t.arc(e,i,s*1.04,-Math.PI/2,-Math.PI/2+Math.PI*2*g),t.stroke())}function hn(t,e,i=!1){return i||t.kind==="entity"?!0:(t.kind==="aspect"||t.kind==="attribute"||t.kind==="memory",e>=.09)}function Qi(t,e,i=!1){return i?!0:t.kind==="mentions"?e>=.18:e>=.09}function Ji(t,e,i=!1){return i||e>=.34||t.kind==="entity"?1:t.kind==="aspect"?.88:t.kind==="attribute"?.68:t.kind==="memory"?.55:.68}function to(t,e,i=!1){return i||e>=.34?1:t.kind==="about"?.52:t.kind==="has_aspect"?.82:t.kind==="has_attribute"?.65:t.kind==="supports"?.55:.6}function eo(t,e,i=!1){return i||e>=.34?1:t.kind==="about"?.9:t.kind==="supports"?.88:.92}function no(t,e,i,s,a,r,d){if(t.save(),t.translate(e,i),d!=="dim"){const h=t.createRadialGradient(0,0,s*.5,0,0,s*2.8);h.addColorStop(0,a),h.addColorStop(1,"rgba(0,0,0,0)"),t.fillStyle=h,t.globalAlpha=d==="selected"?.45:d==="related"?.32:.18,t.beginPath(),t.arc(0,0,s*2.8,0,Math.PI*2),t.fill()}t.globalAlpha=d==="dim"?.55:1,t.fillStyle=a,t.strokeStyle=d==="selected"?"rgba(241, 245, 249, 0.96)":d==="related"?"rgba(180, 230, 255, 0.9)":a,t.lineWidth=d==="selected"?1.6:d==="related"?1.2:.8,t.beginPath(),r==="attribute"||r==="memory"?(t.rotate(Math.PI/4),t.rect(-s,-s,s*2,s*2)):r==="aspect"?t.rect(-s,-s,s*2,s*2):Et(t,0,0,s*1.15),t.fill(),t.stroke(),(d==="selected"||d==="related")&&(t.rotate(r==="attribute"||r==="memory"?0:Math.PI/4),t.strokeStyle=d==="selected"?"rgba(241, 245, 249, 0.94)":"rgba(125, 211, 252, 0.86)",t.lineWidth=d==="selected"?1.1:.85,t.strokeRect(-s*1.75,-s*1.75,s*3.5,s*3.5)),t.restore()}function io(t,e,i,s,a,r,d,h,f,g){const m=Math.max(s*.5,2),M=oo(h,f);if(M&&m>=4.6){so(t,e,i,m,M,d,g,r);return}if(d==="hex"){ao(t,e,i,m,a,r,g);return}if(d==="rect"){ro(t,e,i,m,a,r,g);return}lo(t,e,i,m,a,r,g)}function oo(t,e){const i=e??Fi[t];if(!i||typeof Image>"u")return null;const s=Ke.get(i);if(s!==void 0)return s?.complete&&s.naturalWidth>0?s:null;const a=new Image;return a.decoding="async",a.src=i,Ke.set(i,a),null}function so(t,e,i,s,a,r,d,h){const g=s*(r==="hex"?3.05:2.72);t.save(),t.imageSmoothingEnabled=!0,t.drawImage(a,e-g/2,i-g/2,g,g),(d==="selected"||d==="related")&&(t.strokeStyle=d==="selected"?"rgba(241, 245, 249, 0.96)":h,t.lineWidth=d==="selected"?1.8:1.25,r==="hex"?Et(t,e,i,s*1.55):r==="rect"?(t.beginPath(),t.rect(e-s*1.15,i-s*1.15,s*2.3,s*2.3)):(t.beginPath(),t.arc(e,i,s*1.12,0,Math.PI*2)),t.stroke()),t.restore()}function ao(t,e,i,s,a,r,d){const h=d==="selected",f=d==="related";if(t.save(),h||f){const m=t.createRadialGradient(e,i,s*.8,e,i,s*2.4);m.addColorStop(0,h?"rgba(255, 255, 255, 0.35)":"rgba(125, 211, 252, 0.22)"),m.addColorStop(1,"rgba(0, 0, 0, 0)"),t.fillStyle=m,t.beginPath(),t.arc(e,i,s*2.4,0,Math.PI*2),t.fill()}t.lineWidth=h?1.9:f?1.55:1.15,t.strokeStyle=h?"rgba(241, 245, 249, 0.96)":f?"rgba(180, 214, 255, 0.88)":"rgba(132, 166, 207, 0.68)",t.fillStyle=d==="dim"?"rgba(4, 14, 31, 0.42)":"rgba(4, 14, 31, 0.84)",Et(t,e,i,s*1.12),t.fill(),t.stroke(),t.strokeStyle=h?"rgba(217, 183, 109, 0.92)":"rgba(166, 124, 58, 0.66)",t.lineWidth=h||f?1.1:.75,Et(t,e,i,s*1.28),t.stroke();const g=t.createRadialGradient(e-s*.28,i-s*.28,1,e,i,s*.74);g.addColorStop(0,h?"rgba(255, 255, 255, 1)":"rgba(220, 238, 255, 0.82)"),g.addColorStop(.3,a),g.addColorStop(.78,h?"rgba(56, 189, 248, 0.76)":"rgba(37, 99, 235, 0.52)"),g.addColorStop(1,d==="dim"?"rgba(2, 6, 23, 0.92)":"rgba(2, 6, 23, 0.82)"),t.fillStyle=g,t.strokeStyle=h?"rgba(241, 245, 249, 0.96)":r,t.lineWidth=h?1.5:f?1.25:.95,Et(t,e,i,s*.72),t.fill(),t.stroke(),t.strokeStyle=h?"rgba(255, 255, 255, 0.92)":"rgba(191, 219, 254, 0.68)",t.lineWidth=h?1.05:.7,fn(t,e,i,s*.52),t.stroke(),t.restore()}function ro(t,e,i,s,a,r,d){const h=d==="selected",f=d==="related";if(t.save(),h||f){const m=t.createRadialGradient(e,i,s*.8,e,i,s*2.2);m.addColorStop(0,h?"rgba(255, 255, 255, 0.3)":"rgba(125, 211, 252, 0.18)"),m.addColorStop(1,"rgba(0, 0, 0, 0)"),t.fillStyle=m,t.beginPath(),t.arc(e,i,s*2.2,0,Math.PI*2),t.fill()}t.fillStyle=d==="dim"?"rgba(5, 18, 40, 0.36)":"rgba(5, 18, 40, 0.78)",t.strokeStyle=h?"rgba(241, 245, 249, 0.96)":f?"rgba(191, 219, 254, 0.86)":"rgba(137, 166, 204, 0.58)",t.lineWidth=h?1.7:f?1.35:.95,t.beginPath(),t.rect(e-s,i-s,s*2,s*2),t.fill(),t.stroke(),t.strokeStyle=h?"rgba(217, 183, 109, 0.9)":"rgba(166, 124, 58, 0.5)",t.lineWidth=h||f?1:.65,co(t,e,i,s);const g=t.createRadialGradient(e-s*.22,i-s*.22,1,e,i,s*.75);g.addColorStop(0,h?"rgba(255, 255, 255, 1)":"rgba(224, 242, 254, 0.72)"),g.addColorStop(.32,a),g.addColorStop(1,d==="dim"?"rgba(30, 41, 59, 0.48)":"rgba(30, 41, 59, 0.72)"),t.fillStyle=g,t.strokeStyle=h?"rgba(241, 245, 249, 0.94)":r,t.lineWidth=h?1.25:.9,fn(t,e,i,s*.62),t.fill(),t.stroke(),t.restore()}function lo(t,e,i,s,a,r,d){const h=d==="selected",f=d==="related";if(t.save(),h||f){const m=t.createRadialGradient(e,i,s*.8,e,i,s*2.2);m.addColorStop(0,h?"rgba(255, 255, 255, 0.3)":"rgba(125, 211, 252, 0.18)"),m.addColorStop(1,"rgba(0, 0, 0, 0)"),t.fillStyle=m,t.beginPath(),t.arc(e,i,s*2.2,0,Math.PI*2),t.fill()}const g=t.createRadialGradient(e-s*.26,i-s*.26,1,e,i,s);g.addColorStop(0,d==="selected"?"rgba(255, 255, 255, 1)":"rgba(240, 249, 255, 0.68)"),g.addColorStop(.35,a),g.addColorStop(1,d==="dim"?"rgba(2, 6, 23, 0.88)":"rgba(2, 6, 23, 0.76)"),t.fillStyle=g,t.strokeStyle=d==="selected"?"rgba(241, 245, 249, 0.94)":r,t.lineWidth=d==="selected"?1.4:d==="related"?1.2:.9,t.beginPath(),t.arc(e,i,s,0,Math.PI*2),t.fill(),t.stroke(),t.restore()}function Et(t,e,i,s){t.beginPath();for(let a=0;a<6;a++){const r=Math.PI/6+Math.PI*2*a/6,d=e+Math.cos(r)*s,h=i+Math.sin(r)*s;a===0?t.moveTo(d,h):t.lineTo(d,h)}t.closePath()}function fn(t,e,i,s){t.beginPath(),t.moveTo(e,i-s),t.lineTo(e+s,i),t.lineTo(e,i+s),t.lineTo(e-s,i),t.closePath()}function co(t,e,i,s){const a=Math.max(s*.42,4),r=s*.12,d=e-s-r,h=e+s+r,f=i-s-r,g=i+s+r;t.beginPath(),t.moveTo(d,f+a),t.lineTo(d,f),t.lineTo(d+a,f),t.moveTo(h-a,f),t.lineTo(h,f),t.lineTo(h,f+a),t.moveTo(h,g-a),t.lineTo(h,g),t.lineTo(h-a,g),t.moveTo(d+a,g),t.lineTo(d,g),t.lineTo(d,g-a),t.stroke()}function uo(t,e,i,s,a,r){return i||s?!0:t.kind==="memory"&&!a?!1:e>.58&&r>3}function ho(t,e,i,s,a,r,d,h){const f=e.length>28?`${e.slice(0,28)}...`:e,g=Math.max(7,d*Math.min(h,1.4));t.font=`${g}px var(--font-mono), monospace`,t.textAlign="center",t.textBaseline="top";const m=t.measureText(f).width+14;t.fillStyle="rgba(2, 6, 23, 0.62)",t.fillRect(i-m/2,s-2,m,g+6),t.strokeStyle="rgba(96, 165, 250, 0.18)",t.lineWidth=.7,t.beginPath(),t.moveTo(i-m/2,s-2),t.lineTo(i+m/2,s-2),t.stroke(),t.fillStyle=r,t.fillText(f,i+1,s+1),t.fillStyle=a,t.fillText(f,i,s)}const je={chargeStrength:-2e3,linkDistance:220,linkStrength:.15,collisionPadding:18,solarPadding:120,solarStrength:.34,preSettleTicks:150,maxActiveTicks:80,maxActiveMs:1e3};class fo{sim=null;opts=je;activeTicks=0;activeStartedAt=0;init(e,i,s={}){this.destroy(),this.opts={...je,...s};const a=tn(i);this.sim=Ai(e).alphaDecay(.025).alphaMin(.001).velocityDecay(.45).force("link",Di(a).id(r=>r.id).distance(r=>go(r,this.opts.linkDistance)).strength(r=>bo(r,this.opts.linkStrength))).force("charge",Oi().strength(r=>this.opts.chargeStrength*po(r))).force("collide",qi(r=>r.size*mo(r)+this.opts.collisionPadding).strength(.74)).force("solar",yo().padding(this.opts.solarPadding).strength(this.opts.solarStrength)).force("x",$i(r=>r.zoneX??0).strength(Je)).force("y",xi(r=>r.zoneY??0).strength(Je)).on("tick.signetBudget",()=>this.enforceBudget()),this.sim.stop(),this.sim.alpha(1);for(let r=0;r<this.opts.preSettleTicks;r++)this.sim.tick();this.restartWithBudget(.22,0)}update(e,i){if(!this.sim)return;this.sim.nodes(e);const s=this.sim.force("link");s&&s.links(tn(i)),this.restartWithBudget(.22,0)}reheat(){this.restartWithBudget(.18,.12)}coolDown(){this.sim?.alphaTarget(0)}pause(){this.sim?.alphaTarget(0),this.sim?.alpha(0),this.sim?.stop()}isActive(){return(this.sim?.alpha()??0)>.001}destroy(){this.sim?.stop(),this.sim=null}restartWithBudget(e,i){this.sim&&(this.activeTicks=0,this.activeStartedAt=nn(),this.sim.alpha(Math.max(this.sim.alpha(),e)).alphaTarget(i).restart())}enforceBudget(){this.sim&&(this.activeTicks+=1,(this.activeTicks>=this.opts.maxActiveTicks||nn()-this.activeStartedAt>=this.opts.maxActiveMs)&&this.pause())}}function go(t,e){const i=Qe(t.source),s=Qe(t.target),a=Math.max(i,s),r=Math.min(Math.max(Ve(t.source),Ve(t.target))*.68+a*190,290);return t.kind==="supports"?64:t.kind==="has_attribute"?115:t.kind==="has_aspect"?Math.max(230+r,vo(t.target)+170):t.kind==="contains"?170:t.kind==="about"?260+r:t.kind==="updates"||t.kind==="extends"?78:e}function Ve(t){return typeof t=="string"?0:t.size}function Qe(t){return typeof t=="string"?0:t.mass??0}function vo(t){return typeof t=="string"?0:t.systemRadius??t.size}function po(t){return t.kind==="entity"?.72+(t.mass??0)**1.18*8.2:t.kind==="aspect"?Math.min(1.16,.78+t.size/160):.62}function mo(t){return t.kind==="entity"?.62+(t.mass??0)**1.08*1.65:t.kind==="aspect"?.58:.5}function bo(t,e){return t.kind==="supports"?.34:t.kind==="has_attribute"?.44:t.kind==="has_aspect"?.34:t.kind==="contains"?.16:t.kind==="about"?Math.max(.06,Math.min(t.strength??e,.28)):t.kind==="updates"||t.kind==="extends"?.3:e}function Je(t){return t.kind==="entity"&&t.zoneX!==void 0&&t.zoneY!==void 0?.085:.028}function tn(t){return t.filter(e=>!e.visualOnly).map(e=>({...e,source:e.sourceId,target:e.targetId}))}function yo(){let t=[],e=120,i=.34;const s=(a=>{const r=t.filter(d=>d.kind==="entity");for(let d=0;d<r.length;d++){const h=r[d];if(h)for(let f=d+1;f<r.length;f++){const g=r[f];if(!g)continue;const m=en(h)+en(g)+e;let M=(g.x??0)-(h.x??0),S=(g.y??0)-(h.y??0),k=Math.hypot(M,S);if(k>=m)continue;if(k<.001){const K=((d+1)*12.9898+(f+1)*78.233)%(Math.PI*2);M=Math.cos(K),S=Math.sin(K),k=1}const P=(m-k)/k*i*a,v=1+(h.mass??0)*3,b=1+(g.mass??0)*3,N=v+b,L=b/N,G=v/N;h.vx=(h.vx??0)-M*P*L,h.vy=(h.vy??0)-S*P*L,g.vx=(g.vx??0)+M*P*G,g.vy=(g.vy??0)+S*P*G}}});return s.initialize=a=>{t=a},s.padding=a=>(e=a,s),s.strength=a=>(i=a,s),s}function en(t){return Math.max(t.systemRadius??t.size,t.size*2)}function nn(){return typeof performance>"u"?Date.now():performance.now()}class rt{panX;panY;zoom;velocityX=0;velocityY=0;friction=.92;targetZoom;zoomSpring=.075;zoomAnchorX=0;zoomAnchorY=0;targetWorldX=null;targetWorldY=null;targetScreenX=0;targetScreenY=0;panLerp=.075;static MIN_ZOOM=.1;static MAX_ZOOM=6;constructor(e=0,i=0,s=1){this.panX=e,this.panY=i,this.zoom=Rt(s,rt.MIN_ZOOM,rt.MAX_ZOOM),this.targetZoom=this.zoom}worldToScreen(e,i){return{x:e*this.zoom+this.panX,y:i*this.zoom+this.panY}}screenToWorld(e,i){return{x:(e-this.panX)/this.zoom,y:(i-this.panY)/this.zoom}}pan(e,i){this.panX+=e,this.panY+=i,this.clearFocusTarget()}releaseWithVelocity(e,i){this.velocityX=e,this.velocityY=i}zoomImmediate(e,i,s){const a=this.screenToWorld(i,s);this.zoom=Rt(this.zoom*e,rt.MIN_ZOOM,rt.MAX_ZOOM),this.targetZoom=this.zoom,this.panX=i-a.x*this.zoom,this.panY=s-a.y*this.zoom,this.clearFocusTarget()}zoomTo(e,i,s){this.targetZoom=Rt(e,rt.MIN_ZOOM,rt.MAX_ZOOM),this.zoomAnchorX=i,this.zoomAnchorY=s,this.clearFocusTarget()}fitToNodes(e,i,s,a={}){if(e.length===0||i<=0||s<=0)return;let r=Number.POSITIVE_INFINITY,d=Number.NEGATIVE_INFINITY,h=Number.POSITIVE_INFINITY,f=Number.NEGATIVE_INFINITY;for(const P of e){const v=P.size*.5;r=Math.min(r,P.x-v),d=Math.max(d,P.x+v),h=Math.min(h,P.y-v),f=Math.max(f,P.y+v)}const g=a.padding??.14,m=Math.max((d-r)*(1+g*2),1),M=Math.max((f-h)*(1+g*2),1),S=(r+d)/2,k=(h+f)/2;this.targetZoom=Rt(Math.min(i/m,s/M,a.maxZoom??1.8),rt.MIN_ZOOM,rt.MAX_ZOOM),this.targetWorldX=S,this.targetWorldY=k,this.targetScreenX=i/2,this.targetScreenY=s/2}centerOn(e,i,s,a){this.targetWorldX=e,this.targetWorldY=i,this.targetScreenX=s/2,this.targetScreenY=a/2,this.targetZoom=this.zoom}tick(){let e=!1;Math.abs(this.velocityX)>.5||Math.abs(this.velocityY)>.5?(this.panX+=this.velocityX,this.panY+=this.velocityY,this.velocityX*=this.friction,this.velocityY*=this.friction,e=!0):(this.velocityX=0,this.velocityY=0);const i=this.targetWorldX,s=this.targetWorldY;if(i!==null&&s!==null){const a=this.stepZoom(),r=this.targetScreenX-i*this.zoom,d=this.targetScreenY-s*this.zoom,h=this.stepPan(r,d);return!a||!h?e=!0:this.clearFocusTarget(),e}if(!this.stepZoom()){const a=this.screenToWorld(this.zoomAnchorX,this.zoomAnchorY);this.panX=this.zoomAnchorX-a.x*this.zoom,this.panY=this.zoomAnchorY-a.y*this.zoom,e=!0}return e}stepZoom(){const e=this.targetZoom-this.zoom;return Math.abs(e)>.001?(this.zoom+=e*this.zoomSpring,!1):(this.zoom=this.targetZoom,!0)}stepPan(e,i){const s=e-this.panX,a=i-this.panY;return Math.abs(s)>.5||Math.abs(a)>.5?(this.panX+=s*this.panLerp,this.panY+=a*this.panLerp,!1):(this.panX=e,this.panY=i,!0)}clearFocusTarget(){this.targetWorldX=null,this.targetWorldY=null}}function Rt(t,e,i){return t<e?e:t>i?i:t}const gn=600,ko=Math.PI*(3-Math.sqrt(5)),vn=new Set(["person","project","topic","system","product","organization","org","source","artifact","agent","policy","action","workflow","event","object_type","interface","observation","claim_slot","claim_value"]),Mo=new Set(["benchmark","run","file","chunk","unknown"]),on={source:"#38bdf8",document:"#60a5fa",session:"#818cf8",entity:"#7dd3fc",aspect:"#60a5fa",attribute:"#a78bfa",memory:"#22d3ee",proposal:"#f59e0b"},_o={source:"rgba(56, 189, 248, 0.38)",document:"rgba(96, 165, 250, 0.34)",session:"rgba(129, 140, 248, 0.34)",entity:"rgba(125, 211, 252, 0.38)",aspect:"rgba(96, 165, 250, 0.34)",attribute:"rgba(167, 139, 250, 0.34)",memory:"rgba(34, 211, 238, 0.32)",proposal:"rgba(245, 158, 11, 0.34)"},Io={source:"rgba(56, 189, 248, 0.14)",document:"rgba(96, 165, 250, 0.14)",session:"rgba(129, 140, 248, 0.16)",entity:"rgba(125, 211, 252, 0.16)",aspect:"rgba(96, 165, 250, 0.15)",attribute:"rgba(167, 139, 250, 0.17)",memory:"rgba(34, 211, 238, 0.16)",proposal:"rgba(245, 158, 11, 0.16)"};function wo(t,e={}){const i=So(e.limit??gn),s=t.entities.filter(To).sort((v,b)=>be(b,e.focusLabel)-be(v,e.focusLabel)).slice(0,Math.max(1,i)),a=[],r=[],d=new Set,h=new Map,f=new Map,g=[],m=[];let M=0;for(const v of s){if(a.length>=i)break;const b=Po(v,M++,s.length);a.push(b),h.set(v.id,b),d.add(v.id)}No(a);const S=s.reduce((v,b)=>Math.max(v,b.aspects.length),0);for(let v=0;v<S;v++)for(const b of s){if(a.length>=i)break;const N=h.get(b.id);if(!N)continue;const L=b.aspects.toSorted((Z,st)=>Ft(st)-Ft(Z)),G=L[v];if(!G)continue;const K=Lo(N,G,v,L.length);a.push(K),g.push({aspect:G,node:K}),f.set(`${b.id}:${pn(G.name)}`,K),r.push({id:`has_aspect:${b.id}:${K.id}`,source:b.id,target:K.id,label:"aspect",kind:"has_aspect",strength:.58})}const k=g.reduce((v,b)=>Math.max(v,sn(b.aspect).length),0);for(let v=0;v<k;v++)for(const b of g){if(a.length>=i)break;const N=sn(b.aspect),L=N[v];if(!L)continue;const G=Ao(b.node,L,v,N.length);a.push(G),m.push({attribute:L,node:G}),r.push({id:`has_attribute:${b.node.id}:${G.id}`,source:b.node.id,target:G.id,label:L.kind,kind:"has_attribute",strength:.66})}for(const v of m){if(!v.attribute.memoryId||a.length>=i)continue;const b=xo(v.node,v.attribute);a.push(b),r.push({id:`supports:${b.id}:${v.node.id}`,source:b.id,target:v.node.id,label:"evidence",kind:"supports",strength:.64})}for(const v of Do(t.proposals??[])){if(a.length>=i)break;const b=Oo(v,h,f);if(!b&&a.length>=Math.floor(i*.95))continue;const N=qo(v,b,a.length);a.push(N),b&&r.push({id:`updates:${v.id}:${b.id}`,source:N.id,target:b.id,label:v.operation,kind:"updates",strength:Math.max(.35,v.confidence)})}const P=t.metadata?.dreaming;if(P&&a.length<i&&(P.latestPass||P.lastPassId||P.tokensSinceLastPass>0)){const v=h.values().next().value??null,b=$o(P,v);a.push(b),v&&r.push({id:`updates:${b.id}:${v.id}`,source:b.id,target:v.id,label:"dreaming",kind:"updates",strength:.42,visualOnly:!0})}for(const v of t.dependencies)!d.has(v.sourceEntityId)||!d.has(v.targetEntityId)||v.strength<.35||r.push({id:`about:${v.sourceEntityId}:${v.targetEntityId}`,source:v.sourceEntityId,target:v.targetEntityId,label:v.dependencyType,kind:"about",strength:v.strength,dashed:!0,visualOnly:!0});return{nodes:a.slice(0,i),edges:r.filter(v=>ln(a,v.source)&&ln(a,v.target))}}function So(t){return Number.isFinite(t)?Math.max(1,Math.min(Math.floor(t),2200)):gn}function To(t){const e=t.entityType.toLowerCase();return t.aspects.length===0?!1:t.pinned?!0:Eo(t.name)?!1:vn.has(e)?!0:Mo.has(e)?!1:t.mentions>=3||t.aspects.some(i=>i.attributes.some(s=>s.importance>=.78))}function Eo(t){const e=t.toLowerCase();return e.includes("benchmark")||e.includes("artifact")||e.includes("fixture")||e.includes("chunk")||/\b[0-9a-f]{8,}\b/.test(e)||/\d{6,}/.test(e)}function be(t,e){const i=e?.trim().toLowerCase(),s=i&&t.name.toLowerCase().includes(i)?100:0,a=vn.has(t.entityType.toLowerCase())?25:0,r=t.pinned?40:0,d=t.aspects.reduce((h,f)=>h+f.attributes.reduce((g,m)=>g+m.importance,0),0);return s+r+a+t.mentions*1.8+d}function Ft(t){return t.weight*4+t.attributes.reduce((e,i)=>e+i.importance,0)}function sn(t){return t.attributes.filter(e=>e.content.trim().length>0).toSorted((e,i)=>i.importance-e.importance)}function Po(t,e,i){const s=320+Math.sqrt(e+1)*88,a=e*ko+(i>1?0:.35),r=t.aspects.reduce((f,g)=>f+g.attributes.length,0),d=zo(t,r),h=t.aspects.toSorted((f,g)=>Ft(g)-Ft(f)).slice(0,4).map(f=>f.name).join(", ");return{id:t.id,kind:"entity",label:t.name,sublabel:t.entityType,preview:`${t.mentions} mentions • ${t.aspects.length} aspects`,entityType:t.entityType,status:t.proposalId?"review":"current",weight:be(t),counts:{mentions:t.mentions,aspects:t.aspects.length,attributes:r,influence:d,scale:0},details:[{label:"Type",value:t.entityType},{label:"Mentions",value:String(t.mentions)},{label:"Aspects",value:String(t.aspects.length)},...t.proposalId?[{label:"Proposal",value:t.proposalId}]:[],{label:"Strongest",value:h||"None indexed"}],x:Math.cos(a)*s,y:Math.sin(a)*s,data:t}}function zo(t,e){return Math.log2(t.mentions+1)*1.85+t.aspects.length*1.45+Math.sqrt(e)*1.7}function No(t){const e=t.filter(r=>r.kind==="entity");if(e.length===0)return;const i=e.map(r=>r.counts?.influence??0).toSorted((r,d)=>r-d),s=an(i,.58),a=Math.max(an(i,.96),s+1);for(const r of e){const h=Co(((r.counts?.influence??0)-s)/(a-s))**2.15;r.counts={...r.counts,scale:h}}}function an(t,e){if(t.length===0)return 0;const i=Math.max(0,Math.min(t.length-1,Math.floor((t.length-1)*e)));return t[i]??0}function Co(t){return Math.max(0,Math.min(t,1))}function Lo(t,e,i,s){const a=Math.max(0,Math.min(t.counts?.scale??0,1)),r=mn({index:i,total:s,baseRadius:250+a*170,ringStep:128,minArc:176,offset:-Math.PI/2+Pt(t.id,"aspect-offset")*.28}),d=r.angle,h=r.radius,f=e.attributes.toSorted((g,m)=>m.importance-g.importance).slice(0,3).map(g=>g.content).join(" / ");return{id:`aspect:${e.id}`,kind:"aspect",label:e.name,searchText:`${e.name} ${f}`,sublabel:"aspect",preview:f||"No attributes indexed for this aspect yet.",parentId:t.id,status:e.proposalId?"review":"current",weight:e.weight,counts:{attributes:e.attributes.length,laneAngle:d,laneIndex:i,laneRing:r.ring},details:[{label:"Entity",value:t.label},{label:"Aspect",value:e.name},{label:"Weight",value:e.weight.toFixed(2)},{label:"Attributes",value:String(e.attributes.length)},...e.proposalId?[{label:"Proposal",value:e.proposalId}]:[],{label:"Strongest",value:f||"None indexed"}],x:t.x+Math.cos(d)*h,y:t.y+Math.sin(d)*h,data:e}}function Ao(t,e,i,s){const a=mn({index:i,total:s,baseRadius:154,ringStep:94,minArc:142,offset:Pt(t.id,"attribute-offset")*Math.PI*2}),r=Xt(t,"laneAngle")??a.angle,d=s>36?6:s>18?5:s>8?4:3,h=Math.floor(i/d),f=i%d,m=(Math.min(d,s-h*d)-1)/2,M=(f-m)*86,S=150+h*98,k=r+Math.PI/2;return{id:`attribute:${e.id}`,kind:"attribute",label:bn(e.content,58),searchText:e.content,sublabel:e.kind,preview:e.content,parentId:t.id,status:e.proposalId?"review":e.status==="deleted"?"forgotten":"current",weight:e.importance,counts:{importance:Math.round(e.importance*100),version:e.version??1,proposalEvidence:e.proposalEvidenceCount??0,laneAngle:r,laneRow:h,laneColumn:f},details:[{label:"Aspect",value:t.label},{label:"Kind",value:e.kind},{label:"Importance",value:`${Math.round(e.importance*100)}%`},{label:"Version",value:`v${e.version??1}`},...e.groupKey?[{label:"Group",value:e.groupKey}]:[],...e.claimKey?[{label:"Claim",value:e.claimKey}]:[],...e.sourceKind?[{label:"Source",value:e.sourcePath??e.sourceKind}]:[],...e.proposalId?[{label:"Proposal",value:e.proposalId}]:[],{label:"Evidence",value:e.memoryId??"No memory id"}],x:t.x+Math.cos(r)*S+Math.cos(k)*M,y:t.y+Math.sin(r)*S+Math.sin(k)*M,data:e}}function Do(t){return[...t].filter(e=>e.id.trim().length>0).toSorted((e,i)=>i.confidence-e.confidence||i.evidenceCount-e.evidenceCount)}function Oo(t,e,i){if(!t.targetEntityId)return null;const s=t.targetAspectName?.trim();if(s){const a=i.get(`${t.targetEntityId}:${pn(s)}`);if(a)return a}return e.get(t.targetEntityId)??null}function qo(t,e,i){const s=Pt(t.id,"proposal")*Math.PI*2,a=e?136+Pt(t.id,"proposal-r")*46:620+i*14,r=e?e.x+Math.cos(s)*a:Math.cos(s)*a,d=e?e.y+Math.sin(s)*a:Math.sin(s)*a,h=t.preview??t.rationale;return{id:`proposal:${t.id}`,kind:"proposal",label:rn(t.operation),searchText:`${t.operation} ${t.targetEntityName??""} ${t.targetAspectName??""} ${h}`,sublabel:t.targetEntityName??"pending",preview:h||"Pending ontology operation",parentId:e?.id,status:"review",weight:t.confidence,counts:{confidence:Math.round(t.confidence*100),evidence:t.evidenceCount},details:[{label:"Operation",value:rn(t.operation)},{label:"Confidence",value:`${Math.round(t.confidence*100)}%`},{label:"Evidence",value:String(t.evidenceCount)},...t.targetEntityName?[{label:"Target",value:t.targetEntityName}]:[],...t.targetAspectName?[{label:"Aspect",value:t.targetAspectName}]:[],...t.sourceKind?[{label:"Source",value:t.sourcePath??t.sourceKind}]:[]],x:r,y:d,data:t}}function rn(t){return t.split(/[-_\s]+/).filter(Boolean).map(e=>`${e.charAt(0).toUpperCase()}${e.slice(1)}`).join(" ")}function $o(t,e){const i=t.latestPass,s=`dreaming:${i?.id??t.lastPassId??"queued"}`,a=i?.mutationsApplied??0,r=i?.mutationsSkipped??0,d=i?.mutationsFailed??0,h=i?`${i.status} ${i.mode}`:`${pe(t.tokensSinceLastPass)} tokens queued`,f=e?e.x-260:-260,g=e?e.y-220:-220;return{id:s,kind:"session",label:"Dreaming",searchText:`dreaming ${h} ${t.lastPassMode??""}`,sublabel:h,preview:i?`${a} applied / ${r} skipped / ${d} failed`:`${pe(t.tokensSinceLastPass)} summary tokens queued for consolidation`,status:d>0||t.consecutiveFailures>0?"conflict":"current",weight:i?Math.min(1,Math.max(.2,(a+r+d)/12)):.35,counts:{applied:a,skipped:r,failed:d,tokens:t.tokensSinceLastPass},details:[{label:"Status",value:h},{label:"Tokens",value:pe(t.tokensSinceLastPass)},...t.lastPassAt?[{label:"Last pass",value:t.lastPassAt}]:[],...i?[{label:"Mutations",value:`${a} / ${r} / ${d}`}]:[]],x:f,y:g,data:t}}function pe(t){return Intl.NumberFormat(void 0,{notation:t>=1e4?"compact":"standard"}).format(t)}function pn(t){return t.trim().toLowerCase().replace(/\s+/g," ")}function Xt(t,e){const i=t.counts?.[e];return typeof i=="number"&&Number.isFinite(i)?i:null}function mn(t){let e=0,i=0;for(;;){const s=t.baseRadius+i*t.ringStep,a=Math.max(5,Math.floor(Math.PI*2*s/t.minArc)),r=t.index-e;if(r<a){const d=Math.min(a,t.total-e);return{radius:s,angle:t.offset+Math.PI*2*r/Math.max(d,1),ring:i}}e+=a,i+=1}}function xo(t,e){const i=Xt(t,"laneAngle")??Pt(e.id,"memory")*Math.PI*2,s=Xt(t,"laneRow")??0,a=Xt(t,"laneColumn")??0,r=i+Math.PI/2,d=a%2===0?1:-1,h=70+s%2*12,f=d*28;return{id:`memory:${e.memoryId??e.id}:${e.id}`,kind:"memory",label:bn(e.content,42),searchText:e.content,sublabel:e.kind,preview:e.content,parentId:t.id,weight:e.importance,counts:{importance:Math.round(e.importance*100)},details:[{label:"Supports",value:t.label},{label:"Kind",value:e.kind},{label:"Memory",value:e.memoryId??"unknown"},{label:"Claim",value:e.content}],x:t.x+Math.cos(i)*h+Math.cos(r)*f,y:t.y+Math.sin(i)*h+Math.sin(r)*f,data:e}}function Pt(t,e=""){let i=0;const s=`${t}:${e}`;for(let a=0;a<s.length;a++)i=Math.imul(31,i)+s.charCodeAt(a)|0;return(i>>>0)%1e4/1e4}function bn(t,e){return t.length>e?`${t.slice(0,e-3)}...`:t}function ln(t,e){return t.some(i=>i.id===e)}var Ro=$('<div class="legend-item svelte-c2qg3z"><span class="legend-dot svelte-c2qg3z"></span> <span class="svelte-c2qg3z"> </span></div>'),Yo=$('<div class="legend-empty svelte-c2qg3z">No entities visible</div>'),Xo=$('<div class="legend-item svelte-c2qg3z"><span class="legend-dot svelte-c2qg3z"></span> <span class="svelte-c2qg3z"> </span></div>'),Wo=$('<div class="legend-list svelte-c2qg3z"><div class="legend-section svelte-c2qg3z"><div class="legend-heading svelte-c2qg3z">Entity Type</div> <div class="legend-grid svelte-c2qg3z"><!> <!></div></div> <div class="legend-section legend-structure svelte-c2qg3z"><div class="legend-heading svelte-c2qg3z">Structure</div> <!></div></div>'),Fo=$('<div class="node-card-preview svelte-c2qg3z"> </div>'),Go=$('<div class="node-detail-row svelte-c2qg3z"><span class="svelte-c2qg3z"> </span> <strong class="svelte-c2qg3z"> </strong></div>'),Zo=$('<div class="node-detail-list svelte-c2qg3z"></div>'),Ho=$('<button type="button" class="svelte-c2qg3z">Parent</button>'),Bo=$('<button type="button" class="svelte-c2qg3z"><span class="svelte-c2qg3z"> </span> <strong class="svelte-c2qg3z"> </strong></button>'),Uo=$('<div class="popover-more svelte-c2qg3z"> </div>'),Ko=$('<div class="node-card-kind svelte-c2qg3z"> </div> <div class="node-card-title svelte-c2qg3z"> </div> <!> <!> <div class="popover-actions svelte-c2qg3z"><!> <!> <!></div>',1),jo=$('<div class="entity-navigator-empty svelte-c2qg3z">Type to locate an entity</div>'),Vo=$('<div class="entity-navigator-empty svelte-c2qg3z">No matching entities</div>'),Qo=$('<button type="button" class="svelte-c2qg3z"><span class="svelte-c2qg3z"> </span> <small class="svelte-c2qg3z"> </small></button>'),Jo=$('<div class="node-card-kind svelte-c2qg3z">Navigator</div> <div class="node-card-title entity-navigator-title svelte-c2qg3z">Entities</div> <div class="entity-navigator-subtitle svelte-c2qg3z"> </div> <label class="entity-search-label svelte-c2qg3z" for="constellation-entity-search">Search entity</label> <input id="constellation-entity-search" class="entity-search-input svelte-c2qg3z" type="search" placeholder="Name, type, or memory path" autocomplete="off"/> <div class="entity-navigator-results svelte-c2qg3z" aria-label="Entity search results"><!></div>',1),ts=$('<span> </span> <code class="svelte-c2qg3z"> </code>',1),es=$('<span>overview</span> <code class="svelte-c2qg3z"> </code>',1),ns=$('<div class="knowledge-map-zone svelte-c2qg3z"><canvas class="graph-canvas svelte-c2qg3z" aria-label="Signet knowledge graph"></canvas> <div class="graph-chrome top-left svelte-c2qg3z"><div class="map-title svelte-c2qg3z">SIGNET CONSTELLATION</div> <div class="map-subtitle svelte-c2qg3z"> </div></div> <div class="map-controls svelte-c2qg3z"><button type="button" class="svelte-c2qg3z"><span class="svelte-c2qg3z">Fit</span><kbd class="svelte-c2qg3z">Z</kbd></button> <button type="button" class="svelte-c2qg3z"><span class="svelte-c2qg3z">Center</span><kbd class="svelte-c2qg3z">C</kbd></button> <div class="zoom-row svelte-c2qg3z"><span class="svelte-c2qg3z"> </span> <button type="button" aria-label="Zoom out" class="svelte-c2qg3z">-</button> <button type="button" aria-label="Zoom in" class="svelte-c2qg3z">+</button></div> <div class="legend-shell svelte-c2qg3z"><button type="button"><span class="legend-chevron svelte-c2qg3z">›</span> <span class="svelte-c2qg3z">Legend</span></button> <!></div></div> <div><div class="node-popover-content svelte-c2qg3z"><!></div> <div class="node-card-footer svelte-c2qg3z"><!></div></div></div>');function is(t,e){cn(e,!0);const i=dn(e,"agentId",3,"default"),s={source:58,document:48,session:46,aspect:32,attribute:30,memory:28,entity:38,proposal:34},a={person:{color:"#eab308",dim:"rgba(234, 179, 8, 0.34)"},project:{color:"#06b6d4",dim:"rgba(6, 182, 212, 0.34)"},product:{color:"#14f1d9",dim:"rgba(20, 241, 217, 0.3)"},system:{color:"#a855f7",dim:"rgba(168, 85, 247, 0.32)"},tool:{color:"#10b981",dim:"rgba(16, 185, 129, 0.3)"},topic:{color:"#a78bfa",dim:"rgba(167, 139, 250, 0.32)"},concept:{color:"#f43f5e",dim:"rgba(244, 63, 94, 0.3)"},organization:{color:"#f59e0b",dim:"rgba(245, 158, 11, 0.28)"},org:{color:"#f59e0b",dim:"rgba(245, 158, 11, 0.28)"},skill:{color:"#f59e0b",dim:"rgba(245, 158, 11, 0.28)"},task:{color:"#64748b",dim:"rgba(100, 116, 139, 0.3)"},source:{color:"#38bdf8",dim:"rgba(56, 189, 248, 0.3)"},artifact:{color:"#f97316",dim:"rgba(249, 115, 22, 0.28)"},agent:{color:"#22c55e",dim:"rgba(34, 197, 94, 0.3)"},policy:{color:"#fb7185",dim:"rgba(251, 113, 133, 0.3)"},action:{color:"#84cc16",dim:"rgba(132, 204, 22, 0.28)"},workflow:{color:"#c084fc",dim:"rgba(192, 132, 252, 0.3)"},event:{color:"#facc15",dim:"rgba(250, 204, 21, 0.28)"},object_type:{color:"#2dd4bf",dim:"rgba(45, 212, 191, 0.3)"},interface:{color:"#60a5fa",dim:"rgba(96, 165, 250, 0.3)"},observation:{color:"#e879f9",dim:"rgba(232, 121, 249, 0.3)"},claim_slot:{color:"#a3e635",dim:"rgba(163, 230, 53, 0.28)"},claim_value:{color:"#f472b6",dim:"rgba(244, 114, 182, 0.3)"}},r=new Set(["person","project","product","system","tool","topic","concept","organization","org","skill","task","unknown"]),d={contains:{color:"rgb(96, 165, 250)",alpha:.14,width:1},has_aspect:{color:"rgb(96, 165, 250)",alpha:.38,width:1.25},has_attribute:{color:"rgb(167, 139, 250)",alpha:.34,width:1.1},supports:{color:"rgb(34, 211, 238)",alpha:.34,width:1.15},updates:{color:"rgb(34, 211, 238)",alpha:.48,width:1.6},extends:{color:"rgb(14, 165, 233)",alpha:.3,width:1.1},mentions:{color:"rgb(59, 130, 246)",alpha:.1,width:.85},about:{color:"rgb(59, 130, 246)",alpha:.2,width:1.1}},h={contains:{color:"rgb(10, 57, 255)",alpha:.18,width:1},has_aspect:{color:"rgb(10, 57, 255)",alpha:.42,width:1.25},has_attribute:{color:"rgb(124, 58, 237)",alpha:.38,width:1.1},supports:{color:"rgb(6, 182, 212)",alpha:.38,width:1.15},updates:{color:"rgb(6, 182, 212)",alpha:.52,width:1.6},extends:{color:"rgb(2, 132, 199)",alpha:.34,width:1.1},mentions:{color:"rgb(37, 99, 235)",alpha:.14,width:.85},about:{color:"rgb(37, 99, 235)",alpha:.26,width:1.1}},f={selection:"#7cc7ff",selectionGlow:"rgba(59, 130, 246, 0.24)",text:"rgba(226, 232, 240, 0.74)",textMuted:"rgba(148, 163, 184, 0.66)",textDim:"rgba(148, 163, 184, 0.14)",labelShadow:"rgba(0, 0, 0, 0.82)",edges:d,relatedGlow:Io},g={selection:"#0a39ff",selectionGlow:"rgba(10, 57, 255, 0.18)",text:"rgba(36, 41, 54, 0.78)",textMuted:"rgba(94, 102, 117, 0.72)",textDim:"rgba(94, 102, 117, 0.18)",labelShadow:"rgba(255, 255, 255, 0.7)",edges:h,relatedGlow:{source:"rgba(10, 57, 255, 0.18)",document:"rgba(10, 57, 255, 0.18)",session:"rgba(10, 57, 255, 0.18)",aspect:"rgba(10, 57, 255, 0.14)",attribute:"rgba(124, 58, 237, 0.14)",memory:"rgba(10, 57, 255, 0.12)",entity:"rgba(10, 57, 255, 0.18)",proposal:"rgba(10, 57, 255, 0.14)"}},m=["person","project","system","tool","concept","topic","product","org","skill","task","source","artifact","agent","policy","action","workflow","event","object_type","interface","observation","claim_slot","claim_value","extracted","unknown"],M={person:"Person",project:"Project",product:"Product",system:"System",tool:"Tool",topic:"Topic",concept:"Concept",org:"Org",skill:"Skill",task:"Task",source:"Source",artifact:"Artifact",agent:"Agent",policy:"Policy",action:"Action",workflow:"Workflow",event:"Event",object_type:"Object Type",interface:"Interface",observation:"Observation",claim_slot:"Claim Slot",claim_value:"Claim Value",extracted:"Extracted",unknown:"Other"},S=12,k=[{kind:"aspect",label:"Aspect"},{kind:"attribute",label:"Attribute"},{kind:"memory",label:"Evidence"}],P=.56,v=.72,b=.92;let N=B(null),L=B(Tt([]));const G=ot(()=>Pn(l(L)));let K=[],Z=B(Tt([])),st=B(Tt([])),H=B(null),bt=B(null),vt=B(Tt(new Set)),Gt=B(!1),yt=B(null),kt=B(!0),J=B(800),et=B(600),ye=B(50),Mt=B(""),Zt=B(!1);const R=ot(ai),yn=ot(ui),zt=ot(()=>zn(l(Z),l(Mt))),kn=ot(()=>l(Zt)?g:f);let Ht=new Map,j=new Map,lt=null;const ke=new Yi;let Nt=null;const ft=new fo;let Bt=0,pt=!0,Ct=0,Ut=!1,Mn=0;function _n(n){const o=s[n.kind],c=Math.max(0,Math.min(n.weight??0,1));if(n.kind==="entity"){const u=Math.max(0,Math.min(n.counts?.scale??0,1));return o+Math.round(108*u)}return n.kind==="aspect"||n.kind==="attribute"||n.kind==="memory"?o+c*8:o}function In(n){return n==="source"||n==="document"||n==="session"?"rect":n==="entity"?"hex":n==="aspect"||n==="attribute"?"rect":"circle"}function wn(n){const o=Ht.get(n.id),c=_n(n),u=n.kind==="entity"?Me(n.entityType):null;return{id:n.id,kind:n.kind,label:n.label,sublabel:n.sublabel,searchText:n.searchText,parentId:n.parentId,x:o?.x??n.x,y:o?.y??n.y,vx:o?.vx??0,vy:o?.vy??0,fx:o?.fx??null,fy:o?.fy??null,anchorDx:o?.anchorDx,anchorDy:o?.anchorDy,size:c,mass:n.kind==="entity"?Math.max(0,Math.min(n.counts?.scale??0,1)):void 0,systemRadius:Tn(n,c),iconScale:Sn(n.kind),counts:n.counts,color:u?.color??on[n.kind],dimColor:u?.dim??_o[n.kind],sprite:n.kind==="entity"?En(n.entityType):void 0,shape:In(n.kind),data:n}}function Sn(n){return n==="aspect"?1.35:n==="attribute"?1.45:1}function Tn(n,o){if(n.kind==="entity"){const c=n.counts?.aspects??0,u=n.counts?.attributes??0,p=Math.max(0,Math.min(n.counts?.scale??0,1));return ne(370+p*230+Math.sqrt(c)*36+Math.sqrt(u)*9,440,860)}if(n.kind==="aspect"){const c=n.counts?.attributes??0;return ne(150+Math.sqrt(c)*17,o+96,360)}}function Me(n){return a[_t(n)]??{color:"#93c5fd",dim:"rgba(147, 197, 253, 0.28)"}}function En(n){const o=_t(n);return`/constellation-assets/entity-${r.has(o)?o:"unknown"}.png`}function _t(n){const o=n?.trim().toLowerCase();return o?o==="organization"?"org":o:"unknown"}function Pn(n){const o=new Map;for(const u of n){if(u.kind!=="entity")continue;const p=_t(_e(u));o.set(p,(o.get(p)??0)+1)}const c=new Map(m.map((u,p)=>[u,p]));return[...o.entries()].sort(([u,p],[y,_])=>{const I=c.get(u),C=c.get(y);return I!==void 0||C!==void 0?(I??999)-(C??999):_-p||u.localeCompare(y)}).slice(0,S).map(([u,p])=>({type:u,label:Ie(u),count:p}))}function _e(n){const o=n.data;if(!o||typeof o!="object"||!("entityType"in o))return;const c=o.entityType;return typeof c=="string"?c:void 0}function Ie(n){const o=M[n];return o||n.split(/[-_\s]+/).filter(Boolean).map(c=>`${c.charAt(0).toUpperCase()}${c.slice(1)}`).join(" ")}function zn(n,o){const c=o.trim().toLowerCase().split(/\s+/).filter(Boolean);return c.length===0?[]:n.filter(u=>u.kind==="entity").map(u=>({node:u,score:Nn(u,c)})).filter(u=>u.score>0).sort((u,p)=>p.score-u.score||Kt(p.node)-Kt(u.node)||u.node.label.localeCompare(p.node.label)).slice(0,10).map(u=>u.node)}function Nn(n,o){const c=Cn(n);let u=0;for(const p of o)if(n.label.toLowerCase()===p)u+=80;else if(n.label.toLowerCase().startsWith(p))u+=45;else if(n.label.toLowerCase().includes(p))u+=25;else if(c.includes(p))u+=8;else return 0;return u+Math.min(Kt(n)/70,25)}function Cn(n){return[n.label,n.entityType,n.sublabel,n.preview,n.searchText].filter(o=>typeof o=="string").join(" ").toLowerCase()}function Kt(n){const o=Math.max(0,n.counts?.mentions??0),c=Math.max(0,Math.min(n.counts?.scale??0,1)),u=Math.max(0,n.counts?.aspects??0),p=Math.max(0,n.counts?.attributes??0);return o*8+c*1e3+u*10+p}function Ln(n,o){const c=n.filter(C=>C.kind==="entity");if(c.length===0)return;const u=new Map;for(const C of c){const E=_t(_e(C)),O=u.get(E)??[];O.push(C),u.set(E,O)}const p=new Map(m.map((C,E)=>[C,E])),y=[...u.entries()].sort(([C,E],[O,A])=>{const z=p.get(C),Y=p.get(O);return z!==void 0||Y!==void 0?(z??999)-(Y??999):A.length-E.length||C.localeCompare(O)}),_=Math.max(2,Math.ceil(Math.sqrt(y.length*1.45))),I=Math.max(1,Math.ceil(y.length/_));for(const[C,[,E]]of y.entries()){const O=(C%_-(_-1)/2)*1320,A=(Math.floor(C/_)-(I-1)/2)*1060;E.sort((z,Y)=>Y.size-z.size||z.label.localeCompare(Y.label));for(const[z,Y]of E.entries()){const Q=An(z,E.length,O,A,Y.systemRadius??Y.size*3);Y.zoneX=Q.x,Y.zoneY=Q.y,o&&(Y.x=Q.x,Y.y=Q.y,Y.vx=0,Y.vy=0)}}}function An(n,o,c,u,p){if(n===0)return{x:c,y:u};const y=Math.floor(Math.sqrt(n)),_=y*y,I=Math.max(1,Math.min(o-_,(y+1)*(y+1)-_)),C=n-_,E=-Math.PI/2+C/I*Math.PI*2+y*.38,O=Math.max(420,p*.42)+y*420;return{x:c+Math.cos(E)*O,y:u+Math.sin(E)*O}}function Dn(n){return{...n,id:n.id,sourceId:n.source,targetId:n.target,source:n.source,target:n.target}}function we(n,o,c=!1){const u=n.map(wn);Ln(u,c&&l(H)===null);const p=new Set(u.map(z=>z.id)),y=o.filter(z=>p.has(z.source)&&p.has(z.target)).map(Dn);x(L,u,!0),K=y;const _=l(L),I=K;Ht=new Map(_.map(z=>[z.id,z])),j=new Map(_.map(z=>[z.id,z])),jn(_),te(),ee();const C=_.filter(Kn),E=C.length>600?-900:C.length>250?-1500:C.length>90?-2200:-2800,O=new Set(C.map(z=>z.id)),A=I.filter(z=>O.has(z.sourceId)&&O.has(z.targetId));c?ft.init(C,A,{chargeStrength:E,linkDistance:_.length>1e3?210:280,collisionPadding:_.length>1e3?20:34,solarPadding:_.length>1e3?170:240,solarStrength:_.length>1e3?.42:.5,preSettleTicks:_.length>1e3?48:_.length>400?90:180,maxActiveTicks:_.length>1e3?28:_.length>400?48:90,maxActiveMs:_.length>1e3?420:_.length>400?680:1100}):ft.update(C,A),Ut=c,tt()}function jt(n=!1){const o=On();we(o.nodes,o.edges,n)}function at(n){return l(Z).filter(o=>o.parentId===n)}function On(){const n=Lt(),o=n?Se(n):qn();return{nodes:l(Z).filter(u=>o.has(u.id)),edges:l(st).filter(u=>o.has(u.source)&&o.has(u.target)&&$n(u,n))}}function qn(){const n=new Set;for(const o of l(Z))(o.kind==="entity"||o.kind==="session")&&n.add(o.id);return n}function Se(n){const o=new Set,c=Ne(n),u=n.kind==="entity"?n:c.find(y=>y.kind==="entity"),p=n.kind==="aspect"?n:c.find(y=>y.kind==="aspect");if(n.kind==="entity"&&u){o.add(u.id);for(const y of at(u.id))o.add(y.id);for(const y of l(st))y.kind==="about"&&(y.source===n.id&&o.add(y.target),y.target===n.id&&o.add(y.source));return o}if(n.kind==="aspect"&&p){u&&o.add(u.id),o.add(p.id);for(const y of at(p.id))o.add(y.id);return o}if(n.kind==="attribute"){if(u&&o.add(u.id),p&&o.add(p.id),o.add(n.id),p)for(const y of at(p.id))o.add(y.id);for(const y of at(n.id))o.add(y.id);return o}if(n.kind==="memory"){for(const y of c)o.add(y.id);return o.add(n.id),o}return o.add(n.id),o}function $n(n,o){return o?o.kind==="entity"?n.kind==="has_aspect"||n.kind==="about"||n.kind==="updates":o.kind==="aspect"?n.kind==="has_aspect"||n.kind==="has_attribute"||n.kind==="updates":o.kind==="attribute"||o.kind==="memory"?n.kind==="has_aspect"||n.kind==="has_attribute"||n.kind==="supports"||n.kind==="updates":!0:n.kind==="about"||n.kind==="updates"}async function xn(n){x(Gt,!0),x(yt,null),x(H,null),x(vt,new Set,!0);try{const o=await Li(n);if(!o){x(yt,"Could not reach daemon knowledge endpoint"),x(Z,[],!0),x(st,[],!0),we([],[],!0);return}const c=wo(o,{focusLabel:"Signet",limit:5e3});x(Z,c.nodes,!0),x(st,c.edges,!0),Ht=new Map,x(H,null),jt(!0)}catch(o){x(yt,o instanceof Error?o.message:String(o),!0)}finally{x(Gt,!1)}}function Rn(n){const o=n.getContext("2d");if(!o)return null;const c=window.devicePixelRatio||1,u=n.clientWidth,p=n.clientHeight,y=16384,_=Math.min(y/Math.max(u,1),y/Math.max(p,1),c);return(n.width!==Math.floor(u*_)||n.height!==Math.floor(p*_))&&(n.width=Math.floor(u*_),n.height=Math.floor(p*_),x(J,u,!0),x(et,p,!0),pt=!0),o.setTransform(_,0,0,_,0,0),o}function tt(){pt=!0}function Te(){Bt=requestAnimationFrame(Te);const n=l(N),o=lt;if(!n||!o)return;const c=Rn(n);if(!c)return;const u=o.tick();x(ye,Math.round(o.zoom*100),!0);const p=l(H)?1:0,y=p-Ct;let _=!1;Math.abs(y)>.01?(Ct+=y*.1,_=!0):Ct=p;const I=ft.isActive(),C=Nt?.getDraggingNode()!=null,E=Nt?.getDraggingNode();E&&Vn(E);const O=te(E),A=u||I||C||O||pt?ee(Mn++%3!==0):!1;Ut&&l(L).length>0&&l(J)>0&&l(et)>0&&(o.fitToNodes(l(L),l(J),l(et)),Ut=!1),!(!u&&!I&&!_&&!A&&!pt)&&(pt=!1,Gi(c,l(L),K,o,l(J),l(et),{selectedId:l(H),hoveredId:l(bt),relatedIds:l(vt),dimProgress:Ct},j,l(kn)))}function Yn(n){if(!n||l(H)===n.id){Ce();return}ze(n.id)}function Lt(){return l(H)?l(Z).find(o=>o.id===l(H))??null:null}function Ee(){lt?.fitToNodes(l(L),l(J),l(et)),tt()}function Pe(){if(l(H)){Le(l(H));return}if(l(L).length===0)return;let n=0,o=0;for(const c of l(L))n+=c.x,o+=c.y;lt?.centerOn(n/l(L).length,o/l(L).length,l(J),l(et)),tt()}function At(n){const o=lt;o&&(o.zoomTo(o.zoom*n,l(J)/2,l(et)/2),tt())}function dt(n){ze(n)}function ze(n){x(H,n,!0),x(vt,Xn(n),!0),jt();const o=j.get(n);o?.kind==="entity"||o?.kind==="aspect"||o?.kind==="attribute"?Wn(n):Le(n),tt()}function Xn(n){const o=l(Z).find(p=>p.id===n);if(!o)return new Set;const c=new Set([n]),u=Ne(o);for(const p of u)c.add(p.id);for(const p of at(n))c.add(p.id);if(o.kind==="entity"||o.kind==="aspect")for(const p of Se(o))c.add(p);return c}function Ne(n){const o=[];let c=n.parentId?l(Z).find(u=>u.id===n.parentId):null;for(;c;)o.push(c),c=c.parentId?l(Z).find(u=>u.id===c?.parentId):null;return o}function Ce(){x(H,null),x(vt,new Set,!0),jt(!0),tt()}function Le(n){const o=j.get(n);o&&(lt?.centerOn(o.x,o.y,l(J),l(et)),tt())}function Wn(n){const o=j.get(n);if(!o)return;const c=Vt(n);if(Gn(o,c),ft.pause(),te(),ee(),o.kind==="attribute"){tt();return}const u=o.kind==="entity"?P:o.kind==="aspect"?v:b;lt?.fitToNodes(Fn(o),l(J),l(et),{maxZoom:u,padding:o.kind==="entity"?.34:o.kind==="aspect"?.42:.58}),tt()}function Vt(n){return at(n).map(o=>j.get(o.id)).filter(o=>o!==void 0)}function Fn(n){const o=new Set([n.id]);for(const u of Vt(n.id))o.add(u.id);let c=n.parentId?j.get(n.parentId):null;for(;c;){if(o.add(c.id),n.kind==="attribute"&&c.kind==="aspect")for(const u of Vt(c.id))o.add(u.id);c=c.parentId?j.get(c.parentId):null}return[...o].map(u=>j.get(u)).filter(u=>u!==void 0)}function Gn(n,o){if(n.kind==="aspect"){if(o.length===0)return;Hn(n,o);return}if(n.kind==="attribute"){Bn(n,o);return}o.length!==0&&Zn(n,o)}function Zn(n,o){const c=n.kind==="entity"?Math.max(290,n.size*.8+190):Math.max(188,n.size*1.15+118),u=n.kind==="entity"?122:96,p=n.kind==="entity"?190:188,y=-Math.PI/2+Qt(n.id)*.4;n.vx=0,n.vy=0;for(const[_,I]of o.entries()){const C=Un(_,o.length,c,u,p,y),E=C.angle,O=C.radius;I.x=n.x+Math.cos(E)*O,I.y=n.y+Math.sin(E)*O,I.vx=0,I.vy=0,I.fx=null,I.fy=null,I.anchorDx=I.x-n.x,I.anchorDy=I.y-n.y}}function Hn(n,o){const c=n.parentId?j.get(n.parentId):null,u=c?Math.atan2(n.y-c.y,n.x-c.x):Qt(n.id),p=u+Math.PI/2,y=o.length>42?7:o.length>24?6:o.length>12?5:4;n.vx=0,n.vy=0;for(const[_,I]of o.entries()){const C=Math.floor(_/y),E=_%y,A=(Math.min(y,o.length-C*y)-1)/2,z=178+C*124,Y=(E-A)*118;I.x=n.x+Math.cos(u)*z+Math.cos(p)*Y,I.y=n.y+Math.sin(u)*z+Math.sin(p)*Y,I.vx=0,I.vy=0,I.fx=null,I.fy=null,I.anchorDx=I.x-n.x,I.anchorDy=I.y-n.y}}function Bn(n,o){const c=n.parentId?j.get(n.parentId):null,u=c?.parentId?j.get(c.parentId):null,p=c&&u?Math.atan2(c.y-u.y,c.x-u.x):Qt(n.id),y=p+Math.PI/2;n.vx=0,n.vy=0;for(const[_,I]of o.entries()){const C=_%2===0?1:-1,E=86+Math.floor(_/2)*48,O=C*(34+Math.floor(_/2)*16);I.x=n.x+Math.cos(p)*E+Math.cos(y)*O,I.y=n.y+Math.sin(p)*E+Math.sin(y)*O,I.vx=0,I.vy=0,I.fx=null,I.fy=null,I.anchorDx=I.x-n.x,I.anchorDy=I.y-n.y}}function Un(n,o,c,u,p,y){let _=0,I=0;for(;;){const C=c+I*u,E=Math.max(5,Math.floor(Math.PI*2*C/p)),O=n-_;if(O<E){const A=Math.min(E,o-_),z=y+Math.PI*2*O/Math.max(A,1);return{radius:C,angle:z}}_+=E,I+=1}}function Qt(n){let o=0;for(let c=0;c<n.length;c++)o=Math.imul(31,o)+n.charCodeAt(c)|0;return((o>>>0)%1e4/1e4-.5)*.6}function Kn(n){return n.kind==="entity"||n.kind==="aspect"}function Jt(n){return n.kind==="attribute"||n.kind==="memory"||n.kind==="proposal"}function jn(n){for(const o of n){if(!Jt(o)||!o.parentId)continue;const c=j.get(o.parentId);c&&(o.anchorDx??=o.x-c.x,o.anchorDy??=o.y-c.y)}}function te(n){let o=!1;for(const c of l(L)){if(!Jt(c)||c===n||!c.parentId)continue;const u=j.get(c.parentId);if(!u)continue;const p=u.x+(c.anchorDx??0),y=u.y+(c.anchorDy??0);(Math.abs(c.x-p)>.05||Math.abs(c.y-y)>.05)&&(c.x=p,c.y=y,o=!0)}return o}function Vn(n){if(!Jt(n)||!n.parentId)return;const o=j.get(n.parentId);o&&(n.anchorDx=n.x-o.x,n.anchorDy=n.y-o.y)}function ee(n=!1){const o=lt;if(n&&l(L).length>1e3)return!1;const c=o?.zoom??1;return ke.rebuild(l(L).filter(u=>Jn(u,c,Qn(u))))}function Qn(n){return n.id===l(H)||n.id===l(bt)||l(vt).has(n.id)}function Jn(n,o,c=!1){return c||n.kind==="entity"?!0:n.kind==="aspect"?o>=.15:n.kind==="attribute"?o>=.38:n.kind==="memory"?o>=.62:hn(n,o,c)}function Ae(n){const o=Lt();if(!o)return;const c=l(Z).filter(y=>y.parentId===o.parentId&&y.kind===o.kind);if(c.length===0)return;const u=c.findIndex(y=>y.id===o.id),p=c[(u+n+c.length)%c.length];p&&dt(p.id)}function ti(){const n=Lt();n?.parentId&&dt(n.parentId)}function ei(){if(!l(H))return;const n=l(Z).find(o=>o.parentId===l(H));n&&dt(n.id)}function De(n){return n==="memory"?"Evidence":n[0]?.toUpperCase()+n.slice(1)}function ni(n){return n.kind==="attribute"&&n.preview?n.preview:n.label}function ii(n){return n.kind!=="attribute"&&!!n.preview}function oi(n){return n.counts?.mentions?`${n.counts.mentions} mentions`:n.counts?.importance?`${n.counts.importance}% importance`:n.counts?.confidence?`${n.counts.confidence}% confidence`:n.status??"current"}function si(n){return n.parentId?l(Z).find(o=>o.id===n.parentId)??null:null}function ai(){const n=l(H)??l(bt);return n?l(Z).find(o=>o.id===n)??null:null}function ri(n){const o=Math.max(260,Math.min(330,l(J)-32)),c=ci(n),u=l(J)<700?14:24;return`right: ${u}px; bottom: ${u}px; width: ${o}px; height: ${c}px;`}function li(){const n=Math.max(300,Math.min(360,l(J)-32)),o=l(J)<700?14:24;return`right: ${o}px; bottom: ${o}px; width: ${n}px; height: auto; max-height: ${Math.min(420,l(et)-80)}px;`}function ci(n){const o=Math.min(at(n.id).length,Dt(n));return ne(236+Math.ceil(o/2)*32,270,Math.min(430,l(et)-32))}function Dt(n){return n.kind==="aspect"?8:n.kind==="entity"||n.kind==="attribute"?6:4}function di(n){return n.length>18?`${n.slice(0,10)}...${n.slice(-5)}`:n}function ne(n,o,c){return Math.max(o,Math.min(n,c))}function ui(){const n=l(L).length;if(l(Gt))return"Loading knowledge map...";if(l(yt))return l(yt);const o=Lt(),c=l(L).filter(y=>y.kind==="proposal").length,u=l(L).filter(y=>y.kind==="session").length,p=[o?`${hi(o)} focus`:"overview",c>0?`${c} proposals`:"",u>0?`${u} dreaming signals`:""].filter(Boolean);return`${n} ontology nodes • ${K.length} relationships${p.length>0?` • ${p.join(" • ")}`:""}`}function hi(n){return n.kind==="entity"?"entity":n.kind==="aspect"?"aspect":n.kind==="attribute"||n.kind==="memory"?"attribute":"overview"}function Oe(n){const o=n.target;if(!(o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.isContentEditable))switch(n.key){case"z":case"Z":Ee();break;case"c":case"C":Pe();break;case"+":case"=":At(1.3);break;case"-":case"_":At(1/1.3);break;case"Escape":Ce();break;case"ArrowRight":n.preventDefault(),Ae(1);break;case"ArrowLeft":n.preventDefault(),Ae(-1);break;case"ArrowUp":n.preventDefault(),ti();break;case"ArrowDown":n.preventDefault(),ei();break}}function fi(n){if(n.key==="Enter"){n.preventDefault();const o=l(zt)[0];o&&dt(o.id)}n.key==="Escape"&&(n.stopPropagation(),x(Mt,""))}function qe(){return typeof document<"u"&&document.documentElement.dataset.theme==="light"}Wt(()=>{i(),xn(i())}),Wt(()=>{l(H),l(bt),l(vt),tt()}),Ti(()=>{x(Zt,qe(),!0);const n=l(N);n&&(lt=new rt(n.clientWidth/2,n.clientHeight/2,.5),Nt=new Xi(n,lt,ke,{onNodeHover:c=>{x(bt,c?.id??null,!0)},onNodeClick:Yn,onNodeDragStart:()=>ft.reheat(),onNodeDragEnd:()=>{ft.coolDown(),tt()},onNodeDoubleClick:c=>{c&&dt(c.id)},onRequestRender:tt})),window.addEventListener("keydown",Oe),Bt=requestAnimationFrame(Te);const o=new MutationObserver(c=>{for(const u of c)if(u.attributeName==="data-theme"){x(Zt,qe(),!0),pt=!0;break}});return o.observe(document.documentElement,{attributes:!0}),()=>{window.removeEventListener("keydown",Oe),cancelAnimationFrame(Bt),Nt?.destroy(),ft.destroy(),o.disconnect()}});var ie=ns(),$e=T(ie);Ei($e,n=>x(N,n),()=>l(N));var oe=q($e,2),xe=q(T(oe),2),gi=T(xe,!0);w(xe),w(oe);var se=q(oe,2),Re=T(se),Ye=q(Re,2),ae=q(Ye,2),re=T(ae),vi=T(re);w(re);var Xe=q(re,2),pi=q(Xe,2);w(ae);var We=q(ae,2),Ot=T(We);let Fe;var mi=q(Ot,2);{var bi=n=>{var o=Wo(),c=T(o),u=q(T(c),2),p=T(u);St(p,17,()=>l(G),E=>E.type,(E,O)=>{var A=Ro(),z=T(A),Y=q(z,2),Q=T(Y,!0);w(Y),w(A),U(nt=>{he(A,"title",`${l(O).count} visible`),fe(z,`background: ${nt??""}`),F(Q,l(O).label)},[()=>Me(l(O).type).color]),D(E,A)});var y=q(p,2);{var _=E=>{var O=Yo();D(E,O)};it(y,E=>{l(G).length===0&&E(_)})}w(u),w(c);var I=q(c,2),C=q(T(I),2);St(C,17,()=>k,E=>E.kind,(E,O)=>{var A=Xo(),z=T(A),Y=q(z,2),Q=T(Y,!0);w(Y),w(A),U(()=>{fe(z,`background: ${on[l(O).kind]??""}`),F(Q,l(O).label)}),D(E,A)}),w(I),w(o),D(n,o)};it(mi,n=>{l(kt)&&n(bi)})}w(We),w(se);var qt=q(se,2);let Ge;var le=T(qt),yi=T(le);{var ki=n=>{var o=Ko(),c=ht(o),u=T(c);w(c);var p=q(c,2),y=T(p,!0);w(p);var _=q(p,2);{var I=X=>{var W=Fo(),V=T(W,!0);w(W),U(()=>F(V,l(R).preview)),D(X,W)},C=ot(()=>ii(l(R)));it(_,X=>{l(C)&&X(I)})}var E=q(_,2);{var O=X=>{var W=Zo();St(W,21,()=>l(R).details.slice(0,4),V=>`${V.label}:${V.value}`,(V,ut)=>{var wt=Go(),mt=T(wt),de=T(mt,!0);w(mt);var $t=q(mt,2),Si=T($t,!0);w($t),w(wt),U(()=>{F(de,l(ut).label),F(Si,l(ut).value)}),D(V,wt)}),w(W),D(X,W)};it(E,X=>{l(R).details?.length&&X(O)})}var A=q(E,2),z=T(A);{var Y=X=>{var W=Ho();ct("click",W,()=>l(R).parentId&&dt(l(R).parentId)),D(X,W)},Q=ot(()=>si(l(R)));it(z,X=>{l(Q)&&X(Y)})}var nt=q(z,2);St(nt,17,()=>at(l(R).id).slice(0,Dt(l(R))),X=>X.id,(X,W)=>{var V=Bo(),ut=T(V),wt=T(ut,!0);w(ut);var mt=q(ut,2),de=T(mt,!0);w(mt),w(V),U($t=>{F(wt,$t),F(de,l(W).label)},[()=>De(l(W).kind)]),ct("click",V,()=>dt(l(W).id)),D(X,V)});var gt=q(nt,2);{var It=X=>{var W=Uo(),V=T(W);w(W),U(ut=>F(V,`+${ut??""} more`),[()=>at(l(R).id).length-Dt(l(R))]),D(X,W)},ce=ot(()=>at(l(R).id).length>Dt(l(R)));it(gt,X=>{l(ce)&&X(It)})}w(A),U((X,W)=>{F(u,`${X??""}${l(R).sublabel?` • ${l(R).sublabel}`:""}`),F(y,W)},[()=>De(l(R).kind),()=>ni(l(R))]),D(n,o)},Mi=n=>{var o=Jo(),c=q(ht(o),4),u=T(c);w(c);var p=q(c,4);Pi(p);var y=q(p,2),_=T(y);{var I=A=>{var z=jo();D(A,z)},C=ot(()=>l(Mt).trim().length===0),E=A=>{var z=Vo();D(A,z)},O=A=>{var z=Yt(),Y=ht(z);St(Y,17,()=>l(zt),Q=>Q.id,(Q,nt)=>{var gt=Qo(),It=T(gt),ce=T(It,!0);w(It);var X=q(It,2),W=T(X);w(X),w(gt),U(V=>{he(gt,"title",l(nt).label),F(ce,l(nt).label),F(W,`${V??""} • ${l(nt).counts?.aspects??0??""} aspects • ${l(nt).counts?.attributes??0??""} attributes`)},[()=>Ie(_t(l(nt).entityType))]),ct("click",gt,()=>dt(l(nt).id)),D(Q,gt)}),D(A,z)};it(_,A=>{l(C)?A(I):l(zt).length===0?A(E,1):A(O,-1)})}w(y),U(A=>F(u,`${A??""} selectable entities`),[()=>l(Z).filter(A=>A.kind==="entity").length]),ct("keydown",p,fi),zi(p,()=>l(Mt),A=>x(Mt,A)),D(n,o)};it(yi,n=>{l(R)?n(ki):n(Mi,-1)})}w(le);var Ze=q(le,2),_i=T(Ze);{var Ii=n=>{var o=ts(),c=ht(o),u=T(c,!0);w(c);var p=q(c,2),y=T(p,!0);w(p),U((_,I)=>{F(u,_),F(y,I)},[()=>oi(l(R)),()=>di(l(R).id)]),D(n,o)},wi=n=>{var o=es(),c=q(ht(o),2),u=T(c);w(c),U(()=>F(u,`${l(zt).length??""} results`)),D(n,o)};it(_i,n=>{l(R)?n(Ii):n(wi,-1)})}w(Ze),w(qt),w(ie),U(n=>{F(gi,l(yn)),F(vi,`${l(ye)??""}%`),Fe=me(Ot,1,"legend-toggle svelte-c2qg3z",null,Fe,{"legend-toggle-open":l(kt)}),he(Ot,"aria-expanded",l(kt)),Ge=me(qt,1,"node-popover svelte-c2qg3z",null,Ge,{selected:l(R)?l(H)===l(R).id:!1,"attribute-popover":l(R)?.kind==="attribute","entity-navigator-popover":!l(R)}),fe(qt,n)},[()=>l(R)?ri(l(R)):li()]),ct("click",Re,Ee),ct("click",Ye,Pe),ct("click",Xe,()=>At(1/1.3)),ct("click",pi,()=>At(1.3)),ct("click",Ot,()=>x(kt,!l(kt))),D(t,ie),un()}Ni(["click","keydown"]);var os=$('<div class="ontology-dashboard svelte-1p7cxtr"><!></div>');function ss(t,e){const i=dn(e,"agentId",3,"default");var s=os(),a=T(s);is(a,{get agentId(){return i()}}),w(s),D(t,s)}var as=$('<div class="unified-main svelte-1vrq4s9"><!></div>'),rs=$('<div class="unified-main constellation-full svelte-1vrq4s9"><!></div>'),ls=$('<div class="unified-memory svelte-1vrq4s9"><div class="tab-header svelte-1vrq4s9"><div class="tab-header-left svelte-1vrq4s9"><span class="tab-header-title svelte-1vrq4s9">ONTOLOGY</span> <span class="tab-header-sep svelte-1vrq4s9" aria-hidden="true"></span> <span class="tab-header-count svelte-1vrq4s9">CORTEX INDEX -> CONSTELLATION</span></div> <div class="unified-actions svelte-1vrq4s9"><!> <!></div></div> <div><!></div></div>');function cs(t,e){cn(e,!0);const i=new Set(["cortex","constellation"]);function s(){if(typeof window>"u")return"cortex";const b=window.location.hash.replace("#","").split("/");return b[0]!=="cortex-memory"&&b[0]!=="ontology"?"cortex":b[1]&&i.has(b[1])?b[1]:"cortex"}let a=B(Tt(s()));Wt(()=>{if(typeof window>"u")return;const v=l(a)==="cortex"?"cortex-memory":"cortex-memory/constellation";window.location.hash!==`#${v}`&&Ci(`#${v}`,{})}),Wt(()=>{if(typeof window>"u")return;const v=()=>{const b=s();b!==l(a)&&x(a,b,!0)};return window.addEventListener("hashchange",v),()=>window.removeEventListener("hashchange",v)});var r=ls(),d=T(r),h=q(T(d),2),f=T(h);{let v=ot(()=>`tab-switch ${l(a)==="cortex"?"tab-switch-active":""}`);Ue(f,{variant:"outline",size:"sm",get class(){return l(v)},onclick:()=>x(a,"cortex"),children:(b,N)=>{He();var L=Be("CORTEX");D(b,L)},$$slots:{default:!0}})}var g=q(f,2);{let v=ot(()=>`tab-switch ${l(a)==="constellation"?"tab-switch-active":""}`);Ue(g,{variant:"outline",size:"sm",get class(){return l(v)},onclick:()=>x(a,"constellation"),children:(b,N)=>{He();var L=Be("CONSTELLATION");D(b,L)},$$slots:{default:!0}})}w(h),w(d);var m=q(d,2);let M;var S=T(m);{var k=v=>{var b=as(),N=T(b);Ri(N,{get memories(){return e.memories},get agentId(){return e.agentId},embedded:!0}),w(b),D(v,b)},P=v=>{var b=rs(),N=T(b);ss(N,{get agentId(){return e.agentId}}),w(b),D(v,b)};it(S,v=>{l(a)==="cortex"?v(k):v(P,-1)})}w(m),w(r),U(()=>M=me(m,1,"unified-body svelte-1vrq4s9",null,M,{"unified-body-flush":l(a)==="constellation"})),D(t,r),un()}var ds=$('<div class="cortex-content svelte-10uk01t"><!></div>'),us=$('<div class="cortex-error svelte-10uk01t"> </div>'),hs=$('<div class="cortex-loading svelte-10uk01t">Loading apps...</div>'),fs=$('<div class="cortex-content svelte-10uk01t"><!></div>'),gs=$('<div class="cortex-error svelte-10uk01t"> </div>'),vs=$('<div class="cortex-loading svelte-10uk01t">Loading tasks...</div>'),ps=$('<div class="cortex-content svelte-10uk01t"><!></div>'),ms=$('<div class="cortex-error svelte-10uk01t"> </div>'),bs=$('<div class="cortex-loading svelte-10uk01t">Loading troubleshooter...</div>'),ys=$('<div class="cortex-content svelte-10uk01t"><!></div>'),ks=$('<div class="cortex-tab svelte-10uk01t"><!></div>');function Es(t,e){var i=ks(),s=T(i);{var a=f=>{var g=ds(),m=T(g);cs(m,{get memories(){return e.memories},get agentId(){return e.agentId},get onopenglobalsimilar(){return e.onopenglobalsimilar}}),w(g),D(f,g)},r=f=>{var g=fs(),m=T(g);ge(m,()=>ue(()=>import("./BUA1YtJe.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]),import.meta.url),M=>{var S=hs();D(M,S)},(M,S)=>{var k=Yt(),P=ht(k);ve(P,()=>l(S).default,(v,b)=>{b(v,{})}),D(M,k)},(M,S)=>{var k=us(),P=T(k);w(k),U(()=>F(P,`Failed to load: ${l(S)?.message??"unknown"??""}`)),D(M,k)}),w(g),D(f,g)},d=f=>{var g=ps(),m=T(g);ge(m,()=>ue(()=>import("./CP2U8F92.js"),__vite__mapDeps([15,1,2,3,4,5,6,16,17,18,19,20,10,21,22,23,24,25,8,26]),import.meta.url),M=>{var S=vs();D(M,S)},(M,S)=>{var k=Yt(),P=ht(k);ve(P,()=>l(S).default,(v,b)=>{b(v,{})}),D(M,k)},(M,S)=>{var k=gs(),P=T(k);w(k),U(()=>F(P,`Failed to load: ${l(S)?.message??"unknown"??""}`)),D(M,k)}),w(g),D(f,g)},h=f=>{var g=ys(),m=T(g);ge(m,()=>ue(()=>import("./Di__debW.js"),__vite__mapDeps([27,1,2,3,4,5,6,23,24,25,7,10,28]),import.meta.url),M=>{var S=bs();D(M,S)},(M,S)=>{var k=Yt(),P=ht(k);ve(P,()=>l(S).default,(v,b)=>{b(v,{})}),D(M,k)},(M,S)=>{var k=ms(),P=T(k);w(k),U(()=>F(P,`Failed to load: ${l(S)?.message??"unknown"??""}`)),D(M,k)}),w(g),D(f,g)};it(s,f=>{e.activeTab==="cortex-memory"?f(a):e.activeTab==="cortex-apps"?f(r,1):e.activeTab==="cortex-tasks"?f(d,2):e.activeTab==="cortex-troubleshooter"&&f(h,3)})}w(i),D(t,i)}export{Es as default};
|