ltcai 12.2.0 → 12.2.1
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 +85 -84
- package/docs/CHANGELOG.md +30 -4
- package/docs/COMMUNITY_AND_PLUGINS.md +1 -1
- package/docs/DEVELOPMENT.md +11 -11
- package/docs/ONBOARDING.md +1 -1
- package/docs/OPERATIONS.md +1 -1
- package/docs/ROADMAP.md +8 -8
- package/docs/TRUST_MODEL.md +2 -2
- package/docs/WHY_LATTICE.md +1 -1
- package/docs/kg-schema.md +1 -1
- package/lattice_brain/__init__.py +1 -1
- package/latticeai/__init__.py +1 -1
- package/latticeai/core/vector_index/hnsw.py +49 -10
- package/latticeai/core/vector_index/sidecar.py +120 -31
- package/latticeai/services/architecture_readiness.py +1 -1
- package/latticeai/services/product_readiness.py +2 -2
- package/package.json +1 -1
- package/scripts/check_current_release_docs.mjs +1 -1
- package/scripts/release_screen_claims.json +11 -0
- package/src-tauri/Cargo.lock +10 -10
- package/src-tauri/Cargo.toml +1 -1
- package/src-tauri/tauri.conf.json +1 -1
- package/static/app/asset-manifest.json +44 -44
- package/static/app/assets/{Act-BjGgeuQd.js → Act-DC676bqE.js} +2 -2
- package/static/app/assets/{AdminConsole-C6hcJGMr.js → AdminConsole-aCxQgD2L.js} +1 -1
- package/static/app/assets/{Brain-CNQnIaA8.js → Brain-Dbd0xvsc.js} +2 -2
- package/static/app/assets/{BrainHome-CGJ6O69l.js → BrainHome-N00B-MAJ.js} +1 -1
- package/static/app/assets/{BrainSignals-DONPljxz.js → BrainSignals-CNA0d6xS.js} +1 -1
- package/static/app/assets/{Capture-BMCC5544.js → Capture-BB19fo7P.js} +1 -1
- package/static/app/assets/{Chronicle-DF6sOonx.js → Chronicle-D8p3dqxZ.js} +1 -1
- package/static/app/assets/{CommandPalette-DiWyutdM.js → CommandPalette-uVFYAa-6.js} +1 -1
- package/static/app/assets/{DigitalBrainExplorer-BL3V6Dqz.js → DigitalBrainExplorer-mH6ZSuvK.js} +1 -1
- package/static/app/assets/{Library-B-ue9hXL.js → Library-0q8Sdke7.js} +1 -1
- package/static/app/assets/{LivingBrain-b1RiM5Rh.js → LivingBrain-wess-qJZ.js} +1 -1
- package/static/app/assets/ProductFlow-DeBGF6qz.js +1 -0
- package/static/app/assets/{ReviewCard-D1fGTEn7.js → ReviewCard-DyTrDpy0.js} +1 -1
- package/static/app/assets/{RunsListPanel-DAirtLkS.js → RunsListPanel-CHJv2Qyw.js} +1 -1
- package/static/app/assets/{System-BEI1eoC4.js → System-CyKGHQrW.js} +1 -1
- package/static/app/assets/{WorkflowGraph-qrI6GU4R.js → WorkflowGraph-B5nKCCGa.js} +1 -1
- package/static/app/assets/{WorkflowsPanel-CIMNTw-O.js → WorkflowsPanel-C7RZNRGo.js} +2 -2
- package/static/app/assets/{actHelpers-BMukIRnQ.js → actHelpers-6MYDH2kW.js} +1 -1
- package/static/app/assets/arrow-left-DOnpwsVV.js +1 -0
- package/static/app/assets/{bot-Dkd-DbiP.js → bot-Dm3fmXAE.js} +1 -1
- package/static/app/assets/{brain-BsexlNOA.js → brain-C2XwdQL1.js} +1 -1
- package/static/app/assets/{button-BA0N_zId.js → button-xXPeemQr.js} +1 -1
- package/static/app/assets/circle-check-D44VI2ZE.js +1 -0
- package/static/app/assets/{circle-pause-918Kuvk0.js → circle-pause-B_lmNicW.js} +1 -1
- package/static/app/assets/{circle-play-CS0IbVDV.js → circle-play-DSYCP0RD.js} +1 -1
- package/static/app/assets/{cpu-BpvoWsjk.js → cpu-D7x-dtxi.js} +1 -1
- package/static/app/assets/{download-BvkMLLLN.js → download-BHuJr-5V.js} +1 -1
- package/static/app/assets/{folder-open-YmGugIBf.js → folder-open-BiO31EwS.js} +1 -1
- package/static/app/assets/{hard-drive-BOzmS-cq.js → hard-drive-CFEaZ-wP.js} +1 -1
- package/static/app/assets/{index-CfeqZ9Ri.js → index-DCT79wzR.js} +3 -3
- package/static/app/assets/{input-CFfCfMjO.js → input-D3YrgxvO.js} +1 -1
- package/static/app/assets/{link-2-CcYzeM7M.js → link-2-3O-By3qc.js} +1 -1
- package/static/app/assets/{permissionCopy-B23r24oX.js → permissionCopy-CNK2tfkz.js} +1 -1
- package/static/app/assets/{primitives-BDryQl6H.js → primitives-B6DzQC3H.js} +1 -1
- package/static/app/assets/search-BwMK0hjs.js +1 -0
- package/static/app/assets/{share-2-B-gPv2ec.js → share-2-BljIPAku.js} +1 -1
- package/static/app/assets/{shield-alert-CfyRO1p0.js → shield-alert-WDP2DSTM.js} +1 -1
- package/static/app/assets/{sourceMeta-C4LDEy1S.js → sourceMeta-By2WIjlN.js} +1 -1
- package/static/app/assets/{textarea-BdVMYEb1.js → textarea-5v8vtDlK.js} +1 -1
- package/static/app/assets/{useFocusTrap-CV73DLHn.js → useFocusTrap-ssiDeh6P.js} +1 -1
- package/static/app/assets/{useMutation-B8QKq2NW.js → useMutation-Bi0PXQMC.js} +1 -1
- package/static/app/assets/workspace-BsxrRYQI.js +1 -0
- package/static/app/index.html +1 -1
- package/static/sw.js +1 -1
- package/static/app/assets/ProductFlow-wZIKJW7G.js +0 -1
- package/static/app/assets/arrow-left-iVa1goff.js +0 -1
- package/static/app/assets/circle-check-BxaDWjPR.js +0 -1
- package/static/app/assets/search-DHsPwmPw.js +0 -1
- package/static/app/assets/workspace-BmfVs66W.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{n as r}from"./QueryClientProvider-B3OjqSyJ.js";import{t as i}from"./useMutation-B8QKq2NW.js";import{_ as a,b as o,c as s,d as c,f as l,g as u,h as d,i as f,l as p,m,n as h,p as g,r as _,t as v,u as y,v as b}from"./primitives-BDryQl6H.js";import{t as x}from"./circle-check-BxaDWjPR.js";import{t as S}from"./circle-play-CS0IbVDV.js";import{t as C}from"./cpu-BpvoWsjk.js";import{t as w}from"./download-BvkMLLLN.js";import{t as T}from"./shield-alert-CfyRO1p0.js";import{H as E,R as D,S as O,c as k,f as A,o as j,v as M,z as N}from"./index-CfeqZ9Ri.js";import{t as P}from"./button-BA0N_zId.js";import{t as F}from"./input-CFfCfMjO.js";import"./workspace-BmfVs66W.js";var I=D(`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`}]]),L=D(`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`}]]),R=D(`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`}]]),z=e(t()),B=n();function V(e,t){let n=String(e||``).toLowerCase();return n===`production`?O(t,`library.embedding.state.production`):n===`fallback`||n===`hash`||n===`local`?O(t,`library.embedding.state.fallback`):O(t,`library.embedding.state.unknown`)}function H(e,t){let n=String(e?.os||``).toLowerCase(),r=String(e?.arch||``).toLowerCase();return n?n===`darwin`&&r.startsWith(`arm`)?O(t,`library.runtime.appleSilicon`):n===`darwin`?`Mac`:n===`win32`||n.startsWith(`win`)?`Windows`:n===`linux`?`Linux`:O(t,`library.runtime.thisComputer`):O(t,`library.value.detected`)}function ee(e){return/[ㄱ-힝]/u.test(e)?!1:e.trim().split(/\s+/).length>=6}var te=new Set([`loaded`,`ready`,`download_required`,`unavailable`,`unsupported`]),U=[{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 W({initialTab:e}){let t=N(e=>e.mode),n=N(e=>e.language),[r,i]=z.useState(e||`models`);z.useEffect(()=>{U.some(t=>t.id===e)&&i(e)},[e]);let a=(t===`basic`?U.filter(e=>e.id===`models`):U).map(e=>({id:e.id,label:O(n,e.labelKey)})),o=e=>{i(e),j(`/`+e)};return(0,B.jsxs)(`div`,{className:`product-page library-page space-y-5`,children:[(0,B.jsxs)(`header`,{className:`page-hero`,children:[(0,B.jsxs)(`div`,{className:`page-kicker`,children:[(0,B.jsx)(I,{className:`h-4 w-4`}),` `,O(n,`library.kicker`)]}),(0,B.jsx)(`h1`,{className:`page-title`,children:O(n,`library.title`)}),(0,B.jsx)(`p`,{className:`page-copy`,children:O(n,`library.body`)})]}),(0,B.jsx)(G,{}),(0,B.jsx)(c,{tabs:a,value:r,onChange:e=>o(e)}),r===`models`?(0,B.jsx)(K,{}):null,r===`skills`?(0,B.jsx)(J,{}):null,r===`mcp`?(0,B.jsx)(Y,{}):null,r===`marketplace`?(0,B.jsx)(X,{}):null]})}function G(){let e=r(),t=N(e=>e.language),n=E({queryKey:[`models`],queryFn:M.models}),[i,a]=z.useState(null),[s,c]=z.useState(null),l=n.data?.data||{},u=k(l.loaded),d=String(l.current||u[0]||``),f=[...k(l.catalog),...k(l.recommended),...k(l.models)],p=e=>String(e.id||e.model_id||``),m=d?f.find(e=>p(e)===d):void 0,h=String(m?.name||``)||(d?A(d):``),g=f.filter(e=>{let t=p(e);return!t||t===d||u.includes(t)||e.download_required||q(e.runtime_compatibility).supported===!1||e.load_status===`unsupported`?!1:!!e.load_available||e.load_status===`ready`}).slice(0,3);async function _(n){let r=p(n);a(r),c(null);let i=String(n.recommended_engine||n.engine||``)||void 0,o=await M.loadModel(String(n.recommended_load_id||r),i,!1);a(null),o.ok||c(o.error||O(t,`library.active.switchFailed`)),await e.invalidateQueries({queryKey:[`models`]})}let v=!!(n.data&&!n.data.ok);return(0,B.jsxs)(`section`,{className:`library-active`,"aria-label":O(t,`library.active.title`),"data-testid":`library-active-model`,children:[(0,B.jsxs)(`div`,{className:`library-active-main`,children:[(0,B.jsx)(`span`,{className:`library-active-mark`,"aria-hidden":`true`,children:h&&!v?(0,B.jsx)(S,{className:`h-5 w-5`}):(0,B.jsx)(C,{className:`h-5 w-5`})}),(0,B.jsxs)(`div`,{className:`library-active-copy`,children:[(0,B.jsx)(`span`,{className:`library-active-kicker`,children:O(t,`library.active.title`)}),v?(0,B.jsx)(`strong`,{children:O(t,`library.active.unknown`)}):h?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`strong`,{children:h}),(0,B.jsx)(`small`,{children:O(t,`library.active.ready`)})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`strong`,{children:O(t,`library.active.none`)}),(0,B.jsx)(`small`,{children:O(t,`library.active.noneHint`)})]})]}),h&&!v?(0,B.jsx)(b,{variant:`success`,children:O(t,`library.model.loaded`)}):null]}),g.length&&!v?(0,B.jsxs)(`div`,{className:`library-active-switch`,children:[(0,B.jsxs)(`span`,{className:`library-active-switch-label`,children:[O(t,`library.active.switchTitle`),(0,B.jsx)(`small`,{children:O(t,`library.active.switchHint`)})]}),(0,B.jsx)(`div`,{className:`library-active-switch-options`,children:g.map(e=>{let n=p(e),r=String(e.name||``)||A(n);return(0,B.jsxs)(`button`,{type:`button`,disabled:!!i,"data-testid":`library-switch-${n}`,onClick:()=>void _(e),children:[i===n?(0,B.jsx)(o,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":`true`}):(0,B.jsx)(x,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),i===n?O(t,`library.active.switching`):r]},n)})})]}):null,s?(0,B.jsx)(`p`,{className:`library-active-error`,role:`status`,children:s}):null]})}function K(){let e=r(),t=N(e=>e.mode),n=N(e=>e.language),i=E({queryKey:[`models`],queryFn:M.models}),a=E({queryKey:[`modelRecommendations`,`local_mlx`],queryFn:()=>M.modelRecommendations(`local_mlx`)}),o=E({queryKey:[`embeddings`],queryFn:M.embeddingsStatus}),[s,c]=z.useState(!1),[u,d]=z.useState(null),[p,m]=z.useState([]),[g,D]=z.useState(null),[A,j]=z.useState(null),[F,I]=z.useState(!1),R=z.useRef(!1),H=k(i.data?.data?.loaded),U=String(i.data?.data?.current||``),W=e=>{let t=String(e.id||e.model_id||``);return t&&(H.includes(t)||t===U)?0:e.load_available||e.load_status===`ready`?1:e.pulled?2:3},G=[...k(i.data?.data?.catalog),...k(i.data?.data?.recommended)].map((e,t)=>({model:e,index:t})).sort((e,t)=>W(e.model)-W(t.model)||e.index-t.index).map(e=>e.model),K=k(a.data?.data?.recommendations?.models),J=new Map(K.map(e=>[String(e.id),e])),Y=G.find(e=>{let t=String(e.id||``);return!!t&&(H.includes(t)||t===U)}),X=a.data?.data?.recommendations?.top_pick||null,Z=p[p.length-1]||null,Q=z.useCallback((e,r=`library.model.notReady`)=>{let i=String(e);if(n===`ko`&&ee(i))return O(n,r);if(t!==`basic`)return i;let a=i.replace(/gemma4_unified/gi,O(n,`library.model.localFormat`)).replace(/mlx[-_ ]?vlm|mlx[-_ ]?lm|local_mlx|\bmlx\b|\bgguf\b|\bollama\b|hugging face/gi,O(n,`library.model.localSupport`)).replace(/runtime/gi,O(n,`library.model.support`)).replace(/model_type/gi,O(n,`library.model.format`));return n===`en`?a.replace(/this local model format local model support format/gi,O(n,`library.model.localFormat`)).replace(/local model support model support/gi,O(n,`library.model.localSupport`)):a},[n,t]);async function $(t,n,r){I(!0),d(t),m([]),D(null),j(null),R.current=!1;let i=await M.streamModelPrepare({model:t,engine:n||`local_mlx`,allow_download:r},{onProgress:e=>m(t=>[...t.slice(-8),e]),onDone:e=>D(e),onError:e=>{R.current=!0,j(e)}});I(!1),await e.invalidateQueries({queryKey:[`models`]}),await e.invalidateQueries({queryKey:[`modelRecommendations`,`local_mlx`]}),!i.ok&&!R.current&&j(i.data)}return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(h,{title:O(n,`library.models.setup.title`),description:O(n,`library.models.setup.desc`),result:a.data,children:r=>{let i=r.recommendations,a=r.profile;return(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(re,{language:n,mode:t,profile:a||{},recommendation:i||{},current:Y,currentId:U,latestProgress:Z,lastResult:g,onReload:()=>{if(Y){let e=Y.recommended_load_id||Y.id;$(String(e||U),String(Y.recommended_engine||Y.engine||`local_mlx`),s)}},onUnload:()=>{U&&M.unloadModel(U).then(()=>e.invalidateQueries({queryKey:[`models`]}))}}),(0,B.jsx)(`ol`,{className:`library-setup-track`,"aria-label":O(n,`library.steps.aria`),children:[[O(n,`library.step.environment`),!0,C],[O(n,`library.step.recommend`),!!(X||G.length),x],[O(n,`library.step.install`),!!(Y||Z?.stage===`engine`),L],[O(n,`library.step.download`),!!(Y||Z?.stage===`download`),w],[O(n,`library.step.validate`),!!(Y||Z?.stage===`smoke_test`),T],[O(n,`library.step.ready`),!!(Y||g),S]].map(([e,t,r])=>(0,B.jsxs)(`li`,{className:t?`is-done`:``,children:[(0,B.jsx)(`span`,{className:`library-setup-mark`,"aria-hidden":`true`,children:z.createElement(r,{className:`h-3.5 w-3.5`})}),(0,B.jsx)(`span`,{className:`library-setup-label`,children:String(e)}),(0,B.jsx)(`span`,{className:`library-setup-state`,children:t?O(n,`library.step.done`):O(n,`library.step.pending`)})]},String(e)))}),(0,B.jsxs)(`label`,{className:`flex items-start gap-2 rounded-lg border border-border bg-background/55 p-3 text-sm leading-6`,children:[(0,B.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:s,onChange:e=>c(e.target.checked)}),(0,B.jsx)(`span`,{children:O(n,`library.consent`)})]}),Z?(0,B.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/55 p-3 text-sm`,children:[(0,B.jsx)(`div`,{className:`font-medium`,children:String(Z.message||O(n,`library.preparing`))}),(0,B.jsx)(`div`,{className:`mt-2 h-2 overflow-hidden rounded-full bg-muted`,children:(0,B.jsx)(`div`,{className:`h-full bg-primary`,style:{width:`${Number(Z.percent||8)}%`}})}),Z.detail?(0,B.jsx)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:String(Z.detail)}):null]}):null,A?(0,B.jsx)(ie,{error:A}):null]})}}),(0,B.jsx)(h,{title:t===`basic`?O(n,`library.panel.recommended.basic`):O(n,`library.panel.recommended.other`),result:i.data,children:e=>(0,B.jsxs)(`div`,{className:`grid gap-2`,children:[(G.length?G: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`,c=String(r.recommended_load_id||a),l=String(r.recommended_engine||r.engine||``),d=J.get(a)||J.get(c)||{},f=q(r.verification),p=q(d.verification),m=q(r.hardware),h=q(d.hardware),g=!!r.download_required,_=m.recommended_ram_gb||h.recommended_ram_gb,y=_?O(n,`library.model.ramRecommended`,{ram:String(_)}):t===`basic`?``:String(m.notes||h.notes||``),x=r.safety_notes||d.safety_notes,S=r.license||d.license,C=r.runtime_compatibility||d.runtime_compatibility||{},w=String(C.status||``)===`fallback_available`,T=r.load_status===`unsupported`||C.supported===!1,E=(!!r.load_available||o)&&!T,D=String(r.load_status||(o?`loaded`:`unavailable`)),A=g?O(n,`library.model.needsDownloadFirst`):Q(r.unavailable_reason||O(n,`library.model.notReady`)),j=String(r.runtime_label||C.preferred_runtime||l||`local_mlx`),N=String(C.action||D.replace(/_/g,` `)),I=te.has(D)?O(n,`library.model.status.${D}`):O(n,`library.model.status.unknown`),L=T&&t===`basic`?O(n,`library.model.needsAttention`):I,R=E||g,z=r.download_size||r.estimated_size||d.download_size||d.estimated_size||r.size||d.size,V=r.provider||d.provider||r.organization||d.organization;return(0,B.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 rounded-lg border border-border bg-background/55 p-4`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(`div`,{className:`text-base font-semibold`,children:String(r.name||a)}),X?.id===a||r.recommended_default?(0,B.jsx)(b,{variant:`success`,children:O(n,`library.model.recommended`)}):null,String(r.modality||d.modality||``).includes(`multi`)||String(r.modality||``)===`multimodal`?(0,B.jsx)(b,{variant:`muted`,children:O(n,`library.model.multimodal`)}):null,f.verified||p.verified?(0,B.jsx)(b,{variant:`success`,title:O(n,`library.model.hfVerified`),children:O(n,`library.model.sourceVerified`)}):null]}),(0,B.jsx)(`div`,{className:`mt-1 text-sm text-muted-foreground`,children:t===`basic`?[Q(r.family||d.family||O(n,`library.model.local`)),/mlx|gguf|ollama/i.test(String(r.size||d.size||``))?``:r.size||d.size].filter(Boolean).map(String).join(` · `):[r.family||d.family||O(n,`library.value.local`),r.size||d.size].filter(Boolean).map(String).join(` · `)}),r.hardware||d.hardware?(0,B.jsx)(`div`,{className:`mt-1 text-[11px] text-muted-foreground/80`,children:String(y)}):null,(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1 text-[11px] text-muted-foreground`,children:[(0,B.jsx)(b,{variant:`muted`,children:g?O(n,`library.model.downloadSize`,{size:String(z||O(n,`library.model.downloadRequired`))}):O(n,`library.model.noDownload`)}),(0,B.jsx)(b,{variant:`muted`,children:g?O(n,`library.model.internetDuringDownload`):O(n,`library.model.runsLocally`)}),V?(0,B.jsx)(b,{variant:`muted`,children:String(V)}):null]}),T?(0,B.jsxs)(`div`,{className:`mt-3 rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-sm`,children:[(0,B.jsx)(`div`,{className:`font-medium`,children:t===`basic`?O(n,`library.model.attentionBeforeLoad`):N}),(0,B.jsx)(`div`,{className:`text-muted-foreground`,children:Q(C.user_message||A,`library.model.unsupportedHere`)})]}):w?(0,B.jsxs)(`div`,{className:`mt-3 rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-sm`,children:[(0,B.jsx)(`div`,{className:`font-medium`,children:t===`basic`?O(n,`library.model.compatiblePath`):O(n,`library.model.runtimeFallback`)}),(0,B.jsx)(`div`,{className:`text-muted-foreground`,children:Q(C.user_message||O(n,`library.model.compatibilityFallback`),`library.model.compatibilityFallback`)})]}):!o&&!E?(0,B.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:A}):null,t===`basic`?null:(0,B.jsxs)(`div`,{className:`mt-2 space-y-1 text-xs text-muted-foreground`,children:[(0,B.jsxs)(`div`,{children:[j,` · `,c,r.load_strategy||d.load_strategy?` · ${String(r.load_strategy||d.load_strategy)}`:``,f.notes?` · ${String(f.notes).slice(0,60)}`:``]}),x||S?(0,B.jsx)(`div`,{children:[S?O(n,`library.model.license`,{license:String(S)}):``,x?String(x):``].filter(Boolean).join(` · `)}):null]}),T||w?(0,B.jsx)(ne,{compatibility:C}):null]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 md:justify-end`,children:[(0,B.jsx)(b,{variant:o?`success`:E?`muted`:`warning`,children:o?O(n,`library.model.loaded`):L}),o?(0,B.jsx)(v,{label:O(n,`library.runtime.unload`),action:()=>M.unloadModel(c),invalidate:[`models`]}):(0,B.jsx)(P,{variant:`outline`,disabled:F||T||!R||g&&!s,title:T?O(n,`library.model.status.unsupported`):g&&!s?O(n,`library.btn.needsConsent`):R?void 0:A,onClick:()=>$(c,l,s),children:u===c&&F?O(n,`library.btn.preparing`):g?O(n,`library.btn.installLoad`):O(n,`library.btn.validateLoad`)})]})]},a)}),t===`basic`&&G.length>3?(0,B.jsx)(`div`,{className:`rounded-lg border border-border bg-background/55 p-3 text-sm text-muted-foreground`,children:O(n,`library.model.shortListHint`)}):null]})})]}),(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(h,{title:t===`basic`?O(n,`library.models.embedding.basic`):O(n,`library.models.embedding.advanced`),result:o.data,children:e=>(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(l,{value:V(e.state,n)}),t===`basic`?null:(0,B.jsx)(y,{value:e})]})}),(0,B.jsx)(h,{title:t===`basic`?O(n,`library.models.validation`):O(n,`library.models.validationAdvanced`),result:i.data,children:e=>{let r=k(e.compat_profiles);return r.length?(0,B.jsx)(f,{items:r.map(e=>({...e,name:t===`basic`?e.name||e.display_name||O(n,`library.model.loadedName`):e.name||e.display_name||e.model_id,status:e.quality_status||e.load_status||O(n,`library.model.checked`)})),titleKey:`name`,metaKey:`status`,limit:6}):(0,B.jsx)(_,{title:O(n,`library.model.noneChecked`),detail:O(n,`library.model.noneCheckedHint`)})}})]})]})}function ne({compatibility:e}){let t=N(e=>e.mode),n=N(e=>e.language),r=k(e.alternatives);return r.length?(0,B.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:r.slice(0,3).map(e=>(0,B.jsx)(b,{variant:`muted`,children:t===`basic`&&/mlx|gguf|ollama|lm studio/i.test(String(e.name||e.id))?O(n,`library.model.compatibleAlternative`):String(e.name||e.id)},String(e.id||e.name)))}):null}function re({language:e=`en`,mode:t=`advanced`,profile:n,recommendation:r,current:i,currentId:a,latestProgress:o,lastResult:s,onReload:c,onUnload:l}){let u=String(i?.id||a||``),d=String(i?.name||``)||(u?A(u):``),f=String(i?.engine||i?.recommended_engine||o?.engine||`local_mlx`),m=String(i?.local_path||i?.storage_location||r.cache_path||r.storage_location||`~/.cache/huggingface / ~/.latticeai/models`),h=String(o?.stage||s?.stage||(d?O(e,`library.value.ready`):O(e,`library.value.idle`))),g=t===`basic`;return(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(p,{stats:g?[{label:O(e,`library.runtime.computer`),value:H(n,e)},{label:O(e,`library.runtime.loaded`),value:d||O(e,`library.runtime.noneShort`)}]:[{label:O(e,`library.runtime.computer`),value:H(n,e)},{label:O(e,`library.runtime.engine`),value:f},{label:O(e,`library.runtime.loaded`),value:d||O(e,`library.runtime.noLoaded`)},{label:O(e,`library.runtime.state`),value:h}]}),(0,B.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/55 p-3 text-sm`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`font-medium`,children:d?O(e,`library.models.runtime.available`):O(e,`library.models.runtime.none`)}),g?null:(0,B.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:O(e,`library.runtime.cacheStorage`,{path:m})})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsx)(P,{variant:`outline`,size:`sm`,disabled:!d,onClick:c,children:O(e,`library.runtime.reload`)}),(0,B.jsx)(P,{variant:`outline`,size:`sm`,disabled:!d,onClick:l,children:O(e,`library.runtime.unload`)})]})]}),o?(0,B.jsxs)(`div`,{className:`mt-3`,children:[(0,B.jsxs)(`div`,{className:`flex justify-between text-xs text-muted-foreground`,children:[(0,B.jsx)(`span`,{children:String(o.message||O(e,`library.preparing`))}),(0,B.jsxs)(`span`,{children:[Number(o.percent||0),`%`]})]}),(0,B.jsx)(`div`,{className:`mt-1 h-2 overflow-hidden rounded-full bg-muted`,children:(0,B.jsx)(`div`,{className:`h-full bg-primary`,style:{width:`${Number(o.percent||8)}%`}})})]}):null]})]})}function ie({error:e}){let t=N(e=>e.language),n=k(e.recovery_guidance);return(0,B.jsxs)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-sm`,children:[(0,B.jsx)(`div`,{className:`font-medium`,children:String(e.user_message||O(t,`library.model.setupAttention`))}),n.length?(0,B.jsx)(`ul`,{className:`mt-2 list-inside list-disc text-muted-foreground`,children:n.slice(0,3).map(e=>(0,B.jsx)(`li`,{children:e},e))}):null]})}function q(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function J(){let e=r(),t=N(e=>e.language),n=E({queryKey:[`skills`],queryFn:M.skills}),a=E({queryKey:[`skillsMarketplace`],queryFn:M.skillsMarketplace}),o=i({mutationFn:e=>M.skillInstall(String(e.name||e.id),String(e.plugin||``)),onSuccess:()=>e.invalidateQueries({queryKey:[`skills`]})});return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,B.jsx)(h,{title:O(t,`library.skills.installed`),result:n.data,children:e=>(0,B.jsx)(`div`,{className:`flex flex-col gap-2`,children:k(e.skills).map(e=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`font-medium`,children:String(e.name||e.id)}),(0,B.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:String(e.plugin||e.description||``)})]}),(0,B.jsx)(v,{label:O(t,e.enabled?`library.skills.disable`:`library.skills.enable`),action:()=>M.skillToggle(String(e.name||e.id),!!e.enabled),invalidate:[`skills`]})]},String(e.name||e.id)))})}),(0,B.jsx)(h,{title:O(t,`library.skills.marketplace`),result:a.data,children:e=>(0,B.jsx)(`div`,{className:`flex flex-col gap-2`,children:k(e.skills).slice(0,10).map(e=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`font-medium`,children:String(e.name||e.id)}),(0,B.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:String(e.description||e.category||``)})]}),(0,B.jsx)(P,{variant:`outline`,disabled:o.isPending,onClick:()=>o.mutate(e),children:O(t,`library.skills.install`)})]},String(e.name||e.id)))})})]})}function Y(){let e=N(e=>e.mode),t=N(e=>e.language),[n,r]=z.useState(`github`),o=E({queryKey:[`mcpTools`],queryFn:M.mcpTools}),c=i({mutationFn:()=>M.mcpRecommend(n)});return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,B.jsx)(h,{title:O(t,e===`basic`?`library.connector.connections`:`library.connector.mcpTools`),result:o.data,children:e=>(0,B.jsx)(f,{items:e.tools||e.installed_mcps,titleKey:`name`,metaKey:`status`})}),(0,B.jsxs)(g,{children:[(0,B.jsxs)(u,{children:[(0,B.jsxs)(a,{className:`flex items-center gap-2`,children:[(0,B.jsx)(R,{className:`h-4 w-4`}),` `,O(t,`library.connector.recommend`)]}),(0,B.jsx)(d,{children:O(t,`library.connector.recommendHint`)})]}),(0,B.jsxs)(m,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(F,{value:n,onChange:e=>r(e.target.value)}),(0,B.jsx)(P,{onClick:()=>c.mutate(),disabled:!n.trim()||c.isPending,children:O(t,`library.connector.recommendAction`)})]}),c.data?(0,B.jsx)(s,{result:c.data,successLabel:O(t,`library.connector.recommendDone`)}):null]})]})]})}function X(){let e=N(e=>e.language),t=E({queryKey:[`templates`],queryFn:M.templates}),n=E({queryKey:[`plugins`],queryFn:M.pluginsRegistry}),r=E({queryKey:[`pluginsDirectory`],queryFn:M.pluginsDirectory});return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,B.jsx)(h,{title:O(e,`library.market.templates`),result:t.data,children:e=>(0,B.jsx)(f,{items:e.templates,titleKey:`name`,metaKey:`kind`})}),(0,B.jsx)(h,{title:O(e,`library.market.installedPlugins`),result:n.data,children:e=>(0,B.jsx)(f,{items:e.plugins,titleKey:`name`,metaKey:`status`})}),(0,B.jsx)(h,{title:O(e,`library.market.pluginDirectory`),result:r.data,children:e=>(0,B.jsx)(f,{items:e.plugins,titleKey:`name`,metaKey:`category`})}),(0,B.jsxs)(g,{className:`xl:col-span-3`,children:[(0,B.jsxs)(u,{children:[(0,B.jsxs)(a,{className:`flex items-center gap-2`,children:[(0,B.jsx)(L,{className:`h-4 w-4`}),` `,O(e,`library.market.templateInstall`)]}),(0,B.jsx)(d,{children:O(e,`library.market.templateInstallHint`)})]}),(0,B.jsx)(m,{children:k(t.data?.data?.templates).length?(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:k(t.data?.data?.templates).slice(0,6).map(t=>(0,B.jsx)(v,{label:O(e,`library.market.installTemplate`,{name:String(t.name||t.id)}),action:()=>M.installTemplate(t)},String(t.id||t.name)))}):(0,B.jsx)(f,{items:[]})})]})]})}export{W as LibraryPage};
|
|
1
|
+
import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{n as r}from"./QueryClientProvider-B3OjqSyJ.js";import{t as i}from"./useMutation-Bi0PXQMC.js";import{_ as a,b as o,c as s,d as c,f as l,g as u,h as d,i as f,l as p,m,n as h,p as g,r as _,t as v,u as y,v as b}from"./primitives-B6DzQC3H.js";import{t as x}from"./circle-check-D44VI2ZE.js";import{t as S}from"./circle-play-DSYCP0RD.js";import{t as C}from"./cpu-D7x-dtxi.js";import{t as w}from"./download-BHuJr-5V.js";import{t as T}from"./shield-alert-WDP2DSTM.js";import{H as E,R as D,S as O,c as k,f as A,o as j,v as M,z as N}from"./index-DCT79wzR.js";import{t as P}from"./button-xXPeemQr.js";import{t as F}from"./input-D3YrgxvO.js";import"./workspace-BsxrRYQI.js";var I=D(`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`}]]),L=D(`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`}]]),R=D(`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`}]]),z=e(t()),B=n();function V(e,t){let n=String(e||``).toLowerCase();return n===`production`?O(t,`library.embedding.state.production`):n===`fallback`||n===`hash`||n===`local`?O(t,`library.embedding.state.fallback`):O(t,`library.embedding.state.unknown`)}function H(e,t){let n=String(e?.os||``).toLowerCase(),r=String(e?.arch||``).toLowerCase();return n?n===`darwin`&&r.startsWith(`arm`)?O(t,`library.runtime.appleSilicon`):n===`darwin`?`Mac`:n===`win32`||n.startsWith(`win`)?`Windows`:n===`linux`?`Linux`:O(t,`library.runtime.thisComputer`):O(t,`library.value.detected`)}function ee(e){return/[ㄱ-힝]/u.test(e)?!1:e.trim().split(/\s+/).length>=6}var te=new Set([`loaded`,`ready`,`download_required`,`unavailable`,`unsupported`]),U=[{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 W({initialTab:e}){let t=N(e=>e.mode),n=N(e=>e.language),[r,i]=z.useState(e||`models`);z.useEffect(()=>{U.some(t=>t.id===e)&&i(e)},[e]);let a=(t===`basic`?U.filter(e=>e.id===`models`):U).map(e=>({id:e.id,label:O(n,e.labelKey)})),o=e=>{i(e),j(`/`+e)};return(0,B.jsxs)(`div`,{className:`product-page library-page space-y-5`,children:[(0,B.jsxs)(`header`,{className:`page-hero`,children:[(0,B.jsxs)(`div`,{className:`page-kicker`,children:[(0,B.jsx)(I,{className:`h-4 w-4`}),` `,O(n,`library.kicker`)]}),(0,B.jsx)(`h1`,{className:`page-title`,children:O(n,`library.title`)}),(0,B.jsx)(`p`,{className:`page-copy`,children:O(n,`library.body`)})]}),(0,B.jsx)(G,{}),(0,B.jsx)(c,{tabs:a,value:r,onChange:e=>o(e)}),r===`models`?(0,B.jsx)(K,{}):null,r===`skills`?(0,B.jsx)(J,{}):null,r===`mcp`?(0,B.jsx)(Y,{}):null,r===`marketplace`?(0,B.jsx)(X,{}):null]})}function G(){let e=r(),t=N(e=>e.language),n=E({queryKey:[`models`],queryFn:M.models}),[i,a]=z.useState(null),[s,c]=z.useState(null),l=n.data?.data||{},u=k(l.loaded),d=String(l.current||u[0]||``),f=[...k(l.catalog),...k(l.recommended),...k(l.models)],p=e=>String(e.id||e.model_id||``),m=d?f.find(e=>p(e)===d):void 0,h=String(m?.name||``)||(d?A(d):``),g=f.filter(e=>{let t=p(e);return!t||t===d||u.includes(t)||e.download_required||q(e.runtime_compatibility).supported===!1||e.load_status===`unsupported`?!1:!!e.load_available||e.load_status===`ready`}).slice(0,3);async function _(n){let r=p(n);a(r),c(null);let i=String(n.recommended_engine||n.engine||``)||void 0,o=await M.loadModel(String(n.recommended_load_id||r),i,!1);a(null),o.ok||c(o.error||O(t,`library.active.switchFailed`)),await e.invalidateQueries({queryKey:[`models`]})}let v=!!(n.data&&!n.data.ok);return(0,B.jsxs)(`section`,{className:`library-active`,"aria-label":O(t,`library.active.title`),"data-testid":`library-active-model`,children:[(0,B.jsxs)(`div`,{className:`library-active-main`,children:[(0,B.jsx)(`span`,{className:`library-active-mark`,"aria-hidden":`true`,children:h&&!v?(0,B.jsx)(S,{className:`h-5 w-5`}):(0,B.jsx)(C,{className:`h-5 w-5`})}),(0,B.jsxs)(`div`,{className:`library-active-copy`,children:[(0,B.jsx)(`span`,{className:`library-active-kicker`,children:O(t,`library.active.title`)}),v?(0,B.jsx)(`strong`,{children:O(t,`library.active.unknown`)}):h?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`strong`,{children:h}),(0,B.jsx)(`small`,{children:O(t,`library.active.ready`)})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`strong`,{children:O(t,`library.active.none`)}),(0,B.jsx)(`small`,{children:O(t,`library.active.noneHint`)})]})]}),h&&!v?(0,B.jsx)(b,{variant:`success`,children:O(t,`library.model.loaded`)}):null]}),g.length&&!v?(0,B.jsxs)(`div`,{className:`library-active-switch`,children:[(0,B.jsxs)(`span`,{className:`library-active-switch-label`,children:[O(t,`library.active.switchTitle`),(0,B.jsx)(`small`,{children:O(t,`library.active.switchHint`)})]}),(0,B.jsx)(`div`,{className:`library-active-switch-options`,children:g.map(e=>{let n=p(e),r=String(e.name||``)||A(n);return(0,B.jsxs)(`button`,{type:`button`,disabled:!!i,"data-testid":`library-switch-${n}`,onClick:()=>void _(e),children:[i===n?(0,B.jsx)(o,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":`true`}):(0,B.jsx)(x,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),i===n?O(t,`library.active.switching`):r]},n)})})]}):null,s?(0,B.jsx)(`p`,{className:`library-active-error`,role:`status`,children:s}):null]})}function K(){let e=r(),t=N(e=>e.mode),n=N(e=>e.language),i=E({queryKey:[`models`],queryFn:M.models}),a=E({queryKey:[`modelRecommendations`,`local_mlx`],queryFn:()=>M.modelRecommendations(`local_mlx`)}),o=E({queryKey:[`embeddings`],queryFn:M.embeddingsStatus}),[s,c]=z.useState(!1),[u,d]=z.useState(null),[p,m]=z.useState([]),[g,D]=z.useState(null),[A,j]=z.useState(null),[F,I]=z.useState(!1),R=z.useRef(!1),H=k(i.data?.data?.loaded),U=String(i.data?.data?.current||``),W=e=>{let t=String(e.id||e.model_id||``);return t&&(H.includes(t)||t===U)?0:e.load_available||e.load_status===`ready`?1:e.pulled?2:3},G=[...k(i.data?.data?.catalog),...k(i.data?.data?.recommended)].map((e,t)=>({model:e,index:t})).sort((e,t)=>W(e.model)-W(t.model)||e.index-t.index).map(e=>e.model),K=k(a.data?.data?.recommendations?.models),J=new Map(K.map(e=>[String(e.id),e])),Y=G.find(e=>{let t=String(e.id||``);return!!t&&(H.includes(t)||t===U)}),X=a.data?.data?.recommendations?.top_pick||null,Z=p[p.length-1]||null,Q=z.useCallback((e,r=`library.model.notReady`)=>{let i=String(e);if(n===`ko`&&ee(i))return O(n,r);if(t!==`basic`)return i;let a=i.replace(/gemma4_unified/gi,O(n,`library.model.localFormat`)).replace(/mlx[-_ ]?vlm|mlx[-_ ]?lm|local_mlx|\bmlx\b|\bgguf\b|\bollama\b|hugging face/gi,O(n,`library.model.localSupport`)).replace(/runtime/gi,O(n,`library.model.support`)).replace(/model_type/gi,O(n,`library.model.format`));return n===`en`?a.replace(/this local model format local model support format/gi,O(n,`library.model.localFormat`)).replace(/local model support model support/gi,O(n,`library.model.localSupport`)):a},[n,t]);async function $(t,n,r){I(!0),d(t),m([]),D(null),j(null),R.current=!1;let i=await M.streamModelPrepare({model:t,engine:n||`local_mlx`,allow_download:r},{onProgress:e=>m(t=>[...t.slice(-8),e]),onDone:e=>D(e),onError:e=>{R.current=!0,j(e)}});I(!1),await e.invalidateQueries({queryKey:[`models`]}),await e.invalidateQueries({queryKey:[`modelRecommendations`,`local_mlx`]}),!i.ok&&!R.current&&j(i.data)}return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(h,{title:O(n,`library.models.setup.title`),description:O(n,`library.models.setup.desc`),result:a.data,children:r=>{let i=r.recommendations,a=r.profile;return(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(re,{language:n,mode:t,profile:a||{},recommendation:i||{},current:Y,currentId:U,latestProgress:Z,lastResult:g,onReload:()=>{if(Y){let e=Y.recommended_load_id||Y.id;$(String(e||U),String(Y.recommended_engine||Y.engine||`local_mlx`),s)}},onUnload:()=>{U&&M.unloadModel(U).then(()=>e.invalidateQueries({queryKey:[`models`]}))}}),(0,B.jsx)(`ol`,{className:`library-setup-track`,"aria-label":O(n,`library.steps.aria`),children:[[O(n,`library.step.environment`),!0,C],[O(n,`library.step.recommend`),!!(X||G.length),x],[O(n,`library.step.install`),!!(Y||Z?.stage===`engine`),L],[O(n,`library.step.download`),!!(Y||Z?.stage===`download`),w],[O(n,`library.step.validate`),!!(Y||Z?.stage===`smoke_test`),T],[O(n,`library.step.ready`),!!(Y||g),S]].map(([e,t,r])=>(0,B.jsxs)(`li`,{className:t?`is-done`:``,children:[(0,B.jsx)(`span`,{className:`library-setup-mark`,"aria-hidden":`true`,children:z.createElement(r,{className:`h-3.5 w-3.5`})}),(0,B.jsx)(`span`,{className:`library-setup-label`,children:String(e)}),(0,B.jsx)(`span`,{className:`library-setup-state`,children:t?O(n,`library.step.done`):O(n,`library.step.pending`)})]},String(e)))}),(0,B.jsxs)(`label`,{className:`flex items-start gap-2 rounded-lg border border-border bg-background/55 p-3 text-sm leading-6`,children:[(0,B.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:s,onChange:e=>c(e.target.checked)}),(0,B.jsx)(`span`,{children:O(n,`library.consent`)})]}),Z?(0,B.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/55 p-3 text-sm`,children:[(0,B.jsx)(`div`,{className:`font-medium`,children:String(Z.message||O(n,`library.preparing`))}),(0,B.jsx)(`div`,{className:`mt-2 h-2 overflow-hidden rounded-full bg-muted`,children:(0,B.jsx)(`div`,{className:`h-full bg-primary`,style:{width:`${Number(Z.percent||8)}%`}})}),Z.detail?(0,B.jsx)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:String(Z.detail)}):null]}):null,A?(0,B.jsx)(ie,{error:A}):null]})}}),(0,B.jsx)(h,{title:t===`basic`?O(n,`library.panel.recommended.basic`):O(n,`library.panel.recommended.other`),result:i.data,children:e=>(0,B.jsxs)(`div`,{className:`grid gap-2`,children:[(G.length?G: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`,c=String(r.recommended_load_id||a),l=String(r.recommended_engine||r.engine||``),d=J.get(a)||J.get(c)||{},f=q(r.verification),p=q(d.verification),m=q(r.hardware),h=q(d.hardware),g=!!r.download_required,_=m.recommended_ram_gb||h.recommended_ram_gb,y=_?O(n,`library.model.ramRecommended`,{ram:String(_)}):t===`basic`?``:String(m.notes||h.notes||``),x=r.safety_notes||d.safety_notes,S=r.license||d.license,C=r.runtime_compatibility||d.runtime_compatibility||{},w=String(C.status||``)===`fallback_available`,T=r.load_status===`unsupported`||C.supported===!1,E=(!!r.load_available||o)&&!T,D=String(r.load_status||(o?`loaded`:`unavailable`)),A=g?O(n,`library.model.needsDownloadFirst`):Q(r.unavailable_reason||O(n,`library.model.notReady`)),j=String(r.runtime_label||C.preferred_runtime||l||`local_mlx`),N=String(C.action||D.replace(/_/g,` `)),I=te.has(D)?O(n,`library.model.status.${D}`):O(n,`library.model.status.unknown`),L=T&&t===`basic`?O(n,`library.model.needsAttention`):I,R=E||g,z=r.download_size||r.estimated_size||d.download_size||d.estimated_size||r.size||d.size,V=r.provider||d.provider||r.organization||d.organization;return(0,B.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 rounded-lg border border-border bg-background/55 p-4`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(`div`,{className:`text-base font-semibold`,children:String(r.name||a)}),X?.id===a||r.recommended_default?(0,B.jsx)(b,{variant:`success`,children:O(n,`library.model.recommended`)}):null,String(r.modality||d.modality||``).includes(`multi`)||String(r.modality||``)===`multimodal`?(0,B.jsx)(b,{variant:`muted`,children:O(n,`library.model.multimodal`)}):null,f.verified||p.verified?(0,B.jsx)(b,{variant:`success`,title:O(n,`library.model.hfVerified`),children:O(n,`library.model.sourceVerified`)}):null]}),(0,B.jsx)(`div`,{className:`mt-1 text-sm text-muted-foreground`,children:t===`basic`?[Q(r.family||d.family||O(n,`library.model.local`)),/mlx|gguf|ollama/i.test(String(r.size||d.size||``))?``:r.size||d.size].filter(Boolean).map(String).join(` · `):[r.family||d.family||O(n,`library.value.local`),r.size||d.size].filter(Boolean).map(String).join(` · `)}),r.hardware||d.hardware?(0,B.jsx)(`div`,{className:`mt-1 text-[11px] text-muted-foreground/80`,children:String(y)}):null,(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1 text-[11px] text-muted-foreground`,children:[(0,B.jsx)(b,{variant:`muted`,children:g?O(n,`library.model.downloadSize`,{size:String(z||O(n,`library.model.downloadRequired`))}):O(n,`library.model.noDownload`)}),(0,B.jsx)(b,{variant:`muted`,children:g?O(n,`library.model.internetDuringDownload`):O(n,`library.model.runsLocally`)}),V?(0,B.jsx)(b,{variant:`muted`,children:String(V)}):null]}),T?(0,B.jsxs)(`div`,{className:`mt-3 rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-sm`,children:[(0,B.jsx)(`div`,{className:`font-medium`,children:t===`basic`?O(n,`library.model.attentionBeforeLoad`):N}),(0,B.jsx)(`div`,{className:`text-muted-foreground`,children:Q(C.user_message||A,`library.model.unsupportedHere`)})]}):w?(0,B.jsxs)(`div`,{className:`mt-3 rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-sm`,children:[(0,B.jsx)(`div`,{className:`font-medium`,children:t===`basic`?O(n,`library.model.compatiblePath`):O(n,`library.model.runtimeFallback`)}),(0,B.jsx)(`div`,{className:`text-muted-foreground`,children:Q(C.user_message||O(n,`library.model.compatibilityFallback`),`library.model.compatibilityFallback`)})]}):!o&&!E?(0,B.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:A}):null,t===`basic`?null:(0,B.jsxs)(`div`,{className:`mt-2 space-y-1 text-xs text-muted-foreground`,children:[(0,B.jsxs)(`div`,{children:[j,` · `,c,r.load_strategy||d.load_strategy?` · ${String(r.load_strategy||d.load_strategy)}`:``,f.notes?` · ${String(f.notes).slice(0,60)}`:``]}),x||S?(0,B.jsx)(`div`,{children:[S?O(n,`library.model.license`,{license:String(S)}):``,x?String(x):``].filter(Boolean).join(` · `)}):null]}),T||w?(0,B.jsx)(ne,{compatibility:C}):null]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 md:justify-end`,children:[(0,B.jsx)(b,{variant:o?`success`:E?`muted`:`warning`,children:o?O(n,`library.model.loaded`):L}),o?(0,B.jsx)(v,{label:O(n,`library.runtime.unload`),action:()=>M.unloadModel(c),invalidate:[`models`]}):(0,B.jsx)(P,{variant:`outline`,disabled:F||T||!R||g&&!s,title:T?O(n,`library.model.status.unsupported`):g&&!s?O(n,`library.btn.needsConsent`):R?void 0:A,onClick:()=>$(c,l,s),children:u===c&&F?O(n,`library.btn.preparing`):g?O(n,`library.btn.installLoad`):O(n,`library.btn.validateLoad`)})]})]},a)}),t===`basic`&&G.length>3?(0,B.jsx)(`div`,{className:`rounded-lg border border-border bg-background/55 p-3 text-sm text-muted-foreground`,children:O(n,`library.model.shortListHint`)}):null]})})]}),(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(h,{title:t===`basic`?O(n,`library.models.embedding.basic`):O(n,`library.models.embedding.advanced`),result:o.data,children:e=>(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(l,{value:V(e.state??e.grade,n)}),[`fallback`,`hash`].includes(String(e.state||e.grade||``).toLowerCase())?(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:O(n,`library.embedding.fallbackHint`)}):null,t===`basic`?null:(0,B.jsx)(y,{value:e})]})}),(0,B.jsx)(h,{title:t===`basic`?O(n,`library.models.validation`):O(n,`library.models.validationAdvanced`),result:i.data,children:e=>{let r=k(e.compat_profiles);return r.length?(0,B.jsx)(f,{items:r.map(e=>({...e,name:t===`basic`?e.name||e.display_name||O(n,`library.model.loadedName`):e.name||e.display_name||e.model_id,status:e.quality_status||e.load_status||O(n,`library.model.checked`)})),titleKey:`name`,metaKey:`status`,limit:6}):(0,B.jsx)(_,{title:O(n,`library.model.noneChecked`),detail:O(n,`library.model.noneCheckedHint`)})}})]})]})}function ne({compatibility:e}){let t=N(e=>e.mode),n=N(e=>e.language),r=k(e.alternatives);return r.length?(0,B.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:r.slice(0,3).map(e=>(0,B.jsx)(b,{variant:`muted`,children:t===`basic`&&/mlx|gguf|ollama|lm studio/i.test(String(e.name||e.id))?O(n,`library.model.compatibleAlternative`):String(e.name||e.id)},String(e.id||e.name)))}):null}function re({language:e=`en`,mode:t=`advanced`,profile:n,recommendation:r,current:i,currentId:a,latestProgress:o,lastResult:s,onReload:c,onUnload:l}){let u=String(i?.id||a||``),d=String(i?.name||``)||(u?A(u):``),f=String(i?.engine||i?.recommended_engine||o?.engine||`local_mlx`),m=String(i?.local_path||i?.storage_location||r.cache_path||r.storage_location||`~/.cache/huggingface / ~/.latticeai/models`),h=String(o?.stage||s?.stage||(d?O(e,`library.value.ready`):O(e,`library.value.idle`))),g=t===`basic`;return(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(p,{stats:g?[{label:O(e,`library.runtime.computer`),value:H(n,e)},{label:O(e,`library.runtime.loaded`),value:d||O(e,`library.runtime.noneShort`)}]:[{label:O(e,`library.runtime.computer`),value:H(n,e)},{label:O(e,`library.runtime.engine`),value:f},{label:O(e,`library.runtime.loaded`),value:d||O(e,`library.runtime.noLoaded`)},{label:O(e,`library.runtime.state`),value:h}]}),(0,B.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/55 p-3 text-sm`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`font-medium`,children:d?O(e,`library.models.runtime.available`):O(e,`library.models.runtime.none`)}),g?null:(0,B.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:O(e,`library.runtime.cacheStorage`,{path:m})})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsx)(P,{variant:`outline`,size:`sm`,disabled:!d,onClick:c,children:O(e,`library.runtime.reload`)}),(0,B.jsx)(P,{variant:`outline`,size:`sm`,disabled:!d,onClick:l,children:O(e,`library.runtime.unload`)})]})]}),o?(0,B.jsxs)(`div`,{className:`mt-3`,children:[(0,B.jsxs)(`div`,{className:`flex justify-between text-xs text-muted-foreground`,children:[(0,B.jsx)(`span`,{children:String(o.message||O(e,`library.preparing`))}),(0,B.jsxs)(`span`,{children:[Number(o.percent||0),`%`]})]}),(0,B.jsx)(`div`,{className:`mt-1 h-2 overflow-hidden rounded-full bg-muted`,children:(0,B.jsx)(`div`,{className:`h-full bg-primary`,style:{width:`${Number(o.percent||8)}%`}})})]}):null]})]})}function ie({error:e}){let t=N(e=>e.language),n=k(e.recovery_guidance);return(0,B.jsxs)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-sm`,children:[(0,B.jsx)(`div`,{className:`font-medium`,children:String(e.user_message||O(t,`library.model.setupAttention`))}),n.length?(0,B.jsx)(`ul`,{className:`mt-2 list-inside list-disc text-muted-foreground`,children:n.slice(0,3).map(e=>(0,B.jsx)(`li`,{children:e},e))}):null]})}function q(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function J(){let e=r(),t=N(e=>e.language),n=E({queryKey:[`skills`],queryFn:M.skills}),a=E({queryKey:[`skillsMarketplace`],queryFn:M.skillsMarketplace}),o=i({mutationFn:e=>M.skillInstall(String(e.name||e.id),String(e.plugin||``)),onSuccess:()=>e.invalidateQueries({queryKey:[`skills`]})});return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,B.jsx)(h,{title:O(t,`library.skills.installed`),result:n.data,children:e=>(0,B.jsx)(`div`,{className:`flex flex-col gap-2`,children:k(e.skills).map(e=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`font-medium`,children:String(e.name||e.id)}),(0,B.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:String(e.plugin||e.description||``)})]}),(0,B.jsx)(v,{label:O(t,e.enabled?`library.skills.disable`:`library.skills.enable`),action:()=>M.skillToggle(String(e.name||e.id),!!e.enabled),invalidate:[`skills`]})]},String(e.name||e.id)))})}),(0,B.jsx)(h,{title:O(t,`library.skills.marketplace`),result:a.data,children:e=>(0,B.jsx)(`div`,{className:`flex flex-col gap-2`,children:k(e.skills).slice(0,10).map(e=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`font-medium`,children:String(e.name||e.id)}),(0,B.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:String(e.description||e.category||``)})]}),(0,B.jsx)(P,{variant:`outline`,disabled:o.isPending,onClick:()=>o.mutate(e),children:O(t,`library.skills.install`)})]},String(e.name||e.id)))})})]})}function Y(){let e=N(e=>e.mode),t=N(e=>e.language),[n,r]=z.useState(`github`),o=E({queryKey:[`mcpTools`],queryFn:M.mcpTools}),c=i({mutationFn:()=>M.mcpRecommend(n)});return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,B.jsx)(h,{title:O(t,e===`basic`?`library.connector.connections`:`library.connector.mcpTools`),result:o.data,children:e=>(0,B.jsx)(f,{items:e.tools||e.installed_mcps,titleKey:`name`,metaKey:`status`})}),(0,B.jsxs)(g,{children:[(0,B.jsxs)(u,{children:[(0,B.jsxs)(a,{className:`flex items-center gap-2`,children:[(0,B.jsx)(R,{className:`h-4 w-4`}),` `,O(t,`library.connector.recommend`)]}),(0,B.jsx)(d,{children:O(t,`library.connector.recommendHint`)})]}),(0,B.jsxs)(m,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(F,{value:n,onChange:e=>r(e.target.value)}),(0,B.jsx)(P,{onClick:()=>c.mutate(),disabled:!n.trim()||c.isPending,children:O(t,`library.connector.recommendAction`)})]}),c.data?(0,B.jsx)(s,{result:c.data,successLabel:O(t,`library.connector.recommendDone`)}):null]})]})]})}function X(){let e=N(e=>e.language),t=E({queryKey:[`templates`],queryFn:M.templates}),n=E({queryKey:[`plugins`],queryFn:M.pluginsRegistry}),r=E({queryKey:[`pluginsDirectory`],queryFn:M.pluginsDirectory});return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,B.jsx)(h,{title:O(e,`library.market.templates`),result:t.data,children:e=>(0,B.jsx)(f,{items:e.templates,titleKey:`name`,metaKey:`kind`})}),(0,B.jsx)(h,{title:O(e,`library.market.installedPlugins`),result:n.data,children:e=>(0,B.jsx)(f,{items:e.plugins,titleKey:`name`,metaKey:`status`})}),(0,B.jsx)(h,{title:O(e,`library.market.pluginDirectory`),result:r.data,children:e=>(0,B.jsx)(f,{items:e.plugins,titleKey:`name`,metaKey:`category`})}),(0,B.jsxs)(g,{className:`xl:col-span-3`,children:[(0,B.jsxs)(u,{children:[(0,B.jsxs)(a,{className:`flex items-center gap-2`,children:[(0,B.jsx)(L,{className:`h-4 w-4`}),` `,O(e,`library.market.templateInstall`)]}),(0,B.jsx)(d,{children:O(e,`library.market.templateInstallHint`)})]}),(0,B.jsx)(m,{children:k(t.data?.data?.templates).length?(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:k(t.data?.data?.templates).slice(0,6).map(t=>(0,B.jsx)(v,{label:O(e,`library.market.installTemplate`,{name:String(t.name||t.id)}),action:()=>M.installTemplate(t)},String(t.id||t.name)))}):(0,B.jsx)(f,{items:[]})})]})]})}export{W as LibraryPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{R as r,S as i,u as a,z as o}from"./index-
|
|
1
|
+
import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{R as r,S as i,u as a,z as o}from"./index-DCT79wzR.js";var s=r(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),c=r(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),l=e(t()),u=n(),d=Array.from({length:12},(e,t)=>t),f=[{x:22,y:32,delay:-.4,duration:5.8},{x:36,y:18,delay:-2.1,duration:6.4},{x:65,y:22,delay:-3.7,duration:5.4},{x:79,y:42,delay:-1.3,duration:6.8},{x:68,y:72,delay:-4.5,duration:5.9},{x:31,y:75,delay:-2.8,duration:6.2}];function p({state:e=`idle`,intensity:t=.6,onPulse:n,size:r=`large`,label:s,className:c,showLabel:p=!0,depth:h=0,onInteract:g}){let _=o(e=>e.language),v=l.useRef(null),y=l.useRef(null),b=l.useRef(null),x=l.useRef({x:0,y:0}),S=l.useId().replace(/:/g,``),C={left:`${S}-lobe-left`,right:`${S}-lobe-right`,bridge:`${S}-bridge`,stem:`${S}-stem`,sheen:`${S}-sheen`},w=l.useCallback(()=>{v.current&&(v.current.classList.add(`pulse`),y.current!==null&&window.clearTimeout(y.current),y.current=window.setTimeout(()=>{v.current&&v.current.classList.remove(`pulse`)},1350)),n?.()},[n]);l.useEffect(()=>{let e=()=>w();return window.addEventListener(`brain:recall`,e),()=>{window.removeEventListener(`brain:recall`,e),y.current!==null&&window.clearTimeout(y.current)}},[w]),l.useEffect(()=>{if(e===`recalling`||t>.82){let e=window.setTimeout(()=>w(),180);return()=>clearTimeout(e)}},[e,t,w]);let T=e,E=r===`large`,D=r===`trace`,O=Math.max(.35,Math.min(1,t)),k=Math.max(0,Math.min(5,h||0)),A=e===`thinking`||e===`recalling`||e===`synthesizing`||e===`acting`,j=()=>{w(),!A&&g?.()},M=l.useRef(!1);l.useEffect(()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>{M.current=e.matches};return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let N=l.useCallback(e=>{if(M.current||e.pointerType===`touch`)return;let t=e.currentTarget.getBoundingClientRect(),n=(e.clientX-t.left)/t.width*2-1;x.current={x:((e.clientY-t.top)/t.height*2-1)*-9,y:n*11},b.current===null&&(b.current=window.requestAnimationFrame(()=>{b.current=null;let e=v.current;e&&(e.style.setProperty(`--tilt-y`,`${x.current.y.toFixed(2)}deg`),e.style.setProperty(`--tilt-x`,`${x.current.x.toFixed(2)}deg`))}))},[]),P=l.useCallback(e=>{b.current!==null&&(window.cancelAnimationFrame(b.current),b.current=null);let t=e.currentTarget;t.style.setProperty(`--tilt-y`,`0deg`),t.style.setProperty(`--tilt-x`,`0deg`)},[]);return l.useEffect(()=>()=>{b.current!==null&&window.cancelAnimationFrame(b.current)},[]),(0,u.jsxs)(`div`,{className:a(`brain-presence select-none`,E&&`large`,D&&`trace`,c,k>0&&`is-exploring`),"aria-label":i(_,`brain.living.aria`),role:`group`,"data-depth":k,children:[(0,u.jsxs)(`button`,{type:`button`,ref:v,className:a(`brain-organism`,`size-${r}`,`depth-${k}`),"data-state":T,"data-testid":`living-brain`,"aria-label":i(_,k<5?`brain.living.open`:`brain.living.graph`),"aria-busy":A,style:{"--brain-scale":`${.96+(O-.5)*.09+k*.015}`},onClick:j,onPointerMove:N,onPointerLeave:P,title:i(_,k<5?`brain.living.open`:`brain.living.graph`),children:[(0,u.jsxs)(`div`,{className:`brain-vital-field`,"aria-hidden":`true`,children:[(0,u.jsx)(`span`,{className:`brain-vital-ring is-primary`}),(0,u.jsx)(`span`,{className:`brain-vital-ring is-echo`}),(0,u.jsx)(`span`,{className:`brain-orbit is-near`,children:(0,u.jsx)(`i`,{})}),(0,u.jsx)(`span`,{className:`brain-orbit is-far`,children:(0,u.jsx)(`i`,{})}),f.map((e,t)=>(0,u.jsx)(`i`,{className:`brain-vital-spark`,style:{left:`${e.x}%`,top:`${e.y}%`,animationDelay:`${e.delay}s`,animationDuration:`${e.duration}s`,"--spark-index":t}},`${e.x}-${e.y}`))]}),(0,u.jsx)(`div`,{className:`brain-core`,style:{"--core-scale":`${1+k*.045}`},children:(0,u.jsx)(`div`,{className:`brain-body-motion`,children:(0,u.jsxs)(`svg`,{className:`brain-anatomy`,viewBox:`0 0 220 174`,"aria-hidden":!0,children:[(0,u.jsxs)(`defs`,{children:[(0,u.jsxs)(`radialGradient`,{id:C.left,cx:`34%`,cy:`26%`,r:`85%`,children:[(0,u.jsx)(`stop`,{offset:`0%`,stopColor:`hsl(var(--brain-halo) / 0.8)`}),(0,u.jsx)(`stop`,{offset:`42%`,stopColor:`hsl(var(--brain-core) / 0.46)`}),(0,u.jsx)(`stop`,{offset:`78%`,stopColor:`hsl(var(--brain-core) / 0.2)`}),(0,u.jsx)(`stop`,{offset:`100%`,stopColor:`hsl(var(--brain-shade) / 0.28)`})]}),(0,u.jsxs)(`radialGradient`,{id:C.right,cx:`62%`,cy:`24%`,r:`88%`,children:[(0,u.jsx)(`stop`,{offset:`0%`,stopColor:`hsl(var(--primary) / 0.55)`}),(0,u.jsx)(`stop`,{offset:`46%`,stopColor:`hsl(var(--memory) / 0.34)`}),(0,u.jsx)(`stop`,{offset:`80%`,stopColor:`hsl(var(--brain-core) / 0.16)`}),(0,u.jsx)(`stop`,{offset:`100%`,stopColor:`hsl(var(--brain-shade) / 0.3)`})]}),(0,u.jsxs)(`radialGradient`,{id:C.bridge,cx:`50%`,cy:`30%`,r:`80%`,children:[(0,u.jsx)(`stop`,{offset:`0%`,stopColor:`hsl(var(--brain-halo) / 0.5)`}),(0,u.jsx)(`stop`,{offset:`100%`,stopColor:`hsl(var(--primary) / 0.12)`})]}),(0,u.jsxs)(`linearGradient`,{id:C.stem,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,u.jsx)(`stop`,{offset:`0%`,stopColor:`hsl(var(--primary) / 0.38)`}),(0,u.jsx)(`stop`,{offset:`100%`,stopColor:`hsl(var(--brain-shade) / 0.12)`})]}),(0,u.jsxs)(`linearGradient`,{id:C.sheen,x1:`0`,y1:`0`,x2:`0.4`,y2:`1`,children:[(0,u.jsx)(`stop`,{offset:`0%`,stopColor:`hsl(var(--brain-sheen) / 0.5)`}),(0,u.jsx)(`stop`,{offset:`70%`,stopColor:`hsl(var(--brain-sheen) / 0.06)`}),(0,u.jsx)(`stop`,{offset:`100%`,stopColor:`hsl(var(--brain-sheen) / 0)`})]})]}),(0,u.jsx)(`path`,{className:`brain-lobe brain-lobe-left`,style:{fill:`url(#${C.left})`},d:`M102 30c-13-20-44-19-55 1-18 1-29 16-28 33-13 8-18 25-11 39-9 16-1 36 17 42 5 19 27 26 43 15 13 10 33 8 43-5 5-7 8-16 8-27V52c0-8-6-17-17-22Z`}),(0,u.jsx)(`path`,{className:`brain-lobe brain-lobe-right`,style:{fill:`url(#${C.right})`},d:`M118 30c13-20 44-19 55 1 18 1 29 16 28 33 13 8 18 25 11 39 9 16 1 36-17 42-5 19-27 26-43 15-13 10-33 8-43-5-5-7-8-16-8-27V52c0-8 6-17 17-22Z`}),(0,u.jsx)(`path`,{className:`brain-bridge`,style:{fill:`url(#${C.bridge})`},d:`M103 48c9-8 24-8 33 0 7 6 9 16 5 25-5 11-16 15-31 12-15 3-26-1-31-12-4-9-2-19 5-25 5-4 12-6 19 0Z`}),(0,u.jsx)(`path`,{className:`brain-stem`,style:{fill:`url(#${C.stem})`},d:`M92 137c10 9 26 9 36 0 1 14 7 25 20 33H76c12-8 17-19 16-33Z`}),(0,u.jsx)(`path`,{className:`brain-fold fold-a`,d:`M48 50c18-11 38-8 47 8`}),(0,u.jsx)(`path`,{className:`brain-fold fold-b`,d:`M34 82c22-8 45-5 58 8`}),(0,u.jsx)(`path`,{className:`brain-fold fold-c`,d:`M43 119c18 5 35 2 49-11`}),(0,u.jsx)(`path`,{className:`brain-fold fold-d`,d:`M172 50c-18-11-38-8-47 8`}),(0,u.jsx)(`path`,{className:`brain-fold fold-e`,d:`M186 82c-22-8-45-5-58 8`}),(0,u.jsx)(`path`,{className:`brain-fold fold-f`,d:`M177 119c-18 5-35 2-49-11`}),(0,u.jsx)(`path`,{className:`brain-fold fold-mid`,d:`M110 38c-5 30-5 70 0 112`}),(0,u.jsx)(`path`,{className:`brain-sheen`,style:{fill:`url(#${C.sheen})`},d:`M58 38c22-16 52-20 78-10-30-2-58 6-74 22-8 8-16 6-4-12Z`})]})})}),(0,u.jsx)(`div`,{className:`brain-aura`,style:{animationDuration:e===`thinking`?`1.65s`:e===`recalling`?`2.4s`:`6.8s`,"--aura-scale":`${1+k*.12}`,opacity:.65+k*.05,boxShadow:k>2?`0 0 var(--aura-blur, 60px) hsl(var(--brain-core) / 0.25)`:`none`}}),(0,u.jsx)(`div`,{className:`thought-activity`,"aria-hidden":!0,children:d.slice(0,Math.min(12,5+k*2)).map(e=>(0,u.jsx)(`div`,{className:a(`thought-particle`,k>=3&&`resolving`),style:{left:`${18+(e*13+k*4)%64}%`,top:`${22+e%5*14}%`,animationDelay:`-${e*.55+t*1.1-k*.2}s`,animationDuration:`${2.8+(1-O)*1.6-k*.15}s`}},e))}),Array.from({length:1+Math.floor(k/1.5)}).map((e,t)=>(0,u.jsx)(`div`,{className:`memory-ripple`,"aria-hidden":!0,style:{inset:`${18+t*6}%`,animationDelay:`${180+t*220}ms`,opacity:.55+k*.06}},t))]}),p&&!D&&(0,u.jsxs)(`div`,{className:`brain-presence-label`,"data-state":e,children:[(0,u.jsx)(`span`,{className:`dot`}),s||(k>0?i(_,`brain.living.depth`,{depth:k}):i(_,m(e)))]})]})}function m(e){switch(e){case`listening`:return`brain.living.state.listening`;case`thinking`:return`brain.living.state.thinking`;case`recalling`:return`brain.living.state.recalling`;case`synthesizing`:return`brain.living.state.synthesizing`;case`planning`:return`brain.living.state.planning`;case`acting`:return`brain.living.state.acting`;case`resting`:return`brain.living.state.resting`;default:return`brain.living.state.idle`}}function h(){typeof window<`u`&&window.dispatchEvent(new CustomEvent(`brain:recall`))}export{s as i,h as n,c as r,p as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{i as r,r as i,t as a}from"./LivingBrain-wess-qJZ.js";import{t as o}from"./circle-check-D44VI2ZE.js";import{t as s}from"./cpu-D7x-dtxi.js";import{B as c,O as l,R as u,S as d,c as f,v as p,w as m,x as h,z as g}from"./index-DCT79wzR.js";import"./brain-C2XwdQL1.js";import{t as _}from"./button-xXPeemQr.js";import{t as v}from"./input-D3YrgxvO.js";var y=u(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),b=u(`shield`,[[`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`}]]),x=u(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),S=u(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),C=e(t());m({ko:{"flow.analysis.fact.computer":`컴퓨터`,"flow.analysis.fact.memory":`메모리`,"flow.analysis.fact.graphics":`그래픽`,"flow.analysis.fact.support":`로컬 지원`,"flow.analysis.fact.models":`모델`,"flow.analysis.checking":`확인 중`,"flow.analysis.fact.computerDetail":`운영체제와 칩`,"flow.analysis.fact.memoryDetail":`로컬 사고를 위한 여유 공간`,"flow.analysis.fact.graphicsDetail":`로컬 가속 지원`,"flow.analysis.fact.supportDetail":`설치된 모델 도우미`,"flow.analysis.fact.modelsDetail":`설치된 로컬 Brain`,"flow.analysis.apple":`Apple Silicon Mac`,"flow.analysis.detected":`감지됨`,"flow.analysis.localReady":`로컬 가속 준비됨`,"flow.analysis.standardLocal":`표준 로컬 모드`,"flow.analysis.supportReady":`준비됨`,"flow.analysis.supportInstall":`준비 예정`,"flow.analysis.modelsInstalled":`{count}개 이미 설치됨`,"flow.analysis.noModels":`아직 설치된 모델 없음`,"flow.analysis.readyDetail":`로컬 Digital Brain 사용 준비 완료`,"flow.analysis.memoryReadyDetail":`추천 모델에 충분한 컨텍스트`,"flow.analysis.graphicsReadyDetail":`Lattice가 가장 좋은 경로를 선택합니다.`,"flow.analysis.supportReadyDetail":`설치된 모델 도우미가 감지되었습니다.`,"flow.analysis.supportInstallDetail":`Lattice가 필요한 항목을 추가합니다.`,"flow.analysis.modelsReadyDetail":`즉시 로드할 수 있는 모델이 있습니다.`,"flow.analysis.modelsInstallDetail":`Lattice가 첫 설치를 안내합니다.`,"flow.recommend.reason.best":`최적 경험`,"flow.recommend.reason.faster":`빠른 선택`,"flow.recommend.reason.advanced":`고급 선택`,"flow.recommend.reason.default":`추천`,"flow.recommend.sizeReady":`준비됨`,"flow.recommend.fallbackName":`추천 Brain`,"flow.install.stage.idle":`아래 버튼을 누르면 준비를 시작합니다.`,"flow.install.stage.install":`Brain 준비를 시작합니다.`,"flow.install.stage.download":`모델 파일을 받는 중입니다.`,"flow.install.stage.validate":`Brain이 응답할 수 있는지 확인 중입니다.`,"flow.install.stage.load":`Brain을 불러오는 중입니다.`,"flow.install.stage.done":`Brain이 준비되었습니다. 곧 대화가 열립니다.`,"flow.install.stage.error":`확인이 필요한 일이 있습니다.`,"flow.install.step.install":`준비`,"flow.install.step.download":`다운로드`,"flow.install.step.ready":`로컬 확인`,"flow.install.step.validate":`확인`,"flow.install.step.load":`로드`,"flow.analysis.hardware.icon.chip":`🖥️`,"flow.analysis.hardware.icon.ram":`🧠`,"flow.analysis.hardware.icon.gpu":`⚡`,"flow.analysis.hardware.icon.support":`🧩`,"flow.analysis.hardware.icon.models":`📦`,"flow.analysis.hardware.label.chip":`컴퓨터 (운영체제와 칩)`,"flow.analysis.hardware.label.ram":`메모리 (생각할 작업 공간, RAM)`,"flow.analysis.hardware.label.gpu":`그래픽 (계산을 도와주는 GPU)`,"flow.analysis.hardware.label.support":`로컬 지원 (모델 실행 도우미)`,"flow.analysis.hardware.label.models":`모델 (설치된 AI Brain)`,"flow.recommend.timeEstimate":`다운로드 약 {download} · 첫 응답 약 {response}초`,"flow.recommend.timeEstimate.ready":`다운로드 불필요 · 첫 응답 약 {response}초`,"flow.recommend.timeEstimate.unknown":`다운로드 시간 미확인 · 첫 응답 약 {response}초`,"flow.recommend.timeNote":`네트워크 속도에 따라 달라질 수 있어요.`,"flow.recommend.alternatives":`다른 선택지`,"flow.recommend.minutes":`{count}분`,"flow.recommend.comparison.faster":`(더 빠름)`,"flow.recommend.comparison.advanced":`(더 강력함)`,"flow.recommend.choose":`이 모델 선택`,"flow.recommend.primaryNote":`약 {time} 후 사용 준비 완료`,"flow.recommend.primaryNote.ready":`다운로드 없이 바로 사용 준비 완료`,"flow.recommend.primaryNote.unknown":`다운로드 시간 확인 후 사용 준비`,"flow.recommend.nextHint":`선택하면 다운로드와 준비 화면으로 넘어가고, 끝나면 바로 Brain이 열립니다.`,"flow.recommend.nextHint.ready":`선택하면 준비 확인 화면으로 넘어가고, 끝나면 바로 Brain이 열립니다.`,"flow.install.expectedTitle":`예상 진행`,"flow.install.expected":`약 {download} 다운로드 후 약 {response}초 안에 첫 응답`,"flow.install.expected.ready":`다운로드 없이 약 {response}초 안에 첫 응답`,"flow.install.expected.unknown":`다운로드 후 약 {response}초 안에 첫 응답`,"flow.install.timelineStep.download":`모델 다운로드`,"flow.install.timelineStep.ready":`로컬 모델 확인`,"flow.install.timelineStep.validate":`응답 확인`,"flow.install.timelineStep.load":`Brain에 로드`,"flow.install.timelineApprox":`약 {time}`,"flow.install.timelineQuick":`잠깐`,"flow.install.expectedCompletion":`끝나면 바로 Brain이 열립니다.`,"flow.shell":`내 로컬 AI 브레인 만들기`,"flow.wake.aria":`Brain 깨우기`,"flow.wake.title":`내 지식이 살아나는 Brain을 시작하세요.`,"flow.wake.body":`Lattice AI는 이 컴퓨터 안에서 내 대화, 문서, 결정이 오래 남는 작업 기억이 되게 합니다. 모델은 바꿔도 Brain은 계속 내 것입니다.`,"flow.wake.value.aria":`Brain 시작 가치`,"flow.wake.value.local.k":`완전 로컬`,"flow.wake.value.local.v":`지식과 대화는 이 컴퓨터에서 먼저 정리됩니다.`,"flow.wake.value.instant.k":`바로 이해`,"flow.wake.value.instant.v":`복잡한 설정 대신 3단계로 첫 대화를 엽니다.`,"flow.wake.value.brain.k":`지속되는 Brain`,"flow.wake.value.brain.v":`모델을 바꿔도 내 기억과 그래프는 이어집니다.`,"flow.wake.plan.aria":`Brain 시작 단계`,"flow.wake.step.identity":`주인 확인`,"flow.wake.step.check":`컴퓨터 확인`,"flow.wake.step.voice":`목소리 선택`,"flow.wake.primary":`Brain 지금 깨우기`,"flow.wake.existing":`기존 Brain 열기`,"flow.wake.startNote":`평균 2분 안에 첫 대화 시작 · 로컬 우선 · 사용자가 제어`,"flow.login.title":`이 Brain의 주인을 정합니다.`,"flow.login.statement":`이 컴퓨터 안에서만 사는 기억을 만듭니다.`,"flow.login.body":`이 컴퓨터의 기억을 누구 것으로 할지 정합니다. 기존 Brain이 있으면 새로 만들기 전에 먼저 안전하게 확인합니다.`,"flow.name":`이름`,"flow.name.placeholder":`나`,"flow.email":`이메일`,"flow.email.placeholder":`you@local`,"flow.password":`비밀번호`,"flow.password.placeholder":`로컬 Brain 비밀번호`,"flow.login.busy":`Brain 여는 중...`,"flow.login.submit":`내 Brain 시작하기`,"flow.login.note":`이 프로필은 내 AI 브레인의 주인입니다. 기존 Brain과 다른 이메일이면 새로 만들지 않고 먼저 확인합니다.`,"flow.login.passwordLocal":`이 비밀번호는 이 컴퓨터의 Brain 전용입니다. 클라우드로 전송되지 않습니다.`,"flow.login.missing":`이름과 이메일, 비밀번호를 입력하면 기존 Brain을 안전하게 확인합니다.`,"flow.login.otherEmail":`이 컴퓨터의 기존 Brain과 다른 이메일입니다. 오타인지 확인해 주세요.`,"flow.login.wrongPassword":`기존 Brain 이메일은 맞지만 비밀번호가 다릅니다. 비밀번호를 다시 확인해 주세요.`,"flow.login.unavailable":`로컬 프로필을 열 수 없습니다. 이메일과 비밀번호를 확인해 주세요.`,"flow.promise.memory.k":`오래 남는 지식`,"flow.promise.memory.v":`내 일이 장기 기억이 됩니다.`,"flow.promise.model.k":`교체 가능한 모델`,"flow.promise.model.v":`모델은 목소리이고, 자산은 Brain입니다.`,"flow.promise.ownership.k":`사용자 소유`,"flow.promise.ownership.v":`백업, 복원, 이동을 직접 결정합니다.`,"flow.promise.aria":`Lattice AI 제품 약속`,"flow.analysis.title":`이 컴퓨터에 맞는 Brain 경험을 확인합니다.`,"flow.analysis.body":`스펙 점수가 아니라, 이 Mac에서 어떤 로컬 AI 브레인 경험이 편한지 보여드립니다. 확인은 로컬 상태를 읽는 것이고, 클라우드 모델은 선택 사항입니다.`,"flow.analysis.finding":`가장 편한 설정을 찾는 중...`,"flow.analysis.ready":`추천 모델을 바로 시작할 수 있게 준비했습니다.`,"flow.analysis.wait":`잠시만 기다리면 자동으로 정리됩니다.`,"flow.analysis.error":`Lattice가 이 컴퓨터를 끝까지 확인하지 못했습니다. 그래도 안전한 기본값으로 계속할 수 있습니다.`,"flow.analysis.continue":`추천 모델 보기`,"flow.analysis.bestFit":`{model}이 이 컴퓨터에 가장 잘 맞습니다.`,"flow.analysis.privateRecommended":`이 컴퓨터에는 개인 로컬 Brain을 추천합니다.`,"flow.analysis.os.windows":`Windows PC`,"flow.analysis.os.linux":`Linux 컴퓨터`,"flow.recommend.title":`추천대로 시작하세요.`,"flow.recommend.environment.apple":`컴퓨터 준비 완료: 로컬 MLX 지원(Apple Silicon, {ram}GB RAM 감지)`,"flow.recommend.environment.standard":`권장: 가벼운 로컬 모델로 시작하세요({ram}GB RAM 감지)`,"flow.recommend.body":`모델은 Brain의 현재 목소리입니다. 추천, 빠른 선택, 강한 선택만 먼저 보여드려 바로 결정할 수 있게 합니다.`,"flow.recommend.embedHint":`검색은 대화 모델과 별개입니다. 의미 모델이 없으면 해시 검색으로 시작합니다.`,"flow.recommend.primary":`추천으로 바로 시작`,"flow.recommend.unsupported":`이 컴퓨터에서 추가 확인이 필요합니다`,"flow.recommend.back":`뒤로`,"flow.recommend.skip":`모델 없이 Brain 열기`,"flow.recommend.hint":`잘 모르겠다면 추천대로 시작하면 됩니다.`,"flow.recommend.loading":`이 컴퓨터에 맞는 모델을 확인하는 중...`,"flow.recommend.unavailable.aria":`로컬 모델 준비 상태`,"flow.recommend.unavailable.title":`지금은 이 컴퓨터에서 바로 쓸 로컬 모델을 준비하지 못했습니다.`,"flow.recommend.unavailable.probe":`Lattice가 이 컴퓨터의 로컬 환경을 확인하지 못했습니다. 네트워크와 로컬 서비스 상태를 확인한 뒤 다시 시도해 주세요.`,"flow.recommend.unavailable.empty":`이 컴퓨터에서 바로 실행할 수 있는 추천 모델을 찾지 못했습니다. 다시 확인하거나, 모델 없이 Brain을 먼저 열 수 있습니다.`,"flow.recommend.unavailable.retry":`다시 확인`,"flow.recommend.unavailable.hint":`모델은 나중에 라이브러리에서 언제든 추가할 수 있습니다.`,"flow.recommend.rank.best":`추천`,"flow.recommend.rank.faster":`빠른 선택`,"flow.recommend.rank.advanced":`고급 선택`,"flow.recommend.rank.choice":`선택 {index}`,"flow.install.title":`모델을 설치하고 시작합니다.`,"flow.install.title.ready":`모델을 준비하고 시작합니다.`,"flow.install.wait":`Brain이 사용할 모델을 기다리고 있습니다.`,"flow.install.prepare":`Brain 준비 중입니다.`,"flow.install.done":`Brain이 준비되었습니다.`,"flow.install.note":`큰 모델은 다운로드에 몇 분 이상 걸릴 수 있습니다. 진행률은 모델 런타임이 알려주는 만큼 표시하고, 멈춘 것처럼 보여도 현재 단계가 유지됩니다.`,"flow.install.note.ready":`로컬 응답 확인은 보통 잠깐이면 끝납니다. 실패하면 다른 모델을 고르거나 나중에 다시 시도할 수 있습니다.`,"flow.install.retry":`다른 모델을 고르거나 다시 시도할 수 있습니다.`,"flow.install.back":`다른 모델 고르기`,"flow.install.start":`다운로드하고 시작하기`,"flow.install.startReady":`준비하고 시작하기`,"flow.install.busy":`모델 준비 중...`,"flow.install.enter":`Brain으로 들어가기`,"flow.install.later":`나중에 하기`,"flow.install.local":`모델 다운로드와 외부 통신은 사용자가 시작할 때만 진행됩니다.`,"flow.install.local.ready":`이 선택은 외부 다운로드 없이 로컬 준비 상태만 확인합니다.`,"flow.consent.title":`다운로드 전 확인`,"flow.consent.readyTitle":`로컬 준비 상태`,"flow.consent.body":`시작하면 아래 모델 파일을 외부 저장소에서 받아 이 컴퓨터에 저장합니다.`,"flow.consent.ready":`이미 준비된 모델입니다. 시작해도 외부 다운로드를 요청하지 않고 로컬에서 응답 가능 여부만 확인합니다.`,"flow.consent.state":`다운로드 필요`,"flow.consent.stateReady":`없음`,"flow.consent.size":`다운로드 크기`,"flow.consent.sizeUnknown":`런타임 확인 후 표시`,"flow.consent.location":`저장 위치`,"flow.consent.external":`외부 접속 대상`,"flow.consent.externalUnknown":`런타임 확인 후 표시`,"flow.consent.externalNone":`선택 전 외부 접속 없음`},en:{"flow.analysis.fact.computer":`Computer`,"flow.analysis.fact.memory":`Memory`,"flow.analysis.fact.graphics":`Graphics`,"flow.analysis.fact.support":`Local Support`,"flow.analysis.fact.models":`Models`,"flow.analysis.checking":`Checking`,"flow.analysis.fact.computerDetail":`Operating system and chip`,"flow.analysis.fact.memoryDetail":`Available room for local thinking`,"flow.analysis.fact.graphicsDetail":`Local acceleration support`,"flow.analysis.fact.supportDetail":`Installed model helpers`,"flow.analysis.fact.modelsDetail":`Installed local Brains`,"flow.analysis.apple":`Apple Silicon Mac`,"flow.analysis.detected":`Detected`,"flow.analysis.localReady":`Local acceleration ready`,"flow.analysis.standardLocal":`Standard local mode`,"flow.analysis.supportReady":`Ready`,"flow.analysis.supportInstall":`Will be prepared`,"flow.analysis.modelsInstalled":`{count} already installed`,"flow.analysis.noModels":`None installed yet`,"flow.analysis.readyDetail":`Ready for local Digital Brain use`,"flow.analysis.memoryReadyDetail":`Enough context for the recommended model`,"flow.analysis.graphicsReadyDetail":`Lattice will choose the best available path`,"flow.analysis.supportReadyDetail":`Installed model helpers detected`,"flow.analysis.supportInstallDetail":`Lattice will add what is needed`,"flow.analysis.modelsReadyDetail":`One can be loaded immediately`,"flow.analysis.modelsInstallDetail":`Lattice will guide the first install`,"flow.recommend.reason.best":`Best Experience`,"flow.recommend.reason.faster":`Faster`,"flow.recommend.reason.advanced":`Advanced`,"flow.recommend.reason.default":`Recommended`,"flow.recommend.sizeReady":`ready`,"flow.recommend.fallbackName":`Recommended Brain`,"flow.install.stage.idle":`Press the button below to start preparing.`,"flow.install.stage.install":`Starting to prepare your Brain.`,"flow.install.stage.download":`Getting the model files.`,"flow.install.stage.validate":`Checking that the Brain can answer.`,"flow.install.stage.load":`Loading the Brain.`,"flow.install.stage.done":`Your Brain is ready. Opening the conversation.`,"flow.install.stage.error":`Something needs attention.`,"flow.install.step.install":`Install`,"flow.install.step.download":`Download`,"flow.install.step.ready":`Local check`,"flow.install.step.validate":`Validate`,"flow.install.step.load":`Load`,"flow.analysis.hardware.icon.chip":`🖥️`,"flow.analysis.hardware.icon.ram":`🧠`,"flow.analysis.hardware.icon.gpu":`⚡`,"flow.analysis.hardware.icon.support":`🧩`,"flow.analysis.hardware.icon.models":`📦`,"flow.analysis.hardware.label.chip":`Computer (operating system and chip)`,"flow.analysis.hardware.label.ram":`Memory (working space to think, RAM)`,"flow.analysis.hardware.label.gpu":`Graphics (the GPU that speeds up math)`,"flow.analysis.hardware.label.support":`Local support (helpers that run models)`,"flow.analysis.hardware.label.models":`Models (AI Brains already installed)`,"flow.recommend.timeEstimate":`Download about {download} · first reply about {response}s`,"flow.recommend.timeEstimate.ready":`No download needed · first reply about {response}s`,"flow.recommend.timeEstimate.unknown":`Download time unknown · first reply about {response}s`,"flow.recommend.timeNote":`Actual time depends on your network speed.`,"flow.recommend.alternatives":`Other options`,"flow.recommend.minutes":`{count} min`,"flow.recommend.comparison.faster":`(faster)`,"flow.recommend.comparison.advanced":`(more capable)`,"flow.recommend.choose":`Choose this model`,"flow.recommend.primaryNote":`Ready to use in about {time}`,"flow.recommend.primaryNote.ready":`Ready with no download`,"flow.recommend.primaryNote.unknown":`Ready after download time is confirmed`,"flow.recommend.nextHint":`Choosing takes you to download and setup, then your Brain opens automatically.`,"flow.recommend.nextHint.ready":`Choosing takes you to a readiness check, then your Brain opens automatically.`,"flow.install.expectedTitle":`What to expect`,"flow.install.expected":`About {download} to download, then a first reply within about {response}s`,"flow.install.expected.ready":`No download — first reply within about {response}s`,"flow.install.expected.unknown":`After download, a first reply within about {response}s`,"flow.install.timelineStep.download":`Download model`,"flow.install.timelineStep.ready":`Check local model`,"flow.install.timelineStep.validate":`Check the reply`,"flow.install.timelineStep.load":`Load into Brain`,"flow.install.timelineApprox":`about {time}`,"flow.install.timelineQuick":`moment`,"flow.install.expectedCompletion":`When it finishes, your Brain opens right away.`,"flow.shell":`Create your local AI Brain`,"flow.wake.aria":`Wake your Brain`,"flow.wake.title":`Start the Brain where your knowledge comes alive.`,"flow.wake.body":`Lattice AI turns your conversations, documents, and decisions into durable working memory on this computer. Models can change while your Brain remains yours.`,"flow.wake.value.aria":`Brain startup value`,"flow.wake.value.local.k":`Fully local`,"flow.wake.value.local.v":`Knowledge and conversations are organized on this computer first.`,"flow.wake.value.instant.k":`Clear start`,"flow.wake.value.instant.v":`Open the first conversation in three guided steps.`,"flow.wake.value.brain.k":`Durable Brain`,"flow.wake.value.brain.v":`Your memories and graph continue even when models change.`,"flow.wake.plan.aria":`Brain start steps`,"flow.wake.step.identity":`Confirm owner`,"flow.wake.step.check":`Check computer`,"flow.wake.step.voice":`Choose voice`,"flow.wake.primary":`Wake Brain`,"flow.wake.existing":`Open existing Brain`,"flow.wake.startNote":`First conversation in about 2 minutes · local-first · user controlled`,"flow.login.title":`Choose the owner of this Brain.`,"flow.login.statement":`Creates a memory system that lives only on this computer.`,"flow.login.body":`Decide who owns the memory on this computer. If a Brain already exists here, Lattice checks safely before creating anything new.`,"flow.name":`Name`,"flow.name.placeholder":`You`,"flow.email":`Email`,"flow.email.placeholder":`you@local`,"flow.password":`Password`,"flow.password.placeholder":`Local Brain password`,"flow.login.busy":`Opening Brain...`,"flow.login.submit":`Start my Brain`,"flow.login.note":`This profile owns your AI Brain. If the email differs from this computer's Brain, Lattice checks before creating anything new.`,"flow.login.passwordLocal":`This password is only for the Brain on this computer. It is not sent to the cloud.`,"flow.login.missing":`Enter your name, email, and password so Lattice can safely check your Brain.`,"flow.login.otherEmail":`This email differs from the Brain on this computer. Please check for a typo.`,"flow.login.wrongPassword":`The email matches this Brain, but the password is different. Please check it again.`,"flow.login.unavailable":`Could not open the local profile. Check your email and password.`,"flow.promise.memory.k":`Durable knowledge`,"flow.promise.memory.v":`Your work becomes long-term memory.`,"flow.promise.model.k":`Replaceable models`,"flow.promise.model.v":`The model is the voice; the Brain is the asset.`,"flow.promise.ownership.k":`User owned`,"flow.promise.ownership.v":`You decide when to back up, restore, or move it.`,"flow.promise.aria":`Lattice AI product promise`,"flow.analysis.title":`Checking the Brain experience for this computer.`,"flow.analysis.body":`This is not a spec score. Lattice reads local capability and explains which local AI Brain experience will feel comfortable on this Mac. Cloud models remain optional.`,"flow.analysis.finding":`Finding the easiest setup...`,"flow.analysis.ready":`Your recommended model is ready to start.`,"flow.analysis.wait":`This will be summarized automatically in a moment.`,"flow.analysis.error":`Lattice could not finish checking this computer. You can still continue with a safe default.`,"flow.analysis.continue":`View recommended models`,"flow.analysis.bestFit":`{model} looks like the best fit.`,"flow.analysis.privateRecommended":`A private local Brain is recommended for this computer.`,"flow.analysis.os.windows":`Windows PC`,"flow.analysis.os.linux":`Linux computer`,"flow.recommend.title":`Start with the recommendation.`,"flow.recommend.environment.apple":`Computer ready: local MLX supported (Apple Silicon, {ram}GB RAM detected)`,"flow.recommend.environment.standard":`Recommended: start with a lighter local model ({ram}GB RAM detected)`,"flow.recommend.body":`The model is your Brain's current voice. Lattice shows the recommendation, a faster choice, and a stronger choice first so you can decide quickly.`,"flow.recommend.embedHint":`Search is separate from the chat model. Without a meaning model, Lattice starts with hash search — not semantic recall.`,"flow.recommend.primary":`Start with recommendation`,"flow.recommend.unsupported":`This computer needs one more check`,"flow.recommend.back":`Back`,"flow.recommend.skip":`Open Brain without a model`,"flow.recommend.hint":`If unsure, start with the recommendation.`,"flow.recommend.loading":`Checking which model fits this computer...`,"flow.recommend.unavailable.aria":`Local model readiness`,"flow.recommend.unavailable.title":`A local model isn't ready to run on this computer yet.`,"flow.recommend.unavailable.probe":`Lattice couldn't check this computer's local environment. Check your network and local services, then try again.`,"flow.recommend.unavailable.empty":`No recommended model can run on this computer right now. Try checking again, or open your Brain without a model first.`,"flow.recommend.unavailable.retry":`Check again`,"flow.recommend.unavailable.hint":`You can add a model anytime later from the library.`,"flow.recommend.rank.best":`Best Experience`,"flow.recommend.rank.faster":`Faster`,"flow.recommend.rank.advanced":`Advanced`,"flow.recommend.rank.choice":`Choice {index}`,"flow.install.title":`Install the model and start.`,"flow.install.title.ready":`Prepare the model and start.`,"flow.install.wait":`Waiting for the model your Brain will use.`,"flow.install.prepare":`Preparing your Brain.`,"flow.install.done":`Your Brain is ready.`,"flow.install.note":`Large models can take several minutes to download. Progress is shown when the model runtime reports it; a steady stage still means work is continuing.`,"flow.install.note.ready":`The local reply check usually takes a moment. If it fails, choose another model or try again later.`,"flow.install.retry":`Choose another model or try again.`,"flow.install.back":`Choose another model`,"flow.install.start":`Download and start`,"flow.install.startReady":`Check and start`,"flow.install.busy":`Preparing model...`,"flow.install.enter":`Enter Brain`,"flow.install.later":`Do later`,"flow.install.local":`Downloads and external communication start only when you choose them.`,"flow.install.local.ready":`This choice checks local readiness without starting an external download.`,"flow.consent.title":`Before downloading`,"flow.consent.readyTitle":`Local readiness`,"flow.consent.body":`Starting will fetch these model files from an external repository and store them on this computer.`,"flow.consent.ready":`This model is already ready. Starting checks whether it can answer locally without requesting an external download.`,"flow.consent.state":`Download needed`,"flow.consent.stateReady":`No`,"flow.consent.size":`Download size`,"flow.consent.sizeUnknown":`Reported by runtime`,"flow.consent.location":`Storage location`,"flow.consent.external":`External target`,"flow.consent.externalUnknown":`Reported by runtime`,"flow.consent.externalNone":`No external connection before selection`}});function ee(e){let t=k(e?.models),n=[...f(t.recommended),...f(t.catalog)],r=k(e?.recommendations?.recommendations),i=f(r.models),a=k(r.top_pick),o=new Map;for(let e of[...i,...n]){let t=String(e.id||e.model_id||e.recommended_load_id||``);t&&o.set(t,{...o.get(t)||{},...e})}a.id&&!o.has(String(a.id))&&o.set(String(a.id),a);let s=Array.from(o.values()).map(w).filter(e=>e.id),c=s.filter(e=>e.supported),l=c.length?c:s,u=(e=>l.find(t=>t.id===String(e)))(a.id)||(e=>l.find(t=>e.test(`${t.name} ${t.id}`)))(/gemma.*12|12b/i)||l[0],d=u?.id,p=l.find(e=>e.id!==d&&/qwen|8b|7b/i.test(`${e.name} ${e.id}`))||l.find(e=>e.id!==d),m=p?.id,h=l.find(e=>e.id!==d&&e.id!==m&&/26b|32b|70b|advanced/i.test(`${e.name} ${e.id}`))||l.find(e=>e.id!==d&&e.id!==m);return[u?{...u,role:`best`,reason:u.reason||`best`}:null,p?{...p,role:`faster`,reason:p.reason||`faster`}:null,h?{...h,role:`advanced`,reason:h.reason||`advanced`}:null].filter(Boolean)}function te(e){let{analysis:t,endpoints:n}=e;if(!n)return{status:`loading`,recommendations:[],reason:null,failedEndpoints:[]};let r=Object.keys(n).filter(e=>!n[e]);if(!(n.recommendations||n.models))return{status:`unavailable`,recommendations:[],reason:`probe_failed`,failedEndpoints:r};let i=ee(t).filter(e=>e.supported);return i.length?{status:`ready`,recommendations:i,reason:null,failedEndpoints:r}:{status:`unavailable`,recommendations:[],reason:`no_supported_model`,failedEndpoints:r}}function ne(){return{id:`mlx-community/gemma-4-e2b-it-4bit`,loadId:`mlx-community/gemma-4-e2b-it-4bit`,engine:`local_mlx`,name:`Gemma 4 E2B`,shortName:`Gemma 4`,family:`Gemma 4`,size:``,role:`best`,reason:`best`,supported:!0,downloadRequired:!1,downloadSize:``,storageLocation:`~/.latticeai/models`,externalHost:``,estimatedDownloadMinutes:0,estimatedFirstResponseSeconds:5,parameterBillions:2}}function w(e){let t=k(e.runtime_compatibility),n=String(e.id||e.model_id||e.recommended_load_id||``),r=String(e.recommended_load_id||e.load_id||n),i=String(e.display_name||e.name||n||`recommended_brain`),a=e.load_status!==`unsupported`&&e.load_status!==`runtime_update_needed`&&e.status!==`not_recommended`&&t.supported!==!1,o=!!e.download_required,s=o?String(e.download_size||e.size||``):``,c=D(`${i} ${n}`);return{id:n,loadId:r,engine:String(e.recommended_engine||e.engine||`local_mlx`),name:i,shortName:O(i),family:O(String(e.family||i)),size:String(e.size||``),role:`best`,reason:String(e.reason||``),supported:a,downloadRequired:o,downloadSize:s,storageLocation:String(e.storage_location||e.local_path||`~/.latticeai/models`),externalHost:o?ie(e):``,estimatedDownloadMinutes:o?E(s):0,estimatedFirstResponseSeconds:re(c),parameterBillions:c}}function T(e){let t=String(e||``).match(/([\d.]+)\s*(t|g|m)?b?/i);if(!t)return null;let n=Number(t[1]);if(!Number.isFinite(n)||n<=0)return null;let r=(t[2]||`g`).toLowerCase();return r===`t`?n*1024*1024:r===`m`?n:n*1024}function E(e){let t=T(e);if(t===null)return null;let n=t/(15/8)/60;return Math.max(1,Math.round(n))}function D(e){let t=String(e||``).match(/(\d{1,3}(?:\.\d)?)\s*b\b/i);if(!t)return null;let n=Number(t[1]);return n>0?n:null}function re(e){return e===null?8:e<=9?5:e<=16?10:e<=40?18:30}function ie(e){let t=String(e.source_url||e.download_url||e.repository||e.provider||e.id||``);return t?/huggingface|hf\\.co|mlx-community/i.test(t)?`huggingface`:/ollama/i.test(t)?`ollama`:t.replace(/^https?:\/\//,``).split(`/`)[0]||t:``}function O(e){return String(e||`recommended_brain`).replace(/^mlx-community\//i,``).replace(/[-_]?Instruct/gi,``).replace(/[-_]?4bit/gi,``).replace(/Qwen3[-_ ]?VL/gi,`Qwen 3`).replace(/Qwen3/gi,`Qwen 3`).replace(/Gemma[-_ ]?4/gi,`Gemma 4`).replace(/A4B/gi,``).replace(/[-_]+/g,` `).replace(/\s+/g,` `).trim()}function k(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}var A=n();function ae({model:e}){let t=g(e=>e.language),n=e.downloadRequired?[{label:d(t,`flow.consent.size`),value:e.downloadSize||d(t,`flow.consent.sizeUnknown`)},{label:d(t,`flow.consent.location`),value:e.storageLocation},{label:d(t,`flow.consent.external`),value:e.externalHost||d(t,`flow.consent.externalUnknown`)}]:[{label:d(t,`flow.consent.state`),value:d(t,`flow.consent.stateReady`)},{label:d(t,`flow.consent.location`),value:e.storageLocation},{label:d(t,`flow.consent.external`),value:d(t,`flow.consent.externalNone`)}],r=e.downloadRequired?`flow.consent.title`:`flow.consent.readyTitle`;return(0,A.jsxs)(`section`,{className:`ritual-consent-panel`,"aria-label":d(t,r),children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`strong`,{children:d(t,r)}),(0,A.jsx)(`p`,{children:e.downloadRequired?d(t,`flow.consent.body`):d(t,`flow.consent.ready`)})]}),(0,A.jsx)(`dl`,{children:n.map(e=>(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`dt`,{children:e.label}),(0,A.jsx)(`dd`,{children:e.value})]},e.label))})]})}function j({model:e,onBack:t,onComplete:n,onLater:r}){let i=g(e=>e.language),a=g(e=>e.mode),[s,c]=C.useState(!1),[l,u]=C.useState(`idle`),[f,m]=C.useState(0),[h,v]=C.useState(d(i,`flow.install.wait`)),[y,b]=C.useState(null),x=d(i,`flow.install.stage.${l}`,{defaultValue:h});async function S(){c(!0),b(null),u(`install`),m(8),v(d(i,`flow.install.prepare`));let t=await p.streamModelPrepare({model:e.loadId,engine:e.engine||`local_mlx`,allow_download:e.downloadRequired},{onProgress:e=>{let t=P(String(e.stage||``));u(t),m(Number(e.percent||F(t))),v(I(e,t,i))},onDone:()=>{u(`done`),m(100),v(d(i,`flow.install.done`))},onError:e=>{u(`error`),b(B(e))}});c(!1),t.ok?(u(`done`),m(100),v(d(i,`flow.install.done`)),window.setTimeout(n,700)):(u(`error`),b(B(t.data)))}return(0,A.jsxs)(`div`,{className:`ritual-install`,children:[(0,A.jsxs)(`header`,{children:[(0,A.jsx)(`h1`,{className:`ritual-title`,children:d(i,e.downloadRequired?`flow.install.title`:`flow.install.title.ready`)}),(0,A.jsxs)(`p`,{className:`ritual-subtitle`,children:[(0,A.jsx)(`strong`,{children:e.shortName}),` — `,e.reason,`.`]})]}),(0,A.jsxs)(`section`,{className:`ritual-card ritual-install-progress-unit`,"aria-label":x,children:[(0,A.jsxs)(`div`,{className:`ritual-progress w-full`,children:[(0,A.jsx)(`div`,{className:`ritual-stage-list`,children:[`install`,`download`,`load`,`validate`].map(t=>(0,A.jsxs)(`div`,{className:`ritual-stage ${z(l,t)}`,children:[(0,A.jsx)(o,{className:`ritual-stage-icon`}),(0,A.jsx)(`span`,{children:L(t,i,e)})]},t))}),(0,A.jsx)(`div`,{className:`ritual-bar`,children:(0,A.jsx)(`span`,{className:`ritual-bar-fill ${R(f)}`})})]}),(0,A.jsxs)(`div`,{className:`ritual-status`,children:[x,a===`advanced`&&h!==x?(0,A.jsx)(`span`,{className:`ritual-status-raw block text-xs opacity-70 mt-1`,children:h}):null]})]}),y&&(0,A.jsxs)(`div`,{className:`ritual-card ritual-error-card ritual-install-error`,role:`alert`,children:[y,(0,A.jsx)(`div`,{className:`ritual-error-detail`,children:d(i,`flow.install.retry`)})]}),(0,A.jsxs)(`details`,{className:`ritual-install-details`,children:[(0,A.jsxs)(`summary`,{className:`cursor-pointer py-2 text-sm text-muted-foreground hover:text-foreground`,children:[d(i,`flow.install.expectedTitle`),` & `,d(i,`flow.consent.readyTitle`)]}),(0,A.jsxs)(`div`,{className:`ritual-install-details-content flex flex-col gap-3 py-2`,children:[(0,A.jsxs)(`section`,{className:`ritual-card ritual-expected-card`,"aria-label":d(i,`flow.install.expectedTitle`),children:[(0,A.jsx)(`div`,{className:`ritual-fact-label`,children:d(i,`flow.install.expectedTitle`)}),(0,A.jsx)(`div`,{className:`ritual-time-estimate ritual-expected-line`,children:M(e,i)}),(0,A.jsx)(`ol`,{className:`ritual-timeline`,children:N(e,i).map(e=>(0,A.jsxs)(`li`,{className:`ritual-timeline-step`,children:[(0,A.jsx)(`span`,{className:`ritual-timeline-name`,children:e.name}),(0,A.jsx)(`span`,{className:`ritual-timeline-time`,children:e.time})]},e.key))}),(0,A.jsx)(`div`,{className:`ritual-muted-hint`,children:d(i,`flow.install.expectedCompletion`)})]}),(0,A.jsx)(ae,{model:e}),(0,A.jsx)(`div`,{className:`ritual-card ritual-status-card`,children:d(i,e.downloadRequired?`flow.install.note`:`flow.install.note.ready`)}),(0,A.jsx)(`div`,{className:`ritual-local-note`,children:d(i,e.downloadRequired?`flow.install.local`:`flow.install.local.ready`)})]})]}),(0,A.jsxs)(`div`,{className:`ritual-button-row`,children:[(0,A.jsx)(_,{variant:`ghost`,onClick:t,disabled:s,children:d(i,`flow.install.back`)}),(0,A.jsx)(_,{variant:`outline`,onClick:r,disabled:s,children:d(i,`flow.install.later`)}),l===`done`?(0,A.jsx)(_,{onClick:n,children:d(i,`flow.install.enter`)}):(0,A.jsx)(_,{onClick:S,disabled:s||!e.supported,children:s?d(i,`flow.install.busy`):d(i,e.downloadRequired?`flow.install.start`:`flow.install.startReady`)})]})]})}function M(e,t){let n=e.estimatedFirstResponseSeconds;return!e.downloadRequired||e.estimatedDownloadMinutes===0?d(t,`flow.install.expected.ready`,{response:n}):e.estimatedDownloadMinutes===null?d(t,`flow.install.expected.unknown`,{response:n}):d(t,`flow.install.expected`,{download:d(t,`flow.recommend.minutes`,{count:e.estimatedDownloadMinutes}),response:n})}function N(e,t){let n=e.downloadRequired&&e.estimatedDownloadMinutes?d(t,`flow.install.timelineApprox`,{time:d(t,`flow.recommend.minutes`,{count:e.estimatedDownloadMinutes})}):d(t,`flow.install.timelineQuick`);return[{key:`download`,name:d(t,e.downloadRequired?`flow.install.timelineStep.download`:`flow.install.timelineStep.ready`),time:n},{key:`validate`,name:d(t,`flow.install.timelineStep.validate`),time:d(t,`flow.install.timelineQuick`)},{key:`load`,name:d(t,`flow.install.timelineStep.load`),time:d(t,`flow.install.timelineApprox`,{time:`${e.estimatedFirstResponseSeconds}s`})}]}function P(e){return/download|pull|weights/i.test(e)?`download`:/smoke|validate|verify|test/i.test(e)?`validate`:/load|ready/i.test(e)?`load`:/done|complete/i.test(e)?`done`:`install`}function F(e){return e===`install`?20:e===`download`?55:e===`load`?82:e===`validate`?94:e===`done`?100:8}function I(e,t,n){let r={install:d(n,`flow.install.prepare`),download:d(n,`flow.install.stage.download`),validate:d(n,`flow.install.stage.validate`),load:d(n,`flow.install.stage.load`),done:d(n,`flow.install.done`),idle:d(n,`flow.install.wait`),error:d(n,`flow.install.stage.error`)}[t];return V(String(e.user_message||e.message||r))}function L(e,t,n){return e===`download`&&!n.downloadRequired?d(t,`flow.install.step.ready`):d(t,`flow.install.step.${e}`)}function R(e){return`progress-${Math.max(0,Math.min(100,Math.round(e/10)*10))}`}function z(e,t){let n=[`idle`,`install`,`download`,`load`,`validate`,`done`],r=n.indexOf(e),i=n.indexOf(t);return e===`error`?`is-error`:e===`done`||r>i?`is-done`:e===t?`is-active`:``}function B(e){let t=k(e),n=f(t.recovery_guidance).map(V).filter(Boolean);return[V(String(t.user_message||t.reason||t.error||`The selected model could not be loaded.`)),...n.slice(0,2)].join(` `)}function V(e){return String(e||``).replace(/gemma4_unified/gi,`this model format`).replace(/mlx[-_ ]?vlm|mlx[-_ ]?lm|local_mlx|\bmlx\b|\bgguf\b|\bollama\b|huggingface|hugging face/gi,`local model support`).replace(/runtime/gi,`model support`).replace(/No module named ['\"][^'\"]+['\"]/gi,`A local support component is missing`).replace(/\s+/g,` `).trim()}function H(){let e=g(e=>e.language),t=g(e=>e.setLanguage);return(0,A.jsx)(`div`,{className:`language-switcher ritual-language`,"aria-label":d(e,`language.label`),children:[`ko`,`en`].map(n=>(0,A.jsx)(`button`,{type:`button`,className:e===n?`is-active`:``,onClick:()=>t(n),"aria-pressed":e===n,children:h[n]},n))})}var U=`lattice.productFlow.user`;function W(){try{let e=localStorage.getItem(U);return e?JSON.parse(e):null}catch{}return null}function G({onSuccess:e}){let t=g(e=>e.language),[n,r]=C.useState(()=>W()?.email||`you@local`),[i,a]=C.useState(``),[o,s]=C.useState(()=>W()?.name||`You`),[c,l]=C.useState(!1),[u,f]=C.useState(null);async function m(r){r.preventDefault();let a=n.trim(),s=i.trim(),c=o.trim()||a.split(`@`)[0]||`You`;if(!a||!s){f(d(t,`flow.login.missing`));return}l(!0),f(null);let u=W(),m=await p.login(a,s);if(!m.ok){if((await p.profile()).ok&&(!u?.email||u.email===a)){try{localStorage.setItem(U,JSON.stringify({email:a,name:c}))}catch{}l(!1),e();return}if(u?.email&&u.email!==a){l(!1),f(d(t,`flow.login.otherEmail`));return}if(u?.email===a){l(!1),f(d(t,`flow.login.wrongPassword`));return}(await p.register({email:a,password:s,name:c,nickname:c})).ok&&(m=await p.login(a,s))}if(!m.ok){l(!1),f(d(t,`flow.login.unavailable`));return}try{localStorage.setItem(U,JSON.stringify({email:a,name:c}))}catch{}l(!1),e()}return(0,A.jsx)(`div`,{className:`ritual-login`,children:(0,A.jsxs)(`div`,{className:`ritual-login-grid`,children:[(0,A.jsxs)(`div`,{className:`ritual-login-left`,children:[(0,A.jsx)(`p`,{className:`ritual-login-statement`,children:d(t,`flow.login.statement`)}),(0,A.jsx)(K,{})]}),(0,A.jsxs)(`div`,{className:`ritual-login-right`,children:[(0,A.jsxs)(`header`,{children:[(0,A.jsx)(`h1`,{id:`login-title`,className:`ritual-title`,children:d(t,`flow.login.title`)}),(0,A.jsx)(`p`,{className:`ritual-subtitle`,children:d(t,`flow.login.body`)})]}),(0,A.jsx)(`div`,{className:`ritual-login-card`,children:(0,A.jsxs)(`form`,{onSubmit:m,className:`ritual-form`,"aria-labelledby":`login-title`,children:[(0,A.jsxs)(`div`,{className:`ritual-field-stack`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{htmlFor:`login-name`,className:`ritual-field-label`,children:d(t,`flow.name`)}),(0,A.jsx)(v,{id:`login-name`,value:o,onChange:e=>s(e.target.value),placeholder:d(t,`flow.name.placeholder`),autoComplete:`name`})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{htmlFor:`login-email`,className:`ritual-field-label`,children:d(t,`flow.email`)}),(0,A.jsx)(v,{id:`login-email`,value:n,onChange:e=>r(e.target.value),type:`email`,placeholder:d(t,`flow.email.placeholder`),autoComplete:`email`,required:!0,"aria-invalid":u?!0:void 0,"aria-describedby":u?`login-error`:void 0})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{htmlFor:`login-password`,className:`ritual-field-label`,children:d(t,`flow.password`)}),(0,A.jsx)(v,{id:`login-password`,value:i,onChange:e=>a(e.target.value),type:`password`,placeholder:d(t,`flow.password.placeholder`),autoComplete:`current-password`,required:!0,"aria-invalid":u?!0:void 0,"aria-describedby":u?`login-error`:void 0})]})]}),u&&(0,A.jsx)(`div`,{id:`login-error`,className:`ritual-error`,role:`alert`,children:u}),(0,A.jsx)(_,{type:`submit`,disabled:c||!n.trim()||!i.trim(),className:`ritual-full-button`,children:c?d(t,`flow.login.busy`):d(t,`flow.login.submit`)}),(0,A.jsxs)(`div`,{className:`ritual-login-footnotes`,children:[(0,A.jsx)(`div`,{className:`ritual-muted-hint`,children:d(t,`flow.login.passwordLocal`)}),(0,A.jsx)(`div`,{className:`ritual-note`,children:d(t,`flow.login.note`)})]})]})})]})]})})}function K(){let e=g(e=>e.language);return(0,A.jsxs)(`aside`,{className:`ritual-promise is-quiet`,"aria-label":d(e,`flow.promise.aria`),children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`span`,{children:d(e,`flow.promise.memory.k`)}),(0,A.jsx)(`strong`,{children:d(e,`flow.promise.memory.v`)})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`span`,{children:d(e,`flow.promise.model.k`)}),(0,A.jsx)(`strong`,{children:d(e,`flow.promise.model.v`)})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`span`,{children:d(e,`flow.promise.ownership.k`)}),(0,A.jsx)(`strong`,{children:d(e,`flow.promise.ownership.v`)})]})]})}function q({status:e,reason:t,recommendations:n,analysis:a,onBack:o,onRetry:s,onSkipModel:c,onSelect:u}){let f=g(e=>e.language);if(e===`loading`)return(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`div`,{className:`ritual-title`,children:d(f,`flow.recommend.title`)}),(0,A.jsx)(`div`,{className:`ritual-subtitle`,children:d(f,`flow.recommend.body`)}),(0,A.jsxs)(`div`,{className:`ritual-scan-banner is-loading`,role:`status`,children:[(0,A.jsx)(`span`,{className:`ritual-scan-dot pulsing`}),(0,A.jsx)(`span`,{children:d(f,`flow.recommend.loading`)})]}),(0,A.jsxs)(`div`,{className:`ritual-action-row`,children:[(0,A.jsx)(_,{variant:`ghost`,onClick:o,children:d(f,`flow.recommend.back`)}),(0,A.jsx)(_,{variant:`outline`,onClick:c,children:d(f,`flow.recommend.skip`)})]})]});if(e===`unavailable`){let e=t===`no_supported_model`?`flow.recommend.unavailable.empty`:`flow.recommend.unavailable.probe`;return(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`div`,{className:`ritual-title`,children:d(f,`flow.recommend.title`)}),(0,A.jsx)(`section`,{className:`ritual-card ritual-error-card ritual-unavailable-card`,role:`alert`,"aria-label":d(f,`flow.recommend.unavailable.aria`),children:(0,A.jsxs)(`div`,{className:`ritual-inline-row`,children:[(0,A.jsx)(l,{className:`ritual-core-icon`,"aria-hidden":`true`}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`div`,{className:`ritual-strong-text`,children:d(f,`flow.recommend.unavailable.title`)}),(0,A.jsx)(`div`,{className:`ritual-muted-text`,children:d(f,e)})]})]})}),(0,A.jsxs)(`div`,{className:`ritual-button-row ritual-button-row-primary`,children:[(0,A.jsxs)(`button`,{type:`button`,className:`ritual-full-button ritual-full-button-primary`,onClick:s,children:[(0,A.jsx)(i,{size:16}),` `,d(f,`flow.recommend.unavailable.retry`)]}),(0,A.jsx)(`button`,{type:`button`,className:`ritual-secondary-button`,onClick:c,children:d(f,`flow.recommend.skip`)})]}),(0,A.jsxs)(`div`,{className:`ritual-action-row`,children:[(0,A.jsx)(_,{variant:`ghost`,onClick:o,children:d(f,`flow.recommend.back`)}),(0,A.jsx)(`div`,{className:`ritual-muted-hint`,children:d(f,`flow.recommend.unavailable.hint`)})]})]})}let p=n;function m(e,t){if(!e)return(0,A.jsxs)(`div`,{className:`ritual-scan-banner is-loading`,children:[(0,A.jsx)(`span`,{className:`ritual-scan-dot pulsing`}),(0,A.jsx)(`span`,{children:d(t,`flow.analysis.checking`)})]});let n=k(e.recommendations?.recommendations),r=k(e.setup?.environment),i=k(e.recommendations?.profile),a={...r,...i},o=Number(n.ram_gb||Number(a.ram_mb||0)/1024||0);return n.apple_silicon||String(a.arch||``).includes(`arm`)?(0,A.jsxs)(`div`,{className:`ritual-scan-banner is-success`,children:[(0,A.jsx)(`span`,{className:`ritual-scan-dot is-success`}),(0,A.jsx)(`span`,{children:d(t,`flow.recommend.environment.apple`,{ram:Math.round(o)})})]}):(0,A.jsxs)(`div`,{className:`ritual-scan-banner is-warning`,children:[(0,A.jsx)(`span`,{className:`ritual-scan-dot is-warning`}),(0,A.jsx)(`span`,{children:d(t,`flow.recommend.environment.standard`,{ram:Math.round(o)})})]})}return(0,A.jsxs)(`div`,{className:`ritual-recommend`,children:[(0,A.jsxs)(`header`,{children:[(0,A.jsx)(`h1`,{className:`ritual-title`,children:d(f,`flow.recommend.title`)}),(0,A.jsx)(`p`,{className:`ritual-subtitle`,children:d(f,`flow.recommend.body`)}),(0,A.jsx)(`p`,{className:`ritual-muted-hint`,children:d(f,`flow.recommend.embedHint`)}),(0,A.jsx)(`div`,{className:`ritual-env-line`,children:m(a,f)})]}),p[0]?(0,A.jsxs)(`section`,{className:`ritual-primary-hero-card`,"aria-labelledby":`recommend-primary-name`,children:[(0,A.jsxs)(`div`,{className:`ritual-hero-topline`,children:[(0,A.jsxs)(`span`,{className:`ritual-hero-rank`,children:[(0,A.jsx)(x,{size:16,"aria-hidden":`true`}),Z(p[0].role,0,f)]}),(0,A.jsx)(`span`,{className:`ritual-hero-size`,children:p[0].size||d(f,`flow.recommend.sizeReady`)})]}),(0,A.jsx)(`h2`,{id:`recommend-primary-name`,className:`ritual-hero-name`,children:p[0].shortName}),(0,A.jsxs)(`p`,{className:`ritual-hero-reason`,children:[p[0].reason,X(p[0].role,f)?(0,A.jsxs)(`span`,{className:`ritual-model-comparison`,children:[` `,X(p[0].role,f)]}):null]}),(0,A.jsxs)(`p`,{className:`ritual-hero-time`,children:[(0,A.jsx)(`span`,{className:`ritual-time-estimate`,children:Y(p[0],f)}),(0,A.jsx)(`span`,{className:`ritual-time-note`,children:d(f,`flow.recommend.timeNote`)})]}),p[0].supported?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(_,{onClick:()=>u(p[0]),className:`ritual-primary-model-button`,children:[d(f,`flow.recommend.primary`),` `,(0,A.jsx)(r,{size:18,"aria-hidden":`true`})]}),(0,A.jsxs)(`p`,{className:`ritual-hero-next`,children:[oe(p[0],f),` · `,d(f,p[0].downloadRequired?`flow.recommend.nextHint`:`flow.recommend.nextHint.ready`)]})]}):(0,A.jsx)(`p`,{className:`ritual-model-warning`,children:d(f,`flow.recommend.unsupported`)})]}):null,p.length>1?(0,A.jsxs)(`details`,{className:`ritual-alternatives-details`,children:[(0,A.jsx)(`summary`,{id:`recommend-alternatives`,className:`ritual-alternatives-title cursor-pointer`,children:(0,A.jsx)(`h2`,{className:`inline text-sm font-semibold`,children:d(f,`flow.recommend.alternatives`)})}),(0,A.jsx)(`div`,{className:`ritual-alt-list`,children:p.slice(1,3).map((e,t)=>{let n=e.role===`faster`?S:y;return(0,A.jsxs)(`button`,{type:`button`,className:`ritual-model-card is-compact`,onClick:()=>e.supported&&u(e),disabled:!e.supported,children:[(0,A.jsxs)(`span`,{className:`ritual-model-heading`,children:[(0,A.jsx)(n,{size:15,"aria-hidden":`true`}),(0,A.jsx)(`span`,{className:`role`,children:Z(e.role,t+1,f)}),(0,A.jsx)(`span`,{className:`ritual-alt-size`,children:e.size||d(f,`flow.recommend.sizeReady`)})]}),(0,A.jsx)(`span`,{className:`name`,children:e.shortName}),(0,A.jsx)(`span`,{className:`reason`,children:e.reason}),(0,A.jsxs)(`span`,{className:`ritual-alt-footer`,children:[(0,A.jsx)(`span`,{className:`ritual-time-estimate`,children:Y(e,f)}),e.supported?(0,A.jsxs)(`span`,{className:`ritual-model-choose`,children:[d(f,`flow.recommend.choose`),` `,(0,A.jsx)(r,{size:14,"aria-hidden":`true`})]}):(0,A.jsx)(`span`,{className:`ritual-model-warning`,children:d(f,`flow.recommend.unsupported`)})]})]},`${e.role}-${e.id}`)})})]}):null,(0,A.jsxs)(`footer`,{className:`ritual-action-row is-split`,children:[(0,A.jsx)(_,{variant:`ghost`,onClick:o,children:d(f,`flow.recommend.back`)}),(0,A.jsxs)(`span`,{className:`ritual-action-tail`,children:[(0,A.jsx)(`span`,{className:`ritual-muted-hint`,children:d(f,`flow.recommend.hint`)}),(0,A.jsx)(_,{variant:`outline`,onClick:c,children:d(f,`flow.recommend.skip`)})]})]})]})}function J(e,t){return d(t,`flow.recommend.minutes`,{count:e})}function Y(e,t){let n=e.estimatedFirstResponseSeconds;return!e.downloadRequired||e.estimatedDownloadMinutes===0?d(t,`flow.recommend.timeEstimate.ready`,{response:n}):e.estimatedDownloadMinutes===null?d(t,`flow.recommend.timeEstimate.unknown`,{response:n}):d(t,`flow.recommend.timeEstimate`,{download:J(e.estimatedDownloadMinutes,t),response:n})}function oe(e,t){return!e.downloadRequired||e.estimatedDownloadMinutes===0?d(t,`flow.recommend.primaryNote.ready`):e.estimatedDownloadMinutes===null?d(t,`flow.recommend.primaryNote.unknown`):d(t,`flow.recommend.primaryNote`,{time:J(e.estimatedDownloadMinutes,t)})}function X(e,t){return e===`faster`?d(t,`flow.recommend.comparison.faster`):e===`advanced`?d(t,`flow.recommend.comparison.advanced`):``}function Z(e,t,n){return e===`best`?d(n,`flow.recommend.rank.best`):e===`faster`?d(n,`flow.recommend.rank.faster`):e===`advanced`?d(n,`flow.recommend.rank.advanced`):d(n,`flow.recommend.rank.choice`,{index:t+1})}function se({onComplete:e}){let t=g(e=>e.language),[n,r]=C.useState(`wake`),[i,o]=C.useState(null),[s,c]=C.useState(null),[l,u]=C.useState(0),[f,m]=C.useState(null),h=C.useMemo(()=>te({analysis:i,endpoints:s}),[i,s]);C.useEffect(()=>{let e=!1;async function t(){let[t,n,r,i]=await Promise.all([p.setupScan(),p.modelRecommendations(`local_mlx`),p.models(),p.sysinfo()]);e||(o({setup:t.ok?t.data:null,recommendations:n.ok?n.data:null,models:r.ok?r.data:null,sysinfo:i.ok?i.data:null}),c({setup:t.ok,recommendations:n.ok,models:r.ok,sysinfo:i.ok}))}return t(),()=>{e=!0}},[l]);let _=C.useCallback(()=>{o(null),c(null),u(e=>e+1)},[]);return(0,A.jsx)(`div`,{className:`ritual-shell`,children:(0,A.jsxs)(`main`,{className:`ritual-container`,"aria-label":d(t,`flow.shell`),children:[(0,A.jsx)(H,{}),(0,A.jsxs)(`div`,{className:`ritual-brain`,"data-scale":n===`wake`?`hero`:`mark`,children:[(0,A.jsx)(a,{state:le(n),intensity:n===`install`?.92:.7,size:`large`,showLabel:!1}),(0,A.jsx)(`div`,{className:`ritual-edition`,title:d(t,`brain.edition.tip`),children:d(t,`brain.edition`)})]}),n===`wake`&&(0,A.jsx)(Q,{onWake:()=>r(`login`),onUseExisting:()=>$(e)}),n===`login`&&(0,A.jsx)(G,{onSuccess:()=>r(`recommend`)}),n===`recommend`&&(0,A.jsx)(q,{status:h.status,reason:h.reason,recommendations:h.recommendations,analysis:i,onBack:()=>r(`login`),onRetry:_,onSkipModel:()=>$(e),onSelect:e=>{m(e),r(`install`)}}),n===`install`&&(0,A.jsx)(j,{model:ce(f,h.recommendations),onBack:()=>r(`recommend`),onComplete:()=>$(e),onLater:()=>$(e)})]})})}function Q({onWake:e,onUseExisting:t}){let n=g(e=>e.language),i=[{icon:b,label:d(n,`flow.wake.value.local.k`),body:d(n,`flow.wake.value.local.v`)},{icon:S,label:d(n,`flow.wake.value.instant.k`),body:d(n,`flow.wake.value.instant.v`)},{icon:s,label:d(n,`flow.wake.value.brain.k`),body:d(n,`flow.wake.value.brain.v`)}];return(0,A.jsxs)(`section`,{className:`ritual-wake`,"aria-label":d(n,`flow.wake.aria`),children:[(0,A.jsx)(`div`,{className:`ritual-title`,children:d(n,`flow.wake.title`)}),(0,A.jsx)(`div`,{className:`ritual-subtitle`,children:d(n,`flow.wake.body`)}),(0,A.jsx)(`div`,{className:`ritual-value-grid`,"aria-label":d(n,`flow.wake.value.aria`),children:i.map(e=>{let t=e.icon;return(0,A.jsxs)(`div`,{className:`ritual-value-card`,children:[(0,A.jsxs)(`div`,{className:`ritual-value-label`,children:[(0,A.jsx)(t,{size:14}),` `,e.label]}),(0,A.jsx)(`div`,{className:`ritual-value-body`,children:e.body})]},e.label)})}),(0,A.jsxs)(`div`,{className:`ritual-wake-plan`,"aria-label":d(n,`flow.wake.plan.aria`),children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`span`,{children:`1`}),(0,A.jsx)(`strong`,{children:d(n,`flow.wake.step.identity`)})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`span`,{children:`2`}),(0,A.jsx)(`strong`,{children:d(n,`flow.wake.step.check`)})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`span`,{children:`3`}),(0,A.jsx)(`strong`,{children:d(n,`flow.wake.step.voice`)})]})]}),(0,A.jsxs)(`div`,{className:`ritual-button-row ritual-button-row-primary`,children:[(0,A.jsxs)(`button`,{type:`button`,className:`ritual-full-button ritual-full-button-primary`,onClick:e,children:[d(n,`flow.wake.primary`),` `,(0,A.jsx)(r,{size:18})]}),(0,A.jsx)(`button`,{type:`button`,className:`ritual-secondary-button`,onClick:t,children:d(n,`flow.wake.existing`)})]}),(0,A.jsx)(`div`,{className:`ritual-start-note`,children:d(n,`flow.wake.startNote`)})]})}function $(e){c(),e()}function ce(e,t){return e||t[0]||ne()}function le(e){return e===`wake`?`idle`:e===`analysis`?`listening`:e===`recommend`?`recalling`:e===`install`?`thinking`:`idle`}export{se as ProductFlow};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{n as r}from"./QueryClientProvider-B3OjqSyJ.js";import{t as i}from"./useMutation-
|
|
1
|
+
import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{n as r}from"./QueryClientProvider-B3OjqSyJ.js";import{t as i}from"./useMutation-Bi0PXQMC.js";import{a,t as o,v as s}from"./primitives-B6DzQC3H.js";import{A as c,R as l,S as u,p as d,v as f,z as p}from"./index-DCT79wzR.js";import{t as m}from"./button-xXPeemQr.js";import{t as h}from"./input-D3YrgxvO.js";var g=l(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),_=e(t()),v=400,y=40,b=400;function x(e){return new TextEncoder().encode(e).length}async function S(e){let t=globalThis.crypto?.subtle;if(!t)return``;let n=await t.digest(`SHA-256`,new TextEncoder().encode(e));return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}function C(e,t,n){let r=[`--- a/${n}`,`+++ b/${n}`],i=e.length?e.split(`
|
|
2
2
|
`):[],a=t.length?t.split(`
|
|
3
3
|
`):[];if(i.length>b||a.length>b)return[...r,...i.map(e=>`-${e}`),...a.map(e=>`+${e}`)].slice(0,v);let o=i.length,s=a.length,c=Array.from({length:o+1},()=>new Uint32Array(s+1));for(let e=o-1;e>=0;--e)for(let t=s-1;t>=0;--t)c[e][t]=i[e]===a[t]?c[e+1][t+1]+1:Math.max(c[e+1][t],c[e][t+1]);let l=[],u=0,d=0;for(;u<o&&d<s;)i[u]===a[d]?(u+=1,d+=1):c[u+1][d]>=c[u][d+1]?(l.push(`-${i[u]}`),u+=1):(l.push(`+${a[d]}`),d+=1);for(;u<o;)l.push(`-${i[u++]}`);for(;d<s;)l.push(`+${a[d++]}`);return l.length?[...r,...l].slice(0,v):[]}async function w(e){let t=await f.proposalDetail(e);if(!t.ok)throw Error(t.error||`HTTP ${t.status}`);let n=t.data,r=d(n.payload)?n.payload:{},i=typeof r.path==`string`?r.path:``,a=typeof n.kind==`string`&&n.kind?n.kind:`file_update`;if(!i)throw Error(`proposal payload has no path`);let o=typeof r.new_content==`string`?r.new_content:``,s=await f.readWorkspaceFile(i);if(!s.ok&&s.status!==404)throw Error(s.error||`HTTP ${s.status}`);let c=s.ok,l=s.ok?s.data.content:``;if(a===`file_update`&&c&&l===o)return await f.rejectProposal(e,`rebase: content already applied`),`already_applied`;if(a===`file_delete`&&!c)return await f.rejectProposal(e,`rebase: file already deleted`),`already_applied`;let u=a===`file_delete`?``:o,p=C(l,u,i),m=c?await S(l):``,h=await f.createReviewItem({title:typeof n.title==`string`&&n.title?n.title:i,summary:typeof n.summary==`string`?n.summary:``,source:`change_proposal`,kind:a,payload:{path:i,diff:p,...a===`file_delete`?{}:{new_content:o},tier:a===`file_delete`?`large`:p.length<=y?`small`:`large`,before_bytes:x(l),after_bytes:x(u),...m||!c?{base_exists:c,base_sha256:m}:{}},provenance:{proposed_by:`user_rebase`,reason:`rebased_from:${e}`,source_detail:`proposal_conflict_rebase`}});if(!h.ok)throw Error(h.error||`HTTP ${h.status}`);let g=String(h.data.id||``);return await f.rejectProposal(e,g?`rebased_to:${g}`:`rebased`),`rebased`}var T=n();function E({language:e,itemId:t,onResolved:n}){let a=r(),[o,s]=_.useState(null),l=i({mutationFn:()=>w(t),onSuccess:async e=>{s(e),await Promise.all([a.invalidateQueries({queryKey:[`pendingProposals`]}),a.invalidateQueries({queryKey:[`proposalCounts`]}),a.invalidateQueries({queryKey:[`automationReviews`]}),a.invalidateQueries({queryKey:[`reviewItems`]})]),n?.(e)}});return(0,T.jsxs)(`div`,{className:`proposal-conflict-note`,role:`alert`,"data-testid":`proposal-conflict-note`,children:[(0,T.jsxs)(`div`,{className:`proposal-conflict-head`,children:[(0,T.jsx)(g,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,T.jsx)(`strong`,{children:u(e,`proposals.conflict.title`)})]}),(0,T.jsx)(`p`,{children:u(e,`proposals.conflict.detail`)}),o===`rebased`?(0,T.jsx)(`p`,{className:`proposal-conflict-done`,role:`status`,children:u(e,`proposals.conflict.rebased`)}):o===`already_applied`?(0,T.jsx)(`p`,{className:`proposal-conflict-done`,role:`status`,children:u(e,`proposals.conflict.alreadyApplied`)}):(0,T.jsxs)(`button`,{type:`button`,className:`proposal-conflict-rebase`,disabled:l.isPending,onClick:()=>l.mutate(),children:[(0,T.jsx)(c,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),l.isPending?u(e,`proposals.conflict.rebasing`):u(e,`proposals.conflict.rebase`)]}),l.isError?(0,T.jsx)(`small`,{className:`proposal-conflict-error`,children:u(e,`proposals.conflict.failed`,{reason:l.error instanceof Error?l.error.message:String(l.error)})}):null]})}var D=[{id:`pending`,labelKey:`review.filter.status.pending`},{id:`snoozed`,labelKey:`review.filter.status.snoozed`},{id:`all`,labelKey:`review.filter.status.all`},{id:`approved`,labelKey:`review.filter.status.approved`},{id:`dismissed`,labelKey:`review.filter.status.dismissed`}],O=[{id:`all`,labelKey:`review.filter.source.all`},{id:`workflow_run`,labelKey:`review.filter.source.workflow_run`},{id:`trigger`,labelKey:`review.filter.source.trigger`},{id:`kg_change_digest`,labelKey:`review.filter.source.kg_change_digest`},{id:`chat_followup`,labelKey:`review.filter.source.chat_followup`},{id:`agent_followup`,labelKey:`review.filter.source.agent_followup`},{id:`change_proposal`,labelKey:`review.filter.source.change_proposal`}];function k(e){return e===`pending`?`warning`:e===`snoozed`?`muted`:e===`approved`?`success`:e===`dismissed`?`danger`:`muted`}var A={pending:`review.itemStatus.pending`,snoozed:`review.itemStatus.snoozed`,approved:`review.itemStatus.approved`,dismissed:`review.itemStatus.dismissed`};function j(e,t){let n=A[t];return n?u(e,n):t}var M={workflow_run:`review.source.workflow_run`,trigger:`review.source.trigger`,kg_change_digest:`review.source.kg_change_digest`,chat_followup:`review.source.chat_followup`,agent_followup:`review.source.agent_followup`,change_proposal:`review.source.change_proposal`};function N(e,t){let n=t?M[t]:void 0;return n?u(e,n):t||u(e,`review.source.automation`)}function P(e,t,n){let r=t.source_detail;if(r!=null&&String(r).trim())return String(r);let i=t.trigger_id;return i!=null&&String(i).trim()?String(i):N(e,n)}var F={read:`review.risk.read`,write:`review.risk.write`,write_scoped:`review.risk.write_scoped`,exec:`review.risk.exec`,destructive:`review.risk.destructive`};function I(e,t){let n=typeof t==`string`?t.trim():``;if(!n)return``;let r=F[n];return r?u(e,r):n}var L={read:`review.change.read`,additive:`review.change.additive`,mutation:`review.change.mutation`,destructive:`review.change.destructive`,exec:`review.change.exec`};function R(e,t){let n=typeof t==`string`?t.trim():``;if(!n)return``;let r=L[n];return r?u(e,r):n}function z(){let e=new Date;return e.setDate(e.getDate()+1),e.toISOString()}function B(e,t){if(!t)return u(e,`review.snoozed.badge`);let n=new Date(t);return Number.isNaN(n.getTime())?u(e,`review.snoozed.until`,{value:t}):u(e,`review.snoozed.until`,{value:new Intl.DateTimeFormat(e===`ko`?`ko-KR`:`en-US`,{dateStyle:`medium`,timeStyle:`short`}).format(n)})}function V(e){return e.effective_status===`pending`||e.effective_status===`snoozed`}function H(e){let t=e.payload||{},n=e.provenance||{};return!!(t.last_run_id||n.run_id)}var U=24;function W({language:e,diff:t,path:n,className:r=``}){if(!t.length)return null;let i=t.slice(0,U),a=t.length-i.length;return(0,T.jsxs)(`figure`,{className:`m-0 grid gap-1 ${r}`,children:[(0,T.jsxs)(`figcaption`,{className:`flex flex-wrap items-baseline gap-2 text-xs text-muted-foreground`,children:[(0,T.jsx)(`strong`,{className:`font-medium text-foreground`,children:u(e,`proposals.diff.header`)}),n?(0,T.jsx)(`code`,{className:`break-all`,children:n}):null]}),(0,T.jsx)(`pre`,{className:`pending-proposal-diff`,"aria-label":u(e,`proposals.diff`),children:i.map((e,t)=>(0,T.jsx)(`span`,{className:`block ${G(e)}`,children:e||` `},t))}),a>0?(0,T.jsx)(`small`,{className:`text-xs text-muted-foreground`,children:u(e,`proposals.diff.more`,{count:a})}):null]})}function G(e){return/^\+(?!\+\+)/.test(e)?`text-success`:/^-(?!--)/.test(e)?`text-destructive`:``}function K({item:e,feedback:t,onAction:n}){let r=p(e=>e.mode),i=p(e=>e.language),[l,d]=_.useState(``),f=_.useId(),g=e.provenance||{},v=e.payload||{},y=H(e),b=e.effective_status===`snoozed`,x=V(e),S=e.source===`change_proposal`,C=e.source!==`chat_followup`&&e.source!==`agent_followup`&&!S,w=Array.isArray(v.diff)?v.diff:[],D=String(v.tier||`small`),O=typeof v.path==`string`&&v.path.trim()?v.path:void 0,A=I(i,g.risk),M=R(i,g.change_class),F=typeof g.tool==`string`&&g.tool.trim()?g.tool:``,L=typeof g.proposed_by==`string`&&g.proposed_by.trim()?g.proposed_by:``,z=r!==`basic`,U=!!(S&&w.length>0||b||A||M||F||L||z);return(0,T.jsxs)(`article`,{"aria-labelledby":f,className:`review-card`,children:[(0,T.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-border/40 pb-3`,children:[(0,T.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,T.jsx)(`h3`,{id:f,className:`font-bold text-base text-foreground`,children:e.title}),e.summary?(0,T.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:e.summary}):null]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 shrink-0`,children:[(0,T.jsx)(s,{variant:`muted`,className:`text-xs`,children:N(i,e.source)}),S?(0,T.jsx)(s,{variant:`muted`,className:`text-xs`,children:u(i,e.kind===`file_delete`?`proposals.kind.delete`:D===`large`?`proposals.tier.large`:`proposals.tier.small`)}):null,(0,T.jsx)(s,{variant:k(e.effective_status),className:`text-xs font-semibold`,children:j(i,e.effective_status)})]})]}),(0,T.jsxs)(`div`,{className:`grid items-start gap-5 ${U?`md:grid-cols-12`:``}`,children:[(0,T.jsxs)(`div`,{className:U?`md:col-span-7 space-y-3`:`hidden`,children:[S&&w.length>0?(0,T.jsx)(`div`,{className:`rounded-lg border border-border/60 bg-muted/20 p-3 max-h-64 overflow-y-auto`,children:(0,T.jsx)(W,{language:i,diff:w,path:O})}):null,b?(0,T.jsxs)(`div`,{className:`review-card-snooze`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`review-card-snooze-title`,children:B(i,e.snoozed_until)}),(0,T.jsx)(`p`,{className:`text-muted-foreground text-[11px]`,children:u(i,`review.snoozed.detail`)})]}),(0,T.jsxs)(m,{size:`sm`,variant:`outline`,onClick:()=>n(e,`unsnooze`),disabled:!x,className:`h-7 text-xs`,children:[(0,T.jsx)(c,{className:`h-3 w-3 mr-1`}),` `,u(i,`review.unsnooze`)]})]}):null,A||M||F||L?(0,T.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-muted/10 p-3 space-y-2 text-xs`,children:[M||A?(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[M?(0,T.jsx)(s,{variant:`muted`,className:`text-[10px]`,children:M}):null,A?(0,T.jsx)(s,{variant:`muted`,className:`text-[10px]`,children:A}):null]}):null,F?(0,T.jsxs)(`p`,{className:`m-0 text-muted-foreground`,children:[(0,T.jsx)(`span`,{className:`font-semibold text-foreground`,children:u(i,`review.summary.tool`)}),` · `,F]}):null,L?(0,T.jsxs)(`p`,{className:`m-0 text-muted-foreground`,children:[(0,T.jsx)(`span`,{className:`font-semibold text-foreground`,children:u(i,`review.summary.proposedBy`)}),` · `,L]}):null]}):null,z?(0,T.jsxs)(`details`,{className:`rounded-lg border border-border/50 text-xs`,children:[(0,T.jsx)(`summary`,{className:`cursor-pointer select-none p-2.5 font-medium text-muted-foreground hover:text-foreground`,children:u(i,`review.technical.title`)}),(0,T.jsx)(`div`,{className:`p-3 pt-0`,children:(0,T.jsx)(a,{data:{workflow:g.workflow_id,trigger:g.trigger_id,run:v.last_run_id||g.run_id,...S?{path:v.path}:{},source_detail:P(i,g,e.source),snoozed_until:e.snoozed_until,created_at:e.created_at,updated_at:e.updated_at},limit:S?12:8})})]}):null]}),(0,T.jsxs)(`div`,{className:`rounded-xl border border-border/80 bg-muted/20 p-4 space-y-3 ${U?`md:col-span-5`:``}`,children:[(0,T.jsx)(`h4`,{className:`text-xs font-bold tracking-wide text-muted-foreground`,children:u(i,`review.decision.title`)}),x?(0,T.jsxs)(`div`,{className:`space-y-3`,children:[(0,T.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:u(i,C?`review.runNow.detail`:S?`review.proposal.detail`:e.source===`agent_followup`?`review.agent.detail`:`review.chat.detail`)}),S?(0,T.jsx)(h,{value:l,onChange:e=>d(e.target.value),placeholder:u(i,`review.proposal.rejectReason`),"aria-label":u(i,`review.proposal.rejectReason`),className:`text-xs h-8`}):null,(0,T.jsxs)(`div`,{className:`flex flex-col gap-2 pt-1`,role:`group`,"aria-label":u(i,`review.actions.aria`),children:[(0,T.jsxs)(`div`,{className:`flex gap-2`,children:[(0,T.jsx)(o,{label:u(i,S?`proposals.approve`:`review.approve`),action:()=>n(e,`approve`),invalidate:[]}),(0,T.jsx)(o,{label:u(i,S?`proposals.reject`:`review.dismiss`),action:()=>n(e,`dismiss`,!1,S?l:void 0),invalidate:[],variant:`destructive`})]}),(0,T.jsxs)(`div`,{className:`flex gap-2`,children:[C?(0,T.jsx)(o,{label:u(i,`review.runNow`),successLabel:y?u(i,`review.regenerated`):u(i,`review.executed`),action:()=>n(e,`run_now`,y),invalidate:[]}):null,b?null:(0,T.jsx)(o,{label:u(i,`review.snoozeDay`),action:()=>n(e,`snooze`),invalidate:[]})]})]})]}):(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:j(i,e.effective_status)}),t?.conflict&&S?(0,T.jsx)(E,{language:i,itemId:e.id}):t?(0,T.jsxs)(`p`,{className:`review-card-feedback ${t.tone===`error`?`is-error`:`is-ok`}`,children:[t.message,` - `,u(i,`review.feedback.open`),t.detail&&t.detail!==t.message?(0,T.jsx)(`span`,{className:`mt-0.5 block text-[11px] opacity-75`,children:t.detail}):null]}):null]})]})]})}export{D as a,O as i,K as n,E as o,z as r,W as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./jsx-runtime-bzQ4Vb5N.js";import{i as n,n as r,t as i,v as a}from"./primitives-
|
|
1
|
+
import{n as e,t}from"./jsx-runtime-bzQ4Vb5N.js";import{i as n,n as r,t as i,v as a}from"./primitives-B6DzQC3H.js";import{H as o,S as s,c,h as l,v as u,z as d}from"./index-DCT79wzR.js";import"./workspace-BsxrRYQI.js";import{a as f,i as p,n as m,r as h,t as g}from"./actHelpers-6MYDH2kW.js";e();var _=t();function v(){let e=d(e=>e.mode),t=d(e=>e.language),a=o({queryKey:[`agentRuntime`],queryFn:u.agentRuntime}),p=o({queryKey:[`workflowRuns`],queryFn:u.workflowRuns}),m=o({queryKey:[`activityRuns`],queryFn:()=>u.activityRuns(20)}),h=o({queryKey:[`permissions`],queryFn:u.permissionsPending}),g=c((m.data?.data||m.data)?.runs),v=c(a.data?.data?.runs),x=c(p.data?.data?.runs),S=g.length>0?g:[...v.map(e=>({...e,source:`agent`})),...x.map(e=>({...e,source:`workflow`}))];return(0,_.jsxs)(`div`,{className:`space-y-6`,children:[(0,_.jsx)(r,{title:s(t,`act.panel.approvalInbox`),result:h.data,className:`is-attention`,children:r=>{let a=r.pending||{},o=Object.entries(a);return o.length?(0,_.jsx)(`div`,{className:`grid gap-3`,children:o.map(([n,r],a)=>(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4 rounded-lg border border-amber-500/30 bg-card p-4 shadow-sm`,children:[(0,_.jsxs)(`div`,{className:`space-y-1`,children:[(0,_.jsxs)(`div`,{className:`font-semibold text-sm flex items-center gap-2`,children:[(0,_.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-amber-500`,"aria-hidden":`true`}),e===`basic`?s(t,`act.approval.request`,{index:a+1}):l(n,16)]}),(0,_.jsx)(`div`,{className:`mt-1`,children:(0,_.jsx)(y,{data:r||{},language:t})})]}),(0,_.jsxs)(`div`,{className:`flex gap-2`,children:[(0,_.jsx)(i,{label:s(t,`act.action.approve`),action:()=>u.approvePermission(n),invalidate:[`permissions`]}),(0,_.jsx)(i,{label:s(t,`act.action.deny`),action:()=>u.denyPermission(n),invalidate:[`permissions`],variant:`destructive`})]})]},n))}):(0,_.jsx)(n,{items:[]})}}),(0,_.jsx)(f,{language:t}),(0,_.jsx)(r,{title:s(t,`act.panel.combinedRuns`),result:m.data?.ok===!1?a.data:m.data,children:()=>(0,_.jsx)(b,{runs:S,kind:`combined`})})]})}function y({data:e,language:t}){let n=g(e,t),r=m(e.path,e.target,e.file,e.resource),i=r?r.split(`/`).pop()||r:``,o=m(e.user_email,e.requested_by,e.actor),c=m(e.reason,e.purpose,e.explanation);return(0,_.jsxs)(`div`,{className:`space-y-1.5 text-sm`,children:[(0,_.jsxs)(`div`,{className:`font-medium text-foreground flex flex-wrap items-center gap-2`,children:[(0,_.jsx)(a,{variant:`warning`,children:n}),r?(0,_.jsx)(`code`,{className:`bg-muted px-1.5 py-0.5 rounded text-xs break-all`,title:r,children:(0,_.jsx)(`strong`,{children:i})}):null]}),c?(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c}):null,o?(0,_.jsxs)(`p`,{className:`text-[11px] text-muted-foreground/80`,children:[s(t,`act.approval.requestedBy`),`: `,o]}):null]})}function b({runs:e,kind:t}){let r=d(e=>e.mode),o=d(e=>e.language);return e.length?(0,_.jsx)(`div`,{className:`grid gap-2`,children:e.slice(0,10).map((e,n)=>{let c=String(e.run_id||e.id),d=String(e.status||``),f=p(d,o),m=e.source===`workflow`||t===`workflow`||!!e.workflow_id,g=h(e)||(r===`basic`?s(o,`act.run.fallbackName`,{index:n+1}):l(c,18)),v=/^(ok|retried_ok|succeed(?:ed)?|complet(?:e|ed)?)$/i.test(d),y=d===`awaiting_approval`||d===`waiting_approval`;return(0,_.jsxs)(`div`,{className:`rounded-md border border-border bg-background p-3`,children:[(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,_.jsxs)(`div`,{className:`font-medium flex items-center gap-2`,children:[(0,_.jsx)(a,{variant:`muted`,children:m?s(o,`act.tab.recipes`):s(o,`act.tab.goals`)}),(0,_.jsx)(`span`,{children:g})]}),(0,_.jsx)(a,{variant:v?`success`:y?`warning`:`muted`,children:f})]}),r===`basic`?null:(0,_.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:l(c,18)}),(0,_.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,_.jsx)(i,{label:s(o,`act.action.stop`),action:()=>m?u.stopWorkflowRun(c):u.stopAgentRun(c)}),y&&m?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(i,{label:s(o,`act.action.resumeApproved`),action:()=>u.resumeWorkflowRun(c,!0)}),(0,_.jsx)(i,{label:s(o,`act.action.resumeDenied`),action:()=>u.resumeWorkflowRun(c,!1),variant:`destructive`})]}):null]})]},c)})}):(0,_.jsx)(n,{items:[]})}export{v as RunsListPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{n as r}from"./QueryClientProvider-B3OjqSyJ.js";import{t as i}from"./useMutation-B8QKq2NW.js";import{_ as a,a as o,c as s,d as c,g as l,h as u,i as d,l as f,m as p,n as m,p as h,r as g,s as _,t as v,u as y,v as b,y as x}from"./primitives-BDryQl6H.js";import{t as S}from"./circle-check-BxaDWjPR.js";import{a as C,i as w,n as T,r as E,t as D}from"./permissionCopy-B23r24oX.js";import{t as O}from"./shield-alert-CfyRO1p0.js";import{F as k,H as A,R as j,S as M,c as N,h as P,k as F,o as ee,p as I,t as te,v as L,y as R,z}from"./index-CfeqZ9Ri.js";import{t as B}from"./button-BA0N_zId.js";import{t as V}from"./input-CFfCfMjO.js";import"./workspace-BmfVs66W.js";var ne=j(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),H=j(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),U=e(t()),W=n(),re={low:`success`,medium:`warning`,high:`danger`};function G(e,t){return t===`ko`&&e.label_ko||e.label}function K(e,t){return t===`ko`&&e.summary_ko||e.summary}function q(e,t){return t===`ko`&&e.warning_ko||e.warning||``}function ie(){let e=r(),t=z(e=>e.language),[n,o]=U.useState(null),[s,c]=U.useState(!1),[d,f]=U.useState(``),m=A({queryKey:[`networkBoundary`],queryFn:L.networkBoundary}),_=A({queryKey:[`cloudStatus`],queryFn:L.cloudStatus}),v=i({mutationFn:e=>L.setNetworkBoundary(e.mode,e.ack),onSuccess:t=>{t.ok&&(e.invalidateQueries({queryKey:[`networkBoundary`]}),o(null),c(!1))}}),y=i({mutationFn:e=>L.setHybridPolicy(e),onSuccess:()=>e.invalidateQueries({queryKey:[`networkBoundary`]})}),x=i({mutationFn:e=>L.previewCloudContext(e)}),[S,C]=U.useState([]),w=i({mutationFn:e=>L.setNodeSensitivity(e.nodeId,e.localOnly),onSuccess:(e,t)=>{e.ok&&C(e=>t.localOnly?[...e,t.nodeId]:e.filter(e=>e!==t.nodeId))}}),T=m.data?.ok?m.data.data:void 0,E=T?.catalog??[],D=T?.mode??``,k=n??D,j=E.find(e=>e.id===k),N=j?.requires_ack&&k!==D?j:void 0,P=N!==void 0&&!s,F=k===D,ee=T?.policy??{},I=x.data?.ok?x.data.data:void 0;return m.isLoading?(0,W.jsxs)(h,{children:[(0,W.jsx)(l,{children:(0,W.jsx)(a,{children:M(t,`system.network.title`)})}),(0,W.jsx)(p,{children:(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:M(t,`ui.loading`)})})]}):!T||E.length===0?(0,W.jsxs)(h,{children:[(0,W.jsx)(l,{children:(0,W.jsx)(a,{children:M(t,`system.network.title`)})}),(0,W.jsx)(p,{children:(0,W.jsx)(g,{title:M(t,`ui.requestUnavailable`),detail:m.data?.error})})]}):(0,W.jsxs)(h,{className:`settings-dial`,id:`network-boundary-panel`,"data-testid":`network-boundary-panel`,children:[(0,W.jsxs)(l,{children:[(0,W.jsxs)(a,{className:`flex items-center gap-2`,children:[(0,W.jsx)(ne,{className:`h-4 w-4`,"aria-hidden":`true`}),M(t,`system.network.title`)]}),(0,W.jsx)(u,{children:M(t,`system.network.hint`)})]}),(0,W.jsxs)(p,{className:`space-y-3`,children:[(0,W.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[M(t,`system.network.current`),`:`,` `,(0,W.jsx)(`strong`,{"data-testid":`network-boundary-active`,children:t===`ko`&&T.label_ko||T.label})]}),(0,W.jsx)(`div`,{className:`space-y-2`,role:`radiogroup`,"aria-label":M(t,`system.network.title`),children:E.map(e=>{let n=e.id===k;return(0,W.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"data-testid":`network-boundary-option-${e.id}`,onClick:()=>{o(e.id),c(!1),v.reset()},className:`settings-dial-option ${n?`is-active`:``}`,children:[(0,W.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`strong`,{className:`text-sm`,children:G(e,t)}),(0,W.jsx)(b,{variant:re[e.risk]||`warning`,children:M(t,`system.permission.risk.${e.risk}`)}),e.id===D?(0,W.jsx)(b,{variant:`muted`,children:M(t,`system.network.current`)}):null]}),(0,W.jsx)(`p`,{className:`mt-1 block text-xs text-muted-foreground`,children:K(e,t)})]},e.id)})}),N?(0,W.jsxs)(`div`,{className:`space-y-2 rounded-md border border-border bg-muted p-3`,children:[(0,W.jsxs)(`p`,{className:`flex items-start gap-2 text-xs`,children:[(0,W.jsx)(O,{className:`mt-0.5 h-4 w-4 shrink-0`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{children:q(N,t)})]}),(0,W.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,W.jsx)(`input`,{type:`checkbox`,"data-testid":`network-boundary-ack`,checked:s,onChange:e=>c(e.target.checked)}),M(t,`system.network.ack`)]})]}):null,(0,W.jsx)(B,{"data-testid":`network-boundary-apply`,disabled:F||P||v.isPending,onClick:()=>v.mutate({mode:k,ack:s}),children:M(t,`system.network.apply`)}),v.data&&!v.data.ok?(0,W.jsx)(g,{title:M(t,`ui.requestUnavailable`),detail:v.data.error}):null,v.data?.ok?(0,W.jsx)(b,{variant:`success`,"data-testid":`network-boundary-applied`,children:M(t,`ui.requestCompleted`)}):null,(0,W.jsxs)(`div`,{className:`space-y-2 rounded-md border border-border p-3`,children:[(0,W.jsx)(`p`,{className:`text-xs font-medium`,children:M(t,`system.network.preview.title`)}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:M(t,`system.network.preview.hint`)}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(`input`,{type:`text`,"data-testid":`network-boundary-probe`,value:d,onChange:e=>f(e.target.value),placeholder:M(t,`system.network.preview.placeholder`),className:`min-w-0 flex-1 rounded-md border border-border bg-background px-2 py-1 text-xs`}),(0,W.jsx)(B,{variant:`outline`,"data-testid":`network-boundary-preview`,disabled:!d.trim()||x.isPending,onClick:()=>x.mutate(d.trim()),children:M(t,`system.network.preview.run`)})]}),I?(0,W.jsxs)(`div`,{className:`space-y-1`,"data-testid":`network-boundary-preview-result`,children:[I.allows_cloud?null:(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:M(t,`system.network.preview.localOnly`)}),I.would_block?(0,W.jsx)(b,{variant:`danger`,children:M(t,`system.network.preview.blocked`)}):null,I.titles.length===0?(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:M(t,`system.network.preview.empty`)}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[M(t,`system.network.preview.count`,{count:I.titles.length}),` · `,M(t,`system.network.preview.tokens`,{tokens:I.token_estimate})]}),(0,W.jsx)(`ul`,{className:`space-y-0.5`,children:I.titles.map((e,n)=>{let r=I.node_ids[n],i=r?S.includes(r):!1;return(0,W.jsxs)(`li`,{className:`flex items-start justify-between gap-2 text-xs`,children:[(0,W.jsxs)(`span`,{className:i?`line-through opacity-60`:void 0,children:[`· `,e]}),r?(0,W.jsx)(`button`,{type:`button`,"data-testid":`network-boundary-hold-${n}`,className:`shrink-0 underline underline-offset-2 opacity-80 hover:opacity-100`,disabled:w.isPending,onClick:()=>w.mutate({nodeId:r,localOnly:!i}),children:M(t,i?`system.network.preview.release`:`system.network.preview.hold`)}):null]},`${r||e}-${n}`)})})]})]}):null,x.data&&!x.data.ok?(0,W.jsx)(g,{title:M(t,`ui.requestUnavailable`),detail:x.data.error}):null]}),T.allows_cloud?(0,W.jsxs)(`div`,{className:`space-y-2 rounded-md border border-border p-3`,"data-testid":`network-boundary-policy`,children:[(0,W.jsx)(Y,{language:t,loading:_.isLoading,status:R(_.data?.data,!!_.data?.ok)}),(0,W.jsx)(`p`,{className:`text-xs font-medium`,children:M(t,`system.network.policy.title`)}),(0,W.jsxs)(`label`,{className:`flex items-start gap-2 text-xs`,children:[(0,W.jsx)(`input`,{type:`checkbox`,"data-testid":`network-boundary-auto-commit`,checked:!!ee.auto_commit,disabled:y.isPending,onChange:e=>y.mutate({auto_commit:e.target.checked})}),(0,W.jsxs)(`span`,{children:[M(t,`system.network.policy.autoCommit`),(0,W.jsx)(`span`,{className:`mt-0.5 block text-muted-foreground`,children:M(t,`system.network.policy.autoCommitHint`)})]})]}),(0,W.jsxs)(`label`,{className:`flex items-start gap-2 text-xs`,children:[(0,W.jsx)(`input`,{type:`checkbox`,"data-testid":`network-boundary-multimodal`,checked:!!ee.allow_multimodal,disabled:y.isPending,onChange:e=>y.mutate({allow_multimodal:e.target.checked})}),(0,W.jsxs)(`span`,{children:[M(t,`system.network.policy.multimodal`),(0,W.jsx)(`span`,{className:`mt-0.5 block text-muted-foreground`,children:M(t,`system.network.policy.multimodalHint`)})]})]})]}):null,(0,W.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,W.jsx)(`p`,{className:`text-xs font-medium`,children:M(t,`system.network.guards`)}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:M(t,`system.network.guards.detail`)}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:M(t,`system.network.preview.autoHeld`)})]})]})]})}function J(e,t){return t.mode===`cli_oauth`&&t.provider&&t.model?M(e,`system.network.cloudStatus.identity.cli`,{provider:t.provider,model:t.model}):t.provider&&t.model?M(e,`system.network.cloudStatus.identity`,{provider:t.provider,model:t.model}):t.model?M(e,`system.network.cloudStatus.identity.model`,{model:t.model}):t.provider}function Y({language:e,loading:t,status:n}){let r=n.mode===`cli_oauth`?`system.network.cloudStatus.cli`:n.mode===`api_key`?`system.network.cloudStatus.apiKey`:`system.network.cloudStatus.none`,i=n.configured?J(e,n):``;return(0,W.jsxs)(`div`,{className:`space-y-1`,"data-testid":`network-cloud-status`,children:[(0,W.jsx)(`p`,{className:`text-xs font-medium`,children:M(e,`system.network.cloudStatus.title`)}),t?(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`network-cloud-status-loading`,children:M(e,`system.network.cloudStatus.loading`)}):n.configured?(0,W.jsxs)(`p`,{className:`text-xs`,"data-testid":`network-cloud-status-ready`,children:[M(e,r),i?` · ${i}`:``]}):(0,W.jsxs)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`network-cloud-status-none`,children:[M(e,`system.network.cloudStatus.none`),(0,W.jsx)(`span`,{className:`mt-0.5 block`,children:M(e,`system.network.cloudStatus.none.hint`)})]})]})}var X=[`proposal_first`,`workspace_writes_auto`,`knowledge_reads_auto`,`exec_auto`,`computer_observation_auto`,`computer_control_auto`,`circuit_breakers`];function ae(e){return e===`strict`?{proposal_first:!0,workspace_writes_auto:!1,knowledge_reads_auto:!1,exec_auto:!1,computer_observation_auto:!1,computer_control_auto:!1,circuit_breakers:!0}:e===`trusted`?{proposal_first:!1,workspace_writes_auto:!0,knowledge_reads_auto:!0,exec_auto:!1,computer_observation_auto:!0,computer_control_auto:!1,circuit_breakers:!0}:e===`bypass`?{proposal_first:!1,workspace_writes_auto:!0,knowledge_reads_auto:!0,exec_auto:!0,computer_observation_auto:!0,computer_control_auto:!0,circuit_breakers:!0}:null}function oe(e){return{proposal_first:!!e.proposal_first,workspace_writes_auto:!!e.workspace_writes_auto,knowledge_reads_auto:!!e.knowledge_reads_auto,exec_auto:!!e.exec_auto,computer_observation_auto:!!e.computer_observation_auto,computer_control_auto:!!e.computer_control_auto,circuit_breakers:e.circuit_breakers!==!1}}function Z(e,t,n){return n===`auto`?M(e,t?`system.permission.preview.auto`:`system.permission.preview.ask`):M(e,t?`system.permission.preview.on`:`system.permission.preview.off`)}function se(e,t){let n=`system.permission.risk.${t}`,r=M(e,n);return r===n?t:r}function ce(e,t,n,r){let i=ae(n.id),a=i===null,o=[{id:`risk`,label:M(e,`system.permission.preview.risk`),current:se(e,t.risk),next:se(e,n.risk),changed:t.risk!==n.risk},{id:`ack`,label:M(e,`system.permission.preview.ack`),current:M(e,t.requires_ack?`system.permission.preview.ack.yes`:`system.permission.preview.ack.no`),next:M(e,n.requires_ack?`system.permission.preview.ack.yes`:`system.permission.preview.ack.no`),changed:!!t.requires_ack!=!!n.requires_ack}];if(i)for(let t of X){let n=r[t],a=i[t],s=t===`proposal_first`||t===`circuit_breakers`?`on`:`auto`;o.push({id:t,label:M(e,`system.permission.preview.cap.${t}`),current:Z(e,n,s),next:Z(e,a,s),changed:n!==a})}return{rows:o,fromCatalogOnly:a}}function le(e,t){return{label:T(e,t),summary:E(e,t)}}var ue={low:`success`,medium:`warning`,high:`danger`};function de(){let e=r(),t=z(e=>e.language),[n,o]=U.useState(null),[s,c]=U.useState(!1),d=A({queryKey:[`permissionMode`],queryFn:L.permissionMode}),f=i({mutationFn:e=>L.setPermissionMode(e.mode,e.ack),onSuccess:t=>{t.ok&&(e.invalidateQueries({queryKey:[`permissionMode`]}),o(null),c(!1))}}),m=d.data?.ok?d.data.data:void 0,_=m?.catalog??[],v=m?.mode??``,y=n??v,x=_.find(e=>e.id===y),S=x?.requires_ack&&y!==v?x:void 0,C=S!==void 0&&!s,k=y===v,j=_.find(e=>e.id===v),N=!k&&x&&j&&m?ce(t,j,x,oe(m)):null,P=j?le(j,t):null,F=x?le(x,t):null;return d.isLoading?(0,W.jsxs)(h,{children:[(0,W.jsx)(l,{children:(0,W.jsx)(a,{children:M(t,`system.permission.title`)})}),(0,W.jsx)(p,{children:(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:M(t,`ui.loading`)})})]}):!m||_.length===0?(0,W.jsxs)(h,{children:[(0,W.jsx)(l,{children:(0,W.jsx)(a,{children:M(t,`system.permission.title`)})}),(0,W.jsx)(p,{children:(0,W.jsx)(g,{title:M(t,`ui.requestUnavailable`),detail:d.data?.error})})]}):(0,W.jsxs)(h,{className:`settings-dial`,"data-testid":`permission-mode-panel`,children:[(0,W.jsxs)(l,{children:[(0,W.jsx)(a,{children:M(t,`system.permission.title`)}),(0,W.jsx)(u,{children:M(t,`system.permission.hint`)})]}),(0,W.jsxs)(p,{className:`space-y-3`,children:[(0,W.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[M(t,`system.permission.current`),`:`,` `,(0,W.jsx)(`strong`,{"data-testid":`permission-mode-active`,children:D(m,t)})]}),(0,W.jsx)(`div`,{className:`space-y-2`,role:`radiogroup`,"aria-label":M(t,`system.permission.title`),children:_.map(e=>{let n=e.id===y;return(0,W.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"data-testid":`permission-mode-option-${e.id}`,onClick:()=>{o(e.id),c(!1),f.reset()},className:`settings-dial-option ${n?`is-active`:``}`,children:[(0,W.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`strong`,{className:`text-sm`,children:T(e,t)}),(0,W.jsx)(b,{variant:ue[e.risk]||`warning`,children:M(t,`system.permission.risk.${e.risk}`)}),e.id===v?(0,W.jsx)(b,{variant:`muted`,children:M(t,`system.permission.current`)}):null]}),(0,W.jsx)(`p`,{className:`mt-1 block text-xs text-muted-foreground`,children:E(e,t)})]},e.id)})}),N&&P&&F?(0,W.jsxs)(`div`,{className:`settings-preview`,"data-testid":`permission-mode-preview`,children:[(0,W.jsx)(`p`,{className:`settings-preview-title`,children:M(t,`system.permission.preview.title`)}),(0,W.jsx)(`p`,{className:`settings-preview-hint`,children:M(t,`system.permission.preview.hint`)}),(0,W.jsxs)(`div`,{className:`settings-preview-pair`,children:[(0,W.jsxs)(`div`,{className:`settings-preview-col`,children:[(0,W.jsx)(`span`,{children:M(t,`system.permission.preview.from`)}),(0,W.jsx)(`strong`,{children:P.label}),(0,W.jsx)(`p`,{children:P.summary})]}),(0,W.jsxs)(`div`,{className:`settings-preview-col is-next`,children:[(0,W.jsx)(`span`,{children:M(t,`system.permission.preview.to`)}),(0,W.jsx)(`strong`,{children:F.label}),(0,W.jsx)(`p`,{children:F.summary})]})]}),(0,W.jsx)(`ul`,{className:`settings-preview-rows`,children:N.rows.filter(e=>e.changed).map(e=>(0,W.jsxs)(`li`,{"data-testid":`permission-mode-preview-row-${e.id}`,children:[(0,W.jsx)(`span`,{className:`settings-preview-row-label`,children:e.label}),(0,W.jsx)(`span`,{className:`settings-preview-row-from`,children:e.current}),(0,W.jsx)(`span`,{className:`settings-preview-row-to`,children:e.next})]},e.id))}),N.fromCatalogOnly?(0,W.jsx)(`p`,{className:`settings-preview-limit`,"data-testid":`permission-mode-preview-limit`,children:M(t,`system.permission.preview.unknown`)}):null]}):null,S?(0,W.jsxs)(`div`,{className:`space-y-2 rounded-md border border-border bg-muted p-3`,children:[(0,W.jsxs)(`p`,{className:`flex items-start gap-2 text-xs`,children:[(0,W.jsx)(O,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,W.jsx)(`span`,{children:w(S,t)})]}),(0,W.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,W.jsx)(`input`,{type:`checkbox`,"data-testid":`permission-mode-ack`,checked:s,onChange:e=>c(e.target.checked)}),M(t,`system.permission.ack`)]})]}):null,(0,W.jsx)(B,{"data-testid":`permission-mode-apply`,disabled:k||C||f.isPending,onClick:()=>f.mutate({mode:y,ack:s}),children:M(t,`system.permission.apply`)}),f.data&&!f.data.ok?(0,W.jsx)(g,{title:M(t,`ui.requestUnavailable`),detail:f.data.error}):null,f.data?.ok?(0,W.jsx)(b,{variant:`success`,"data-testid":`permission-mode-applied`,children:M(t,`ui.requestCompleted`)}):null,(0,W.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,W.jsx)(`p`,{className:`text-xs font-medium`,children:M(t,`system.permission.guards`)}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:M(t,`system.permission.guards.detail`)})]})]})]})}var fe=[{id:`identity`,labelKey:`system.group.identity`},{id:`data`,labelKey:`system.group.data`},{id:`system`,labelKey:`system.group.system`}],pe=[{id:`account`,labelKey:`system.tab.account`,group:`identity`},{id:`workspaces`,labelKey:`system.tab.workspaces`,group:`identity`},{id:`snapshots`,labelKey:`system.tab.snapshots`,group:`data`},{id:`activity`,labelKey:`system.tab.activity`,group:`data`},{id:`settings`,labelKey:`system.tab.settings`,group:`system`},{id:`network`,labelKey:`system.tab.network`,group:`system`},{id:`admin`,labelKey:`system.tab.admin`,group:`system`}];function me({initialTab:e}){let t=z(e=>e.mode),n=z(e=>e.language),[r,i]=U.useState(e||`account`);U.useEffect(()=>{pe.some(t=>t.id===e)&&i(e)},[e]);let a=t===`basic`?pe.filter(e=>e.id===`account`||e.id===`workspaces`||e.id===`snapshots`||e.id===`settings`):pe,o=e=>{i(e),ee(`/`+{account:`account`,workspaces:`workspace-admin`,snapshots:`snapshots`,activity:`activity`,network:`network`,settings:`settings`,admin:`system-admin`}[e])};return(0,W.jsxs)(`div`,{className:`product-page settings-page space-y-5 pb-8`,children:[(0,W.jsxs)(`header`,{className:`page-hero`,children:[(0,W.jsxs)(`div`,{className:`page-kicker`,children:[(0,W.jsx)(F,{className:`h-4 w-4`}),` `,M(n,`system.kicker`)]}),(0,W.jsx)(`h1`,{className:`page-title`,children:M(n,`system.title`)}),(0,W.jsx)(`p`,{className:`page-copy`,children:M(n,`system.body`)})]}),(0,W.jsx)(`div`,{className:`system-tab-groups`,"data-testid":`system-tab-groups`,children:fe.map(e=>({group:e,items:a.filter(t=>t.group===e.id)})).filter(({items:e})=>e.length>0).map(({group:e,items:t})=>{let i=`system-group-${e.id}`;return(0,W.jsxs)(`div`,{className:`system-tab-group`,children:[(0,W.jsx)(`span`,{id:i,className:`system-tab-group-label`,children:M(n,e.labelKey)}),(0,W.jsx)(c,{ariaLabelledBy:i,tabs:t.map(e=>({id:e.id,label:M(n,e.labelKey)})),value:r,onChange:e=>o(e)})]},e.id)})}),r===`account`?(0,W.jsx)(he,{}):null,r===`workspaces`?(0,W.jsx)(_e,{}):null,r===`settings`?(0,W.jsx)(xe,{}):null,r===`snapshots`?(0,W.jsx)(ve,{}):null,r===`activity`?(0,W.jsx)(ye,{}):null,r===`network`?(0,W.jsx)(be,{}):null,r===`admin`?(0,W.jsx)(ke,{}):null]})}function he(){let e=r(),t=z(e=>e.language),n=z(e=>e.setWorkspaceId),c=A({queryKey:[`profile`],queryFn:L.profile}),d=A({queryKey:[`sso`],queryFn:L.ssoConfig}),[f,g]=U.useState(``),[_,y]=U.useState(``),[b,x]=U.useState(``),[S,C]=U.useState(``),[w,T]=U.useState(``),E=e=>{e.ok&&(te(),n(null))},D=i({mutationFn:()=>L.login(f,_),onSuccess:E}),O=i({mutationFn:()=>L.register({email:f,password:_,name:b,nickname:S}),onSuccess:E}),j=i({mutationFn:()=>L.updateProfile({name:b,nickname:S}),onSuccess:()=>e.invalidateQueries({queryKey:[`profile`]})}),N=i({mutationFn:()=>L.changePassword(_,w)});return(0,W.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,W.jsx)(m,{title:M(t,`system.account.profile`),result:c.data,children:e=>(0,W.jsx)(o,{data:e})}),(0,W.jsxs)(h,{children:[(0,W.jsxs)(l,{children:[(0,W.jsxs)(a,{className:`flex items-center gap-2`,children:[(0,W.jsx)(k,{className:`h-4 w-4`}),` `,M(t,`system.account.title`)]}),(0,W.jsx)(u,{children:M(t,`system.account.detail`)})]}),(0,W.jsxs)(p,{className:`flex flex-col gap-3`,children:[(0,W.jsx)(V,{value:f,onChange:e=>g(e.target.value),placeholder:M(t,`system.account.email`)}),(0,W.jsx)(V,{type:`password`,value:_,onChange:e=>y(e.target.value),placeholder:M(t,`system.account.password`)}),(0,W.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2`,children:[(0,W.jsx)(V,{value:b,onChange:e=>x(e.target.value),placeholder:M(t,`system.account.name`)}),(0,W.jsx)(V,{value:S,onChange:e=>C(e.target.value),placeholder:M(t,`system.account.nickname`)})]}),(0,W.jsx)(V,{type:`password`,value:w,onChange:e=>T(e.target.value),placeholder:M(t,`system.account.newPassword`)}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(B,{onClick:()=>D.mutate(),disabled:!f||!_||D.isPending,children:M(t,`system.account.login`)}),(0,W.jsx)(B,{variant:`outline`,onClick:()=>O.mutate(),disabled:!f||!_||O.isPending,children:M(t,`system.account.register`)}),(0,W.jsx)(B,{variant:`outline`,onClick:()=>j.mutate(),disabled:j.isPending,children:M(t,`system.account.save`)}),(0,W.jsx)(B,{variant:`outline`,onClick:()=>N.mutate(),disabled:!_||!w||N.isPending,children:M(t,`system.account.changePassword`)}),(0,W.jsx)(v,{label:M(t,`system.account.logout`),action:()=>L.logout(),onSuccess:E})]}),[D.data,O.data,j.data,N.data].filter(Boolean).map((e,n)=>(0,W.jsx)(s,{result:e,successLabel:M(t,`system.account.requestDone`)},n))]})]}),(0,W.jsx)(m,{title:M(t,`system.account.signInOptions`),result:d.data,children:e=>(0,W.jsx)(ge,{data:e})})]})}function ge({data:e}){let t=z(e=>e.mode),n=z(e=>e.language),r=!!e.enabled||N(e.providers).length>0;return(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)($,{title:M(n,r?`system.account.signIn.sso`:`system.account.signIn.localOnly`),status:M(n,r?`system.value.enabled`:`system.storage.local.badge`),detail:M(n,r?`system.account.signIn.ssoDetail`:`system.account.signIn.localOnlyDetail`)}),t===`basic`?null:(0,W.jsx)(y,{value:e})]})}function _e(){let e=r(),t=z(e=>e.language),{setWorkspaceId:n}=z(),o=A({queryKey:[`workspaceRegistry`],queryFn:L.workspaceRegistry}),s=A({queryKey:[`invitations`],queryFn:L.invitations}),[c,f]=U.useState(``),[g,_]=U.useState(``),[y,b]=U.useState(``),x=i({mutationFn:()=>L.createOrg(c),onSuccess:()=>e.invalidateQueries({queryKey:[`workspaceRegistry`]})}),S=i({mutationFn:()=>L.createInvitation({email:g||null,role:`member`,expires_hours:168}),onSuccess:()=>e.invalidateQueries({queryKey:[`invitations`]})}),C=i({mutationFn:()=>L.acceptInvitation(y),onSuccess:()=>e.invalidateQueries({queryKey:[`workspaceRegistry`]})}),w=N(o.data?.data?.workspaces);return(0,W.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,W.jsx)(m,{title:M(t,`system.workspace.yours`),result:o.data,children:()=>(0,W.jsx)(`div`,{className:`flex flex-col gap-2`,children:w.map(e=>{let r=String(e.workspace_id||e.id);return(0,W.jsx)(`div`,{className:`rounded-md border border-border p-3`,children:(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`font-medium`,children:String(e.name||r)}),(0,W.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[String(e.type||``),` · `,String(e.your_role||e.role||``)]})]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(B,{variant:`outline`,onClick:()=>n(r),children:M(t,`system.workspace.use`)}),(0,W.jsx)(v,{label:M(t,`system.workspace.activate`),action:()=>L.activateWorkspace(r),invalidate:[`workspaceRegistry`]}),(0,W.jsx)(v,{label:M(t,`system.workspace.archive`),action:()=>L.archiveWorkspace(r),invalidate:[`workspaceRegistry`],variant:`destructive`})]})]})},r)})})}),(0,W.jsxs)(h,{children:[(0,W.jsxs)(l,{children:[(0,W.jsxs)(a,{className:`flex items-center gap-2`,children:[(0,W.jsx)(H,{className:`h-4 w-4`}),` `,M(t,`system.workspace.organizations`)]}),(0,W.jsx)(u,{children:M(t,`system.workspace.organizationsHint`)})]}),(0,W.jsxs)(p,{className:`flex flex-col gap-3`,children:[(0,W.jsx)(V,{value:c,onChange:e=>f(e.target.value),placeholder:M(t,`system.workspace.orgPlaceholder`)}),(0,W.jsx)(B,{disabled:!c.trim()||x.isPending,onClick:()=>x.mutate(),children:M(t,`system.workspace.createOrg`)}),(0,W.jsx)(V,{value:g,onChange:e=>_(e.target.value),placeholder:M(t,`system.workspace.inviteeEmail`)}),(0,W.jsx)(B,{variant:`outline`,disabled:S.isPending,onClick:()=>S.mutate(),children:M(t,`system.workspace.createInvite`)}),(0,W.jsx)(V,{value:y,onChange:e=>b(e.target.value),placeholder:M(t,`system.workspace.inviteToken`)}),(0,W.jsx)(B,{variant:`outline`,disabled:!y.trim()||C.isPending,onClick:()=>C.mutate(),children:M(t,`system.workspace.acceptInvite`)}),(0,W.jsx)(m,{title:M(t,`system.workspace.invitations`),result:s.data,children:e=>(0,W.jsx)(d,{items:e.invitations,titleKey:`token`,metaKey:`role`})})]})]})]})}function ve(){let e=z(e=>e.language),t=A({queryKey:[`snapshots`],queryFn:L.snapshots}),n=A({queryKey:[`timeMachine`],queryFn:L.timeMachine}),[r,o]=U.useState(``),[c,f]=U.useState(``),[g,_]=U.useState(``),y=i({mutationFn:()=>L.createSnapshot(r||M(e,`system.snapshots.defaultName`))}),b=i({mutationFn:()=>L.compareSnapshots(c,g)}),x=N(t.data?.data?.snapshots);return(0,W.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,W.jsx)(m,{title:M(e,`system.snapshots.title`),result:t.data,children:()=>(0,W.jsx)(`div`,{className:`space-y-2`,children:x.map(t=>{let n=String(t.id||t.snapshot_id);return(0,W.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,W.jsx)(`div`,{className:`font-medium`,children:String(t.name||n)}),(0,W.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,W.jsx)(v,{label:M(e,`system.snapshots.export`),action:()=>L.exportSnapshot(n)}),(0,W.jsx)(v,{label:M(e,`system.snapshots.mergeRestore`),action:()=>L.restoreSnapshot(n),variant:`outline`})]})]},n)})})}),(0,W.jsxs)(h,{children:[(0,W.jsxs)(l,{children:[(0,W.jsx)(a,{children:M(e,`system.snapshots.actions`)}),(0,W.jsx)(u,{children:M(e,`system.snapshots.actionsHint`)})]}),(0,W.jsxs)(p,{className:`flex flex-col gap-3`,children:[(0,W.jsx)(V,{value:r,onChange:e=>o(e.target.value),placeholder:M(e,`system.snapshots.namePlaceholder`)}),(0,W.jsx)(B,{onClick:()=>y.mutate(),disabled:y.isPending,children:M(e,`system.snapshots.create`)}),(0,W.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2`,children:[(0,W.jsx)(V,{value:c,onChange:e=>f(e.target.value),placeholder:M(e,`system.snapshots.beforeId`)}),(0,W.jsx)(V,{value:g,onChange:e=>_(e.target.value),placeholder:M(e,`system.snapshots.afterId`)})]}),(0,W.jsx)(B,{variant:`outline`,onClick:()=>b.mutate(),disabled:!c||!g||b.isPending,children:M(e,`system.snapshots.compare`)}),b.data?(0,W.jsx)(s,{result:b.data,successLabel:M(e,`system.snapshots.compareDone`)}):null]})]}),(0,W.jsx)(m,{title:M(e,`system.snapshots.timeline`),result:n.data,children:e=>(0,W.jsx)(d,{items:e.events||e,titleKey:`event`,metaKey:`type`,limit:14})})]})}function ye(){let e=z(e=>e.language),t=A({queryKey:[`realtimeFeed`],queryFn:L.realtimeFeed}),n=A({queryKey:[`presence`],queryFn:L.presence});return(0,W.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,W.jsx)(m,{title:M(e,`system.activity.feed`),result:t.data,children:e=>(0,W.jsx)(d,{items:e.events,titleKey:`event_type`,metaKey:`area`,limit:14})}),(0,W.jsx)(m,{title:M(e,`system.activity.presence`),result:n.data,children:e=>(0,W.jsx)(Se,{data:e})})]})}function be(){let e=r(),t=z(e=>e.language),n=A({queryKey:[`networkIdentity`],queryFn:L.networkIdentity}),o=A({queryKey:[`networkPeers`],queryFn:L.networkPeers}),[c,d]=U.useState(``),[f,g]=U.useState(``),[_,y]=U.useState(``),b=i({mutationFn:()=>L.pairPeer({name:c,base_url:f,public_key:_}),onSuccess:()=>e.invalidateQueries({queryKey:[`networkPeers`]})});return(0,W.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,W.jsx)(m,{title:M(t,`system.network.identity`),result:n.data,children:e=>(0,W.jsx)(Ce,{data:e})}),(0,W.jsxs)(h,{children:[(0,W.jsxs)(l,{children:[(0,W.jsxs)(a,{className:`flex items-center gap-2`,children:[(0,W.jsx)(C,{className:`h-4 w-4`}),` `,M(t,`system.network.pair`)]}),(0,W.jsx)(u,{children:M(t,`system.network.pairHint`)})]}),(0,W.jsxs)(p,{className:`grid gap-3`,children:[(0,W.jsx)(V,{value:c,onChange:e=>d(e.target.value),placeholder:M(t,`system.network.deviceName`)}),(0,W.jsx)(V,{value:f,onChange:e=>g(e.target.value),placeholder:M(t,`system.network.address`)}),(0,W.jsx)(V,{value:_,onChange:e=>y(e.target.value),placeholder:M(t,`system.network.publicKey`)}),(0,W.jsx)(B,{disabled:!c||!f||!_||b.isPending,onClick:()=>b.mutate(),children:M(t,`system.network.pair`)}),b.data?(0,W.jsx)(s,{result:b.data,successLabel:M(t,`system.network.pairDone`)}):null]})]}),(0,W.jsx)(m,{title:M(t,`system.network.peers`),result:o.data,className:`xl:col-span-2`,children:e=>(0,W.jsx)(`div`,{className:`grid gap-2`,children:N(e.peers).map(e=>{let n=String(e.peer_id||e.id);return(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`font-medium`,children:String(e.name||n)}),(0,W.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:String(e.base_url||``)})]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(v,{label:M(t,`system.network.pushWorkspace`),action:()=>L.pushPeer(n,z.getState().workspaceId)}),(0,W.jsx)(v,{label:M(t,`system.network.unpair`),action:()=>L.unpairPeer(n),invalidate:[`networkPeers`],variant:`destructive`})]})]},n)})})})]})}function xe(){let e=r(),{theme:t,setTheme:n,mode:o,setMode:c}=z(),d=z(e=>e.language),f=A({queryKey:[`health`],queryFn:L.health}),g=A({queryKey:[`sysinfo`],queryFn:L.sysinfo}),_=A({queryKey:[`computerMemory`],queryFn:L.computerMemory}),C=A({queryKey:[`brainStorage`],queryFn:L.brainStorage}),w=A({queryKey:[`backupHealth`],queryFn:L.backupHealth}),[T,E]=U.useState(``),[D,O]=U.useState(`lattice_brain`),[k,j]=U.useState(!1),[N,P]=U.useState(``),[F,ee]=U.useState(``),[I,te]=U.useState(``),[R,ne]=U.useState(!1),[H,re]=U.useState(!1),G=i({mutationFn:e=>L.dockerPostgres({consent:e,dry_run:!e,port:5432})}),K=i({mutationFn:()=>L.migratePostgres({dsn:T,schema_name:D||`lattice_brain`,dry_run:!0})}),q=i({mutationFn:()=>L.brainArchive({path:N.trim()||null,passphrase:I}),onSuccess:()=>e.invalidateQueries({queryKey:[`backupHealth`]})}),J=i({mutationFn:()=>L.brainArchiveInspect({path:F,passphrase:I||null})}),Y=i({mutationFn:()=>L.brainArchiveVerify({path:F,passphrase:I})}),X=i({mutationFn:()=>L.brainArchiveRestore({path:F,passphrase:I,dry_run:!0,confirm:!1})}),ae=i({mutationFn:()=>L.brainArchiveRestore({path:F,passphrase:I,dry_run:!1,confirm:R}),onSuccess:()=>{e.invalidateQueries({queryKey:[`brainStorage`]}),e.invalidateQueries({queryKey:[`backupHealth`]})}}),oe=i({mutationFn:()=>L.brainArchiveImport({path:F,passphrase:I,dry_run:!0,confirm:!1})}),Z=i({mutationFn:()=>L.brainArchiveImport({path:F,passphrase:I,dry_run:!1,confirm:H}),onSuccess:()=>{e.invalidateQueries({queryKey:[`brainStorage`]}),e.invalidateQueries({queryKey:[`backupHealth`]})}});return(0,W.jsxs)(`div`,{className:`flex flex-col gap-4 max-w-[54rem]`,children:[(0,W.jsxs)(h,{children:[(0,W.jsxs)(l,{children:[(0,W.jsx)(a,{children:M(d,`system.panel.appearance`)}),(0,W.jsx)(u,{children:M(d,`system.panel.appearance.hint`)})]}),(0,W.jsxs)(p,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(B,{variant:t===`dark`?`default`:`outline`,onClick:()=>n(`dark`),children:M(d,`system.theme.dark`)}),(0,W.jsx)(B,{variant:t===`light`?`default`:`outline`,onClick:()=>n(`light`),children:M(d,`system.theme.light`)})]})]}),(0,W.jsxs)(h,{children:[(0,W.jsxs)(l,{children:[(0,W.jsx)(a,{children:M(d,`system.panel.detailLevel`)}),(0,W.jsx)(u,{children:M(d,`system.panel.detailLevel.hint`)})]}),(0,W.jsx)(p,{className:`flex flex-wrap gap-2`,children:[`basic`,`advanced`,`admin`].map(e=>(0,W.jsx)(B,{variant:o===e?`default`:`outline`,onClick:()=>c(e),children:M(d,`shell.mode.${e}`)},e))})]}),(0,W.jsxs)(h,{"data-testid":`system-tools-panel`,children:[(0,W.jsxs)(l,{children:[(0,W.jsxs)(a,{className:`flex items-center gap-2`,children:[(0,W.jsx)(x,{className:`h-4 w-4`,"aria-hidden":`true`}),M(d,`system.panel.tools`)]}),(0,W.jsx)(u,{children:M(d,`system.panel.tools.hint`)})]}),(0,W.jsx)(p,{className:`flex flex-wrap gap-2`,children:[`search`,`read`,`skill`,`mcp`].map(e=>(0,W.jsx)(b,{variant:`muted`,children:M(d,`system.panel.tools.${e}`)},e))})]}),(0,W.jsx)(de,{}),(0,W.jsx)(ie,{}),(0,W.jsx)(m,{title:o===`basic`?M(d,`system.panel.brainStatus`):M(d,`system.panel.serverHealth`),result:f.data,children:e=>(0,W.jsx)(we,{data:e})}),(0,W.jsx)(m,{title:o===`basic`?M(d,`system.panel.readiness`):M(d,`system.panel.hostTelemetry`),result:g.data,children:e=>{if(o===`basic`){let t=String(e?.readiness||`roomy`),n=t===`tight`||t===`low`||t===`roomy`?`system.readiness.${t}`:`system.readiness.plenty`;return(0,W.jsxs)(`div`,{className:`flex items-center gap-2.5 p-3 rounded-lg border border-border/60 bg-muted/20 text-sm text-foreground`,children:[(0,W.jsx)(S,{className:`h-4 w-4 ${t===`low`?`text-rose-500`:t===`tight`?`text-amber-500`:`text-emerald-500`} flex-shrink-0`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{children:M(d,n)})]})}return(0,W.jsx)(y,{value:e})}}),(0,W.jsx)(m,{title:o===`basic`?M(d,`system.storage.title`):M(d,`system.panel.brainStorage`),result:C.data,children:e=>(0,W.jsx)(Te,{data:e,mode:o,language:d})}),o===`basic`?null:(0,W.jsx)(m,{title:M(d,`system.backup.health`),result:w.data,children:e=>(0,W.jsx)(Ee,{data:e})}),o===`basic`?null:(0,W.jsxs)(h,{children:[(0,W.jsxs)(l,{children:[(0,W.jsx)(a,{children:M(d,`system.archive.title`)}),(0,W.jsx)(u,{children:M(d,`system.archive.detail`)})]}),(0,W.jsxs)(p,{className:`flex flex-col gap-3`,children:[(0,W.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2`,children:[(0,W.jsx)(V,{value:N,onChange:e=>P(e.target.value),placeholder:M(d,`system.archive.exportPath`)}),(0,W.jsx)(V,{value:F,onChange:e=>ee(e.target.value),placeholder:M(d,`system.archive.restorePath`)})]}),(0,W.jsx)(V,{type:`password`,value:I,onChange:e=>te(e.target.value),placeholder:M(d,`system.archive.passphrase`)}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(B,{onClick:()=>q.mutate(),disabled:!I||q.isPending,children:M(d,`system.archive.export`)}),(0,W.jsx)(B,{variant:`outline`,onClick:()=>J.mutate(),disabled:!F||J.isPending,children:M(d,`system.archive.inspect`)}),(0,W.jsx)(B,{variant:`outline`,onClick:()=>Y.mutate(),disabled:!F||!I||Y.isPending,children:M(d,`system.archive.verify`)}),(0,W.jsx)(B,{variant:`outline`,onClick:()=>X.mutate(),disabled:!F||!I||X.isPending,children:M(d,`system.archive.restoreDryRun`)}),(0,W.jsx)(B,{variant:`outline`,onClick:()=>oe.mutate(),disabled:!F||!I||oe.isPending,children:M(d,`system.archive.importDryRun`)}),(0,W.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:R,onChange:e=>ne(e.target.checked)}),M(d,`system.archive.confirmRestore`)]}),(0,W.jsx)(B,{variant:`destructive`,onClick:()=>ae.mutate(),disabled:!F||!I||!R||ae.isPending,children:M(d,`system.archive.restore`)}),(0,W.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:H,onChange:e=>re(e.target.checked)}),M(d,`system.archive.confirmImport`)]}),(0,W.jsx)(B,{variant:`outline`,onClick:()=>Z.mutate(),disabled:!F||!I||!H||Z.isPending,children:M(d,`system.archive.import`)})]}),[q.data,J.data,Y.data,X.data,ae.data,oe.data,Z.data].filter(Boolean).map((e,t)=>(0,W.jsx)(s,{result:e,successLabel:M(d,`system.archive.requestDone`)},t))]})]}),o===`basic`?null:(0,W.jsxs)(h,{children:[(0,W.jsxs)(l,{children:[(0,W.jsx)(a,{children:M(d,`system.scale.title`)}),(0,W.jsx)(u,{children:M(d,`system.scale.detail`)})]}),(0,W.jsxs)(p,{className:`flex flex-col gap-3`,children:[(0,W.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2`,children:[(0,W.jsx)(V,{value:T,onChange:e=>E(e.target.value),placeholder:M(d,`system.scale.dsn`)}),(0,W.jsx)(V,{value:D,onChange:e=>O(e.target.value),placeholder:M(d,`system.scale.schema`)})]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(B,{variant:`outline`,onClick:()=>G.mutate(!1),disabled:G.isPending,children:M(d,`system.scale.dockerPlan`)}),(0,W.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:k,onChange:e=>j(e.target.checked)}),M(d,`system.scale.dockerConsent`)]}),(0,W.jsx)(B,{onClick:()=>G.mutate(!0),disabled:!k||G.isPending,children:M(d,`system.scale.dockerStart`)}),(0,W.jsx)(B,{variant:`outline`,onClick:()=>K.mutate(),disabled:!T||K.isPending,children:M(d,`system.scale.migrationPlan`)})]}),G.data?(0,W.jsx)(s,{result:G.data,successLabel:M(d,`system.scale.dockerDone`)}):null,K.data?(0,W.jsx)(s,{result:K.data,successLabel:M(d,`system.scale.migrationDone`)}):null]})]}),o===`basic`?null:(0,W.jsx)(m,{title:M(d,`system.computerMemory.title`),result:_.data,children:e=>(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(y,{value:e}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(v,{label:M(d,`system.computerMemory.enable`),action:()=>L.setComputerMemory(!0),invalidate:[`computerMemory`]}),(0,W.jsx)(v,{label:M(d,`system.computerMemory.disable`),action:()=>L.setComputerMemory(!1),invalidate:[`computerMemory`],variant:`destructive`})]})]})})]})}function Q(e,t,n){return t==null||t===``?n:typeof t==`boolean`?M(e,t?`system.value.enabled`:`system.value.disabled`):String(t)}function Se({data:e}){let t=z(e=>e.language),n=N(e.presence||e.clients||e);return n.length?(0,W.jsx)(d,{items:n,titleKey:`user`,metaKey:`workspace_id`}):(0,W.jsx)(g,{title:M(t,`system.presence.empty`),detail:M(t,`system.presence.emptyDetail`)})}function Ce({data:e}){let t=z(e=>e.mode),n=z(e=>e.language),r=Q(n,e.public_key,``);return t===`basic`?(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)($,{title:M(n,`system.device.thisMac`),status:M(n,`system.value.trusted`),detail:M(n,`system.device.thisMacDetail`)}),(0,W.jsx)(b,{variant:`muted`,children:Q(n,e.algorithm,M(n,`system.value.localIdentity`))})]}):(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(b,{variant:`success`,children:M(n,`system.value.localDevice`)}),(0,W.jsx)(b,{variant:`muted`,children:Q(n,e.algorithm,M(n,`system.value.identityKey`))})]}),(0,W.jsx)(o,{data:{device_id:e.device_id||e.id||M(n,`system.value.notReported`),fingerprint:e.fingerprint||M(n,`system.value.notReported`),public_key:r?P(r.replace(/\s+/g,` `),72):M(n,`system.value.notReported`)}})]})}function we({data:e}){let t=z(e=>e.mode),n=z(e=>e.language);return t===`basic`?(0,W.jsx)($,{title:M(n,`system.health.title`),status:M(n,`system.health.ok`),detail:M(n,`system.health.detail`)}):(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(f,{stats:[{label:M(n,`system.health.status`),value:e.status||e.ok||M(n,`system.value.reported`)},{label:M(n,`system.health.version`),value:e.version||M(n,`system.value.notReported`)},{label:M(n,`system.health.mode`),value:e.mode||e.environment||M(n,`system.value.local`)},{label:M(n,`system.health.port`),value:e.port||e.backend_port||M(n,`system.value.configured`)}]}),(0,W.jsx)(y,{value:e})]})}function Te({data:e,mode:t,language:n}){let r=I(e.active)?e.active:e,i=I(e.postgres)?e.postgres:{},a=I(e.backup_health)?e.backup_health:{},o=r.vector_search||r.vector||e.vector_search||e.sqlite_vec,s=!!(i.available||i.connected||i.enabled),c=!!o&&String(o).toLowerCase()!==`not reported`;return t===`basic`?(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)($,{title:M(n,`system.storage.local.title`),status:M(n,`system.storage.local.badge`),detail:M(n,`system.storage.local.detail`)}),(0,W.jsx)($,{title:M(n,`system.storage.search.title`),status:c?M(n,`system.storage.search.on`):M(n,`system.storage.search.pending`),detail:c?M(n,`system.storage.search.detailOn`):M(n,`system.storage.search.detailPending`)})]}):(0,W.jsxs)(`div`,{className:`space-y-4`,children:[(0,W.jsx)(f,{stats:[{label:M(n,`system.storage.activeEngine`),value:r.engine||e.engine||M(n,`system.storage.sqlite`)},{label:M(n,`system.storage.sqliteDefault`),value:r.engine===`postgres`?M(n,`system.value.scaleMode`):M(n,`system.value.enabled`)},{label:M(n,`system.storage.vector`),value:o||M(n,`system.value.notReported`)},{label:M(n,`system.storage.postgres`),value:s?M(n,`system.value.available`):M(n,`system.value.optional`)}]}),(0,W.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-3`,children:[(0,W.jsx)($,{title:M(n,`system.storage.sqlite`),status:r.available===!1?M(n,`system.value.unavailable`):M(n,`system.value.default`),detail:Q(n,r.reason||r.path||e.path,M(n,`system.storage.sqliteDetail`))}),(0,W.jsx)($,{title:M(n,`system.storage.vector`),status:Q(n,o,M(n,`system.value.reported`)),detail:Q(n,r.vector_reason||r.sqlite_vec_reason||e.vector_reason,M(n,`system.storage.vectorDetail`))}),(0,W.jsx)($,{title:M(n,`system.storage.postgres`),status:s?M(n,`system.value.available`):M(n,`system.value.notEnabled`),detail:Q(n,i.reason||i.dsn||i.status,M(n,`system.storage.postgresDetail`))})]}),Object.keys(a).length?(0,W.jsx)(y,{value:{backup_health:a}}):null]})}function Ee({data:e}){let t=z(e=>e.language);return(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(f,{stats:[{label:M(t,`system.backup.available`),value:e.available===!1?M(t,`system.value.no`):M(t,`system.value.yes`)},{label:M(t,`system.backup.backups`),value:e.count||e.backups||0},{label:M(t,`system.backup.encrypted`),value:e.encrypted_archives||0},{label:M(t,`system.backup.zip`),value:e.zip_backups||0}]}),(0,W.jsx)(o,{data:{directory:e.directory||M(t,`system.value.notReported`),latest:e.latest||M(t,`system.value.noneReported`),last_verified:e.last_verified||e.verified_at||M(t,`system.value.notReported`),failure:e.error||e.reason||M(t,`system.value.noneReported`)}})]})}function $({title:e,status:t,detail:n}){let r=/unavailable|failed|denied|disabled|not enabled|사용 불가|실패|거부|비활성|활성화되지 않음/i.test(t)?`warning`:`success`;return(0,W.jsxs)(`div`,{className:`rounded-md border border-border bg-background p-3`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,W.jsx)(`div`,{className:`font-medium`,children:e}),(0,W.jsx)(b,{variant:r,children:t})]}),(0,W.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:n})]})}function De({data:e}){let t=z(e=>e.language),n=I(e.startup)?e.startup:{},r=I(e.privacy)?e.privacy:{},i=I(e.storage)?e.storage:{},a=I(e.backup)?e.backup:{},o=I(e.device_identity)?e.device_identity:{},s=I(e.permissions)?e.permissions:{};return(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(f,{stats:[{label:M(t,`system.hardening.version`),value:e.version||M(t,`system.value.reported`)},{label:M(t,`system.hardening.localOnly`),value:r.local_only_default??n.local_only_default??M(t,`system.value.reported`)},{label:M(t,`system.hardening.storage`),value:I(i.active)?i.active.engine:M(t,`system.value.reported`)},{label:M(t,`system.hardening.backups`),value:a.count||a.available||M(t,`system.value.reported`)}]}),(0,W.jsxs)(`div`,{className:`flex flex-col sm:flex-row flex-wrap gap-3`,children:[(0,W.jsx)($,{title:M(t,`system.hardening.startup`),status:M(t,n.network_exposed?`system.value.networkExposed`:`system.value.localOnly`),detail:M(t,`system.hardening.startupDetail`)}),(0,W.jsx)($,{title:M(t,`system.hardening.integrations`),status:M(t,r.local_only_default===!1?`system.value.reviewRequired`:`system.value.optIn`),detail:M(t,`system.hardening.integrationsDetail`)}),(0,W.jsx)($,{title:M(t,`system.hardening.identity`),status:Q(t,o.algorithm||o.fingerprint,M(t,`system.value.reported`)),detail:Q(t,o.storage,M(t,`system.hardening.identityStorage`))}),(0,W.jsx)($,{title:M(t,`system.hardening.permissions`),status:M(t,s.destructive_restore_requires_confirmation===!1?`system.value.reviewRequired`:`system.value.guarded`),detail:M(t,`system.hardening.permissionsDetail`)})]})]})}function Oe({data:e}){let t=z(e=>e.language),n=I(e.cards)?e.cards:{},r=I(e.severity_counts)?e.severity_counts:{};return(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(f,{stats:[{label:M(t,`system.security.eventsToday`),value:n.events_today||0},{label:M(t,`system.security.highRisk`),value:n.high_risk_events||r.high||0},{label:M(t,`system.security.review`),value:n.review_required||0},{label:M(t,`system.security.riskRate`),value:e.risk_rate||0}]}),(0,W.jsx)(y,{value:{severity_counts:r,sensitive_fields:e.field_counts||{}}})]})}function ke(){let e=z(e=>e.mode),t=z(e=>e.language),n=A({queryKey:[`adminSummary`],queryFn:L.adminSummary}),r=A({queryKey:[`adminUsers`],queryFn:L.adminUsers}),i=A({queryKey:[`adminAudit`],queryFn:()=>L.adminAudit()}),a=A({queryKey:[`adminRoles`],queryFn:L.adminRoles}),s=A({queryKey:[`adminPolicies`],queryFn:L.adminPolicies}),c=A({queryKey:[`adminProductHardening`],queryFn:L.adminProductHardening}),l=A({queryKey:[`adminSecurity`],queryFn:L.adminSecurity}),u=A({queryKey:[`vpcStatus`],queryFn:L.vpcStatus});return e===`admin`?(0,W.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,W.jsx)(m,{title:M(t,`system.admin.summary`),result:n.data,children:e=>(0,W.jsx)(o,{data:e})}),(0,W.jsx)(m,{title:M(t,`system.admin.users`),result:r.data,children:e=>(0,W.jsx)(d,{items:e,titleKey:`email`,metaKey:`role`})}),(0,W.jsx)(m,{title:M(t,`system.admin.audit`),result:i.data,children:e=>(0,W.jsx)(d,{items:e.recent_events||e,titleKey:`act`,metaKey:`sev`})}),(0,W.jsx)(m,{title:M(t,`system.admin.roles`),result:a.data,children:e=>(0,W.jsx)(d,{items:e.roles||e,titleKey:`role`,metaKey:`members`})}),(0,W.jsx)(m,{title:M(t,`system.admin.policies`),result:s.data,children:e=>(0,W.jsx)(d,{items:e.policies||e,titleKey:`label`,metaKey:`enforced`})}),(0,W.jsx)(m,{title:M(t,`system.admin.hardening`),result:c.data,children:e=>(0,W.jsx)(De,{data:e})}),(0,W.jsx)(m,{title:M(t,`system.admin.security`),result:l.data,children:e=>(0,W.jsx)(Oe,{data:e})}),(0,W.jsx)(m,{title:M(t,`system.admin.vpc`),result:u.data,children:e=>(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(b,{variant:`muted`,children:M(t,`system.admin.communityUnavailable`)}),(0,W.jsx)(y,{value:e})]})})]}):(0,W.jsx)(_,{title:M(t,`system.admin.controls`),detail:M(t,`system.admin.controlsDetail`),target:`admin`})}export{me as SystemPage};
|
|
1
|
+
import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{n as r}from"./QueryClientProvider-B3OjqSyJ.js";import{t as i}from"./useMutation-Bi0PXQMC.js";import{_ as a,a as o,c as s,d as c,g as l,h as u,i as d,l as f,m as p,n as m,p as h,r as g,s as _,t as v,u as y,v as b,y as x}from"./primitives-B6DzQC3H.js";import{t as S}from"./circle-check-D44VI2ZE.js";import{a as C,i as w,n as T,r as E,t as D}from"./permissionCopy-CNK2tfkz.js";import{t as O}from"./shield-alert-WDP2DSTM.js";import{F as k,H as A,R as j,S as M,c as N,h as P,k as F,o as ee,p as I,t as te,v as L,y as R,z}from"./index-DCT79wzR.js";import{t as B}from"./button-xXPeemQr.js";import{t as V}from"./input-D3YrgxvO.js";import"./workspace-BsxrRYQI.js";var ne=j(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),H=j(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),U=e(t()),W=n(),re={low:`success`,medium:`warning`,high:`danger`};function G(e,t){return t===`ko`&&e.label_ko||e.label}function K(e,t){return t===`ko`&&e.summary_ko||e.summary}function q(e,t){return t===`ko`&&e.warning_ko||e.warning||``}function ie(){let e=r(),t=z(e=>e.language),[n,o]=U.useState(null),[s,c]=U.useState(!1),[d,f]=U.useState(``),m=A({queryKey:[`networkBoundary`],queryFn:L.networkBoundary}),_=A({queryKey:[`cloudStatus`],queryFn:L.cloudStatus}),v=i({mutationFn:e=>L.setNetworkBoundary(e.mode,e.ack),onSuccess:t=>{t.ok&&(e.invalidateQueries({queryKey:[`networkBoundary`]}),o(null),c(!1))}}),y=i({mutationFn:e=>L.setHybridPolicy(e),onSuccess:()=>e.invalidateQueries({queryKey:[`networkBoundary`]})}),x=i({mutationFn:e=>L.previewCloudContext(e)}),[S,C]=U.useState([]),w=i({mutationFn:e=>L.setNodeSensitivity(e.nodeId,e.localOnly),onSuccess:(e,t)=>{e.ok&&C(e=>t.localOnly?[...e,t.nodeId]:e.filter(e=>e!==t.nodeId))}}),T=m.data?.ok?m.data.data:void 0,E=T?.catalog??[],D=T?.mode??``,k=n??D,j=E.find(e=>e.id===k),N=j?.requires_ack&&k!==D?j:void 0,P=N!==void 0&&!s,F=k===D,ee=T?.policy??{},I=x.data?.ok?x.data.data:void 0;return m.isLoading?(0,W.jsxs)(h,{children:[(0,W.jsx)(l,{children:(0,W.jsx)(a,{children:M(t,`system.network.title`)})}),(0,W.jsx)(p,{children:(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:M(t,`ui.loading`)})})]}):!T||E.length===0?(0,W.jsxs)(h,{children:[(0,W.jsx)(l,{children:(0,W.jsx)(a,{children:M(t,`system.network.title`)})}),(0,W.jsx)(p,{children:(0,W.jsx)(g,{title:M(t,`ui.requestUnavailable`),detail:m.data?.error})})]}):(0,W.jsxs)(h,{className:`settings-dial`,id:`network-boundary-panel`,"data-testid":`network-boundary-panel`,children:[(0,W.jsxs)(l,{children:[(0,W.jsxs)(a,{className:`flex items-center gap-2`,children:[(0,W.jsx)(ne,{className:`h-4 w-4`,"aria-hidden":`true`}),M(t,`system.network.title`)]}),(0,W.jsx)(u,{children:M(t,`system.network.hint`)})]}),(0,W.jsxs)(p,{className:`space-y-3`,children:[(0,W.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[M(t,`system.network.current`),`:`,` `,(0,W.jsx)(`strong`,{"data-testid":`network-boundary-active`,children:t===`ko`&&T.label_ko||T.label})]}),(0,W.jsx)(`div`,{className:`space-y-2`,role:`radiogroup`,"aria-label":M(t,`system.network.title`),children:E.map(e=>{let n=e.id===k;return(0,W.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"data-testid":`network-boundary-option-${e.id}`,onClick:()=>{o(e.id),c(!1),v.reset()},className:`settings-dial-option ${n?`is-active`:``}`,children:[(0,W.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`strong`,{className:`text-sm`,children:G(e,t)}),(0,W.jsx)(b,{variant:re[e.risk]||`warning`,children:M(t,`system.permission.risk.${e.risk}`)}),e.id===D?(0,W.jsx)(b,{variant:`muted`,children:M(t,`system.network.current`)}):null]}),(0,W.jsx)(`p`,{className:`mt-1 block text-xs text-muted-foreground`,children:K(e,t)})]},e.id)})}),N?(0,W.jsxs)(`div`,{className:`space-y-2 rounded-md border border-border bg-muted p-3`,children:[(0,W.jsxs)(`p`,{className:`flex items-start gap-2 text-xs`,children:[(0,W.jsx)(O,{className:`mt-0.5 h-4 w-4 shrink-0`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{children:q(N,t)})]}),(0,W.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,W.jsx)(`input`,{type:`checkbox`,"data-testid":`network-boundary-ack`,checked:s,onChange:e=>c(e.target.checked)}),M(t,`system.network.ack`)]})]}):null,(0,W.jsx)(B,{"data-testid":`network-boundary-apply`,disabled:F||P||v.isPending,onClick:()=>v.mutate({mode:k,ack:s}),children:M(t,`system.network.apply`)}),v.data&&!v.data.ok?(0,W.jsx)(g,{title:M(t,`ui.requestUnavailable`),detail:v.data.error}):null,v.data?.ok?(0,W.jsx)(b,{variant:`success`,"data-testid":`network-boundary-applied`,children:M(t,`ui.requestCompleted`)}):null,(0,W.jsxs)(`div`,{className:`space-y-2 rounded-md border border-border p-3`,children:[(0,W.jsx)(`p`,{className:`text-xs font-medium`,children:M(t,`system.network.preview.title`)}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:M(t,`system.network.preview.hint`)}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(`input`,{type:`text`,"data-testid":`network-boundary-probe`,value:d,onChange:e=>f(e.target.value),placeholder:M(t,`system.network.preview.placeholder`),className:`min-w-0 flex-1 rounded-md border border-border bg-background px-2 py-1 text-xs`}),(0,W.jsx)(B,{variant:`outline`,"data-testid":`network-boundary-preview`,disabled:!d.trim()||x.isPending,onClick:()=>x.mutate(d.trim()),children:M(t,`system.network.preview.run`)})]}),I?(0,W.jsxs)(`div`,{className:`space-y-1`,"data-testid":`network-boundary-preview-result`,children:[I.allows_cloud?null:(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:M(t,`system.network.preview.localOnly`)}),I.would_block?(0,W.jsx)(b,{variant:`danger`,children:M(t,`system.network.preview.blocked`)}):null,I.titles.length===0?(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:M(t,`system.network.preview.empty`)}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[M(t,`system.network.preview.count`,{count:I.titles.length}),` · `,M(t,`system.network.preview.tokens`,{tokens:I.token_estimate})]}),(0,W.jsx)(`ul`,{className:`space-y-0.5`,children:I.titles.map((e,n)=>{let r=I.node_ids[n],i=r?S.includes(r):!1;return(0,W.jsxs)(`li`,{className:`flex items-start justify-between gap-2 text-xs`,children:[(0,W.jsxs)(`span`,{className:i?`line-through opacity-60`:void 0,children:[`· `,e]}),r?(0,W.jsx)(`button`,{type:`button`,"data-testid":`network-boundary-hold-${n}`,className:`shrink-0 underline underline-offset-2 opacity-80 hover:opacity-100`,disabled:w.isPending,onClick:()=>w.mutate({nodeId:r,localOnly:!i}),children:M(t,i?`system.network.preview.release`:`system.network.preview.hold`)}):null]},`${r||e}-${n}`)})})]})]}):null,x.data&&!x.data.ok?(0,W.jsx)(g,{title:M(t,`ui.requestUnavailable`),detail:x.data.error}):null]}),T.allows_cloud?(0,W.jsxs)(`div`,{className:`space-y-2 rounded-md border border-border p-3`,"data-testid":`network-boundary-policy`,children:[(0,W.jsx)(Y,{language:t,loading:_.isLoading,status:R(_.data?.data,!!_.data?.ok)}),(0,W.jsx)(`p`,{className:`text-xs font-medium`,children:M(t,`system.network.policy.title`)}),(0,W.jsxs)(`label`,{className:`flex items-start gap-2 text-xs`,children:[(0,W.jsx)(`input`,{type:`checkbox`,"data-testid":`network-boundary-auto-commit`,checked:!!ee.auto_commit,disabled:y.isPending,onChange:e=>y.mutate({auto_commit:e.target.checked})}),(0,W.jsxs)(`span`,{children:[M(t,`system.network.policy.autoCommit`),(0,W.jsx)(`span`,{className:`mt-0.5 block text-muted-foreground`,children:M(t,`system.network.policy.autoCommitHint`)})]})]}),(0,W.jsxs)(`label`,{className:`flex items-start gap-2 text-xs`,children:[(0,W.jsx)(`input`,{type:`checkbox`,"data-testid":`network-boundary-multimodal`,checked:!!ee.allow_multimodal,disabled:y.isPending,onChange:e=>y.mutate({allow_multimodal:e.target.checked})}),(0,W.jsxs)(`span`,{children:[M(t,`system.network.policy.multimodal`),(0,W.jsx)(`span`,{className:`mt-0.5 block text-muted-foreground`,children:M(t,`system.network.policy.multimodalHint`)})]})]})]}):null,(0,W.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,W.jsx)(`p`,{className:`text-xs font-medium`,children:M(t,`system.network.guards`)}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:M(t,`system.network.guards.detail`)}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:M(t,`system.network.preview.autoHeld`)})]})]})]})}function J(e,t){return t.mode===`cli_oauth`&&t.provider&&t.model?M(e,`system.network.cloudStatus.identity.cli`,{provider:t.provider,model:t.model}):t.provider&&t.model?M(e,`system.network.cloudStatus.identity`,{provider:t.provider,model:t.model}):t.model?M(e,`system.network.cloudStatus.identity.model`,{model:t.model}):t.provider}function Y({language:e,loading:t,status:n}){let r=n.mode===`cli_oauth`?`system.network.cloudStatus.cli`:n.mode===`api_key`?`system.network.cloudStatus.apiKey`:`system.network.cloudStatus.none`,i=n.configured?J(e,n):``;return(0,W.jsxs)(`div`,{className:`space-y-1`,"data-testid":`network-cloud-status`,children:[(0,W.jsx)(`p`,{className:`text-xs font-medium`,children:M(e,`system.network.cloudStatus.title`)}),t?(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`network-cloud-status-loading`,children:M(e,`system.network.cloudStatus.loading`)}):n.configured?(0,W.jsxs)(`p`,{className:`text-xs`,"data-testid":`network-cloud-status-ready`,children:[M(e,r),i?` · ${i}`:``]}):(0,W.jsxs)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`network-cloud-status-none`,children:[M(e,`system.network.cloudStatus.none`),(0,W.jsx)(`span`,{className:`mt-0.5 block`,children:M(e,`system.network.cloudStatus.none.hint`)})]})]})}var X=[`proposal_first`,`workspace_writes_auto`,`knowledge_reads_auto`,`exec_auto`,`computer_observation_auto`,`computer_control_auto`,`circuit_breakers`];function ae(e){return e===`strict`?{proposal_first:!0,workspace_writes_auto:!1,knowledge_reads_auto:!1,exec_auto:!1,computer_observation_auto:!1,computer_control_auto:!1,circuit_breakers:!0}:e===`trusted`?{proposal_first:!1,workspace_writes_auto:!0,knowledge_reads_auto:!0,exec_auto:!1,computer_observation_auto:!0,computer_control_auto:!1,circuit_breakers:!0}:e===`bypass`?{proposal_first:!1,workspace_writes_auto:!0,knowledge_reads_auto:!0,exec_auto:!0,computer_observation_auto:!0,computer_control_auto:!0,circuit_breakers:!0}:null}function oe(e){return{proposal_first:!!e.proposal_first,workspace_writes_auto:!!e.workspace_writes_auto,knowledge_reads_auto:!!e.knowledge_reads_auto,exec_auto:!!e.exec_auto,computer_observation_auto:!!e.computer_observation_auto,computer_control_auto:!!e.computer_control_auto,circuit_breakers:e.circuit_breakers!==!1}}function Z(e,t,n){return n===`auto`?M(e,t?`system.permission.preview.auto`:`system.permission.preview.ask`):M(e,t?`system.permission.preview.on`:`system.permission.preview.off`)}function se(e,t){let n=`system.permission.risk.${t}`,r=M(e,n);return r===n?t:r}function ce(e,t,n,r){let i=ae(n.id),a=i===null,o=[{id:`risk`,label:M(e,`system.permission.preview.risk`),current:se(e,t.risk),next:se(e,n.risk),changed:t.risk!==n.risk},{id:`ack`,label:M(e,`system.permission.preview.ack`),current:M(e,t.requires_ack?`system.permission.preview.ack.yes`:`system.permission.preview.ack.no`),next:M(e,n.requires_ack?`system.permission.preview.ack.yes`:`system.permission.preview.ack.no`),changed:!!t.requires_ack!=!!n.requires_ack}];if(i)for(let t of X){let n=r[t],a=i[t],s=t===`proposal_first`||t===`circuit_breakers`?`on`:`auto`;o.push({id:t,label:M(e,`system.permission.preview.cap.${t}`),current:Z(e,n,s),next:Z(e,a,s),changed:n!==a})}return{rows:o,fromCatalogOnly:a}}function le(e,t){return{label:T(e,t),summary:E(e,t)}}var ue={low:`success`,medium:`warning`,high:`danger`};function de(){let e=r(),t=z(e=>e.language),[n,o]=U.useState(null),[s,c]=U.useState(!1),d=A({queryKey:[`permissionMode`],queryFn:L.permissionMode}),f=i({mutationFn:e=>L.setPermissionMode(e.mode,e.ack),onSuccess:t=>{t.ok&&(e.invalidateQueries({queryKey:[`permissionMode`]}),o(null),c(!1))}}),m=d.data?.ok?d.data.data:void 0,_=m?.catalog??[],v=m?.mode??``,y=n??v,x=_.find(e=>e.id===y),S=x?.requires_ack&&y!==v?x:void 0,C=S!==void 0&&!s,k=y===v,j=_.find(e=>e.id===v),N=!k&&x&&j&&m?ce(t,j,x,oe(m)):null,P=j?le(j,t):null,F=x?le(x,t):null;return d.isLoading?(0,W.jsxs)(h,{children:[(0,W.jsx)(l,{children:(0,W.jsx)(a,{children:M(t,`system.permission.title`)})}),(0,W.jsx)(p,{children:(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:M(t,`ui.loading`)})})]}):!m||_.length===0?(0,W.jsxs)(h,{children:[(0,W.jsx)(l,{children:(0,W.jsx)(a,{children:M(t,`system.permission.title`)})}),(0,W.jsx)(p,{children:(0,W.jsx)(g,{title:M(t,`ui.requestUnavailable`),detail:d.data?.error})})]}):(0,W.jsxs)(h,{className:`settings-dial`,"data-testid":`permission-mode-panel`,children:[(0,W.jsxs)(l,{children:[(0,W.jsx)(a,{children:M(t,`system.permission.title`)}),(0,W.jsx)(u,{children:M(t,`system.permission.hint`)})]}),(0,W.jsxs)(p,{className:`space-y-3`,children:[(0,W.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[M(t,`system.permission.current`),`:`,` `,(0,W.jsx)(`strong`,{"data-testid":`permission-mode-active`,children:D(m,t)})]}),(0,W.jsx)(`div`,{className:`space-y-2`,role:`radiogroup`,"aria-label":M(t,`system.permission.title`),children:_.map(e=>{let n=e.id===y;return(0,W.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"data-testid":`permission-mode-option-${e.id}`,onClick:()=>{o(e.id),c(!1),f.reset()},className:`settings-dial-option ${n?`is-active`:``}`,children:[(0,W.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`strong`,{className:`text-sm`,children:T(e,t)}),(0,W.jsx)(b,{variant:ue[e.risk]||`warning`,children:M(t,`system.permission.risk.${e.risk}`)}),e.id===v?(0,W.jsx)(b,{variant:`muted`,children:M(t,`system.permission.current`)}):null]}),(0,W.jsx)(`p`,{className:`mt-1 block text-xs text-muted-foreground`,children:E(e,t)})]},e.id)})}),N&&P&&F?(0,W.jsxs)(`div`,{className:`settings-preview`,"data-testid":`permission-mode-preview`,children:[(0,W.jsx)(`p`,{className:`settings-preview-title`,children:M(t,`system.permission.preview.title`)}),(0,W.jsx)(`p`,{className:`settings-preview-hint`,children:M(t,`system.permission.preview.hint`)}),(0,W.jsxs)(`div`,{className:`settings-preview-pair`,children:[(0,W.jsxs)(`div`,{className:`settings-preview-col`,children:[(0,W.jsx)(`span`,{children:M(t,`system.permission.preview.from`)}),(0,W.jsx)(`strong`,{children:P.label}),(0,W.jsx)(`p`,{children:P.summary})]}),(0,W.jsxs)(`div`,{className:`settings-preview-col is-next`,children:[(0,W.jsx)(`span`,{children:M(t,`system.permission.preview.to`)}),(0,W.jsx)(`strong`,{children:F.label}),(0,W.jsx)(`p`,{children:F.summary})]})]}),(0,W.jsx)(`ul`,{className:`settings-preview-rows`,children:N.rows.filter(e=>e.changed).map(e=>(0,W.jsxs)(`li`,{"data-testid":`permission-mode-preview-row-${e.id}`,children:[(0,W.jsx)(`span`,{className:`settings-preview-row-label`,children:e.label}),(0,W.jsx)(`span`,{className:`settings-preview-row-from`,children:e.current}),(0,W.jsx)(`span`,{className:`settings-preview-row-to`,children:e.next})]},e.id))}),N.fromCatalogOnly?(0,W.jsx)(`p`,{className:`settings-preview-limit`,"data-testid":`permission-mode-preview-limit`,children:M(t,`system.permission.preview.unknown`)}):null]}):null,S?(0,W.jsxs)(`div`,{className:`space-y-2 rounded-md border border-border bg-muted p-3`,children:[(0,W.jsxs)(`p`,{className:`flex items-start gap-2 text-xs`,children:[(0,W.jsx)(O,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,W.jsx)(`span`,{children:w(S,t)})]}),(0,W.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,W.jsx)(`input`,{type:`checkbox`,"data-testid":`permission-mode-ack`,checked:s,onChange:e=>c(e.target.checked)}),M(t,`system.permission.ack`)]})]}):null,(0,W.jsx)(B,{"data-testid":`permission-mode-apply`,disabled:k||C||f.isPending,onClick:()=>f.mutate({mode:y,ack:s}),children:M(t,`system.permission.apply`)}),f.data&&!f.data.ok?(0,W.jsx)(g,{title:M(t,`ui.requestUnavailable`),detail:f.data.error}):null,f.data?.ok?(0,W.jsx)(b,{variant:`success`,"data-testid":`permission-mode-applied`,children:M(t,`ui.requestCompleted`)}):null,(0,W.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,W.jsx)(`p`,{className:`text-xs font-medium`,children:M(t,`system.permission.guards`)}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:M(t,`system.permission.guards.detail`)})]})]})]})}var fe=[{id:`identity`,labelKey:`system.group.identity`},{id:`data`,labelKey:`system.group.data`},{id:`system`,labelKey:`system.group.system`}],pe=[{id:`account`,labelKey:`system.tab.account`,group:`identity`},{id:`workspaces`,labelKey:`system.tab.workspaces`,group:`identity`},{id:`snapshots`,labelKey:`system.tab.snapshots`,group:`data`},{id:`activity`,labelKey:`system.tab.activity`,group:`data`},{id:`settings`,labelKey:`system.tab.settings`,group:`system`},{id:`network`,labelKey:`system.tab.network`,group:`system`},{id:`admin`,labelKey:`system.tab.admin`,group:`system`}];function me({initialTab:e}){let t=z(e=>e.mode),n=z(e=>e.language),[r,i]=U.useState(e||`account`);U.useEffect(()=>{pe.some(t=>t.id===e)&&i(e)},[e]);let a=t===`basic`?pe.filter(e=>e.id===`account`||e.id===`workspaces`||e.id===`snapshots`||e.id===`settings`):pe,o=e=>{i(e),ee(`/`+{account:`account`,workspaces:`workspace-admin`,snapshots:`snapshots`,activity:`activity`,network:`network`,settings:`settings`,admin:`system-admin`}[e])};return(0,W.jsxs)(`div`,{className:`product-page settings-page space-y-5 pb-8`,children:[(0,W.jsxs)(`header`,{className:`page-hero`,children:[(0,W.jsxs)(`div`,{className:`page-kicker`,children:[(0,W.jsx)(F,{className:`h-4 w-4`}),` `,M(n,`system.kicker`)]}),(0,W.jsx)(`h1`,{className:`page-title`,children:M(n,`system.title`)}),(0,W.jsx)(`p`,{className:`page-copy`,children:M(n,`system.body`)})]}),(0,W.jsx)(`div`,{className:`system-tab-groups`,"data-testid":`system-tab-groups`,children:fe.map(e=>({group:e,items:a.filter(t=>t.group===e.id)})).filter(({items:e})=>e.length>0).map(({group:e,items:t})=>{let i=`system-group-${e.id}`;return(0,W.jsxs)(`div`,{className:`system-tab-group`,children:[(0,W.jsx)(`span`,{id:i,className:`system-tab-group-label`,children:M(n,e.labelKey)}),(0,W.jsx)(c,{ariaLabelledBy:i,tabs:t.map(e=>({id:e.id,label:M(n,e.labelKey)})),value:r,onChange:e=>o(e)})]},e.id)})}),r===`account`?(0,W.jsx)(he,{}):null,r===`workspaces`?(0,W.jsx)(_e,{}):null,r===`settings`?(0,W.jsx)(xe,{}):null,r===`snapshots`?(0,W.jsx)(ve,{}):null,r===`activity`?(0,W.jsx)(ye,{}):null,r===`network`?(0,W.jsx)(be,{}):null,r===`admin`?(0,W.jsx)(ke,{}):null]})}function he(){let e=r(),t=z(e=>e.language),n=z(e=>e.setWorkspaceId),c=A({queryKey:[`profile`],queryFn:L.profile}),d=A({queryKey:[`sso`],queryFn:L.ssoConfig}),[f,g]=U.useState(``),[_,y]=U.useState(``),[b,x]=U.useState(``),[S,C]=U.useState(``),[w,T]=U.useState(``),E=e=>{e.ok&&(te(),n(null))},D=i({mutationFn:()=>L.login(f,_),onSuccess:E}),O=i({mutationFn:()=>L.register({email:f,password:_,name:b,nickname:S}),onSuccess:E}),j=i({mutationFn:()=>L.updateProfile({name:b,nickname:S}),onSuccess:()=>e.invalidateQueries({queryKey:[`profile`]})}),N=i({mutationFn:()=>L.changePassword(_,w)});return(0,W.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,W.jsx)(m,{title:M(t,`system.account.profile`),result:c.data,children:e=>(0,W.jsx)(o,{data:e})}),(0,W.jsxs)(h,{children:[(0,W.jsxs)(l,{children:[(0,W.jsxs)(a,{className:`flex items-center gap-2`,children:[(0,W.jsx)(k,{className:`h-4 w-4`}),` `,M(t,`system.account.title`)]}),(0,W.jsx)(u,{children:M(t,`system.account.detail`)})]}),(0,W.jsxs)(p,{className:`flex flex-col gap-3`,children:[(0,W.jsx)(V,{value:f,onChange:e=>g(e.target.value),placeholder:M(t,`system.account.email`)}),(0,W.jsx)(V,{type:`password`,value:_,onChange:e=>y(e.target.value),placeholder:M(t,`system.account.password`)}),(0,W.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2`,children:[(0,W.jsx)(V,{value:b,onChange:e=>x(e.target.value),placeholder:M(t,`system.account.name`)}),(0,W.jsx)(V,{value:S,onChange:e=>C(e.target.value),placeholder:M(t,`system.account.nickname`)})]}),(0,W.jsx)(V,{type:`password`,value:w,onChange:e=>T(e.target.value),placeholder:M(t,`system.account.newPassword`)}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(B,{onClick:()=>D.mutate(),disabled:!f||!_||D.isPending,children:M(t,`system.account.login`)}),(0,W.jsx)(B,{variant:`outline`,onClick:()=>O.mutate(),disabled:!f||!_||O.isPending,children:M(t,`system.account.register`)}),(0,W.jsx)(B,{variant:`outline`,onClick:()=>j.mutate(),disabled:j.isPending,children:M(t,`system.account.save`)}),(0,W.jsx)(B,{variant:`outline`,onClick:()=>N.mutate(),disabled:!_||!w||N.isPending,children:M(t,`system.account.changePassword`)}),(0,W.jsx)(v,{label:M(t,`system.account.logout`),action:()=>L.logout(),onSuccess:E})]}),[D.data,O.data,j.data,N.data].filter(Boolean).map((e,n)=>(0,W.jsx)(s,{result:e,successLabel:M(t,`system.account.requestDone`)},n))]})]}),(0,W.jsx)(m,{title:M(t,`system.account.signInOptions`),result:d.data,children:e=>(0,W.jsx)(ge,{data:e})})]})}function ge({data:e}){let t=z(e=>e.mode),n=z(e=>e.language),r=!!e.enabled||N(e.providers).length>0;return(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)($,{title:M(n,r?`system.account.signIn.sso`:`system.account.signIn.localOnly`),status:M(n,r?`system.value.enabled`:`system.storage.local.badge`),detail:M(n,r?`system.account.signIn.ssoDetail`:`system.account.signIn.localOnlyDetail`)}),t===`basic`?null:(0,W.jsx)(y,{value:e})]})}function _e(){let e=r(),t=z(e=>e.language),{setWorkspaceId:n}=z(),o=A({queryKey:[`workspaceRegistry`],queryFn:L.workspaceRegistry}),s=A({queryKey:[`invitations`],queryFn:L.invitations}),[c,f]=U.useState(``),[g,_]=U.useState(``),[y,b]=U.useState(``),x=i({mutationFn:()=>L.createOrg(c),onSuccess:()=>e.invalidateQueries({queryKey:[`workspaceRegistry`]})}),S=i({mutationFn:()=>L.createInvitation({email:g||null,role:`member`,expires_hours:168}),onSuccess:()=>e.invalidateQueries({queryKey:[`invitations`]})}),C=i({mutationFn:()=>L.acceptInvitation(y),onSuccess:()=>e.invalidateQueries({queryKey:[`workspaceRegistry`]})}),w=N(o.data?.data?.workspaces);return(0,W.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,W.jsx)(m,{title:M(t,`system.workspace.yours`),result:o.data,children:()=>(0,W.jsx)(`div`,{className:`flex flex-col gap-2`,children:w.map(e=>{let r=String(e.workspace_id||e.id);return(0,W.jsx)(`div`,{className:`rounded-md border border-border p-3`,children:(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`font-medium`,children:String(e.name||r)}),(0,W.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[String(e.type||``),` · `,String(e.your_role||e.role||``)]})]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(B,{variant:`outline`,onClick:()=>n(r),children:M(t,`system.workspace.use`)}),(0,W.jsx)(v,{label:M(t,`system.workspace.activate`),action:()=>L.activateWorkspace(r),invalidate:[`workspaceRegistry`]}),(0,W.jsx)(v,{label:M(t,`system.workspace.archive`),action:()=>L.archiveWorkspace(r),invalidate:[`workspaceRegistry`],variant:`destructive`})]})]})},r)})})}),(0,W.jsxs)(h,{children:[(0,W.jsxs)(l,{children:[(0,W.jsxs)(a,{className:`flex items-center gap-2`,children:[(0,W.jsx)(H,{className:`h-4 w-4`}),` `,M(t,`system.workspace.organizations`)]}),(0,W.jsx)(u,{children:M(t,`system.workspace.organizationsHint`)})]}),(0,W.jsxs)(p,{className:`flex flex-col gap-3`,children:[(0,W.jsx)(V,{value:c,onChange:e=>f(e.target.value),placeholder:M(t,`system.workspace.orgPlaceholder`)}),(0,W.jsx)(B,{disabled:!c.trim()||x.isPending,onClick:()=>x.mutate(),children:M(t,`system.workspace.createOrg`)}),(0,W.jsx)(V,{value:g,onChange:e=>_(e.target.value),placeholder:M(t,`system.workspace.inviteeEmail`)}),(0,W.jsx)(B,{variant:`outline`,disabled:S.isPending,onClick:()=>S.mutate(),children:M(t,`system.workspace.createInvite`)}),(0,W.jsx)(V,{value:y,onChange:e=>b(e.target.value),placeholder:M(t,`system.workspace.inviteToken`)}),(0,W.jsx)(B,{variant:`outline`,disabled:!y.trim()||C.isPending,onClick:()=>C.mutate(),children:M(t,`system.workspace.acceptInvite`)}),(0,W.jsx)(m,{title:M(t,`system.workspace.invitations`),result:s.data,children:e=>(0,W.jsx)(d,{items:e.invitations,titleKey:`token`,metaKey:`role`})})]})]})]})}function ve(){let e=z(e=>e.language),t=A({queryKey:[`snapshots`],queryFn:L.snapshots}),n=A({queryKey:[`timeMachine`],queryFn:L.timeMachine}),[r,o]=U.useState(``),[c,f]=U.useState(``),[g,_]=U.useState(``),y=i({mutationFn:()=>L.createSnapshot(r||M(e,`system.snapshots.defaultName`))}),b=i({mutationFn:()=>L.compareSnapshots(c,g)}),x=N(t.data?.data?.snapshots);return(0,W.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,W.jsx)(m,{title:M(e,`system.snapshots.title`),result:t.data,children:()=>(0,W.jsx)(`div`,{className:`space-y-2`,children:x.map(t=>{let n=String(t.id||t.snapshot_id);return(0,W.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,W.jsx)(`div`,{className:`font-medium`,children:String(t.name||n)}),(0,W.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,W.jsx)(v,{label:M(e,`system.snapshots.export`),action:()=>L.exportSnapshot(n)}),(0,W.jsx)(v,{label:M(e,`system.snapshots.mergeRestore`),action:()=>L.restoreSnapshot(n),variant:`outline`})]})]},n)})})}),(0,W.jsxs)(h,{children:[(0,W.jsxs)(l,{children:[(0,W.jsx)(a,{children:M(e,`system.snapshots.actions`)}),(0,W.jsx)(u,{children:M(e,`system.snapshots.actionsHint`)})]}),(0,W.jsxs)(p,{className:`flex flex-col gap-3`,children:[(0,W.jsx)(V,{value:r,onChange:e=>o(e.target.value),placeholder:M(e,`system.snapshots.namePlaceholder`)}),(0,W.jsx)(B,{onClick:()=>y.mutate(),disabled:y.isPending,children:M(e,`system.snapshots.create`)}),(0,W.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2`,children:[(0,W.jsx)(V,{value:c,onChange:e=>f(e.target.value),placeholder:M(e,`system.snapshots.beforeId`)}),(0,W.jsx)(V,{value:g,onChange:e=>_(e.target.value),placeholder:M(e,`system.snapshots.afterId`)})]}),(0,W.jsx)(B,{variant:`outline`,onClick:()=>b.mutate(),disabled:!c||!g||b.isPending,children:M(e,`system.snapshots.compare`)}),b.data?(0,W.jsx)(s,{result:b.data,successLabel:M(e,`system.snapshots.compareDone`)}):null]})]}),(0,W.jsx)(m,{title:M(e,`system.snapshots.timeline`),result:n.data,children:e=>(0,W.jsx)(d,{items:e.events||e,titleKey:`event`,metaKey:`type`,limit:14})})]})}function ye(){let e=z(e=>e.language),t=A({queryKey:[`realtimeFeed`],queryFn:L.realtimeFeed}),n=A({queryKey:[`presence`],queryFn:L.presence});return(0,W.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,W.jsx)(m,{title:M(e,`system.activity.feed`),result:t.data,children:e=>(0,W.jsx)(d,{items:e.events,titleKey:`event_type`,metaKey:`area`,limit:14})}),(0,W.jsx)(m,{title:M(e,`system.activity.presence`),result:n.data,children:e=>(0,W.jsx)(Se,{data:e})})]})}function be(){let e=r(),t=z(e=>e.language),n=A({queryKey:[`networkIdentity`],queryFn:L.networkIdentity}),o=A({queryKey:[`networkPeers`],queryFn:L.networkPeers}),[c,d]=U.useState(``),[f,g]=U.useState(``),[_,y]=U.useState(``),b=i({mutationFn:()=>L.pairPeer({name:c,base_url:f,public_key:_}),onSuccess:()=>e.invalidateQueries({queryKey:[`networkPeers`]})});return(0,W.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,W.jsx)(m,{title:M(t,`system.network.identity`),result:n.data,children:e=>(0,W.jsx)(Ce,{data:e})}),(0,W.jsxs)(h,{children:[(0,W.jsxs)(l,{children:[(0,W.jsxs)(a,{className:`flex items-center gap-2`,children:[(0,W.jsx)(C,{className:`h-4 w-4`}),` `,M(t,`system.network.pair`)]}),(0,W.jsx)(u,{children:M(t,`system.network.pairHint`)})]}),(0,W.jsxs)(p,{className:`grid gap-3`,children:[(0,W.jsx)(V,{value:c,onChange:e=>d(e.target.value),placeholder:M(t,`system.network.deviceName`)}),(0,W.jsx)(V,{value:f,onChange:e=>g(e.target.value),placeholder:M(t,`system.network.address`)}),(0,W.jsx)(V,{value:_,onChange:e=>y(e.target.value),placeholder:M(t,`system.network.publicKey`)}),(0,W.jsx)(B,{disabled:!c||!f||!_||b.isPending,onClick:()=>b.mutate(),children:M(t,`system.network.pair`)}),b.data?(0,W.jsx)(s,{result:b.data,successLabel:M(t,`system.network.pairDone`)}):null]})]}),(0,W.jsx)(m,{title:M(t,`system.network.peers`),result:o.data,className:`xl:col-span-2`,children:e=>(0,W.jsx)(`div`,{className:`grid gap-2`,children:N(e.peers).map(e=>{let n=String(e.peer_id||e.id);return(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`font-medium`,children:String(e.name||n)}),(0,W.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:String(e.base_url||``)})]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(v,{label:M(t,`system.network.pushWorkspace`),action:()=>L.pushPeer(n,z.getState().workspaceId)}),(0,W.jsx)(v,{label:M(t,`system.network.unpair`),action:()=>L.unpairPeer(n),invalidate:[`networkPeers`],variant:`destructive`})]})]},n)})})})]})}function xe(){let e=r(),{theme:t,setTheme:n,mode:o,setMode:c}=z(),d=z(e=>e.language),f=A({queryKey:[`health`],queryFn:L.health}),g=A({queryKey:[`sysinfo`],queryFn:L.sysinfo}),_=A({queryKey:[`computerMemory`],queryFn:L.computerMemory}),C=A({queryKey:[`brainStorage`],queryFn:L.brainStorage}),w=A({queryKey:[`backupHealth`],queryFn:L.backupHealth}),[T,E]=U.useState(``),[D,O]=U.useState(`lattice_brain`),[k,j]=U.useState(!1),[N,P]=U.useState(``),[F,ee]=U.useState(``),[I,te]=U.useState(``),[R,ne]=U.useState(!1),[H,re]=U.useState(!1),G=i({mutationFn:e=>L.dockerPostgres({consent:e,dry_run:!e,port:5432})}),K=i({mutationFn:()=>L.migratePostgres({dsn:T,schema_name:D||`lattice_brain`,dry_run:!0})}),q=i({mutationFn:()=>L.brainArchive({path:N.trim()||null,passphrase:I}),onSuccess:()=>e.invalidateQueries({queryKey:[`backupHealth`]})}),J=i({mutationFn:()=>L.brainArchiveInspect({path:F,passphrase:I||null})}),Y=i({mutationFn:()=>L.brainArchiveVerify({path:F,passphrase:I})}),X=i({mutationFn:()=>L.brainArchiveRestore({path:F,passphrase:I,dry_run:!0,confirm:!1})}),ae=i({mutationFn:()=>L.brainArchiveRestore({path:F,passphrase:I,dry_run:!1,confirm:R}),onSuccess:()=>{e.invalidateQueries({queryKey:[`brainStorage`]}),e.invalidateQueries({queryKey:[`backupHealth`]})}}),oe=i({mutationFn:()=>L.brainArchiveImport({path:F,passphrase:I,dry_run:!0,confirm:!1})}),Z=i({mutationFn:()=>L.brainArchiveImport({path:F,passphrase:I,dry_run:!1,confirm:H}),onSuccess:()=>{e.invalidateQueries({queryKey:[`brainStorage`]}),e.invalidateQueries({queryKey:[`backupHealth`]})}});return(0,W.jsxs)(`div`,{className:`flex flex-col gap-4 max-w-[54rem]`,children:[(0,W.jsxs)(h,{children:[(0,W.jsxs)(l,{children:[(0,W.jsx)(a,{children:M(d,`system.panel.appearance`)}),(0,W.jsx)(u,{children:M(d,`system.panel.appearance.hint`)})]}),(0,W.jsxs)(p,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(B,{variant:t===`dark`?`default`:`outline`,onClick:()=>n(`dark`),children:M(d,`system.theme.dark`)}),(0,W.jsx)(B,{variant:t===`light`?`default`:`outline`,onClick:()=>n(`light`),children:M(d,`system.theme.light`)})]})]}),(0,W.jsxs)(h,{children:[(0,W.jsxs)(l,{children:[(0,W.jsx)(a,{children:M(d,`system.panel.detailLevel`)}),(0,W.jsx)(u,{children:M(d,`system.panel.detailLevel.hint`)})]}),(0,W.jsx)(p,{className:`flex flex-wrap gap-2`,children:[`basic`,`advanced`,`admin`].map(e=>(0,W.jsx)(B,{variant:o===e?`default`:`outline`,onClick:()=>c(e),children:M(d,`shell.mode.${e}`)},e))})]}),(0,W.jsxs)(h,{"data-testid":`system-tools-panel`,children:[(0,W.jsxs)(l,{children:[(0,W.jsxs)(a,{className:`flex items-center gap-2`,children:[(0,W.jsx)(x,{className:`h-4 w-4`,"aria-hidden":`true`}),M(d,`system.panel.tools`)]}),(0,W.jsx)(u,{children:M(d,`system.panel.tools.hint`)})]}),(0,W.jsx)(p,{className:`flex flex-wrap gap-2`,children:[`search`,`read`,`skill`,`mcp`].map(e=>(0,W.jsx)(b,{variant:`muted`,children:M(d,`system.panel.tools.${e}`)},e))})]}),(0,W.jsx)(de,{}),(0,W.jsx)(ie,{}),(0,W.jsx)(m,{title:o===`basic`?M(d,`system.panel.brainStatus`):M(d,`system.panel.serverHealth`),result:f.data,children:e=>(0,W.jsx)(we,{data:e})}),(0,W.jsx)(m,{title:o===`basic`?M(d,`system.panel.readiness`):M(d,`system.panel.hostTelemetry`),result:g.data,children:e=>{if(o===`basic`){let t=String(e?.readiness||`roomy`),n=t===`tight`||t===`low`||t===`roomy`?`system.readiness.${t}`:`system.readiness.plenty`;return(0,W.jsxs)(`div`,{className:`flex items-center gap-2.5 p-3 rounded-lg border border-border/60 bg-muted/20 text-sm text-foreground`,children:[(0,W.jsx)(S,{className:`h-4 w-4 ${t===`low`?`text-rose-500`:t===`tight`?`text-amber-500`:`text-emerald-500`} flex-shrink-0`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{children:M(d,n)})]})}return(0,W.jsx)(y,{value:e})}}),(0,W.jsx)(m,{title:o===`basic`?M(d,`system.storage.title`):M(d,`system.panel.brainStorage`),result:C.data,children:e=>(0,W.jsx)(Te,{data:e,mode:o,language:d})}),o===`basic`?null:(0,W.jsx)(m,{title:M(d,`system.backup.health`),result:w.data,children:e=>(0,W.jsx)(Ee,{data:e})}),o===`basic`?null:(0,W.jsxs)(h,{children:[(0,W.jsxs)(l,{children:[(0,W.jsx)(a,{children:M(d,`system.archive.title`)}),(0,W.jsx)(u,{children:M(d,`system.archive.detail`)})]}),(0,W.jsxs)(p,{className:`flex flex-col gap-3`,children:[(0,W.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2`,children:[(0,W.jsx)(V,{value:N,onChange:e=>P(e.target.value),placeholder:M(d,`system.archive.exportPath`)}),(0,W.jsx)(V,{value:F,onChange:e=>ee(e.target.value),placeholder:M(d,`system.archive.restorePath`)})]}),(0,W.jsx)(V,{type:`password`,value:I,onChange:e=>te(e.target.value),placeholder:M(d,`system.archive.passphrase`)}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(B,{onClick:()=>q.mutate(),disabled:!I||q.isPending,children:M(d,`system.archive.export`)}),(0,W.jsx)(B,{variant:`outline`,onClick:()=>J.mutate(),disabled:!F||J.isPending,children:M(d,`system.archive.inspect`)}),(0,W.jsx)(B,{variant:`outline`,onClick:()=>Y.mutate(),disabled:!F||!I||Y.isPending,children:M(d,`system.archive.verify`)}),(0,W.jsx)(B,{variant:`outline`,onClick:()=>X.mutate(),disabled:!F||!I||X.isPending,children:M(d,`system.archive.restoreDryRun`)}),(0,W.jsx)(B,{variant:`outline`,onClick:()=>oe.mutate(),disabled:!F||!I||oe.isPending,children:M(d,`system.archive.importDryRun`)}),(0,W.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:R,onChange:e=>ne(e.target.checked)}),M(d,`system.archive.confirmRestore`)]}),(0,W.jsx)(B,{variant:`destructive`,onClick:()=>ae.mutate(),disabled:!F||!I||!R||ae.isPending,children:M(d,`system.archive.restore`)}),(0,W.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:H,onChange:e=>re(e.target.checked)}),M(d,`system.archive.confirmImport`)]}),(0,W.jsx)(B,{variant:`outline`,onClick:()=>Z.mutate(),disabled:!F||!I||!H||Z.isPending,children:M(d,`system.archive.import`)})]}),[q.data,J.data,Y.data,X.data,ae.data,oe.data,Z.data].filter(Boolean).map((e,t)=>(0,W.jsx)(s,{result:e,successLabel:M(d,`system.archive.requestDone`)},t))]})]}),o===`basic`?null:(0,W.jsxs)(h,{children:[(0,W.jsxs)(l,{children:[(0,W.jsx)(a,{children:M(d,`system.scale.title`)}),(0,W.jsx)(u,{children:M(d,`system.scale.detail`)})]}),(0,W.jsxs)(p,{className:`flex flex-col gap-3`,children:[(0,W.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2`,children:[(0,W.jsx)(V,{value:T,onChange:e=>E(e.target.value),placeholder:M(d,`system.scale.dsn`)}),(0,W.jsx)(V,{value:D,onChange:e=>O(e.target.value),placeholder:M(d,`system.scale.schema`)})]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(B,{variant:`outline`,onClick:()=>G.mutate(!1),disabled:G.isPending,children:M(d,`system.scale.dockerPlan`)}),(0,W.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:k,onChange:e=>j(e.target.checked)}),M(d,`system.scale.dockerConsent`)]}),(0,W.jsx)(B,{onClick:()=>G.mutate(!0),disabled:!k||G.isPending,children:M(d,`system.scale.dockerStart`)}),(0,W.jsx)(B,{variant:`outline`,onClick:()=>K.mutate(),disabled:!T||K.isPending,children:M(d,`system.scale.migrationPlan`)})]}),G.data?(0,W.jsx)(s,{result:G.data,successLabel:M(d,`system.scale.dockerDone`)}):null,K.data?(0,W.jsx)(s,{result:K.data,successLabel:M(d,`system.scale.migrationDone`)}):null]})]}),o===`basic`?null:(0,W.jsx)(m,{title:M(d,`system.computerMemory.title`),result:_.data,children:e=>(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(y,{value:e}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(v,{label:M(d,`system.computerMemory.enable`),action:()=>L.setComputerMemory(!0),invalidate:[`computerMemory`]}),(0,W.jsx)(v,{label:M(d,`system.computerMemory.disable`),action:()=>L.setComputerMemory(!1),invalidate:[`computerMemory`],variant:`destructive`})]})]})})]})}function Q(e,t,n){return t==null||t===``?n:typeof t==`boolean`?M(e,t?`system.value.enabled`:`system.value.disabled`):String(t)}function Se({data:e}){let t=z(e=>e.language),n=N(e.presence||e.clients||e);return n.length?(0,W.jsx)(d,{items:n,titleKey:`user`,metaKey:`workspace_id`}):(0,W.jsx)(g,{title:M(t,`system.presence.empty`),detail:M(t,`system.presence.emptyDetail`)})}function Ce({data:e}){let t=z(e=>e.mode),n=z(e=>e.language),r=Q(n,e.public_key,``);return t===`basic`?(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)($,{title:M(n,`system.device.thisMac`),status:M(n,`system.value.trusted`),detail:M(n,`system.device.thisMacDetail`)}),(0,W.jsx)(b,{variant:`muted`,children:Q(n,e.algorithm,M(n,`system.value.localIdentity`))})]}):(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(b,{variant:`success`,children:M(n,`system.value.localDevice`)}),(0,W.jsx)(b,{variant:`muted`,children:Q(n,e.algorithm,M(n,`system.value.identityKey`))})]}),(0,W.jsx)(o,{data:{device_id:e.device_id||e.id||M(n,`system.value.notReported`),fingerprint:e.fingerprint||M(n,`system.value.notReported`),public_key:r?P(r.replace(/\s+/g,` `),72):M(n,`system.value.notReported`)}})]})}function we({data:e}){let t=z(e=>e.mode),n=z(e=>e.language);return t===`basic`?(0,W.jsx)($,{title:M(n,`system.health.title`),status:M(n,`system.health.ok`),detail:M(n,`system.health.detail`)}):(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(f,{stats:[{label:M(n,`system.health.status`),value:e.status||e.ok||M(n,`system.value.reported`)},{label:M(n,`system.health.version`),value:e.version||M(n,`system.value.notReported`)},{label:M(n,`system.health.mode`),value:e.mode||e.environment||M(n,`system.value.local`)},{label:M(n,`system.health.port`),value:e.port||e.backend_port||M(n,`system.value.configured`)}]}),(0,W.jsx)(y,{value:e})]})}function Te({data:e,mode:t,language:n}){let r=I(e.active)?e.active:e,i=I(e.postgres)?e.postgres:{},a=I(e.backup_health)?e.backup_health:{},o=r.vector_search||r.vector||e.vector_search||e.sqlite_vec,s=!!(i.available||i.connected||i.enabled),c=!!o&&String(o).toLowerCase()!==`not reported`;return t===`basic`?(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)($,{title:M(n,`system.storage.local.title`),status:M(n,`system.storage.local.badge`),detail:M(n,`system.storage.local.detail`)}),(0,W.jsx)($,{title:M(n,`system.storage.search.title`),status:c?M(n,`system.storage.search.on`):M(n,`system.storage.search.pending`),detail:c?M(n,`system.storage.search.detailOn`):M(n,`system.storage.search.detailPending`)})]}):(0,W.jsxs)(`div`,{className:`space-y-4`,children:[(0,W.jsx)(f,{stats:[{label:M(n,`system.storage.activeEngine`),value:r.engine||e.engine||M(n,`system.storage.sqlite`)},{label:M(n,`system.storage.sqliteDefault`),value:r.engine===`postgres`?M(n,`system.value.scaleMode`):M(n,`system.value.enabled`)},{label:M(n,`system.storage.vector`),value:o||M(n,`system.value.notReported`)},{label:M(n,`system.storage.postgres`),value:s?M(n,`system.value.available`):M(n,`system.value.optional`)}]}),(0,W.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-3`,children:[(0,W.jsx)($,{title:M(n,`system.storage.sqlite`),status:r.available===!1?M(n,`system.value.unavailable`):M(n,`system.value.default`),detail:Q(n,r.reason||r.path||e.path,M(n,`system.storage.sqliteDetail`))}),(0,W.jsx)($,{title:M(n,`system.storage.vector`),status:Q(n,o,M(n,`system.value.reported`)),detail:Q(n,r.vector_reason||r.sqlite_vec_reason||e.vector_reason,M(n,`system.storage.vectorDetail`))}),(0,W.jsx)($,{title:M(n,`system.storage.postgres`),status:s?M(n,`system.value.available`):M(n,`system.value.notEnabled`),detail:Q(n,i.reason||i.dsn||i.status,M(n,`system.storage.postgresDetail`))})]}),Object.keys(a).length?(0,W.jsx)(y,{value:{backup_health:a}}):null]})}function Ee({data:e}){let t=z(e=>e.language);return(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(f,{stats:[{label:M(t,`system.backup.available`),value:e.available===!1?M(t,`system.value.no`):M(t,`system.value.yes`)},{label:M(t,`system.backup.backups`),value:e.count||e.backups||0},{label:M(t,`system.backup.encrypted`),value:e.encrypted_archives||0},{label:M(t,`system.backup.zip`),value:e.zip_backups||0}]}),(0,W.jsx)(o,{data:{directory:e.directory||M(t,`system.value.notReported`),latest:e.latest||M(t,`system.value.noneReported`),last_verified:e.last_verified||e.verified_at||M(t,`system.value.notReported`),failure:e.error||e.reason||M(t,`system.value.noneReported`)}})]})}function $({title:e,status:t,detail:n}){let r=/unavailable|failed|denied|disabled|not enabled|사용 불가|실패|거부|비활성|활성화되지 않음/i.test(t)?`warning`:`success`;return(0,W.jsxs)(`div`,{className:`rounded-md border border-border bg-background p-3`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,W.jsx)(`div`,{className:`font-medium`,children:e}),(0,W.jsx)(b,{variant:r,children:t})]}),(0,W.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:n})]})}function De({data:e}){let t=z(e=>e.language),n=I(e.startup)?e.startup:{},r=I(e.privacy)?e.privacy:{},i=I(e.storage)?e.storage:{},a=I(e.backup)?e.backup:{},o=I(e.device_identity)?e.device_identity:{},s=I(e.permissions)?e.permissions:{};return(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(f,{stats:[{label:M(t,`system.hardening.version`),value:e.version||M(t,`system.value.reported`)},{label:M(t,`system.hardening.localOnly`),value:r.local_only_default??n.local_only_default??M(t,`system.value.reported`)},{label:M(t,`system.hardening.storage`),value:I(i.active)?i.active.engine:M(t,`system.value.reported`)},{label:M(t,`system.hardening.backups`),value:a.count||a.available||M(t,`system.value.reported`)}]}),(0,W.jsxs)(`div`,{className:`flex flex-col sm:flex-row flex-wrap gap-3`,children:[(0,W.jsx)($,{title:M(t,`system.hardening.startup`),status:M(t,n.network_exposed?`system.value.networkExposed`:`system.value.localOnly`),detail:M(t,`system.hardening.startupDetail`)}),(0,W.jsx)($,{title:M(t,`system.hardening.integrations`),status:M(t,r.local_only_default===!1?`system.value.reviewRequired`:`system.value.optIn`),detail:M(t,`system.hardening.integrationsDetail`)}),(0,W.jsx)($,{title:M(t,`system.hardening.identity`),status:Q(t,o.algorithm||o.fingerprint,M(t,`system.value.reported`)),detail:Q(t,o.storage,M(t,`system.hardening.identityStorage`))}),(0,W.jsx)($,{title:M(t,`system.hardening.permissions`),status:M(t,s.destructive_restore_requires_confirmation===!1?`system.value.reviewRequired`:`system.value.guarded`),detail:M(t,`system.hardening.permissionsDetail`)})]})]})}function Oe({data:e}){let t=z(e=>e.language),n=I(e.cards)?e.cards:{},r=I(e.severity_counts)?e.severity_counts:{};return(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(f,{stats:[{label:M(t,`system.security.eventsToday`),value:n.events_today||0},{label:M(t,`system.security.highRisk`),value:n.high_risk_events||r.high||0},{label:M(t,`system.security.review`),value:n.review_required||0},{label:M(t,`system.security.riskRate`),value:e.risk_rate||0}]}),(0,W.jsx)(y,{value:{severity_counts:r,sensitive_fields:e.field_counts||{}}})]})}function ke(){let e=z(e=>e.mode),t=z(e=>e.language),n=A({queryKey:[`adminSummary`],queryFn:L.adminSummary}),r=A({queryKey:[`adminUsers`],queryFn:L.adminUsers}),i=A({queryKey:[`adminAudit`],queryFn:()=>L.adminAudit()}),a=A({queryKey:[`adminRoles`],queryFn:L.adminRoles}),s=A({queryKey:[`adminPolicies`],queryFn:L.adminPolicies}),c=A({queryKey:[`adminProductHardening`],queryFn:L.adminProductHardening}),l=A({queryKey:[`adminSecurity`],queryFn:L.adminSecurity}),u=A({queryKey:[`vpcStatus`],queryFn:L.vpcStatus});return e===`admin`?(0,W.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,W.jsx)(m,{title:M(t,`system.admin.summary`),result:n.data,children:e=>(0,W.jsx)(o,{data:e})}),(0,W.jsx)(m,{title:M(t,`system.admin.users`),result:r.data,children:e=>(0,W.jsx)(d,{items:e,titleKey:`email`,metaKey:`role`})}),(0,W.jsx)(m,{title:M(t,`system.admin.audit`),result:i.data,children:e=>(0,W.jsx)(d,{items:e.recent_events||e,titleKey:`act`,metaKey:`sev`})}),(0,W.jsx)(m,{title:M(t,`system.admin.roles`),result:a.data,children:e=>(0,W.jsx)(d,{items:e.roles||e,titleKey:`role`,metaKey:`members`})}),(0,W.jsx)(m,{title:M(t,`system.admin.policies`),result:s.data,children:e=>(0,W.jsx)(d,{items:e.policies||e,titleKey:`label`,metaKey:`enforced`})}),(0,W.jsx)(m,{title:M(t,`system.admin.hardening`),result:c.data,children:e=>(0,W.jsx)(De,{data:e})}),(0,W.jsx)(m,{title:M(t,`system.admin.security`),result:l.data,children:e=>(0,W.jsx)(Oe,{data:e})}),(0,W.jsx)(m,{title:M(t,`system.admin.vpc`),result:u.data,children:e=>(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(b,{variant:`muted`,children:M(t,`system.admin.communityUnavailable`)}),(0,W.jsx)(y,{value:e})]})})]}):(0,W.jsx)(_,{title:M(t,`system.admin.controls`),detail:M(t,`system.admin.controlsDetail`),target:`admin`})}export{me as SystemPage};
|