ltcai 8.8.0 → 9.0.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 +33 -37
- package/auto_setup.py +84 -70
- package/docs/CHANGELOG.md +113 -237
- package/docs/CODE_REVIEW_2026-07-06.md +764 -0
- package/docs/COMMUNITY_AND_PLUGINS.md +3 -3
- package/docs/DEVELOPMENT.md +10 -10
- package/docs/LEGACY_COMPATIBILITY.md +1 -1
- package/docs/ONBOARDING.md +2 -2
- package/docs/PRODUCT_DIRECTION_REVIEW.md +3 -2
- package/docs/ROADMAP_RECOMMENDATIONS.md +61 -36
- package/docs/TRUST_MODEL.md +5 -1
- package/docs/WHY_LATTICE.md +4 -3
- package/docs/architecture.md +4 -0
- package/docs/kg-schema.md +1 -1
- package/lattice_brain/__init__.py +1 -1
- package/lattice_brain/archive.py +4 -9
- package/lattice_brain/conversations.py +156 -21
- package/lattice_brain/embeddings.py +38 -2
- package/lattice_brain/graph/_kg_common.py +39 -496
- package/lattice_brain/graph/_kg_constants.py +243 -0
- package/lattice_brain/graph/_kg_fsutil.py +297 -0
- package/lattice_brain/graph/discovery.py +0 -948
- package/lattice_brain/graph/discovery_index.py +972 -0
- package/lattice_brain/graph/json_utils.py +25 -0
- package/lattice_brain/graph/retrieval.py +66 -597
- package/lattice_brain/graph/retrieval_docgen.py +210 -0
- package/lattice_brain/graph/retrieval_vector.py +460 -0
- package/lattice_brain/graph/runtime.py +16 -0
- package/lattice_brain/graph/store.py +6 -0
- package/lattice_brain/ingestion.py +68 -0
- package/lattice_brain/portability.py +1 -9
- package/lattice_brain/quality.py +98 -4
- package/lattice_brain/runtime/agent_runtime.py +166 -0
- package/lattice_brain/runtime/multi_agent.py +1 -1
- package/lattice_brain/utils.py +28 -0
- package/latticeai/__init__.py +1 -1
- package/latticeai/api/chat.py +368 -418
- package/latticeai/api/chat_helpers.py +227 -0
- package/latticeai/api/computer_use.py +149 -31
- package/latticeai/api/marketplace.py +11 -0
- package/latticeai/api/mcp.py +3 -2
- package/latticeai/api/models.py +4 -1
- package/latticeai/api/permissions.py +72 -33
- package/latticeai/api/setup.py +17 -2
- package/latticeai/api/tools.py +105 -62
- package/latticeai/app_factory.py +101 -296
- package/latticeai/core/agent.py +25 -7
- package/latticeai/core/io_utils.py +37 -0
- package/latticeai/core/legacy_compatibility.py +1 -1
- package/latticeai/core/local_embeddings.py +2 -4
- package/latticeai/core/marketplace.py +33 -2
- package/latticeai/core/mcp_catalog.py +450 -0
- package/latticeai/core/mcp_registry.py +2 -441
- package/latticeai/core/sessions.py +11 -3
- package/latticeai/core/tool_registry.py +15 -4
- package/latticeai/core/users.py +4 -9
- package/latticeai/core/workspace_os.py +1 -1
- package/latticeai/core/workspace_os_utils.py +3 -17
- package/latticeai/integrations/telegram_bot.py +7 -2
- package/latticeai/models/model_providers.py +111 -0
- package/latticeai/models/router.py +58 -136
- package/latticeai/runtime/audit_runtime.py +27 -16
- package/latticeai/runtime/automation_runtime.py +9 -0
- package/latticeai/runtime/bootstrap.py +1 -1
- package/latticeai/runtime/history_runtime.py +163 -0
- package/latticeai/runtime/namespace_runtime.py +173 -0
- package/latticeai/runtime/network_config_runtime.py +56 -0
- package/latticeai/runtime/sso_config_runtime.py +128 -0
- package/latticeai/runtime/user_key_runtime.py +106 -0
- package/latticeai/services/app_context.py +1 -0
- package/latticeai/services/architecture_readiness.py +2 -2
- package/latticeai/services/memory_service.py +213 -0
- package/latticeai/services/model_engines.py +79 -12
- package/latticeai/services/model_runtime.py +24 -4
- package/latticeai/services/platform_runtime.py +9 -1
- package/latticeai/services/process_audit.py +208 -0
- package/latticeai/services/product_readiness.py +11 -11
- package/latticeai/services/review_queue.py +64 -11
- package/latticeai/services/run_executor.py +21 -0
- package/latticeai/services/search_service.py +106 -30
- package/latticeai/services/setup_detection.py +80 -0
- package/latticeai/services/tool_dispatch.py +66 -0
- package/latticeai/services/workspace_service.py +15 -0
- package/package.json +1 -1
- package/scripts/check_i18n_literals.mjs +20 -8
- package/scripts/i18n_literal_allowlist.json +34 -0
- package/scripts/lint_frontend.mjs +6 -2
- package/setup_wizard.py +196 -74
- 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 +11 -11
- package/static/app/assets/{Act-C7K9wsO9.js → Act-21lIXx2E.js} +1 -1
- package/static/app/assets/Brain-BqUd5UJJ.js +321 -0
- package/static/app/assets/{Capture-B3V4_5Xp.js → Capture-BA7Z2Q1u.js} +1 -1
- package/static/app/assets/{Library-Cgj-EF50.js → Library-bFMtyni3.js} +1 -1
- package/static/app/assets/System-K6krGCqn.js +1 -0
- package/static/app/assets/index-C4R3ws30.js +17 -0
- package/static/app/assets/index-ChSeOB02.css +2 -0
- package/static/app/assets/primitives-sQU3it5I.js +1 -0
- package/static/app/assets/{textarea-CVQkN2Tk.js → textarea-DK3Fd_lR.js} +1 -1
- package/static/app/index.html +2 -2
- package/static/css/tokens.css +4 -2
- package/static/sw.js +1 -1
- package/tools/local_files.py +6 -0
- package/latticeai/runtime/sso_runtime.py +0 -52
- package/static/app/assets/Brain-I1OSzxJu.js +0 -321
- package/static/app/assets/System-D1Lkei3I.js +0 -1
- package/static/app/assets/index--P0ksosz.js +0 -17
- package/static/app/assets/index-DCh5AoXt.css +0 -2
- package/static/app/assets/primitives-BLqaKk5g.js +0 -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-BLqaKk5g.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--P0ksosz.js";var j=A(`clipboard-paste`,[[`path`,{d:`M11 14h10`,key:`1w8e9d`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v1.344`,key:`1e62lh`}],[`path`,{d:`m17 18 4-4-4-4`,key:`z2g111`}],[`path`,{d:`M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113`,key:`bjbb7m`}],[`rect`,{x:`8`,y:`2`,width:`8`,height:`4`,rx:`1`,key:`ublpy`}]]),M=A(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),N=A(`scan-line`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}]]),P=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`}]]),F=m(_()),I=h();function L({initialTab:e}){let t=g(e=>e.language),[r,i]=F.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 F.useEffect(()=>{(e===`pipeline`||e===`local`||e===`files`)&&i(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)(P,{className:`h-4 w-4`}),` `,y(t,`capture.kicker`)]}),(0,I.jsx)(`h1`,{className:`page-title`,children:y(t,`capture.title`)}),(0,I.jsx)(`p`,{className:`page-copy`,children:y(t,`capture.body`)})]}),(0,I.jsx)(n,{tabs:a,value:r,onChange:e=>i(e)}),r===`files`?(0,I.jsx)(R,{}):null,r===`local`?(0,I.jsx)(Y,{}):null,r===`browser`?(0,I.jsx)(X,{}):null,r===`pipeline`?(0,I.jsx)(Q,{}):null]})}function R(){let t=g(e=>e.language),n=C(),l=f({queryKey:[`documents`],queryFn:()=>p.documents(200)}),[u,d]=F.useState([]),m=w({mutationFn:e=>z(e,d),onSuccess:()=>{n.invalidateQueries({queryKey:[`documents`]}),n.invalidateQueries({queryKey:[`graphStats`]}),n.invalidateQueries({queryKey:[`memoryManager`]})}}),h=F.useCallback(e=>{let t=Array.from(e);t.length&&m.mutate(t)},[m]);return(0,I.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[0.75fr_1.25fr]`,children:[(0,I.jsxs)(c,{children:[(0,I.jsxs)(r,{children:[(0,I.jsxs)(e,{className:`flex items-center gap-2`,children:[(0,I.jsx)(P,{className:`h-4 w-4`}),` `,y(t,`capture.files.title`)]}),(0,I.jsx)(i,{children:y(t,`capture.files.description`)})]}),(0,I.jsxs)(o,{children:[(0,I.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,I.jsx)(P,{className:`h-7 w-7 text-primary`}),(0,I.jsx)(`span`,{className:`text-lg font-semibold`,children:y(t,`capture.files.drop`)}),(0,I.jsx)(`span`,{className:`max-w-sm text-sm leading-6 text-muted-foreground`,children:y(t,`capture.files.dropDetail`)}),(0,I.jsx)(`input`,{type:`file`,multiple:!0,className:`sr-only`,onChange:e=>e.target.files&&h(e.target.files)})]}),(0,I.jsx)(B,{queue:u,onRetry:e=>h([e])})]})]}),(0,I.jsx)(s,{title:y(t,`capture.files.uploaded`),result:l.data,children:e=>(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsx)(a,{items:e.documents||e,titleKey:`filename`,metaKey:`ingest_state`,limit:12}),(0,I.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 z(e,t){let n=e.map(e=>({id:`${e.name}-${e.size}-${e.lastModified}-${Date.now()}`,file:e,name:U(e),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 B({queue:e,onRetry:n}){let r=g(e=>e.language);return e.length?(0,I.jsx)(`div`,{className:`mt-4 space-y-2`,children:e.map(e=>{let i=V(e,r);return(0,I.jsxs)(`div`,{className:`rounded-md border border-border bg-background/55 p-3 text-sm`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[e.status===`done`?(0,I.jsx)(v,{className:`h-4 w-4 text-emerald-400`}):e.status===`failed`?(0,I.jsx)(d,{className:`h-4 w-4 text-amber-400`}):(0,I.jsx)(T,{className:`h-4 w-4 animate-spin text-primary`}),e.name]}),(0,I.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,I.jsxs)(E,{size:`sm`,variant:`outline`,onClick:()=>n(e.file),children:[(0,I.jsx)(b,{className:`h-3.5 w-3.5`}),` `,y(r,`capture.retry`)]}):null]}),e.result?(0,I.jsx)(t,{result:e.result,successLabel:y(r,`capture.files.success`)}):null]},e.id)})}):null}function V(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`)}var H={webkitdirectory:``,directory:``};function U(e){return e.webkitRelativePath||e.name}function W(e){return(e[0]?.webkitRelativePath||``).split(`/`).filter(Boolean)[0]||``}function G(){let e=window;return!!(e.__TAURI__?.core?.invoke||e.latticeDesktop?.selectFolder||e.__TAURI_INTERNALS__&&window.location.protocol===`tauri:`)}function K(e){return e instanceof DOMException&&e.name===`AbortError`}async function q(e){let t=[];if(typeof e.values==`function`){for await(let n of e.values())t.push(n);return t}if(typeof e.entries==`function`)for await(let[,n]of e.entries())t.push(n);return t}async function J(e){let t=[];for(let n of await q(e)){if(n.kind===`file`){t.push(await n.getFile());continue}t.push(...await J(n))}return t}function Y(){let n=g(e=>e.language),d=C(),m=F.useRef(null),[h,_]=F.useState(``),[v,b]=F.useState(null),[S,O]=F.useState(``),[A,j]=F.useState(!1),[P,L]=F.useState([]),R=f({queryKey:[`localSources`],queryFn:p.localSources}),V=f({queryKey:[`localAgent`],queryFn:p.localAgent}),U=w({mutationFn:e=>p.connectFolder((e||h).trim()),onSuccess:()=>{b(null),d.invalidateQueries({queryKey:[`localSources`]}),d.invalidateQueries({queryKey:[`graphStats`]}),d.invalidateQueries({queryKey:[`memoryManager`]})}}),q=w({mutationFn:e=>z(e,L),onSuccess:()=>{d.invalidateQueries({queryKey:[`documents`]}),d.invalidateQueries({queryKey:[`graphStats`]}),d.invalidateQueries({queryKey:[`memoryManager`]})}}),Y=F.useCallback((e,t)=>{if(!e.length){b(y(n,`capture.local.emptyFolder`));return}b(null),O(t||W(e)||y(n,`capture.local.browserFolder`)),q.mutate(e)},[q,n]),X=F.useCallback(async()=>{if(!A){j(!0),b(null);try{let e=window.showDirectoryPicker;if(!G()&&typeof e==`function`){let t=await e.call(window);Y(await J(t),t.name);return}if(G()){let e=await p.selectFolder();if(e){O(``),_(e),U.mutate(e);return}}if(typeof e==`function`){let t=await e.call(window);Y(await J(t),t.name);return}if(m.current){m.current.click();return}b(y(n,`capture.local.pickUnavailable`))}catch(e){K(e)||b(y(n,`capture.local.pickUnavailable`))}finally{j(!1)}}},[Y,A,U,n]),Z=F.useCallback(()=>{let e=h.trim();e&&(b(null),O(``),U.mutate(e))},[U,h]),Q=(q.data||[]).find(e=>!e.ok)?.error,$=!!(q.error||Q);return(0,I.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[0.9fr_1.1fr]`,children:[(0,I.jsxs)(c,{children:[(0,I.jsxs)(r,{children:[(0,I.jsxs)(e,{className:`flex items-center gap-2`,children:[(0,I.jsx)(x,{className:`h-4 w-4`}),` `,y(n,`capture.local.title`)]}),(0,I.jsx)(i,{children:y(n,`capture.local.description`)})]}),(0,I.jsxs)(o,{className:`space-y-3`,children:[(0,I.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),Z()},children:[(0,I.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,I.jsx)(D,{value:h,onChange:e=>_(e.target.value),placeholder:y(n,`capture.local.placeholder`)}),(0,I.jsxs)(E,{type:`button`,variant:`outline`,disabled:A||U.isPending||q.isPending,onClick:()=>void X(),children:[A?(0,I.jsx)(T,{className:`h-4 w-4 animate-spin`}):(0,I.jsx)(M,{className:`h-4 w-4`}),A?y(n,`capture.local.choosing`):y(n,`capture.local.choose`)]})]}),(0,I.jsx)(`input`,{ref:m,type:`file`,multiple:!0,className:`sr-only`,"aria-hidden":`true`,tabIndex:-1,...H,onChange:e=>{let t=Array.from(e.currentTarget.files||[]);e.currentTarget.value=``,Y(t)}}),(0,I.jsxs)(E,{type:`submit`,disabled:!h.trim()||U.isPending,children:[U.isPending?(0,I.jsx)(T,{className:`h-4 w-4 animate-spin`}):(0,I.jsx)(N,{className:`h-4 w-4`}),y(n,`capture.local.connect`)]})]}),v?(0,I.jsx)(t,{result:{ok:!1,status:0,data:{},source:`unavailable`,error:v}}):null,U.data?(0,I.jsx)(t,{result:U.data,successLabel:y(n,`capture.local.success`)}):null,S?(0,I.jsx)(t,{result:{ok:q.isPending||!$,status:$?0:200,data:{folder:S},source:$?`unavailable`:`live`,error:q.error?y(n,`capture.local.browserImportFailed`):Q},successLabel:q.isPending?y(n,`capture.local.browserImporting`):y(n,`capture.local.browserImportSuccess`,{folder:S})}):null,(0,I.jsx)(B,{queue:P,onRetry:e=>Y([e],S)})]})]}),(0,I.jsx)(s,{title:y(n,`capture.local.sources`),result:R.data,children:e=>(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsx)(a,{items:e.sources,titleKey:`path`,metaKey:`status`}),k(e.sources).map(e=>(0,I.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,I.jsx)(s,{title:y(n,`capture.local.access`),result:V.data,className:`xl:col-span-2`,children:e=>(0,I.jsx)(u,{value:e})})]})}function X(){let n=g(e=>e.language),a=C(),[s,l]=F.useState(``),u=w({mutationFn:e=>p.browserReadUrl(e),onSuccess:()=>{a.invalidateQueries({queryKey:[`graphStats`]}),a.invalidateQueries({queryKey:[`memoryManager`]})}}),d=F.useCallback(()=>{let e=Z(s);e&&(l(e),u.mutate(e))},[u,s]),f=F.useCallback(async()=>{let e=Z(await navigator.clipboard?.readText().catch(()=>``)||``);e&&(l(e),u.mutate(e))},[u]);return(0,I.jsxs)(c,{children:[(0,I.jsxs)(r,{children:[(0,I.jsxs)(e,{className:`flex items-center gap-2`,children:[(0,I.jsx)(S,{className:`h-4 w-4`}),` `,y(n,`capture.browser.title`)]}),(0,I.jsx)(i,{children:y(n,`capture.browser.description`)})]}),(0,I.jsxs)(o,{className:`space-y-3`,children:[(0,I.jsxs)(`form`,{className:`flex flex-col gap-2 sm:flex-row`,onSubmit:e=>{e.preventDefault(),d()},children:[(0,I.jsx)(D,{value:s,onChange:e=>l(e.target.value),placeholder:y(n,`capture.browser.placeholder`),inputMode:`url`}),(0,I.jsxs)(E,{type:`button`,variant:`outline`,disabled:u.isPending,onClick:()=>void f(),children:[(0,I.jsx)(j,{className:`h-4 w-4`}),` `,y(n,`capture.browser.paste`)]}),(0,I.jsxs)(E,{type:`submit`,disabled:!s.trim()||u.isPending,children:[u.isPending?(0,I.jsx)(T,{className:`h-4 w-4 animate-spin`}):(0,I.jsx)(N,{className:`h-4 w-4`}),y(n,`capture.browser.capture`)]})]}),u.data?(0,I.jsx)(t,{result:u.data,successLabel:y(n,`capture.browser.success`)}):null]})]})}function Z(e){let t=e.trim();return t?/^https?:\/\//i.test(t)?t:/^[\w.-]+\.[a-z]{2,}([/:?#].*)?$/i.test(t)?`https://${t}`:t:``}function Q(){let t=g(e=>e.language),n=f({queryKey:[`index`],queryFn:p.indexStatus}),a=f({queryKey:[`graphStats`],queryFn:p.graphStats});return(0,I.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,I.jsx)(s,{title:y(t,`capture.pipeline.status`),result:n.data,children:e=>(0,I.jsx)(u,{value:e})}),(0,I.jsx)(s,{title:y(t,`capture.pipeline.growth`),result:a.data,children:e=>(0,I.jsx)(u,{value:e})}),(0,I.jsxs)(c,{className:`xl:col-span-2`,children:[(0,I.jsxs)(r,{children:[(0,I.jsxs)(e,{className:`flex items-center gap-2`,children:[(0,I.jsx)(O,{className:`h-4 w-4`}),` `,y(t,`capture.pipeline.refresh`)]}),(0,I.jsx)(i,{children:y(t,`capture.pipeline.description`)})]}),(0,I.jsx)(o,{children:(0,I.jsx)(l,{label:y(t,`capture.pipeline.rebuild`),action:()=>p.rebuildIndex(),invalidate:[`index`]})})]})]})}export{L as CapturePage};
|
|
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-sQU3it5I.js";import{A as f,F as p,L as m,M as h,N as g,O 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-C4R3ws30.js";var j=A(`clipboard-paste`,[[`path`,{d:`M11 14h10`,key:`1w8e9d`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v1.344`,key:`1e62lh`}],[`path`,{d:`m17 18 4-4-4-4`,key:`z2g111`}],[`path`,{d:`M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113`,key:`bjbb7m`}],[`rect`,{x:`8`,y:`2`,width:`8`,height:`4`,rx:`1`,key:`ublpy`}]]),M=A(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),N=A(`scan-line`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}]]),P=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`}]]),F=m(p()),I=g();function L({initialTab:e}){let t=w(e=>e.language),[r,i]=F.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 F.useEffect(()=>{(e===`pipeline`||e===`local`||e===`files`)&&i(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)(P,{className:`h-4 w-4`}),` `,y(t,`capture.kicker`)]}),(0,I.jsx)(`h1`,{className:`page-title`,children:y(t,`capture.title`)}),(0,I.jsx)(`p`,{className:`page-copy`,children:y(t,`capture.body`)})]}),(0,I.jsx)(n,{tabs:a,value:r,onChange:e=>i(e)}),r===`files`?(0,I.jsx)(R,{}):null,r===`local`?(0,I.jsx)(Y,{}):null,r===`browser`?(0,I.jsx)(X,{}):null,r===`pipeline`?(0,I.jsx)(Q,{}):null]})}function R(){let t=w(e=>e.language),n=h(),l=C({queryKey:[`documents`],queryFn:()=>_.documents(200)}),[u,d]=F.useState([]),p=f({mutationFn:e=>z(e,d),onSuccess:()=>{n.invalidateQueries({queryKey:[`documents`]}),n.invalidateQueries({queryKey:[`graphStats`]}),n.invalidateQueries({queryKey:[`memoryManager`]})}}),m=F.useCallback(e=>{let t=Array.from(e);t.length&&p.mutate(t)},[p]);return(0,I.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[0.75fr_1.25fr]`,children:[(0,I.jsxs)(c,{children:[(0,I.jsxs)(r,{children:[(0,I.jsxs)(e,{className:`flex items-center gap-2`,children:[(0,I.jsx)(P,{className:`h-4 w-4`}),` `,y(t,`capture.files.title`)]}),(0,I.jsx)(i,{children:y(t,`capture.files.description`)})]}),(0,I.jsxs)(o,{children:[(0,I.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(),m(e.dataTransfer.files)},children:[(0,I.jsx)(P,{className:`h-7 w-7 text-primary`}),(0,I.jsx)(`span`,{className:`text-lg font-semibold`,children:y(t,`capture.files.drop`)}),(0,I.jsx)(`span`,{className:`max-w-sm text-sm leading-6 text-muted-foreground`,children:y(t,`capture.files.dropDetail`)}),(0,I.jsx)(`input`,{type:`file`,multiple:!0,className:`sr-only`,onChange:e=>e.target.files&&m(e.target.files)})]}),(0,I.jsx)(B,{queue:u,onRetry:e=>m([e])})]})]}),(0,I.jsx)(s,{title:y(t,`capture.files.uploaded`),result:l.data,children:e=>(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsx)(a,{items:e.documents||e,titleKey:`filename`,metaKey:`ingest_state`,limit:12}),(0,I.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 z(e,t){let n=e.map(e=>({id:`${e.name}-${e.size}-${e.lastModified}-${Date.now()}`,file:e,name:U(e),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 _.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 B({queue:e,onRetry:n}){let r=w(e=>e.language);return e.length?(0,I.jsx)(`div`,{className:`mt-4 space-y-2`,children:e.map(e=>{let i=V(e,r);return(0,I.jsxs)(`div`,{className:`rounded-md border border-border bg-background/55 p-3 text-sm`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[e.status===`done`?(0,I.jsx)(v,{className:`h-4 w-4 text-emerald-400`}):e.status===`failed`?(0,I.jsx)(d,{className:`h-4 w-4 text-amber-400`}):(0,I.jsx)(T,{className:`h-4 w-4 animate-spin text-primary`}),e.name]}),(0,I.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,I.jsxs)(E,{size:`sm`,variant:`outline`,onClick:()=>n(e.file),children:[(0,I.jsx)(b,{className:`h-3.5 w-3.5`}),` `,y(r,`capture.retry`)]}):null]}),e.result?(0,I.jsx)(t,{result:e.result,successLabel:y(r,`capture.files.success`)}):null]},e.id)})}):null}function V(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`)}var H={webkitdirectory:``,directory:``};function U(e){return e.webkitRelativePath||e.name}function W(e){return(e[0]?.webkitRelativePath||``).split(`/`).filter(Boolean)[0]||``}function G(){let e=window;return!!(e.__TAURI__?.core?.invoke||e.latticeDesktop?.selectFolder||e.__TAURI_INTERNALS__&&window.location.protocol===`tauri:`)}function K(e){return e instanceof DOMException&&e.name===`AbortError`}async function q(e){let t=[];if(typeof e.values==`function`){for await(let n of e.values())t.push(n);return t}if(typeof e.entries==`function`)for await(let[,n]of e.entries())t.push(n);return t}async function J(e){let t=[];for(let n of await q(e)){if(n.kind===`file`){t.push(await n.getFile());continue}t.push(...await J(n))}return t}function Y(){let n=w(e=>e.language),d=h(),p=F.useRef(null),[m,g]=F.useState(``),[v,b]=F.useState(null),[S,O]=F.useState(``),[A,j]=F.useState(!1),[P,L]=F.useState([]),R=C({queryKey:[`localSources`],queryFn:_.localSources}),V=C({queryKey:[`localAgent`],queryFn:_.localAgent}),U=f({mutationFn:e=>_.connectFolder((e||m).trim()),onSuccess:()=>{b(null),d.invalidateQueries({queryKey:[`localSources`]}),d.invalidateQueries({queryKey:[`graphStats`]}),d.invalidateQueries({queryKey:[`memoryManager`]})}}),q=f({mutationFn:e=>z(e,L),onSuccess:()=>{d.invalidateQueries({queryKey:[`documents`]}),d.invalidateQueries({queryKey:[`graphStats`]}),d.invalidateQueries({queryKey:[`memoryManager`]})}}),Y=F.useCallback((e,t)=>{if(!e.length){b(y(n,`capture.local.emptyFolder`));return}b(null),O(t||W(e)||y(n,`capture.local.browserFolder`)),q.mutate(e)},[q,n]),X=F.useCallback(async()=>{if(!A){j(!0),b(null);try{let e=window.showDirectoryPicker;if(!G()&&typeof e==`function`){let t=await e.call(window);Y(await J(t),t.name);return}if(G()){let e=await _.selectFolder();if(e){O(``),g(e),U.mutate(e);return}}if(typeof e==`function`){let t=await e.call(window);Y(await J(t),t.name);return}if(p.current){p.current.click();return}b(y(n,`capture.local.pickUnavailable`))}catch(e){K(e)||b(y(n,`capture.local.pickUnavailable`))}finally{j(!1)}}},[Y,A,U,n]),Z=F.useCallback(()=>{let e=m.trim();e&&(b(null),O(``),U.mutate(e))},[U,m]),Q=(q.data||[]).find(e=>!e.ok)?.error,$=!!(q.error||Q);return(0,I.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[0.9fr_1.1fr]`,children:[(0,I.jsxs)(c,{children:[(0,I.jsxs)(r,{children:[(0,I.jsxs)(e,{className:`flex items-center gap-2`,children:[(0,I.jsx)(x,{className:`h-4 w-4`}),` `,y(n,`capture.local.title`)]}),(0,I.jsx)(i,{children:y(n,`capture.local.description`)})]}),(0,I.jsxs)(o,{className:`space-y-3`,children:[(0,I.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),Z()},children:[(0,I.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,I.jsx)(D,{value:m,onChange:e=>g(e.target.value),placeholder:y(n,`capture.local.placeholder`)}),(0,I.jsxs)(E,{type:`button`,variant:`outline`,disabled:A||U.isPending||q.isPending,onClick:()=>void X(),children:[A?(0,I.jsx)(T,{className:`h-4 w-4 animate-spin`}):(0,I.jsx)(M,{className:`h-4 w-4`}),A?y(n,`capture.local.choosing`):y(n,`capture.local.choose`)]})]}),(0,I.jsx)(`input`,{ref:p,type:`file`,multiple:!0,className:`sr-only`,"aria-hidden":`true`,tabIndex:-1,...H,onChange:e=>{let t=Array.from(e.currentTarget.files||[]);e.currentTarget.value=``,Y(t)}}),(0,I.jsxs)(E,{type:`submit`,disabled:!m.trim()||U.isPending,children:[U.isPending?(0,I.jsx)(T,{className:`h-4 w-4 animate-spin`}):(0,I.jsx)(N,{className:`h-4 w-4`}),y(n,`capture.local.connect`)]})]}),v?(0,I.jsx)(t,{result:{ok:!1,status:0,data:{},source:`unavailable`,error:v}}):null,U.data?(0,I.jsx)(t,{result:U.data,successLabel:y(n,`capture.local.success`)}):null,S?(0,I.jsx)(t,{result:{ok:q.isPending||!$,status:$?0:200,data:{folder:S},source:$?`unavailable`:`live`,error:q.error?y(n,`capture.local.browserImportFailed`):Q},successLabel:q.isPending?y(n,`capture.local.browserImporting`):y(n,`capture.local.browserImportSuccess`,{folder:S})}):null,(0,I.jsx)(B,{queue:P,onRetry:e=>Y([e],S)})]})]}),(0,I.jsx)(s,{title:y(n,`capture.local.sources`),result:R.data,children:e=>(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsx)(a,{items:e.sources,titleKey:`path`,metaKey:`status`}),k(e.sources).map(e=>(0,I.jsx)(l,{label:`Stop ${String(e.path||e.id||`source`)}`,action:()=>_.localWatchStop(String(e.id||e.source_id)),invalidate:[`localSources`]},String(e.id||e.source_id||e.path)))]})}),(0,I.jsx)(s,{title:y(n,`capture.local.access`),result:V.data,className:`xl:col-span-2`,children:e=>(0,I.jsx)(u,{value:e})})]})}function X(){let n=w(e=>e.language),a=h(),[s,l]=F.useState(``),u=f({mutationFn:e=>_.browserReadUrl(e),onSuccess:()=>{a.invalidateQueries({queryKey:[`graphStats`]}),a.invalidateQueries({queryKey:[`memoryManager`]})}}),d=F.useCallback(()=>{let e=Z(s);e&&(l(e),u.mutate(e))},[u,s]),p=F.useCallback(async()=>{let e=Z(await navigator.clipboard?.readText().catch(()=>``)||``);e&&(l(e),u.mutate(e))},[u]);return(0,I.jsxs)(c,{children:[(0,I.jsxs)(r,{children:[(0,I.jsxs)(e,{className:`flex items-center gap-2`,children:[(0,I.jsx)(S,{className:`h-4 w-4`}),` `,y(n,`capture.browser.title`)]}),(0,I.jsx)(i,{children:y(n,`capture.browser.description`)})]}),(0,I.jsxs)(o,{className:`space-y-3`,children:[(0,I.jsxs)(`form`,{className:`flex flex-col gap-2 sm:flex-row`,onSubmit:e=>{e.preventDefault(),d()},children:[(0,I.jsx)(D,{value:s,onChange:e=>l(e.target.value),placeholder:y(n,`capture.browser.placeholder`),inputMode:`url`}),(0,I.jsxs)(E,{type:`button`,variant:`outline`,disabled:u.isPending,onClick:()=>void p(),children:[(0,I.jsx)(j,{className:`h-4 w-4`}),` `,y(n,`capture.browser.paste`)]}),(0,I.jsxs)(E,{type:`submit`,disabled:!s.trim()||u.isPending,children:[u.isPending?(0,I.jsx)(T,{className:`h-4 w-4 animate-spin`}):(0,I.jsx)(N,{className:`h-4 w-4`}),y(n,`capture.browser.capture`)]})]}),u.data?(0,I.jsx)(t,{result:u.data,successLabel:y(n,`capture.browser.success`)}):null]})]})}function Z(e){let t=e.trim();return t?/^https?:\/\//i.test(t)?t:/^[\w.-]+\.[a-z]{2,}([/:?#].*)?$/i.test(t)?`https://${t}`:t:``}function Q(){let t=w(e=>e.language),n=C({queryKey:[`index`],queryFn:_.indexStatus}),a=C({queryKey:[`graphStats`],queryFn:_.graphStats});return(0,I.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,I.jsx)(s,{title:y(t,`capture.pipeline.status`),result:n.data,children:e=>(0,I.jsx)(u,{value:e})}),(0,I.jsx)(s,{title:y(t,`capture.pipeline.growth`),result:a.data,children:e=>(0,I.jsx)(u,{value:e})}),(0,I.jsxs)(c,{className:`xl:col-span-2`,children:[(0,I.jsxs)(r,{children:[(0,I.jsxs)(e,{className:`flex items-center gap-2`,children:[(0,I.jsx)(O,{className:`h-4 w-4`}),` `,y(t,`capture.pipeline.refresh`)]}),(0,I.jsx)(i,{children:y(t,`capture.pipeline.description`)})]}),(0,I.jsx)(o,{children:(0,I.jsx)(l,{label:y(t,`capture.pipeline.rebuild`),action:()=>_.rebuildIndex(),invalidate:[`index`]})})]})]})}export{L 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-BLqaKk5g.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--P0ksosz.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=y(e=>e.language),i=h({queryKey:[`models`],queryFn:g.models}),a=h({queryKey:[`modelRecommendations`,`local_mlx`],queryFn:()=>g.modelRecommendations(`local_mlx`)}),s=h({queryKey:[`embeddings`],queryFn:g.embeddingsStatus}),[c,u]=I.useState(!1),[_,v]=I.useState(null),[b,T]=I.useState([]),[O,A]=I.useState(null),[j,P]=I.useState(null),[R,z]=I.useState(!1),B=[...k(i.data?.data?.catalog),...k(i.data?.data?.recommended)],G=k(a.data?.data?.recommendations?.models),K=new Map(G.map(e=>[String(e.id),e])),q=k(i.data?.data?.loaded),J=String(i.data?.data?.current||``),Y=B.find(e=>q.includes(String(e.id))||String(e.id)===J),X=a.data?.data?.recommendations?.top_pick||null,Z=b[b.length-1]||null,Q=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 $(t,n,r){z(!0),v(t),T([]),A(null),P(null);let i=await g.streamModelPrepare({model:t,engine:n||`local_mlx`,allow_download:r},{onProgress:e=>T(t=>[...t.slice(-8),e]),onDone:e=>A(e),onError:e=>P(e)});z(!1),await e.invalidateQueries({queryKey:[`models`]}),await e.invalidateQueries({queryKey:[`modelRecommendations`,`local_mlx`]}),!i.ok&&!j&&P(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:S(n,`library.models.setup.title`),description:S(n,`library.models.setup.desc`),result:a.data,children:r=>{let i=r.recommendations,a=r.profile;return(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsx)(H,{language:n,mode:t,profile:a||{},recommendation:i||{},current:Y,currentId:J,latestProgress:Z,lastResult:O,onReload:()=>{Y&&$(String(Y.recommended_load_id||Y.id||J),String(Y.recommended_engine||Y.engine||`local_mlx`),c)},onUnload:()=>{J&&g.unloadModel(J).then(()=>e.invalidateQueries({queryKey:[`models`]}))}}),(0,L.jsx)(`div`,{className:`grid gap-2 md:grid-cols-3 xl:grid-cols-6`,children:[[S(n,`library.step.environment`),!0,C],[S(n,`library.step.recommend`),!!(X||B.length),x],[S(n,`library.step.install`),!!(Y||Z?.stage===`engine`),N],[S(n,`library.step.download`),!!(Y||Z?.stage===`download`),D],[S(n,`library.step.validate`),!!(Y||Z?.stage===`smoke_test`),F],[S(n,`library.step.ready`),!!(Y||O),M]].map(([e,t,r])=>(0,L.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/55 p-3`,children:[I.createElement(r,{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?S(n,`library.step.done`):S(n,`library.step.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:c,onChange:e=>u(e.target.checked)}),(0,L.jsx)(`span`,{children:S(n,`library.consent`)})]}),Z?(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(Z.message||S(n,`library.preparing`))}),(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(Z.percent||8)}%`}})}),Z.detail?(0,L.jsx)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:String(Z.detail)}):null]}):null,j?(0,L.jsx)(U,{error:j}):null]})}}),(0,L.jsx)(l,{title:t===`basic`?S(n,`library.panel.recommended.basic`):S(n,`library.panel.recommended.other`),result:i.data,children:e=>(0,L.jsxs)(`div`,{className:`grid gap-2`,children:[(B.length?B:k(e.loaded)).slice(0,t===`basic`?3:14).map((r,i)=>{let a=String(r.id||r.model_id||r.name||i),o=k(e.loaded).includes(a)||e.current===a||r.state===`loaded`,s=String(r.recommended_load_id||a),l=String(r.recommended_engine||r.engine||``),u=K.get(a)||K.get(s)||{},d=W(r.verification),p=W(u.verification),h=W(r.hardware),v=W(u.hardware),y=h.notes||v.notes||(h.recommended_ram_gb?`~${h.recommended_ram_gb}GB RAM rec`:``),b=r.safety_notes||u.safety_notes,x=r.license||u.license,C=r.runtime_compatibility||u.runtime_compatibility||{},w=String(C.status||``)===`fallback_available`,T=r.load_status===`unsupported`||C.supported===!1,D=!!r.download_required,O=(!!r.load_available||o)&&!T,A=String(r.load_status||(o?`loaded`:`unavailable`)),j=Q(r.unavailable_reason||`This model is not ready to load yet.`),M=String(r.runtime_label||C.preferred_runtime||l||`local_mlx`),N=String(C.action||A.replace(/_/g,` `)),P=T&&t===`basic`?`needs attention`:T?N:A,F=O||D,I=r.download_size||r.estimated_size||u.download_size||u.estimated_size||r.size||u.size,z=r.provider||u.provider||r.organization||u.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(r.name||a)}),X?.id===a||r.recommended_default?(0,L.jsx)(m,{variant:`success`,children:`recommended`}):null,String(r.modality||u.modality||``).includes(`multi`)||String(r.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`?[Q(r.family||u.family||`Local model`),/mlx|gguf|ollama/i.test(String(r.size||u.size||``))?``:r.size||u.size].filter(Boolean).map(String).join(` · `):[r.family||u.family||`local`,r.size||u.size].filter(Boolean).map(String).join(` · `)}),r.hardware||u.hardware?(0,L.jsx)(`div`,{className:`mt-1 text-[11px] text-muted-foreground/80`,children:String(y)}):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:D?`Download: ${String(I||`required`)}`:`No download needed now`}),(0,L.jsx)(m,{variant:`muted`,children:D?`Internet only during download`:`Runs locally when loaded`}),z?(0,L.jsx)(m,{variant:`muted`,children:String(z)}):null]}),T?(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`:N}),(0,L.jsx)(`div`,{className:`text-muted-foreground`,children:Q(C.user_message||j)})]}):w?(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:Q(C.user_message||`Lattice will try the compatible local runtime path before showing this model as unsupported.`)})]}):!o&&!O?(0,L.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:j}):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:[M,` · `,s,r.load_strategy||u.load_strategy?` · ${String(r.load_strategy||u.load_strategy)}`:``,d.notes?` · ${String(d.notes).slice(0,60)}`:``]}),b||x?(0,L.jsx)(`div`,{children:[x?`License: ${String(x)}`:``,b?String(b):``].filter(Boolean).join(` · `)}):null]}),T||w?(0,L.jsx)(V,{compatibility:C}):null]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 md:justify-end`,children:[(0,L.jsx)(m,{variant:o?`success`:O?`muted`:`warning`,children:o?`loaded`:P}),o?(0,L.jsx)(f,{label:`Unload`,action:()=>g.unloadModel(s),invalidate:[`models`]}):(0,L.jsx)(E,{variant:`outline`,disabled:R||T||!F||D&&!c,onClick:()=>$(s,l||`local_mlx`,c),children:_===s&&R?S(n,`library.btn.preparing`):D?S(n,`library.btn.installLoad`):S(n,`library.btn.validateLoad`)})]})]},a)}),t===`basic`&&B.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`?S(n,`library.models.embedding.basic`):`Embedding provider`,result:s.data,children:e=>t===`basic`?(0,L.jsx)(r,{value:e.state||`ready`}):(0,L.jsx)(p,{value:e})}),(0,L.jsx)(l,{title:t===`basic`?S(n,`library.models.validation`):`Model validation`,result:i.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({language:e=`en`,mode:t=`advanced`,profile:n,recommendation:r,current:i,currentId:a,latestProgress:o,lastResult:c,onReload:l,onUnload:u}){let d=String(i?.name||i?.id||a||``),f=String(i?.engine||i?.recommended_engine||o?.engine||`local_mlx`),p=String(i?.local_path||i?.storage_location||r.cache_path||r.storage_location||`~/.cache/huggingface / ~/.latticeai/models`),m=String(o?.stage||c?.stage||(d?`ready`:`idle`)),h=t===`basic`;return(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(s,{stats:h?[{label:S(e,`library.runtime.computer`),value:n?.os?`${String(n.os)} ${String(n.arch||``)}`:`detected`},{label:S(e,`library.runtime.loaded`),value:d||S(e,`library.runtime.noneShort`)}]:[{label:`Computer`,value:n?.os?`${String(n.os)} ${String(n.arch||``)}`:`detected`},{label:`Engine`,value:f},{label:`Loaded model`,value:d||`No local model loaded`},{label:`Runtime state`,value:m}]}),(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:d?S(e,`library.models.runtime.available`):S(e,`library.models.runtime.none`)}),h?null:(0,L.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`Cache/storage: `,p]})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsx)(E,{variant:`outline`,size:`sm`,disabled:!d,onClick:l,children:S(e,`library.runtime.reload`)}),(0,L.jsx)(E,{variant:`outline`,size:`sm`,disabled:!d,onClick:u,children:S(e,`library.runtime.unload`)})]})]}),o?(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(o.message||`Preparing model`)}),(0,L.jsxs)(`span`,{children:[Number(o.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(o.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-sQU3it5I.js";import{A as h,F as g,L as _,M as v,N as y,O 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-C4R3ws30.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=_(g()),L=y(),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}){T(e=>e.mode);let t=T(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=v(),t=T(e=>e.mode),n=T(e=>e.language),i=w({queryKey:[`models`],queryFn:b.models}),a=w({queryKey:[`modelRecommendations`,`local_mlx`],queryFn:()=>b.modelRecommendations(`local_mlx`)}),s=w({queryKey:[`embeddings`],queryFn:b.embeddingsStatus}),[c,u]=I.useState(!1),[h,g]=I.useState(null),[_,y]=I.useState([]),[O,A]=I.useState(null),[j,P]=I.useState(null),[R,z]=I.useState(!1),B=[...k(i.data?.data?.catalog),...k(i.data?.data?.recommended)],G=k(a.data?.data?.recommendations?.models),K=new Map(G.map(e=>[String(e.id),e])),q=k(i.data?.data?.loaded),J=String(i.data?.data?.current||``),Y=B.find(e=>q.includes(String(e.id))||String(e.id)===J),X=a.data?.data?.recommendations?.top_pick||null,Z=_[_.length-1]||null,Q=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 $(t,n,r){z(!0),g(t),y([]),A(null),P(null);let i=await b.streamModelPrepare({model:t,engine:n||`local_mlx`,allow_download:r},{onProgress:e=>y(t=>[...t.slice(-8),e]),onDone:e=>A(e),onError:e=>P(e)});z(!1),await e.invalidateQueries({queryKey:[`models`]}),await e.invalidateQueries({queryKey:[`modelRecommendations`,`local_mlx`]}),!i.ok&&!j&&P(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:S(n,`library.models.setup.title`),description:S(n,`library.models.setup.desc`),result:a.data,children:r=>{let i=r.recommendations,a=r.profile;return(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsx)(H,{language:n,mode:t,profile:a||{},recommendation:i||{},current:Y,currentId:J,latestProgress:Z,lastResult:O,onReload:()=>{Y&&$(String(Y.recommended_load_id||Y.id||J),String(Y.recommended_engine||Y.engine||`local_mlx`),c)},onUnload:()=>{J&&b.unloadModel(J).then(()=>e.invalidateQueries({queryKey:[`models`]}))}}),(0,L.jsx)(`div`,{className:`grid gap-2 md:grid-cols-3 xl:grid-cols-6`,children:[[S(n,`library.step.environment`),!0,C],[S(n,`library.step.recommend`),!!(X||B.length),x],[S(n,`library.step.install`),!!(Y||Z?.stage===`engine`),N],[S(n,`library.step.download`),!!(Y||Z?.stage===`download`),D],[S(n,`library.step.validate`),!!(Y||Z?.stage===`smoke_test`),F],[S(n,`library.step.ready`),!!(Y||O),M]].map(([e,t,r])=>(0,L.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/55 p-3`,children:[I.createElement(r,{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?S(n,`library.step.done`):S(n,`library.step.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:c,onChange:e=>u(e.target.checked)}),(0,L.jsx)(`span`,{children:S(n,`library.consent`)})]}),Z?(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(Z.message||S(n,`library.preparing`))}),(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(Z.percent||8)}%`}})}),Z.detail?(0,L.jsx)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:String(Z.detail)}):null]}):null,j?(0,L.jsx)(U,{error:j}):null]})}}),(0,L.jsx)(l,{title:t===`basic`?S(n,`library.panel.recommended.basic`):S(n,`library.panel.recommended.other`),result:i.data,children:e=>(0,L.jsxs)(`div`,{className:`grid gap-2`,children:[(B.length?B:k(e.loaded)).slice(0,t===`basic`?3:14).map((r,i)=>{let a=String(r.id||r.model_id||r.name||i),o=k(e.loaded).includes(a)||e.current===a||r.state===`loaded`,s=String(r.recommended_load_id||a),l=String(r.recommended_engine||r.engine||``),u=K.get(a)||K.get(s)||{},d=W(r.verification),p=W(u.verification),g=W(r.hardware),_=W(u.hardware),v=g.notes||_.notes||(g.recommended_ram_gb?`~${g.recommended_ram_gb}GB RAM rec`:``),y=r.safety_notes||u.safety_notes,x=r.license||u.license,C=r.runtime_compatibility||u.runtime_compatibility||{},w=String(C.status||``)===`fallback_available`,T=r.load_status===`unsupported`||C.supported===!1,D=!!r.download_required,O=(!!r.load_available||o)&&!T,A=String(r.load_status||(o?`loaded`:`unavailable`)),j=Q(r.unavailable_reason||`This model is not ready to load yet.`),M=String(r.runtime_label||C.preferred_runtime||l||`local_mlx`),N=String(C.action||A.replace(/_/g,` `)),P=T&&t===`basic`?`needs attention`:T?N:A,F=O||D,I=r.download_size||r.estimated_size||u.download_size||u.estimated_size||r.size||u.size,z=r.provider||u.provider||r.organization||u.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(r.name||a)}),X?.id===a||r.recommended_default?(0,L.jsx)(m,{variant:`success`,children:`recommended`}):null,String(r.modality||u.modality||``).includes(`multi`)||String(r.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`?[Q(r.family||u.family||`Local model`),/mlx|gguf|ollama/i.test(String(r.size||u.size||``))?``:r.size||u.size].filter(Boolean).map(String).join(` · `):[r.family||u.family||`local`,r.size||u.size].filter(Boolean).map(String).join(` · `)}),r.hardware||u.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:D?`Download: ${String(I||`required`)}`:`No download needed now`}),(0,L.jsx)(m,{variant:`muted`,children:D?`Internet only during download`:`Runs locally when loaded`}),z?(0,L.jsx)(m,{variant:`muted`,children:String(z)}):null]}),T?(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`:N}),(0,L.jsx)(`div`,{className:`text-muted-foreground`,children:Q(C.user_message||j)})]}):w?(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:Q(C.user_message||`Lattice will try the compatible local runtime path before showing this model as unsupported.`)})]}):!o&&!O?(0,L.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:j}):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:[M,` · `,s,r.load_strategy||u.load_strategy?` · ${String(r.load_strategy||u.load_strategy)}`:``,d.notes?` · ${String(d.notes).slice(0,60)}`:``]}),y||x?(0,L.jsx)(`div`,{children:[x?`License: ${String(x)}`:``,y?String(y):``].filter(Boolean).join(` · `)}):null]}),T||w?(0,L.jsx)(V,{compatibility:C}):null]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 md:justify-end`,children:[(0,L.jsx)(m,{variant:o?`success`:O?`muted`:`warning`,children:o?`loaded`:P}),o?(0,L.jsx)(f,{label:`Unload`,action:()=>b.unloadModel(s),invalidate:[`models`]}):(0,L.jsx)(E,{variant:`outline`,disabled:R||T||!F||D&&!c,onClick:()=>$(s,l||`local_mlx`,c),children:h===s&&R?S(n,`library.btn.preparing`):D?S(n,`library.btn.installLoad`):S(n,`library.btn.validateLoad`)})]})]},a)}),t===`basic`&&B.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`?S(n,`library.models.embedding.basic`):`Embedding provider`,result:s.data,children:e=>t===`basic`?(0,L.jsx)(r,{value:e.state||`ready`}):(0,L.jsx)(p,{value:e})}),(0,L.jsx)(l,{title:t===`basic`?S(n,`library.models.validation`):`Model validation`,result:i.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=T(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({language:e=`en`,mode:t=`advanced`,profile:n,recommendation:r,current:i,currentId:a,latestProgress:o,lastResult:c,onReload:l,onUnload:u}){let d=String(i?.name||i?.id||a||``),f=String(i?.engine||i?.recommended_engine||o?.engine||`local_mlx`),p=String(i?.local_path||i?.storage_location||r.cache_path||r.storage_location||`~/.cache/huggingface / ~/.latticeai/models`),m=String(o?.stage||c?.stage||(d?`ready`:`idle`)),h=t===`basic`;return(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(s,{stats:h?[{label:S(e,`library.runtime.computer`),value:n?.os?`${String(n.os)} ${String(n.arch||``)}`:`detected`},{label:S(e,`library.runtime.loaded`),value:d||S(e,`library.runtime.noneShort`)}]:[{label:`Computer`,value:n?.os?`${String(n.os)} ${String(n.arch||``)}`:`detected`},{label:`Engine`,value:f},{label:`Loaded model`,value:d||`No local model loaded`},{label:`Runtime state`,value:m}]}),(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:d?S(e,`library.models.runtime.available`):S(e,`library.models.runtime.none`)}),h?null:(0,L.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`Cache/storage: `,p]})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsx)(E,{variant:`outline`,size:`sm`,disabled:!d,onClick:l,children:S(e,`library.runtime.reload`)}),(0,L.jsx)(E,{variant:`outline`,size:`sm`,disabled:!d,onClick:u,children:S(e,`library.runtime.unload`)})]})]}),o?(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(o.message||`Preparing model`)}),(0,L.jsxs)(`span`,{children:[Number(o.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(o.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=v(),t=w({queryKey:[`skills`],queryFn:b.skills}),n=w({queryKey:[`skillsMarketplace`],queryFn:b.skillsMarketplace}),r=h({mutationFn:e=>b.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:()=>b.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=T(e=>e.mode),[r,s]=I.useState(`github`),d=w({queryKey:[`mcpTools`],queryFn:b.mcpTools}),f=h({mutationFn:()=>b.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=w({queryKey:[`templates`],queryFn:b.templates}),n=w({queryKey:[`plugins`],queryFn:b.pluginsRegistry}),r=w({queryKey:[`pluginsDirectory`],queryFn:b.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:()=>b.installTemplate(e)},String(e.id||e.name)))}):(0,L.jsx)(o,{items:[]})})]})]})}export{z as LibraryPage};
|
|
@@ -0,0 +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-sQU3it5I.js";import{A as g,E as _,F as v,L as y,M as b,N as x,O as S,b as C,g as w,i as T,j as E,k as D,n as O,o as k,t as A,w as j,x as M,y as N}from"./index-C4R3ws30.js";var ee=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`}]]),P=y(v()),F=x(),I=[{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 L({initialTab:e}){let t=D(e=>e.mode),n=D(e=>e.language),[i,a]=P.useState(e||`account`);return P.useEffect(()=>{I.some(t=>t.id===e)&&a(e)},[e]),(0,F.jsxs)(`div`,{className:`space-y-5`,children:[(0,F.jsxs)(`header`,{className:`page-hero`,children:[(0,F.jsxs)(`div`,{className:`page-kicker`,children:[(0,F.jsx)(k,{className:`h-4 w-4`}),` `,C(n,`system.kicker`)]}),(0,F.jsx)(`h1`,{className:`page-title`,children:C(n,`system.title`)}),(0,F.jsx)(`p`,{className:`page-copy`,children:C(n,`system.body`)})]}),(0,F.jsx)(r,{tabs:(t===`basic`?I.filter(e=>e.id!==`admin`):I).map(e=>({id:e.id,label:C(n,e.labelKey)})),value:i,onChange:e=>a(e)}),i===`account`?(0,F.jsx)(R,{}):null,i===`workspaces`?(0,F.jsx)(te,{}):null,i===`snapshots`?(0,F.jsx)(z,{}):null,i===`activity`?(0,F.jsx)(B,{}):null,i===`network`?(0,F.jsx)(V,{}):null,i===`settings`?(0,F.jsx)(H,{}):null,i===`admin`?(0,F.jsx)(Y,{}):null]})}function R(){let r=b(),o=E({queryKey:[`profile`],queryFn:S.profile}),s=E({queryKey:[`sso`],queryFn:S.ssoConfig}),[d,f]=P.useState(``),[h,_]=P.useState(``),[v,y]=P.useState(``),[x,C]=P.useState(``),[T,D]=P.useState(``),k=g({mutationFn:()=>S.login(d,h),onSuccess:()=>r.invalidateQueries({queryKey:[`profile`]})}),j=g({mutationFn:()=>S.register({email:d,password:h,name:v,nickname:x}),onSuccess:()=>r.invalidateQueries({queryKey:[`profile`]})}),M=g({mutationFn:()=>S.updateProfile({name:v,nickname:x}),onSuccess:()=>r.invalidateQueries({queryKey:[`profile`]})}),N=g({mutationFn:()=>S.changePassword(h,T)});return(0,F.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,F.jsx)(l,{title:`Profile`,result:o.data,children:e=>(0,F.jsx)(t,{data:e})}),(0,F.jsxs)(u,{children:[(0,F.jsxs)(i,{children:[(0,F.jsxs)(e,{className:`flex items-center gap-2`,children:[(0,F.jsx)(w,{className:`h-4 w-4`}),` Account`]}),(0,F.jsx)(a,{children:`Sign in, create a local account, and keep your profile current.`})]}),(0,F.jsxs)(c,{className:`grid gap-3`,children:[(0,F.jsx)(A,{value:d,onChange:e=>f(e.target.value),placeholder:`email`}),(0,F.jsx)(A,{type:`password`,value:h,onChange:e=>_(e.target.value),placeholder:`current password`}),(0,F.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,F.jsx)(A,{value:v,onChange:e=>y(e.target.value),placeholder:`name`}),(0,F.jsx)(A,{value:x,onChange:e=>C(e.target.value),placeholder:`nickname`})]}),(0,F.jsx)(A,{type:`password`,value:T,onChange:e=>D(e.target.value),placeholder:`new password`}),(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,F.jsx)(O,{onClick:()=>k.mutate(),disabled:!d||!h||k.isPending,children:`Login`}),(0,F.jsx)(O,{variant:`outline`,onClick:()=>j.mutate(),disabled:!d||!h||j.isPending,children:`Register`}),(0,F.jsx)(O,{variant:`outline`,onClick:()=>M.mutate(),disabled:M.isPending,children:`Save profile`}),(0,F.jsx)(O,{variant:`outline`,onClick:()=>N.mutate(),disabled:!h||!T||N.isPending,children:`Change password`}),(0,F.jsx)(p,{label:`Logout`,action:()=>S.logout(),invalidate:[`profile`]})]}),[k.data,j.data,M.data,N.data].filter(Boolean).map((e,t)=>(0,F.jsx)(n,{result:e,successLabel:`Account request completed`},t))]})]}),(0,F.jsx)(l,{title:`Sign-in options`,result:s.data,className:`xl:col-span-2`,children:e=>(0,F.jsx)(m,{value:e})})]})}function te(){let t=b(),{setWorkspaceId:n}=D(),r=E({queryKey:[`workspaceRegistry`],queryFn:S.workspaceRegistry}),s=E({queryKey:[`invitations`],queryFn:S.invitations}),[d,f]=P.useState(``),[m,h]=P.useState(``),[_,v]=P.useState(``),y=g({mutationFn:()=>S.createOrg(d),onSuccess:()=>t.invalidateQueries({queryKey:[`workspaceRegistry`]})}),x=g({mutationFn:()=>S.createInvitation({email:m||null,role:`member`,expires_hours:168}),onSuccess:()=>t.invalidateQueries({queryKey:[`invitations`]})}),C=g({mutationFn:()=>S.acceptInvitation(_),onSuccess:()=>t.invalidateQueries({queryKey:[`workspaceRegistry`]})}),w=M(r.data?.data?.workspaces);return(0,F.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[1.1fr_0.9fr]`,children:[(0,F.jsx)(l,{title:`Your workspaces`,result:r.data,children:()=>(0,F.jsx)(`div`,{className:`grid gap-2`,children:w.map(e=>{let t=String(e.workspace_id||e.id);return(0,F.jsx)(`div`,{className:`rounded-md border border-border p-3`,children:(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`font-medium`,children:String(e.name||t)}),(0,F.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[String(e.type||``),` · `,String(e.your_role||e.role||``)]})]}),(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,F.jsx)(O,{variant:`outline`,onClick:()=>n(t),children:`Use`}),(0,F.jsx)(p,{label:`Activate`,action:()=>S.activateWorkspace(t),invalidate:[`workspaceRegistry`]}),(0,F.jsx)(p,{label:`Archive`,action:()=>S.archiveWorkspace(t),invalidate:[`workspaceRegistry`],variant:`destructive`})]})]})},t)})})}),(0,F.jsxs)(u,{children:[(0,F.jsxs)(i,{children:[(0,F.jsxs)(e,{className:`flex items-center gap-2`,children:[(0,F.jsx)(T,{className:`h-4 w-4`}),` Organizations and invitations`]}),(0,F.jsx)(a,{children:`Create or join a workspace before adding knowledge.`})]}),(0,F.jsxs)(c,{className:`grid gap-3`,children:[(0,F.jsx)(A,{value:d,onChange:e=>f(e.target.value),placeholder:`New organization name`}),(0,F.jsx)(O,{disabled:!d.trim()||y.isPending,onClick:()=>y.mutate(),children:`Create organization`}),(0,F.jsx)(A,{value:m,onChange:e=>h(e.target.value),placeholder:`invitee email`}),(0,F.jsx)(O,{variant:`outline`,disabled:x.isPending,onClick:()=>x.mutate(),children:`Create invitation`}),(0,F.jsx)(A,{value:_,onChange:e=>v(e.target.value),placeholder:`invitation token`}),(0,F.jsx)(O,{variant:`outline`,disabled:!_.trim()||C.isPending,onClick:()=>C.mutate(),children:`Accept invitation`}),(0,F.jsx)(l,{title:`Invitations`,result:s.data,children:e=>(0,F.jsx)(o,{items:e.invitations,titleKey:`token`,metaKey:`role`})})]})]})]})}function z(){let t=E({queryKey:[`snapshots`],queryFn:S.snapshots}),r=E({queryKey:[`timeMachine`],queryFn:S.timeMachine}),[s,d]=P.useState(``),[f,m]=P.useState(``),[h,_]=P.useState(``),v=g({mutationFn:()=>S.createSnapshot(s||`desktop checkpoint`)}),y=g({mutationFn:()=>S.compareSnapshots(f,h)}),b=M(t.data?.data?.snapshots);return(0,F.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,F.jsx)(l,{title:`Snapshots`,result:t.data,children:()=>(0,F.jsx)(`div`,{className:`space-y-2`,children:b.map(e=>{let t=String(e.id||e.snapshot_id);return(0,F.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,F.jsx)(`div`,{className:`font-medium`,children:String(e.name||t)}),(0,F.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,F.jsx)(p,{label:`Export`,action:()=>S.exportSnapshot(t)}),(0,F.jsx)(p,{label:`Merge restore`,action:()=>S.restoreSnapshot(t),variant:`outline`})]})]},t)})})}),(0,F.jsxs)(u,{children:[(0,F.jsxs)(i,{children:[(0,F.jsx)(e,{children:`Snapshot actions`}),(0,F.jsx)(a,{children:`Create checkpoints and compare changes over time.`})]}),(0,F.jsxs)(c,{className:`grid gap-3`,children:[(0,F.jsx)(A,{value:s,onChange:e=>d(e.target.value),placeholder:`snapshot name`}),(0,F.jsx)(O,{onClick:()=>v.mutate(),disabled:v.isPending,children:`Create snapshot`}),(0,F.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,F.jsx)(A,{value:f,onChange:e=>m(e.target.value),placeholder:`before id`}),(0,F.jsx)(A,{value:h,onChange:e=>_(e.target.value),placeholder:`after id`})]}),(0,F.jsx)(O,{variant:`outline`,onClick:()=>y.mutate(),disabled:!f||!h||y.isPending,children:`Compare`}),y.data?(0,F.jsx)(n,{result:y.data,successLabel:`Snapshot comparison completed`}):null]})]}),(0,F.jsx)(l,{title:`Time machine`,result:r.data,className:`xl:col-span-2`,children:e=>(0,F.jsx)(o,{items:e.events||e,titleKey:`event`,metaKey:`type`,limit:14})})]})}function B(){let e=E({queryKey:[`realtimeFeed`],queryFn:S.realtimeFeed}),t=E({queryKey:[`presence`],queryFn:S.presence});return(0,F.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,F.jsx)(l,{title:`Realtime feed`,result:e.data,children:e=>(0,F.jsx)(o,{items:e.events,titleKey:`event_type`,metaKey:`area`,limit:14})}),(0,F.jsx)(l,{title:`Presence`,result:t.data,children:e=>(0,F.jsx)(W,{data:e})})]})}function V(){let t=b(),r=E({queryKey:[`networkIdentity`],queryFn:S.networkIdentity}),o=E({queryKey:[`networkPeers`],queryFn:S.networkPeers}),[s,d]=P.useState(``),[f,m]=P.useState(``),[h,_]=P.useState(``),v=g({mutationFn:()=>S.pairPeer({name:s,base_url:f,public_key:h}),onSuccess:()=>t.invalidateQueries({queryKey:[`networkPeers`]})});return(0,F.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[0.8fr_1.2fr]`,children:[(0,F.jsx)(l,{title:`Device identity`,result:r.data,children:e=>(0,F.jsx)(G,{data:e})}),(0,F.jsxs)(u,{children:[(0,F.jsxs)(i,{children:[(0,F.jsxs)(e,{className:`flex items-center gap-2`,children:[(0,F.jsx)(ee,{className:`h-4 w-4`}),` Pair device`]}),(0,F.jsx)(a,{children:`Pair a trusted device for workspace exchange.`})]}),(0,F.jsxs)(c,{className:`grid gap-3`,children:[(0,F.jsx)(A,{value:s,onChange:e=>d(e.target.value),placeholder:`device name`}),(0,F.jsx)(A,{value:f,onChange:e=>m(e.target.value),placeholder:`trusted device address`}),(0,F.jsx)(A,{value:h,onChange:e=>_(e.target.value),placeholder:`trusted public key`}),(0,F.jsx)(O,{disabled:!s||!f||!h||v.isPending,onClick:()=>v.mutate(),children:`Pair device`}),v.data?(0,F.jsx)(n,{result:v.data,successLabel:`Peer pairing request completed`}):null]})]}),(0,F.jsx)(l,{title:`Peers`,result:o.data,className:`xl:col-span-2`,children:e=>(0,F.jsx)(`div`,{className:`grid gap-2`,children:M(e.peers).map(e=>{let t=String(e.peer_id||e.id);return(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`font-medium`,children:String(e.name||t)}),(0,F.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:String(e.base_url||``)})]}),(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,F.jsx)(p,{label:`Push workspace`,action:()=>S.pushPeer(t,D.getState().workspaceId)}),(0,F.jsx)(p,{label:`Unpair`,action:()=>S.unpairPeer(t),invalidate:[`networkPeers`],variant:`destructive`})]})]},t)})})})]})}function H(){let t=b(),{theme:r,setTheme:o,mode:d,setMode:f}=D(),h=D(e=>e.language),_=E({queryKey:[`health`],queryFn:S.health}),v=E({queryKey:[`sysinfo`],queryFn:S.sysinfo}),y=E({queryKey:[`computerMemory`],queryFn:S.computerMemory}),x=E({queryKey:[`brainStorage`],queryFn:S.brainStorage}),w=E({queryKey:[`backupHealth`],queryFn:S.backupHealth}),[T,k]=P.useState(``),[j,M]=P.useState(`lattice_brain`),[N,ee]=P.useState(!1),[I,L]=P.useState(``),[R,te]=P.useState(``),[z,B]=P.useState(``),[V,H]=P.useState(!1),[U,W]=P.useState(!1),G=g({mutationFn:e=>S.dockerPostgres({consent:e,dry_run:!e,port:5432})}),K=g({mutationFn:()=>S.migratePostgres({dsn:T,schema_name:j||`lattice_brain`,dry_run:!0})}),q=g({mutationFn:()=>S.brainArchive({path:I.trim()||null,passphrase:z}),onSuccess:()=>t.invalidateQueries({queryKey:[`backupHealth`]})}),J=g({mutationFn:()=>S.brainArchiveInspect({path:R,passphrase:z||null})}),Y=g({mutationFn:()=>S.brainArchiveVerify({path:R,passphrase:z})}),X=g({mutationFn:()=>S.brainArchiveRestore({path:R,passphrase:z,dry_run:!0,confirm:!1})}),Z=g({mutationFn:()=>S.brainArchiveRestore({path:R,passphrase:z,dry_run:!1,confirm:V}),onSuccess:()=>{t.invalidateQueries({queryKey:[`brainStorage`]}),t.invalidateQueries({queryKey:[`backupHealth`]})}}),Q=g({mutationFn:()=>S.brainArchiveImport({path:R,passphrase:z,dry_run:!0,confirm:!1})}),$=g({mutationFn:()=>S.brainArchiveImport({path:R,passphrase:z,dry_run:!1,confirm:U}),onSuccess:()=>{t.invalidateQueries({queryKey:[`brainStorage`]}),t.invalidateQueries({queryKey:[`backupHealth`]})}});return(0,F.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-3`,children:[(0,F.jsxs)(u,{children:[(0,F.jsxs)(i,{children:[(0,F.jsx)(e,{children:C(h,`system.panel.appearance`)}),(0,F.jsx)(a,{children:C(h,`system.panel.appearance.hint`)})]}),(0,F.jsxs)(c,{className:`flex flex-wrap gap-2`,children:[(0,F.jsx)(O,{variant:r===`dark`?`default`:`outline`,onClick:()=>o(`dark`),children:C(h,`system.theme.dark`)}),(0,F.jsx)(O,{variant:r===`light`?`default`:`outline`,onClick:()=>o(`light`),children:C(h,`system.theme.light`)}),[`basic`,`advanced`,`admin`].map(e=>(0,F.jsx)(O,{variant:d===e?`default`:`outline`,onClick:()=>f(e),children:C(h,`shell.mode.${e}`)},e))]})]}),(0,F.jsx)(l,{title:d===`basic`?C(h,`system.panel.brainStatus`):`Server health`,result:_.data,children:e=>(0,F.jsx)(ne,{data:e})}),(0,F.jsx)(l,{title:d===`basic`?C(h,`system.panel.readiness`):`Host telemetry`,result:v.data,children:e=>d===`basic`?(0,F.jsx)(s,{stats:[{label:C(h,`system.stat.cpu`),value:`${String(e.cpu_pct||`0`)}%`},{label:C(h,`system.stat.memory`),value:`${String(e.ram_pct||`0`)}%`},{label:C(h,`system.stat.gpu`),value:`${String(e.gpu_mem_pct||`0`)}%`},{label:C(h,`system.stat.localStatus`),value:C(h,`system.stat.ready`)}]}):(0,F.jsx)(m,{value:e})}),(0,F.jsx)(l,{title:d===`basic`?C(h,`system.storage.title`):`Brain storage`,result:x.data,className:`xl:col-span-3`,children:e=>(0,F.jsx)(re,{data:e,mode:d,language:h})}),d===`basic`?null:(0,F.jsx)(l,{title:`Backup health`,result:w.data,className:`xl:col-span-3`,children:e=>(0,F.jsx)(ie,{data:e})}),d===`basic`?null:(0,F.jsxs)(u,{className:`xl:col-span-3`,children:[(0,F.jsxs)(i,{children:[(0,F.jsx)(e,{children:`.latticebrain portability`}),(0,F.jsx)(a,{children:`Create an encrypted portable brain file, verify one, or preview a restore before applying it.`})]}),(0,F.jsxs)(c,{className:`grid gap-3`,children:[(0,F.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[1fr_1fr]`,children:[(0,F.jsx)(A,{value:I,onChange:e=>L(e.target.value),placeholder:`export path (optional)`}),(0,F.jsx)(A,{value:R,onChange:e=>te(e.target.value),placeholder:`archive path for inspect/restore`})]}),(0,F.jsx)(A,{type:`password`,value:z,onChange:e=>B(e.target.value),placeholder:`archive passphrase`}),(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,F.jsx)(O,{onClick:()=>q.mutate(),disabled:!z||q.isPending,children:`Export archive`}),(0,F.jsx)(O,{variant:`outline`,onClick:()=>J.mutate(),disabled:!R||J.isPending,children:`Inspect`}),(0,F.jsx)(O,{variant:`outline`,onClick:()=>Y.mutate(),disabled:!R||!z||Y.isPending,children:`Verify`}),(0,F.jsx)(O,{variant:`outline`,onClick:()=>X.mutate(),disabled:!R||!z||X.isPending,children:`Restore dry run`}),(0,F.jsx)(O,{variant:`outline`,onClick:()=>Q.mutate(),disabled:!R||!z||Q.isPending,children:`Import dry run`}),(0,F.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:V,onChange:e=>H(e.target.checked)}),`Confirm restore`]}),(0,F.jsx)(O,{variant:`destructive`,onClick:()=>Z.mutate(),disabled:!R||!z||!V||Z.isPending,children:`Restore`}),(0,F.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:U,onChange:e=>W(e.target.checked)}),`Confirm import`]}),(0,F.jsx)(O,{variant:`outline`,onClick:()=>$.mutate(),disabled:!R||!z||!U||$.isPending,children:`Import`})]}),[q.data,J.data,Y.data,X.data,Z.data,Q.data,$.data].filter(Boolean).map((e,t)=>(0,F.jsx)(n,{result:e,successLabel:`Archive request completed`},t))]})]}),d===`basic`?null:(0,F.jsxs)(u,{className:`xl:col-span-3`,children:[(0,F.jsxs)(i,{children:[(0,F.jsx)(e,{children:`Scale mode`}),(0,F.jsx)(a,{children:`Optional advanced storage. Local SQLite remains the default.`})]}),(0,F.jsxs)(c,{className:`grid gap-3`,children:[(0,F.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[1fr_220px]`,children:[(0,F.jsx)(A,{value:T,onChange:e=>k(e.target.value),placeholder:`Postgres connection string`}),(0,F.jsx)(A,{value:j,onChange:e=>M(e.target.value),placeholder:`database schema`})]}),(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,F.jsx)(O,{variant:`outline`,onClick:()=>G.mutate(!1),disabled:G.isPending,children:`Docker plan`}),(0,F.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:N,onChange:e=>ee(e.target.checked)}),`Consent to start Docker`]}),(0,F.jsx)(O,{onClick:()=>G.mutate(!0),disabled:!N||G.isPending,children:`Start Docker`}),(0,F.jsx)(O,{variant:`outline`,onClick:()=>K.mutate(),disabled:!T||K.isPending,children:`Plan migration`})]}),G.data?(0,F.jsx)(n,{result:G.data,successLabel:`Docker setup request completed`}):null,K.data?(0,F.jsx)(n,{result:K.data,successLabel:`Migration plan completed`}):null]})]}),d===`basic`?null:(0,F.jsx)(l,{title:`Computer memory`,result:y.data,className:`xl:col-span-3`,children:e=>(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.jsx)(m,{value:e}),(0,F.jsxs)(`div`,{className:`flex gap-2`,children:[(0,F.jsx)(p,{label:`Enable memory`,action:()=>S.setComputerMemory(!0),invalidate:[`computerMemory`]}),(0,F.jsx)(p,{label:`Disable memory`,action:()=>S.setComputerMemory(!1),invalidate:[`computerMemory`],variant:`destructive`})]})]})})]})}function U(e,t=`not reported`){return e==null||e===``?t:typeof e==`boolean`?e?`enabled`:`disabled`:String(e)}function W({data:e}){let t=M(e.presence||e.clients||e);return t.length?(0,F.jsx)(o,{items:t,titleKey:`user`,metaKey:`workspace_id`}):(0,F.jsx)(d,{title:`No active presence`,detail:`No live collaborators or realtime clients are currently reported.`})}function G({data:e}){let n=D(e=>e.mode),r=U(e.public_key,``);return n===`basic`?(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.jsx)(K,{title:`This Mac`,status:`trusted`,detail:`This device can participate in local workspace exchange when you pair another trusted device.`}),(0,F.jsx)(h,{variant:`muted`,children:U(e.algorithm,`local identity`)})]}):(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,F.jsx)(h,{variant:`success`,children:`local device`}),(0,F.jsx)(h,{variant:`muted`,children:U(e.algorithm,`identity key`)})]}),(0,F.jsx)(t,{data:{device_id:e.device_id||e.id||`not reported`,fingerprint:e.fingerprint||`not reported`,public_key:r?_(r.replace(/\s+/g,` `),72):`not reported`}})]})}function ne({data:e}){let t=D(e=>e.mode),n=D(e=>e.language);return t===`basic`?(0,F.jsx)(K,{title:C(n,`system.health.title`),status:C(n,`system.health.ok`),detail:C(n,`system.health.detail`)}):(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.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`},{label:`Port`,value:e.port||e.backend_port||`configured`}]}),(0,F.jsx)(m,{value:e})]})}function re({data:e,mode:t=`advanced`,language:n=`en`}){let r=j(e.active)?e.active:e,i=j(e.postgres)?e.postgres:{},a=j(e.backup_health)?e.backup_health:{},o=r.vector_search||r.vector||e.vector_search||e.sqlite_vec,c=!!(i.available||i.connected||i.enabled),l=!!o&&String(o).toLowerCase()!==`not reported`;return t===`basic`?(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.jsx)(K,{title:C(n,`system.storage.local.title`),status:C(n,`system.storage.local.badge`),detail:C(n,`system.storage.local.detail`)}),(0,F.jsx)(K,{title:C(n,`system.storage.search.title`),status:l?C(n,`system.storage.search.on`):C(n,`system.storage.search.pending`),detail:l?C(n,`system.storage.search.detailOn`):C(n,`system.storage.search.detailPending`)})]}):(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsx)(s,{stats:[{label:`Active engine`,value:r.engine||e.engine||`sqlite`},{label:`SQLite default`,value:r.engine===`postgres`?`scale mode`:`enabled`},{label:`Vector search`,value:o||`not reported`},{label:`Postgres`,value:c?`available`:`optional`}]}),(0,F.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-3`,children:[(0,F.jsx)(K,{title:`SQLite`,status:r.available===!1?`unavailable`:`default`,detail:U(r.reason||r.path||e.path,`Local brain storage is active by default.`)}),(0,F.jsx)(K,{title:`Vector search`,status:U(o,`reported`),detail:U(r.vector_reason||r.sqlite_vec_reason||e.vector_reason,`Uses the configured local vector capability or reports why it is unavailable.`)}),(0,F.jsx)(K,{title:`Postgres`,status:c?`available`:`not enabled`,detail:U(i.reason||i.dsn||i.status,`Postgres scale mode is opt-in and never required for local use.`)})]}),Object.keys(a).length?(0,F.jsx)(m,{value:{backup_health:a}}):null]})}function ie({data:e}){return(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.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,F.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 K({title:e,status:t,detail:n}){let r=/unavailable|failed|denied|disabled|not enabled/i.test(t)?`warning`:`success`;return(0,F.jsxs)(`div`,{className:`rounded-md border border-border bg-background p-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,F.jsx)(`div`,{className:`font-medium`,children:e}),(0,F.jsx)(h,{variant:r,children:t})]}),(0,F.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:n})]})}function q({data:e}){let t=j(e.startup)?e.startup:{},n=j(e.privacy)?e.privacy:{},r=j(e.storage)?e.storage:{},i=j(e.backup)?e.backup:{},a=j(e.device_identity)?e.device_identity:{},o=j(e.permissions)?e.permissions:{};return(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.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:j(r.active)?r.active.engine:`reported`},{label:`Backups`,value:i.count||i.available||`reported`}]}),(0,F.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,F.jsx)(K,{title:`Startup`,status:t.network_exposed?`network exposed`:`local-only`,detail:`Lattice starts locally by default and reports when network access is enabled.`}),(0,F.jsx)(K,{title:`Integrations`,status:n.local_only_default===!1?`review required`:`opt-in`,detail:`External integrations remain disabled until the user explicitly enables them.`}),(0,F.jsx)(K,{title:`Device identity`,status:U(a.algorithm||a.fingerprint,`reported`),detail:U(a.storage,`Stored locally and used for signed bundle exchange.`)}),(0,F.jsx)(K,{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 J({data:e}){let t=j(e.cards)?e.cards:{},n=j(e.severity_counts)?e.severity_counts:{};return(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.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,F.jsx)(m,{value:{severity_counts:n,sensitive_fields:e.field_counts||{}}})]})}function Y(){let e=D(e=>e.mode),n=E({queryKey:[`adminSummary`],queryFn:S.adminSummary}),r=E({queryKey:[`adminUsers`],queryFn:S.adminUsers}),i=E({queryKey:[`adminAudit`],queryFn:()=>S.adminAudit()}),a=E({queryKey:[`adminRoles`],queryFn:S.adminRoles}),s=E({queryKey:[`adminPolicies`],queryFn:S.adminPolicies}),c=E({queryKey:[`adminProductHardening`],queryFn:S.adminProductHardening}),u=E({queryKey:[`adminSecurity`],queryFn:S.adminSecurity}),d=E({queryKey:[`vpcStatus`],queryFn:S.vpcStatus});return e===`admin`?(0,F.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,F.jsx)(l,{title:`Admin summary`,result:n.data,children:e=>(0,F.jsx)(t,{data:e})}),(0,F.jsx)(l,{title:`Users`,result:r.data,children:e=>(0,F.jsx)(o,{items:e,titleKey:`email`,metaKey:`role`})}),(0,F.jsx)(l,{title:`Audit`,result:i.data,children:e=>(0,F.jsx)(o,{items:e.recent_events||e,titleKey:`act`,metaKey:`sev`})}),(0,F.jsx)(l,{title:`Roles`,result:a.data,children:e=>(0,F.jsx)(o,{items:e.roles||e,titleKey:`role`,metaKey:`members`})}),(0,F.jsx)(l,{title:`Policies`,result:s.data,children:e=>(0,F.jsx)(o,{items:e.policies||e,titleKey:`label`,metaKey:`enforced`})}),(0,F.jsx)(l,{title:`Product hardening`,result:c.data,children:e=>(0,F.jsx)(q,{data:e})}),(0,F.jsx)(l,{title:`Security overview`,result:u.data,children:e=>(0,F.jsx)(J,{data:e})}),(0,F.jsx)(l,{title:`Private VPC`,result:d.data,className:`xl:col-span-2`,children:e=>(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsx)(h,{variant:`muted`,children:`Community-disabled features remain honest unavailable states.`}),(0,F.jsx)(m,{value:e})]})})]}):(0,F.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{L as SystemPage};
|