ltcai 8.2.0 → 8.4.0
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/README.md +27 -19
- package/docs/CHANGELOG.md +59 -0
- package/docs/COMMUNITY_AND_PLUGINS.md +43 -0
- package/docs/DEVELOPMENT.md +8 -8
- package/docs/LEGACY_COMPATIBILITY.md +22 -2
- package/docs/ONBOARDING.md +38 -0
- package/docs/TRUST_MODEL.md +1 -1
- package/docs/WHY_LATTICE.md +5 -4
- package/docs/kg-schema.md +3 -3
- package/lattice_brain/__init__.py +1 -1
- package/lattice_brain/graph/ingest.py +40 -8
- package/lattice_brain/runtime/agent_runtime.py +22 -37
- package/lattice_brain/runtime/multi_agent.py +1 -1
- package/lattice_brain/workflow.py +26 -1
- package/latticeai/__init__.py +1 -1
- package/latticeai/api/chat.py +230 -51
- package/latticeai/api/knowledge_graph.py +33 -0
- package/latticeai/api/local_files.py +2 -0
- package/latticeai/api/tools.py +1 -0
- package/latticeai/api/workflow_designer.py +5 -4
- package/latticeai/core/legacy_compatibility.py +174 -0
- package/latticeai/core/marketplace.py +1 -1
- package/latticeai/core/workspace_os.py +1 -1
- package/latticeai/services/architecture_readiness.py +37 -3
- package/latticeai/services/model_catalog.py +6 -0
- package/latticeai/services/model_engines.py +12 -21
- package/latticeai/services/model_runtime.py +17 -23
- package/latticeai/services/product_readiness.py +45 -14
- package/llm_router.py +7 -28
- package/mcp_registry.py +7 -24
- package/package.json +1 -1
- package/scripts/pts-claudecode-discord-bridge.mjs +2 -1
- package/src-tauri/Cargo.lock +1 -1
- package/src-tauri/Cargo.toml +1 -1
- package/src-tauri/tauri.conf.json +1 -1
- package/static/app/asset-manifest.json +10 -10
- package/static/app/assets/{Act-D9jIknFd.js → Act-D5mo4tE4.js} +1 -1
- package/static/app/assets/{Brain-CFOtWbPN.js → Brain-BVWyQw8A.js} +1 -1
- package/static/app/assets/{Capture-Q4WYzwr5.js → Capture-C1R6GT0t.js} +1 -1
- package/static/app/assets/{Library-C5Q2yWee.js → Library-C2wIxpTs.js} +1 -1
- package/static/app/assets/{System-BLbjdr1_.js → System-DE5GRyQR.js} +1 -1
- package/static/app/assets/{index-BqammyNu.js → index-CoiuIFFP.js} +3 -3
- package/static/app/assets/{primitives-Br8uSfZ4.js → primitives-BdsUNXa6.js} +1 -1
- package/static/app/assets/{textarea-BnhNs1_X.js → textarea-e7qaj6Hm.js} +1 -1
- package/static/app/index.html +1 -1
- package/static/sw.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,c as t,d as n,g as r,h as i,i as a,m as o,n as s,p as c,t as l,u,y as d}from"./primitives-
|
|
1
|
+
import{_ as e,c as t,d as n,g as r,h as i,i as a,m as o,n as s,p as c,t as l,u,y as d}from"./primitives-BdsUNXa6.js";import{A as f,D as p,I as m,M as h,O as g,P as _,_ as v,b as y,c as b,d as x,f as S,j as C,k as w,l as T,n as E,t as D,u as O,x as k,y as A}from"./index-CoiuIFFP.js";var j=A(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),M=m(_()),N=h();function P({initialTab:e}){let t=g(e=>e.language),[r,i]=M.useState(e||`files`),a=[{id:`files`,label:y(t,`capture.tab.files`)},{id:`local`,label:y(t,`capture.tab.local`)},{id:`browser`,label:y(t,`capture.tab.browser`)},{id:`pipeline`,label:y(t,`capture.tab.pipeline`)}];return M.useEffect(()=>{(e===`pipeline`||e===`local`||e===`files`)&&i(e)},[e]),(0,N.jsxs)(`div`,{className:`space-y-5`,children:[(0,N.jsxs)(`header`,{className:`page-hero`,children:[(0,N.jsxs)(`div`,{className:`page-kicker`,children:[(0,N.jsx)(j,{className:`h-4 w-4`}),` `,y(t,`capture.kicker`)]}),(0,N.jsx)(`h1`,{className:`page-title`,children:y(t,`capture.title`)}),(0,N.jsx)(`p`,{className:`page-copy`,children:y(t,`capture.body`)})]}),(0,N.jsx)(n,{tabs:a,value:r,onChange:e=>i(e)}),r===`files`?(0,N.jsx)(F,{}):null,r===`local`?(0,N.jsx)(z,{}):null,r===`browser`?(0,N.jsx)(B,{}):null,r===`pipeline`?(0,N.jsx)(V,{}):null]})}function F(){let t=g(e=>e.language),n=C(),l=f({queryKey:[`documents`],queryFn:()=>p.documents(200)}),[u,d]=M.useState([]),m=w({mutationFn:e=>I(e,d),onSuccess:()=>{n.invalidateQueries({queryKey:[`documents`]}),n.invalidateQueries({queryKey:[`graphStats`]}),n.invalidateQueries({queryKey:[`memoryManager`]})}}),h=M.useCallback(e=>{let t=Array.from(e);t.length&&m.mutate(t)},[m]);return(0,N.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[0.75fr_1.25fr]`,children:[(0,N.jsxs)(c,{children:[(0,N.jsxs)(r,{children:[(0,N.jsxs)(e,{className:`flex items-center gap-2`,children:[(0,N.jsx)(j,{className:`h-4 w-4`}),` `,y(t,`capture.files.title`)]}),(0,N.jsx)(i,{children:y(t,`capture.files.description`)})]}),(0,N.jsxs)(o,{children:[(0,N.jsxs)(`label`,{className:`flex min-h-56 cursor-pointer flex-col items-center justify-center gap-3 rounded-lg border border-dashed border-border bg-muted/30 p-6 text-center transition hover:bg-muted/50`,onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),h(e.dataTransfer.files)},children:[(0,N.jsx)(j,{className:`h-7 w-7 text-primary`}),(0,N.jsx)(`span`,{className:`text-lg font-semibold`,children:y(t,`capture.files.drop`)}),(0,N.jsx)(`span`,{className:`max-w-sm text-sm leading-6 text-muted-foreground`,children:y(t,`capture.files.dropDetail`)}),(0,N.jsx)(`input`,{type:`file`,multiple:!0,className:`sr-only`,onChange:e=>e.target.files&&h(e.target.files)})]}),(0,N.jsx)(L,{queue:u,onRetry:e=>h([e])})]})]}),(0,N.jsx)(s,{title:y(t,`capture.files.uploaded`),result:l.data,children:e=>(0,N.jsxs)(`div`,{className:`space-y-3`,children:[(0,N.jsx)(a,{items:e.documents||e,titleKey:`filename`,metaKey:`ingest_state`,limit:12}),(0,N.jsx)(`div`,{className:`rounded-md border border-border bg-background/55 p-3 text-sm text-muted-foreground`,children:y(t,`capture.files.completed`)})]})})]})}async function I(e,t){let n=e.map(e=>({id:`${e.name}-${e.size}-${e.lastModified}-${Date.now()}`,file:e,name:e.name,size:e.size,status:`queued`}));t(e=>[...n,...e].slice(0,12));let r=[];for(let e of n){t(t=>t.map(t=>t.id===e.id?{...t,status:`uploading`}:t));let n=await p.uploadDocument(e.file);r.push(n),t(t=>t.map(t=>t.id===e.id?{...t,status:n.ok?`done`:`failed`,result:n}:t))}return r}function L({queue:e,onRetry:n}){let r=g(e=>e.language);return e.length?(0,N.jsx)(`div`,{className:`mt-4 space-y-2`,children:e.map(e=>{let i=R(e,r);return(0,N.jsxs)(`div`,{className:`rounded-md border border-border bg-background/55 p-3 text-sm`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[e.status===`done`?(0,N.jsx)(v,{className:`h-4 w-4 text-emerald-400`}):e.status===`failed`?(0,N.jsx)(d,{className:`h-4 w-4 text-amber-400`}):(0,N.jsx)(T,{className:`h-4 w-4 animate-spin text-primary`}),e.name]}),(0,N.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[Math.max(1,Math.round(e.size/1024)),` KB · `,i]})]}),e.status===`failed`?(0,N.jsxs)(E,{size:`sm`,variant:`outline`,onClick:()=>n(e.file),children:[(0,N.jsx)(b,{className:`h-3.5 w-3.5`}),` `,y(r,`capture.retry`)]}):null]}),e.result?(0,N.jsx)(t,{result:e.result,successLabel:y(r,`capture.files.success`)}):null]},e.id)})}):null}function R(e,t){if(e.status===`queued`)return y(t,`capture.files.queued`);if(e.status===`uploading`)return y(t,`capture.files.uploading`);if(!e.result?.ok)return e.result?.error||y(t,`capture.files.failed`);let n=e.result.data||{},r=String(n.node_id||n.graph_node||n.provenance_id||``);return r?y(t,`capture.files.capturedWithNode`,{node:r}):y(t,`capture.files.captured`)}function z(){let n=g(e=>e.language),d=C(),[m,h]=M.useState(``),_=f({queryKey:[`localSources`],queryFn:p.localSources}),v=f({queryKey:[`localAgent`],queryFn:p.localAgent}),b=w({mutationFn:()=>p.connectFolder(m),onSuccess:()=>d.invalidateQueries({queryKey:[`localSources`]})});return(0,N.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[0.9fr_1.1fr]`,children:[(0,N.jsxs)(c,{children:[(0,N.jsxs)(r,{children:[(0,N.jsxs)(e,{className:`flex items-center gap-2`,children:[(0,N.jsx)(x,{className:`h-4 w-4`}),` `,y(n,`capture.local.title`)]}),(0,N.jsx)(i,{children:y(n,`capture.local.description`)})]}),(0,N.jsxs)(o,{className:`space-y-3`,children:[(0,N.jsx)(D,{value:m,onChange:e=>h(e.target.value),placeholder:y(n,`capture.local.placeholder`)}),(0,N.jsx)(E,{disabled:!m.trim()||b.isPending,onClick:()=>b.mutate(),children:y(n,`capture.local.connect`)}),b.data?(0,N.jsx)(t,{result:b.data,successLabel:y(n,`capture.local.success`)}):null]})]}),(0,N.jsx)(s,{title:y(n,`capture.local.sources`),result:_.data,children:e=>(0,N.jsxs)(`div`,{className:`space-y-3`,children:[(0,N.jsx)(a,{items:e.sources,titleKey:`path`,metaKey:`status`}),k(e.sources).map(e=>(0,N.jsx)(l,{label:`Stop ${String(e.path||e.id||`source`)}`,action:()=>p.localWatchStop(String(e.id||e.source_id)),invalidate:[`localSources`]},String(e.id||e.source_id||e.path)))]})}),(0,N.jsx)(s,{title:y(n,`capture.local.access`),result:v.data,className:`xl:col-span-2`,children:e=>(0,N.jsx)(u,{value:e})})]})}function B(){let n=g(e=>e.language),[a,s]=M.useState(``),l=w({mutationFn:()=>p.browserReadUrl(a)});return(0,N.jsxs)(c,{children:[(0,N.jsxs)(r,{children:[(0,N.jsxs)(e,{className:`flex items-center gap-2`,children:[(0,N.jsx)(S,{className:`h-4 w-4`}),` `,y(n,`capture.browser.title`)]}),(0,N.jsx)(i,{children:y(n,`capture.browser.description`)})]}),(0,N.jsxs)(o,{className:`space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,N.jsx)(D,{value:a,onChange:e=>s(e.target.value),placeholder:y(n,`capture.browser.placeholder`)}),(0,N.jsx)(E,{disabled:!a.trim()||l.isPending,onClick:()=>l.mutate(),children:y(n,`capture.browser.capture`)})]}),l.data?(0,N.jsx)(t,{result:l.data,successLabel:y(n,`capture.browser.success`)}):null]})]})}function V(){let t=g(e=>e.language),n=f({queryKey:[`index`],queryFn:p.indexStatus}),a=f({queryKey:[`graphStats`],queryFn:p.graphStats});return(0,N.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,N.jsx)(s,{title:y(t,`capture.pipeline.status`),result:n.data,children:e=>(0,N.jsx)(u,{value:e})}),(0,N.jsx)(s,{title:y(t,`capture.pipeline.growth`),result:a.data,children:e=>(0,N.jsx)(u,{value:e})}),(0,N.jsxs)(c,{className:`xl:col-span-2`,children:[(0,N.jsxs)(r,{children:[(0,N.jsxs)(e,{className:`flex items-center gap-2`,children:[(0,N.jsx)(O,{className:`h-4 w-4`}),` `,y(t,`capture.pipeline.refresh`)]}),(0,N.jsx)(i,{children:y(t,`capture.pipeline.description`)})]}),(0,N.jsx)(o,{children:(0,N.jsx)(l,{label:y(t,`capture.pipeline.rebuild`),action:()=>p.rebuildIndex(),invalidate:[`index`]})})]})]})}export{P as CapturePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,p as u,r as d,t as f,u as p,v as m}from"./primitives-Br8uSfZ4.js";import{A as h,D as g,I as _,M as v,O as y,P as b,_ as x,b as S,h as C,j as w,k as T,n as E,p as D,t as O,x as k,y as A}from"./index-BqammyNu.js";var j=A(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),M=A(`circle-play`,[[`path`,{d:`M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z`,key:`kmsa83`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),N=A(`package-plus`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),P=A(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),F=A(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),I=_(b()),L=v(),R=[{id:`models`,labelKey:`library.tab.models`},{id:`skills`,labelKey:`library.tab.skills`},{id:`mcp`,labelKey:`library.tab.mcp`},{id:`marketplace`,labelKey:`library.tab.marketplace`}];function z({initialTab:e}){y(e=>e.mode);let t=y(e=>e.language),[r,i]=I.useState(e||`models`);I.useEffect(()=>{R.some(t=>t.id===e)&&i(e)},[e]);let a=R.map(e=>({id:e.id,label:S(t,e.labelKey)}));return(0,L.jsxs)(`div`,{className:`space-y-5`,children:[(0,L.jsxs)(`header`,{className:`page-hero`,children:[(0,L.jsxs)(`div`,{className:`page-kicker`,children:[(0,L.jsx)(j,{className:`h-4 w-4`}),` `,S(t,`library.kicker`)]}),(0,L.jsx)(`h1`,{className:`page-title`,children:S(t,`library.title`)}),(0,L.jsx)(`p`,{className:`page-copy`,children:S(t,`library.body`)})]}),(0,L.jsx)(n,{tabs:a,value:r,onChange:e=>i(e)}),r===`models`?(0,L.jsx)(B,{}):null,r===`skills`?(0,L.jsx)(G,{}):null,r===`mcp`?(0,L.jsx)(K,{}):null,r===`marketplace`?(0,L.jsx)(q,{}):null]})}function B(){let e=w(),t=y(e=>e.mode),n=h({queryKey:[`models`],queryFn:g.models}),i=h({queryKey:[`modelRecommendations`,`local_mlx`],queryFn:()=>g.modelRecommendations(`local_mlx`)}),a=h({queryKey:[`embeddings`],queryFn:g.embeddingsStatus}),[s,c]=I.useState(!1),[u,_]=I.useState(null),[v,b]=I.useState([]),[S,T]=I.useState(null),[O,A]=I.useState(null),[j,P]=I.useState(!1),R=[...k(n.data?.data?.catalog),...k(n.data?.data?.recommended)],z=k(i.data?.data?.recommendations?.models),B=new Map(z.map(e=>[String(e.id),e])),G=k(n.data?.data?.loaded),K=String(n.data?.data?.current||``),q=R.find(e=>G.includes(String(e.id))||String(e.id)===K),J=i.data?.data?.recommendations?.top_pick||null,Y=v[v.length-1]||null,X=I.useCallback(e=>{let n=String(e||`This model is not ready to load yet.`);return t===`basic`?n.replace(/gemma4_unified/gi,`this local model format`).replace(/mlx[-_ ]?vlm|mlx[-_ ]?lm|local_mlx|\bmlx\b|\bgguf\b|\bollama\b|hugging face/gi,`local model support`).replace(/runtime/gi,`model support`).replace(/model_type/gi,`model format`).replace(/this local model format local model support format/gi,`this local model format`).replace(/local model support model support/gi,`local model support`):n},[t]);async function Z(t,n,r){P(!0),_(t),b([]),T(null),A(null);let i=await g.streamModelPrepare({model:t,engine:n||`local_mlx`,allow_download:r},{onProgress:e=>b(t=>[...t.slice(-8),e]),onDone:e=>T(e),onError:e=>A(e)});P(!1),await e.invalidateQueries({queryKey:[`models`]}),await e.invalidateQueries({queryKey:[`modelRecommendations`,`local_mlx`]}),!i.ok&&!O&&A(i.data)}return(0,L.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[1.2fr_0.8fr]`,children:[(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsx)(l,{title:`Guided model setup`,description:`Lattice recommends a small set first, explains internet/download needs, and keeps every model download behind consent.`,result:i.data,children:t=>{let n=t.recommendations,r=t.profile;return(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsx)(H,{profile:r||{},recommendation:n||{},current:q,currentId:K,latestProgress:Y,lastResult:S,onReload:()=>{q&&Z(String(q.recommended_load_id||q.id||K),String(q.recommended_engine||q.engine||`local_mlx`),s)},onUnload:()=>{K&&g.unloadModel(K).then(()=>e.invalidateQueries({queryKey:[`models`]}))}}),(0,L.jsx)(`div`,{className:`grid gap-2 md:grid-cols-3 xl:grid-cols-6`,children:[[`Environment Analysis`,!0,C],[`Recommended Models`,!!(J||R.length),x],[`Install`,!!(q||Y?.stage===`engine`),N],[`Download Progress`,!!(q||Y?.stage===`download`),D],[`Validate`,!!(q||Y?.stage===`smoke_test`),F],[`Load / Ready`,!!(q||S),M]].map(([e,t,n])=>(0,L.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/55 p-3`,children:[I.createElement(n,{className:`h-4 w-4 text-primary`}),(0,L.jsx)(`div`,{className:`mt-2 text-sm font-medium`,children:String(e)}),(0,L.jsx)(m,{variant:t?`success`:`muted`,children:t?`ready`:`pending`})]},String(e)))}),(0,L.jsxs)(`label`,{className:`flex items-start gap-2 rounded-lg border border-border bg-background/55 p-3 text-sm leading-6`,children:[(0,L.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:s,onChange:e=>c(e.target.checked)}),(0,L.jsx)(`span`,{children:`Allow Lattice to install a missing local model component or download model files for this action. Download uses the internet; running the model stays local.`})]}),Y?(0,L.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/55 p-3 text-sm`,children:[(0,L.jsx)(`div`,{className:`font-medium`,children:String(Y.message||`Preparing model`)}),(0,L.jsx)(`div`,{className:`mt-2 h-2 overflow-hidden rounded-full bg-muted`,children:(0,L.jsx)(`div`,{className:`h-full bg-primary`,style:{width:`${Number(Y.percent||8)}%`}})}),Y.detail?(0,L.jsx)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:String(Y.detail)}):null]}):null,O?(0,L.jsx)(U,{error:O}):null]})}}),(0,L.jsx)(l,{title:t===`basic`?`Recommended models`:`Recommended and advanced models`,result:n.data,children:e=>(0,L.jsxs)(`div`,{className:`grid gap-2`,children:[(R.length?R:k(e.loaded)).slice(0,t===`basic`?3:14).map((n,r)=>{let i=String(n.id||n.model_id||n.name||r),a=k(e.loaded).includes(i)||e.current===i||n.state===`loaded`,o=String(n.recommended_load_id||i),c=String(n.recommended_engine||n.engine||``),l=B.get(i)||B.get(o)||{},d=W(n.verification),p=W(l.verification),h=W(n.hardware),_=W(l.hardware),v=h.notes||_.notes||(h.recommended_ram_gb?`~${h.recommended_ram_gb}GB RAM rec`:``),y=n.safety_notes||l.safety_notes,b=n.license||l.license,x=n.runtime_compatibility||l.runtime_compatibility||{},S=String(x.status||``)===`fallback_available`,C=n.load_status===`unsupported`||x.supported===!1,w=!!n.download_required,T=(!!n.load_available||a)&&!C,D=String(n.load_status||(a?`loaded`:`unavailable`)),O=X(n.unavailable_reason||`This model is not ready to load yet.`),A=String(n.runtime_label||x.preferred_runtime||c||`local_mlx`),M=String(x.action||D.replace(/_/g,` `)),N=C&&t===`basic`?`needs attention`:C?M:D,P=T||w,F=n.download_size||n.estimated_size||l.download_size||l.estimated_size||n.size||l.size,I=n.provider||l.provider||n.organization||l.organization;return(0,L.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-border bg-background/55 p-4 md:grid-cols-[1fr_auto]`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(`div`,{className:`text-base font-semibold`,children:String(n.name||i)}),J?.id===i||n.recommended_default?(0,L.jsx)(m,{variant:`success`,children:`recommended`}):null,String(n.modality||l.modality||``).includes(`multi`)||String(n.modality||``)===`multimodal`?(0,L.jsx)(m,{variant:`muted`,children:`multimodal`}):null,d.verified||p.verified?(0,L.jsx)(m,{variant:`success`,title:`HF verified (config+tokenizer present)`,children:`✓ HF`}):null]}),(0,L.jsx)(`div`,{className:`mt-1 text-sm text-muted-foreground`,children:t===`basic`?[X(n.family||l.family||`Local model`),/mlx|gguf|ollama/i.test(String(n.size||l.size||``))?``:n.size||l.size].filter(Boolean).map(String).join(` · `):[n.family||l.family||`local`,n.size||l.size].filter(Boolean).map(String).join(` · `)}),n.hardware||l.hardware?(0,L.jsx)(`div`,{className:`mt-1 text-[11px] text-muted-foreground/80`,children:String(v)}):null,(0,L.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1 text-[11px] text-muted-foreground`,children:[(0,L.jsx)(m,{variant:`muted`,children:w?`Download: ${String(F||`required`)}`:`No download needed now`}),(0,L.jsx)(m,{variant:`muted`,children:w?`Internet only during download`:`Runs locally when loaded`}),I?(0,L.jsx)(m,{variant:`muted`,children:String(I)}):null]}),C?(0,L.jsxs)(`div`,{className:`mt-3 rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-sm`,children:[(0,L.jsx)(`div`,{className:`font-medium`,children:t===`basic`?`Needs attention before loading`:M}),(0,L.jsx)(`div`,{className:`text-muted-foreground`,children:X(x.user_message||O)})]}):S?(0,L.jsxs)(`div`,{className:`mt-3 rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-sm`,children:[(0,L.jsx)(`div`,{className:`font-medium`,children:t===`basic`?`Compatible loading path available`:`Runtime fallback available`}),(0,L.jsx)(`div`,{className:`text-muted-foreground`,children:X(x.user_message||`Lattice will try the compatible local runtime path before showing this model as unsupported.`)})]}):!a&&!T?(0,L.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:O}):null,t===`basic`?null:(0,L.jsxs)(`div`,{className:`mt-2 space-y-1 text-xs text-muted-foreground`,children:[(0,L.jsxs)(`div`,{children:[A,` · `,o,n.load_strategy||l.load_strategy?` · ${String(n.load_strategy||l.load_strategy)}`:``,d.notes?` · ${String(d.notes).slice(0,60)}`:``]}),y||b?(0,L.jsx)(`div`,{children:[b?`License: ${String(b)}`:``,y?String(y):``].filter(Boolean).join(` · `)}):null]}),C||S?(0,L.jsx)(V,{compatibility:x}):null]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 md:justify-end`,children:[(0,L.jsx)(m,{variant:a?`success`:T?`muted`:`warning`,children:a?`loaded`:N}),a?(0,L.jsx)(f,{label:`Unload`,action:()=>g.unloadModel(o),invalidate:[`models`]}):(0,L.jsx)(E,{variant:`outline`,disabled:j||C||!P||w&&!s,onClick:()=>Z(o,c||`local_mlx`,s),children:u===o&&j?`Preparing`:w?`Install & Load`:`Validate & Load`})]})]},i)}),t===`basic`&&R.length>3?(0,L.jsx)(`div`,{className:`rounded-lg border border-border bg-background/55 p-3 text-sm text-muted-foreground`,children:`Showing the safest short list. Switch to Advanced for the full registry, runtime details, licenses, and safety notes.`}):null]})})]}),(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsx)(l,{title:t===`basic`?`Memory search support`:`Embedding provider`,result:a.data,children:e=>t===`basic`?(0,L.jsx)(r,{value:e.state||`ready`}):(0,L.jsx)(p,{value:e})}),(0,L.jsx)(l,{title:`Model validation`,result:n.data,children:e=>{let n=k(e.compat_profiles);return n.length?(0,L.jsx)(o,{items:n.map(e=>({...e,name:t===`basic`?e.name||e.display_name||`Loaded model`:e.name||e.display_name||e.model_id,status:e.quality_status||e.load_status||`checked`})),titleKey:`name`,metaKey:`status`,limit:6}):(0,L.jsx)(d,{title:`No model checked yet`,detail:`Load a model to confirm it can answer before you start using it.`})}})]})]})}function V({compatibility:e}){let t=y(e=>e.mode),n=k(e.alternatives);return n.length?(0,L.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:n.slice(0,3).map(e=>(0,L.jsx)(m,{variant:`muted`,children:t===`basic`&&/mlx|gguf|ollama|lm studio/i.test(String(e.name||e.id))?`Compatible alternative`:String(e.name||e.id)},String(e.id||e.name)))}):null}function H({profile:e,recommendation:t,current:n,currentId:r,latestProgress:i,lastResult:a,onReload:o,onUnload:c}){let l=String(n?.name||n?.id||r||``),u=String(n?.engine||n?.recommended_engine||i?.engine||`local_mlx`),d=String(n?.local_path||n?.storage_location||t.cache_path||t.storage_location||`~/.cache/huggingface / ~/.latticeai/models`),f=String(i?.stage||a?.stage||(l?`ready`:`idle`));return(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(s,{stats:[{label:`Computer`,value:e?.os?`${String(e.os)} ${String(e.arch||``)}`:`detected`},{label:`Engine`,value:u},{label:`Loaded model`,value:l||`No local model loaded`},{label:`Runtime state`,value:f}]}),(0,L.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/55 p-3 text-sm`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`font-medium`,children:l?`Local model runtime is available`:`No model is loaded yet`}),(0,L.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`Cache/storage: `,d]})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsx)(E,{variant:`outline`,size:`sm`,disabled:!l,onClick:o,children:`Reload`}),(0,L.jsx)(E,{variant:`outline`,size:`sm`,disabled:!l,onClick:c,children:`Unload`})]})]}),i?(0,L.jsxs)(`div`,{className:`mt-3`,children:[(0,L.jsxs)(`div`,{className:`flex justify-between text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{children:String(i.message||`Preparing model`)}),(0,L.jsxs)(`span`,{children:[Number(i.percent||0),`%`]})]}),(0,L.jsx)(`div`,{className:`mt-1 h-2 overflow-hidden rounded-full bg-muted`,children:(0,L.jsx)(`div`,{className:`h-full bg-primary`,style:{width:`${Number(i.percent||8)}%`}})})]}):null]})]})}function U({error:e}){let t=k(e.recovery_guidance);return(0,L.jsxs)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-sm`,children:[(0,L.jsx)(`div`,{className:`font-medium`,children:String(e.user_message||`Model setup needs attention.`)}),t.length?(0,L.jsx)(`ul`,{className:`mt-2 list-inside list-disc text-muted-foreground`,children:t.slice(0,3).map(e=>(0,L.jsx)(`li`,{children:e},e))}):null]})}function W(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function G(){let e=w(),t=h({queryKey:[`skills`],queryFn:g.skills}),n=h({queryKey:[`skillsMarketplace`],queryFn:g.skillsMarketplace}),r=T({mutationFn:e=>g.skillInstall(String(e.name||e.id),String(e.plugin||``)),onSuccess:()=>e.invalidateQueries({queryKey:[`skills`]})});return(0,L.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,L.jsx)(l,{title:`Installed skills`,result:t.data,children:e=>(0,L.jsx)(`div`,{className:`grid gap-2`,children:k(e.skills).map(e=>(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`font-medium`,children:String(e.name||e.id)}),(0,L.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:String(e.plugin||e.description||``)})]}),(0,L.jsx)(f,{label:e.enabled?`Disable`:`Enable`,action:()=>g.skillToggle(String(e.name||e.id),!!e.enabled),invalidate:[`skills`]})]},String(e.name||e.id)))})}),(0,L.jsx)(l,{title:`Skill marketplace`,result:n.data,children:e=>(0,L.jsx)(`div`,{className:`grid gap-2`,children:k(e.skills).slice(0,10).map(e=>(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`font-medium`,children:String(e.name||e.id)}),(0,L.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:String(e.description||e.category||``)})]}),(0,L.jsx)(E,{variant:`outline`,disabled:r.isPending,onClick:()=>r.mutate(e),children:`Install`})]},String(e.name||e.id)))})})]})}function K(){let n=y(e=>e.mode),[r,s]=I.useState(`github`),d=h({queryKey:[`mcpTools`],queryFn:g.mcpTools}),f=T({mutationFn:()=>g.mcpRecommend(r)});return(0,L.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[1fr_1fr]`,children:[(0,L.jsx)(l,{title:n===`basic`?`Tool connections`:`MCP tools`,result:d.data,children:e=>(0,L.jsx)(o,{items:e.tools||e.installed_mcps,titleKey:`name`,metaKey:`status`})}),(0,L.jsxs)(u,{children:[(0,L.jsxs)(i,{children:[(0,L.jsxs)(e,{className:`flex items-center gap-2`,children:[(0,L.jsx)(P,{className:`h-4 w-4`}),` Recommend connector`]}),(0,L.jsx)(a,{children:`Describe what you want to connect and Lattice will suggest a connector.`})]}),(0,L.jsxs)(c,{className:`space-y-3`,children:[(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(O,{value:r,onChange:e=>s(e.target.value)}),(0,L.jsx)(E,{onClick:()=>f.mutate(),disabled:!r.trim()||f.isPending,children:`Recommend`})]}),f.data?(0,L.jsx)(t,{result:f.data,successLabel:`Recommendation completed`}):null]})]})]})}function q(){let t=h({queryKey:[`templates`],queryFn:g.templates}),n=h({queryKey:[`plugins`],queryFn:g.pluginsRegistry}),r=h({queryKey:[`pluginsDirectory`],queryFn:g.pluginsDirectory});return(0,L.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-3`,children:[(0,L.jsx)(l,{title:`Templates`,result:t.data,children:e=>(0,L.jsx)(o,{items:e.templates,titleKey:`name`,metaKey:`kind`})}),(0,L.jsx)(l,{title:`Installed plugins`,result:n.data,children:e=>(0,L.jsx)(o,{items:e.plugins,titleKey:`name`,metaKey:`status`})}),(0,L.jsx)(l,{title:`Plugin directory`,result:r.data,children:e=>(0,L.jsx)(o,{items:e.plugins,titleKey:`name`,metaKey:`category`})}),(0,L.jsxs)(u,{className:`xl:col-span-3`,children:[(0,L.jsxs)(i,{children:[(0,L.jsxs)(e,{className:`flex items-center gap-2`,children:[(0,L.jsx)(N,{className:`h-4 w-4`}),` Template install`]}),(0,L.jsx)(a,{children:`Start from a reusable workspace pattern.`})]}),(0,L.jsx)(c,{children:k(t.data?.data?.templates).length?(0,L.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:k(t.data?.data?.templates).slice(0,6).map(e=>(0,L.jsx)(f,{label:`Install ${String(e.name||e.id)}`,action:()=>g.installTemplate(e)},String(e.id||e.name)))}):(0,L.jsx)(o,{items:[]})})]})]})}export{z as LibraryPage};
|
|
1
|
+
import{_ as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,p as u,r as d,t as f,u as p,v as m}from"./primitives-BdsUNXa6.js";import{A as h,D as g,I as _,M as v,O as y,P as b,_ as x,b as S,h as C,j as w,k as T,n as E,p as D,t as O,x as k,y as A}from"./index-CoiuIFFP.js";var j=A(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),M=A(`circle-play`,[[`path`,{d:`M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z`,key:`kmsa83`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),N=A(`package-plus`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),P=A(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),F=A(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),I=_(b()),L=v(),R=[{id:`models`,labelKey:`library.tab.models`},{id:`skills`,labelKey:`library.tab.skills`},{id:`mcp`,labelKey:`library.tab.mcp`},{id:`marketplace`,labelKey:`library.tab.marketplace`}];function z({initialTab:e}){y(e=>e.mode);let t=y(e=>e.language),[r,i]=I.useState(e||`models`);I.useEffect(()=>{R.some(t=>t.id===e)&&i(e)},[e]);let a=R.map(e=>({id:e.id,label:S(t,e.labelKey)}));return(0,L.jsxs)(`div`,{className:`space-y-5`,children:[(0,L.jsxs)(`header`,{className:`page-hero`,children:[(0,L.jsxs)(`div`,{className:`page-kicker`,children:[(0,L.jsx)(j,{className:`h-4 w-4`}),` `,S(t,`library.kicker`)]}),(0,L.jsx)(`h1`,{className:`page-title`,children:S(t,`library.title`)}),(0,L.jsx)(`p`,{className:`page-copy`,children:S(t,`library.body`)})]}),(0,L.jsx)(n,{tabs:a,value:r,onChange:e=>i(e)}),r===`models`?(0,L.jsx)(B,{}):null,r===`skills`?(0,L.jsx)(G,{}):null,r===`mcp`?(0,L.jsx)(K,{}):null,r===`marketplace`?(0,L.jsx)(q,{}):null]})}function B(){let e=w(),t=y(e=>e.mode),n=h({queryKey:[`models`],queryFn:g.models}),i=h({queryKey:[`modelRecommendations`,`local_mlx`],queryFn:()=>g.modelRecommendations(`local_mlx`)}),a=h({queryKey:[`embeddings`],queryFn:g.embeddingsStatus}),[s,c]=I.useState(!1),[u,_]=I.useState(null),[v,b]=I.useState([]),[S,T]=I.useState(null),[O,A]=I.useState(null),[j,P]=I.useState(!1),R=[...k(n.data?.data?.catalog),...k(n.data?.data?.recommended)],z=k(i.data?.data?.recommendations?.models),B=new Map(z.map(e=>[String(e.id),e])),G=k(n.data?.data?.loaded),K=String(n.data?.data?.current||``),q=R.find(e=>G.includes(String(e.id))||String(e.id)===K),J=i.data?.data?.recommendations?.top_pick||null,Y=v[v.length-1]||null,X=I.useCallback(e=>{let n=String(e||`This model is not ready to load yet.`);return t===`basic`?n.replace(/gemma4_unified/gi,`this local model format`).replace(/mlx[-_ ]?vlm|mlx[-_ ]?lm|local_mlx|\bmlx\b|\bgguf\b|\bollama\b|hugging face/gi,`local model support`).replace(/runtime/gi,`model support`).replace(/model_type/gi,`model format`).replace(/this local model format local model support format/gi,`this local model format`).replace(/local model support model support/gi,`local model support`):n},[t]);async function Z(t,n,r){P(!0),_(t),b([]),T(null),A(null);let i=await g.streamModelPrepare({model:t,engine:n||`local_mlx`,allow_download:r},{onProgress:e=>b(t=>[...t.slice(-8),e]),onDone:e=>T(e),onError:e=>A(e)});P(!1),await e.invalidateQueries({queryKey:[`models`]}),await e.invalidateQueries({queryKey:[`modelRecommendations`,`local_mlx`]}),!i.ok&&!O&&A(i.data)}return(0,L.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[1.2fr_0.8fr]`,children:[(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsx)(l,{title:`Guided model setup`,description:`Lattice recommends a small set first, explains internet/download needs, and keeps every model download behind consent.`,result:i.data,children:t=>{let n=t.recommendations,r=t.profile;return(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsx)(H,{profile:r||{},recommendation:n||{},current:q,currentId:K,latestProgress:Y,lastResult:S,onReload:()=>{q&&Z(String(q.recommended_load_id||q.id||K),String(q.recommended_engine||q.engine||`local_mlx`),s)},onUnload:()=>{K&&g.unloadModel(K).then(()=>e.invalidateQueries({queryKey:[`models`]}))}}),(0,L.jsx)(`div`,{className:`grid gap-2 md:grid-cols-3 xl:grid-cols-6`,children:[[`Environment Analysis`,!0,C],[`Recommended Models`,!!(J||R.length),x],[`Install`,!!(q||Y?.stage===`engine`),N],[`Download Progress`,!!(q||Y?.stage===`download`),D],[`Validate`,!!(q||Y?.stage===`smoke_test`),F],[`Load / Ready`,!!(q||S),M]].map(([e,t,n])=>(0,L.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/55 p-3`,children:[I.createElement(n,{className:`h-4 w-4 text-primary`}),(0,L.jsx)(`div`,{className:`mt-2 text-sm font-medium`,children:String(e)}),(0,L.jsx)(m,{variant:t?`success`:`muted`,children:t?`ready`:`pending`})]},String(e)))}),(0,L.jsxs)(`label`,{className:`flex items-start gap-2 rounded-lg border border-border bg-background/55 p-3 text-sm leading-6`,children:[(0,L.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:s,onChange:e=>c(e.target.checked)}),(0,L.jsx)(`span`,{children:`Allow Lattice to install a missing local model component or download model files for this action. Download uses the internet; running the model stays local.`})]}),Y?(0,L.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/55 p-3 text-sm`,children:[(0,L.jsx)(`div`,{className:`font-medium`,children:String(Y.message||`Preparing model`)}),(0,L.jsx)(`div`,{className:`mt-2 h-2 overflow-hidden rounded-full bg-muted`,children:(0,L.jsx)(`div`,{className:`h-full bg-primary`,style:{width:`${Number(Y.percent||8)}%`}})}),Y.detail?(0,L.jsx)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:String(Y.detail)}):null]}):null,O?(0,L.jsx)(U,{error:O}):null]})}}),(0,L.jsx)(l,{title:t===`basic`?`Recommended models`:`Recommended and advanced models`,result:n.data,children:e=>(0,L.jsxs)(`div`,{className:`grid gap-2`,children:[(R.length?R:k(e.loaded)).slice(0,t===`basic`?3:14).map((n,r)=>{let i=String(n.id||n.model_id||n.name||r),a=k(e.loaded).includes(i)||e.current===i||n.state===`loaded`,o=String(n.recommended_load_id||i),c=String(n.recommended_engine||n.engine||``),l=B.get(i)||B.get(o)||{},d=W(n.verification),p=W(l.verification),h=W(n.hardware),_=W(l.hardware),v=h.notes||_.notes||(h.recommended_ram_gb?`~${h.recommended_ram_gb}GB RAM rec`:``),y=n.safety_notes||l.safety_notes,b=n.license||l.license,x=n.runtime_compatibility||l.runtime_compatibility||{},S=String(x.status||``)===`fallback_available`,C=n.load_status===`unsupported`||x.supported===!1,w=!!n.download_required,T=(!!n.load_available||a)&&!C,D=String(n.load_status||(a?`loaded`:`unavailable`)),O=X(n.unavailable_reason||`This model is not ready to load yet.`),A=String(n.runtime_label||x.preferred_runtime||c||`local_mlx`),M=String(x.action||D.replace(/_/g,` `)),N=C&&t===`basic`?`needs attention`:C?M:D,P=T||w,F=n.download_size||n.estimated_size||l.download_size||l.estimated_size||n.size||l.size,I=n.provider||l.provider||n.organization||l.organization;return(0,L.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-border bg-background/55 p-4 md:grid-cols-[1fr_auto]`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(`div`,{className:`text-base font-semibold`,children:String(n.name||i)}),J?.id===i||n.recommended_default?(0,L.jsx)(m,{variant:`success`,children:`recommended`}):null,String(n.modality||l.modality||``).includes(`multi`)||String(n.modality||``)===`multimodal`?(0,L.jsx)(m,{variant:`muted`,children:`multimodal`}):null,d.verified||p.verified?(0,L.jsx)(m,{variant:`success`,title:`HF verified (config+tokenizer present)`,children:`✓ HF`}):null]}),(0,L.jsx)(`div`,{className:`mt-1 text-sm text-muted-foreground`,children:t===`basic`?[X(n.family||l.family||`Local model`),/mlx|gguf|ollama/i.test(String(n.size||l.size||``))?``:n.size||l.size].filter(Boolean).map(String).join(` · `):[n.family||l.family||`local`,n.size||l.size].filter(Boolean).map(String).join(` · `)}),n.hardware||l.hardware?(0,L.jsx)(`div`,{className:`mt-1 text-[11px] text-muted-foreground/80`,children:String(v)}):null,(0,L.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1 text-[11px] text-muted-foreground`,children:[(0,L.jsx)(m,{variant:`muted`,children:w?`Download: ${String(F||`required`)}`:`No download needed now`}),(0,L.jsx)(m,{variant:`muted`,children:w?`Internet only during download`:`Runs locally when loaded`}),I?(0,L.jsx)(m,{variant:`muted`,children:String(I)}):null]}),C?(0,L.jsxs)(`div`,{className:`mt-3 rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-sm`,children:[(0,L.jsx)(`div`,{className:`font-medium`,children:t===`basic`?`Needs attention before loading`:M}),(0,L.jsx)(`div`,{className:`text-muted-foreground`,children:X(x.user_message||O)})]}):S?(0,L.jsxs)(`div`,{className:`mt-3 rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-sm`,children:[(0,L.jsx)(`div`,{className:`font-medium`,children:t===`basic`?`Compatible loading path available`:`Runtime fallback available`}),(0,L.jsx)(`div`,{className:`text-muted-foreground`,children:X(x.user_message||`Lattice will try the compatible local runtime path before showing this model as unsupported.`)})]}):!a&&!T?(0,L.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:O}):null,t===`basic`?null:(0,L.jsxs)(`div`,{className:`mt-2 space-y-1 text-xs text-muted-foreground`,children:[(0,L.jsxs)(`div`,{children:[A,` · `,o,n.load_strategy||l.load_strategy?` · ${String(n.load_strategy||l.load_strategy)}`:``,d.notes?` · ${String(d.notes).slice(0,60)}`:``]}),y||b?(0,L.jsx)(`div`,{children:[b?`License: ${String(b)}`:``,y?String(y):``].filter(Boolean).join(` · `)}):null]}),C||S?(0,L.jsx)(V,{compatibility:x}):null]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 md:justify-end`,children:[(0,L.jsx)(m,{variant:a?`success`:T?`muted`:`warning`,children:a?`loaded`:N}),a?(0,L.jsx)(f,{label:`Unload`,action:()=>g.unloadModel(o),invalidate:[`models`]}):(0,L.jsx)(E,{variant:`outline`,disabled:j||C||!P||w&&!s,onClick:()=>Z(o,c||`local_mlx`,s),children:u===o&&j?`Preparing`:w?`Install & Load`:`Validate & Load`})]})]},i)}),t===`basic`&&R.length>3?(0,L.jsx)(`div`,{className:`rounded-lg border border-border bg-background/55 p-3 text-sm text-muted-foreground`,children:`Showing the safest short list. Switch to Advanced for the full registry, runtime details, licenses, and safety notes.`}):null]})})]}),(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsx)(l,{title:t===`basic`?`Memory search support`:`Embedding provider`,result:a.data,children:e=>t===`basic`?(0,L.jsx)(r,{value:e.state||`ready`}):(0,L.jsx)(p,{value:e})}),(0,L.jsx)(l,{title:`Model validation`,result:n.data,children:e=>{let n=k(e.compat_profiles);return n.length?(0,L.jsx)(o,{items:n.map(e=>({...e,name:t===`basic`?e.name||e.display_name||`Loaded model`:e.name||e.display_name||e.model_id,status:e.quality_status||e.load_status||`checked`})),titleKey:`name`,metaKey:`status`,limit:6}):(0,L.jsx)(d,{title:`No model checked yet`,detail:`Load a model to confirm it can answer before you start using it.`})}})]})]})}function V({compatibility:e}){let t=y(e=>e.mode),n=k(e.alternatives);return n.length?(0,L.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:n.slice(0,3).map(e=>(0,L.jsx)(m,{variant:`muted`,children:t===`basic`&&/mlx|gguf|ollama|lm studio/i.test(String(e.name||e.id))?`Compatible alternative`:String(e.name||e.id)},String(e.id||e.name)))}):null}function H({profile:e,recommendation:t,current:n,currentId:r,latestProgress:i,lastResult:a,onReload:o,onUnload:c}){let l=String(n?.name||n?.id||r||``),u=String(n?.engine||n?.recommended_engine||i?.engine||`local_mlx`),d=String(n?.local_path||n?.storage_location||t.cache_path||t.storage_location||`~/.cache/huggingface / ~/.latticeai/models`),f=String(i?.stage||a?.stage||(l?`ready`:`idle`));return(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(s,{stats:[{label:`Computer`,value:e?.os?`${String(e.os)} ${String(e.arch||``)}`:`detected`},{label:`Engine`,value:u},{label:`Loaded model`,value:l||`No local model loaded`},{label:`Runtime state`,value:f}]}),(0,L.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/55 p-3 text-sm`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`font-medium`,children:l?`Local model runtime is available`:`No model is loaded yet`}),(0,L.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`Cache/storage: `,d]})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsx)(E,{variant:`outline`,size:`sm`,disabled:!l,onClick:o,children:`Reload`}),(0,L.jsx)(E,{variant:`outline`,size:`sm`,disabled:!l,onClick:c,children:`Unload`})]})]}),i?(0,L.jsxs)(`div`,{className:`mt-3`,children:[(0,L.jsxs)(`div`,{className:`flex justify-between text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{children:String(i.message||`Preparing model`)}),(0,L.jsxs)(`span`,{children:[Number(i.percent||0),`%`]})]}),(0,L.jsx)(`div`,{className:`mt-1 h-2 overflow-hidden rounded-full bg-muted`,children:(0,L.jsx)(`div`,{className:`h-full bg-primary`,style:{width:`${Number(i.percent||8)}%`}})})]}):null]})]})}function U({error:e}){let t=k(e.recovery_guidance);return(0,L.jsxs)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-sm`,children:[(0,L.jsx)(`div`,{className:`font-medium`,children:String(e.user_message||`Model setup needs attention.`)}),t.length?(0,L.jsx)(`ul`,{className:`mt-2 list-inside list-disc text-muted-foreground`,children:t.slice(0,3).map(e=>(0,L.jsx)(`li`,{children:e},e))}):null]})}function W(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function G(){let e=w(),t=h({queryKey:[`skills`],queryFn:g.skills}),n=h({queryKey:[`skillsMarketplace`],queryFn:g.skillsMarketplace}),r=T({mutationFn:e=>g.skillInstall(String(e.name||e.id),String(e.plugin||``)),onSuccess:()=>e.invalidateQueries({queryKey:[`skills`]})});return(0,L.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,L.jsx)(l,{title:`Installed skills`,result:t.data,children:e=>(0,L.jsx)(`div`,{className:`grid gap-2`,children:k(e.skills).map(e=>(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`font-medium`,children:String(e.name||e.id)}),(0,L.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:String(e.plugin||e.description||``)})]}),(0,L.jsx)(f,{label:e.enabled?`Disable`:`Enable`,action:()=>g.skillToggle(String(e.name||e.id),!!e.enabled),invalidate:[`skills`]})]},String(e.name||e.id)))})}),(0,L.jsx)(l,{title:`Skill marketplace`,result:n.data,children:e=>(0,L.jsx)(`div`,{className:`grid gap-2`,children:k(e.skills).slice(0,10).map(e=>(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`font-medium`,children:String(e.name||e.id)}),(0,L.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:String(e.description||e.category||``)})]}),(0,L.jsx)(E,{variant:`outline`,disabled:r.isPending,onClick:()=>r.mutate(e),children:`Install`})]},String(e.name||e.id)))})})]})}function K(){let n=y(e=>e.mode),[r,s]=I.useState(`github`),d=h({queryKey:[`mcpTools`],queryFn:g.mcpTools}),f=T({mutationFn:()=>g.mcpRecommend(r)});return(0,L.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[1fr_1fr]`,children:[(0,L.jsx)(l,{title:n===`basic`?`Tool connections`:`MCP tools`,result:d.data,children:e=>(0,L.jsx)(o,{items:e.tools||e.installed_mcps,titleKey:`name`,metaKey:`status`})}),(0,L.jsxs)(u,{children:[(0,L.jsxs)(i,{children:[(0,L.jsxs)(e,{className:`flex items-center gap-2`,children:[(0,L.jsx)(P,{className:`h-4 w-4`}),` Recommend connector`]}),(0,L.jsx)(a,{children:`Describe what you want to connect and Lattice will suggest a connector.`})]}),(0,L.jsxs)(c,{className:`space-y-3`,children:[(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(O,{value:r,onChange:e=>s(e.target.value)}),(0,L.jsx)(E,{onClick:()=>f.mutate(),disabled:!r.trim()||f.isPending,children:`Recommend`})]}),f.data?(0,L.jsx)(t,{result:f.data,successLabel:`Recommendation completed`}):null]})]})]})}function q(){let t=h({queryKey:[`templates`],queryFn:g.templates}),n=h({queryKey:[`plugins`],queryFn:g.pluginsRegistry}),r=h({queryKey:[`pluginsDirectory`],queryFn:g.pluginsDirectory});return(0,L.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-3`,children:[(0,L.jsx)(l,{title:`Templates`,result:t.data,children:e=>(0,L.jsx)(o,{items:e.templates,titleKey:`name`,metaKey:`kind`})}),(0,L.jsx)(l,{title:`Installed plugins`,result:n.data,children:e=>(0,L.jsx)(o,{items:e.plugins,titleKey:`name`,metaKey:`status`})}),(0,L.jsx)(l,{title:`Plugin directory`,result:r.data,children:e=>(0,L.jsx)(o,{items:e.plugins,titleKey:`name`,metaKey:`category`})}),(0,L.jsxs)(u,{className:`xl:col-span-3`,children:[(0,L.jsxs)(i,{children:[(0,L.jsxs)(e,{className:`flex items-center gap-2`,children:[(0,L.jsx)(N,{className:`h-4 w-4`}),` Template install`]}),(0,L.jsx)(a,{children:`Start from a reusable workspace pattern.`})]}),(0,L.jsx)(c,{children:k(t.data?.data?.templates).length?(0,L.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:k(t.data?.data?.templates).slice(0,6).map(e=>(0,L.jsx)(f,{label:`Install ${String(e.name||e.id)}`,action:()=>g.installTemplate(e)},String(e.id||e.name)))}):(0,L.jsx)(o,{items:[]})})]})]})}export{z as LibraryPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,a as t,c as n,d as r,g as i,h as a,i as o,l as s,m as c,n as l,p as u,r as d,s as f,t as p,u as m,v as h}from"./primitives-Br8uSfZ4.js";import{A as g,D as _,E as v,I as y,M as b,O as x,P as S,T as C,b as w,g as T,i as E,j as D,k as O,n as k,o as A,t as j,x as M,y as N}from"./index-BqammyNu.js";var P=N(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),F=y(S()),I=b(),L=[{id:`account`,labelKey:`system.tab.account`},{id:`workspaces`,labelKey:`system.tab.workspaces`},{id:`snapshots`,labelKey:`system.tab.snapshots`},{id:`activity`,labelKey:`system.tab.activity`},{id:`network`,labelKey:`system.tab.network`},{id:`settings`,labelKey:`system.tab.settings`},{id:`admin`,labelKey:`system.tab.admin`}];function R({initialTab:e}){let t=x(e=>e.mode),n=x(e=>e.language),[i,a]=F.useState(e||`account`);return F.useEffect(()=>{L.some(t=>t.id===e)&&a(e)},[e]),(0,I.jsxs)(`div`,{className:`space-y-5`,children:[(0,I.jsxs)(`header`,{className:`page-hero`,children:[(0,I.jsxs)(`div`,{className:`page-kicker`,children:[(0,I.jsx)(A,{className:`h-4 w-4`}),` `,w(n,`system.kicker`)]}),(0,I.jsx)(`h1`,{className:`page-title`,children:w(n,`system.title`)}),(0,I.jsx)(`p`,{className:`page-copy`,children:w(n,`system.body`)})]}),(0,I.jsx)(r,{tabs:(t===`basic`?L.filter(e=>e.id!==`admin`):L).map(e=>({id:e.id,label:w(n,e.labelKey)})),value:i,onChange:e=>a(e)}),i===`account`?(0,I.jsx)(z,{}):null,i===`workspaces`?(0,I.jsx)(B,{}):null,i===`snapshots`?(0,I.jsx)(V,{}):null,i===`activity`?(0,I.jsx)(H,{}):null,i===`network`?(0,I.jsx)(ee,{}):null,i===`settings`?(0,I.jsx)(U,{}):null,i===`admin`?(0,I.jsx)(Z,{}):null]})}function z(){let r=D(),o=g({queryKey:[`profile`],queryFn:_.profile}),s=g({queryKey:[`sso`],queryFn:_.ssoConfig}),[d,f]=F.useState(``),[h,v]=F.useState(``),[y,b]=F.useState(``),[x,S]=F.useState(``),[C,w]=F.useState(``),E=O({mutationFn:()=>_.login(d,h),onSuccess:()=>r.invalidateQueries({queryKey:[`profile`]})}),A=O({mutationFn:()=>_.register({email:d,password:h,name:y,nickname:x}),onSuccess:()=>r.invalidateQueries({queryKey:[`profile`]})}),M=O({mutationFn:()=>_.updateProfile({name:y,nickname:x}),onSuccess:()=>r.invalidateQueries({queryKey:[`profile`]})}),N=O({mutationFn:()=>_.changePassword(h,C)});return(0,I.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,I.jsx)(l,{title:`Profile`,result:o.data,children:e=>(0,I.jsx)(t,{data:e})}),(0,I.jsxs)(u,{children:[(0,I.jsxs)(i,{children:[(0,I.jsxs)(e,{className:`flex items-center gap-2`,children:[(0,I.jsx)(T,{className:`h-4 w-4`}),` Account`]}),(0,I.jsx)(a,{children:`Sign in, create a local account, and keep your profile current.`})]}),(0,I.jsxs)(c,{className:`grid gap-3`,children:[(0,I.jsx)(j,{value:d,onChange:e=>f(e.target.value),placeholder:`email`}),(0,I.jsx)(j,{type:`password`,value:h,onChange:e=>v(e.target.value),placeholder:`current password`}),(0,I.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,I.jsx)(j,{value:y,onChange:e=>b(e.target.value),placeholder:`name`}),(0,I.jsx)(j,{value:x,onChange:e=>S(e.target.value),placeholder:`nickname`})]}),(0,I.jsx)(j,{type:`password`,value:C,onChange:e=>w(e.target.value),placeholder:`new password`}),(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,I.jsx)(k,{onClick:()=>E.mutate(),disabled:!d||!h||E.isPending,children:`Login`}),(0,I.jsx)(k,{variant:`outline`,onClick:()=>A.mutate(),disabled:!d||!h||A.isPending,children:`Register`}),(0,I.jsx)(k,{variant:`outline`,onClick:()=>M.mutate(),disabled:M.isPending,children:`Save profile`}),(0,I.jsx)(k,{variant:`outline`,onClick:()=>N.mutate(),disabled:!h||!C||N.isPending,children:`Change password`}),(0,I.jsx)(p,{label:`Logout`,action:()=>_.logout(),invalidate:[`profile`]})]}),[E.data,A.data,M.data,N.data].filter(Boolean).map((e,t)=>(0,I.jsx)(n,{result:e,successLabel:`Account request completed`},t))]})]}),(0,I.jsx)(l,{title:`Sign-in options`,result:s.data,className:`xl:col-span-2`,children:e=>(0,I.jsx)(m,{value:e})})]})}function B(){let t=D(),{setWorkspaceId:n}=x(),r=g({queryKey:[`workspaceRegistry`],queryFn:_.workspaceRegistry}),s=g({queryKey:[`invitations`],queryFn:_.invitations}),[d,f]=F.useState(``),[m,h]=F.useState(``),[v,y]=F.useState(``),b=O({mutationFn:()=>_.createOrg(d),onSuccess:()=>t.invalidateQueries({queryKey:[`workspaceRegistry`]})}),S=O({mutationFn:()=>_.createInvitation({email:m||null,role:`member`,expires_hours:168}),onSuccess:()=>t.invalidateQueries({queryKey:[`invitations`]})}),C=O({mutationFn:()=>_.acceptInvitation(v),onSuccess:()=>t.invalidateQueries({queryKey:[`workspaceRegistry`]})}),w=M(r.data?.data?.workspaces);return(0,I.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[1.1fr_0.9fr]`,children:[(0,I.jsx)(l,{title:`Your workspaces`,result:r.data,children:()=>(0,I.jsx)(`div`,{className:`grid gap-2`,children:w.map(e=>{let t=String(e.workspace_id||e.id);return(0,I.jsx)(`div`,{className:`rounded-md border border-border p-3`,children:(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{className:`font-medium`,children:String(e.name||t)}),(0,I.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[String(e.type||``),` · `,String(e.your_role||e.role||``)]})]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,I.jsx)(k,{variant:`outline`,onClick:()=>n(t),children:`Use`}),(0,I.jsx)(p,{label:`Activate`,action:()=>_.activateWorkspace(t),invalidate:[`workspaceRegistry`]}),(0,I.jsx)(p,{label:`Archive`,action:()=>_.archiveWorkspace(t),invalidate:[`workspaceRegistry`],variant:`destructive`})]})]})},t)})})}),(0,I.jsxs)(u,{children:[(0,I.jsxs)(i,{children:[(0,I.jsxs)(e,{className:`flex items-center gap-2`,children:[(0,I.jsx)(E,{className:`h-4 w-4`}),` Organizations and invitations`]}),(0,I.jsx)(a,{children:`Create or join a workspace before adding knowledge.`})]}),(0,I.jsxs)(c,{className:`grid gap-3`,children:[(0,I.jsx)(j,{value:d,onChange:e=>f(e.target.value),placeholder:`New organization name`}),(0,I.jsx)(k,{disabled:!d.trim()||b.isPending,onClick:()=>b.mutate(),children:`Create organization`}),(0,I.jsx)(j,{value:m,onChange:e=>h(e.target.value),placeholder:`invitee email`}),(0,I.jsx)(k,{variant:`outline`,disabled:S.isPending,onClick:()=>S.mutate(),children:`Create invitation`}),(0,I.jsx)(j,{value:v,onChange:e=>y(e.target.value),placeholder:`invitation token`}),(0,I.jsx)(k,{variant:`outline`,disabled:!v.trim()||C.isPending,onClick:()=>C.mutate(),children:`Accept invitation`}),(0,I.jsx)(l,{title:`Invitations`,result:s.data,children:e=>(0,I.jsx)(o,{items:e.invitations,titleKey:`token`,metaKey:`role`})})]})]})]})}function V(){let t=g({queryKey:[`snapshots`],queryFn:_.snapshots}),r=g({queryKey:[`timeMachine`],queryFn:_.timeMachine}),[s,d]=F.useState(``),[f,m]=F.useState(``),[h,v]=F.useState(``),y=O({mutationFn:()=>_.createSnapshot(s||`desktop checkpoint`)}),b=O({mutationFn:()=>_.compareSnapshots(f,h)}),x=M(t.data?.data?.snapshots);return(0,I.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,I.jsx)(l,{title:`Snapshots`,result:t.data,children:()=>(0,I.jsx)(`div`,{className:`space-y-2`,children:x.map(e=>{let t=String(e.id||e.snapshot_id);return(0,I.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,I.jsx)(`div`,{className:`font-medium`,children:String(e.name||t)}),(0,I.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,I.jsx)(p,{label:`Export`,action:()=>_.exportSnapshot(t)}),(0,I.jsx)(p,{label:`Merge restore`,action:()=>_.restoreSnapshot(t),variant:`outline`})]})]},t)})})}),(0,I.jsxs)(u,{children:[(0,I.jsxs)(i,{children:[(0,I.jsx)(e,{children:`Snapshot actions`}),(0,I.jsx)(a,{children:`Create checkpoints and compare changes over time.`})]}),(0,I.jsxs)(c,{className:`grid gap-3`,children:[(0,I.jsx)(j,{value:s,onChange:e=>d(e.target.value),placeholder:`snapshot name`}),(0,I.jsx)(k,{onClick:()=>y.mutate(),disabled:y.isPending,children:`Create snapshot`}),(0,I.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,I.jsx)(j,{value:f,onChange:e=>m(e.target.value),placeholder:`before id`}),(0,I.jsx)(j,{value:h,onChange:e=>v(e.target.value),placeholder:`after id`})]}),(0,I.jsx)(k,{variant:`outline`,onClick:()=>b.mutate(),disabled:!f||!h||b.isPending,children:`Compare`}),b.data?(0,I.jsx)(n,{result:b.data,successLabel:`Snapshot comparison completed`}):null]})]}),(0,I.jsx)(l,{title:`Time machine`,result:r.data,className:`xl:col-span-2`,children:e=>(0,I.jsx)(o,{items:e.events||e,titleKey:`event`,metaKey:`type`,limit:14})})]})}function H(){let e=g({queryKey:[`realtimeFeed`],queryFn:_.realtimeFeed}),t=g({queryKey:[`presence`],queryFn:_.presence});return(0,I.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,I.jsx)(l,{title:`Realtime feed`,result:e.data,children:e=>(0,I.jsx)(o,{items:e.events,titleKey:`event_type`,metaKey:`area`,limit:14})}),(0,I.jsx)(l,{title:`Presence`,result:t.data,children:e=>(0,I.jsx)(K,{data:e})})]})}function ee(){let t=D(),r=g({queryKey:[`networkIdentity`],queryFn:_.networkIdentity}),o=g({queryKey:[`networkPeers`],queryFn:_.networkPeers}),[s,d]=F.useState(``),[f,m]=F.useState(``),[h,v]=F.useState(``),y=O({mutationFn:()=>_.pairPeer({name:s,base_url:f,public_key:h}),onSuccess:()=>t.invalidateQueries({queryKey:[`networkPeers`]})});return(0,I.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[0.8fr_1.2fr]`,children:[(0,I.jsx)(l,{title:`Device identity`,result:r.data,children:e=>(0,I.jsx)(q,{data:e})}),(0,I.jsxs)(u,{children:[(0,I.jsxs)(i,{children:[(0,I.jsxs)(e,{className:`flex items-center gap-2`,children:[(0,I.jsx)(P,{className:`h-4 w-4`}),` Pair device`]}),(0,I.jsx)(a,{children:`Pair a trusted device for workspace exchange.`})]}),(0,I.jsxs)(c,{className:`grid gap-3`,children:[(0,I.jsx)(j,{value:s,onChange:e=>d(e.target.value),placeholder:`device name`}),(0,I.jsx)(j,{value:f,onChange:e=>m(e.target.value),placeholder:`trusted device address`}),(0,I.jsx)(j,{value:h,onChange:e=>v(e.target.value),placeholder:`trusted public key`}),(0,I.jsx)(k,{disabled:!s||!f||!h||y.isPending,onClick:()=>y.mutate(),children:`Pair device`}),y.data?(0,I.jsx)(n,{result:y.data,successLabel:`Peer pairing request completed`}):null]})]}),(0,I.jsx)(l,{title:`Peers`,result:o.data,className:`xl:col-span-2`,children:e=>(0,I.jsx)(`div`,{className:`grid gap-2`,children:M(e.peers).map(e=>{let t=String(e.peer_id||e.id);return(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{className:`font-medium`,children:String(e.name||t)}),(0,I.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:String(e.base_url||``)})]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,I.jsx)(p,{label:`Push workspace`,action:()=>_.pushPeer(t,x.getState().workspaceId)}),(0,I.jsx)(p,{label:`Unpair`,action:()=>_.unpairPeer(t),invalidate:[`networkPeers`],variant:`destructive`})]})]},t)})})})]})}function U(){let t=D(),{theme:r,setTheme:o,mode:d,setMode:f}=x(),h=g({queryKey:[`health`],queryFn:_.health}),y=g({queryKey:[`sysinfo`],queryFn:_.sysinfo}),b=g({queryKey:[`computerMemory`],queryFn:_.computerMemory}),S=g({queryKey:[`brainStorage`],queryFn:_.brainStorage}),C=g({queryKey:[`backupHealth`],queryFn:_.backupHealth}),[w,T]=F.useState(``),[E,A]=F.useState(`lattice_brain`),[M,N]=F.useState(!1),[P,L]=F.useState(``),[R,z]=F.useState(``),[B,V]=F.useState(``),[H,ee]=F.useState(!1),[U,W]=F.useState(!1),G=O({mutationFn:e=>_.dockerPostgres({consent:e,dry_run:!e,port:5432})}),K=O({mutationFn:()=>_.migratePostgres({dsn:w,schema_name:E||`lattice_brain`,dry_run:!0})}),q=O({mutationFn:()=>_.brainArchive({path:P.trim()||null,passphrase:B}),onSuccess:()=>t.invalidateQueries({queryKey:[`backupHealth`]})}),J=O({mutationFn:()=>_.brainArchiveInspect({path:R,passphrase:B||null})}),Y=O({mutationFn:()=>_.brainArchiveVerify({path:R,passphrase:B})}),X=O({mutationFn:()=>_.brainArchiveRestore({path:R,passphrase:B,dry_run:!0,confirm:!1})}),Z=O({mutationFn:()=>_.brainArchiveRestore({path:R,passphrase:B,dry_run:!1,confirm:H}),onSuccess:()=>{t.invalidateQueries({queryKey:[`brainStorage`]}),t.invalidateQueries({queryKey:[`backupHealth`]})}}),Q=O({mutationFn:()=>_.brainArchiveImport({path:R,passphrase:B,dry_run:!0,confirm:!1})}),$=O({mutationFn:()=>_.brainArchiveImport({path:R,passphrase:B,dry_run:!1,confirm:U}),onSuccess:()=>{t.invalidateQueries({queryKey:[`brainStorage`]}),t.invalidateQueries({queryKey:[`backupHealth`]})}});return(0,I.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-3`,children:[(0,I.jsxs)(u,{children:[(0,I.jsxs)(i,{children:[(0,I.jsx)(e,{children:`Appearance`}),(0,I.jsx)(a,{children:`Local browser settings only.`})]}),(0,I.jsxs)(c,{className:`flex flex-wrap gap-2`,children:[(0,I.jsx)(k,{variant:r===`dark`?`default`:`outline`,onClick:()=>o(`dark`),children:`Dark`}),(0,I.jsx)(k,{variant:r===`light`?`default`:`outline`,onClick:()=>o(`light`),children:`Light`}),[`basic`,`advanced`,`admin`].map(e=>(0,I.jsx)(k,{variant:d===e?`default`:`outline`,onClick:()=>f(e),children:v(e)},e))]})]}),(0,I.jsx)(l,{title:`Server health`,result:h.data,children:e=>(0,I.jsx)(te,{data:e})}),(0,I.jsx)(l,{title:d===`basic`?`Computer readiness`:`Host telemetry`,result:y.data,children:e=>d===`basic`?(0,I.jsx)(s,{stats:[{label:`CPU`,value:`${String(e.cpu_pct||`0`)}%`},{label:`Memory`,value:`${String(e.ram_pct||`0`)}%`},{label:`GPU memory`,value:`${String(e.gpu_mem_pct||`0`)}%`},{label:`Local status`,value:`ready`}]}):(0,I.jsx)(m,{value:e})}),(0,I.jsx)(l,{title:`Brain storage`,result:S.data,className:`xl:col-span-3`,children:e=>(0,I.jsx)(ne,{data:e})}),(0,I.jsx)(l,{title:`Backup health`,result:C.data,className:`xl:col-span-3`,children:e=>(0,I.jsx)(re,{data:e})}),(0,I.jsxs)(u,{className:`xl:col-span-3`,children:[(0,I.jsxs)(i,{children:[(0,I.jsx)(e,{children:`.latticebrain portability`}),(0,I.jsx)(a,{children:`Create an encrypted portable brain file, verify one, or preview a restore before applying it.`})]}),(0,I.jsxs)(c,{className:`grid gap-3`,children:[(0,I.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[1fr_1fr]`,children:[(0,I.jsx)(j,{value:P,onChange:e=>L(e.target.value),placeholder:`export path (optional)`}),(0,I.jsx)(j,{value:R,onChange:e=>z(e.target.value),placeholder:`archive path for inspect/restore`})]}),(0,I.jsx)(j,{type:`password`,value:B,onChange:e=>V(e.target.value),placeholder:`archive passphrase`}),(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,I.jsx)(k,{onClick:()=>q.mutate(),disabled:!B||q.isPending,children:`Export archive`}),(0,I.jsx)(k,{variant:`outline`,onClick:()=>J.mutate(),disabled:!R||J.isPending,children:`Inspect`}),(0,I.jsx)(k,{variant:`outline`,onClick:()=>Y.mutate(),disabled:!R||!B||Y.isPending,children:`Verify`}),(0,I.jsx)(k,{variant:`outline`,onClick:()=>X.mutate(),disabled:!R||!B||X.isPending,children:`Restore dry run`}),(0,I.jsx)(k,{variant:`outline`,onClick:()=>Q.mutate(),disabled:!R||!B||Q.isPending,children:`Import dry run`}),(0,I.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:H,onChange:e=>ee(e.target.checked)}),`Confirm restore`]}),(0,I.jsx)(k,{variant:`destructive`,onClick:()=>Z.mutate(),disabled:!R||!B||!H||Z.isPending,children:`Restore`}),(0,I.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:U,onChange:e=>W(e.target.checked)}),`Confirm import`]}),(0,I.jsx)(k,{variant:`outline`,onClick:()=>$.mutate(),disabled:!R||!B||!U||$.isPending,children:`Import`})]}),[q.data,J.data,Y.data,X.data,Z.data,Q.data,$.data].filter(Boolean).map((e,t)=>(0,I.jsx)(n,{result:e,successLabel:`Archive request completed`},t))]})]}),d===`basic`?null:(0,I.jsxs)(u,{className:`xl:col-span-3`,children:[(0,I.jsxs)(i,{children:[(0,I.jsx)(e,{children:`Scale mode`}),(0,I.jsx)(a,{children:`Optional advanced storage. Local SQLite remains the default.`})]}),(0,I.jsxs)(c,{className:`grid gap-3`,children:[(0,I.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[1fr_220px]`,children:[(0,I.jsx)(j,{value:w,onChange:e=>T(e.target.value),placeholder:`Postgres connection string`}),(0,I.jsx)(j,{value:E,onChange:e=>A(e.target.value),placeholder:`database schema`})]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,I.jsx)(k,{variant:`outline`,onClick:()=>G.mutate(!1),disabled:G.isPending,children:`Docker plan`}),(0,I.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:M,onChange:e=>N(e.target.checked)}),`Consent to start Docker`]}),(0,I.jsx)(k,{onClick:()=>G.mutate(!0),disabled:!M||G.isPending,children:`Start Docker`}),(0,I.jsx)(k,{variant:`outline`,onClick:()=>K.mutate(),disabled:!w||K.isPending,children:`Plan migration`})]}),G.data?(0,I.jsx)(n,{result:G.data,successLabel:`Docker setup request completed`}):null,K.data?(0,I.jsx)(n,{result:K.data,successLabel:`Migration plan completed`}):null]})]}),(0,I.jsx)(l,{title:`Computer memory`,result:b.data,className:`xl:col-span-3`,children:e=>(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsx)(m,{value:e}),(0,I.jsxs)(`div`,{className:`flex gap-2`,children:[(0,I.jsx)(p,{label:`Enable memory`,action:()=>_.setComputerMemory(!0),invalidate:[`computerMemory`]}),(0,I.jsx)(p,{label:`Disable memory`,action:()=>_.setComputerMemory(!1),invalidate:[`computerMemory`],variant:`destructive`})]})]})})]})}function W(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}function G(e,t=`not reported`){return e==null||e===``?t:typeof e==`boolean`?e?`enabled`:`disabled`:String(e)}function K({data:e}){let t=M(e.presence||e.clients||e);return t.length?(0,I.jsx)(o,{items:t,titleKey:`user`,metaKey:`workspace_id`}):(0,I.jsx)(d,{title:`No active presence`,detail:`No live collaborators or realtime clients are currently reported.`})}function q({data:e}){let n=x(e=>e.mode),r=G(e.public_key,``);return n===`basic`?(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsx)(J,{title:`This Mac`,status:`trusted`,detail:`This device can participate in local workspace exchange when you pair another trusted device.`}),(0,I.jsx)(h,{variant:`muted`,children:G(e.algorithm,`local identity`)})]}):(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(h,{variant:`success`,children:`local device`}),(0,I.jsx)(h,{variant:`muted`,children:G(e.algorithm,`identity key`)})]}),(0,I.jsx)(t,{data:{device_id:e.device_id||e.id||`not reported`,fingerprint:e.fingerprint||`not reported`,public_key:r?C(r.replace(/\s+/g,` `),72):`not reported`}})]})}function te({data:e}){let t=x(e=>e.mode);return(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsx)(s,{stats:[{label:`Status`,value:e.status||e.ok||`reported`},{label:`Version`,value:e.version||`not reported`},{label:`Mode`,value:e.mode||e.environment||`local`},...t===`basic`?[]:[{label:`Port`,value:e.port||e.backend_port||`configured`}]]}),t===`basic`?null:(0,I.jsx)(m,{value:e})]})}function ne({data:e}){let t=W(e.active)?e.active:e,n=W(e.postgres)?e.postgres:{},r=W(e.backup_health)?e.backup_health:{},i=t.vector_search||t.vector||e.vector_search||e.sqlite_vec,a=!!(n.available||n.connected||n.enabled);return(0,I.jsxs)(`div`,{className:`space-y-4`,children:[(0,I.jsx)(s,{stats:[{label:`Active engine`,value:t.engine||e.engine||`sqlite`},{label:`SQLite default`,value:t.engine===`postgres`?`scale mode`:`enabled`},{label:`Vector search`,value:i||`not reported`},{label:`Postgres`,value:a?`available`:`optional`}]}),(0,I.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-3`,children:[(0,I.jsx)(J,{title:`SQLite`,status:t.available===!1?`unavailable`:`default`,detail:G(t.reason||t.path||e.path,`Local brain storage is active by default.`)}),(0,I.jsx)(J,{title:`Vector search`,status:G(i,`reported`),detail:G(t.vector_reason||t.sqlite_vec_reason||e.vector_reason,`Uses the configured local vector capability or reports why it is unavailable.`)}),(0,I.jsx)(J,{title:`Postgres`,status:a?`available`:`not enabled`,detail:G(n.reason||n.dsn||n.status,`Postgres scale mode is opt-in and never required for local use.`)})]}),Object.keys(r).length?(0,I.jsx)(m,{value:{backup_health:r}}):null]})}function re({data:e}){return(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsx)(s,{stats:[{label:`Available`,value:e.available===!1?`no`:`yes`},{label:`Backups`,value:e.count||e.backups||0},{label:`Encrypted`,value:e.encrypted_archives||0},{label:`Zip backups`,value:e.zip_backups||0}]}),(0,I.jsx)(t,{data:{directory:e.directory||`not reported`,latest:e.latest||`none reported`,last_verified:e.last_verified||e.verified_at||`not reported`,failure:e.error||e.reason||`none reported`}})]})}function J({title:e,status:t,detail:n}){let r=/unavailable|failed|denied|disabled|not enabled/i.test(t)?`warning`:`success`;return(0,I.jsxs)(`div`,{className:`rounded-md border border-border bg-background p-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,I.jsx)(`div`,{className:`font-medium`,children:e}),(0,I.jsx)(h,{variant:r,children:t})]}),(0,I.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:n})]})}function Y({data:e}){let t=W(e.startup)?e.startup:{},n=W(e.privacy)?e.privacy:{},r=W(e.storage)?e.storage:{},i=W(e.backup)?e.backup:{},a=W(e.device_identity)?e.device_identity:{},o=W(e.permissions)?e.permissions:{};return(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsx)(s,{stats:[{label:`Version`,value:e.version||`reported`},{label:`Local only`,value:n.local_only_default??t.local_only_default??`reported`},{label:`Storage`,value:W(r.active)?r.active.engine:`reported`},{label:`Backups`,value:i.count||i.available||`reported`}]}),(0,I.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,I.jsx)(J,{title:`Startup`,status:t.network_exposed?`network exposed`:`local-only`,detail:`Lattice starts locally by default and reports when network access is enabled.`}),(0,I.jsx)(J,{title:`Integrations`,status:n.local_only_default===!1?`review required`:`opt-in`,detail:`External integrations remain disabled until the user explicitly enables them.`}),(0,I.jsx)(J,{title:`Device identity`,status:G(a.algorithm||a.fingerprint,`reported`),detail:G(a.storage,`Stored locally and used for signed bundle exchange.`)}),(0,I.jsx)(J,{title:`Permissions`,status:o.destructive_restore_requires_confirmation===!1?`review required`:`guarded`,detail:`Export, import, and destructive restore permissions are surfaced through admin status.`})]})]})}function X({data:e}){let t=W(e.cards)?e.cards:{},n=W(e.severity_counts)?e.severity_counts:{};return(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsx)(s,{stats:[{label:`Events today`,value:t.events_today||0},{label:`High risk`,value:t.high_risk_events||n.high||0},{label:`Review`,value:t.review_required||0},{label:`Risk rate`,value:e.risk_rate||0}]}),(0,I.jsx)(m,{value:{severity_counts:n,sensitive_fields:e.field_counts||{}}})]})}function Z(){let e=x(e=>e.mode),n=g({queryKey:[`adminSummary`],queryFn:_.adminSummary}),r=g({queryKey:[`adminUsers`],queryFn:_.adminUsers}),i=g({queryKey:[`adminAudit`],queryFn:()=>_.adminAudit()}),a=g({queryKey:[`adminRoles`],queryFn:_.adminRoles}),s=g({queryKey:[`adminPolicies`],queryFn:_.adminPolicies}),c=g({queryKey:[`adminProductHardening`],queryFn:_.adminProductHardening}),u=g({queryKey:[`adminSecurity`],queryFn:_.adminSecurity}),d=g({queryKey:[`vpcStatus`],queryFn:_.vpcStatus});return e===`admin`?(0,I.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,I.jsx)(l,{title:`Admin summary`,result:n.data,children:e=>(0,I.jsx)(t,{data:e})}),(0,I.jsx)(l,{title:`Users`,result:r.data,children:e=>(0,I.jsx)(o,{items:e,titleKey:`email`,metaKey:`role`})}),(0,I.jsx)(l,{title:`Audit`,result:i.data,children:e=>(0,I.jsx)(o,{items:e.recent_events||e,titleKey:`act`,metaKey:`sev`})}),(0,I.jsx)(l,{title:`Roles`,result:a.data,children:e=>(0,I.jsx)(o,{items:e.roles||e,titleKey:`role`,metaKey:`members`})}),(0,I.jsx)(l,{title:`Policies`,result:s.data,children:e=>(0,I.jsx)(o,{items:e.policies||e,titleKey:`label`,metaKey:`enforced`})}),(0,I.jsx)(l,{title:`Product hardening`,result:c.data,children:e=>(0,I.jsx)(Y,{data:e})}),(0,I.jsx)(l,{title:`Security overview`,result:u.data,children:e=>(0,I.jsx)(X,{data:e})}),(0,I.jsx)(l,{title:`Private VPC`,result:d.data,className:`xl:col-span-2`,children:e=>(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(h,{variant:`muted`,children:`Community-disabled features remain honest unavailable states.`}),(0,I.jsx)(m,{value:e})]})})]}):(0,I.jsx)(f,{title:`Admin controls`,detail:`Switch to Admin mode to review users, audit events, policies, security posture, and private networking diagnostics.`,target:`admin`})}export{R as SystemPage};
|
|
1
|
+
import{_ as e,a as t,c as n,d as r,g as i,h as a,i as o,l as s,m as c,n as l,p as u,r as d,s as f,t as p,u as m,v as h}from"./primitives-BdsUNXa6.js";import{A as g,D as _,E as v,I as y,M as b,O as x,P as S,T as C,b as w,g as T,i as E,j as D,k as O,n as k,o as A,t as j,x as M,y as N}from"./index-CoiuIFFP.js";var P=N(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),F=y(S()),I=b(),L=[{id:`account`,labelKey:`system.tab.account`},{id:`workspaces`,labelKey:`system.tab.workspaces`},{id:`snapshots`,labelKey:`system.tab.snapshots`},{id:`activity`,labelKey:`system.tab.activity`},{id:`network`,labelKey:`system.tab.network`},{id:`settings`,labelKey:`system.tab.settings`},{id:`admin`,labelKey:`system.tab.admin`}];function R({initialTab:e}){let t=x(e=>e.mode),n=x(e=>e.language),[i,a]=F.useState(e||`account`);return F.useEffect(()=>{L.some(t=>t.id===e)&&a(e)},[e]),(0,I.jsxs)(`div`,{className:`space-y-5`,children:[(0,I.jsxs)(`header`,{className:`page-hero`,children:[(0,I.jsxs)(`div`,{className:`page-kicker`,children:[(0,I.jsx)(A,{className:`h-4 w-4`}),` `,w(n,`system.kicker`)]}),(0,I.jsx)(`h1`,{className:`page-title`,children:w(n,`system.title`)}),(0,I.jsx)(`p`,{className:`page-copy`,children:w(n,`system.body`)})]}),(0,I.jsx)(r,{tabs:(t===`basic`?L.filter(e=>e.id!==`admin`):L).map(e=>({id:e.id,label:w(n,e.labelKey)})),value:i,onChange:e=>a(e)}),i===`account`?(0,I.jsx)(z,{}):null,i===`workspaces`?(0,I.jsx)(B,{}):null,i===`snapshots`?(0,I.jsx)(V,{}):null,i===`activity`?(0,I.jsx)(H,{}):null,i===`network`?(0,I.jsx)(ee,{}):null,i===`settings`?(0,I.jsx)(U,{}):null,i===`admin`?(0,I.jsx)(Z,{}):null]})}function z(){let r=D(),o=g({queryKey:[`profile`],queryFn:_.profile}),s=g({queryKey:[`sso`],queryFn:_.ssoConfig}),[d,f]=F.useState(``),[h,v]=F.useState(``),[y,b]=F.useState(``),[x,S]=F.useState(``),[C,w]=F.useState(``),E=O({mutationFn:()=>_.login(d,h),onSuccess:()=>r.invalidateQueries({queryKey:[`profile`]})}),A=O({mutationFn:()=>_.register({email:d,password:h,name:y,nickname:x}),onSuccess:()=>r.invalidateQueries({queryKey:[`profile`]})}),M=O({mutationFn:()=>_.updateProfile({name:y,nickname:x}),onSuccess:()=>r.invalidateQueries({queryKey:[`profile`]})}),N=O({mutationFn:()=>_.changePassword(h,C)});return(0,I.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,I.jsx)(l,{title:`Profile`,result:o.data,children:e=>(0,I.jsx)(t,{data:e})}),(0,I.jsxs)(u,{children:[(0,I.jsxs)(i,{children:[(0,I.jsxs)(e,{className:`flex items-center gap-2`,children:[(0,I.jsx)(T,{className:`h-4 w-4`}),` Account`]}),(0,I.jsx)(a,{children:`Sign in, create a local account, and keep your profile current.`})]}),(0,I.jsxs)(c,{className:`grid gap-3`,children:[(0,I.jsx)(j,{value:d,onChange:e=>f(e.target.value),placeholder:`email`}),(0,I.jsx)(j,{type:`password`,value:h,onChange:e=>v(e.target.value),placeholder:`current password`}),(0,I.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,I.jsx)(j,{value:y,onChange:e=>b(e.target.value),placeholder:`name`}),(0,I.jsx)(j,{value:x,onChange:e=>S(e.target.value),placeholder:`nickname`})]}),(0,I.jsx)(j,{type:`password`,value:C,onChange:e=>w(e.target.value),placeholder:`new password`}),(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,I.jsx)(k,{onClick:()=>E.mutate(),disabled:!d||!h||E.isPending,children:`Login`}),(0,I.jsx)(k,{variant:`outline`,onClick:()=>A.mutate(),disabled:!d||!h||A.isPending,children:`Register`}),(0,I.jsx)(k,{variant:`outline`,onClick:()=>M.mutate(),disabled:M.isPending,children:`Save profile`}),(0,I.jsx)(k,{variant:`outline`,onClick:()=>N.mutate(),disabled:!h||!C||N.isPending,children:`Change password`}),(0,I.jsx)(p,{label:`Logout`,action:()=>_.logout(),invalidate:[`profile`]})]}),[E.data,A.data,M.data,N.data].filter(Boolean).map((e,t)=>(0,I.jsx)(n,{result:e,successLabel:`Account request completed`},t))]})]}),(0,I.jsx)(l,{title:`Sign-in options`,result:s.data,className:`xl:col-span-2`,children:e=>(0,I.jsx)(m,{value:e})})]})}function B(){let t=D(),{setWorkspaceId:n}=x(),r=g({queryKey:[`workspaceRegistry`],queryFn:_.workspaceRegistry}),s=g({queryKey:[`invitations`],queryFn:_.invitations}),[d,f]=F.useState(``),[m,h]=F.useState(``),[v,y]=F.useState(``),b=O({mutationFn:()=>_.createOrg(d),onSuccess:()=>t.invalidateQueries({queryKey:[`workspaceRegistry`]})}),S=O({mutationFn:()=>_.createInvitation({email:m||null,role:`member`,expires_hours:168}),onSuccess:()=>t.invalidateQueries({queryKey:[`invitations`]})}),C=O({mutationFn:()=>_.acceptInvitation(v),onSuccess:()=>t.invalidateQueries({queryKey:[`workspaceRegistry`]})}),w=M(r.data?.data?.workspaces);return(0,I.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[1.1fr_0.9fr]`,children:[(0,I.jsx)(l,{title:`Your workspaces`,result:r.data,children:()=>(0,I.jsx)(`div`,{className:`grid gap-2`,children:w.map(e=>{let t=String(e.workspace_id||e.id);return(0,I.jsx)(`div`,{className:`rounded-md border border-border p-3`,children:(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{className:`font-medium`,children:String(e.name||t)}),(0,I.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[String(e.type||``),` · `,String(e.your_role||e.role||``)]})]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,I.jsx)(k,{variant:`outline`,onClick:()=>n(t),children:`Use`}),(0,I.jsx)(p,{label:`Activate`,action:()=>_.activateWorkspace(t),invalidate:[`workspaceRegistry`]}),(0,I.jsx)(p,{label:`Archive`,action:()=>_.archiveWorkspace(t),invalidate:[`workspaceRegistry`],variant:`destructive`})]})]})},t)})})}),(0,I.jsxs)(u,{children:[(0,I.jsxs)(i,{children:[(0,I.jsxs)(e,{className:`flex items-center gap-2`,children:[(0,I.jsx)(E,{className:`h-4 w-4`}),` Organizations and invitations`]}),(0,I.jsx)(a,{children:`Create or join a workspace before adding knowledge.`})]}),(0,I.jsxs)(c,{className:`grid gap-3`,children:[(0,I.jsx)(j,{value:d,onChange:e=>f(e.target.value),placeholder:`New organization name`}),(0,I.jsx)(k,{disabled:!d.trim()||b.isPending,onClick:()=>b.mutate(),children:`Create organization`}),(0,I.jsx)(j,{value:m,onChange:e=>h(e.target.value),placeholder:`invitee email`}),(0,I.jsx)(k,{variant:`outline`,disabled:S.isPending,onClick:()=>S.mutate(),children:`Create invitation`}),(0,I.jsx)(j,{value:v,onChange:e=>y(e.target.value),placeholder:`invitation token`}),(0,I.jsx)(k,{variant:`outline`,disabled:!v.trim()||C.isPending,onClick:()=>C.mutate(),children:`Accept invitation`}),(0,I.jsx)(l,{title:`Invitations`,result:s.data,children:e=>(0,I.jsx)(o,{items:e.invitations,titleKey:`token`,metaKey:`role`})})]})]})]})}function V(){let t=g({queryKey:[`snapshots`],queryFn:_.snapshots}),r=g({queryKey:[`timeMachine`],queryFn:_.timeMachine}),[s,d]=F.useState(``),[f,m]=F.useState(``),[h,v]=F.useState(``),y=O({mutationFn:()=>_.createSnapshot(s||`desktop checkpoint`)}),b=O({mutationFn:()=>_.compareSnapshots(f,h)}),x=M(t.data?.data?.snapshots);return(0,I.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,I.jsx)(l,{title:`Snapshots`,result:t.data,children:()=>(0,I.jsx)(`div`,{className:`space-y-2`,children:x.map(e=>{let t=String(e.id||e.snapshot_id);return(0,I.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,I.jsx)(`div`,{className:`font-medium`,children:String(e.name||t)}),(0,I.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,I.jsx)(p,{label:`Export`,action:()=>_.exportSnapshot(t)}),(0,I.jsx)(p,{label:`Merge restore`,action:()=>_.restoreSnapshot(t),variant:`outline`})]})]},t)})})}),(0,I.jsxs)(u,{children:[(0,I.jsxs)(i,{children:[(0,I.jsx)(e,{children:`Snapshot actions`}),(0,I.jsx)(a,{children:`Create checkpoints and compare changes over time.`})]}),(0,I.jsxs)(c,{className:`grid gap-3`,children:[(0,I.jsx)(j,{value:s,onChange:e=>d(e.target.value),placeholder:`snapshot name`}),(0,I.jsx)(k,{onClick:()=>y.mutate(),disabled:y.isPending,children:`Create snapshot`}),(0,I.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,I.jsx)(j,{value:f,onChange:e=>m(e.target.value),placeholder:`before id`}),(0,I.jsx)(j,{value:h,onChange:e=>v(e.target.value),placeholder:`after id`})]}),(0,I.jsx)(k,{variant:`outline`,onClick:()=>b.mutate(),disabled:!f||!h||b.isPending,children:`Compare`}),b.data?(0,I.jsx)(n,{result:b.data,successLabel:`Snapshot comparison completed`}):null]})]}),(0,I.jsx)(l,{title:`Time machine`,result:r.data,className:`xl:col-span-2`,children:e=>(0,I.jsx)(o,{items:e.events||e,titleKey:`event`,metaKey:`type`,limit:14})})]})}function H(){let e=g({queryKey:[`realtimeFeed`],queryFn:_.realtimeFeed}),t=g({queryKey:[`presence`],queryFn:_.presence});return(0,I.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,I.jsx)(l,{title:`Realtime feed`,result:e.data,children:e=>(0,I.jsx)(o,{items:e.events,titleKey:`event_type`,metaKey:`area`,limit:14})}),(0,I.jsx)(l,{title:`Presence`,result:t.data,children:e=>(0,I.jsx)(K,{data:e})})]})}function ee(){let t=D(),r=g({queryKey:[`networkIdentity`],queryFn:_.networkIdentity}),o=g({queryKey:[`networkPeers`],queryFn:_.networkPeers}),[s,d]=F.useState(``),[f,m]=F.useState(``),[h,v]=F.useState(``),y=O({mutationFn:()=>_.pairPeer({name:s,base_url:f,public_key:h}),onSuccess:()=>t.invalidateQueries({queryKey:[`networkPeers`]})});return(0,I.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[0.8fr_1.2fr]`,children:[(0,I.jsx)(l,{title:`Device identity`,result:r.data,children:e=>(0,I.jsx)(q,{data:e})}),(0,I.jsxs)(u,{children:[(0,I.jsxs)(i,{children:[(0,I.jsxs)(e,{className:`flex items-center gap-2`,children:[(0,I.jsx)(P,{className:`h-4 w-4`}),` Pair device`]}),(0,I.jsx)(a,{children:`Pair a trusted device for workspace exchange.`})]}),(0,I.jsxs)(c,{className:`grid gap-3`,children:[(0,I.jsx)(j,{value:s,onChange:e=>d(e.target.value),placeholder:`device name`}),(0,I.jsx)(j,{value:f,onChange:e=>m(e.target.value),placeholder:`trusted device address`}),(0,I.jsx)(j,{value:h,onChange:e=>v(e.target.value),placeholder:`trusted public key`}),(0,I.jsx)(k,{disabled:!s||!f||!h||y.isPending,onClick:()=>y.mutate(),children:`Pair device`}),y.data?(0,I.jsx)(n,{result:y.data,successLabel:`Peer pairing request completed`}):null]})]}),(0,I.jsx)(l,{title:`Peers`,result:o.data,className:`xl:col-span-2`,children:e=>(0,I.jsx)(`div`,{className:`grid gap-2`,children:M(e.peers).map(e=>{let t=String(e.peer_id||e.id);return(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{className:`font-medium`,children:String(e.name||t)}),(0,I.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:String(e.base_url||``)})]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,I.jsx)(p,{label:`Push workspace`,action:()=>_.pushPeer(t,x.getState().workspaceId)}),(0,I.jsx)(p,{label:`Unpair`,action:()=>_.unpairPeer(t),invalidate:[`networkPeers`],variant:`destructive`})]})]},t)})})})]})}function U(){let t=D(),{theme:r,setTheme:o,mode:d,setMode:f}=x(),h=g({queryKey:[`health`],queryFn:_.health}),y=g({queryKey:[`sysinfo`],queryFn:_.sysinfo}),b=g({queryKey:[`computerMemory`],queryFn:_.computerMemory}),S=g({queryKey:[`brainStorage`],queryFn:_.brainStorage}),C=g({queryKey:[`backupHealth`],queryFn:_.backupHealth}),[w,T]=F.useState(``),[E,A]=F.useState(`lattice_brain`),[M,N]=F.useState(!1),[P,L]=F.useState(``),[R,z]=F.useState(``),[B,V]=F.useState(``),[H,ee]=F.useState(!1),[U,W]=F.useState(!1),G=O({mutationFn:e=>_.dockerPostgres({consent:e,dry_run:!e,port:5432})}),K=O({mutationFn:()=>_.migratePostgres({dsn:w,schema_name:E||`lattice_brain`,dry_run:!0})}),q=O({mutationFn:()=>_.brainArchive({path:P.trim()||null,passphrase:B}),onSuccess:()=>t.invalidateQueries({queryKey:[`backupHealth`]})}),J=O({mutationFn:()=>_.brainArchiveInspect({path:R,passphrase:B||null})}),Y=O({mutationFn:()=>_.brainArchiveVerify({path:R,passphrase:B})}),X=O({mutationFn:()=>_.brainArchiveRestore({path:R,passphrase:B,dry_run:!0,confirm:!1})}),Z=O({mutationFn:()=>_.brainArchiveRestore({path:R,passphrase:B,dry_run:!1,confirm:H}),onSuccess:()=>{t.invalidateQueries({queryKey:[`brainStorage`]}),t.invalidateQueries({queryKey:[`backupHealth`]})}}),Q=O({mutationFn:()=>_.brainArchiveImport({path:R,passphrase:B,dry_run:!0,confirm:!1})}),$=O({mutationFn:()=>_.brainArchiveImport({path:R,passphrase:B,dry_run:!1,confirm:U}),onSuccess:()=>{t.invalidateQueries({queryKey:[`brainStorage`]}),t.invalidateQueries({queryKey:[`backupHealth`]})}});return(0,I.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-3`,children:[(0,I.jsxs)(u,{children:[(0,I.jsxs)(i,{children:[(0,I.jsx)(e,{children:`Appearance`}),(0,I.jsx)(a,{children:`Local browser settings only.`})]}),(0,I.jsxs)(c,{className:`flex flex-wrap gap-2`,children:[(0,I.jsx)(k,{variant:r===`dark`?`default`:`outline`,onClick:()=>o(`dark`),children:`Dark`}),(0,I.jsx)(k,{variant:r===`light`?`default`:`outline`,onClick:()=>o(`light`),children:`Light`}),[`basic`,`advanced`,`admin`].map(e=>(0,I.jsx)(k,{variant:d===e?`default`:`outline`,onClick:()=>f(e),children:v(e)},e))]})]}),(0,I.jsx)(l,{title:`Server health`,result:h.data,children:e=>(0,I.jsx)(te,{data:e})}),(0,I.jsx)(l,{title:d===`basic`?`Computer readiness`:`Host telemetry`,result:y.data,children:e=>d===`basic`?(0,I.jsx)(s,{stats:[{label:`CPU`,value:`${String(e.cpu_pct||`0`)}%`},{label:`Memory`,value:`${String(e.ram_pct||`0`)}%`},{label:`GPU memory`,value:`${String(e.gpu_mem_pct||`0`)}%`},{label:`Local status`,value:`ready`}]}):(0,I.jsx)(m,{value:e})}),(0,I.jsx)(l,{title:`Brain storage`,result:S.data,className:`xl:col-span-3`,children:e=>(0,I.jsx)(ne,{data:e})}),(0,I.jsx)(l,{title:`Backup health`,result:C.data,className:`xl:col-span-3`,children:e=>(0,I.jsx)(re,{data:e})}),(0,I.jsxs)(u,{className:`xl:col-span-3`,children:[(0,I.jsxs)(i,{children:[(0,I.jsx)(e,{children:`.latticebrain portability`}),(0,I.jsx)(a,{children:`Create an encrypted portable brain file, verify one, or preview a restore before applying it.`})]}),(0,I.jsxs)(c,{className:`grid gap-3`,children:[(0,I.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[1fr_1fr]`,children:[(0,I.jsx)(j,{value:P,onChange:e=>L(e.target.value),placeholder:`export path (optional)`}),(0,I.jsx)(j,{value:R,onChange:e=>z(e.target.value),placeholder:`archive path for inspect/restore`})]}),(0,I.jsx)(j,{type:`password`,value:B,onChange:e=>V(e.target.value),placeholder:`archive passphrase`}),(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,I.jsx)(k,{onClick:()=>q.mutate(),disabled:!B||q.isPending,children:`Export archive`}),(0,I.jsx)(k,{variant:`outline`,onClick:()=>J.mutate(),disabled:!R||J.isPending,children:`Inspect`}),(0,I.jsx)(k,{variant:`outline`,onClick:()=>Y.mutate(),disabled:!R||!B||Y.isPending,children:`Verify`}),(0,I.jsx)(k,{variant:`outline`,onClick:()=>X.mutate(),disabled:!R||!B||X.isPending,children:`Restore dry run`}),(0,I.jsx)(k,{variant:`outline`,onClick:()=>Q.mutate(),disabled:!R||!B||Q.isPending,children:`Import dry run`}),(0,I.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:H,onChange:e=>ee(e.target.checked)}),`Confirm restore`]}),(0,I.jsx)(k,{variant:`destructive`,onClick:()=>Z.mutate(),disabled:!R||!B||!H||Z.isPending,children:`Restore`}),(0,I.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:U,onChange:e=>W(e.target.checked)}),`Confirm import`]}),(0,I.jsx)(k,{variant:`outline`,onClick:()=>$.mutate(),disabled:!R||!B||!U||$.isPending,children:`Import`})]}),[q.data,J.data,Y.data,X.data,Z.data,Q.data,$.data].filter(Boolean).map((e,t)=>(0,I.jsx)(n,{result:e,successLabel:`Archive request completed`},t))]})]}),d===`basic`?null:(0,I.jsxs)(u,{className:`xl:col-span-3`,children:[(0,I.jsxs)(i,{children:[(0,I.jsx)(e,{children:`Scale mode`}),(0,I.jsx)(a,{children:`Optional advanced storage. Local SQLite remains the default.`})]}),(0,I.jsxs)(c,{className:`grid gap-3`,children:[(0,I.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[1fr_220px]`,children:[(0,I.jsx)(j,{value:w,onChange:e=>T(e.target.value),placeholder:`Postgres connection string`}),(0,I.jsx)(j,{value:E,onChange:e=>A(e.target.value),placeholder:`database schema`})]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,I.jsx)(k,{variant:`outline`,onClick:()=>G.mutate(!1),disabled:G.isPending,children:`Docker plan`}),(0,I.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:M,onChange:e=>N(e.target.checked)}),`Consent to start Docker`]}),(0,I.jsx)(k,{onClick:()=>G.mutate(!0),disabled:!M||G.isPending,children:`Start Docker`}),(0,I.jsx)(k,{variant:`outline`,onClick:()=>K.mutate(),disabled:!w||K.isPending,children:`Plan migration`})]}),G.data?(0,I.jsx)(n,{result:G.data,successLabel:`Docker setup request completed`}):null,K.data?(0,I.jsx)(n,{result:K.data,successLabel:`Migration plan completed`}):null]})]}),(0,I.jsx)(l,{title:`Computer memory`,result:b.data,className:`xl:col-span-3`,children:e=>(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsx)(m,{value:e}),(0,I.jsxs)(`div`,{className:`flex gap-2`,children:[(0,I.jsx)(p,{label:`Enable memory`,action:()=>_.setComputerMemory(!0),invalidate:[`computerMemory`]}),(0,I.jsx)(p,{label:`Disable memory`,action:()=>_.setComputerMemory(!1),invalidate:[`computerMemory`],variant:`destructive`})]})]})})]})}function W(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}function G(e,t=`not reported`){return e==null||e===``?t:typeof e==`boolean`?e?`enabled`:`disabled`:String(e)}function K({data:e}){let t=M(e.presence||e.clients||e);return t.length?(0,I.jsx)(o,{items:t,titleKey:`user`,metaKey:`workspace_id`}):(0,I.jsx)(d,{title:`No active presence`,detail:`No live collaborators or realtime clients are currently reported.`})}function q({data:e}){let n=x(e=>e.mode),r=G(e.public_key,``);return n===`basic`?(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsx)(J,{title:`This Mac`,status:`trusted`,detail:`This device can participate in local workspace exchange when you pair another trusted device.`}),(0,I.jsx)(h,{variant:`muted`,children:G(e.algorithm,`local identity`)})]}):(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(h,{variant:`success`,children:`local device`}),(0,I.jsx)(h,{variant:`muted`,children:G(e.algorithm,`identity key`)})]}),(0,I.jsx)(t,{data:{device_id:e.device_id||e.id||`not reported`,fingerprint:e.fingerprint||`not reported`,public_key:r?C(r.replace(/\s+/g,` `),72):`not reported`}})]})}function te({data:e}){let t=x(e=>e.mode);return(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsx)(s,{stats:[{label:`Status`,value:e.status||e.ok||`reported`},{label:`Version`,value:e.version||`not reported`},{label:`Mode`,value:e.mode||e.environment||`local`},...t===`basic`?[]:[{label:`Port`,value:e.port||e.backend_port||`configured`}]]}),t===`basic`?null:(0,I.jsx)(m,{value:e})]})}function ne({data:e}){let t=W(e.active)?e.active:e,n=W(e.postgres)?e.postgres:{},r=W(e.backup_health)?e.backup_health:{},i=t.vector_search||t.vector||e.vector_search||e.sqlite_vec,a=!!(n.available||n.connected||n.enabled);return(0,I.jsxs)(`div`,{className:`space-y-4`,children:[(0,I.jsx)(s,{stats:[{label:`Active engine`,value:t.engine||e.engine||`sqlite`},{label:`SQLite default`,value:t.engine===`postgres`?`scale mode`:`enabled`},{label:`Vector search`,value:i||`not reported`},{label:`Postgres`,value:a?`available`:`optional`}]}),(0,I.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-3`,children:[(0,I.jsx)(J,{title:`SQLite`,status:t.available===!1?`unavailable`:`default`,detail:G(t.reason||t.path||e.path,`Local brain storage is active by default.`)}),(0,I.jsx)(J,{title:`Vector search`,status:G(i,`reported`),detail:G(t.vector_reason||t.sqlite_vec_reason||e.vector_reason,`Uses the configured local vector capability or reports why it is unavailable.`)}),(0,I.jsx)(J,{title:`Postgres`,status:a?`available`:`not enabled`,detail:G(n.reason||n.dsn||n.status,`Postgres scale mode is opt-in and never required for local use.`)})]}),Object.keys(r).length?(0,I.jsx)(m,{value:{backup_health:r}}):null]})}function re({data:e}){return(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsx)(s,{stats:[{label:`Available`,value:e.available===!1?`no`:`yes`},{label:`Backups`,value:e.count||e.backups||0},{label:`Encrypted`,value:e.encrypted_archives||0},{label:`Zip backups`,value:e.zip_backups||0}]}),(0,I.jsx)(t,{data:{directory:e.directory||`not reported`,latest:e.latest||`none reported`,last_verified:e.last_verified||e.verified_at||`not reported`,failure:e.error||e.reason||`none reported`}})]})}function J({title:e,status:t,detail:n}){let r=/unavailable|failed|denied|disabled|not enabled/i.test(t)?`warning`:`success`;return(0,I.jsxs)(`div`,{className:`rounded-md border border-border bg-background p-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,I.jsx)(`div`,{className:`font-medium`,children:e}),(0,I.jsx)(h,{variant:r,children:t})]}),(0,I.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:n})]})}function Y({data:e}){let t=W(e.startup)?e.startup:{},n=W(e.privacy)?e.privacy:{},r=W(e.storage)?e.storage:{},i=W(e.backup)?e.backup:{},a=W(e.device_identity)?e.device_identity:{},o=W(e.permissions)?e.permissions:{};return(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsx)(s,{stats:[{label:`Version`,value:e.version||`reported`},{label:`Local only`,value:n.local_only_default??t.local_only_default??`reported`},{label:`Storage`,value:W(r.active)?r.active.engine:`reported`},{label:`Backups`,value:i.count||i.available||`reported`}]}),(0,I.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,I.jsx)(J,{title:`Startup`,status:t.network_exposed?`network exposed`:`local-only`,detail:`Lattice starts locally by default and reports when network access is enabled.`}),(0,I.jsx)(J,{title:`Integrations`,status:n.local_only_default===!1?`review required`:`opt-in`,detail:`External integrations remain disabled until the user explicitly enables them.`}),(0,I.jsx)(J,{title:`Device identity`,status:G(a.algorithm||a.fingerprint,`reported`),detail:G(a.storage,`Stored locally and used for signed bundle exchange.`)}),(0,I.jsx)(J,{title:`Permissions`,status:o.destructive_restore_requires_confirmation===!1?`review required`:`guarded`,detail:`Export, import, and destructive restore permissions are surfaced through admin status.`})]})]})}function X({data:e}){let t=W(e.cards)?e.cards:{},n=W(e.severity_counts)?e.severity_counts:{};return(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsx)(s,{stats:[{label:`Events today`,value:t.events_today||0},{label:`High risk`,value:t.high_risk_events||n.high||0},{label:`Review`,value:t.review_required||0},{label:`Risk rate`,value:e.risk_rate||0}]}),(0,I.jsx)(m,{value:{severity_counts:n,sensitive_fields:e.field_counts||{}}})]})}function Z(){let e=x(e=>e.mode),n=g({queryKey:[`adminSummary`],queryFn:_.adminSummary}),r=g({queryKey:[`adminUsers`],queryFn:_.adminUsers}),i=g({queryKey:[`adminAudit`],queryFn:()=>_.adminAudit()}),a=g({queryKey:[`adminRoles`],queryFn:_.adminRoles}),s=g({queryKey:[`adminPolicies`],queryFn:_.adminPolicies}),c=g({queryKey:[`adminProductHardening`],queryFn:_.adminProductHardening}),u=g({queryKey:[`adminSecurity`],queryFn:_.adminSecurity}),d=g({queryKey:[`vpcStatus`],queryFn:_.vpcStatus});return e===`admin`?(0,I.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,I.jsx)(l,{title:`Admin summary`,result:n.data,children:e=>(0,I.jsx)(t,{data:e})}),(0,I.jsx)(l,{title:`Users`,result:r.data,children:e=>(0,I.jsx)(o,{items:e,titleKey:`email`,metaKey:`role`})}),(0,I.jsx)(l,{title:`Audit`,result:i.data,children:e=>(0,I.jsx)(o,{items:e.recent_events||e,titleKey:`act`,metaKey:`sev`})}),(0,I.jsx)(l,{title:`Roles`,result:a.data,children:e=>(0,I.jsx)(o,{items:e.roles||e,titleKey:`role`,metaKey:`members`})}),(0,I.jsx)(l,{title:`Policies`,result:s.data,children:e=>(0,I.jsx)(o,{items:e.policies||e,titleKey:`label`,metaKey:`enforced`})}),(0,I.jsx)(l,{title:`Product hardening`,result:c.data,children:e=>(0,I.jsx)(Y,{data:e})}),(0,I.jsx)(l,{title:`Security overview`,result:u.data,children:e=>(0,I.jsx)(X,{data:e})}),(0,I.jsx)(l,{title:`Private VPC`,result:d.data,className:`xl:col-span-2`,children:e=>(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(h,{variant:`muted`,children:`Community-disabled features remain honest unavailable states.`}),(0,I.jsx)(m,{value:e})]})})]}):(0,I.jsx)(f,{title:`Admin controls`,detail:`Switch to Admin mode to review users, audit events, policies, security posture, and private networking diagnostics.`,target:`admin`})}export{R as SystemPage};
|